587 lines
15 KiB
ObjectPascal
587 lines
15 KiB
ObjectPascal
![]() |
unit U_KCRLLTZ;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, strutils, SysUtils, Variants, Classes, Graphics, Controls,
|
|||
|
Forms, Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
|
|||
|
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
|
|||
|
cxGrid, StdCtrls, cxContainer, cxTextEdit, cxCurrencyEdit, BtnEdit, ExtCtrls,
|
|||
|
ComCtrls, ToolWin, DBClient, ADODB, MovePanel, RM_Dataset, RM_System,
|
|||
|
RM_Common, RM_Class, RM_GridReport;
|
|||
|
|
|||
|
function CommOpen(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): integer; stdcall; external 'JCYData.DLL';
|
|||
|
|
|||
|
function CommClose(sCommName: PAnsiChar): integer; stdcall; external 'JCYData.DLL';
|
|||
|
|
|||
|
type
|
|||
|
TfrmKCRLLTZ = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBSave: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
CDS_FromMJID: TClientDataSet;
|
|||
|
CDS_ToMJID: TClientDataSet;
|
|||
|
DS_FromMJID: TDataSource;
|
|||
|
DS_ToMJID: TDataSource;
|
|||
|
SmNO: TEdit;
|
|||
|
ADOQueryTmp: TADOQuery;
|
|||
|
CheckBox3: TCheckBox;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
RM2: TRMGridReport;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
Panel4: TPanel;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1MJID: TcxGridDBColumn;
|
|||
|
v1P_Code: TcxGridDBColumn;
|
|||
|
v1P_Color: TcxGridDBColumn;
|
|||
|
v1Qty: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TV2: TcxGridDBTableView;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
V2Column1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
V2Column2: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
Label32: TLabel;
|
|||
|
Label33: TLabel;
|
|||
|
Edit7: TEdit;
|
|||
|
Edit8: TEdit;
|
|||
|
Label26: TLabel;
|
|||
|
Edit6: TEdit;
|
|||
|
Panel2: TPanel;
|
|||
|
Label2: TLabel;
|
|||
|
Label3: TLabel;
|
|||
|
MJGW: TEdit;
|
|||
|
btnChaiPi: TButton;
|
|||
|
Button4: TButton;
|
|||
|
Label5: TLabel;
|
|||
|
Label9: TLabel;
|
|||
|
MJLen: TEdit;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure SmNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure Edit7Click(Sender: TObject);
|
|||
|
procedure Edit8Click(Sender: TObject);
|
|||
|
procedure Edit6Click(Sender: TObject);
|
|||
|
procedure Tv1DblClick(Sender: TObject);
|
|||
|
procedure Button5Click(Sender: TObject);
|
|||
|
procedure btnChaiPiClick(Sender: TObject);
|
|||
|
private
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitMJID();
|
|||
|
function Savedata1(): boolean;
|
|||
|
function Savedata2(): boolean;
|
|||
|
procedure Printdata(fCRID: string);
|
|||
|
procedure On1201(var Message: Tmessage); message 1201;
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
iscom: boolean;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmKCRLLTZ: TfrmKCRLLTZ;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_UserHelp, U_ZDYHelp;
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.On1201(var Message: Tmessage);
|
|||
|
var
|
|||
|
i1, i2: integer;
|
|||
|
unitname: string;
|
|||
|
fdata: double;
|
|||
|
begin
|
|||
|
i1 := Message.WParam;
|
|||
|
i2 := Message.LParam;
|
|||
|
|
|||
|
if not CheckBox3.Checked then
|
|||
|
exit;
|
|||
|
|
|||
|
if trim(DParameters10) = '<27><>С<EFBFBD><D0A1>' then
|
|||
|
MJLen.Text := format('%.2f', [i1 / 100000])
|
|||
|
else
|
|||
|
MJLen.Text := format('%.0f', [i1 / 100000]);
|
|||
|
if i2 = 0 then
|
|||
|
Label9.Caption := 'M'
|
|||
|
else
|
|||
|
Label9.Caption := 'Y';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.Printdata(fCRID: string);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
mvalue: Double;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select A.* from WFB_MJJY where MJID =' + quotedstr(trim(fCRID)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(ADOQueryPrint.fieldbyname('MJID').AsString);
|
|||
|
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
|||
|
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
|||
|
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
|||
|
if FileExists(fImagePath) then
|
|||
|
DeleteFile(fImagePath);
|
|||
|
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ͨ<>ñ<EFBFBD>ǩ.rmf';
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
RM2.PrintReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ǩ.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmKCRLLTZ.Savedata2(): boolean;
|
|||
|
var
|
|||
|
fconNo, FC_CodeName, FC_Color, maxno: string;
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
result := false;
|
|||
|
if CDS_FromMJID.RecordCount <= 1 then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ڻ<EFBFBD><DABB>ߵ<EFBFBD><DFB5><EFBFBD>һƥ<D2BB><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD>赽<EFBFBD><E8B5BD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if GetLSNo(ADOQueryTmp, maxno, 'B', 'WFB_MJJY', 4, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_FromMJID do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
FC_CodeName := trim(Fieldbyname('C_CodeName').AsString);
|
|||
|
FC_Color := trim(Fieldbyname('C_Color').AsString);
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if trim(FC_CodeName) <> trim(Fieldbyname('C_CodeName').AsString) then
|
|||
|
begin
|
|||
|
EnableControls;
|
|||
|
application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ʋ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ܺϲ<DCBA><CFB2><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if trim(FC_Color) <> trim(Fieldbyname('C_Color').AsString) then
|
|||
|
begin
|
|||
|
EnableControls;
|
|||
|
application.MessageBox('<27><>ɫ<EFBFBD><C9AB>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ܺϲ<DCBA><CFB2><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
First;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
try
|
|||
|
with CDS_FromMJID do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_JYCBCK ');
|
|||
|
sql.Add(' @MJID=' + quotedstr(trim(ADOQueryCmd.FieldByName('MJID').AsString)));
|
|||
|
sql.Add(',@ToMJID='''' ');
|
|||
|
sql.Add(',@CRType=''<27><>ƥ'' ');
|
|||
|
sql.Add(',@DName=' + quotedstr(trim(DName)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
First;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from WFB_MJJY ');
|
|||
|
sql.Add('where MJID=' + quotedstr(trim(CDS_FromMJID.FieldByName('MJID').AsString)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select * from WFB_MJJY where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
ADOQueryCmd.Append;
|
|||
|
for i := 0 to ADOQueryCmd.FieldCount - 1 do
|
|||
|
begin
|
|||
|
ADOQueryCmd.fields[i].value := ADOQueryTmp.Fields[i].Value;
|
|||
|
end;
|
|||
|
ADOQueryCmd.FieldByName('MJID').Value := Trim(maxno);
|
|||
|
ADOQueryCmd.FieldByName('MJGW').Value := StrToFloatDef(MJGW.Text, 0);
|
|||
|
ADOQueryCmd.FieldByName('MJNW').Value := StrToFloatDef(MJGW.Text, 0) - ADOQueryTmp.FieldByName('MJTare').AsFloat;
|
|||
|
ADOQueryCmd.FieldByName('MJLen').Value := StrToFloatDef(MJLen.Text, 0);
|
|||
|
ADOQueryCmd.Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_JYCRK ' + quotedstr(Trim(maxno)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
CDS_FromMJID.EmptyDataSet;
|
|||
|
if Trim(Edit6.Text) = '<27><>' then
|
|||
|
begin
|
|||
|
printdata(maxno);
|
|||
|
end;
|
|||
|
|
|||
|
ModalResult := 1;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmKCRLLTZ.Savedata1(): boolean;
|
|||
|
var
|
|||
|
FFromMJID, maxno: string;
|
|||
|
i: integer;
|
|||
|
begin
|
|||
|
result := false;
|
|||
|
|
|||
|
if GetLSNo(ADOQueryTmp, maxno, 'C', 'WFB_MJJY', 4, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_JYCBCK ');
|
|||
|
sql.Add(' @MJID=' + quotedstr(trim(ADOQueryCmd.FieldByName('MJID').AsString)));
|
|||
|
sql.Add(',@ToMJID='''' ');
|
|||
|
sql.Add(',@CRType=''<27><>ƥ'' ');
|
|||
|
sql.Add(',@DName=' + quotedstr(trim(DName)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from WFB_MJJY ');
|
|||
|
sql.Add('where MJID=' + quotedstr(trim(CDS_FromMJID.FieldByName('MJID').AsString)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select * from WFB_MJJY where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
ADOQueryCmd.Append;
|
|||
|
for i := 0 to ADOQueryCmd.FieldCount - 1 do
|
|||
|
begin
|
|||
|
ADOQueryCmd.fields[i].value := ADOQueryTmp.Fields[i].Value;
|
|||
|
end;
|
|||
|
ADOQueryCmd.FieldByName('FromMJID').Value := Trim(ADOQueryTmp.FieldByName('MJID').AsString);
|
|||
|
ADOQueryCmd.FieldByName('MJID').Value := Trim(maxno) + '1';
|
|||
|
ADOQueryCmd.FieldByName('MJGW').Value := StrToFloatDef(MJGW.Text, 0);
|
|||
|
ADOQueryCmd.FieldByName('MJNW').Value := StrToFloatDef(MJGW.Text, 0) - ADOQueryTmp.FieldByName('MJTare').AsFloat;
|
|||
|
ADOQueryCmd.FieldByName('MJLen').Value := StrToFloatDef(MJLen.Text, 0);
|
|||
|
ADOQueryCmd.Post;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
ADOQueryCmd.Append;
|
|||
|
for i := 0 to ADOQueryCmd.FieldCount - 1 do
|
|||
|
begin
|
|||
|
ADOQueryCmd.fields[i].value := ADOQueryTmp.Fields[i].Value;
|
|||
|
end;
|
|||
|
ADOQueryCmd.FieldByName('FromMJID').Value := Trim(ADOQueryTmp.FieldByName('MJID').AsString);
|
|||
|
ADOQueryCmd.FieldByName('MJID').Value := Trim(maxno) + '2';
|
|||
|
ADOQueryCmd.FieldByName('MJGW').Value := ADOQueryTmp.FieldByName('MJGW').AsFloat - StrToFloatDef(MJGW.Text, 0);
|
|||
|
ADOQueryCmd.FieldByName('MJNW').Value := ADOQueryTmp.FieldByName('MJGW').AsFloat - StrToFloatDef(MJGW.Text, 0) - ADOQueryTmp.FieldByName('MJTare').AsFloat;
|
|||
|
ADOQueryCmd.FieldByName('MJLen').Value := ADOQueryTmp.FieldByName('MJGW').AsFloat;
|
|||
|
ADOQueryCmd.Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_JYCRK ' + quotedstr(Trim(maxno) + '1'));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_JYCRK ' + quotedstr(Trim(maxno) + '2'));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
CDS_FromMJID.EmptyDataSet;
|
|||
|
|
|||
|
if Trim(Edit6.Text) = '<27><>' then
|
|||
|
begin
|
|||
|
printdata(Trim(maxno) + '1');
|
|||
|
printdata(Trim(maxno) + '2');
|
|||
|
end;
|
|||
|
ModalResult := 1;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.InitGrid();
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select * from WFB_MJJY A');
|
|||
|
SQL.Add('where 1=2 ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_FromMJID);
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_ToMJID);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.InitMJID();
|
|||
|
var
|
|||
|
fP_No: string;
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select A.* from WFB_MJJY A');
|
|||
|
SQL.Add('where A.MJID=' + quotedstr(trim(SmNO.text)));
|
|||
|
Open;
|
|||
|
if not IsEmpty then
|
|||
|
begin
|
|||
|
if Fieldbyname('MJCRType').AsString = '<27>ѳ<EFBFBD><D1B3><EFBFBD>' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѳ<EFBFBD><D1B3>⣡', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_FromMJID);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
wRITECxGrid(self.Caption + tV1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
wRITECxGrid(self.Caption + TV2.Name, Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
frmKCRLLTZ := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
if iscom then
|
|||
|
CommClose(pchar('com2'));
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.SmNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
|
|||
|
if not CDS_FromMJID.Locate('MJID', trim(smNo.Text), []) then
|
|||
|
initMjid();
|
|||
|
|
|||
|
smno.Text := '';
|
|||
|
smno.SetFocus;
|
|||
|
|
|||
|
if trim(Edit8.Text) = '<27><>' then
|
|||
|
begin
|
|||
|
if not CDS_FromMJID.IsEmpty then
|
|||
|
begin
|
|||
|
MJLen.Text := floattostr(tv1.DataController.Summary.FooterSummaryValues[1]);
|
|||
|
MJGW.Text := floattostr(tv1.DataController.Summary.FooterSummaryValues[2]);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
ReadCxGrid(self.Caption + tV1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
ReadCxGrid(self.Caption + TV2.Name, Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
InitGrid();
|
|||
|
if iscom then
|
|||
|
begin
|
|||
|
// if CommOpen(frmKCRLLTZ.Handle, '', 500, 1) < 1 then
|
|||
|
// begin
|
|||
|
// showmessage('<27><EFBFBD><F2BFAAB4>ڴ<EFBFBD><DAB4><EFBFBD>');
|
|||
|
// end;
|
|||
|
end;
|
|||
|
SmNO.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.Edit7Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(Edit7.Text) = '' then
|
|||
|
begin
|
|||
|
Edit7.Text := '<27><>';
|
|||
|
Edit8.Text := '';
|
|||
|
// Edit9.Text:='';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Edit7.Text := '';
|
|||
|
Edit8.Text := '';
|
|||
|
// Edit9.Text:='';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.Edit8Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(Edit8.Text) = '' then
|
|||
|
begin
|
|||
|
Edit7.Text := '';
|
|||
|
Edit8.Text := '<27><>';
|
|||
|
// Edit9.Text:='';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Edit7.Text := '';
|
|||
|
Edit8.Text := '';
|
|||
|
// Edit9.Text:='';
|
|||
|
end;
|
|||
|
if trim(Edit8.Text) = '<27><>' then
|
|||
|
begin
|
|||
|
if not CDS_FromMJID.IsEmpty then
|
|||
|
MJLen.Text := floattostr(tv1.DataController.Summary.FooterSummaryValues[1]);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.Edit6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(Edit6.Text) = '' then
|
|||
|
begin
|
|||
|
Edit6.Text := '<27><>';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Edit6.Text := '';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.Tv1DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_FromMJID.IsEmpty then
|
|||
|
exit;
|
|||
|
CDS_FromMJID.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.Button5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_FromMJID.IsEmpty then
|
|||
|
exit;
|
|||
|
printdata(CDS_FromMJID.fieldbyname('CRID').AsString);
|
|||
|
SmNO.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKCRLLTZ.btnChaiPiClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
if Trim(Edit7.Text) <> '' then
|
|||
|
begin
|
|||
|
if CDS_FromMJID.RecordCount > 1 then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>һƥ<D2BB><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD>赽<EFBFBD><E8B5BD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if strtofloatdef(trim(mjlen.Text), 0) > CDS_FromMJID.FieldByName('mjlen').AsFloat then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if strtofloatdef(trim(MJGW.Text), 0) > CDS_FromMJID.FieldByName('MJGW').AsFloat then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
savedata1();
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
savedata2();
|
|||
|
end;
|
|||
|
|
|||
|
SmNO.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|