Required documents pos_ad_Dll.dll -------- third party development interface pos_ad_Dll.dll interface function return value #define HS_OK 0xf0 / / OK #define HS_Error 0xff / / exception remarks: All interface functions have a_The copy at the end of stdcall. For the third party using PowerBuilder as the development tool, please Call suffix is_The interface function of stdcall. //**********************Print related************************* //Format string to be printed int PrintText(char *str,int FontSize) Parameters: STR length must be less than 20480 The fontsize must be between 12 and 72. The height of the corresponding font size is equal to the font size divided by 8, and the unit is mm. For example, the height of 72 font is 9mm. Paperwidth paper width must be between 30-80mm Return value: HS_OK HS_ERROR //Bitmap file printing int PrintBitmapFile(char *BmpFileName,int LabelAngle) Parameters: Bmpfilename: bitmap image file (supports bitmaps with color below 24 bits) Labelangle = 0: no rotation, other values rotate 180 degrees Return value: HS_OK HS_ERROR //Start printing int BeginPrint(int PrintType) Parameters: PrintType 4: paper feeding 8: cut paper Return value: HS_OK HS_ERROR //Print QR code //Parameters: //QRcode: QR code content //Mode, bitmap size setting, module size 1 ≤ n ≤ 16, printer default 3 DllExport int PrintQrCode(char *QRCode,int Mode); DllExport int PrintQrCode_stdcall(char *QRCode,int Mode); //Print barcode //Parameters: //Barcode: barcode data //Height: height, value range, 1-255, unit point. //Width: width, value range 2-6, default 2 //Textposition: N printing position 0 does not print 1 above barcode 2 below barcode 3 above and below barcode int PrintBarCode(char *barcode,int textPosition=2,int height=50,int width=2); //Send printer command //Parameters: //CMD: instruction data //Len: data length DllExport int PrintCommand(char *cmd,int len); For example, the printer's command to open the cash box: unsigned char pscmd [] = {0x1b, 0x70, 0x0, 0xe1, 0xe1}//27,112,0,225,225 PrintCommand((char *)psCmd,5); //Set row spacing //Parameters: //Space: line spacing, printer default is 30, spacex0.125 mm DllExport int SetLineSpace(int space); //Paper cutting command DllExport int CutPaper() //**********************Weighing related************************* //Read the range information --- before accessing the weighing related interface function, the obtained range information truthfully displayed on the application interface. int read_baseinfo(char *buf) The length of buf should be greater than or equal to 65 bytes Return value: HS_OK HS_ERROR If you return to HS_OK, then the measurement range information is obtained successfully. The data structure is as follows long max_range[3]; //maximum capacity long min_range; //minimum capacity long max_tare; //Maximum tare weight long max_pre_tare; //Maximum preset tare weight long resolution[3]; //Graduation char Weight_unit[4];//weight char money_unit[4]; //Monetary unit char system_version[20];//Data transmission version //Clearing int send_zero(void) Return value: HS_OK, success 1 It is not allowed to clear when it is unstable and under load 2 Load out of peeling range 3 Overload beyond peeling range -1 abnormal -2 Abnormal data communication -3 In data transmission: syntax, logic / unable to execute, internal function error -8 And idnet_Service connection failed -9 And idnet_Service data communication error //Set tare to be compatible with old interfaces int send_tare(char *buf) Parameters: The length of buf must be greater than or equal to 10 bytes. The value in buf is an empty string or "0" or "0.000" 1If there is tare weight, if gross weight = 0, clear tare weight; otherwise, if net weight is greater than 0, press key to remove tare weight 2If there is no tare, press the key to remove the tare If buf is tare string, it means preset tare. For example, if the tare value string needs to be set, such as 20g, the parameter is string "0.020". Return value: HS_OK, the current tare weight is stored in buf 1 Operation prohibited in case of non-compliance 2 Underload 3 Overload beyond peeling range 4 Parameter exception 5 Data processing exception When returning to HS_When OK, it indicates that the current tare operation is successful, and the actual tare value after operation will be stored in buf. If the tare value after tare operation is 20g, the content in buf is "00.0200". //Set the preset tare weight and remove the tare according to the tare weight parameters //The parameter buf is used as both the incoming parameter and the return tare, and the length should be greater than or equal to 10 bytes int send_pre_tare(char *buf) Parameters: If the tare value string needs to be set, such as 20g, the parameter is string "0.020". If the parameter is an empty string or equal to "0.000", the function is equivalent to clearing tare. Return value: HS_OK, the current tare weight is stored in buf 1 Operation prohibited in case of non-compliance 2 Underload 3 Overload beyond peeling range 4 Parameter exception 5 Data processing exception //Press the key to remove the skin, and automatically remove the skin according to the current weight on the scale //The parameter buf is used to return tare weight, and the length should be greater than or equal to 10 bytes int set_tare_bykey(char *buf) Return value: HS_OK, the current tare weight is stored in buf 1 Operation prohibited in case of non-compliance 2 Underload 3 Overload beyond peeling range 5 Data processing exception //Remove tare //The parameter buf is used to return tare weight, and the length should be greater than or equal to 10 bytes int clear_tare(char *buf) Return value: HS_OK, the current tare weight is stored in buf 1 Operation prohibited in case of non-compliance 2 Underload 3 Overload beyond peeling range 5 Data processing exception //Read the weight int read_standard(char *buf) The length of buf should be greater than or equal to 18 bytes Return value: HS_OK, success -1 Underload -2 overload HS_Error exception If you return to HS_OK, the weight information is obtained successfully, and the data structure is as follows char status; //Bit0 (the first bit) of status indicates whether it is stable or not. If it is 1, it means stable //Bit1 (the second bit) of status indicates whether it is in the zero position. If it is 1, it means the zero position //Bit2 (the third digit) of status indicates whether there is tare weight. If it is 1, there is tare weight char net_weight[7]; char FixSeparator;//Fixed as "P" char tare_weight[7]; When under load, net_The data in weight is "━", and the return value is - 1 When in overload state, net_The data in weight is "━┓", and the return value is - 2 ;Open the cash box int OpenCashDrawerEx(void) The first run requires administrator mode ;Cash box status bool GetCashDrawerStatus(void); Return value: True open state False off state