第三方
Code
1unit VehiclePonderation;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 SingleMoudle, Db, ADODB, PrnDbgeh, Wwdatsrc, ActnList, ImgList, Grids,
8 DBGridEh, ExtCtrls, StdCtrls, wwSpeedButton, wwDBNavigator, wwclearpanel,
9 ComCtrls, ToolWin, Mask, DBCtrls, MemTableEh, DataDriverEh, GridsEh,
10 wwdbdatetimepicker, Buttons, wwdblook, OoMisc, AdPort, Spin, Menus,
11 FR_Class, FR_DSet, FR_DBSet;
12
13type
14 TVehiclePonderationFrm = class(TSingleMoudleFrm)
15 wwModuleQryId: TIntegerField;
16 wwModuleQryVehicleNo: TStringField;
17 wwModuleQryWeight0: TFloatField;
18 wwModuleQryWeight1: TFloatField;
19 wwModuleQryWeight2: TFloatField;
20 wwModuleQryWeight3: TFloatField;
21 wwModuleQryRemark: TStringField;
22 ICVehicleInOutQry: TADOQuery;
23 ICVehicleInOutQryId: TIntegerField;
24 ICVehicleInOutQryWork_No: TIntegerField;
25 DataSource1: TDataSource;
26 Panel3: TPanel;
27 Panel5: TPanel;
28 DBGridEh3: TDBGridEh;
29 Label1: TLabel;
30 DBEdit1: TDBEdit;
31 Label2: TLabel;
32 DBEdit2: TDBEdit;
33 Label3: TLabel;
34 DBEdit3: TDBEdit;
35 Label4: TLabel;
36 DBEdit4: TDBEdit;
37 Label5: TLabel;
38 DBEdit5: TDBEdit;
39 Label6: TLabel;
40 DBEdit6: TDBEdit;
41 wwModuleQryPonderation_No: TIntegerField;
42 ICVehicleInOutQryVehicleNo: TStringField;
43 Label8: TLabel;
44 DBEdit8: TDBEdit;
45 wwModuleQryOccur_Date: TDateTimeField;
46 Label15: TLabel;
47 wwDBDateTimePicker1: TwwDBDateTimePicker;
48 DBEdit7: TDBEdit;
49 Label7: TLabel;
50 SpeedButton1: TSpeedButton;
51 SpeedButton2: TSpeedButton;
52 Panel1: TPanel;
53 Label9: TLabel;
54 Label10: TLabel;
55 dtStart: TDateTimePicker;
56 dtEnd: TDateTimePicker;
57 Button1: TButton;
58 Button6: TButton;
59 Button2: TButton;
60 CheckBox1: TCheckBox;
61 ComPort1: TApdComPort;
62 Panel2: TPanel;
63 wwModuleQryShipper_Id: TIntegerField;
64 wwModuleQryMateriel_Name: TStringField;
65 wwModuleQryOccur_Date1: TDateTimeField;
66 wwModuleQryAmount: TFloatField;
67 Label12: TLabel;
68 CustomerInfoLK1: TwwDBLookupCombo;
69 Label13: TLabel;
70 SpinEdit1: TSpinEdit;
71 wwModuleQryIC_No: TStringField;
72 Label14: TLabel;
73 DBEdit10: TDBEdit;
74 frDBDataSet1: TfrDBDataSet;
75 frReport1: TfrReport;
76 PopupMenu1: TPopupMenu;
77 N4r5te1: TMenuItem;
78 ertre1: TMenuItem;
79 wwModuleQryPonderation_Type: TStringField;
80 wwModuleQryKa_No: TStringField;
81 Label11: TLabel;
82 DBEdit9: TDBEdit;
83 Label16: TLabel;
84 DBEdit11: TDBEdit;
85 Label17: TLabel;
86 wwDBDateTimePicker2: TwwDBDateTimePicker;
87 Label18: TLabel;
88 DBComboBox1: TDBComboBox;
89 wwModuleQryUserID: TStringField;
90 wwModuleQryInput_Date: TDateTimeField;
91 Label19: TLabel;
92 DBEdit12: TDBEdit;
93 Label20: TLabel;
94 DBEdit13: TDBEdit;
95 wwModuleQryshipper_name: TStringField;
96 Label21: TLabel;
97 DBEdit14: TDBEdit;
98 Button3: TButton;
99 wwModuleQrykong_weight: TFloatField;
100 wwModuleQryzong_weight: TFloatField;
101 Timer1: TTimer;
102 wwModuleQryhandleperson_name: TStringField;
103 wwModuleQryWork_No: TStringField;
104 wwModuleQryweight4: TFloatField;
105 N1: TMenuItem;
106 frReport2: TfrReport;
107 wwModuleDetQryId: TIntegerField;
108 wwModuleDetQryMaster_Id: TIntegerField;
109 wwModuleDetQryAmount: TFloatField;
110 wwModuleDetQryWeight: TFloatField;
111 wwModuleDetQryUserID: TStringField;
112 wwModuleDetQryInput_Date: TDateTimeField;
113 wwModuleDetQryRemark: TStringField;
114 N2: TMenuItem;
115 frReport3: TfrReport;
116 procedure DBGridEh3DblClick(Sender: TObject);
117 procedure wwModuleQryAfterInsert(DataSet: TDataSet);
118 procedure wwModuleQryBeforePost(DataSet: TDataSet);
119 procedure Button1Click(Sender: TObject);
120 procedure FormCreate(Sender: TObject);
121 procedure CheckBox1Click(Sender: TObject);
122 procedure SpeedButton1Click(Sender: TObject);
123 procedure SpeedButton2Click(Sender: TObject);
124 procedure Button2Click(Sender: TObject);
125 procedure ComPort1Trigger(CP: TObject; Msg, TriggerHandle, Data: Word);
126 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
127 procedure tbPrintClick(Sender: TObject);
128 procedure ertre1Click(Sender: TObject);
129 procedure Button3Click(Sender: TObject);
130 procedure wwModuleQryCalcFields(DataSet: TDataSet);
131 procedure Timer1Timer(Sender: TObject);
132 procedure FormActivate(Sender: TObject);
133 procedure N1Click(Sender: TObject);
134 procedure Button6Click(Sender: TObject);
135 procedure Panel1Click(Sender: TObject);
136 procedure N2Click(Sender: TObject);
137 private
138 CodeArr:array[0..82] of String;
139 WeighS: String;
140 counti: integer;
141 IC_No:Integer;
142 RefreshCount: integer;
143 function Gethex(data: Char): String;
144 function GetVehicleNo: String;
145 { Private declarations }
146 public
147 procedure GetVehiclePonderation(Weight: Double);
148 { Public declarations }
149 end;
150
151var
152 VehiclePonderationFrm: TVehiclePonderationFrm;
153 procedure ExecVehiclePonderation;
154
155implementation
156
157uses CommonData, ICCommon, CommonFunction, Ponderation;
158//97.5
159{$R *.DFM}
160
161procedure ExecVehiclePonderation;
162begin
163 VehiclePonderationFrm := TVehiclePonderationFrm.Create(nil);
164 try
165 VehiclePonderationFrm.ShowModal;
166 finally
167 VehiclePonderationFrm.Free;
168 end;
169
170end;
171
172procedure TVehiclePonderationFrm.DBGridEh3DblClick(Sender: TObject);
173begin
174 inherited;
175 Button6Click(nil);
176
177end;
178
179procedure TVehiclePonderationFrm.wwModuleQryAfterInsert(DataSet: TDataSet);
180begin
181 inherited;
182end;
183
184procedure TVehiclePonderationFrm.wwModuleQryBeforePost(DataSet: TDataSet);
185begin
186end;
187
188procedure TVehiclePonderationFrm.Button1Click(Sender: TObject);
189begin
190 inherited;
191end;
192
193procedure TVehiclePonderationFrm.FormCreate(Sender: TObject);
194begin
195 inherited;
196 RefreshCount := 0;
197 CodeArr[0] := '0';
198 CodeArr[1] := '1';
199 CodeArr[2] := '2';
200 CodeArr[3] := '3';
201 CodeArr[4] := '4';
202 CodeArr[5] := '5';
203 CodeArr[6] := '6';
204 CodeArr[7] := '7';
205 CodeArr[8] := '8';
206 CodeArr[9] := '9';
207 CodeArr[10] := 'A';
208 CodeArr[11] := 'B';
209 CodeArr[12] := 'C';
210 CodeArr[13] := 'D';
211 CodeArr[14] := 'E';
212 CodeArr[15] := 'F';
213 CodeArr[16] := 'G';
214 CodeArr[17] := 'H';
215 CodeArr[18] := 'I';
216 CodeArr[19] := 'J';
217 CodeArr[20] := 'K';
218 CodeArr[21] := 'L';
219 CodeArr[22] := 'M';
220 CodeArr[23] := 'N';
221 CodeArr[24] := 'O';
222 CodeArr[25] := 'P';
223 CodeArr[26] := 'Q';
224 CodeArr[27] := 'R';
225 CodeArr[28] := 'S';
226 CodeArr[29] := 'T';
227 CodeArr[30] := 'U';
228 CodeArr[31] := 'V';
229 CodeArr[32] := 'W';
230 CodeArr[33] := 'X';
231 CodeArr[34] := 'Y';
232 CodeArr[35] := 'Z';
233 CodeArr[36] := ':';
234 CodeArr[37] := '*';
235 CodeArr[38] := '';
236 CodeArr[39] := '';
237
238 CodeArr[51] := '京';
239 CodeArr[52] := '津';
240 CodeArr[53] := '沪';
241 CodeArr[54] := '渝';
242 CodeArr[55] := '粤';
243 CodeArr[56] := '闽';
244 CodeArr[57] := '桂';
245 CodeArr[58] := '湘';
246 CodeArr[59] := '黑';
247 CodeArr[60] := '辽';
248 CodeArr[61] := '蒙';
249 CodeArr[62] := '新';
250 CodeArr[63] := '宁';
251 CodeArr[64] := '青';
252 CodeArr[65] := '甘';
253 CodeArr[66] := '藏';
254 CodeArr[67] := '晋';
255 CodeArr[68] := '冀';
256 CodeArr[69] := '鲁';
257 CodeArr[70] := '豫';
258 CodeArr[71] := '贵';
259 CodeArr[72] := '云';
260 CodeArr[73] := '赣';
261 CodeArr[74] := '鄂';
262 CodeArr[75] := '苏';
263 CodeArr[76] := '皖';
264 CodeArr[77] := '琼';
265 CodeArr[78] := '川';
266 CodeArr[79] := '吉';
267 CodeArr[80] := '浙';
268 CodeArr[81] := '陕';
269 CodeArr[82] := '特';
270
271 dtStart.Date := dtEnd.Date;
272
273end;
274
275procedure TVehiclePonderationFrm.SpeedButton1Click(Sender: TObject);
276begin
277 inherited;
278end;
279
280procedure TVehiclePonderationFrm.SpeedButton2Click(Sender: TObject);
281begin
282 inherited;
283end;
284
285procedure TVehiclePonderationFrm.Button2Click(Sender: TObject);
286var tagtype, Work_No:Integer;
287 snr:Longword;
288 Vehicle_No: String;
289data:array[0..15] of Char;
290begin
291
292 if Sender <> nil then
293 begin
294 IcShow(RFConfig($c6,$0e));
295 IcShow(RFRequest(1,tagtype));
296 IcShow(RFAnticoll(0,snr));
297 IC_No := snr;
298 IcShow(RFReadA(snr,56,@data,#$FF#$FF#$FF#$FF#$FF#$FF));
299 try
300 Vehicle_No := CodeArr[StrToInt(Gethex(data[0]))] +
301 CodeArr[StrToInt(Gethex(data[1]))] +
302 CodeArr[StrToInt(Gethex(data[2]))] +
303 CodeArr[StrToInt(Gethex(data[3]))] +
304 CodeArr[StrToInt(Gethex(data[4]))] +
305 CodeArr[StrToInt(Gethex(data[5]))] +
306 CodeArr[StrToInt(Gethex(data[6]))];
307 except
308 end;
309// DM.ExeSql(Format('select top 1 Work_No, Vehicle_No from NanChuWuLiu_IC_Vehicle_InOut where IC_No = ''%s'' order by Work_No Desc', [IntToStr(snr)]));
310// Work_No := DM.Dual1Qry.FieldByName('Work_No').Value;
311// Work_No := snr;
312// Vehicle_No := DM.Dual1Qry.FieldByName('Vehicle_No').asString;
313 end;
314
315 tbInsertClick(nil);
316 wwModuleQryVehicleNo.Value := Vehicle_No;
317 wwModuleQryIC_No.Value := IntToStr(IC_No);
318end;
319
320function TVehiclePonderationFrm.Gethex(data: Char): String;
321begin
322 Result := Format('%d',[StrtoInt('$'+inttohex(byte(data),2))]);
323
324end;
325
326function TVehiclePonderationFrm.GetVehicleNo: String;
327var snr:Longword;
328data:array[0..15] of Char;
329 buf1:array[0..1] of byte;
330 i: integer;
331 S: String;
332begin
333IcShow(RFReadA(snr,56,@data,#$FF#$FF#$FF#$FF#$FF#$FF));
334// Edit1.Text:=inttohex(byte(data[0]),2);
335// Edit1.Text:=Format('%d',[StrtoInt('$'+Edit1.Text)]);
336 try
337 Result := CodeArr[StrToInt(Gethex(data[0]))] +
338 CodeArr[StrToInt(Gethex(data[1]))] +
339 CodeArr[StrToInt(Gethex(data[2]))] +
340 CodeArr[StrToInt(Gethex(data[3]))] +
341 CodeArr[StrToInt(Gethex(data[4]))] +
342 CodeArr[StrToInt(Gethex(data[5]))] +
343 CodeArr[StrToInt(Gethex(data[6]))];
344 except
345 end;
346end;
347
348procedure TVehiclePonderationFrm.FormCloseQuery(Sender: TObject;
349 var CanClose: Boolean);
350begin
351 inherited;
352 SaveINI('Start', 'DibangCom', IntToStr(SpinEdit1.Value));
353
354end;
355
356procedure TVehiclePonderationFrm.tbPrintClick(Sender: TObject);
357begin
358//inherited;
359// frReport1.LoadFromFile(WorkDir + '称重单.frf');
360// frReport1.ShowReport;
361 if LoadINI('Start', 'Ponderation') <> '1' then
362 begin
363 frReport2.PrepareReport;
364 frReport2.PrintPreparedReport('', 1, True, frAll);
365 end
366 else
367 begin
368 frReport1.PrepareReport;
369 frReport1.PrintPreparedReport('', 1, True, frAll);
370 end;
371
372// frReport1.PrintPreparedReportDlg;
373
374end;
375
376procedure TVehiclePonderationFrm.ertre1Click(Sender: TObject);
377begin
378 inherited;
379 frReport1.LoadFromFile(WorkDir + '称重单.frf');
380 frReport1.DesignReport;
381
382end;
383
384procedure TVehiclePonderationFrm.Button3Click(Sender: TObject);
385var F: Double;
386begin
387 inherited;
388
389end;
390
391procedure TVehiclePonderationFrm.wwModuleQryCalcFields(DataSet: TDataSet);
392begin
393 inherited;
394end;
395
396procedure TVehiclePonderationFrm.Timer1Timer(Sender: TObject);
397var tagtype, Work_No:Integer;
398 snr:Longword;
399 Vehicle_No: String;
400data:array[0..15] of Char;
401Weight1: double;
402Id: integer;
403begin
404
405 if PonderationFrm <> nil then
406 exit;
407 inc(RefreshCount);
408 if (RefreshCount > 30) and (wwModuleQry.State in [dsBrowse]) then
409 begin
410 RefreshCount := 0;
411 Id := wwModuleQryId.Value;
412 Button1Click(nil);
413 wwModuleQry.Locate('Id', Id, []);
414 end;
415
416 if RFConfig($c6,$0e) < 0 then
417 begin
418 snr := 0;
419 IC_No := 0;
420 exit;
421 end;
422
423 if RFRequest(1,tagtype) < 0 then
424 begin
425 snr := 0;
426 IC_No := 0;
427 exit;
428 end;
429 if RFAnticoll(0,snr) < 0 then
430 begin
431 IC_No := 0;
432 snr := 0;
433 exit;
434 end;
435
436// showinfo(inttostr(snr));
437
438 if snr = 0 then
439 exit;
440 if IC_No = snr then
441 exit;
442 IC_No := snr;
443 IcShow(RFReadA(snr,56,@data,#$FF#$FF#$FF#$FF#$FF#$FF));
444 try
445 Vehicle_No := CodeArr[StrToInt(Gethex(data[0]))] +
446 CodeArr[StrToInt(Gethex(data[1]))] +
447 CodeArr[StrToInt(Gethex(data[2]))] +
448 CodeArr[StrToInt(Gethex(data[3]))] +
449 CodeArr[StrToInt(Gethex(data[4]))] +
450 CodeArr[StrToInt(Gethex(data[5]))] +
451 CodeArr[StrToInt(Gethex(data[6]))];
452 except
453 exit;
454 end;
455end;
456
457procedure TVehiclePonderationFrm.FormActivate(Sender: TObject);
458begin
459// inherited;
460 Timer1.Enabled := True;
461end;
462
463procedure TVehiclePonderationFrm.N1Click(Sender: TObject);
464begin
465 inherited;
466 frReport1.ShowReport;
467
468end;
469
470procedure TVehiclePonderationFrm.Button6Click(Sender: TObject);
471begin
472 inherited;
473 DM.DB.Close;
474 DM.DB.Open;
475end;
476
477procedure TVehiclePonderationFrm.GetVehiclePonderation(Weight: Double);
478var Amount: integer;
479begin
480
481end;
482
483procedure TVehiclePonderationFrm.Panel1Click(Sender: TObject);
484begin
485 inherited;
486// ExecPonderation(wwModuleQryId.Value);
487
488end;
489
490procedure TVehiclePonderationFrm.N2Click(Sender: TObject);
491begin
492 inherited;
493// frReport3.PrepareReport;
494// frReport3.PrintPreparedReport('', 1, True, frAll);
495 frReport3.ShowReport;
496end;
497
498end.
1unit VehiclePonderation;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 SingleMoudle, Db, ADODB, PrnDbgeh, Wwdatsrc, ActnList, ImgList, Grids,
8 DBGridEh, ExtCtrls, StdCtrls, wwSpeedButton, wwDBNavigator, wwclearpanel,
9 ComCtrls, ToolWin, Mask, DBCtrls, MemTableEh, DataDriverEh, GridsEh,
10 wwdbdatetimepicker, Buttons, wwdblook, OoMisc, AdPort, Spin, Menus,
11 FR_Class, FR_DSet, FR_DBSet;
12
13type
14 TVehiclePonderationFrm = class(TSingleMoudleFrm)
15 wwModuleQryId: TIntegerField;
16 wwModuleQryVehicleNo: TStringField;
17 wwModuleQryWeight0: TFloatField;
18 wwModuleQryWeight1: TFloatField;
19 wwModuleQryWeight2: TFloatField;
20 wwModuleQryWeight3: TFloatField;
21 wwModuleQryRemark: TStringField;
22 ICVehicleInOutQry: TADOQuery;
23 ICVehicleInOutQryId: TIntegerField;
24 ICVehicleInOutQryWork_No: TIntegerField;
25 DataSource1: TDataSource;
26 Panel3: TPanel;
27 Panel5: TPanel;
28 DBGridEh3: TDBGridEh;
29 Label1: TLabel;
30 DBEdit1: TDBEdit;
31 Label2: TLabel;
32 DBEdit2: TDBEdit;
33 Label3: TLabel;
34 DBEdit3: TDBEdit;
35 Label4: TLabel;
36 DBEdit4: TDBEdit;
37 Label5: TLabel;
38 DBEdit5: TDBEdit;
39 Label6: TLabel;
40 DBEdit6: TDBEdit;
41 wwModuleQryPonderation_No: TIntegerField;
42 ICVehicleInOutQryVehicleNo: TStringField;
43 Label8: TLabel;
44 DBEdit8: TDBEdit;
45 wwModuleQryOccur_Date: TDateTimeField;
46 Label15: TLabel;
47 wwDBDateTimePicker1: TwwDBDateTimePicker;
48 DBEdit7: TDBEdit;
49 Label7: TLabel;
50 SpeedButton1: TSpeedButton;
51 SpeedButton2: TSpeedButton;
52 Panel1: TPanel;
53 Label9: TLabel;
54 Label10: TLabel;
55 dtStart: TDateTimePicker;
56 dtEnd: TDateTimePicker;
57 Button1: TButton;
58 Button6: TButton;
59 Button2: TButton;
60 CheckBox1: TCheckBox;
61 ComPort1: TApdComPort;
62 Panel2: TPanel;
63 wwModuleQryShipper_Id: TIntegerField;
64 wwModuleQryMateriel_Name: TStringField;
65 wwModuleQryOccur_Date1: TDateTimeField;
66 wwModuleQryAmount: TFloatField;
67 Label12: TLabel;
68 CustomerInfoLK1: TwwDBLookupCombo;
69 Label13: TLabel;
70 SpinEdit1: TSpinEdit;
71 wwModuleQryIC_No: TStringField;
72 Label14: TLabel;
73 DBEdit10: TDBEdit;
74 frDBDataSet1: TfrDBDataSet;
75 frReport1: TfrReport;
76 PopupMenu1: TPopupMenu;
77 N4r5te1: TMenuItem;
78 ertre1: TMenuItem;
79 wwModuleQryPonderation_Type: TStringField;
80 wwModuleQryKa_No: TStringField;
81 Label11: TLabel;
82 DBEdit9: TDBEdit;
83 Label16: TLabel;
84 DBEdit11: TDBEdit;
85 Label17: TLabel;
86 wwDBDateTimePicker2: TwwDBDateTimePicker;
87 Label18: TLabel;
88 DBComboBox1: TDBComboBox;
89 wwModuleQryUserID: TStringField;
90 wwModuleQryInput_Date: TDateTimeField;
91 Label19: TLabel;
92 DBEdit12: TDBEdit;
93 Label20: TLabel;
94 DBEdit13: TDBEdit;
95 wwModuleQryshipper_name: TStringField;
96 Label21: TLabel;
97 DBEdit14: TDBEdit;
98 Button3: TButton;
99 wwModuleQrykong_weight: TFloatField;
100 wwModuleQryzong_weight: TFloatField;
101 Timer1: TTimer;
102 wwModuleQryhandleperson_name: TStringField;
103 wwModuleQryWork_No: TStringField;
104 wwModuleQryweight4: TFloatField;
105 N1: TMenuItem;
106 frReport2: TfrReport;
107 wwModuleDetQryId: TIntegerField;
108 wwModuleDetQryMaster_Id: TIntegerField;
109 wwModuleDetQryAmount: TFloatField;
110 wwModuleDetQryWeight: TFloatField;
111 wwModuleDetQryUserID: TStringField;
112 wwModuleDetQryInput_Date: TDateTimeField;
113 wwModuleDetQryRemark: TStringField;
114 N2: TMenuItem;
115 frReport3: TfrReport;
116 procedure DBGridEh3DblClick(Sender: TObject);
117 procedure wwModuleQryAfterInsert(DataSet: TDataSet);
118 procedure wwModuleQryBeforePost(DataSet: TDataSet);
119 procedure Button1Click(Sender: TObject);
120 procedure FormCreate(Sender: TObject);
121 procedure CheckBox1Click(Sender: TObject);
122 procedure SpeedButton1Click(Sender: TObject);
123 procedure SpeedButton2Click(Sender: TObject);
124 procedure Button2Click(Sender: TObject);
125 procedure ComPort1Trigger(CP: TObject; Msg, TriggerHandle, Data: Word);
126 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
127 procedure tbPrintClick(Sender: TObject);
128 procedure ertre1Click(Sender: TObject);
129 procedure Button3Click(Sender: TObject);
130 procedure wwModuleQryCalcFields(DataSet: TDataSet);
131 procedure Timer1Timer(Sender: TObject);
132 procedure FormActivate(Sender: TObject);
133 procedure N1Click(Sender: TObject);
134 procedure Button6Click(Sender: TObject);
135 procedure Panel1Click(Sender: TObject);
136 procedure N2Click(Sender: TObject);
137 private
138 CodeArr:array[0..82] of String;
139 WeighS: String;
140 counti: integer;
141 IC_No:Integer;
142 RefreshCount: integer;
143 function Gethex(data: Char): String;
144 function GetVehicleNo: String;
145 { Private declarations }
146 public
147 procedure GetVehiclePonderation(Weight: Double);
148 { Public declarations }
149 end;
150
151var
152 VehiclePonderationFrm: TVehiclePonderationFrm;
153 procedure ExecVehiclePonderation;
154
155implementation
156
157uses CommonData, ICCommon, CommonFunction, Ponderation;
158//97.5
159{$R *.DFM}
160
161procedure ExecVehiclePonderation;
162begin
163 VehiclePonderationFrm := TVehiclePonderationFrm.Create(nil);
164 try
165 VehiclePonderationFrm.ShowModal;
166 finally
167 VehiclePonderationFrm.Free;
168 end;
169
170end;
171
172procedure TVehiclePonderationFrm.DBGridEh3DblClick(Sender: TObject);
173begin
174 inherited;
175 Button6Click(nil);
176
177end;
178
179procedure TVehiclePonderationFrm.wwModuleQryAfterInsert(DataSet: TDataSet);
180begin
181 inherited;
182end;
183
184procedure TVehiclePonderationFrm.wwModuleQryBeforePost(DataSet: TDataSet);
185begin
186end;
187
188procedure TVehiclePonderationFrm.Button1Click(Sender: TObject);
189begin
190 inherited;
191end;
192
193procedure TVehiclePonderationFrm.FormCreate(Sender: TObject);
194begin
195 inherited;
196 RefreshCount := 0;
197 CodeArr[0] := '0';
198 CodeArr[1] := '1';
199 CodeArr[2] := '2';
200 CodeArr[3] := '3';
201 CodeArr[4] := '4';
202 CodeArr[5] := '5';
203 CodeArr[6] := '6';
204 CodeArr[7] := '7';
205 CodeArr[8] := '8';
206 CodeArr[9] := '9';
207 CodeArr[10] := 'A';
208 CodeArr[11] := 'B';
209 CodeArr[12] := 'C';
210 CodeArr[13] := 'D';
211 CodeArr[14] := 'E';
212 CodeArr[15] := 'F';
213 CodeArr[16] := 'G';
214 CodeArr[17] := 'H';
215 CodeArr[18] := 'I';
216 CodeArr[19] := 'J';
217 CodeArr[20] := 'K';
218 CodeArr[21] := 'L';
219 CodeArr[22] := 'M';
220 CodeArr[23] := 'N';
221 CodeArr[24] := 'O';
222 CodeArr[25] := 'P';
223 CodeArr[26] := 'Q';
224 CodeArr[27] := 'R';
225 CodeArr[28] := 'S';
226 CodeArr[29] := 'T';
227 CodeArr[30] := 'U';
228 CodeArr[31] := 'V';
229 CodeArr[32] := 'W';
230 CodeArr[33] := 'X';
231 CodeArr[34] := 'Y';
232 CodeArr[35] := 'Z';
233 CodeArr[36] := ':';
234 CodeArr[37] := '*';
235 CodeArr[38] := '';
236 CodeArr[39] := '';
237
238 CodeArr[51] := '京';
239 CodeArr[52] := '津';
240 CodeArr[53] := '沪';
241 CodeArr[54] := '渝';
242 CodeArr[55] := '粤';
243 CodeArr[56] := '闽';
244 CodeArr[57] := '桂';
245 CodeArr[58] := '湘';
246 CodeArr[59] := '黑';
247 CodeArr[60] := '辽';
248 CodeArr[61] := '蒙';
249 CodeArr[62] := '新';
250 CodeArr[63] := '宁';
251 CodeArr[64] := '青';
252 CodeArr[65] := '甘';
253 CodeArr[66] := '藏';
254 CodeArr[67] := '晋';
255 CodeArr[68] := '冀';
256 CodeArr[69] := '鲁';
257 CodeArr[70] := '豫';
258 CodeArr[71] := '贵';
259 CodeArr[72] := '云';
260 CodeArr[73] := '赣';
261 CodeArr[74] := '鄂';
262 CodeArr[75] := '苏';
263 CodeArr[76] := '皖';
264 CodeArr[77] := '琼';
265 CodeArr[78] := '川';
266 CodeArr[79] := '吉';
267 CodeArr[80] := '浙';
268 CodeArr[81] := '陕';
269 CodeArr[82] := '特';
270
271 dtStart.Date := dtEnd.Date;
272
273end;
274
275procedure TVehiclePonderationFrm.SpeedButton1Click(Sender: TObject);
276begin
277 inherited;
278end;
279
280procedure TVehiclePonderationFrm.SpeedButton2Click(Sender: TObject);
281begin
282 inherited;
283end;
284
285procedure TVehiclePonderationFrm.Button2Click(Sender: TObject);
286var tagtype, Work_No:Integer;
287 snr:Longword;
288 Vehicle_No: String;
289data:array[0..15] of Char;
290begin
291
292 if Sender <> nil then
293 begin
294 IcShow(RFConfig($c6,$0e));
295 IcShow(RFRequest(1,tagtype));
296 IcShow(RFAnticoll(0,snr));
297 IC_No := snr;
298 IcShow(RFReadA(snr,56,@data,#$FF#$FF#$FF#$FF#$FF#$FF));
299 try
300 Vehicle_No := CodeArr[StrToInt(Gethex(data[0]))] +
301 CodeArr[StrToInt(Gethex(data[1]))] +
302 CodeArr[StrToInt(Gethex(data[2]))] +
303 CodeArr[StrToInt(Gethex(data[3]))] +
304 CodeArr[StrToInt(Gethex(data[4]))] +
305 CodeArr[StrToInt(Gethex(data[5]))] +
306 CodeArr[StrToInt(Gethex(data[6]))];
307 except
308 end;
309// DM.ExeSql(Format('select top 1 Work_No, Vehicle_No from NanChuWuLiu_IC_Vehicle_InOut where IC_No = ''%s'' order by Work_No Desc', [IntToStr(snr)]));
310// Work_No := DM.Dual1Qry.FieldByName('Work_No').Value;
311// Work_No := snr;
312// Vehicle_No := DM.Dual1Qry.FieldByName('Vehicle_No').asString;
313 end;
314
315 tbInsertClick(nil);
316 wwModuleQryVehicleNo.Value := Vehicle_No;
317 wwModuleQryIC_No.Value := IntToStr(IC_No);
318end;
319
320function TVehiclePonderationFrm.Gethex(data: Char): String;
321begin
322 Result := Format('%d',[StrtoInt('$'+inttohex(byte(data),2))]);
323
324end;
325
326function TVehiclePonderationFrm.GetVehicleNo: String;
327var snr:Longword;
328data:array[0..15] of Char;
329 buf1:array[0..1] of byte;
330 i: integer;
331 S: String;
332begin
333IcShow(RFReadA(snr,56,@data,#$FF#$FF#$FF#$FF#$FF#$FF));
334// Edit1.Text:=inttohex(byte(data[0]),2);
335// Edit1.Text:=Format('%d',[StrtoInt('$'+Edit1.Text)]);
336 try
337 Result := CodeArr[StrToInt(Gethex(data[0]))] +
338 CodeArr[StrToInt(Gethex(data[1]))] +
339 CodeArr[StrToInt(Gethex(data[2]))] +
340 CodeArr[StrToInt(Gethex(data[3]))] +
341 CodeArr[StrToInt(Gethex(data[4]))] +
342 CodeArr[StrToInt(Gethex(data[5]))] +
343 CodeArr[StrToInt(Gethex(data[6]))];
344 except
345 end;
346end;
347
348procedure TVehiclePonderationFrm.FormCloseQuery(Sender: TObject;
349 var CanClose: Boolean);
350begin
351 inherited;
352 SaveINI('Start', 'DibangCom', IntToStr(SpinEdit1.Value));
353
354end;
355
356procedure TVehiclePonderationFrm.tbPrintClick(Sender: TObject);
357begin
358//inherited;
359// frReport1.LoadFromFile(WorkDir + '称重单.frf');
360// frReport1.ShowReport;
361 if LoadINI('Start', 'Ponderation') <> '1' then
362 begin
363 frReport2.PrepareReport;
364 frReport2.PrintPreparedReport('', 1, True, frAll);
365 end
366 else
367 begin
368 frReport1.PrepareReport;
369 frReport1.PrintPreparedReport('', 1, True, frAll);
370 end;
371
372// frReport1.PrintPreparedReportDlg;
373
374end;
375
376procedure TVehiclePonderationFrm.ertre1Click(Sender: TObject);
377begin
378 inherited;
379 frReport1.LoadFromFile(WorkDir + '称重单.frf');
380 frReport1.DesignReport;
381
382end;
383
384procedure TVehiclePonderationFrm.Button3Click(Sender: TObject);
385var F: Double;
386begin
387 inherited;
388
389end;
390
391procedure TVehiclePonderationFrm.wwModuleQryCalcFields(DataSet: TDataSet);
392begin
393 inherited;
394end;
395
396procedure TVehiclePonderationFrm.Timer1Timer(Sender: TObject);
397var tagtype, Work_No:Integer;
398 snr:Longword;
399 Vehicle_No: String;
400data:array[0..15] of Char;
401Weight1: double;
402Id: integer;
403begin
404
405 if PonderationFrm <> nil then
406 exit;
407 inc(RefreshCount);
408 if (RefreshCount > 30) and (wwModuleQry.State in [dsBrowse]) then
409 begin
410 RefreshCount := 0;
411 Id := wwModuleQryId.Value;
412 Button1Click(nil);
413 wwModuleQry.Locate('Id', Id, []);
414 end;
415
416 if RFConfig($c6,$0e) < 0 then
417 begin
418 snr := 0;
419 IC_No := 0;
420 exit;
421 end;
422
423 if RFRequest(1,tagtype) < 0 then
424 begin
425 snr := 0;
426 IC_No := 0;
427 exit;
428 end;
429 if RFAnticoll(0,snr) < 0 then
430 begin
431 IC_No := 0;
432 snr := 0;
433 exit;
434 end;
435
436// showinfo(inttostr(snr));
437
438 if snr = 0 then
439 exit;
440 if IC_No = snr then
441 exit;
442 IC_No := snr;
443 IcShow(RFReadA(snr,56,@data,#$FF#$FF#$FF#$FF#$FF#$FF));
444 try
445 Vehicle_No := CodeArr[StrToInt(Gethex(data[0]))] +
446 CodeArr[StrToInt(Gethex(data[1]))] +
447 CodeArr[StrToInt(Gethex(data[2]))] +
448 CodeArr[StrToInt(Gethex(data[3]))] +
449 CodeArr[StrToInt(Gethex(data[4]))] +
450 CodeArr[StrToInt(Gethex(data[5]))] +
451 CodeArr[StrToInt(Gethex(data[6]))];
452 except
453 exit;
454 end;
455end;
456
457procedure TVehiclePonderationFrm.FormActivate(Sender: TObject);
458begin
459// inherited;
460 Timer1.Enabled := True;
461end;
462
463procedure TVehiclePonderationFrm.N1Click(Sender: TObject);
464begin
465 inherited;
466 frReport1.ShowReport;
467
468end;
469
470procedure TVehiclePonderationFrm.Button6Click(Sender: TObject);
471begin
472 inherited;
473 DM.DB.Close;
474 DM.DB.Open;
475end;
476
477procedure TVehiclePonderationFrm.GetVehiclePonderation(Weight: Double);
478var Amount: integer;
479begin
480
481end;
482
483procedure TVehiclePonderationFrm.Panel1Click(Sender: TObject);
484begin
485 inherited;
486// ExecPonderation(wwModuleQryId.Value);
487
488end;
489
490procedure TVehiclePonderationFrm.N2Click(Sender: TObject);
491begin
492 inherited;
493// frReport3.PrepareReport;
494// frReport3.PrintPreparedReport('', 1, True, frAll);
495 frReport3.ShowReport;
496end;
497
498end.