ربط ميزان الباركود بجهاز الكمبيوتر
#9
بعد تحميل المصدر الذي أعطيتنا إياه ، بعد الفحص

- أولا هذا المثال يعتمد في إتصاله على ملف PBusDrv.dll ، فهو الملف الاساسي لبرمجة الميزان أو تحميل البيانات منه
[صورة: 604480178.png]
الكلمات الملونة بالأصفر أسماء الاجراءات لاتصال و التحميل و تخزين
- معلومات عن الميزان من ملف  PBUSDRV02.pdf  يحتوي على أسماء الحقول و كيف التعامل مع ملف PBusDrv.dll

كود :
PBusDrv.DLL use explanation PBusDrv.DLL is a 32 digit dynamic link libraries, mostly is used to download PLU data to Pinncale label scale. Main Data structure and function: (Delphi syntax. For other languages, please refer to use): 1.Data structure TPlu=record //PLU data structure Name: PChar; //product name, 36 characters LFCode: Longint; //Lfcode,1-999999,only way to identify each kind of product Code: PChar; //product code,10 digit, used to form barcode BarCode: Longint; //barcode type,0-99 UnitPrice: Longint; //unit price, did not have decimal mode, 0-9999999 WeightUnit: Longint; //weight unit 0-12 Deptment: Longint; //department,2 number, used to form barcode Tare: Double; //tare weight, it should within 15Kg after logic conversion ShlefTime: Longint; //shelf time,0-365 PackageType: Longint; //package type,0:normal/ limitative weight mode,1:weight fixed, //2:price fixed,3:barcode printer mode PackageWeight:Double; //package weight/limitative weight, it should within 15Kg after logic conversion Tolerance: Longint; //package error tolerance,0-20 Message1: Byte; //message 1,0-197 Reserved: Byte; //reserved Reserved1: Word; //reserved Message2: Byte; //message 2,0-197 Reserved2: Byte; //reserved MultiLabel: Byte; //multi-label,0-255,8 Bit corresponding to A0-D1 respectively Rebate: ShortInt; //rebate,0-99 Account: LongInt; //enter an item in an account, reserved end; PPLU=^TPLU; TPLUCluster=Array[0..3]of TPLU; //one PLU cluster including 4 pcs PLU PPLUCluster=^TPLUCluster; THotkeyTable=Array[0..83]of LongInt; //each array element is a PLU lfcode, //84 pcs element corresponding to 84 pcs PLU PHotkeyTable=^THotkeyTable; For detailed explanation, please refer to user manual’s program interface part. 2.Function(suppose label scale sw (LBMNC) is installed under XX directory) Connect function Function PBusConnect(RefLFZKFileName:PChar;//lf font list file name,including path, //usually point to XX\bin\lfzk.dat //if used character set,point to XX\bin\lfzkfull.dat RefCFGFileName:PChar; //configuration file name, including path, usually point to //XX\bin\system.cfg SerialNO:DWord; //label scale serial number, if is Ethernet, please transfer IP address as //DWord,such as 192.168.0.1 transfer to $C0A80001 CommName:PChar; //equipment name, such as:COM1,COM2,if is Ethernet, it is:IP BaudRate:Integer //communication speed, set as 0 ):Integer;far; external 'PbusDrv.dll'; Function PBusConnectEx(RefLFZKFileName:PChar;// lf font list file name, including path, //usually point to XX\bin\lfzk.dat //if use character set,point to XX\bin\lfzkfull.dat RefCFGFileName:PChar; //configuration file name, including path, usually point to //XX\bin\system.cfg IPAddr: PChar; //label scale IP address, such as:192.168.0.1 ):Integer;far; external 'PbusDrv.dll'; Disconnect function Function PBusDisConnect(SerialNO: DWord //label scale serial no. ):Integer;far; external 'PbusDrv.dll'; Function PBusDisConnectEx(IPAddr: PChar; //label scale IP address,such as:192.168.0.1 ):Integer;far; external 'PbusDrv.dll'; send PLU function Function PBusTransferPLUCluster(PPC:PPLUCluster //PLU cluster ):Integer;far; external 'PbusDrv.dll'; send Hotkey function Function PBusTransferHotkey(HotkeyTable:PHotkeyTable; //hotkey list TableIndex:Integer //hotkey list no., total two list,0 and 1 ):Integer;far; external 'PbusDrv.dll'; send message function Function PBusTransferMessage(Id:Integer; //info code,1~197 PMessage:PChar; //information text DataLen:Integer //information text length ):Integer;far; external 'PBusDrv.DLL'; transform PLU to character string Function PBusPLUToStr(LPPLU:PPLU; //PLU data LPStr:PChar //character string(one line of TXP file), this finger must distribute space. ):Integer;Stdcall;far; external 'PbusDrv.dll'; transform character string to PLU Function PBusStrToPLU(LPStr:PChar; //character string(one line to TXP file) LPPLU:PPLU //PLU data ):Integer;Stdcall;far; external 'PbusDrv.dll'; clear all PLU Function PBusClearPLUData:Integer;Stdcall;far; external 'PBusDrv.dll'; upload PLU data Function PBusUpLoadPLU(index:Integer; PPC:PPLUCluster):Integer;stdcall;Export; upload Hotkey Data Function PBusUpLoadHotKey(HotkeyTable:PHotkeyTable;TableIndex:Integer):Integer;stdcall; Export; upload sales report Function PBusUpLoadOR(fileName:PChar):Boolean;stdcall;Export; set Scrolling Message Function PBusSetADInfo(value:PChar):Boolean;stdcall;Export; 3.Flow (1) PBusConnect if returned value<0, jump out | (2) PBusTransferPLUCluster/PBusTransferHotkey if returned value<0, jump to (4) | (3) PBusTransferPLUCluster/PBusTransferHotkey if returned value<0, jump to (4) | . if returned value<0, jump to (4) . . (4) PBusDisConnect 4.Examples Example under Delphi60 catalog is writen with Delphi, could pass test under Delphi6.0. Example under VB60 catalog is written with Visual Basic, could pass test under VB6.0. Example under VC60 catalog is written with Visual C++, could pass test under VC6.0. Example under PB65 catalog is written with PowerBuilder, could pass test under PB6.5. Remarks: Remarks: 1.Explanation of lf font bank and system parameter Explanation of lf font bank and system parameter PbusConnect connect function cites two file: lfzk.dat and system.cfg, lfzk.dat is lf font bank character list,store some system setting in system.cfg . We intensively suggest to cite corresponding file under link32 install catalog,to make sure that when Link32 sw modifying system parameter, it could reflect to dynamic link libraries in time。For example:There is a option “lf common font bank usage character set” of link32 system option,after modification of it, this parameter setting will be stored in system.cfg,if PbusConnect connect function cites system.cfg of link32 setting catalog ,the dynamic link libraries will download using new configure, or it will confuse the font bank. Of course, you could place these two file on other places, but must make sure update these two file in time and in-phase. 2.Setting of data Setting of data Setting of data alignmode of mode of mode of delphi6 and Delphi7. Set delphi6 and delphi7 as below, Project->Options->Code generation->Record field alignment select 4 If do not want to change default setting (default value is 8) of Delphi data align mode or use Delphi5,could use PBusDrv.DLL of other catalog.

و لاتصال بالميزان نحتاج إلى إلى الاعدادات كاللتي في الصورة
[صورة: 373350895.png]

و لكيفية العمل تحتاج إلى الربط مع الجهاز و التجريب

* و يمكنك برمجته مباشرة بالملف التنفيذي SCaleAssistant.exe الموجود في  SCaleAssistant في الملف SCaleList.bin تجد عنوان الشبكة و تغيره

و الملفات التي تضع فيها القيم يدويا موجودة في SCaleAssistant و الموجودة مجلد Demo و هي متنوعة ، يجب فتحها و تغيير محتواها بعدها تحميلها الى الميزان أو القراءة منه


في الاخير لتجد النتيجة عليك ، البتجريب و التكرار

أما المثال الخاص بالدلفي يحتوي مكونات خارجية مكونان tnt و Raize

شرح الحقول

.rar   TXP.rar (الحجم : 10.64 ك ب / التحميلات : 48)
الرد


الردود في هذا الموضوع
RE: ربط ميزان الباركود بجهاز الكمبيوتر - بواسطة larbiparadox - 08-01-2021, 06:06 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم