329 lines
9.1 KiB
ObjectPascal
329 lines
9.1 KiB
ObjectPascal
unit U_OrderSubSelMX;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxButtonEdit, cxDropDownEdit,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, DBClient, cxGridLevel,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
||
cxControls, cxGridCustomView, cxGrid, ComCtrls, ToolWin, cxCheckBox,
|
||
ADODB, StdCtrls, BtnEdit, ExtCtrls, cxCalendar;
|
||
|
||
type
|
||
TfrmOrderSubSelMX = class(TForm)
|
||
ToolBar2: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
ToolButton3: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
Order_Sub: TClientDataSet;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQuery1: TADOQuery;
|
||
Panel1: TPanel;
|
||
Label1: TLabel;
|
||
PFTPPS: TEdit;
|
||
Label2: TLabel;
|
||
PFTPQty: TEdit;
|
||
Label3: TLabel;
|
||
FactoryName: TBtnEditA;
|
||
PFTPUnit: TComboBox;
|
||
cxGrid3: TcxGrid;
|
||
Tv3: TcxGridDBTableView;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
v3Column1: TcxGridDBColumn;
|
||
Tv3Column1: TcxGridDBColumn;
|
||
v3Column2: TcxGridDBColumn;
|
||
v3Column3: TcxGridDBColumn;
|
||
v3Column5: TcxGridDBColumn;
|
||
v3Column6: TcxGridDBColumn;
|
||
v3Column7: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
PFDlyDate: TDateTimePicker;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
ClientDataSet1: TClientDataSet;
|
||
DataSource2: TDataSource;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
Panel2: TPanel;
|
||
Button1: TButton;
|
||
v3Column4: TcxGridDBColumn;
|
||
v3Column8: TcxGridDBColumn;
|
||
PFGenDanPerson: TBtnEditA;
|
||
Panel3: TPanel;
|
||
Label30: TLabel;
|
||
Label29: TLabel;
|
||
Label31: TLabel;
|
||
ClothOneQty: TEdit;
|
||
OneQtyUnit: TComboBox;
|
||
MPRTOneQty: TEdit;
|
||
v1Column3: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure FactoryNameBtnClick(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure Tv3CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure PFGenDanPersonBtnClick(Sender: TObject);
|
||
procedure PFTPPSChange(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
private
|
||
{ Private declarations }
|
||
public
|
||
{ Public declarations }
|
||
FFFMainId:String;
|
||
end;
|
||
|
||
var
|
||
frmOrderSubSelMX: TfrmOrderSubSelMX;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_ZDYHelp,U_RTFun, U_GYSList;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmOrderSubSelMX.FormDestroy(Sender: TObject);
|
||
begin
|
||
//frmOrderSubSel:=nil;
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.FormShow(Sender: TObject);
|
||
begin
|
||
PFDlyDate.Date:=SGetServerDate(ADOQuery1);
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸѡ<CFB8><D1A1>');
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸѡ<CFB8><D1A1>');
|
||
|
||
try
|
||
ADOQuery1.DisableControls;
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main where Mainid='''+Trim(FFFMainId)+'''');
|
||
Open;
|
||
end;
|
||
SCSHDataNew(ADOQuery1,Panel3,2);
|
||
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,APFlag=Cast(0 as bit) from JYOrder_Sub A Where MainId='''+Trim(FFFMainId)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,Order_Sub);
|
||
SInitCDSData20(ADOQuery1,Order_Sub);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.PRTHX,B.PRTColorNo,B.PRTOrdQty,B.OrderUnit from JYOrder_PCS_Sub A ');
|
||
sql.Add(' left join JYOrder_Sub B on A.SubId=B.SubId');
|
||
sql.Add('where 1<>1');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,ClientDataSet1);
|
||
SInitCDSData20(ADOQuery1,ClientDataSet1);
|
||
finally
|
||
ADOQuery1.EnableControls;
|
||
end;
|
||
PFTPUnit.ItemIndex:=OneQtyUnit.ItemIndex;
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸѡ<CFB8><D1A1>');
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸѡ<CFB8><D1A1>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
{if Order_Sub.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
ModalResult:=1;
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Sub,True);
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Sub,False);
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.FactoryNameBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmGYSList:=TfrmGYSList.Create(Application);
|
||
with frmGYSList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
FactoryName.TxtCode:=Trim(frmGYSList.Order_Main.fieldbyname('ZKID').AsString) ;
|
||
FactoryName.Text:=Trim(frmGYSList.Order_Main.fieldbyname('KHNameJC').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.Button1Click(Sender: TObject);
|
||
var
|
||
FReal:Double;
|
||
begin
|
||
if Order_Sub.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(FactoryName.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><>Ӧ<EFBFBD>̲<EFBFBD><CCB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(PFGenDanPerson.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(PFTPPS.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end else
|
||
if TryStrToFloat(PFTPPS.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(PFTPQty.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end else
|
||
if TryStrToFloat(PFTPQty.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
Order_Sub.DisableControls;
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Order_Sub.FieldByName('SSel').AsBoolean=true then
|
||
begin
|
||
|
||
with ClientDataSet1 do
|
||
begin
|
||
Append;
|
||
FieldByName('SubId').Value:=Order_Sub.fieldbyname('SubId').Value;
|
||
FieldByName('PRTHX').Value:=Order_Sub.fieldbyname('PRTHX').Value;
|
||
FieldByName('PRTColorNo').Value:=Order_Sub.fieldbyname('PRTColorNo').Value;
|
||
FieldByName('FactoryName').Value:=Trim(FactoryName.Text);
|
||
FieldByName('FactoryNo').Value:=Trim(FactoryName.TxtCode);
|
||
FieldByName('PFGenDanPerson').Value:=Trim(PFGenDanPerson.Text);
|
||
FieldByName('PFDlyDate').Value:=PFDlyDate.Date;
|
||
FieldByName('PFTPPS').Value:=Trim(PFTPPS.Text);
|
||
FieldByName('PFTPQty').Value:=Trim(PFTPQty.Text);
|
||
FieldByName('PFTPUnit').Value:=Trim(PFTPUnit.Text);
|
||
FieldByName('PRTOrdQty').Value:=Order_Sub.fieldbyname('PRTOrdQty').Value;
|
||
FieldByName('OrderUnit').Value:=Order_Sub.fieldbyname('OrderUnit').Value;
|
||
Post;
|
||
end;
|
||
Edit;
|
||
FieldByName('APFlag').Value:=True;
|
||
FieldByName('SSel').Value:=False;
|
||
Post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
Order_Sub.EnableControls;
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.Tv3CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
if ClientDataSet1.IsEmpty then Exit;
|
||
ClientDataSet1.Delete;
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.PFGenDanPersonBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='PFGenDanPerson';
|
||
flagname:='<27><><EFBFBD><EFBFBD>Ա';
|
||
fnote:=True;
|
||
V1Note.Caption:='<27>绰';
|
||
if ShowModal=1 then
|
||
begin
|
||
PFGenDanPerson.Text:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.PFTPPSChange(Sender: TObject);
|
||
var
|
||
FReal:Double;
|
||
begin
|
||
if Trim(PFTPPS.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(Trim(PFTPPS.Text),FReal)=False then Exit;
|
||
if Trim(ClothOneQty.Text)<>'' then
|
||
begin
|
||
PFTPQty.Text:=FloatToStr(StrToFloat(PFTPPS.Text)*StrToFloat(ClothOneQty.Text));
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderSubSelMX.Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
ModalResult:=1;
|
||
end;
|
||
|
||
end.
|