638 lines
17 KiB
ObjectPascal
638 lines
17 KiB
ObjectPascal
![]() |
unit U_CPSQSMCK;
|
|||
|
|
|||
|
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
|
|||
|
TfrmCPSQSMCK = class(TForm)
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
DS_MainSel: TDataSource;
|
|||
|
CDS_MainSel: TClientDataSet;
|
|||
|
cxGridPopupMenu4: TcxGridPopupMenu;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
v3Column1: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
v3Column2: TcxGridDBColumn;
|
|||
|
Panel2: TPanel;
|
|||
|
Label5: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
CKOrdNo: TEdit;
|
|||
|
SMID: TEdit;
|
|||
|
CRTime: TDateTimePicker;
|
|||
|
Button2: TButton;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
Label12: TLabel;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
Button1: TButton;
|
|||
|
Label2: TLabel;
|
|||
|
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;
|
|||
|
Button3: TButton;
|
|||
|
CRType: TEdit;
|
|||
|
Label1: TLabel;
|
|||
|
Label6: TLabel;
|
|||
|
edtIsSMTH: TEdit;
|
|||
|
TV2Column1: TcxGridDBColumn;
|
|||
|
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);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
FSMStr, JXFlag, FSubId, FAPBatchNo, FCarNo, isGX, FIsFJT: 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
|
|||
|
frmCPSQSMCK: TfrmCPSQSMCK;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, MMSystem, U_FHSQListSel, U_PBKCListSel; //, U_CKProductBCPKCList
|
|||
|
|
|||
|
//var
|
|||
|
// frmPBKCListSel: TfrmCKProductBCPKCListPB;
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.SaveCKDataJTMCX();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_PBCK @CRFlag=''δ<><CEB4><EFBFBD><EFBFBD>'', @CKOrdNo=' + quotedstr(trim(CKOrdNo.Text)) + ', @MJID=' + quotedstr(trim(FSMStr)) + ', @DName=' + quotedstr(trim(DName)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_FHSQ ''' + 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>ɨ<EFBFBD>賷<EFBFBD><E8B3B7>')));
|
|||
|
sql.Add(',' + quotedstr('<27><><EFBFBD><EFBFBD><EFBFBD>룺' + trim(FSMStr) + ' <20><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CKOrdNo.Text)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
FFHPS := FFHPS - 1;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmCPSQSMCK.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 A.SQPS,A.FHPS,B.* from FHSQ_Sub A');
|
|||
|
sql.Add(' inner join CK_PBCP_CR B on A.MainId=B.MainId');
|
|||
|
sql.Add(' where A.FSID=''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
sql.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and B.MJID=''' + Trim(FSMStr) + '''');
|
|||
|
// ShowMessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
raise Exception.Create('<27>ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
FSubId := ADOQueryTemp.fieldbyname('SubId').AsString;
|
|||
|
FSQPS := ADOQueryTemp.fieldbyname('SQPS').AsInteger;
|
|||
|
FFHPS := ADOQueryTemp.fieldbyname('FHPS').AsInteger;
|
|||
|
end;
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := false;
|
|||
|
PlaySound(PChar('wav\' + Exception(ExceptObject).Message + '.wav'), 0, SND_FILENAME or SND_ASYNC);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.InitFHPS();
|
|||
|
begin
|
|||
|
with CDS_FHSQ do
|
|||
|
begin
|
|||
|
Locate('SubId;APBatchNo', VarArrayOf([Trim(FSubId), Trim(FAPBatchNo)]), []);
|
|||
|
Edit;
|
|||
|
FieldByName('FHPSHZ').Value := FFHPS;
|
|||
|
Post;
|
|||
|
Edit1.Text := IntToStr(FFHPS)
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.SaveCK();
|
|||
|
var
|
|||
|
maxno, SMFlag, KYCKFlag: string;
|
|||
|
FFQty: Integer;
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>Ͱ<EFBFBD><CDB0><EFBFBD><EFBFBD>Ÿ<EFBFBD><C5B8>³<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD>DZ<EFBFBD><C7B1><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>ţ<EFBFBD><C5A3>ֶ<EFBFBD>ΪWFB_MJJY_PB<50>е<EFBFBD>YuanAPBatchNo
|
|||
|
if isGX = '<27><>' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select top 1 isnull(APBatchNo,'''') AS APBatchNo from FHSQ_Sub where isnull(FHPS,0) < isnull(SQPS,0) and FSID =''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
sql.Add('and SubID=''' + Trim(FSubID) + '''');
|
|||
|
// ShowMessage(sql.text);
|
|||
|
open;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE WFB_MJJY_PB set YuanAPBatchNo =isnull(APBatchNo,''''),APBatchNo=''' + Trim(ADOQueryCmd.fieldbyname('APBatchNo').AsString) + '''');
|
|||
|
sql.Add('where MJID = ''' + Trim(FSMStr) + '''');
|
|||
|
// ShowMessage(sql.text);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_PBCK @CRFlag=''ֱ<>ӳ<EFBFBD><D3B3><EFBFBD>'', @CKOrdNo=' + quotedstr(trim(CKOrdNo.Text)) + ', @MJID=' + quotedstr(trim(FSMStr)) + ', @DName=' + quotedstr(trim(DName)));
|
|||
|
// ShowMessage(sql.text);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_FHSQ ''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
// ShowMessage(sql.text);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
FFHPS := FFHPS + 1;
|
|||
|
|
|||
|
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
Exit;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
PlaySound('wav\<5C><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmCPSQSMCK.CheckCkd(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
if CKOrdNo.Text = Trim(FSMStr) then
|
|||
|
raise Exception.Create('<27>ظ<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>뵥!.wav');
|
|||
|
|
|||
|
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
|
|||
|
begin
|
|||
|
raise Exception.Create('<27><><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav');
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_FHSQ);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_FHSQ);
|
|||
|
CKOrdNo.Text := Trim(FSMStr);
|
|||
|
CRType.Text := Trim(CDS_FHSQ.FieldByName('CRType').AsString);
|
|||
|
InitFHMX();
|
|||
|
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 TfrmCPSQSMCK.CheckPB(): Boolean;
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
|
|||
|
if Trim(CKOrdNo.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 (select APID=SUBSTRING(OPEvent,4,13) from SY_Syslog where Acction =''<27><><EFBFBD>ϲ<EFBFBD>Ʊ'' and Operor <> ''ygname'' ');
|
|||
|
sql.Add(' )AA where APID = ''' + Trim(FSMStr) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = false then
|
|||
|
begin
|
|||
|
raise Exception.Create('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from JYCon_Sub_AnPai B ');
|
|||
|
sql.Add(' where B.APID=''' + Trim(FSMStr) + '''');
|
|||
|
// showmessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select isnull(APBatchNo,'''') AS APBatchNo,A.*,B.* from WFB_MJJY_PB B inner join Cloth_Sub A on A.SubID =B.SubID ');
|
|||
|
sql.Add(' where B.MJID=''' + Trim(FSMStr) + '''');
|
|||
|
// showmessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
raise Exception.Create('δ<><CEB4><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('MJStr2').AsString) = 'δ<><CEB4><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
raise Exception.Create('δ<><CEB4><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
FSubId := Trim(ADOQueryTemp.fieldbyname('SubID').AsString); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD><C6B1>subid
|
|||
|
FAPBatchNo := Trim(ADOQueryTemp.fieldbyname('APBatchNo').AsString); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
FCarNo := Trim(ADOQueryTemp.fieldbyname('CarNo').AsString); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD>Ļ<EFBFBD>̨<EFBFBD><CCA8>
|
|||
|
|
|||
|
//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>subid<69>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from FHSQ_Sub ');
|
|||
|
sql.Add(' where FSID=''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
sql.Add(' and SubID=''' + Trim(FSubId) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
raise Exception.Create('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from FHSQ_Sub ');
|
|||
|
sql.Add(' where FSID=''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
sql.Add(' and SubID=''' + Trim(FSubId) + '''');
|
|||
|
sql.Add(' and isnull(APBatchNo,'''')=''' + Trim(FAPBatchNo) + '''');
|
|||
|
// showmessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
PlaySound(PChar('wav\<5C><><EFBFBD>Ų<EFBFBD>һ<EFBFBD><D2BB>.wav'), 0, SND_FILENAME or SND_ASYNC);
|
|||
|
isGX := '<27><>';
|
|||
|
if Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD>һ<EFBFBD>£<EFBFBD><C2A3>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>⣿', '<27><>ʾ', 32 + 4) = IDYES then
|
|||
|
begin
|
|||
|
isGX := '<27><>'; //Ҫ<><D2AA><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Result := false;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
//<2F><>һ<EFBFBD><D2BB>ͬ<EFBFBD><CDAC>Ʒ<EFBFBD><C6B7>û<EFBFBD><C3BB>ȫ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select top 1 * from FHSQ_Sub where isnull(FHPS,0) < isnull(SQPS,0) and FSID =''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
sql.Add('and SubID=''' + Trim(FSubID) + '''');
|
|||
|
// ShowMessage(sql.text);
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.IsEmpty then
|
|||
|
begin
|
|||
|
//<2F>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻῨ<CDBB><E1BFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
FSQPS := 0;
|
|||
|
FFHPS := 1;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
//<2F>ҵĵ<D2B5><C4B5>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>Ϊ<EFBFBD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
FSQPS := ADOQueryCmd.fieldbyname('SQPS').AsInteger;
|
|||
|
FFHPS := ADOQueryCmd.fieldbyname('FHPS').AsInteger;
|
|||
|
FIsFJT := '<27><>';
|
|||
|
end;
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
FSQPS := ADOQueryTemp.fieldbyname('SQPS').AsInteger;
|
|||
|
FFHPS := ADOQueryTemp.fieldbyname('FHPS').AsInteger;
|
|||
|
FIsFJT := Trim(ADOQueryTemp.fieldbyname('IsFJT').AsString); //<2F>Ƿ<EFBFBD><C7B7>ֻ<EFBFBD>̨
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(FIsFJT) = '<27><>' then
|
|||
|
begin
|
|||
|
//<2F><>ѯһ<D1AF><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⵥ<EFBFBD>ŵ<EFBFBD>һ<EFBFBD>γ<EFBFBD><CEB3><EFBFBD><EFBFBD>Ļ<EFBFBD>̨<EFBFBD>ţ<EFBFBD>
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select top 1 B.CarNo from CK_PBCP_CR A inner join WFB_MJJY_PB B on A.MJID =B.MJID ');
|
|||
|
sql.Add(' where A.SubId=''' + Trim(FSubId) + '''');
|
|||
|
sql.Add(' and A.CKOrdNo=''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
sql.Add(' order by CRTime ');
|
|||
|
// showmessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if (ADOQueryTemp.IsEmpty = False) and (Trim(ADOQueryTemp.fieldbyname('CarNo').AsString) <> FCarNo) then
|
|||
|
begin
|
|||
|
PlaySound(PChar('wav\<5C><>̨<EFBFBD>Ų<EFBFBD>һ<EFBFBD><D2BB>.wav'), 0, SND_FILENAME or SND_ASYNC);
|
|||
|
if Application.MessageBox('<27><>̨<EFBFBD>Ų<EFBFBD>һ<EFBFBD>£<EFBFBD><C2A3>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>⣿', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
begin
|
|||
|
Result := false;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
if FSQPS <= FFHPS then
|
|||
|
begin
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select C.CKOrdNo from FHSQ_Sub A');
|
|||
|
sql.Add(' inner join WFB_MJJY_PB B on A.MainId=B.MainId');
|
|||
|
sql.Add(' inner join CK_PBCP_CR C on B.MJID=C.MJID and C.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' where B.MJID=''' + Trim(FSMStr) + '''');
|
|||
|
sql.Add(' and A.FSID=''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
// ShowMessage(SQL.text);
|
|||
|
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;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmCPSQSMCK := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
SMID.SetFocus;
|
|||
|
ReadCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.InitFHMX();
|
|||
|
var
|
|||
|
MFHPS: integer;
|
|||
|
begin
|
|||
|
if CDS_FHSQ.IsEmpty then
|
|||
|
Exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select B.* ');
|
|||
|
sql.Add(' from CK_PBCP_CR A');
|
|||
|
sql.Add(' inner join WFB_MJJY_PB B on A.MJID=B.MJID');
|
|||
|
sql.Add(' where A.CKOrdNo=' + quotedstr(Trim(CKOrdNo.Text)));
|
|||
|
sql.Add(' and A.SubId=' + quotedstr(Trim(CDS_FHSQ.FieldByName('SubId').AsString)));
|
|||
|
sql.Add(' and isnull(B.APBatchNo,'''')=' + quotedstr(Trim(CDS_FHSQ.FieldByName('APBatchNo').AsString)));
|
|||
|
// ShowMessage(sql.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('FHPS').Value := MFHPS;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.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) = 'CK' then
|
|||
|
begin
|
|||
|
if CheckCkd() then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if CheckPB() then
|
|||
|
begin
|
|||
|
SaveCK();
|
|||
|
InitFHPS();
|
|||
|
InitFHMX();
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if JudgeJTMCX() then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
SaveCKDataJTMCX();
|
|||
|
InitFHPS();
|
|||
|
InitFHMX
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
WriteCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.Button1Click(Sender: TObject);
|
|||
|
var
|
|||
|
MKey: Char;
|
|||
|
begin
|
|||
|
MKey := #13;
|
|||
|
try
|
|||
|
frmFHSQListSel := TfrmFHSQListSel.Create(self);
|
|||
|
with frmFHSQListSel do
|
|||
|
begin
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
SMID.Text := Trim(Order_Main.fieldbyname('FSID').AsString);
|
|||
|
SMIDKeyPress(SMID, MKey);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmFHSQListSel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.TV2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
InitFHMX();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.Button3Click(Sender: TObject);
|
|||
|
var
|
|||
|
MKey: Char;
|
|||
|
begin
|
|||
|
MKey := #13;
|
|||
|
if TRIM(SELF.CKOrdNo.Text) = '' then
|
|||
|
EXIT;
|
|||
|
try
|
|||
|
frmPBKCListSel := TfrmPBKCListSel.Create(self);
|
|||
|
with frmPBKCListSel do
|
|||
|
begin
|
|||
|
FCKOrdNo := trim(CKOrdNo.text);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
while frmPBKCListSel.CDS_Main.Locate('SSel', true, []) do
|
|||
|
begin
|
|||
|
self.SMID.Text := Trim(CDS_Main.Fieldbyname('MJID').AsString);
|
|||
|
self.SMIDKeyPress(self.SMID, MKey);
|
|||
|
frmPBKCListSel.CDS_Main.Delete;
|
|||
|
sleep(500);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmPBKCListSel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSQSMCK.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;
|
|||
|
|
|||
|
end.
|
|||
|
|