264 lines
6.9 KiB
ObjectPascal
264 lines
6.9 KiB
ObjectPascal
unit U_DyeOutputList;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
|
||
cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
|
||
cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
|
||
ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
|
||
cxDropDownEdit, MovePanel, cxButtonEdit, cxCalendar, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
||
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu,
|
||
U_BaseList;
|
||
|
||
type
|
||
TfrmDyeOutputList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Label3: TLabel;
|
||
pcid: TEdit;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
CDS_Main: TClientDataSet;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid2Level1: TcxGridLevel;
|
||
cxGrid2: TcxGrid;
|
||
v2Column1: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
Label5: TLabel;
|
||
orderNo: TEdit;
|
||
MovePanel2: TMovePanel;
|
||
Label10: TLabel;
|
||
RMGridReport1: TRMGridReport;
|
||
Label16: TLabel;
|
||
v1Column2: TcxGridDBColumn;
|
||
customerNoName: TEdit;
|
||
Label13: TLabel;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
ywy: TEdit;
|
||
Label17: TLabel;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
Tv1Column5: TcxGridDBColumn;
|
||
Tv1Column6: TcxGridDBColumn;
|
||
Tv1Column8: TcxGridDBColumn;
|
||
Tv1Column9: TcxGridDBColumn;
|
||
Tv1Column10: TcxGridDBColumn;
|
||
Tv1Column11: TcxGridDBColumn;
|
||
Tv1Column12: TcxGridDBColumn;
|
||
C_Color: TEdit;
|
||
Label4: TLabel;
|
||
C_ColorNo: TEdit;
|
||
Label6: TLabel;
|
||
lbHx: TEdit;
|
||
Label7: TLabel;
|
||
TBdel: TToolButton;
|
||
GlideName: TComboBox;
|
||
groupName: TEdit;
|
||
Label9: TLabel;
|
||
Tv1Column15: TcxGridDBColumn;
|
||
begtime: TDateTimePicker;
|
||
endTime: TDateTimePicker;
|
||
ToolButton1: TToolButton;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ConNoMChange(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure pcidChange(Sender: TObject);
|
||
procedure PRTColorChange(Sender: TObject);
|
||
procedure TBdelClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
private
|
||
FLeft, FTop: Integer;
|
||
procedure InitGrid();
|
||
{ Private declarations }
|
||
public
|
||
fsyrName, canshu1: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmDyeOutputList: TfrmDyeOutputList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmDyeOutputList.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmDyeOutputList := nil;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
|
||
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
BegDate.DateTime := EndDate.DateTime - 30;
|
||
fsyrName := trim(DdataBase);
|
||
canshu1 := trim(DParameters1);
|
||
SInitComBoxBySql(ADOQueryTemp, GlideName, false, 'select PSName as Name from Dye_Process');
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.InitGrid();
|
||
var
|
||
Msql, mbegdate, menddate: string;
|
||
begin
|
||
Msql := '';
|
||
if SGetFilters(Panel1, 1, 2) <> '' then
|
||
Msql := Msql + ' and ' + SGetFilters(Panel1, 1, 2);
|
||
mbegdate := FormatDateTime('yyyy-MM-dd', begdate.Date) + ' ' + FormatDateTime('HH:nn', begTime.Time);
|
||
menddate := FormatDateTime('yyyy-MM-dd', enddate.Date) + ' ' + FormatDateTime('HH:nn', endTime.Time);
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
Filtered := False;
|
||
sql.Add('select A.*,B.* from Dye_Plan_Glide_OutPut A ');
|
||
sql.Add('inner join Dye_Plan_Card B on A.PCID=B.PCID ');
|
||
sql.add('where A.GOTime>=''' + trim(mbegdate) + ''' ');
|
||
sql.Add('and A.GOTime<''' + trim(menddate) + ''' ');
|
||
sql.Add(Msql);
|
||
// showmessage(sql.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, CDS_Main);
|
||
SInitCDSData(ADOQueryMain, CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
MovePanel2.Visible := True;
|
||
MovePanel2.Refresh;
|
||
InitGrid();
|
||
MovePanel2.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
ReadCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
canshu1 := self.fParameters1;
|
||
|
||
initgrid();
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
exit;
|
||
// SelExportData(tv1,ADOQueryMain,self.Caption);
|
||
TcxGridToExcel(self.Caption, cxGrid2);
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_Main);
|
||
SInitCDSData(ADOQueryMain, CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.pcidChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.PRTColorChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputList.TBdelClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Dye_Plan_Glide_OutPut where GOID=''' + Trim(CDS_Main.fieldbyname('GOID').AsString) + '''');
|
||
|
||
ExecSQL;
|
||
end;
|
||
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('insert into Dye_Need_Up(UType,UDataId) values(''<27><>̨ˢ<CCA8><CBA2>'',' + quotedstr(Trim(CDS_Main.fieldbyname('GOID').AsString)) + ') ');
|
||
execsql;
|
||
end;
|
||
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
||
CDS_Main.Delete;
|
||
except
|
||
application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
end.
|
||
|