1192 lines
34 KiB
ObjectPascal
1192 lines
34 KiB
ObjectPascal
|
|
unit U_OrderInPut_New220327;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
|
cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
|||
|
|
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, cxMemo,
|
|||
|
|
cxRichEdit, ComCtrls, cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit,
|
|||
|
|
StdCtrls, ToolWin, DBClient, ADODB, ExtCtrls, BtnEdit, cxCalendar, StrUtils,
|
|||
|
|
cxCurrencyEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxDropDownEdit,
|
|||
|
|
cxCheckBox, Menus, cxPC, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
|
dxBarBuiltInMenu, cxNavigator;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmOrderInPut_New220327 = class(TForm)
|
|||
|
|
ADOTemp: TADOQuery;
|
|||
|
|
ADOCmd: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
Order_Sub: TClientDataSet;
|
|||
|
|
ADOQuery1: TADOQuery;
|
|||
|
|
CDS_JGMX: TClientDataSet;
|
|||
|
|
DSCON: TDataSource;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryTmp: TADOQuery;
|
|||
|
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
|
cxStyle1: TcxStyle;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
ScrollBox1: TScrollBox;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
Label14: TLabel;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
MLConNo: TBtnEditC;
|
|||
|
|
MLOrderNo: TEdit;
|
|||
|
|
OrdDate: TDateTimePicker;
|
|||
|
|
KHName: TBtnEditC;
|
|||
|
|
MLCodeName: TBtnEditC;
|
|||
|
|
MLCodeNo: TEdit;
|
|||
|
|
MLBZNote: TMemo;
|
|||
|
|
YWY: TBtnEditC;
|
|||
|
|
ClientDataSet3: TClientDataSet;
|
|||
|
|
DataSource3: TDataSource;
|
|||
|
|
Panel4: TPanel;
|
|||
|
|
Image2: TImage;
|
|||
|
|
Button3: TButton;
|
|||
|
|
Button5: TButton;
|
|||
|
|
Button6: TButton;
|
|||
|
|
Button9: TButton;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
GYNote: TMemo;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
BZType: TComboBox;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
MLNote: TMemo;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
MLMFNote: TEdit;
|
|||
|
|
JHDate: TDateTimePicker;
|
|||
|
|
N3: TMenuItem;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBSave: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
ToolBar2: TToolBar;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
cxPageControl1: TcxPageControl;
|
|||
|
|
cxTabSheet1: TcxTabSheet;
|
|||
|
|
cxTabSheet2: TcxTabSheet;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1XHNo: TcxGridDBColumn;
|
|||
|
|
v1MLColor: TcxGridDBColumn;
|
|||
|
|
v1Column1: TcxGridDBColumn;
|
|||
|
|
v1Column4: TcxGridDBColumn;
|
|||
|
|
v1MLColorNo: TcxGridDBColumn;
|
|||
|
|
v1Column2: TcxGridDBColumn;
|
|||
|
|
v1QtyUnit: TcxGridDBColumn;
|
|||
|
|
v1Qty: TcxGridDBColumn;
|
|||
|
|
v1Column3: TcxGridDBColumn;
|
|||
|
|
v1Column7: TcxGridDBColumn;
|
|||
|
|
v1Column8: TcxGridDBColumn;
|
|||
|
|
v1MLHX: TcxGridDBColumn;
|
|||
|
|
v1Column5: TcxGridDBColumn;
|
|||
|
|
v1Column6: TcxGridDBColumn;
|
|||
|
|
v1Column9: TcxGridDBColumn;
|
|||
|
|
v1MXNote: TcxGridDBColumn;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv2: TcxGridDBTableView;
|
|||
|
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
|
V2MLName: TcxGridDBColumn;
|
|||
|
|
V2Note: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
v1Column10: TcxGridDBColumn;
|
|||
|
|
cxTabSheet3: TcxTabSheet;
|
|||
|
|
DataSource2: TDataSource;
|
|||
|
|
ClientDataSet2: TClientDataSet;
|
|||
|
|
V2MLCode: TcxGridDBColumn;
|
|||
|
|
V2MF: TcxGridDBColumn;
|
|||
|
|
V2KZ: TcxGridDBColumn;
|
|||
|
|
PopupMenu2: TPopupMenu;
|
|||
|
|
MenuItem1: TMenuItem;
|
|||
|
|
MenuItem2: TMenuItem;
|
|||
|
|
Tv2Column1: TcxGridDBColumn;
|
|||
|
|
Panel3: TPanel;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
ComboBox1: TComboBox;
|
|||
|
|
Button1: TButton;
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
|
procedure v1PRTColorPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure KHNameBtnUpClick(Sender: TObject);
|
|||
|
|
procedure KHNameBtnDnClick(Sender: TObject);
|
|||
|
|
procedure v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure v1PriceUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure OrdDefStr2BtnUpClick(Sender: TObject);
|
|||
|
|
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure YCLFactoryBtnUpClick(Sender: TObject);
|
|||
|
|
procedure MPRTSCTeBieNoteBtnUpClick(Sender: TObject);
|
|||
|
|
procedure V2GXNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure YWYBtnUpClick(Sender: TObject);
|
|||
|
|
procedure GYNoteDblClick(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure Tv3Column1PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure Image2Click(Sender: TObject);
|
|||
|
|
procedure Button3Click(Sender: TObject);
|
|||
|
|
procedure v1MLHXPropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure N3Click(Sender: TObject);
|
|||
|
|
procedure v1Column7PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure Tv2Column1PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure Tv2MouseDown(Sender: TObject; Button: TMouseButton;
|
|||
|
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
|
procedure MenuItem1Click(Sender: TObject);
|
|||
|
|
procedure Button1Click(Sender: TObject);
|
|||
|
|
procedure MenuItem2Click(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
procedure InitData();
|
|||
|
|
function SaveData(): Boolean;
|
|||
|
|
procedure InitPDJL();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
PState, CopyInt, PriceFlag: Integer;
|
|||
|
|
FMainId, FFMainId, FOrderNo, ISPD: string;
|
|||
|
|
FXS: Integer;
|
|||
|
|
canshu1, canshu2: string;
|
|||
|
|
fFlileFlag: string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmOrderInPut_New220327: TfrmOrderInPut_New220327;
|
|||
|
|
newh: hwnd;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_ZDYHelp, U_Fun, U_KHList_CX, U_ZDYHelpSel
|
|||
|
|
,U_MLMangeRSSel,U_ZdyAttachCP_HX_sel,U_BPZdy_LRM;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure TfrmOrderInPut_New220327.InitPDJL();
|
|||
|
|
var
|
|||
|
|
i: Integer;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
i := 0;
|
|||
|
|
with ADOQueryTmp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add(' select * from ML_ConMain A inner join ML_ConSub B on A.MLConID=B.MLConID ');
|
|||
|
|
sql.Add('where exists(select * from TbForBatch X where X.ConSubId=B.CSID and X.MainType=''<27><><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>'' and X.DName=' + QUOTEDSTR(Trim(DName)) + ' )');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
KHName.Text := ADOQueryTmp.FieldByName('KHName').AsString;
|
|||
|
|
MLConNo.Text := ADOQueryTmp.FieldByName('ConNO').AsString;
|
|||
|
|
MLCodeNo.Text := ADOQueryTmp.FieldByName('ConCode').AsString;
|
|||
|
|
MLCodeName.Text := ADOQueryTmp.FieldByName('ConCodeName').AsString;
|
|||
|
|
MLOrderNo.Text :=Trim(ADOQueryTmp.FieldByName('YWConNo').AsString)+'-'
|
|||
|
|
+Trim(ADOQueryTmp.FieldByName('XHNo').AsString);
|
|||
|
|
MLOrderNo.Hint:=Trim(ADOQueryTmp.FieldByName('CSID').AsString);
|
|||
|
|
with ADOQueryTmp do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('ConSubId').Value := ADOQueryTmp.FieldByName('CSID').Value;
|
|||
|
|
FieldByName('XHNO').Value := IntToStr(i + 1);
|
|||
|
|
FieldByName('MLColor').Value := ADOQueryTmp.FieldByName('ConColor').Value;
|
|||
|
|
FieldByName('MLColorNo').Value := ADOQueryTmp.FieldByName('ConColNo').Value;
|
|||
|
|
FieldByName('MLHX').Value := ADOQueryTmp.FieldByName('ConHX').Value;
|
|||
|
|
FieldByName('QtyUnit').Value := ADOQueryTmp.FieldByName('QtyUnit').Value;
|
|||
|
|
FieldByName('Qty').Value := ADOQueryTmp.FieldByName('Qty').Value;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.InitData();
|
|||
|
|
begin
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add(' select * from ML_OrderSubidNew where 1=1 ');
|
|||
|
|
if PState = 1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and NewMLID=''' + Trim(FMainId) + '''');
|
|||
|
|
end;
|
|||
|
|
if PState = 0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and 1<>1');
|
|||
|
|
end;
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQuery1, Order_Sub);
|
|||
|
|
SInitCDSData20(ADOQuery1, Order_Sub);
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add(' select * from ML_OrderZuHe where NewMLID=''' + Trim(FMainId) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQuery1, ClientDataSet2);
|
|||
|
|
SInitCDSData20(ADOQuery1, ClientDataSet2);
|
|||
|
|
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from ML_OrderMainNew where NewMLID=''' + Trim(FMainId) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCSHDataNew(ADOQuery1, ScrollBox1, 2);
|
|||
|
|
if PState = 0 then
|
|||
|
|
begin
|
|||
|
|
OrdDate.DateTime := SGetServerDateTime(ADOTemp);
|
|||
|
|
JHDate.Date:=OrdDate.Date;
|
|||
|
|
YWY.Text := Trim(DName);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
end;
|
|||
|
|
if CopyInt = 99 then
|
|||
|
|
begin
|
|||
|
|
PState := 0;
|
|||
|
|
FMainId := '';
|
|||
|
|
OrdDate.DateTime := SGetServerDateTime(ADOTemp);
|
|||
|
|
JHDate.Date:=OrdDate.Date;
|
|||
|
|
YWY.Text := Trim(DName);
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('NewMLID').Value := '';
|
|||
|
|
FieldByName('NewSubid').Value := '';
|
|||
|
|
Post;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with ClientDataSet2 do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('NewMLID').Value := '';
|
|||
|
|
FieldByName('ZHID').Value := '';
|
|||
|
|
Post;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
readCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
InitData();
|
|||
|
|
if ISPD = '<27>ŵ<EFBFBD>' then
|
|||
|
|
InitPDJL();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmOrderInPut_New220327.SaveData(): Boolean;
|
|||
|
|
var
|
|||
|
|
maxno, MXmaxno, forderNo: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOCmd.Connection.BeginTrans;
|
|||
|
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if Trim(FMainId) = '' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOTemp, maxno, 'ML', 'ML_OrderMainNew', 3, 1) = False then
|
|||
|
|
begin
|
|||
|
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
{if GetLSNo(ADOCmd,forderNo,'','ML_OrderMainNew',3,1)=False then
|
|||
|
|
begin
|
|||
|
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
MLorderNo.Text:=forderNo;}
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
maxno := Trim(FMainId);
|
|||
|
|
end;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select * from ML_OrderMainNew where NewMLID=''' + Trim(FMainId) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(FMainId) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
end;
|
|||
|
|
FieldByName('NewMLID').Value := Trim(maxno);
|
|||
|
|
SSetsaveSqlNew(ADOCmd, 'ML_OrderMainNew', ScrollBox1, 2);
|
|||
|
|
if Trim(MLOrderNo.Hint)<>'' then
|
|||
|
|
begin
|
|||
|
|
FieldByName('ConSubId').Value :=Trim(MLOrderNo.Hint);
|
|||
|
|
end;
|
|||
|
|
FieldByName('Status').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
|||
|
|
if Trim(FMainId) = '' then
|
|||
|
|
begin
|
|||
|
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FieldByName('Editer').Value := Trim(DName);
|
|||
|
|
FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp);
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
FMainId := Trim(maxno);
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select * from ML_OrderMainNew where MLOrderNo=''' + Trim(MLOrderNo.Text) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOCmd.RecordCount > 1 then
|
|||
|
|
begin
|
|||
|
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
|
FMainId:='';
|
|||
|
|
application.MessageBox('ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>,<2C><><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>', '<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if Trim(Order_Sub.fieldbyname('NewSubid').AsString) = '' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOTemp, maxno, 'MS', 'ML_OrderSubidNew', 4, 1) = False then
|
|||
|
|
begin
|
|||
|
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
maxno := Trim(Order_Sub.fieldbyname('NewSubid').AsString);
|
|||
|
|
end;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from ML_OrderSubidNew where NewMLID=''' + Trim(FMainId) + '''');
|
|||
|
|
sql.Add(' and NewSubid=''' + Trim(maxno) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(Order_Sub.fieldbyname('NewSubid').AsString) = '' then
|
|||
|
|
Append
|
|||
|
|
else
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('NewMLID').Value := Trim(FMainId);
|
|||
|
|
FieldByName('NewSubid').Value := Trim(maxno);
|
|||
|
|
RTSetSaveDataCDS(ADOCmd, Tv1, Order_Sub, 'ML_OrderSubidNew', 0);
|
|||
|
|
FieldByName('ConSubId').Value := Trim(Order_Sub.FieldByName('ConSubId').AsString);
|
|||
|
|
fieldbyname('Qty').Value := Order_Sub.FieldByName('Qty').AsFloat;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
Order_Sub.Edit;
|
|||
|
|
Order_Sub.FieldByName('NewSubid').Value := Trim(maxno);
|
|||
|
|
Order_Sub.FieldByName('NewMLID').Value := Trim(FMainId);
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
///<2F><><EFBFBD><EFBFBD><EFBFBD>㼶<EFBFBD><E3BCB6>
|
|||
|
|
with ClientDataSet2 do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if Trim(ClientDataSet2.fieldbyname('ZHID').AsString) = '' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOCmd, maxno, 'ZH', 'ML_OrderZuHe', 4, 1) = False then
|
|||
|
|
begin
|
|||
|
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
maxno := Trim(ClientDataSet2.fieldbyname('ZHID').AsString);
|
|||
|
|
end;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from ML_OrderZuHe where ZHID=''' + Trim(maxno) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(ClientDataSet2.fieldbyname('ZHID').AsString) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('Filler').Value :=Trim(DName);
|
|||
|
|
end
|
|||
|
|
else begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('Editer').Value := Trim(DName);
|
|||
|
|
FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
FieldByName('NewMLID').Value := Trim(FMainId);
|
|||
|
|
FieldByName('ZHID').Value := Trim(maxno);
|
|||
|
|
FieldByName('ZHDate').Value :=OrdDate.Date;
|
|||
|
|
RTSetSaveDataCDS(ADOCmd, Tv2, ClientDataSet2, 'ML_OrderZuHe', 0);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
ClientDataSet2.Edit;
|
|||
|
|
ClientDataSet2.FieldByName('ZHID').Value := Trim(maxno);
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('update ML_ConSub set ISPD=( case when (select COUNT(1) from ML_OrderSubidNew X where X.ConSubId=CSID)>0 then 1 else 0 end)');
|
|||
|
|
sql.Add('where exists(select X.MLConID from ML_ConMain X where X.MLConID=ML_ConSub.MLConID and X.ConNO=' + quotedstr(MLConNo.Text) + ') ');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update ML_OrderMainNew Set MianCKQtyMPlan=(select sum(Qty) from ML_OrderSubidNew A where A.NewMLID=ML_OrderMainNew.NewMLID) ');
|
|||
|
|
sql.Add(' where NewMLID='''+Trim(FMainId)+'''');
|
|||
|
|
sql.Add(' and isnull(MianName,'''')<>'''' ');
|
|||
|
|
|
|||
|
|
sql.Add('Update ML_OrderZuHe Set MLJHQty=(select sum(Qty) from ML_OrderSubidNew A where A.NewMLID=ML_OrderZuHe.NewMLID) ');
|
|||
|
|
sql.Add(' where NewMLID='''+Trim(FMainId)+'''');
|
|||
|
|
sql.Add(' and isnull(MLName,'''')<>'''' ');
|
|||
|
|
|
|||
|
|
sql.Add('Update ML_OrderMainNew Set WFBCKQtyMPlan=(select sum(Qty) from ML_OrderSubidNew A where A.NewMLID=ML_OrderMainNew.NewMLID) ');
|
|||
|
|
sql.Add(' where NewMLID='''+Trim(FMainId)+'''');
|
|||
|
|
sql.Add(' and isnull(WFBName,'''')<>'''' ');
|
|||
|
|
|
|||
|
|
sql.Add('Update ML_OrderMainNew Set MianCKQtyM=(select sum(JYLen) from JTJY_New A where A.NewMLID=ML_OrderMainNew.NewMLID and JYType=''<27><>Ʒ'') ');
|
|||
|
|
sql.Add(' where NewMLID='''+Trim(FMainId)+'''');
|
|||
|
|
sql.Add(' and isnull(MianName,'''')<>'''' ');
|
|||
|
|
|
|||
|
|
sql.Add('Update ML_OrderMainNew Set WFBCKQtyM=(select sum(JYLen) from JTJY_New A where A.NewMLID=ML_OrderMainNew.NewMLID and JYType=''<27><>Ʒ'') ');
|
|||
|
|
sql.Add(' where NewMLID='''+Trim(FMainId)+'''');
|
|||
|
|
sql.Add(' and isnull(WFBName,'''')<>'''' ');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
ADOCmd.Connection.CommitTrans;
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
Result := False;
|
|||
|
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.TBSaveClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
OrdDate.SetFocus;
|
|||
|
|
if MLOrderNo.Text = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ָʾ<D6B8><CABE><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(BZType.Text)='' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Order_Sub.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if ClientDataSet2.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>㼶<EFBFBD><E3BCB6><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if SaveData() then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
ModalResult := 1;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.v1PRTColorPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'OrdColor';
|
|||
|
|
flagname := '<27><>ɫ';
|
|||
|
|
V1Name.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
V1Note.Caption := 'Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
fnote := True;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.Order_Sub.Edit;
|
|||
|
|
Self.Order_Sub.FieldByName('MLColor').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
Self.Order_Sub.FieldByName('MLColorNo').Value := Trim(ClientDataSet1.fieldbyname('Note').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.ToolButton1Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
FName,mvalue,FCaption:string;
|
|||
|
|
begin
|
|||
|
|
ToolBar2.SetFocus;
|
|||
|
|
FName:=Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
|
FCaption:=Tv1.Controller.FocusedColumn.Caption;
|
|||
|
|
mvalue:=Trim(Order_Sub.fieldbyname(FName).AsString);
|
|||
|
|
if Trim(FCaption)='<27><>ɫ' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>滻<EFBFBD><E6BBBB>','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(FCaption)='COLOR' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('COLOR<4F><52><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>滻<EFBFBD><E6BBBB>','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Application.MessageBox(PChar('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><'+Trim(FCaption)+'> <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'+Trim(mvalue)+' <20><><EFBFBD><EFBFBD>'),'<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FName).Value:=Trim(mvalue);
|
|||
|
|
Post;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.KHNameBtnUpClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmKHList_CX := TfrmKHList_CX.Create(Application);
|
|||
|
|
with frmKHList_CX do
|
|||
|
|
begin
|
|||
|
|
if self.canshu1 <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
canshu1 := 'ҵ<><D2B5>Ա';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
KHName.Text := Trim(CDS_HZ.fieldbyname('KHName').AsString);
|
|||
|
|
KHName.TxtCode := Trim(CDS_HZ.fieldbyname('KHNo').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmKHList_CX.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.KHNameBtnDnClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBtnEditC(Sender).Text := '';
|
|||
|
|
TBtnEditC(Sender).TxtCode := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
var
|
|||
|
|
mvalues: string;
|
|||
|
|
begin
|
|||
|
|
mvalues := tv1.Columns[tv1.Controller.FocusedColumn.index].DataBinding.FieldName;
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'NewOrderUnit';
|
|||
|
|
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.Order_Sub.Edit;
|
|||
|
|
Self.Order_Sub.FieldByName(mvalues).Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.v1PriceUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'PriceUnit';
|
|||
|
|
flagname := '<27>۸<EFBFBD><DBB8><EFBFBD>λ';
|
|||
|
|
if Trim(DParameters1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
TBAdd.Visible := False;
|
|||
|
|
TBEdit.Visible := False;
|
|||
|
|
TBDel.Visible := False;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.Order_Sub.Edit;
|
|||
|
|
Self.Order_Sub.FieldByName('PriceUnit').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.OrdDefStr2BtnUpClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj: string;
|
|||
|
|
FWZ: Integer;
|
|||
|
|
begin
|
|||
|
|
fsj := Trim(TEdit(Sender).Hint);
|
|||
|
|
FWZ := Pos('/', fsj);
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.ConNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
var
|
|||
|
|
ConMainId: string;
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
with ADOTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from JYOrderCon_Main where ConNo like ''' + '%' + Trim(MLConNo.Text) + '%' + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOTemp.RecordCount > 1 then
|
|||
|
|
begin
|
|||
|
|
with ADOTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select Top 1* from JYOrderCon_Main where ConNo=''' + Trim(MLConNo.Text) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOTemp.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
end
|
|||
|
|
else if ADOTemp.RecordCount = 1 then
|
|||
|
|
begin
|
|||
|
|
with ADOTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from JYOrderCon_Main where ConNo like ''' + '%' + Trim(MLConNo.Text) + '%' + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
begin
|
|||
|
|
MLConNo.Text := Trim(ADOTemp.fieldbyname('ConNo').AsString);
|
|||
|
|
with ADOTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select A.*,ColorName=(select ZdyName from KH_Zdy B where B.Note=A.PRTColor and B.Type=''OrdColor'' ) ');
|
|||
|
|
SQL.Add(' from JYOrderCon_Sub A where MainId=''' + Trim(ConMainId) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOTemp do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('PRTColor').Value := Trim(ADOTemp.fieldbyname('PRTColor').AsString);
|
|||
|
|
FieldByName('SOrdDefStr4').Value := Trim(ADOTemp.fieldbyname('SOrdDefStr4').AsString);
|
|||
|
|
FieldByName('SOrdDefStr3').Value := Trim(ADOTemp.fieldbyname('SOrdDefStr3').AsString);
|
|||
|
|
FieldByName('PRTOrderQty').Value := Trim(ADOTemp.fieldbyname('PRTOrderQty').AsString);
|
|||
|
|
FieldByName('OrderUnit').Value := Trim(ADOTemp.fieldbyname('OrderUnit').AsString);
|
|||
|
|
FieldByName('PRTPrice').Value := Trim(ADOTemp.fieldbyname('PRTPrice').AsString);
|
|||
|
|
FieldByName('PriceUnit').Value := Trim(ADOTemp.fieldbyname('PriceUnit').AsString);
|
|||
|
|
FieldByName('PRTHX').Value := Trim(ADOTemp.fieldbyname('PRTHX').AsString);
|
|||
|
|
FieldByName('XHNO').Value := Trim(ADOTemp.fieldbyname('XHNO').AsString);
|
|||
|
|
FieldByName('Sorddefstr10').Value := Trim(ADOTemp.fieldbyname('Subid').AsString);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.YCLFactoryBtnUpClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj: string;
|
|||
|
|
FWZ: Integer;
|
|||
|
|
begin
|
|||
|
|
fsj := Trim(TEdit(Sender).Hint);
|
|||
|
|
FWZ := Pos('/', fsj);
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
|
//MainType:=TEdit(Sender).Name;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.MPRTSCTeBieNoteBtnUpClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj: string;
|
|||
|
|
FWZ: Integer;
|
|||
|
|
begin
|
|||
|
|
fsj := Trim(TEdit(Sender).Hint);
|
|||
|
|
FWZ := Pos('/', fsj);
|
|||
|
|
try
|
|||
|
|
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
|
|||
|
|
with frmZDYHelpSel do
|
|||
|
|
begin
|
|||
|
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
TEdit(Sender).Text := ReturnStr;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelpSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.V2GXNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'GXName';
|
|||
|
|
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
if Trim(DParameters1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
TBAdd.Visible := False;
|
|||
|
|
TBEdit.Visible := False;
|
|||
|
|
TBDel.Visible := False;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.CDS_JGMX.Edit;
|
|||
|
|
Self.CDS_JGMX.FieldByName('GXName').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.YWYBtnUpClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'YWY';
|
|||
|
|
flagname := 'ҵ<><D2B5>Ա';
|
|||
|
|
if Trim(canshu1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
TBAdd.Visible := False;
|
|||
|
|
TBEdit.Visible := False;
|
|||
|
|
TBDel.Visible := False;
|
|||
|
|
end;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
YWY.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.GYNoteDblClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj: string;
|
|||
|
|
FWZ: Integer;
|
|||
|
|
i: integer;
|
|||
|
|
begin
|
|||
|
|
fsj := Trim(TMemo(Sender).Hint);
|
|||
|
|
FWZ := Pos('/', fsj);
|
|||
|
|
i := 0;
|
|||
|
|
try
|
|||
|
|
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
|
|||
|
|
with frmZDYHelpSel do
|
|||
|
|
begin
|
|||
|
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
GYNote.Lines.Clear;
|
|||
|
|
with ClientDataSet1 do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if FieldByName('SSel').AsBoolean = True then
|
|||
|
|
begin
|
|||
|
|
i := i + 1;
|
|||
|
|
GYNote.Lines.Add(inttostr(i) + '.' + FieldByName('ZDYName').AsString)
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelpSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.N1Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
i: Integer;
|
|||
|
|
begin
|
|||
|
|
i := Order_Sub.RecordCount;
|
|||
|
|
CopyAddRow(Tv1, Order_Sub);
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('XHNO').Value := IntToStr(i + 1);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Sub.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if Trim(Order_Sub.fieldbyname('NewSubid').AsString) <> '' then
|
|||
|
|
begin
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete ML_OrderSubidNew where NewSubid=''' + Trim(Order_Sub.fieldbyname('NewSubid').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Sub.Delete;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.Tv3Column1PropertiesButtonClick(
|
|||
|
|
Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
Panel4.Visible:=True;
|
|||
|
|
Panel4.Refresh;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.Image2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Panel4.Visible:=False;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.Button3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmMLMangeRSSel:=TfrmMLMangeRSSel.Create(Application);
|
|||
|
|
with frmMLMangeRSSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with Self.ClientDataSet3 do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('MLName').Value:=Trim(frmMLMangeRSSel.CDS_Main.fieldbyname('MLName').AsString);
|
|||
|
|
FieldByName('MLGY').Value:=Trim(frmMLMangeRSSel.CDS_Main.fieldbyname('GYLXName').AsString);
|
|||
|
|
FieldByName('MLCode').Value:=Trim(frmMLMangeRSSel.CDS_Main.fieldbyname('MLName').AsString);
|
|||
|
|
FieldByName('MLType').Value:='Ⱦɫ';
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmMLMangeRSSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.v1MLHXPropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZdyAttachCP_HX_Sel:=TfrmZdyAttachCP_HX_Sel.Create(Application);
|
|||
|
|
with frmZdyAttachCP_HX_Sel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('MLHX').Value:=Trim(frmZdyAttachCP_HX_Sel.CDS_HZ.fieldbyname('zdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZdyAttachCP_HX_Sel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.N3Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
FName,mvalue,FCaption:string;
|
|||
|
|
begin
|
|||
|
|
FName:=Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
|
FCaption:=Tv1.Controller.FocusedColumn.Caption;
|
|||
|
|
mvalue:=Trim(Order_Sub.fieldbyname(FName).AsString);
|
|||
|
|
if Application.MessageBox(PChar('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><'+Trim(FCaption)+'> <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>'+Trim(mvalue)+' <20><><EFBFBD><EFBFBD>'),'<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FName).Value:=Trim(mvalue);
|
|||
|
|
Post;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.v1Column7PropertiesButtonClick(
|
|||
|
|
Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag:='FeeName';
|
|||
|
|
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('FeeName').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.Tv2Column1PropertiesButtonClick(
|
|||
|
|
Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
if Trim(ClientDataSet2.fieldbyname('MLType').AsString)='' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(ClientDataSet2.fieldbyname('MLType').AsString)='<27><>' then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmBPZDY_LRM:=TfrmBPZDY_LRM.Create(Application);
|
|||
|
|
with frmBPZDY_LRM do
|
|||
|
|
begin
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with Self.ClientDataSet2 do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
Self.ClientDataSet2.FieldByName('MLCode').Value:=Trim(frmBPZDY_LRM.ClientDataSet1.fieldbyname('BPCode').AsString);
|
|||
|
|
Self.ClientDataSet2.FieldByName('MLName').Value:=Trim(frmBPZDY_LRM.ClientDataSet1.fieldbyname('BPName').AsString);
|
|||
|
|
Self.ClientDataSet2.FieldByName('MLMF').Value:=Trim(frmBPZDY_LRM.ClientDataSet1.fieldbyname('BPMF').AsString);
|
|||
|
|
Self.ClientDataSet2.FieldByName('MLKZ').Value:=Trim(frmBPZDY_LRM.ClientDataSet1.fieldbyname('BPKZ').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmBPZDY_LRM.Free;
|
|||
|
|
end;
|
|||
|
|
end else
|
|||
|
|
if Trim(ClientDataSet2.fieldbyname('MLType').AsString)='<27>IJ<DEB7>' then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmBPZDY_LRM:=TfrmBPZDY_LRM.Create(Application);
|
|||
|
|
with frmBPZDY_LRM do
|
|||
|
|
begin
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with Self.ClientDataSet2 do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
Self.ClientDataSet2.FieldByName('MLCode').Value:=Trim(frmBPZDY_LRM.ClientDataSet1.fieldbyname('BPCode').AsString);
|
|||
|
|
Self.ClientDataSet2.FieldByName('MLName').Value:=Trim(frmBPZDY_LRM.ClientDataSet1.fieldbyname('BPName').AsString);
|
|||
|
|
Self.ClientDataSet2.FieldByName('MLMF').Value:=Trim(frmBPZDY_LRM.ClientDataSet1.fieldbyname('BPMF').AsString);
|
|||
|
|
Self.ClientDataSet2.FieldByName('MLKZ').Value:=Trim(frmBPZDY_LRM.ClientDataSet1.fieldbyname('BPKZ').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmBPZDY_LRM.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.Tv2MouseDown(Sender: TObject;
|
|||
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
begin
|
|||
|
|
if Trim(ClientDataSet2.fieldbyname('SSGS').AsString)='' then
|
|||
|
|
begin
|
|||
|
|
V2MLCode.Options.Focusing:=false; V2MLName.Options.Focusing:=false;V2MF.Options.Focusing:=false;
|
|||
|
|
V2KZ.Options.Focusing:=false; V2Note.Options.Focusing:=false;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
V2MLCode.Options.Focusing:=True; V2MLName.Options.Focusing:=True;V2MF.Options.Focusing:=True;
|
|||
|
|
V2KZ.Options.Focusing:=True; V2Note.Options.Focusing:=True;
|
|||
|
|
end;
|
|||
|
|
if (Trim(ClientDataSet2.fieldbyname('MLType').AsString)='<27><>')
|
|||
|
|
or (Trim(ClientDataSet2.fieldbyname('MLType').AsString)='<27>IJ<DEB7>') then
|
|||
|
|
begin
|
|||
|
|
if Trim(ClientDataSet2.fieldbyname('SSGS').AsString)='<27>Լ<EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
V2MLCode.Properties.ReadOnly:=True;
|
|||
|
|
V2MLName.Options.Focusing:=False;V2MF.Options.Focusing:=False;
|
|||
|
|
V2KZ.Options.Focusing:=False;
|
|||
|
|
end else
|
|||
|
|
if Trim(ClientDataSet2.fieldbyname('SSGS').AsString)='<27>ͻ<EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
V2MLCode.Properties.ReadOnly:=False;
|
|||
|
|
V2MLName.Options.Focusing:=True;V2MF.Options.Focusing:=True;
|
|||
|
|
V2KZ.Options.Focusing:=True;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
V2MLCode.Properties.ReadOnly:=True;
|
|||
|
|
end;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
V2MLCode.Properties.ReadOnly:=False;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.MenuItem1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Panel3.Visible:=True;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.Button1Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
i,j: Integer;
|
|||
|
|
begin
|
|||
|
|
i := ClientDataSet2.RecordCount;
|
|||
|
|
with ClientDataSet2 do
|
|||
|
|
begin
|
|||
|
|
for j:=1 to StrToInt(ComboBox1.Text) do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('XHNO').Value := IntToStr(i + j);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Panel3.Visible:=False;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderInPut_New220327.MenuItem2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ClientDataSet2.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if Trim(ClientDataSet2.fieldbyname('ZHID').AsString) <> '' then
|
|||
|
|
begin
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete ML_OrderZuHe where ZHID=''' + Trim(ClientDataSet2.fieldbyname('ZHID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
ClientDataSet2.Delete;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|