623 lines
16 KiB
ObjectPascal
623 lines
16 KiB
ObjectPascal
![]() |
unit U_NOSQSMCK;
|
|||
|
|
|||
|
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,
|
|||
|
RM_Common, RM_Class, RM_GridReport, RM_System, RM_Dataset, RM_e_Xls,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters,
|
|||
|
cxNavigator, dxDateRanges, dxBarBuiltInMenu, U_BaseList;
|
|||
|
|
|||
|
type
|
|||
|
TfrmSQSMCK = class(TFrmBaseList)
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
DS_MainSel: TDataSource;
|
|||
|
CDS_MainSel: TClientDataSet;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
Panel2: TPanel;
|
|||
|
Label5: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label9: TLabel;
|
|||
|
BaoID: TEdit;
|
|||
|
CRTime: TDateTimePicker;
|
|||
|
KHName: TEdit;
|
|||
|
Button2: TButton;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
Label12: TLabel;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
CRType: TEdit;
|
|||
|
Button1: TButton;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
RMDBMX: TRMDBDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
CDS_JuanPRT: TClientDataSet;
|
|||
|
Label10: TLabel;
|
|||
|
edtIsSMTH: TEdit;
|
|||
|
btn1: TButton;
|
|||
|
CDS_1: TClientDataSet;
|
|||
|
ds2: TDataSource;
|
|||
|
Panel1: TPanel;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
cv3Column3: TcxGridDBColumn;
|
|||
|
VC_MJXH: TcxGridDBColumn;
|
|||
|
v3Column1: TcxGridDBColumn;
|
|||
|
v3Column2: TcxGridDBColumn;
|
|||
|
cv3Column4: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
TV4: TcxGridDBTableView;
|
|||
|
cCXCONNO: TcxGridDBColumn;
|
|||
|
cV4Column1: TcxGridDBColumn;
|
|||
|
cCXCOLOR: TcxGridDBColumn;
|
|||
|
VC_SQQTY: TcxGridDBColumn;
|
|||
|
cCXFHPS: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
TV4Column1: TcxGridDBColumn;
|
|||
|
Tv3Column1: TcxGridDBColumn;
|
|||
|
TV4Column2: TcxGridDBColumn;
|
|||
|
TV4Column3: TcxGridDBColumn;
|
|||
|
CKNO: TEdit;
|
|||
|
Tv3Column2: TcxGridDBColumn;
|
|||
|
Tv3Column3: TcxGridDBColumn;
|
|||
|
GPM_2: TcxGridPopupMenu;
|
|||
|
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 edtIsSMTHClick(Sender: TObject);
|
|||
|
procedure btn1Click(Sender: TObject);
|
|||
|
procedure TV4MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
FCKNO, FSMStr, JXFlag, CZZT, fcuowu: string;
|
|||
|
procedure InitCKGrid();
|
|||
|
procedure InitSQGrid();
|
|||
|
function JudgeSQD(): Boolean;
|
|||
|
function JudgeBao(): Boolean;
|
|||
|
procedure SaveCKBao();
|
|||
|
function JudgeJTM(): Boolean;
|
|||
|
procedure SaveCKJTM();
|
|||
|
function JudgeJTMCX(): Boolean;
|
|||
|
procedure SaveCKJTMCX();
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmSQSMCK: TfrmSQSMCK;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, MMSystem, U_FHSQListSel, U_CKProductBCPKCListSel;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.SaveCKJTMCX();
|
|||
|
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='''',CKNO='''' ');
|
|||
|
sql.Add(' where CK_Cloth_CR.JYID=' + Quotedstr(Trim(FSMStr)));
|
|||
|
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
|
|||
|
sql.Add(' UPdate CK_Cloth_KC Set Valid=''Y'' ');
|
|||
|
sql.Add(' where CK_Cloth_KC.JYID=' + Quotedstr(Trim(FSMStr)));
|
|||
|
sql.Add(' and Valid=''N'' ');
|
|||
|
|
|||
|
sql.Add(' Update JY_Cloth Set JYCRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' where JY_Cloth.JYID=' + Quotedstr(Trim(FSMStr)));
|
|||
|
SQL.Add(' and JY_Cloth.JYCRType=''<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(FSMStr) + ' <20><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(FCKNO)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.TV4MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
|
|||
|
// InitCKGrid();
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmSQSMCK.JudgeJTMCX(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
if Trim(CKNO.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 RKNO,CKNO FROM CK_Cloth_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and JYID=' + quotedstr(FSMStr));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
raise Exception.Create('<27>ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
|
|||
|
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := false;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.SaveCKJTM();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
|||
|
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=''ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.add(',CKNO=' + Quotedstr(CKNO.Text));
|
|||
|
sql.Add(' where CK_Cloth_CR.JYID=' + Quotedstr(Trim(FSMStr)));
|
|||
|
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(' Valid=''N'' ');
|
|||
|
sql.Add(' where CK_Cloth_KC.JYID=' + Quotedstr(Trim(FSMStr)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE JY_Cloth Set JYCRType=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' ');
|
|||
|
sql.Add(' where JY_Cloth.JYID=' + Quotedstr(Trim(FSMStr)));
|
|||
|
SQL.Add(' and JY_Cloth.JYCRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
function TfrmSQSMCK.JudgeJTM(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
if Trim(CKNO.Text) = '' then
|
|||
|
raise Exception.Create('δɨ<CEB4><C9A8><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>!');
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select JYID from JY_Cloth where JYID=' + quotedstr(trim(FSMStr)));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
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 * from JY_Cloth A inner join FHSQ_Sub B on A.Subid=B.Subid ');
|
|||
|
sql.Add('where A.JYID=' + quotedstr(trim(FSMStr)));
|
|||
|
sql.Add('and B.FSID=' + quotedstr(trim(CKNO.Text)));
|
|||
|
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 RKNO from CK_Cloth_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and JYID=' + quotedstr(trim(FSMStr)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
raise Exception.Create('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT RKNO,CKNO FROM CK_Cloth_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and JYID=' + quotedstr(trim(FSMStr)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('CKNO').AsString) = Trim(CKNO.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('wav\'+Exception(ExceptObject).Message+'.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmSQSMCK.JudgeBao(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
|
|||
|
if Trim(CKNO.Text) = '' then
|
|||
|
raise Exception.Create('δɨ<CEB4><C9A8><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>!');
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JY_Cloth A ');
|
|||
|
sql.Add('where Baoid=' + quotedstr(trim(FSMStr)));
|
|||
|
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 * from JY_Cloth A inner join FHSQ_Sub B on A.Subid=B.Subid ');
|
|||
|
sql.Add('where A.Baoid=' + quotedstr(trim(FSMStr)));
|
|||
|
sql.Add('and B.FSID=' + quotedstr(trim(CKNO.Text)));
|
|||
|
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 RKNO,CKNO FROM CK_Cloth_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and Baoid=' + quotedstr(trim(FSMStr)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if not ADOQueryTemp.IsEmpty then
|
|||
|
raise Exception.Create('<27><>ɨ<EFBFBD><C9A8>!');
|
|||
|
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := false;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.SaveCKBao();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_Cloth_KC Set ');
|
|||
|
sql.add(' Valid=''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.Baoid=' + Quotedstr(FSMStr) + ') ');
|
|||
|
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(',CKNO=' + Quotedstr(CKNO.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.Baoid=' + Quotedstr(FSMStr) + ') ');
|
|||
|
sql.Add('and CK_Cloth_CR.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE JY_Cloth Set JYCRType=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' ');
|
|||
|
sql.Add(' where exists (select JYID from CK_Cloth_CR X where JY_Cloth.JYID=X.JYID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.Baoid=' + Quotedstr(FSMStr) + ') ');
|
|||
|
SQL.Add(' and JY_Cloth.JYCRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmSQSMCK.JudgeSQD(): Boolean;
|
|||
|
begin
|
|||
|
Result := false;
|
|||
|
try
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from FHSQ_Main A inner join FHSQ_Sub B on A.FSID=B.FSID where A.FSID=''' + Trim(FSMStr) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
raise Exception.Create('<27><><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>!');
|
|||
|
|
|||
|
if Trim(CKNO.Text) <> '' then
|
|||
|
begin
|
|||
|
FCKNO := Trim(CKNO.Text);
|
|||
|
end;
|
|||
|
CKNO.Text := Trim(FSMStr);
|
|||
|
if FSMStr <> FCKNO then
|
|||
|
begin
|
|||
|
InitCKGrid();
|
|||
|
InitSQGrid();
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
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;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
frmSQSMCK := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
BaoID.SetFocus;
|
|||
|
ReadCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv4', Tv4, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
ReadCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv3', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.BaoIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
maxno, SMFlag, KYCKFlag, FMainId, ff: string;
|
|||
|
FFQty: Integer;
|
|||
|
begin
|
|||
|
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
FSMStr := TRIM(BaoID.Text);
|
|||
|
if Copy(FSMStr, 1, 2) = 'SM' then
|
|||
|
begin
|
|||
|
if not JudgeSQD() then
|
|||
|
exit;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if Trim(edtIsSMTH.Text) = '' then
|
|||
|
begin
|
|||
|
if Copy(FSMStr, 1, 2) = 'BI' then
|
|||
|
begin
|
|||
|
if not JudgeBao() then
|
|||
|
exit;
|
|||
|
SaveCKBao();
|
|||
|
PlaySound('wav/<2F><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if not JudgeJTM() then
|
|||
|
exit;
|
|||
|
SaveCKJTM();
|
|||
|
PlaySound('wav/<2F><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if JudgeJTMCX() then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
SaveCKJTMCX();
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_FH_UP_FHQty ''' + Trim(CKNO.Text) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
InitSQGrid();
|
|||
|
InitCKGrid();
|
|||
|
end;
|
|||
|
|
|||
|
BaoID.Text := '';
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv4', Tv4, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
WriteCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv3', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
Close;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.Button1Click(Sender: TObject);
|
|||
|
var
|
|||
|
MKey: Char;
|
|||
|
begin
|
|||
|
MKey := #13;
|
|||
|
try
|
|||
|
frmFHSQListSel := TfrmFHSQListSel.Create(self);
|
|||
|
with frmFHSQListSel do
|
|||
|
begin
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
BaoID.Text := Trim(Order_Main.fieldbyname('FSID').AsString);
|
|||
|
BaoIDKeyPress(BaoID, MKey);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmFHSQListSel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.edtIsSMTHClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(edtIsSMTH.Text) = '' then
|
|||
|
edtIsSMTH.Text := '<27><>'
|
|||
|
else
|
|||
|
edtIsSMTH.Text := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.btn1Click(Sender: TObject);
|
|||
|
var
|
|||
|
MKey: Char;
|
|||
|
begin
|
|||
|
MKey := #13;
|
|||
|
CZZT := 'ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
fcuowu := '1';
|
|||
|
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
|
|||
|
|
|||
|
Self.BaoID.Text := Trim(Fieldbyname('JYID').AsString);
|
|||
|
BaoIDKeyPress(Self.BaoID, MKey);
|
|||
|
if fcuowu = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
Break;
|
|||
|
end;
|
|||
|
Sleep(200);
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCKProductBCPKCListSel.Free;
|
|||
|
end;
|
|||
|
InitCKGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.InitSQGrid();
|
|||
|
begin
|
|||
|
if CKNO.Text <> '' then
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT b.*,A.ConNo FROM FHSQ_Sub B');
|
|||
|
sql.Add('inner join FHSQ_Main A ON A.FSId=B.FSId ');
|
|||
|
sql.Add('WHERE B.FSId=''' + Trim(CKNO.Text) + '''');
|
|||
|
|
|||
|
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, CDS_1);
|
|||
|
SInitCDSData(ADOQueryTemp, CDS_1);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSQSMCK.InitCKGrid();
|
|||
|
begin
|
|||
|
if CKNO.Text <> '' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select *');
|
|||
|
sql.Add(' from CK_Cloth_CR A');
|
|||
|
sql.Add(' where A.CKNo=''' + Trim(CKNO.Text) + '''');
|
|||
|
Open;
|
|||
|
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, CDS_MainSel);
|
|||
|
SInitCDSData(ADOQueryTemp, CDS_MainSel);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|