636 lines
17 KiB
ObjectPascal
636 lines
17 KiB
ObjectPascal
unit U_LSSQSMCK;
|
||
|
||
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;
|
||
|
||
type
|
||
TfrmLSSQSMCK = class(TForm)
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
DS_MainSel: TDataSource;
|
||
CDS_MainSel: TClientDataSet;
|
||
cxGridPopupMenu4: TcxGridPopupMenu;
|
||
cxGrid3: TcxGrid;
|
||
Tv3: TcxGridDBTableView;
|
||
v3Column1: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
v3Column2: TcxGridDBColumn;
|
||
Panel2: TPanel;
|
||
Label4: TLabel;
|
||
CKOrdNo: TEdit;
|
||
SMID: TEdit;
|
||
CRTime: TDateTimePicker;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
Label12: TLabel;
|
||
CDS_Main: TClientDataSet;
|
||
Label3: TLabel;
|
||
Edit1: TEdit;
|
||
cxGrid1: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
V2Column1: TcxGridDBColumn;
|
||
DS_FHSQ: TDataSource;
|
||
CDS_FHSQ: TClientDataSet;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
CRType: TEdit;
|
||
Label1: TLabel;
|
||
Label6: TLabel;
|
||
edtIsSMTH: TEdit;
|
||
V2Column2: TcxGridDBColumn;
|
||
V2Column3: TcxGridDBColumn;
|
||
V2Column4: TcxGridDBColumn;
|
||
Panel1: TPanel;
|
||
Button1: TButton;
|
||
Button3: TButton;
|
||
Button2: TButton;
|
||
Label2: TLabel;
|
||
Label7: TLabel;
|
||
Button4: TButton;
|
||
v3Column3: TcxGridDBColumn;
|
||
TV2Column1: TcxGridDBColumn;
|
||
cxStyleRepository2: TcxStyleRepository;
|
||
cxStyle2: TcxStyle;
|
||
Button5: TButton;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure SMIDKeyPress(Sender: TObject; var Key: Char);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure TV2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure Button3Click(Sender: TObject);
|
||
procedure edtIsSMTHClick(Sender: TObject);
|
||
procedure Button4Click(Sender: TObject);
|
||
procedure Button5Click(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
FSMStr, JXFlag, FSubId: string;
|
||
FFHPS, FSQPS: integer;
|
||
procedure InitFHMX();
|
||
function CheckCkd(): Boolean;
|
||
function CheckPB(): Boolean;
|
||
function JudgeJTMCX(): Boolean;
|
||
procedure SaveCKDataJTMCX();
|
||
procedure SaveCK();
|
||
procedure InitFHPS();
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmLSSQSMCK: TfrmLSSQSMCK;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, MMSystem, U_LSFHSQListSel;
|
||
|
||
//var
|
||
// frmPBKCListSel: TfrmCKProductBCPKCListPB; LS
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmLSSQSMCK.SaveCKDataJTMCX();
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update CK_YT_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType=NULL,CRTime=NULL,CRNote=NULL,CKNo=NULL ');
|
||
sql.Add(' where CK_YT_CR.JYID=' + Quotedstr(Trim(FSMStr)));
|
||
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
||
|
||
sql.Add(' UPdate CK_YT_KC Set Valid=''Y'' ');
|
||
sql.Add(' where CK_YT_KC.JYID=' + Quotedstr(Trim(FSMStr)));
|
||
sql.Add(' and Valid=''N'' ');
|
||
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_FHSQYT_UP_QTY ' + quotedstr(trim(CKOrdNo.Text)));
|
||
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><CBBF><EFBFBD><EFBFBD>ɨ<EFBFBD>賷<EFBFBD><E8B3B7>')));
|
||
sql.Add(',' + quotedstr('<27><><EFBFBD>룺' + trim(FSMStr) + ' <20><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CKOrdNo.Text)));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
FFHPS := FFHPS - 1;
|
||
InitFHMX();
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
function TfrmLSSQSMCK.JudgeJTMCX(): Boolean;
|
||
begin
|
||
try
|
||
Result:=False;
|
||
if Trim(CKOrdNo.Text) = '' then
|
||
begin
|
||
JXFlag:='';
|
||
PlaySound('wav\<5C><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Application.MessageBox('<27><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>','<27><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',0);
|
||
Exit;
|
||
end;
|
||
|
||
if CDS_MainSel.IsEmpty then
|
||
begin
|
||
JXFlag:='';
|
||
PlaySound('wav\<5C>ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Application.MessageBox('<27>ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',0);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.SQPiQty,A.FHPiQty,A.FHSubId,B.* from SQ_FHYT_Sub A');
|
||
sql.Add(' inner join CK_YT_CR B on A.FactoryName=B.FactoryName');
|
||
sql.Add(' and A.Y_CodeName=B.Y_CodeName and A.Y_Spec=B.Y_Spec');
|
||
sql.Add(' and A.BatchNo=B.BatchNo and A.ZGColor=B.ZGColor');
|
||
sql.Add(' and A.Y_CodeNameCP=B.Y_CodeNameCP and A.Y_Type=B.Y_Type');
|
||
sql.Add(' where A.FHMainID=''' + Trim(CKOrdNo.Text) + '''');
|
||
sql.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and B.JYID=''' + Trim(FSMStr) + '''');
|
||
Open;
|
||
end;
|
||
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
JXFlag:='';
|
||
PlaySound('wav\<5C>ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Application.MessageBox('<27>ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>',0);
|
||
Exit;
|
||
end
|
||
else
|
||
begin
|
||
FSubId := ADOQueryTemp.fieldbyname('FHSubId').AsString;
|
||
FSQPS := ADOQueryTemp.fieldbyname('SQPiQty').AsInteger;
|
||
FFHPS := ADOQueryTemp.fieldbyname('FHPiQty').AsInteger;
|
||
end;
|
||
Result := True;
|
||
except
|
||
Result := false;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.InitFHPS();
|
||
begin
|
||
with CDS_FHSQ do
|
||
begin
|
||
Locate('FHSubId', FSubId, []);
|
||
Edit;
|
||
FieldByName('FHPiQty').Value := FFHPS;
|
||
Post;
|
||
Edit1.Text := IntToStr(FFHPS)
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.SaveCK();
|
||
var
|
||
maxno, SMFlag, KYCKFlag: string;
|
||
FFQty: Integer;
|
||
begin
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPDATE CK_YT_CR Set ');
|
||
sql.add(' CRTime=getdate() ');
|
||
sql.add(',CRType=' + quotedstr(Trim(CRType.Text)));
|
||
sql.add(',CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
sql.add(',CKNo=' + Quotedstr(CKOrdNo.Text));
|
||
sql.Add(' where CK_YT_CR.JYID=' + Quotedstr(Trim(FSMStr)));
|
||
sql.Add('and CK_YT_CR.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPDATE CK_YT_KC Set ');
|
||
sql.add(' Valid=''N'' ');
|
||
sql.Add(' where CK_YT_KC.JYID=' + Quotedstr(Trim(FSMStr)));
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_FHSQYT_UP_QTY ' + quotedstr(trim(CKOrdNo.Text)));
|
||
ExecSQL;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
FFHPS := FFHPS + 1;
|
||
InitFHMX();
|
||
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
PlaySound('wav\<5C><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
function TfrmLSSQSMCK.CheckCkd(): Boolean;
|
||
begin
|
||
try
|
||
Result:=False;
|
||
JXFlag:='JX';
|
||
if CKOrdNo.Text = Trim(FSMStr) then
|
||
begin
|
||
PlaySound('wav\<5C><><EFBFBD>뵥<EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from SQ_FHYT_Main A inner join SQ_FHYT_Sub B on A.FHMainId=B.FHMainId where A.FHMainId=''' + Trim(FSMStr) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
JXFlag:='';
|
||
PlaySound('wav\<5C><><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Application.MessageBox('<27><><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end
|
||
else
|
||
begin
|
||
SCreateCDS20(ADOQueryTemp, CDS_FHSQ);
|
||
SInitCDSData20(ADOQueryTemp, CDS_FHSQ);
|
||
CKOrdNo.Text := Trim(FSMStr);
|
||
CRType.Text := Trim(CDS_FHSQ.FieldByName('SQType').AsString);
|
||
InitFHMX();
|
||
end;
|
||
Result := True;
|
||
except
|
||
Result := false;
|
||
end;
|
||
|
||
end;
|
||
|
||
function TfrmLSSQSMCK.CheckPB(): Boolean;
|
||
begin
|
||
|
||
try
|
||
JXFlag:='JX';
|
||
if Trim(CKOrdNo.Text) = '' then
|
||
begin
|
||
JXFlag:='';
|
||
PlaySound('wav\δѡ<CEB4><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Application.MessageBox('δѡ<CEB4><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from SQ_FHYT_Main where FHMainID='''+Trim(CKOrdNo.Text)+'''');
|
||
sql.Add(' and EndFlag=1 ');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty=False then
|
||
begin
|
||
JXFlag:='';
|
||
PlaySound('wav\<5C>ѽ<EFBFBD><D1BD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Application.MessageBox('<27>ѽ<EFBFBD><D1BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.SQPiQty,A.FHPiQty,A.FHSubid,B.* from SQ_FHYT_Sub A');
|
||
sql.Add(' inner join JY_YT B on A.FactoryName=B.FactoryName');
|
||
sql.Add(' and A.Y_CodeName=B.Y_CodeName and A.Y_Spec=B.Y_Spec');
|
||
sql.Add(' and A.BatchNo=B.BatchNo and A.ZGColor=B.ZGColor');
|
||
sql.Add(' and A.Y_CodeNameCP=B.Y_CodeNameCP and A.Y_Type=B.Y_Type');
|
||
sql.Add(' where A.FHMainID=''' + Trim(CKOrdNo.Text) + '''');
|
||
sql.Add(' and B.JYID=''' + Trim(FSMStr) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
JXFlag:='';
|
||
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end
|
||
else
|
||
begin
|
||
FSubId := ADOQueryTemp.fieldbyname('FHSubId').AsString;
|
||
FSQPS := ADOQueryTemp.fieldbyname('SQPiQty').AsInteger;
|
||
FFHPS := ADOQueryTemp.fieldbyname('FHPiQty').AsInteger;
|
||
if FSQPS <= FFHPS then
|
||
begin
|
||
JXFlag:='';
|
||
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.SQPiQty,A.FHPiQty,A.FHSubid,B.* from SQ_FHYT_Sub A');
|
||
sql.Add(' inner join JY_YT B on A.FactoryName=B.FactoryName');
|
||
sql.Add(' and A.Y_CodeName=B.Y_CodeName and A.Y_Spec=B.Y_Spec');
|
||
sql.Add(' and A.BatchNo=B.BatchNo and A.ZGColor=B.ZGColor');
|
||
sql.Add(' and A.Y_CodeNameCP=B.Y_CodeNameCP and A.Y_Type=B.Y_Type');
|
||
sql.Add(' where A.FHMainID=''' + Trim(CKOrdNo.Text) + '''');
|
||
sql.Add(' and B.JYID=''' + Trim(FSMStr) + '''');
|
||
sql.Add(' and ((B.JYNW>=20 and B.JYNW<=45 and B.ZGKS=6) or B.ChuLiFlag=1)');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
JXFlag:='';
|
||
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select C.CKNo from SQ_FHYT_Sub A');
|
||
sql.Add(' inner join JY_YT B on A.FactoryName=B.FactoryName');
|
||
sql.Add(' and A.Y_CodeName=B.Y_CodeName and A.Y_Spec=B.Y_Spec');
|
||
sql.Add(' and A.BatchNo=B.BatchNo and A.ZGColor=B.ZGColor');
|
||
sql.Add(' and A.Y_CodeNameCP=B.Y_CodeNameCP and A.Y_Type=B.Y_Type');
|
||
sql.Add(' inner join CK_YT_CR C on B.JYID=C.JYID and C.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(' where B.JYID=''' + Trim(FSMStr) + '''');
|
||
sql.Add(' and A.FHMainId=''' + Trim(CKOrdNo.Text) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
if Trim(ADOQueryTemp.fieldbyname('CKNo').AsString) = Trim(CKOrdNo.Text) then
|
||
begin
|
||
JXFlag:='';
|
||
PlaySound('wav\<5C><>ɨ<EFBFBD><C9A8>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end
|
||
else
|
||
begin
|
||
JXFlag:='';
|
||
PlaySound('wav\<5C>ѳ<EFBFBD><D1B3><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Application.MessageBox('<27>ѳ<EFBFBD><D1B3><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
Result := True;
|
||
except
|
||
Result := false;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmLSSQSMCK := nil;
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.FormShow(Sender: TObject);
|
||
begin
|
||
SMID.SetFocus;
|
||
//ReadCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
||
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.InitFHMX();
|
||
var
|
||
MFHPS: integer;
|
||
begin
|
||
if CDS_FHSQ.IsEmpty then
|
||
Exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* ');
|
||
sql.Add(' from CK_YT_CR A');
|
||
sql.Add(' where A.CKNO=' + quotedstr(Trim(CKOrdNo.Text)));
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_MainSel);
|
||
SInitCDSData20(ADOQueryTemp, CDS_MainSel);
|
||
if CDS_MainSel.IsEmpty = False then
|
||
MFHPS := Tv3.DataController.Summary.FooterSummaryValues[0]
|
||
else
|
||
MFHPS := 0;
|
||
|
||
Edit1.Text := IntToStr(MFHPS);
|
||
with CDS_FHSQ do
|
||
begin
|
||
Edit;
|
||
FieldByName('FHPiQty').Value := MFHPS;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.SMIDKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
FSMStr := Trim(SMID.Text);
|
||
SMID.Text := '';
|
||
if edtIsSMTH.Text = '' then
|
||
begin
|
||
if Copy(FSMStr, 1, 2) = 'FC' then
|
||
begin
|
||
CheckCkd();
|
||
if JXFlag<>'JX' then
|
||
begin
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
if CheckPB() then
|
||
begin
|
||
if JXFlag<>'JX' then Exit;
|
||
SaveCK();
|
||
InitFHPS();
|
||
end;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
if JudgeJTMCX() then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
begin
|
||
SaveCKDataJTMCX();
|
||
InitFHPS();
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.Button2Click(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.Button1Click(Sender: TObject);
|
||
var
|
||
MKey: Char;
|
||
begin
|
||
MKey := #13;
|
||
try
|
||
frmLSFHSQListSel := TfrmLSFHSQListSel.Create(Application);
|
||
with frmLSFHSQListSel do
|
||
begin
|
||
FSQType:='<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
SMID.Text := Trim(Order_Main.fieldbyname('FHMainId').AsString);
|
||
SMIDKeyPress(SMID, MKey);
|
||
end;
|
||
end;
|
||
finally
|
||
frmLSFHSQListSel.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.TV2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
InitFHMX();
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.Button3Click(Sender: TObject);
|
||
var
|
||
MKey: Char;
|
||
begin
|
||
// MKey := #13;
|
||
// if TRIM(SELF.CKOrdNo.Text) = '' then
|
||
// EXIT;
|
||
// try
|
||
// frmPBKCListSel := TfrmCKProductBCPKCListPB.Create(self);
|
||
// with frmPBKCListSel do
|
||
// begin
|
||
//
|
||
// if ShowModal = 1 then
|
||
// begin
|
||
// while frmPBKCListSel.CDS_Main.Locate('SSel', true, []) do
|
||
// begin
|
||
// self.SMID.Text := Trim(frmPBKCListSel.CDS_Main.fieldbyname('MJID').AsString);
|
||
// self.SMIDKeyPress(SMID, MKey);
|
||
// frmPBKCListSel.CDS_Main.Delete;
|
||
// sleep(500);
|
||
// end;
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmPBKCListSel.Free;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.edtIsSMTHClick(Sender: TObject);
|
||
begin
|
||
SMID.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 TfrmLSSQSMCK.Button4Click(Sender: TObject);
|
||
var
|
||
MKey: Char;
|
||
begin
|
||
MKey := #13;
|
||
try
|
||
frmLSFHSQListSel := TfrmLSFHSQListSel.Create(Application);
|
||
with frmLSFHSQListSel do
|
||
begin
|
||
FSQType:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
SMID.Text := Trim(Order_Main.fieldbyname('FHMainId').AsString);
|
||
SMIDKeyPress(SMID, MKey);
|
||
end;
|
||
end;
|
||
finally
|
||
frmLSFHSQListSel.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmLSSQSMCK.Button5Click(Sender: TObject);
|
||
var
|
||
MKey: Char;
|
||
begin
|
||
MKey := #13;
|
||
try
|
||
frmLSFHSQListSel := TfrmLSFHSQListSel.Create(Application);
|
||
with frmLSFHSQListSel do
|
||
begin
|
||
FSQType:='<27><><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
SMID.Text := Trim(Order_Main.fieldbyname('FHMainId').AsString);
|
||
SMIDKeyPress(SMID, MKey);
|
||
end;
|
||
end;
|
||
finally
|
||
frmLSFHSQListSel.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
end.
|
||
|