1325 lines
39 KiB
ObjectPascal
1325 lines
39 KiB
ObjectPascal
unit U_SQSMCK;
|
||
|
||
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, RM_Dataset, RM_System,
|
||
RM_Common, RM_Class, RM_GridReport, RM_e_Xls;
|
||
|
||
type
|
||
TfrmSQSMCK = class(TForm)
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
DS_MainSel: TDataSource;
|
||
CDS_MainSel: TClientDataSet;
|
||
cxGridPopupMenu4: TcxGridPopupMenu;
|
||
cxGrid3: TcxGrid;
|
||
Tv3: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
v3Column1: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
v3Column2: TcxGridDBColumn;
|
||
Panel2: TPanel;
|
||
Label10: TLabel;
|
||
Label11: TLabel;
|
||
Label5: TLabel;
|
||
Label4: TLabel;
|
||
Label9: TLabel;
|
||
CKPSQty: TEdit;
|
||
CKOrdNo: TEdit;
|
||
BaoID: TEdit;
|
||
CRTime: TDateTimePicker;
|
||
KHName: TEdit;
|
||
Button2: TButton;
|
||
Label6: TLabel;
|
||
PrtCode1: TEdit;
|
||
Label8: TLabel;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
MJStr3: TEdit;
|
||
Label2: TLabel;
|
||
Label3: TLabel;
|
||
Edit1: TEdit;
|
||
Label12: TLabel;
|
||
CDS_Main: TClientDataSet;
|
||
CRType: TEdit;
|
||
Button1: TButton;
|
||
Label1: TLabel;
|
||
v3Column4: TcxGridDBColumn;
|
||
Label7: TLabel;
|
||
Button3: TButton;
|
||
ds1: TClientDataSet;
|
||
batchno: TComboBox;
|
||
Edit2: TEdit;
|
||
Label13: TLabel;
|
||
Label33: TLabel;
|
||
Edit6: TEdit;
|
||
CPNAME: TComboBox;
|
||
CARNO: TComboBox;
|
||
Tv3Column1: TcxGridDBColumn;
|
||
Label14: TLabel;
|
||
CPPRICE: TEdit;
|
||
KHPM: TBtnEditA;
|
||
Label15: TLabel;
|
||
Button6: TButton;
|
||
ComboBox1: TComboBox;
|
||
RM1: TRMGridReport;
|
||
CDS_JuanPRT: TClientDataSet;
|
||
RMDBMX: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
Label16: TLabel;
|
||
pici: TComboBox;
|
||
Label18: TLabel;
|
||
taitou: TEdit;
|
||
Label17: TLabel;
|
||
edtIsSMTH: TEdit;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
Tv3Column2: TcxGridDBColumn;
|
||
N2: TMenuItem;
|
||
N3: TMenuItem;
|
||
N4: TMenuItem;
|
||
Tv3Column3: TcxGridDBColumn;
|
||
Panel1: TPanel;
|
||
Button4: TButton;
|
||
Button5: TButton;
|
||
Edit3: TEdit;
|
||
Label19: TLabel;
|
||
Tv3Column4: TcxGridDBColumn;
|
||
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);
|
||
// function YSData(Order_Main10: TClientDataSet): Boolean;
|
||
procedure Button3Click(Sender: TObject);
|
||
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
|
||
procedure Edit6Click(Sender: TObject);
|
||
procedure CPNAMEChange(Sender: TObject);
|
||
procedure KHPMBtnClick(Sender: TObject);
|
||
procedure Button6Click(Sender: TObject);
|
||
procedure cxGridDBColumn1PropertiesEditValueChanged(Sender: TObject);
|
||
procedure v3Column1PropertiesEditValueChanged(Sender: TObject);
|
||
procedure edtIsSMTHClick(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N3Click(Sender: TObject);
|
||
procedure N4Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure Button5Click(Sender: TObject);
|
||
procedure Button4Click(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
canshu1, FCKOrdNo, FSMStr, JXFlag: string;
|
||
FSUBID: string;
|
||
procedure TMPanDuan();
|
||
procedure INITTJ();
|
||
procedure SaveCKDataJTMCX();
|
||
function JudgeJTMCX(): Boolean;
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmSQSMCK: TfrmSQSMCK;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, MMSystem, U_FHSQListSel, U_PBKCListSel, U_ZDYHelp;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmSQSMCK.SaveCKDataJTMCX();
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Do_PBCK @CRFlag=''δ<><CEB4><EFBFBD><EFBFBD>'', @CKOrdNo='''', @MJID=' + quotedstr(trim(BaoID.Text)));
|
||
|
||
sql.Add(' UPdate CK_PBCP_KC Set KCValid=''Y'' ');
|
||
sql.Add(' where CK_PBCP_KC.MJID=' + Quotedstr(Trim(BaoID.Text)));
|
||
sql.Add(' and KCValid=''N'' ');
|
||
|
||
sql.Add('UPDATE CK_PBCP_CR Set ');
|
||
sql.add(' CRTime=NULL ');
|
||
sql.add(',CRType=NULL');
|
||
sql.add(',KHName=NULL');
|
||
sql.add(',KHTT=NULL');
|
||
sql.add(',RC=NULL');
|
||
sql.add(',FHTT=NULL');
|
||
sql.add(',CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.add(',CKOrdNo=NULL');
|
||
sql.Add(' where CK_PBCP_CR.MJID=' + Quotedstr(Trim(BaoID.Text)));
|
||
sql.Add('and CK_PBCP_CR.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
|
||
sql.Add('UPDATE WFB_MJJY_PB SET NEWNAME=NULL');
|
||
SQL.Add(',NEWBATCHNO=NULL');
|
||
SQL.Add(',NEWCARNO=NULL');
|
||
SQL.Add(',FHKONGJIA=NULL');
|
||
|
||
SQL.Add(',KHTAITOU=NULL');
|
||
SQL.Add(',pici=NULL');
|
||
SQL.Add(',ckno=NULL');
|
||
SQL.Add(',CPPRICE=NULL');
|
||
SQL.Add(',KHPM=NULL');
|
||
SQL.Add('WHERE MJID=' + quotedstr(trim(BaoID.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(BaoID.Text) + ' <20><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CKOrdNo.Text)));
|
||
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;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.INITTJ();
|
||
var
|
||
FSJ, FSJ2, fsj3: string;
|
||
begin
|
||
if CKOrdNo.Text = '' then
|
||
begin
|
||
Exit;
|
||
end;
|
||
|
||
FSJ := 'select name=P_NAME from FHSQ_Sub where FSID=' + QuotedStr(Trim(CKOrdNo.Text));
|
||
SInitComBoxBySql(ADOQueryCmd, CPNAME, False, FSJ);
|
||
if cpname.Text <> '' then
|
||
begin
|
||
FSJ2 := 'select DISTINCT name=CARNO from WFB_MJJY_PB where NAME IN (SELECT P_NAME FROM FHSQ_Sub WHERE FSID= ' + QuotedStr(Trim(CKOrdNo.Text)) + 'and name=' + QuotedStr(Trim(CPNAME.Text)) + ')';
|
||
end
|
||
else
|
||
begin
|
||
FSJ2 := 'select DISTINCT name=CARNO from WFB_MJJY_PB where NAME IN (SELECT P_NAME FROM FHSQ_Sub WHERE FSID= ' + QuotedStr(Trim(CKOrdNo.Text)) + ')';
|
||
end;
|
||
SInitComBoxBySql(ADOQueryCmd, CARNO, False, FSJ2);
|
||
|
||
if batchno.Text <> '' then
|
||
begin
|
||
fsj3 := 'select DISTINCT name=APBatchNo from WFB_MJJY_PB where NAME IN (SELECT P_NAME FROM FHSQ_Sub WHERE FSID= ' + QuotedStr(Trim(CKOrdNo.Text)) + 'and name=' + QuotedStr(Trim(CPNAME.Text)) + ')';
|
||
end
|
||
else
|
||
begin
|
||
fsj3 := 'select DISTINCT name=APBatchNo from WFB_MJJY_PB where NAME IN (SELECT P_NAME FROM FHSQ_Sub WHERE FSID= ' + QuotedStr(Trim(CKOrdNo.Text)) + ')';
|
||
end;
|
||
SInitComBoxBySql(ADOQueryCmd, batchno, False, fsj3);
|
||
// ShowMessage(FSJ2);
|
||
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmSQSMCK := nil;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.FormShow(Sender: TObject);
|
||
begin
|
||
BaoID.SetFocus;
|
||
ReadCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
||
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
|
||
canshu1 := Trim(DParameters1);
|
||
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.TMPanDuan();
|
||
begin
|
||
//<2F>ж<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD> <20><><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߸<EFBFBD><DFB8><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD>
|
||
JXFlag := '';
|
||
FSMStr := Trim(BaoID.Text);
|
||
if Copy(FSMStr, 1, 2) = 'CK' then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from FHSQ_Main where FSID=''' + Trim(FSMStr) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
JXFlag := '999';
|
||
PlaySound('wav/<2F><><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
|
||
if Trim(CKOrdNo.Text) <> '' then
|
||
begin
|
||
FCKOrdNo := Trim(CKOrdNo.Text);
|
||
end;
|
||
CKOrdNo.Text := Trim(FSMStr);
|
||
if FSMStr <> FCKOrdNo then
|
||
begin
|
||
Edit1.Text := '';
|
||
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=''' + Trim(CKOrdNo.Text) + '''');
|
||
// if CPNAME.Text <> '' then
|
||
// begin
|
||
// SQL.Add('and newname=' + QuotedStr(Trim(CPNAME.Text)));
|
||
// end;
|
||
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_MainSel);
|
||
SInitCDSData20(ADOQueryTemp, CDS_MainSel);
|
||
// SCSHDataNew(ADOQueryTemp, Panel2, 2);
|
||
// if (CDS_MainSel.IsEmpty = False) and (Tv3.DataController.Summary.FooterSummaryValues[2] <> NULL) then
|
||
// Edit1.Text := IntToStr(StrToInt(CKPSQty.TEXT) - Tv3.DataController.Summary.FooterSummaryValues[2])
|
||
// else
|
||
// Edit1.Text := CKPSQty.TEXT;
|
||
end;
|
||
BaoID.Text := '';
|
||
JXFlag := '888';
|
||
end
|
||
else
|
||
begin
|
||
if Trim(CKOrdNo.Text) = '' then
|
||
begin
|
||
JXFlag := '999';
|
||
PlaySound('wav\δɨ<CEB4><C9A8><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
if Trim(CPNAME.Text) = '' then
|
||
begin
|
||
JXFlag := '999';
|
||
PlaySound('wav\<5C><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ʒ.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ʒ
|
||
Exit;
|
||
end;
|
||
if trim(Edit6.Text) = '' then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY_PB A inner join Cloth_Sub B on A.SubId=B.SubId ');
|
||
sql.Add('where exists (select * from FHSQ_sub Y where Y.P_name=B.C_Codename and Y.FSId=' + quotedstr(Trim(CKOrdNo.Text)) + ')');
|
||
sql.Add('and A.MJID=' + quotedstr(Trim(FSMStr)));
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
JXFlag := '999';
|
||
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end
|
||
else
|
||
begin
|
||
if Trim(CPNAME.Text) <> '' then
|
||
begin
|
||
if Trim(ADOQueryTemp.fieldbyname('C_Codename').AsString) <> Trim(CPNAME.Text) then
|
||
begin
|
||
JXFlag := '999';
|
||
PlaySound('wav\<5C><>Ʒ<EFBFBD><C6B7>ͬ<EFBFBD><CDAC>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
if Trim(CarNo.Text) <> '' then
|
||
begin
|
||
if Trim(ADOQueryTemp.fieldbyname('carno').AsString) <> Trim(carno.Text) then
|
||
begin
|
||
JXFlag := '999';
|
||
PlaySound('wav\<5C><>̨<EFBFBD><CCA8>ͬ<EFBFBD><CDAC>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(batchno.Text) <> '' then
|
||
begin
|
||
if Trim(ADOQueryTemp.fieldbyname('apbatchno').AsString) <> Trim(batchno.Text) then
|
||
begin
|
||
JXFlag := '999';
|
||
PlaySound('wav\<5C><><EFBFBD>Ų<EFBFBD>ͬ<EFBFBD><CDAC>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
end;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.CKOrdNo from CK_PBCP_CR A inner join Cloth_Sub B on A.SubId=B.SubId ');
|
||
sql.Add('where exists (select * from FHSQ_SUB Y where Y.P_name=B.C_Codename and Y.FSId=' + quotedstr(Trim(CKOrdNo.Text)) + ')');
|
||
sql.Add(' and A.MJID=' + quotedstr(Trim(FSMStr)));
|
||
sql.Add(' and A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
if Trim(ADOQueryTemp.fieldbyname('CKOrdNo').AsString) = Trim(CKOrdNo.Text) then
|
||
begin
|
||
JXFlag := '999';
|
||
PlaySound('wav\<5C><>ɨ<EFBFBD><C9A8>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end
|
||
else
|
||
begin
|
||
JXFlag := '999';
|
||
PlaySound('wav\<5C>ѳ<EFBFBD><D1B3><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.CKOrdNo from CK_PBCP_CR A inner join Cloth_Sub B on A.SubId=B.SubId ');
|
||
sql.Add('where exists (select * from FHSQ_SUB Y where Y.P_name=B.C_Codename and Y.FSId=' + quotedstr(Trim(CKOrdNo.Text)) + ')');
|
||
sql.Add(' and A.MJID=' + quotedstr(Trim(FSMStr)));
|
||
sql.Add(' and A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
JXFlag := '999';
|
||
PlaySound('wav\δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY_PB a ');
|
||
sql.Add('where A.MJID=' + quotedstr(Trim(FSMStr)));
|
||
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
JXFlag := '999';
|
||
PlaySound('wav\δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
if Trim(Edit1.Text) <> '' then
|
||
begin
|
||
// if StrToInt(Edit1.Text) >= StrToInt(CKPSQty.Text) then
|
||
// begin
|
||
// JXFlag := '999';
|
||
// 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);
|
||
// Exit;
|
||
// end;
|
||
|
||
if StrToInt(Edit1.Text) <= 0 then
|
||
begin
|
||
JXFlag := '999';
|
||
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);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
//<2F>ж<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD> <20><><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߸<EFBFBD><DFB8><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD> FHDate
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.BaoIDKeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
maxno, SMFlag, KYCKFlag, FMainId: string;
|
||
FFQty: Integer;
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
if edtIsSMTH.Text = '' then
|
||
begin
|
||
TMPanDuan();
|
||
if Trim(JXFlag) = '999' then
|
||
begin
|
||
BaoID.Text := '';
|
||
Exit;
|
||
end;
|
||
if Trim(JXFlag) = '888' then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,MJStr3=A.SeBie,KHName=CustomerNoName,CKPSQty=A.SQPSHZ,FHPSHZ2=ISNULL(FHPSHZ,0) ');
|
||
Sql.Add(' ,prtcode1=STUFF(( SELECT '','' +convert(VARCHAR, P_CODE) FROM FHSQ_Sub X where A.FSID=X.FSID FOR XML PATH('''')), 1, 1, '''') ');
|
||
Sql.Add(' ,prtcodeNAME1=STUFF(( SELECT '','' +convert(VARCHAR, P_NAME) FROM FHSQ_Sub X where A.FSID=X.FSID FOR XML PATH('''')), 1, 1, '''') ');
|
||
|
||
sql.Add(' from FHSQ_Main A');
|
||
|
||
sql.Add(' where FSId=''' + Trim(CKOrdNo.Text) + ''' ');
|
||
// ShowMessage(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCSHDataNew(ADOQueryTemp, Panel2, 2);
|
||
taitou.Text := Trim(ADOQueryTemp.fieldbyname('shouhuotaitou').asstring);
|
||
INITTJ();
|
||
// SQBatchNoHZ.text := Trim(ADOQueryTemp.fieldbyname('FHBatchNo').AsString);
|
||
Edit1.Text := IntToStr(StrToInt(CKPSQty.TEXT) - ADOQueryTemp.fieldbyname('FHPSHZ2').VALUE);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' select A.*,B.CRID from WFB_MJJY_PB A');
|
||
sql.Add(' inner join CK_PBCP_CR B on A.MJID=B.MJID and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(' where A. MJID=''' + Trim(BaoID.Text) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_Main);
|
||
SInitCDSData20(ADOQueryTemp, CDS_Main);
|
||
try
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_PBCp_KC where MJID=''' + Trim(BaoID.Text) + '''');
|
||
sql.Add(' and KCKGQty>0');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
KYCKFlag := '<27><><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>';
|
||
end
|
||
else
|
||
begin
|
||
KYCKFlag := '<27>ܳ<EFBFBD><DCB3><EFBFBD>';
|
||
end;
|
||
if Trim(KYCKFlag) = '<27>ܳ<EFBFBD><DCB3><EFBFBD>' then
|
||
begin
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
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(CDS_Main.fieldbyname('MJID').asstring)) + ', @DName=' + quotedstr(trim(DName)));
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPDATE WFB_MJJY_PB SET NEWNAME=' + QuotedStr(Trim(CPNAME.Text)));
|
||
if Trim(batchno.Text) <> '' then
|
||
begin
|
||
SQL.Add(',NEWBATCHNO=' + QuotedStr(Trim(batchno.Text)));
|
||
end
|
||
else
|
||
begin
|
||
SQL.Add(',NEWBATCHNO=APBATCHNO');
|
||
end;
|
||
if Trim(CARNO.Text) <> '' then
|
||
begin
|
||
SQL.Add(',NEWCARNO=' + QuotedStr(Trim(CARNO.Text)));
|
||
end
|
||
else
|
||
begin
|
||
SQL.Add(',NEWCARNO=CARNO');
|
||
end;
|
||
sql.Add(',FHKONGJIA=0.2');
|
||
SQL.Add(',ckno=' + QuotedStr(Trim(CKOrdNo.Text)));
|
||
if Trim(CPPRICE.Text) <> '' then
|
||
begin
|
||
SQL.Add(',CPPRICE=' + (Trim(CPPRICE.Text)));
|
||
end;
|
||
if Trim(KHPM.Text) <> '' then
|
||
begin
|
||
SQL.Add(',KHPM=' + QuotedStr(Trim(KHPM.Text)));
|
||
end;
|
||
if Trim(taitou.Text) <> '' then
|
||
begin
|
||
SQL.Add(',KHTAITOU=' + QuotedStr(Trim(taitou.Text)));
|
||
end;
|
||
if Trim(pici.Text) <> '' then
|
||
begin
|
||
SQL.Add(',pici=' + QuotedStr(Trim(pici.Text)));
|
||
end;
|
||
SQL.Add('WHERE MJID=' + quotedstr(trim(CDS_Main.fieldbyname('MJID').asstring)));
|
||
// ShowMessage(SQL.Text);
|
||
ExecSQL;
|
||
end;
|
||
|
||
FMainId := Trim(CDS_Main.fieldbyname('MainID').AsString);
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Do_FHSQ ''' + Trim(CKOrdNo.Text) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * FROM CK_PBCP_CR a inner join WFB_MJJY_PB B on A.MJID=B.MJID ');
|
||
SQL.Add('WHERE CKOrdNO=' + QuotedStr(Trim(CKOrdNo.Text)));
|
||
SQL.Add('and NEWNAME=' + QuotedStr(Trim(CPNAME.Text)));
|
||
sql.Add('order by a.crtime desc');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_MainSel);
|
||
SInitCDSData20(ADOQueryTemp, CDS_MainSel);
|
||
// with CDS_MainSel do
|
||
// begin
|
||
// Append;
|
||
// FieldByName('Mainid').Value := Self.CDS_Main.fieldbyname('Mainid').Value;
|
||
// FieldByName('SubID').Value := Self.CDS_Main.fieldbyname('SubID').Value;
|
||
// FieldByName('MJMaoZ').Value := Self.CDS_Main.fieldbyname('MJMaoZ').Value;
|
||
// FieldByName('MJId').Value := Self.CDS_Main.fieldbyname('MJId').Value;
|
||
// FieldByName('APXH').Value := Self.CDS_Main.fieldbyname('APXH').Value;
|
||
// FieldByName('MJStr3').Value := Self.CDS_Main.fieldbyname('MJStr3').Value;
|
||
// FieldByName('CarNo').Value := Self.CDS_Main.fieldbyname('CarNo').Value;
|
||
// FieldByName('APBatchNo').Value := Self.CDS_Main.fieldbyname('APBatchNo').Value;
|
||
// FieldByName('NAME').Value := Self.CDS_Main.fieldbyname('NAME').Value;
|
||
// Post;
|
||
// end;
|
||
if CDS_MainSel.IsEmpty = False then
|
||
begin
|
||
Edit1.Text := IntToStr(StrToInt(CKPSQty.TEXT) - Tv3.DataController.Summary.FooterSummaryValues[2]);
|
||
end
|
||
else
|
||
begin
|
||
Edit1.Text := CKPSQty.Text;
|
||
end;
|
||
|
||
// with ADOQueryTemp do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add(' select COUNT(*) fhjs from CK_PBCP_CR where CKOrdNo= ''' + Trim(CKOrdNo.Text) + '''');
|
||
// Open;
|
||
// end;
|
||
//
|
||
// if StrToInt(Edit1.Text) <> ADOQueryTemp.FieldByName('fhjs').AsInteger then
|
||
// begin
|
||
// PlaySound('wav\<5C><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>', '<27><>ʾ', 0);
|
||
// end;
|
||
BaoID.Text := '';
|
||
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
Exit;
|
||
end;
|
||
except
|
||
BaoID.Text := '';
|
||
PlaySound('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
if JudgeJTMCX() then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
SaveCKDataJTMCX();
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * FROM CK_PBCP_CR a inner join WFB_MJJY_PB B on A.MJID=B.MJID ');
|
||
SQL.Add('WHERE CKOrdNO=' + QuotedStr(Trim(CKOrdNo.Text)));
|
||
SQL.Add('and NEWNAME=' + QuotedStr(Trim(CPNAME.Text)));
|
||
sql.Add('order by a.crtime desc');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_MainSel);
|
||
SInitCDSData20(ADOQueryTemp, CDS_MainSel);
|
||
if CDS_MainSel.IsEmpty = False then
|
||
begin
|
||
Edit1.Text := IntToStr(StrToInt(CKPSQty.TEXT) - Tv3.DataController.Summary.FooterSummaryValues[2]);
|
||
end
|
||
else
|
||
begin
|
||
Edit1.Text := CKPSQty.Text;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Do_FHSQ ''' + Trim(CKOrdNo.Text) + '''');
|
||
ExecSQL;
|
||
end;
|
||
BaoID.Text := '';
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
|
||
function TfrmSQSMCK.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 CKOrdNo FROM CK_PBCP_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and MJID=' + quotedstr(BaoID.Text));
|
||
Open;
|
||
end;
|
||
|
||
if ADOQueryTemp.IsEmpty then
|
||
raise Exception.Create('<27>ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
|
||
|
||
Result := True;
|
||
except
|
||
Result := false;
|
||
// MovePanel2.Visible := False;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.Button2Click(Sender: TObject);
|
||
begin
|
||
|
||
WriteCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><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.Button3Click(Sender: TObject);
|
||
var
|
||
MKey: Char;
|
||
begin
|
||
MKey := #13;
|
||
try
|
||
frmPBKCListSel := TfrmPBKCListSel.Create(Application);
|
||
with frmPBKCListSel do
|
||
begin
|
||
FCKOrdNo := trim(CKOrdNo.text);
|
||
|
||
if ShowModal = 1 then
|
||
begin
|
||
with frmPBKCListSel.CDS_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
BaoID.Text := Trim(Fieldbyname('MJID').AsString);
|
||
BaoIDKeyPress(BaoID, MKey);
|
||
Sleep(200);
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmPBKCListSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.Edit2KeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
MKey: Char;
|
||
begin
|
||
MKey := #13;
|
||
|
||
if Key = #13 then
|
||
begin
|
||
if Edit2.Text = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if CPNAME.Text = '' then
|
||
begin
|
||
Exit;
|
||
end;
|
||
if FSUBID = '' then
|
||
begin
|
||
Exit;
|
||
end;
|
||
if StrToFloatDef(Edit1.Text, 0) <= 0 then
|
||
begin
|
||
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);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('exec P_SC_NEWMJID @FSID=' + QuotedStr(Trim(FSUBID)));
|
||
sql.Add(',@MJMAOZ=' + (Trim(Edit2.Text)));
|
||
sql.Add(',@filler=' + QuotedStr(Trim(DName)));
|
||
sql.Add(',@CARNO=' + QuotedStr(Trim(CARNO.Text)));
|
||
sql.Add(',@BATCHNO=' + QuotedStr(Trim(BATCHNO.Text)));
|
||
Open;
|
||
end;
|
||
BaoID.Text := Trim(ADOQueryTemp.Fieldbyname('bhno').AsString);
|
||
BaoIDKeyPress(BaoID, MKey);
|
||
Sleep(200);
|
||
Edit2.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.Edit6Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit6.Text) = '' then
|
||
begin
|
||
Edit6.Text := '<27><>';
|
||
end
|
||
else
|
||
begin
|
||
Edit6.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.CPNAMEChange(Sender: TObject);
|
||
var
|
||
FSJ2, FSJ3: string;
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ֻ<EFBFBD>̨<EFBFBD>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from fhsq_SUB WHERE FSID=' + QuotedStr(Trim(CKOrdNo.Text)));
|
||
SQL.Add('AND P_NAME=' + QuotedStr(Trim(CPNAME.Text)));
|
||
// ShowMessage(SQL.Text);
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = FALSE then
|
||
begin
|
||
FSUBID := ADOQueryTemp.FIELDBYNAME('SSID').AsString;
|
||
|
||
end;
|
||
|
||
if cpname.Text <> '' then
|
||
begin
|
||
FSJ2 := 'select DISTINCT name=CARNO from WFB_MJJY_PB where mjstr4=''δ<><CEB4><EFBFBD><EFBFBD>'' and NAME IN (SELECT P_NAME FROM FHSQ_Sub WHERE FSID= ' + QuotedStr(Trim(CKOrdNo.Text)) + 'and P_name=' + QuotedStr(Trim(CPNAME.Text)) + ')';
|
||
end
|
||
else
|
||
begin
|
||
FSJ2 := 'select DISTINCT name=CARNO from WFB_MJJY_PB where mjstr4=''δ<><CEB4><EFBFBD><EFBFBD>'' and NAME IN (SELECT P_NAME FROM FHSQ_Sub WHERE FSID= ' + QuotedStr(Trim(CKOrdNo.Text)) + ')';
|
||
end;
|
||
|
||
SInitComBoxBySql(ADOQueryCmd, CARNO, False, FSJ2);
|
||
|
||
if cpname.Text <> '' then
|
||
begin
|
||
FSJ3 := 'select DISTINCT name=APBatchNo from WFB_MJJY_PB where mjstr4=''δ<><CEB4><EFBFBD><EFBFBD>'' and NAME IN (SELECT P_NAME FROM FHSQ_Sub WHERE FSID= ' + QuotedStr(Trim(CKOrdNo.Text)) + 'and P_name=' + QuotedStr(Trim(CPNAME.Text)) + ')';
|
||
end
|
||
else
|
||
begin
|
||
FSJ3 := 'select DISTINCT name=APBatchNo from WFB_MJJY_PB where mjstr4=''δ<><CEB4><EFBFBD><EFBFBD>'' and NAME IN (SELECT P_NAME FROM FHSQ_Sub WHERE FSID= ' + QuotedStr(Trim(CKOrdNo.Text)) + ')';
|
||
end;
|
||
SInitComBoxBySql(ADOQueryCmd, batchno, False, FSJ3);
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select *,SYPS=(SQPS-ISNULL(FHPS,0)) ');
|
||
// sql.Add(',YCKPS=(SELLECT COUNT(MJID) FROM CK_PBCP_CR B INNER JOIN WFB_MJJY_PB C ON B.MJID=C.MJID WHERE C.NEWNAME=A.P_NAME AND B.CKORDERNO=C.FSID)');
|
||
sql.Add(' from fhsq_sub c ');
|
||
|
||
sql.Add(' where fsid=''' + Trim(CKOrdNo.Text) + '''');
|
||
if CPNAME.Text <> '' then
|
||
begin
|
||
SQL.Add('and p_name=' + QuotedStr(Trim(CPNAME.Text)));
|
||
end;
|
||
|
||
Open;
|
||
end;
|
||
|
||
Edit1.Text := ADOQueryTemp.fieldbyname('SYPS').asstring;
|
||
CKPSQty.Text := ADOQueryTemp.fieldbyname('sqps').asstring;
|
||
CPPRICE.Text := ADOQueryTemp.fieldbyname('sqprice').asstring;
|
||
if ADOQueryTemp.FIELDBYNAME('FHKHPM').AsString <> '' then
|
||
begin
|
||
SELF.KHPM.Text := ADOQueryTemp.FIELDBYNAME('FHKHPM').AsString;
|
||
end
|
||
else
|
||
begin
|
||
KHPM.Text := CPNAME.Text;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * FROM CK_PBCP_CR a inner join WFB_MJJY_PB B on A.MJID=B.MJID ');
|
||
SQL.Add('WHERE CKOrdNO=' + QuotedStr(Trim(CKOrdNo.Text)));
|
||
SQL.Add('and NEWNAME=' + QuotedStr(Trim(CPNAME.Text)));
|
||
Open;
|
||
end;
|
||
|
||
SCreateCDS20(ADOQueryTemp, CDS_MainSel);
|
||
SInitCDSData20(ADOQueryTemp, CDS_MainSel);
|
||
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.KHPMBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'KHPM';
|
||
flagname := '<27>ͻ<EFBFBD>Ʒ<EFBFBD><C6B7>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.KHPM.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.Button6Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
begin
|
||
|
||
if CKOrdNo.Text = '' then
|
||
EXIT;
|
||
ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
|
||
if (trim(ComboBox1.Text) = '<27><>ͨ<EFBFBD>뵥') or (trim(ComboBox1.Text) = '<27><>̧ͷ<CCA7><CDB7>ͨ<EFBFBD>뵥') then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_Print_CKMD1 @CKOrdNo=' + quotedstr(Trim(CKOrdNo.Text)));
|
||
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT);
|
||
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT);
|
||
end;
|
||
if (trim(ComboBox1.Text) = '<27><>̧ͷ<CCA7>ֻ<EFBFBD>̨') or (trim(ComboBox1.Text) = '<27><>̧ͷ<CCA7>ֻ<EFBFBD>̨') then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_Print_CKMD2 @CKOrdNo=' + quotedstr(Trim(CKOrdNo.Text)));
|
||
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT);
|
||
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT);
|
||
end;
|
||
|
||
if (trim(ComboBox1.Text) = '<27><>̧ͷ<CCA7><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') or (trim(ComboBox1.Text) = '<27><>̧ͷ<CCA7><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_Print_CKMD5 @CKOrdNo=' + quotedstr(Trim(CKOrdNo.Text)));
|
||
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT);
|
||
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT);
|
||
end;
|
||
|
||
if (trim(ComboBox1.Text) = '<27><><EFBFBD>ⵥ') then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_Print_CKMD6 @CKOrdNo=' + quotedstr(Trim(CKOrdNo.Text)));
|
||
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT);
|
||
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT);
|
||
end;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('select top 1 shouhuotaitou,KHNAME2=ISNULL(KHNAME,CustomerNoName),b.CRTime,c.note from WFB_MJJY_PB a inner join CK_PBCP_CR b on a.mjid=b.mjid ');
|
||
sql.Add(' left join fhsq_main c on b.CKOrdNo=c.fsid where CKOrdNo=' + quotedstr(Trim(CKOrdNo.Text)));
|
||
Open;
|
||
end;
|
||
|
||
if Trim(ADOQueryTemp.fieldbyname('shouhuotaitou').AsString) = '' then
|
||
begin
|
||
RMVariables['shouhuotaitou'] := Trim(ADOQueryTemp.fieldbyname('khname2').AsString);
|
||
end
|
||
else
|
||
begin
|
||
RMVariables['shouhuotaitou'] := Trim(ADOQueryTemp.fieldbyname('shouhuotaitou').AsString);
|
||
end;
|
||
RM1.PreviewButtons := [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS, pbExport, pbNavigator];
|
||
// RMVariables['FHTaiTou'] := Trim(CDS_Main.fieldbyname('FHTT').AsString);
|
||
RMVariables['MJDATE'] := Trim(ADOQueryTemp.fieldbyname('CRTime').AsString);
|
||
|
||
RMVariables['Znote'] := Trim(ADOQueryTemp.fieldbyname('note').AsString);
|
||
RMVariables['FILLER'] := Trim(DNAME);
|
||
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.cxGridDBColumn1PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
begin
|
||
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
FFieldName := Trim(Tv3.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_MainSel do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value := mvalue;
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('update WFB_MJJY_PB set newcarno=' + QuotedStr(Trim(mvalue)));
|
||
sql.Add('where mjid=' + QuotedStr(Trim(CDS_MainSel.fieldbyname('mjid').AsString)));
|
||
ExecSQL;
|
||
end;
|
||
tv3.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.v3Column1PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
begin
|
||
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
FFieldName := Trim(Tv3.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_MainSel do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value := mvalue;
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('update WFB_MJJY_PB set mjmaoz=' + (Trim(mvalue)));
|
||
sql.Add('where mjid=' + QuotedStr(Trim(CDS_MainSel.fieldbyname('mjid').AsString)));
|
||
sql.Add('update CK_PBCP_CR set kgqty=' + (Trim(mvalue)));
|
||
sql.Add('where mjid=' + QuotedStr(Trim(CDS_MainSel.fieldbyname('mjid').AsString)));
|
||
|
||
sql.Add('exec P_UP_YCLQTY @mainid=' + QuotedStr(Trim(CDS_MainSel.fieldbyname('mainid').AsString)));
|
||
ExecSQL;
|
||
end;
|
||
tv3.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.edtIsSMTHClick(Sender: TObject);
|
||
begin
|
||
// if Trim(edtIsSMTH.Text) = '' then
|
||
// begin
|
||
// edtIsSMTH.Text := '<27><>';
|
||
// end
|
||
// else
|
||
// begin
|
||
// edtIsSMTH.Text := '';
|
||
// end;
|
||
|
||
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 TfrmSQSMCK.N1Click(Sender: TObject);
|
||
var
|
||
f1: Double;
|
||
begin
|
||
if CDS_MainSel.IsEmpty then
|
||
Exit;
|
||
if CDS_MainSel.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
CDS_MainSel.DisableControls;
|
||
with CDS_MainSel do
|
||
begin
|
||
First;
|
||
while CDS_MainSel.Locate('SSel', True, []) = True do
|
||
begin
|
||
if pos('ZD', Trim(CDS_MainSel.fieldbyname('MJID').asstring)) > 0 then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete WFB_MJJY_PB_DelLog where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + '''');
|
||
SQL.Add('insert into WFB_MJJY_PB_DelLog ');
|
||
sql.Add('select * from WFB_MJJY_PB where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update WFB_MJJY_PB_DelLog Set Note=Isnull(Note,'''')+''<27><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>:''+''' + Trim(DName) + '''');
|
||
sql.Add('+'' ''+Convert(Varchar(20),getdate(),120)');
|
||
sql.Add(' where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete WFB_MJJY_PB where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + '''');
|
||
sql.Add('delete WFB_MJJY_CD_PB where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + '''');
|
||
sql.Add('delete CK_PBCP_CR where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + '''');
|
||
sql.Add('delete CK_PBCP_kc where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_UP_YCLQTY @mainid=' + quotedstr(trim(Trim(CDS_MainSel.fieldbyname('mainid').AsString))));
|
||
ExecSQL;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Do_PBCK @CRFlag=''δ<><CEB4><EFBFBD><EFBFBD>'', @CKOrdNo='''', @MJID=' + quotedstr(trim(CDS_MainSel.fieldbyname('MJID').asstring)));
|
||
sql.Add('UPDATE WFB_MJJY_PB SET NEWNAME=NULL');
|
||
SQL.Add(',NEWBATCHNO=NULL');
|
||
SQL.Add(',NEWCARNO=NULL');
|
||
SQL.Add(',ckno=NULL');
|
||
SQL.Add(',FHKONGJIA=NULL');
|
||
SQL.Add(',CPPRICE=NULL');
|
||
SQL.Add(',pici=NULL');
|
||
SQL.Add(',KHPM=NULL');
|
||
SQL.Add(',KHTAITOU=NULL');
|
||
SQL.Add('WHERE MJID=' + quotedstr(trim(CDS_MainSEL.fieldbyname('MJID').asstring)));
|
||
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
sql.Add(' ' + quotedstr(trim(DName)));
|
||
sql.Add(',getdate() ');
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(trim('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><E2B3B7>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CKOrdNo.Text) + ' <20><><EFBFBD>룺' + trim(CDS_MainSEL.FieldByName('MJID').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Do_FHSQ ''' + Trim(CKOrdNo.Text) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
CDS_MainSel.Delete;
|
||
|
||
end;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * FROM CK_PBCP_CR a inner join WFB_MJJY_PB B on A.MJID=B.MJID ');
|
||
SQL.Add('WHERE CKOrdNO=' + QuotedStr(Trim(CKOrdNo.Text)));
|
||
SQL.Add('and NEWNAME=' + QuotedStr(Trim(CPNAME.Text)));
|
||
sql.Add('order by a.crtime desc');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_MainSel);
|
||
SInitCDSData20(ADOQueryTemp, CDS_MainSel);
|
||
if CDS_MainSel.IsEmpty = False then
|
||
begin
|
||
Edit1.Text := IntToStr(StrToInt(CKPSQty.TEXT) - Tv3.DataController.Summary.FooterSummaryValues[2]);
|
||
end
|
||
else
|
||
begin
|
||
Edit1.Text := CKPSQty.Text;
|
||
end;
|
||
CDS_MainSel.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
|
||
Application.MessageBox('<27><><EFBFBD>ϳɹ<CFB3><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
except
|
||
|
||
CDS_MainSel.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.N3Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_MainSel, True);
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.N4Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_MainSel, false);
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.N2Click(Sender: TObject);
|
||
begin
|
||
Panel1.Visible := True;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.Button5Click(Sender: TObject);
|
||
begin
|
||
Panel1.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmSQSMCK.Button4Click(Sender: TObject);
|
||
begin
|
||
if CDS_MainSel.IsEmpty then
|
||
Exit;
|
||
if CDS_MainSel.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
CDS_MainSel.DisableControls;
|
||
with CDS_MainSel do
|
||
begin
|
||
First;
|
||
while CDS_MainSel.Locate('SSel', True, []) = True do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update WFB_MJJY_PB SET FHKONGJIA=' + Edit3.text);
|
||
SQL.Add(' where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + '''');
|
||
|
||
ExecSQL;
|
||
end;
|
||
|
||
CDS_MainSel.Delete;
|
||
|
||
end;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * FROM CK_PBCP_CR a inner join WFB_MJJY_PB B on A.MJID=B.MJID ');
|
||
SQL.Add('WHERE CKOrdNO=' + QuotedStr(Trim(CKOrdNo.Text)));
|
||
SQL.Add('and NEWNAME=' + QuotedStr(Trim(CPNAME.Text)));
|
||
sql.Add('order by a.crtime desc');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_MainSel);
|
||
SInitCDSData20(ADOQueryTemp, CDS_MainSel);
|
||
|
||
CDS_MainSel.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
|
||
Application.MessageBox('<27>ռӳɹ<D3B3><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
Panel1.Visible := False;
|
||
except
|
||
|
||
CDS_MainSel.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27>ռ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|