D10myYicheng/成品仓库(FinishedClothWarehouse.dll)/U_FCSMCK.pas
2025-05-27 14:08:09 +08:00

687 lines
18 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_FCSMCK;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, DB, cxDBData, StdCtrls, ExtCtrls, ADODB, DBClient,
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
cxGrid, MovePanel, cxCheckBox, Menus, ComCtrls, BtnEdit, ShellAPI, cxTextEdit,
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, U_BaseList, dxSkinsCore,
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu;
type
TfrmFCSMCK = class(TFrmBaseList)
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
DS_MainSel: TDataSource;
CDS_MainSel: TClientDataSet;
cxGridPopupMenu4: TcxGridPopupMenu;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
v3Column3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
v3Column1: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
Panel2: TPanel;
Label5: TLabel;
Label4: TLabel;
Label9: TLabel;
CKOrdNo: TEdit;
BaoID: TEdit;
CRTime: TDateTimePicker;
KHName: TEdit;
Button2: TButton;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
Label12: TLabel;
CDS_Main: TClientDataSet;
Button1: TButton;
v3Column2: TcxGridDBColumn;
Button3: TButton;
CKType: TComboBox;
Label1: TLabel;
edtIsSMTH: TEdit;
Label2: TLabel;
Button4: TButton;
Label3: TLabel;
edtNote: TEdit;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BaoIDKeyPress(Sender: TObject; var Key: Char);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure CKTypeChange(Sender: TObject);
procedure edtIsSMTHClick(Sender: TObject);
procedure CKOrdNoKeyPress(Sender: TObject; var Key: Char);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
FSMID, FCKOrdNo, FRKOrdID, FJYID: string;
function JudgeSQD(): Boolean;
function JudgeRKD(): Boolean;
function JudgeJTM(): Boolean;
function JudgeRKDCX(): Boolean;
function JudgeJTMCX(): Boolean;
procedure SaveCKData();
procedure SaveCKDataJTM();
procedure SaveCKDataCX();
procedure SaveCKDataJTMCX();
procedure InitCKGrid();
public
{ Public declarations }
end;
var
frmFCSMCK: TfrmFCSMCK;
implementation
uses
U_DataLink, U_RTFun, MMSystem, U_ZdyAttachment, U_ZdyAttachGYS,
U_CKProductBCPKCListSel;
{$R *.dfm}
function TfrmFCSMCK.JudgeSQD(): Boolean;
begin
Result := false;
try
if CKType.Text = '<27><><EFBFBD>޳<EFBFBD><DEB3><EFBFBD>' then
begin
if Trim(KHName.Text) = '' then
raise Exception.Create('<27><>ѡ<EFBFBD><D1A1><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>λ!');
end;
if Trim(CKOrdNo.Text) = '' then
raise Exception.Create('δɨ<CEB4><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB5A5>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>!');
Result := True;
except
Result := false;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
// PlaySound('δɨ<CEB4><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB5A5>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
end;
end;
function TfrmFCSMCK.JudgeRKD(): Boolean;
begin
try
if CKType.Text = '<27><><EFBFBD>޳<EFBFBD><DEB3><EFBFBD>' then
begin
if Trim(KHName.Text) = '' then
raise Exception.Create('<27><>ѡ<EFBFBD><D1A1><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>λ');
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from WFB_MJJY A ');
sql.Add('where RKOrdID=' + quotedstr(trim(FRKOrdID)));
Open;
end;
if ADOQueryTemp.IsEmpty then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>');
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('SELECT RKOrdID,CKOrdNo FROM CK_Cloth_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and RKOrdID=' + quotedstr(trim(FRKOrdID)));
Open;
end;
if not ADOQueryTemp.IsEmpty then
raise Exception.Create('<27><>ɨ<EFBFBD><C9A8>');
Result := True;
except
Result := false;
PlaySound(PChar('wav\' + Exception(ExceptObject).Message + '.wav'), 0, SND_FILENAME or SND_ASYNC);
end;
end;
function TfrmFCSMCK.JudgeJTM(): Boolean;
begin
try
if CKType.Text = '<27><><EFBFBD>޳<EFBFBD><DEB3><EFBFBD>' then
begin
if Trim(KHName.Text) = '' then
raise Exception.Create('<27><>ѡ<EFBFBD><D1A1><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>λ');
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select JYID from WFB_MJJY where JYID=' + quotedstr(trim(FJYID)));
Open;
end;
if ADOQueryTemp.IsEmpty then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>');
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select RKOrdID from CK_Cloth_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and JYID=' + quotedstr(trim(FJYID)));
Open;
end;
if ADOQueryTemp.IsEmpty then
begin
raise Exception.Create(<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>');
end
else
begin
FRKOrdID := Trim(ADOQueryTemp.fieldbyname('RKOrdID').AsString);
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('SELECT RKOrdID,CKOrdNo FROM CK_Cloth_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and JYID=' + quotedstr(trim(FJYID)));
Open;
end;
if ADOQueryTemp.IsEmpty = False then
begin
if Trim(ADOQueryTemp.fieldbyname('CKOrdNo').AsString) = Trim(CKOrdNo.Text) then
begin
raise Exception.Create('<27><>ɨ<EFBFBD><C9A8>');
end
else
begin
raise Exception.Create('<27>ѳ<EFBFBD><D1B3><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>');
end;
end;
Result := True;
except
Result := false;
// application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
PlaySound(pchar('wav\' + Exception(ExceptObject).Message + '.wav'), 0, SND_FILENAME or SND_ASYNC);
end;
end;
function TfrmFCSMCK.JudgeJTMCX(): Boolean;
begin
try
if Trim(CKOrdNo.Text) = '' then
raise Exception.Create('<27><><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
if CDS_MainSel.IsEmpty then
raise Exception.Create('<27>޿ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('SELECT RKOrdID,CKOrdNo FROM CK_Cloth_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and JYID=' + quotedstr(FJYID));
Open;
end;
if ADOQueryTemp.IsEmpty then
raise Exception.Create('<27>޿ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
Result := True;
except
Result := false;
PlaySound(PChar('wav\' + Exception(ExceptObject).Message + '.wav'), 0, SND_FILENAME or SND_ASYNC);
end;
end;
function TfrmFCSMCK.JudgeRKDCX(): Boolean;
begin
try
if Trim(CKOrdNo.Text) = '' then
raise Exception.Create('<27><><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>');
if CDS_MainSel.IsEmpty then
raise Exception.Create('<27>޿ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('SELECT RKOrdID,CKOrdNo FROM CK_Cloth_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and CKOrdNo=' + quotedstr(FCKOrdNo));
Open;
end;
if ADOQueryTemp.IsEmpty then
raise Exception.Create('<27>޿ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Result := True;
except
Result := false;
PlaySound(PChar('wav\' + Exception(ExceptObject).Message + '.wav'), 0, SND_FILENAME or SND_ASYNC);
end;
end;
procedure TfrmFCSMCK.SaveCKData();
begin
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_BanCP_CKList Set CKDate=getdate() ');
sql.Add(',KHNmae= ' + Quotedstr(KHName.Text));
sql.Add(',CKType= ' + Quotedstr(CKType.Text));
sql.Add('where CKOrdNo=' + Quotedstr(FCKOrdNo));
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_Cloth_CR Set ');
sql.add(' CRTime=getdate(),CRType='<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
sql.add(',CKOrdNo=' + Quotedstr(FCKOrdNo));
sql.add(',RKOrdID=' + Quotedstr(FRKOrdID));
sql.add(',RKOrdID=' + Quotedstr(edtNote.Text));
sql.Add(' where exists(select JYID from CK_Cloth_CR X where CK_Cloth_CR.JYID=X.JYID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
sql.Add('and CK_Cloth_CR.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_Cloth_KC Set ');
sql.add(' KCValid=''N'' ');
sql.Add(' where exists(select JYID from CK_Cloth_CR X where CK_Cloth_KC.JYID=X.JYID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE WFB_MJJY Set MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' ');
sql.Add(' where exists (select JYID from CK_Cloth_CR X where WFB_MJJY.JYID=X.JYID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
SQL.Add(' and WFB_MJJY.MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
except
ADOQueryCmd.Connection.RollbackTrans;
PlaySound('wav\<5C><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>.wav', 0, SND_FILENAME or SND_ASYNC);
end;
end;
procedure TfrmFCSMCK.SaveCKDataJTM();
begin
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_BanCP_CKList Set CKDate=' + quotedstr(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)));
sql.Add(',KHNmae= ' + Quotedstr(KHName.Text));
sql.Add(',CKType= ' + Quotedstr(CKType.Text));
sql.Add('where CKOrdNo=' + Quotedstr(FCKOrdNo));
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_Cloth_CR Set ');
sql.add(' CRTime=' + quotedstr(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)) + ',CRType=' + quotedstr(CKType.Text) + ',CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
sql.add(',CKOrdNo=' + Quotedstr(FCKOrdNo));
sql.add(',RKOrdID=' + Quotedstr(FRKOrdID));
sql.Add(',CDDanwei= ' + Quotedstr(KHName.Text));
sql.Add(',CRNote= ' + Quotedstr(edtNote.Text));
sql.Add(' where CK_Cloth_CR.JYID=' + Quotedstr(Trim(FJYID)));
sql.Add('and CK_Cloth_CR.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_Cloth_KC Set ');
sql.add(' KCValid=''N'' ');
sql.Add(' where CK_Cloth_KC.JYID=' + Quotedstr(Trim(FJYID)));
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE WFB_MJJY Set MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' ');
sql.Add(' where WFB_MJJY.JYID=' + Quotedstr(Trim(FJYID)));
SQL.Add(' and WFB_MJJY.MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
except
ADOQueryCmd.Connection.RollbackTrans;
PlaySound('wav\<5C><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>.wav', 0, SND_FILENAME or SND_ASYNC);
end;
end;
procedure TfrmFCSMCK.SaveCKDataCX();
begin
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update CK_Cloth_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL,CRNote='''',CKOrdNo='''' ');
sql.Add(' where exists(select JYID from CK_Cloth_CR X where CK_Cloth_CR.JYID=X.JYID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
sql.Add(' UPdate CK_Cloth_KC Set KCValid=''Y'' ');
sql.Add(' where exists(select JYID from CK_Cloth_CR X where CK_Cloth_KC.JYID=X.JYID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
sql.Add(' and KCValid=''N'' ');
sql.Add(' Update WFB_MJJY Set MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
sql.Add(' where exists (select JYID from CK_Cloth_CR X where WFB_MJJY.JYID=X.JYID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
SQL.Add(' and WFB_MJJY.MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(''));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD><E8B3B7>')));
sql.Add(',' + quotedstr('<27><><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(FRKOrdID) + ' <20><><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(FCKOrdNo)));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(')');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
except
ADOQueryCmd.Connection.RollbackTrans;
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>.wav', 0, SND_FILENAME or SND_ASYNC);
end;
end;
procedure TfrmFCSMCK.SaveCKDataJTMCX();
begin
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update CK_Cloth_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL,CRNote='''',CKOrdNo='''' ');
sql.Add(' where CK_Cloth_CR.JYID=' + Quotedstr(Trim(FJYID)));
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
sql.Add(' UPdate CK_Cloth_KC Set KCValid=''Y'' ');
sql.Add(' where CK_Cloth_KC.JYID=' + Quotedstr(Trim(FJYID)));
sql.Add(' and KCValid=''N'' ');
sql.Add(' Update WFB_MJJY Set MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
sql.Add(' where WFB_MJJY.JYID=' + Quotedstr(Trim(FJYID)));
SQL.Add(' and WFB_MJJY.MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(''));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD><E8B3B7>')));
sql.Add(',' + quotedstr('<27><><EFBFBD><EFBFBD><EFBFBD>룺' + trim(FJYID) + ' <20><><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(FCKOrdNo)));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(')');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
except
ADOQueryCmd.Connection.RollbackTrans;
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>.wav', 0, SND_FILENAME or SND_ASYNC);
end;
end;
procedure TfrmFCSMCK.InitCKGrid();
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select AA.*, B.OrderNo,B.MPRTCode,B.MPRTCodeName,B.MPRTMF,B.MPRTKZ ,C.PRTColor,C.PRTEColor,C.PRTHX,C.PrtKuanNo ');
sql.Add('from (select count(SubId) ps,SUM(A.KGQty) KGQty,SUM(A.Qty) Qty,SUM(A.NetKGQty) NetKGQty');
sql.Add(',A.MainId,A.SubId,A.QtyUnit,A.CPType,A.ganghao,A.RKOrdID');
sql.Add('from CK_Cloth_CR A where A.CRFlag=''<27><><EFBFBD><EFBFBD>'' and CKOrdNo=' + quotedstr(FCKOrdNo));
sql.Add('group by A.MainId,A.SubId,A.QtyUnit,A.CPType,A.ganghao,A.RKOrdID ) AA inner join JYOrder_Main B on AA.MainId=B.MainId');
sql.Add(' inner join JYOrder_Sub C on AA.SubId=C.SubId ');
// ShowMessage(SQL.Text);
Open;
end;
SCreateCDS(ADOQueryTemp, CDS_MainSel);
SInitCDSData(ADOQueryTemp, CDS_MainSel);
end;
procedure TfrmFCSMCK.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmFCSMCK.FormDestroy(Sender: TObject);
begin
inherited;
frmFCSMCK := nil;
end;
procedure TfrmFCSMCK.FormShow(Sender: TObject);
begin
inherited;
BaoID.SetFocus;
ReadCxGrid(<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
end;
procedure TfrmFCSMCK.BaoIDKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
FSMID := TRIM(BaoID.Text);
BaoID.Text := '';
FRKOrdID := '';
FJYID := '';
if edtIsSMTH.Text = '' then
begin
//ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// if not JudgeSQD() then
// exit;
if Copy(FSMID, 1, 2) = 'RK' then
begin
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FRKOrdID := FSMID;
if JudgeRKD() then
SaveCKData();
end
else
begin
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FJYID := FSMID;
if JudgeJTM() then
SaveCKDataJTM();
end;
end
else
begin
//ɨ<><C9A8><EFBFBD>˻<EFBFBD>
if Copy(FSMID, 1, 2) = 'RK' then
begin
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FRKOrdID := FSMID;
if JudgeRKDCX() then
SaveCKDataCX();
end
else
begin
// application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FJYID := FSMID;
if JudgeJTMCX() then
SaveCKDataJTMCX();
end;
end;
InitCKGrid();
end;
end;
procedure TfrmFCSMCK.Button2Click(Sender: TObject);
begin
Close;
WriteCxGrid(<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
end;
procedure TfrmFCSMCK.Button1Click(Sender: TObject);
begin
if CKType.Text = '<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>' then
begin
try
frmZdyAttachment := TfrmZdyAttachment.Create(Application);
with frmZdyAttachment do
begin
if ShowModal = 1 then
begin
KHName.Text := Trim(CDS_HZ.fieldbyname('CoName').AsString);
end;
end;
finally
frmZdyAttachment.Free;
end;
end
else
begin
try
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
with frmZdyAttachGYS do
begin
if ShowModal = 1 then
begin
KHName.Text := Trim(CDS_HZ.fieldbyname('CoName').AsString);
end;
end;
finally
frmZdyAttachGYS.Free;
end;
end;
end;
procedure TfrmFCSMCK.Button3Click(Sender: TObject);
begin
if GetLSNo(ADOQueryTemp, FCKOrdNo, 'CK', 'CK_Cloth_CR', 4, 1) = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
exit;
end;
CKOrdNo.TEXT := FCKOrdNo;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into CK_BanCP_CKList(CKOrdNo) ');
sql.add('values(' + quotedstr(FCKOrdNo) + ') ');
ExecSQL;
end;
end;
procedure TfrmFCSMCK.CKTypeChange(Sender: TObject);
begin
KHName.Text := '';
end;
procedure TfrmFCSMCK.edtIsSMTHClick(Sender: TObject);
begin
BaoID.SetFocus;
if edtIsSMTH.Text = '<27><>' then
begin
edtIsSMTH.Text := '';
end
else
begin
if Application.MessageBox(<><C8B7>Ҫɨ<D2AA><C9A8><EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) = IDYES then
edtIsSMTH.Text := '<27><>';
end;
end;
procedure TfrmFCSMCK.CKOrdNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
FCKOrdNo := CKOrdNo.TEXT;
InitCKGrid();
end;
end;
procedure TfrmFCSMCK.Button4Click(Sender: TObject);
var
MKey: Char;
begin
MKey := #13;
try
frmCKProductBCPKCListSel := TfrmCKProductBCPKCListSel.Create(Application);
with frmCKProductBCPKCListSel do
begin
// CustomerNoName.text := trim(Self.KHName.text);
if ShowModal = 1 then
begin
with frmCKProductBCPKCListSel.CDS_Main do
begin
First;
while not Eof do
begin
if Fieldbyname('ssel').AsBoolean then
begin
BaoID.Text := Trim(Fieldbyname('JYID').AsString);
BaoIDKeyPress(BaoID, MKey);
Sleep(200);
end;
Next;
end;
end;
end;
end;
finally
frmCKProductBCPKCListSel.Free;
end;
InitCKGrid();
end;
end.