2028 lines
56 KiB
ObjectPascal
2028 lines
56 KiB
ObjectPascal
![]() |
unit U_PBSMCK;
|
|||
|
|
|||
|
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, cxContainer, cxMaskEdit,
|
|||
|
cxButtonEdit, RM_Dataset, RM_System, RM_Common, RM_Class, RM_GridReport,
|
|||
|
RM_e_Xls, dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter;
|
|||
|
|
|||
|
type
|
|||
|
TfrmPBSMCK = class(TForm)
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
DS_MainSel: TDataSource;
|
|||
|
CDS_MainSel: TClientDataSet;
|
|||
|
cxGridPopupMenu4: TcxGridPopupMenu;
|
|||
|
Panel2: TPanel;
|
|||
|
Label5: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label9: TLabel;
|
|||
|
CKOrdNo: TEdit;
|
|||
|
BaoID: TEdit;
|
|||
|
CRTime: TDateTimePicker;
|
|||
|
Button2: TButton;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
Label12: TLabel;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
Button1: TButton;
|
|||
|
Button3: TButton;
|
|||
|
CKType: TComboBox;
|
|||
|
edtIsSMTH: TEdit;
|
|||
|
Label2: TLabel;
|
|||
|
Button4: TButton;
|
|||
|
CDS_DCK: TClientDataSet;
|
|||
|
MovePanel2: TMovePanel;
|
|||
|
KHNAME: TcxButtonEdit;
|
|||
|
Label8: TLabel;
|
|||
|
Label3: TLabel;
|
|||
|
Label7: TLabel;
|
|||
|
batchno: TComboBox;
|
|||
|
CARNO: TComboBox;
|
|||
|
Label14: TLabel;
|
|||
|
CPPRICE: TEdit;
|
|||
|
KHPM: TBtnEditA;
|
|||
|
Label15: TLabel;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
Tv3Column1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
v3Column4: TcxGridDBColumn;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
v3Column1: TcxGridDBColumn;
|
|||
|
v3Column2: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
Label33: TLabel;
|
|||
|
Edit6: TEdit;
|
|||
|
Label13: TLabel;
|
|||
|
Edit3: TEdit;
|
|||
|
Button6: TButton;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
RM1: TRMGridReport;
|
|||
|
CDS_JuanPRT: TClientDataSet;
|
|||
|
RMDBMX: TRMDBDataSet;
|
|||
|
Label1: TLabel;
|
|||
|
taitou: TEdit;
|
|||
|
Edit2: TEdit;
|
|||
|
Edit4: TEdit;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
cpname: TcxButtonEdit;
|
|||
|
Label16: TLabel;
|
|||
|
pici: TComboBox;
|
|||
|
Label6: TLabel;
|
|||
|
Label10: TLabel;
|
|||
|
Tv3Column2: TcxGridDBColumn;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
Tv3Column3: TcxGridDBColumn;
|
|||
|
N2: TMenuItem;
|
|||
|
N3: TMenuItem;
|
|||
|
N4: TMenuItem;
|
|||
|
Panel1: TPanel;
|
|||
|
Label19: TLabel;
|
|||
|
Button5: TButton;
|
|||
|
Button7: TButton;
|
|||
|
Edit1: TEdit;
|
|||
|
Tv3Column4: TcxGridDBColumn;
|
|||
|
Label11: TLabel;
|
|||
|
Edit5: TEdit;
|
|||
|
Label17: TLabel;
|
|||
|
Edit7: TEdit;
|
|||
|
Label18: TLabel;
|
|||
|
Edit8: TEdit;
|
|||
|
Tv3Column5: TcxGridDBColumn;
|
|||
|
Label20: TLabel;
|
|||
|
fsid: TEdit;
|
|||
|
SSID: TEdit;
|
|||
|
Button8: TButton;
|
|||
|
Panel3: TPanel;
|
|||
|
Button9: TButton;
|
|||
|
Button10: TButton;
|
|||
|
Button11: TButton;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure BaoIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure Button3Click(Sender: TObject);
|
|||
|
procedure CKTypeChange(Sender: TObject);
|
|||
|
procedure edtIsSMTHClick(Sender: TObject);
|
|||
|
procedure Button4Click(Sender: TObject);
|
|||
|
procedure KHNAMEPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure Button5Click(Sender: TObject);
|
|||
|
procedure KHPMBtnClick(Sender: TObject);
|
|||
|
procedure Edit6Click(Sender: TObject);
|
|||
|
procedure Edit3KeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Button6Click(Sender: TObject);
|
|||
|
procedure Edit2Change(Sender: TObject);
|
|||
|
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure cxGridDBColumn1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure v3Column1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure cpnamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure Button7Click(Sender: TObject);
|
|||
|
procedure N3Click(Sender: TObject);
|
|||
|
procedure N4Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure Edit5Click(Sender: TObject);
|
|||
|
procedure Edit7Click(Sender: TObject);
|
|||
|
procedure Edit8Click(Sender: TObject);
|
|||
|
procedure Button8Click(Sender: TObject);
|
|||
|
procedure Button9Click(Sender: TObject);
|
|||
|
procedure Button10Click(Sender: TObject);
|
|||
|
procedure Button11Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
FSMID, FCKOrdNo, FRKOrdID, FMJID, CZZT: string;
|
|||
|
function JudgeSQD(): Boolean;
|
|||
|
function JudgeRKD(): Boolean;
|
|||
|
function JudgeJTM(): Boolean;
|
|||
|
function JudgeRKDCX(): Boolean;
|
|||
|
function JudgeJTMCX(): Boolean;
|
|||
|
procedure SaveCKData();
|
|||
|
procedure SaveCKDataJTM();
|
|||
|
procedure SaveCKDataCX();
|
|||
|
procedure SaveCKDataJTMCX();
|
|||
|
procedure InitCKGrid();
|
|||
|
procedure INITTJ();
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
canshu1: string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmPBSMCK: TfrmPBSMCK;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, MMSystem, U_ZdyAttachment, U_ZdyAttachGYS,
|
|||
|
U_CKProductBCPKCList, U_ZDYHelp, U_PBKCListSel, U_CPManageFMSel, U_FHSQListSel;
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
var
|
|||
|
frmCKProductBCPKCListPBSel: TfrmCKProductBCPKCListPB;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.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 mjstr4=''δ<><CEB4><EFBFBD><EFBFBD>'' 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;
|
|||
|
// ShowMessage(fsj2);
|
|||
|
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 = ' + 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;
|
|||
|
|
|||
|
function TfrmPBSMCK.JudgeSQD(): Boolean;
|
|||
|
begin
|
|||
|
Result := false;
|
|||
|
try
|
|||
|
|
|||
|
if Trim(KHName.Text) = '' then
|
|||
|
raise Exception.Create('<27><>ѡ<EFBFBD><D1A1><EFBFBD>ͻ<EFBFBD>!');
|
|||
|
|
|||
|
if Trim(CKOrdNo.Text) = '' then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>!');
|
|||
|
if Trim(cpname.Text) = '' then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ʒ!');
|
|||
|
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := false;
|
|||
|
MovePanel2.Visible := False;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
// PlaySound('δɨ<CEB4><C9A8><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmPBSMCK.JudgeRKD(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
if CKType.Text = '<27><><EFBFBD><EFBFBD><DEB3><EFBFBD>' then
|
|||
|
begin
|
|||
|
if Trim(KHName.Text) = '' then
|
|||
|
raise Exception.Create('<27><>ѡ<EFBFBD><D1A1><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>λ!');
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from WFB_MJJY A ');
|
|||
|
sql.Add('where RKOrdID=' + quotedstr(trim(FRKOrdID)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>!');
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT RKOrdID,CKOrdNo FROM CK_BanCP_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and RKOrdID=' + quotedstr(trim(FRKOrdID)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if not ADOQueryTemp.IsEmpty then
|
|||
|
raise Exception.Create('<27><>ɨ<EFBFBD><C9A8>!');
|
|||
|
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := false;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmPBSMCK.JudgeJTM(): Boolean;
|
|||
|
//δ<><CEB4><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>Ʊֱ<C6B1><D6B1><EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
try
|
|||
|
if CKType.Text <> '<27><><EFBFBD>ϳ<EFBFBD><CFB3><EFBFBD>' then
|
|||
|
begin
|
|||
|
if Trim(KHName.Text) = '' then
|
|||
|
raise Exception.Create('<27><>ѡ<EFBFBD><D1A1><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>λ!');
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT * FROM CK_PBCP_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and MJID=' + quotedstr(trim(FMJID)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = true then
|
|||
|
begin
|
|||
|
|
|||
|
// raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>');
|
|||
|
PlaySound('wav/δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
Result := false;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT CKOrdNo FROM CK_PBCP_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and MJID=' + quotedstr(trim(FMJID)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('CKOrdNo').AsString) = Trim(CKOrdNo.Text) then
|
|||
|
begin
|
|||
|
PlaySound('wav/<2F><>ɨ<EFBFBD><C9A8>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
Result := false;
|
|||
|
Exit;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
// raise Exception.Create('<27>ѳ<EFBFBD><D1B3><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>');
|
|||
|
PlaySound('wav/<2F>ѳ<EFBFBD><D1B3><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
Result := false;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT * FROM WFB_MJJY_PB where MJID=' + quotedstr(trim(FMJID)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if trim(Edit6.Text) = '' then
|
|||
|
begin
|
|||
|
if Trim(CPNAME.Text) <> '' then
|
|||
|
begin
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('NAME').AsString) <> Trim(CPNAME.Text) then
|
|||
|
begin
|
|||
|
PlaySound('wav\<5C><>Ʒ<EFBFBD><C6B7>ͬ<EFBFBD><CDAC>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
Result := false;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(CarNo.Text) <> '' then
|
|||
|
begin
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('carno').AsString) <> Trim(carno.Text) then
|
|||
|
begin
|
|||
|
|
|||
|
PlaySound('wav\<5C><>̨<EFBFBD><CCA8>ͬ<EFBFBD><CDAC>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
Result := false;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(batchno.Text) <> '' then
|
|||
|
begin
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('apbatchno').AsString) <> Trim(batchno.Text) then
|
|||
|
begin
|
|||
|
|
|||
|
PlaySound('wav\<5C><><EFBFBD>Ų<EFBFBD>ͬ<EFBFBD><CDAC>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
Result := false;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(Edit2.Text) <> '' then
|
|||
|
begin
|
|||
|
if StrToInt(Edit4.Text) <= 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);
|
|||
|
Result := false;
|
|||
|
Exit;
|
|||
|
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 TfrmPBSMCK.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(FMJID));
|
|||
|
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;
|
|||
|
|
|||
|
function TfrmPBSMCK.JudgeRKDCX(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
if Trim(CKOrdNo.Text) = '' then
|
|||
|
raise Exception.Create('<27><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
|||
|
|
|||
|
if CDS_MainSel.IsEmpty then
|
|||
|
raise Exception.Create('<27>ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT RKOrdID,CKOrdNo FROM CK_BanCP_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and CKOrdNo=' + quotedstr(FCKOrdNo));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
raise Exception.Create('<27>ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
|
|||
|
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := false;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.SaveCKData();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_BanCP_CKList Set CKDate=getdate() ');
|
|||
|
sql.Add(',KHNmae= ' + Quotedstr(KHName.Text));
|
|||
|
sql.Add(',CKType= ' + Quotedstr(CKType.Text));
|
|||
|
sql.Add('where CKOrdNo=' + Quotedstr(FCKOrdNo));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_BanCP_CR Set ');
|
|||
|
sql.add(' CRTime=getdate(),CRType=''ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.add(',CKOrdNo=' + Quotedstr(FCKOrdNo));
|
|||
|
sql.add(',RKOrdID=' + Quotedstr(FRKOrdID));
|
|||
|
sql.Add(' where exists(select MJID from CK_BanCP_CR X where CK_BanCP_CR.MJID=X.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
|
|||
|
sql.Add('and CK_BanCP_CR.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_BanCP_KC Set ');
|
|||
|
sql.add(' KCValid=''N'' ');
|
|||
|
sql.Add(' where exists(select MJID from CK_BanCP_CR X where CK_BanCP_KC.MJID=X.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE WFB_MJJY Set MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' ');
|
|||
|
sql.Add(' where exists (select MJID from CK_BanCP_CR X where WFB_MJJY.MJID=X.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
|
|||
|
SQL.Add(' and WFB_MJJY.MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.SaveCKDataJTM();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_PBCP_CR where mjid=' + Quotedstr(Trim(FMJID)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.IsEmpty = True then
|
|||
|
begin
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_PBCP_CR Set ');
|
|||
|
sql.add(' CRTime=getdate() ');
|
|||
|
sql.add(',CRType=' + quotedstr(Trim(CKType.Text)));
|
|||
|
sql.add(',KHName=' + quotedstr(Trim(KHName.Text)));
|
|||
|
|
|||
|
sql.add(',filler=' + quotedstr(Trim(DName)));
|
|||
|
sql.add(',CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.add(',CKOrdNo=' + Quotedstr(FCKOrdNo));
|
|||
|
sql.Add(' where CK_PBCP_CR.MJID=' + Quotedstr(Trim(FMJID)));
|
|||
|
sql.Add('and CK_PBCP_CR.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
|||
|
sql.Add('UPDATE CK_PBCP_KC Set ');
|
|||
|
sql.add(' KCValid=''N'',KCKgQty=0,KCQty=0 ');
|
|||
|
sql.Add(' where CK_PBCP_KC.MJID=' + Quotedstr(Trim(FMJID)));
|
|||
|
|
|||
|
sql.Add(' update WFB_MJJY_PB set MJStr4=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' where MJID=' + Quotedstr(Trim(FMJID)));
|
|||
|
|
|||
|
sql.Add('UPDATE WFB_MJJY_PB SET NEWNAME=' + QuotedStr(Trim(CPNAME.Text)));
|
|||
|
if batchno.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',NEWBATCHNO=' + QuotedStr(Trim(batchno.Text)));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
SQL.Add(',NEWBATCHNO=APBATCHNO');
|
|||
|
end;
|
|||
|
if CARNO.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',NEWCARNO=' + QuotedStr(Trim(CARNO.Text)));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
SQL.Add(',NEWCARNO=CARNO');
|
|||
|
end;
|
|||
|
|
|||
|
SQL.Add(',ckno=' + QuotedStr(Trim(CKOrdNo.Text)));
|
|||
|
if CPPRICE.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',CPPRICE=' + (Trim(CPPRICE.Text)));
|
|||
|
end;
|
|||
|
if KHPM.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',KHPM=' + QuotedStr(Trim(KHPM.Text)));
|
|||
|
end;
|
|||
|
if fsid.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',FHMAINID=' + QuotedStr(Trim(fsid.Text)));
|
|||
|
end;
|
|||
|
if SSID.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',FHSUBID=' + QuotedStr(Trim(SSID.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;
|
|||
|
// if Trim(EDIT5.Text) <> '' then
|
|||
|
// begin
|
|||
|
// SQL.Add(',FHKUWEI=''<27><>λ0'',fhkongjia=0 ');
|
|||
|
// end;
|
|||
|
// if Trim(EDIT7.Text) <> '' then
|
|||
|
// begin
|
|||
|
// SQL.Add(',FHKUWEI=''<27><>λ1'',fhkongjia=0.1 ');
|
|||
|
// end;
|
|||
|
// if Trim(EDIT8.Text) <> '' then
|
|||
|
// begin
|
|||
|
// SQL.Add(',FHKUWEI=''<27><>λ2'',fhkongjia=0.2 ');
|
|||
|
// end;
|
|||
|
|
|||
|
SQL.Add('WHERE MJID=' + quotedstr(trim(FMJID)));
|
|||
|
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
MovePanel2.Visible := False;
|
|||
|
MovePanel2.Visible := False;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.SaveCKDataCX();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update CK_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL,CRNote='''',CKOrdNo='''' ');
|
|||
|
sql.Add(' where exists(select MJID from CK_BanCP_CR X where CK_BanCP_CR.MJID=X.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
|
|||
|
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
|
|||
|
sql.Add(' UPdate CK_BanCP_KC Set KCValid=''Y'' ');
|
|||
|
sql.Add(' where exists(select MJID from CK_BanCP_CR X where CK_BanCP_KC.MJID=X.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
|
|||
|
sql.Add(' and KCValid=''N'' ');
|
|||
|
|
|||
|
sql.Add(' Update WFB_MJJY Set MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' where exists (select MJID from CK_BanCP_CR X where WFB_MJJY.MJID=X.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and X.RKOrdID=' + Quotedstr(FRKOrdID) + ') ');
|
|||
|
SQL.Add(' and WFB_MJJY.MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
sql.Add(',getdate() ');
|
|||
|
sql.Add(',' + quotedstr(''));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD>ɨ<EFBFBD>賷<EFBFBD><E8B3B7>')));
|
|||
|
sql.Add(',' + quotedstr('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(FRKOrdID) + ' <20><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(FCKOrdNo)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.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(FMJID)));
|
|||
|
|
|||
|
sql.Add(' UPdate CK_PBCP_KC Set KCValid=''Y'' ');
|
|||
|
sql.Add(' where CK_PBCP_KC.MJID=' + Quotedstr(Trim(FMJID)));
|
|||
|
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(FMJID)));
|
|||
|
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(',FHMAINID=NULL');
|
|||
|
SQL.Add(',FHSUBID=NULL');
|
|||
|
SQL.Add(',FHkuwei=NULL');
|
|||
|
SQL.Add(',pici=NULL');
|
|||
|
SQL.Add(',KHTAITOU=NULL');
|
|||
|
SQL.Add(',ckno=NULL');
|
|||
|
SQL.Add(',CPPRICE=NULL');
|
|||
|
SQL.Add(',KHPM=NULL');
|
|||
|
SQL.Add('WHERE MJID=' + quotedstr(trim(FMJID)));
|
|||
|
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(FMJID) + ' <20><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(FCKOrdNo)));
|
|||
|
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 TfrmPBSMCK.InitCKGrid();
|
|||
|
begin
|
|||
|
// with ADOQueryTemp do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// SQL.Add('SELECT NAME,SUM(KGQTY)KGQTY,NEWCARNO,NEWBATCHNO,count(*)ps 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('GROUP BY NAME,NEWCARNO,NEWBATCHNO');
|
|||
|
//// ShowMessage(SQL.Text);
|
|||
|
// Open;
|
|||
|
// 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 ISNULL(NEWNAME,'''')=' + QuotedStr(Trim(CPNAME.Text)));
|
|||
|
sql.Add('order by a.crtime desc');
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_MainSel);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_MainSel);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmPBSMCK := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
BaoID.SetFocus;
|
|||
|
ReadCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.BaoIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
MKey: Char;
|
|||
|
begin
|
|||
|
MKey := #13;
|
|||
|
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
if (Edit5.Text = '') and (Edit7.Text = '') and (Edit8.Text = '') then
|
|||
|
begin
|
|||
|
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>', '<27><>ʾ', 0);
|
|||
|
PlaySound('wav/<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
exit;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
if Edit6.Text <> '' then
|
|||
|
begin
|
|||
|
if cpname.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('ǿ<>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if edit4.Text <> '' then
|
|||
|
begin
|
|||
|
if edtIsSMTH.Text = '' then
|
|||
|
begin
|
|||
|
if StrToFloatDef(edit4.Text, 0) <= 0 then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Ѵ<D1B4><EFB7A2><EFBFBD><EFBFBD><EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
MovePanel2.Visible := True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
FSMID := TRIM(BaoID.Text);
|
|||
|
BaoID.Text := '';
|
|||
|
FRKOrdID := '';
|
|||
|
FMJID := '';
|
|||
|
FCKOrdNo := Trim(CKOrdNo.Text);
|
|||
|
if edtIsSMTH.Text = '' then
|
|||
|
begin
|
|||
|
if JudgeSQD() = False then
|
|||
|
exit;
|
|||
|
|
|||
|
FMJID := FSMID;
|
|||
|
|
|||
|
if JudgeJTM() then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
SaveCKDataJTM();
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
FMJID := FSMID;
|
|||
|
if JudgeJTMCX() then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
SaveCKDataJTMCX();
|
|||
|
end;
|
|||
|
if fsid.Text <> '' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_FHSQ_SSID ''' + Trim(fsid.Text) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
MovePanel2.Visible := False;
|
|||
|
|
|||
|
if Edit2.Text <> '' then
|
|||
|
begin
|
|||
|
Edit2KeyPress(EDIT2, MKey);
|
|||
|
end;
|
|||
|
// if CZZT <> 'ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
InitCKGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
WriteCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Button1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CKType.Text = '<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>' then
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZdyAttachment := TfrmZdyAttachment.Create(Application);
|
|||
|
with frmZdyAttachment do
|
|||
|
begin
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
KHName.Text := Trim(CDS_HZ.fieldbyname('CoName').AsString);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZdyAttachment.Free;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
|
|||
|
with frmZdyAttachGYS do
|
|||
|
begin
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
KHName.Text := Trim(CDS_HZ.fieldbyname('CoName').AsString);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZdyAttachGYS.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
BaoID.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Button3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CKOrdNo.Text <> '' then
|
|||
|
begin
|
|||
|
if Application.MessageBox('ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if GetLSNo(ADOQueryTemp, FCKOrdNo, 'CK', 'CK_PBCP_CR', 4, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
CKOrdNo.TEXT := FCKOrdNo;
|
|||
|
BaoID.SetFocus;
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('insert into CK_BanCP_CKList(CKOrdNo) ');
|
|||
|
// sql.add('values(' + quotedstr(FCKOrdNo) + ') ');
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.CKTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
// KHName.Text := '';
|
|||
|
BaoID.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.edtIsSMTHClick(Sender: TObject);
|
|||
|
begin
|
|||
|
BaoID.SetFocus;
|
|||
|
if edtIsSMTH.Text = '<27><>' then
|
|||
|
begin
|
|||
|
edtIsSMTH.Text := '';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɨ<D2AA><C9A8><EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) = IDYES then
|
|||
|
edtIsSMTH.Text := '<27><>';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Button4Click(Sender: TObject);
|
|||
|
var
|
|||
|
MKey: Char;
|
|||
|
SqlMJID: string;
|
|||
|
FGS: Integer;
|
|||
|
begin
|
|||
|
MKey := #13;
|
|||
|
CZZT := 'ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
SqlMJID := '';
|
|||
|
FGS := 0;
|
|||
|
if JudgeSQD() = False then
|
|||
|
exit;
|
|||
|
if (Edit5.Text = '') and (Edit7.Text = '') and (Edit8.Text = '') then
|
|||
|
begin
|
|||
|
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>', '<27><>ʾ', 0);
|
|||
|
PlaySound('wav/<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
exit;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
if Edit6.Text <> '' then
|
|||
|
begin
|
|||
|
if cpname.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('ǿ<>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if edit4.Text <> '' then
|
|||
|
begin
|
|||
|
if edtIsSMTH.Text = '' then
|
|||
|
begin
|
|||
|
if StrToFloatDef(edit4.Text, 0) <= 0 then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Ѵ<D1B4><EFB7A2><EFBFBD><EFBFBD><EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
try
|
|||
|
frmPBKCListSel := TfrmPBKCListSel.Create(Application);
|
|||
|
with frmPBKCListSel do
|
|||
|
begin
|
|||
|
C_CodeName.Text := cpname.Text;
|
|||
|
jhchejian.ItemIndex := jhchejian.Items.IndexOf(trim(canshu1));
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
with frmPBKCListSel.CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
|
|||
|
if Trim(SqlMJID) = '' then
|
|||
|
SqlMJID := QuotedStr(Trim(fieldbyname('MJID').AsString))
|
|||
|
else
|
|||
|
SqlMJID := SqlMJID + ',' + QuotedStr(Trim(fieldbyname('MJID').AsString));
|
|||
|
|
|||
|
FGS := FGS + 1;
|
|||
|
// BaoID.Text := Trim(Fieldbyname('MJID').AsString);
|
|||
|
// BaoIDKeyPress(BaoID, MKey);
|
|||
|
// Sleep(200);
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
if Trim(SqlMJID) = '' then
|
|||
|
begin
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
SqlMJID := 'MJID IN (' + SqlMJID + ')';
|
|||
|
|
|||
|
if trim(Edit6.Text) = '' then
|
|||
|
begin
|
|||
|
if Trim(CPNAME.Text) <> '' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT * FROM WFB_MJJY_PB where ' + SqlMJID);
|
|||
|
sql.Add('and isnull(name,'''')<>' + QuotedStr(CPNAME.Text));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = FALSE then
|
|||
|
begin
|
|||
|
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
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT * FROM WFB_MJJY_PB where ' + SqlMJID);
|
|||
|
sql.Add('and isnull(carno,'''')<>' + QuotedStr(carno.Text));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = FALSE then
|
|||
|
begin
|
|||
|
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
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT * FROM WFB_MJJY_PB where ' + SqlMJID);
|
|||
|
sql.Add('and isnull(apbatchno,'''')<>' + QuotedStr(batchno.Text));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
PlaySound('wav\<5C><><EFBFBD>Ų<EFBFBD>ͬ<EFBFBD><CDAC>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(Edit2.Text) <> '' then
|
|||
|
begin
|
|||
|
if (StrToInt(Edit4.Text) - FGS) < 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;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_PBCP_CR Set ');
|
|||
|
sql.add(' CRTime=getdate() ');
|
|||
|
sql.add(',CRType=' + quotedstr(Trim(SELF.CKType.Text)));
|
|||
|
sql.add(',KHName=' + quotedstr(Trim(Self.KHName.Text)));
|
|||
|
|
|||
|
sql.add(',filler=' + quotedstr(Trim(DName)));
|
|||
|
sql.add(',CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.add(',CKOrdNo=' + Quotedstr(SELF.CKOrdNo.Text));
|
|||
|
sql.Add('where ' + SqlMJID);
|
|||
|
sql.Add('and CK_PBCP_CR.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
|||
|
sql.Add('UPDATE CK_PBCP_KC Set ');
|
|||
|
sql.add(' KCValid=''N'',KCKgQty=0,KCQty=0 ');
|
|||
|
sql.Add('where ' + SqlMJID);
|
|||
|
|
|||
|
sql.Add('UPDATE WFB_MJJY_PB SET MJStr4=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'',NEWNAME=' + QuotedStr(Trim(Self.CPNAME.Text)));
|
|||
|
if Self.batchno.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',NEWBATCHNO=' + QuotedStr(Trim(Self.batchno.Text)));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
SQL.Add(',NEWBATCHNO=APBATCHNO');
|
|||
|
end;
|
|||
|
if SELF.CARNO.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',NEWCARNO=' + QuotedStr(Trim(SELF.CARNO.Text)));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
SQL.Add(',NEWCARNO=CARNO');
|
|||
|
end;
|
|||
|
|
|||
|
SQL.Add(',ckno=' + QuotedStr(Trim(Self.CKOrdNo.Text)));
|
|||
|
if SELF.CPPRICE.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',CPPRICE=' + (Trim(SELF.CPPRICE.Text)));
|
|||
|
end;
|
|||
|
if SELF.KHPM.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',KHPM=' + QuotedStr(Trim(SELF.KHPM.Text)));
|
|||
|
end;
|
|||
|
if Self.fsid.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',FHMAINID=' + QuotedStr(Trim(SELF.fsid.Text)));
|
|||
|
end;
|
|||
|
if SSID.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',FHSUBID=' + QuotedStr(Trim(SSID.Text)));
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(SELF.taitou.Text) <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',KHTAITOU=' + QuotedStr(Trim(SELF.taitou.Text)));
|
|||
|
end;
|
|||
|
if Trim(SELF.pici.Text) <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',pici=' + QuotedStr(Trim(Self.pici.Text)));
|
|||
|
end;
|
|||
|
// if Trim(EDIT5.Text) <> '' then
|
|||
|
// begin
|
|||
|
// SQL.Add(',FHKUWEI=''<27><>λ0'',fhkongjia=0 ');
|
|||
|
// end;
|
|||
|
// if Trim(EDIT7.Text) <> '' then
|
|||
|
// begin
|
|||
|
// SQL.Add(',FHKUWEI=''<27><>λ1'',fhkongjia=0.1 ');
|
|||
|
// end;
|
|||
|
// if Trim(EDIT8.Text) <> '' then
|
|||
|
// begin
|
|||
|
// SQL.Add(',FHKUWEI=''<27><>λ2'',fhkongjia=0.2 ');
|
|||
|
// end;
|
|||
|
|
|||
|
SQL.Add('WHERE ' + SqlMJID);
|
|||
|
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmPBKCListSel.Free;
|
|||
|
|
|||
|
end;
|
|||
|
if fsid.Text <> '' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_FHSQ_SSID ''' + Trim(fsid.Text) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if Edit2.Text <> '' then
|
|||
|
begin
|
|||
|
Edit2KeyPress(EDIT2, MKey);
|
|||
|
end;
|
|||
|
// if CZZT <> 'ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
|
|||
|
InitCKGrid();
|
|||
|
BaoID.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.KHNAMEPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZdyAttachment := TfrmZdyAttachment.Create(Application);
|
|||
|
with frmZdyAttachment do
|
|||
|
begin
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
KHNAME.Text := Trim(CDS_HZ.fieldbyname('CoName').AsString);
|
|||
|
taitou.Text := Trim(CDS_HZ.fieldbyname('CoName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZdyAttachment.Free;
|
|||
|
end;
|
|||
|
// if KHNAME.Text <> '' then
|
|||
|
// begin
|
|||
|
// if Application.MessageBox('<27>Ƿ<EFBFBD>Ҫѡ<D2AA><EFBFBD><F1B7A2BB><EFBFBD><EFBFBD>룿', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
// begin
|
|||
|
//
|
|||
|
// end
|
|||
|
// else
|
|||
|
// begin
|
|||
|
// try
|
|||
|
// frmFHSQListSel := TfrmFHSQListSel.Create(self);
|
|||
|
// with frmFHSQListSel do
|
|||
|
// begin
|
|||
|
// CustomerNoName.Text := Self.KHNAME.Text;
|
|||
|
// CustomerNoName.Enabled := FALSE;
|
|||
|
// if ShowModal = 1 then
|
|||
|
// begin
|
|||
|
// FSID.Text := Trim(Order_Main.fieldbyname('FSID').AsString);
|
|||
|
// SSID.Text := Trim(Order_Main.fieldbyname('SSID').AsString);
|
|||
|
// taitou.Text := Trim(Order_Main.fieldbyname('shouhuotaitou').AsString);
|
|||
|
// KHPM.Text := Trim(Order_Main.fieldbyname('FHKHPM').AsString);
|
|||
|
// CPNAME.Text := Trim(Order_Main.fieldbyname('P_NAME').AsString);
|
|||
|
// CPPRICE.Text := Trim(Order_Main.fieldbyname('SQPRICE').AsString);
|
|||
|
// EDIT2.Text := Trim(Order_Main.fieldbyname('SQPS').AsString);
|
|||
|
// EDIT4.Text := Trim(Order_Main.fieldbyname('WFPS').AsString);
|
|||
|
//
|
|||
|
//// EDIT4.Text := Trim(Order_Main.fieldbyname('SQPS').AsString);
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// finally
|
|||
|
// frmFHSQListSel.Free;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
//
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Button5Click(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=' + Edit1.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;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.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 TfrmPBSMCK.Edit6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(Edit6.Text) = '' then
|
|||
|
begin
|
|||
|
Edit6.Text := '<27><>';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Edit6.Text := '';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Edit3KeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
MKey: Char;
|
|||
|
begin
|
|||
|
MKey := #13;
|
|||
|
if CKOrdNo.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ȡ<EFBFBD>ţ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if KHNAME.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if (Edit5.Text = '') and (Edit7.Text = '') and (Edit8.Text = '') then
|
|||
|
begin
|
|||
|
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>', '<27><>ʾ', 0);
|
|||
|
PlaySound('wav/<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
exit;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
if Edit6.Text <> '' then
|
|||
|
begin
|
|||
|
if cpname.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('ǿ<>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
// if (Edit5.Text = '') and (Edit7.Text = '') and (Edit8.Text = '') then
|
|||
|
// begin
|
|||
|
//
|
|||
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>', '<27><>ʾ', 0);
|
|||
|
// PlaySound('wav/<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
// exit;
|
|||
|
//
|
|||
|
// end;
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
if (edit4.Text = '') and (Edit2.Text <> '') then
|
|||
|
begin
|
|||
|
Edit2KeyPress(EDIT2, MKey);
|
|||
|
end;
|
|||
|
end;
|
|||
|
if edit4.Text <> '' then
|
|||
|
begin
|
|||
|
if StrToFloatDef(edit4.Text, 0) <= 0 then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Ѵ<D1B4><EFB7A2><EFBFBD><EFBFBD><EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
if CPNAME.Text = '' then
|
|||
|
begin
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if Edit3.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_SC_NEWMJID_WSQ @ckordno=' + QuotedStr(Trim(CKOrdNo.Text)));
|
|||
|
sql.Add(',@cpname=' + QuotedStr(Trim(cpname.Text)));
|
|||
|
sql.Add(',@khname=' + QuotedStr(Trim(khname.Text)));
|
|||
|
sql.Add(',@MJMAOZ=' + (Trim(Edit3.Text)));
|
|||
|
sql.Add(',@filler=' + QuotedStr(Trim(DName)));
|
|||
|
sql.Add(',@CARNO=' + QuotedStr(Trim(CARNO.Text)));
|
|||
|
sql.Add(',@BATCHNO=' + QuotedStr(Trim(BATCHNO.Text)));
|
|||
|
sql.Add(',@chejian=' + QuotedStr(Trim(canshu1)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
BaoID.Text := Trim(ADOQueryTemp.Fieldbyname('bhno').AsString);
|
|||
|
BaoIDKeyPress(BaoID, MKey);
|
|||
|
Sleep(200);
|
|||
|
Edit3.Text := '';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Button6Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile, fshtt: string;
|
|||
|
begin
|
|||
|
|
|||
|
if CKOrdNo.Text = '' then
|
|||
|
EXIT;
|
|||
|
if (Edit5.Text = '') and (Edit7.Text = '') and (Edit8.Text = '') then
|
|||
|
begin
|
|||
|
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>', '<27><>ʾ', 0);
|
|||
|
PlaySound('wav/<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
exit;
|
|||
|
|
|||
|
end;
|
|||
|
if Application.MessageBox('<27>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>¿<EFBFBD>λ<EFBFBD><CEBB>', '<27><>ʾ', 32 + 4) = IDYES then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_UPDATE_KONGJIA @ckno=' + quotedstr(Trim(CKOrdNo.Text)));
|
|||
|
|
|||
|
if Trim(EDIT5.Text) <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',@FHKUWEI=''<27><>λ0'',@kongjia=0 ');
|
|||
|
end;
|
|||
|
if Trim(EDIT7.Text) <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',@FHKUWEI=''<27><>λ1'',@kongjia=0.1 ');
|
|||
|
end;
|
|||
|
if Trim(EDIT8.Text) <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(',@FHKUWEI=''<27><>λ2'',@kongjia=0.2 ');
|
|||
|
end;
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
|
|||
|
if (trim(ComboBox1.Text) = '<27><>Ʒ<EFBFBD><C6B7><EFBFBD>뵥') or (trim(ComboBox1.Text) = '<27><>̧ͷ<CCA7><CDB7>Ʒ<EFBFBD><C6B7><EFBFBD>뵥') then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CKMD_PM @CKOrdNo=' + quotedstr(Trim(CKOrdNo.Text)));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT);
|
|||
|
end;
|
|||
|
if (trim(ComboBox1.Text) = '<27><>ͨ<EFBFBD>뵥') or (trim(ComboBox1.Text) = '<27><>̧ͷ<CCA7><CDB7>ͨ<EFBFBD>뵥') or (trim(ComboBox1.Text) = '<27><>ͨ<EFBFBD>뵥(<28><><EFBFBD><EFBFBD><EFBFBD><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>̨') or (trim(ComboBox1.Text) = '<27><>̧ͷ<CCA7>ֻ<EFBFBD>̨(<28><><EFBFBD><EFBFBD><EFBFBD><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 ISNULL(KHTAITOU,KHNAME)KHNAME,khname as khname2,CRTIME from WFB_MJJY_PB a inner join CK_PBCP_CR b on a.mjid=b.mjid where CKOrdNo=' + quotedstr(Trim(CKOrdNo.Text)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
RM1.PreviewButtons := [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS, pbExport, pbNavigator];
|
|||
|
fshtt := Trim(ADOQueryTemp.fieldbyname('khname2').AsString);
|
|||
|
|
|||
|
RMVariables['shouhuotaitou'] := Trim(ADOQueryTemp.fieldbyname('khname').AsString);
|
|||
|
RMVariables['MJDATE'] := Trim(ADOQueryTemp.fieldbyname('CRTime').AsString);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add(' SELECT TOP 1 * FROM Company WHERE CONAME=' + quotedstr(Trim(fshtt)));
|
|||
|
SQL.Add('AND VALID=''Y'' and cotype=''<27>ͻ<EFBFBD>''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
RMVariables['SFHS'] := Trim(ADOQueryTemp.fieldbyname('SFHS').AsString);
|
|||
|
|
|||
|
// RMVariables['FHTaiTou'] := Trim(CDS_Main.fieldbyname('FHTT').AsString);
|
|||
|
|
|||
|
RMVariables['Znote'] := '';
|
|||
|
RMVariables['FILLER'] := Trim(DNAME);
|
|||
|
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
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);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Edit2Change(Sender: TObject);
|
|||
|
var
|
|||
|
f1, f2: double;
|
|||
|
begin
|
|||
|
f1 := StrToFloatDef(Edit2.Text, 0);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Edit2KeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
f1, f2: double;
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
f1 := StrToFloatDef(Edit2.Text, 0);
|
|||
|
if fsid.Text = '' then
|
|||
|
begin
|
|||
|
if CKOrdNo.Text <> '' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('select count(*)js from CK_PBCP_CR a inner join WFB_MJJY_PB b on a.mjid=b.mjid where CKOrdNo=' + quotedstr(Trim(CKOrdNo.Text)));
|
|||
|
sql.Add('and khpm=' + quotedstr(Trim(KHPM.Text)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Edit4.Text := FloatToStr(f1);
|
|||
|
end;
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('select count(*)js from WFB_MJJY_PB a where fhsubid=' + quotedstr(Trim(ssid.Text)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = false then
|
|||
|
begin
|
|||
|
Edit4.Text := FloatToStr(f1 - ADOQueryTemp.fieldbyname('js').AsInteger);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.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 TfrmPBSMCK.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 TfrmPBSMCK.cpnamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
Panel3.Visible := True;
|
|||
|
// if fsid.text = '' then
|
|||
|
// begin
|
|||
|
// try
|
|||
|
// frmCPManageFMSel := TfrmCPManageFMSel.Create(Application);
|
|||
|
// with frmCPManageFMSel do
|
|||
|
// begin
|
|||
|
// if ShowModal = 1 then
|
|||
|
// begin
|
|||
|
//
|
|||
|
// cpname.Text := frmCPManageFMSel.CDS_Main.fieldbyname('CYName').AsString;
|
|||
|
// KHPM.Text := frmCPManageFMSel.CDS_Main.fieldbyname('CYName').AsString;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// finally
|
|||
|
// frmCPManageFMSel.Free;
|
|||
|
// end;
|
|||
|
// if cpname.Text <> '' then
|
|||
|
// INITTJ();
|
|||
|
// end
|
|||
|
// else
|
|||
|
// begin
|
|||
|
// try
|
|||
|
// frmFHSQListSel := TfrmFHSQListSel.Create(self);
|
|||
|
// with frmFHSQListSel do
|
|||
|
// begin
|
|||
|
// CustomerNoName.Text := Self.KHNAME.Text;
|
|||
|
// CustomerNoName.Enabled := FALSE;
|
|||
|
// if ShowModal = 1 then
|
|||
|
// begin
|
|||
|
// FSID.Text := Trim(Order_Main.fieldbyname('FSID').AsString);
|
|||
|
// SSID.Text := Trim(Order_Main.fieldbyname('SSID').AsString);
|
|||
|
// taitou.Text := Trim(Order_Main.fieldbyname('shouhuotaitou').AsString);
|
|||
|
// KHPM.Text := Trim(Order_Main.fieldbyname('FHKHPM').AsString);
|
|||
|
// CPNAME.Text := Trim(Order_Main.fieldbyname('P_NAME').AsString);
|
|||
|
// CPPRICE.Text := Trim(Order_Main.fieldbyname('SQPRICE').AsString);
|
|||
|
// EDIT2.Text := Trim(Order_Main.fieldbyname('SQPS').AsString);
|
|||
|
// EDIT4.Text := Trim(Order_Main.fieldbyname('WFPS').AsString);
|
|||
|
//
|
|||
|
//// EDIT4.Text := Trim(Order_Main.fieldbyname('SQPS').AsString);
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// finally
|
|||
|
// frmFHSQListSel.Free;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.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(',FHKuwei=NULL');
|
|||
|
SQL.Add(',FHMAINID=NULL');
|
|||
|
SQL.Add(',FHSUBID=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(CDS_MainSEL.FieldByName('CKOrdNo').AsString) + ' <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(CDS_MainSel.fieldbyname('CKOrdNo').AsString) + '''');
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
end;
|
|||
|
if fsid.Text <> '' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_FHSQ_SSID ''' + Trim(fsid.Text) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Edit2.Text <> '' then
|
|||
|
begin
|
|||
|
f1 := StrToFloatDef(Edit2.Text, 0);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('select count(*)js from CK_PBCP_CR a where CKOrdNo=' + quotedstr(Trim(CKOrdNo.Text)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
Edit4.Text := FloatToStr(f1 - ADOQueryTemp.fieldbyname('js').AsInteger);
|
|||
|
end;
|
|||
|
|
|||
|
CDS_MainSel.Delete;
|
|||
|
|
|||
|
end;
|
|||
|
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 TfrmPBSMCK.Button7Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel1.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.N3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_MainSel, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.N4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_MainSel, false);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
panel1.Visible := true;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Edit5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
if edit5.Text = '<27><>' then
|
|||
|
begin
|
|||
|
edit5.Text := '';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
edit5.Text := '<27><>';
|
|||
|
edit7.Text := '';
|
|||
|
edit8.Text := '';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Edit7Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if edit7.Text = '<27><>' then
|
|||
|
begin
|
|||
|
edit7.Text := '';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
edit7.Text := '<27><>';
|
|||
|
edit5.Text := '';
|
|||
|
edit8.Text := '';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Edit8Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if edit8.Text = '<27><>' then
|
|||
|
begin
|
|||
|
edit8.Text := '';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
edit8.Text := '<27><>';
|
|||
|
edit5.Text := '';
|
|||
|
edit7.Text := '';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Button8Click(Sender: TObject);
|
|||
|
begin
|
|||
|
fsid.Text := '';
|
|||
|
ssid.Text := '';
|
|||
|
Edit2.Text := '0';
|
|||
|
Edit4.Text := '0';
|
|||
|
CPPRICE.Text := '0';
|
|||
|
edit5.Text := '';
|
|||
|
edit7.Text := '';
|
|||
|
edit8.Text := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Button9Click(Sender: TObject);
|
|||
|
var
|
|||
|
fxz: string;
|
|||
|
begin
|
|||
|
if khname.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
frmFHSQListSel := TfrmFHSQListSel.Create(self);
|
|||
|
with frmFHSQListSel do
|
|||
|
begin
|
|||
|
CustomerNoName.Text := Self.KHNAME.Text;
|
|||
|
CustomerNoName.Enabled := FALSE;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
FSID.Text := Trim(Order_Main.fieldbyname('FSID').AsString);
|
|||
|
SSID.Text := Trim(Order_Main.fieldbyname('SSID').AsString);
|
|||
|
taitou.Text := Trim(Order_Main.fieldbyname('shouhuotaitou').AsString);
|
|||
|
KHPM.Text := Trim(Order_Main.fieldbyname('FHKHPM').AsString);
|
|||
|
// CPNAME.Text := Trim(Order_Main.fieldbyname('P_NAME').AsString);
|
|||
|
CPPRICE.Text := Trim(Order_Main.fieldbyname('SQPRICE').AsString);
|
|||
|
EDIT2.Text := Trim(Order_Main.fieldbyname('SQPS').AsString);
|
|||
|
EDIT4.Text := Trim(Order_Main.fieldbyname('WFPS').AsString);
|
|||
|
Panel3.Visible := False;
|
|||
|
KHPM.Enabled := False;
|
|||
|
fxz := '1';
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmFHSQListSel.Free;
|
|||
|
end;
|
|||
|
if fxz = '1' then
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCPManageFMSel := TfrmCPManageFMSel.Create(Application);
|
|||
|
with frmCPManageFMSel do
|
|||
|
begin
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
// KHPM.Enabled := True;
|
|||
|
cpname.Text := frmCPManageFMSel.CDS_Main.fieldbyname('CYName').AsString;
|
|||
|
// KHPM.Text := frmCPManageFMSel.CDS_Main.fieldbyname('CYName').AsString;
|
|||
|
|
|||
|
// Self.Panel3.Visible := False;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCPManageFMSel.Free;
|
|||
|
end;
|
|||
|
if cpname.Text <> '' then
|
|||
|
INITTJ();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Button10Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCPManageFMSel := TfrmCPManageFMSel.Create(Application);
|
|||
|
with frmCPManageFMSel do
|
|||
|
begin
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
KHPM.Enabled := True;
|
|||
|
cpname.Text := frmCPManageFMSel.CDS_Main.fieldbyname('CYName').AsString;
|
|||
|
KHPM.Text := frmCPManageFMSel.CDS_Main.fieldbyname('CYName').AsString;
|
|||
|
FSID.Text := '';
|
|||
|
SSID.Text := '';
|
|||
|
CPPRICE.Text := '';
|
|||
|
Edit2.Text := '0';
|
|||
|
Edit4.Text := '0';
|
|||
|
Self.Panel3.Visible := False;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCPManageFMSel.Free;
|
|||
|
end;
|
|||
|
if cpname.Text <> '' then
|
|||
|
INITTJ();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBSMCK.Button11Click(Sender: TObject);
|
|||
|
begin
|
|||
|
panel3.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|