391 lines
10 KiB
ObjectPascal
391 lines
10 KiB
ObjectPascal
![]() |
unit U_GDJinDuMXList; //
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|||
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|||
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses,
|
|||
|
cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
|
|||
|
cxGridDBTableView, cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter,
|
|||
|
RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport,
|
|||
|
cxTextEdit, cxPC, cxCheckBox;
|
|||
|
|
|||
|
type
|
|||
|
TfrmGDJinDuMXList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
TBExport: TToolButton;
|
|||
|
Order_Main: TClientDataSet;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1FactoryNo1Name: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1PRTSpec: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1PRTQty: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column17: TcxGridDBColumn;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
v1Column21: TcxGridDBColumn;
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label6: TLabel;
|
|||
|
Label7: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
GDPerson: TEdit;
|
|||
|
OrderNo: TEdit;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
Label2: TLabel;
|
|||
|
FactoryName: TEdit;
|
|||
|
Label3: TLabel;
|
|||
|
PSName: TEdit;
|
|||
|
Label8: TLabel;
|
|||
|
CRType: TComboBox;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
BPType: TComboBox;
|
|||
|
Label9: TLabel;
|
|||
|
FromFactoryName: TEdit;
|
|||
|
Label10: TLabel;
|
|||
|
ToFactoryName: TEdit;
|
|||
|
Label11: TLabel;
|
|||
|
GYS: TEdit;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure TBDelClick(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure FPNoChange(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
private
|
|||
|
FInt,PFInt:Integer;
|
|||
|
canshu1:string;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitGridWSql(fsj:string);
|
|||
|
procedure InitForm();
|
|||
|
function DelData():Boolean;
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmGDJinDuMXList: TfrmGDJinDuMXList;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_RTFun,U_GDJinDuMXInPut,U_ModuleNote;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmGDJinDuMXList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.FormClose(Sender: TObject;
|
|||
|
var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>б<EFBFBD>',Tv1,'<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
sql.Add(',GYS=isnull(FactoryName,'''')+'' ''+isnull(FromFactoryName,'''')+'' ''+isnull(ToFactoryName,'''') ');
|
|||
|
sql.Add(' ,Case when isnull(CRType,'''')=''<27><>'' then PS else null end as FBPS ');
|
|||
|
sql.Add(' ,Case when isnull(CRType,'''')=''<27><>'' then Qty else null end as FBQty ');
|
|||
|
sql.Add(' ,Case when isnull(CRType,'''')=''<27><>'' then PS else null end as SBPS ');
|
|||
|
sql.Add(' ,Case when isnull(CRType,'''')=''<27><>'' then Qty else null end as SBQty ');
|
|||
|
sql.Add(' from JYOrder_GD_Info A ');
|
|||
|
sql.Add(' where 1=1 ');
|
|||
|
if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
sql.Add(' and A.FillerCode='''+Trim(DCode)+'''');
|
|||
|
end;
|
|||
|
sql.Add(' and A.GDDate>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.DateTime))+'''');
|
|||
|
sql.Add(' and A.GDDate<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.DateTime+1))+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
procedure TfrmGDJinDuMXList.InitGridWSql(fsj:string);
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
sql.Add(' ,Case when isnull(CRType,'''')=''<27><>'' then PS else null end as FBPS ');
|
|||
|
sql.Add(' ,Case when isnull(CRType,'''')=''<27><>'' then Qty else null end as FBQty ');
|
|||
|
sql.Add(' ,Case when isnull(CRType,'''')=''<27><>'' then PS else null end as SBPS ');
|
|||
|
sql.Add(' ,Case when isnull(CRType,'''')=''<27><>'' then Qty else null end as SBQty ');
|
|||
|
sql.Add(' from JYOrder_GD_Info A ');
|
|||
|
sql.Add(' where 1=1 ');
|
|||
|
if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
sql.Add(' and A.FillerCode='''+Trim(DCode)+'''');
|
|||
|
end;
|
|||
|
sql.add(fsj);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.InitForm();
|
|||
|
begin
|
|||
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>б<EFBFBD>',Tv1,'<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
EndDate.DateTime:=SGetServerDate10(ADOQueryTemp);
|
|||
|
BegDate.DateTime:=EndDate.DateTime-30;
|
|||
|
{if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
TBEdit.Visible:=False;
|
|||
|
TBDel.Visible:=False;
|
|||
|
end else
|
|||
|
begin
|
|||
|
TBEdit.Visible:=True;
|
|||
|
TBDel.Visible:=True;
|
|||
|
end; }
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
{with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from GD_JinDu_Main where GMID='''+Trim(Order_Main.fieldbyname('GMId').AsString)+'''');
|
|||
|
sql.Add(' and isnull(GMStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;}
|
|||
|
try
|
|||
|
frmGDJinDuMXInPut:=TfrmGDJinDuMXInPut.Create(Application);
|
|||
|
with frmGDJinDuMXInPut do
|
|||
|
begin
|
|||
|
PState:=1;
|
|||
|
FMainId:=Trim(Self.Order_Main.fieldbyname('GDID').AsString);
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmGDJinDuMXInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.TBDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
{with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from GD_JinDu_Main where GMID='''+Trim(Order_Main.fieldbyname('GMId').AsString)+'''');
|
|||
|
sql.Add(' and isnull(GMStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end; }
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete JYOrder_GD_Info where GDId='''+Trim(Order_Main.fieldbyname('GDId').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Order_Main.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmGDJinDuMXList.DelData():Boolean;
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD>б<EFBFBD>',cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.TBAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmGDJinDuMXInPut:=TfrmGDJinDuMXInPut.Create(Application);
|
|||
|
with frmGDJinDuMXInPut do
|
|||
|
begin
|
|||
|
PState:=0;
|
|||
|
FMainId:='';
|
|||
|
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmGDJinDuMXInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.FPNoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitForm();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then Exit;
|
|||
|
try
|
|||
|
frmGDJinDuMXInPut:=TfrmGDJinDuMXInPut.Create(Application);
|
|||
|
with frmGDJinDuMXInPut do
|
|||
|
begin
|
|||
|
PState:=1;
|
|||
|
FMainId:=Trim(Self.Order_Main.fieldbyname('GDId').AsString);
|
|||
|
TBSave.Visible:=False;
|
|||
|
ToolButton1.Visible:=False;
|
|||
|
ToolButton2.Visible:=False;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmGDJinDuMXInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmModuleNote:=TfrmModuleNote.Create(Application);
|
|||
|
with frmModuleNote do
|
|||
|
begin
|
|||
|
flag:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmModuleNote.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
canshu1:=Trim(DParameters1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.OrderNoKeyPress(Sender: TObject;
|
|||
|
var Key: Char);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if Key=#13 then
|
|||
|
begin
|
|||
|
if Length(Trim(OrderNo.Text))<3 then Exit;
|
|||
|
fsj:=' and A.OrderNo like '''+'%'+Trim(OrderNo.Text)+'%'+'''';
|
|||
|
InitGridWSql(fsj);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGDJinDuMXList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|