D7wmguihua/坯布码单待检(PBMDDJ.dll)/U_YFFKFPList.pas

186 lines
4.8 KiB
ObjectPascal
Raw Normal View History

2025-01-18 16:22:10 +08:00
unit U_YFFKFPList;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
cxButtonEdit, cxTextEdit;
type
TfrmYFFKFPList = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Panel1: TPanel;
ToolButton2: TToolButton;
ADOQueryMain: TADOQuery;
ToolButton1: TToolButton;
RM1: TRMGridReport;
RMDB_Main: TRMDBDataSet;
Label3: TLabel;
FactoryName: TEdit;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
cxGridLevel1: TcxGridLevel;
Label2: TLabel;
Label6: TLabel;
begdate: TDateTimePicker;
Enddate: TDateTimePicker;
cxGridPopupMenu2: TcxGridPopupMenu;
DS_HZ: TDataSource;
CDS_HZ: TClientDataSet;
v2Column5: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
v2Column4: TcxGridDBColumn;
v2Column7: TcxGridDBColumn;
v2Column11: TcxGridDBColumn;
v2Column16: TcxGridDBColumn;
ToolButton3: TToolButton;
v2Column12: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure FactoryNameChange(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
private
{ Private declarations }
procedure InitGrid();
public
{ Public declarations }
RKFlag,FCYID:String;
end;
var
frmYFFKFPList: TfrmYFFKFPList;
implementation
uses
U_DataLink,U_RTFun,U_ZDYHelp, U_ModuleNote;
{$R *.dfm}
procedure TfrmYFFKFPList.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
SQL.Clear;
sql.Add(' exec P_View_YFZhangKuan :begdate,:Enddate');
Parameters.ParamByName('begdate').Value:=Trim(FormatDateTime('yyyy-MM-dd',begdate.DateTime));
Parameters.ParamByName('Enddate').Value:=Trim(FormatDateTime('yyyy-MM-dd',Enddate.DateTime+1));
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_HZ);
SInitCDSData20(ADOQueryMain,CDS_HZ);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmYFFKFPList.FormDestroy(Sender: TObject);
begin
frmYFFKFPList:=nil;
end;
procedure TfrmYFFKFPList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmYFFKFPList.TBCloseClick(Sender: TObject);
begin
WriteCxGrid(<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmYFFKFPList.FormShow(Sender: TObject);
begin
ReadCxGrid(<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
begdate.DateTime:=StrToDate(Trim(FormatDateTime('yyyy-MM',SGetServerDate(ADOQueryTemp)))+'-01');
//InitGrid();
end;
procedure TfrmYFFKFPList.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmYFFKFPList.ToolButton2Click(Sender: TObject);
var
fsj:string;
begin
if ADOQueryMain.Active=False then Exit;
if Trim(SGetFilters(Panel1,1,2))='' then
begin
if Trim(FactoryName.Text)<>'' then
begin
fsj:=' FactoryName like '''+'%'+Trim(FactoryName.Text)+'%'+''''
+' or KHZJM like '''+'%'+Trim(FactoryName.Text)+'%'+'''';
end;
end else
begin
if Trim(FactoryName.Text)<>'' then
begin
fsj:=SGetFilters(Panel1,1,2)+' and (FactoryName like '''+'%'+Trim(FactoryName.Text)+'%'+''''
+' or KHZJM like '''+'%'+Trim(FactoryName.Text)+'%'+''')';
end;
end;
SDofilter(ADOQueryMain,fsj);
SCreateCDS20(ADOQueryMain,CDS_HZ);
SInitCDSData20(ADOQueryMain,CDS_HZ);
end;
procedure TfrmYFFKFPList.FactoryNameChange(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmYFFKFPList.ToolButton1Click(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then Exit;
TcxGridToExcel(<><D3A6><EFBFBD>˿<EFBFBD><CBBF>б<EFBFBD>',cxGrid2);
end;
procedure TfrmYFFKFPList.ToolButton3Click(Sender: TObject);
begin
try
frmModuleNote:=TfrmModuleNote.Create(Application);
with frmModuleNote do
begin
flag:=<><D3A6><EFBFBD>˿<EFBFBD><CBBF>б<EFBFBD>';
if ShowModal=1 then
begin
end;
end;
finally
frmModuleNote.Free;
end;
end;
end.