313 lines
8.1 KiB
ObjectPascal
313 lines
8.1 KiB
ObjectPascal
![]() |
unit U_TatOutputList;
|
|||
|
|
|||
|
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, cxCheckBox, Vcl.Menus;
|
|||
|
|
|||
|
type
|
|||
|
TfrmTatOutputList = 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;
|
|||
|
MovePanel2: TMovePanel;
|
|||
|
RMGridReport1: TRMGridReport;
|
|||
|
customerNoName: TEdit;
|
|||
|
Label13: TLabel;
|
|||
|
ywy: TEdit;
|
|||
|
Label17: TLabel;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
Tv1Column12: TcxGridDBColumn;
|
|||
|
lbHx: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
TBdel: TToolButton;
|
|||
|
Tv1Column15: TcxGridDBColumn;
|
|||
|
begtime: TDateTimePicker;
|
|||
|
endTime: TDateTimePicker;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Tv1Column14: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
Tv1Column13: TcxGridDBColumn;
|
|||
|
Tv1Column16: TcxGridDBColumn;
|
|||
|
Label4: TLabel;
|
|||
|
GlideName: TEdit;
|
|||
|
Tv1Column17: TcxGridDBColumn;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
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);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
private
|
|||
|
FLeft, FTop: Integer;
|
|||
|
procedure InitGrid();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
fsyrName, canshu1: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmTatOutputList: TfrmTatOutputList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_OutPutHelp;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmTatOutputList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
frmTatOutputList := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
|
|||
|
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
BegDate.DateTime := EndDate.DateTime - 30;
|
|||
|
fsyrName := trim(DdataBase);
|
|||
|
canshu1 := trim(DParameters1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.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.* ');
|
|||
|
sql.Add(',B.WB_Spec,B.WB_YarnQty,B.WB_YarnName,B.WB_ClothName ');
|
|||
|
sql.Add(',JGSJ=DATEDIFF(MI, A.FillTime, A.EndTime) ');
|
|||
|
sql.Add(' from Tat_Plan_OutPut A left join Tat_WB_Card B on A.Pcid=B.WBCID ');
|
|||
|
sql.add('where A.GOTime>=''' + trim(mbegdate) + ''' ');
|
|||
|
sql.Add('and A.GOTime<''' + trim(menddate) + ''' ');
|
|||
|
sql.Add(Msql);
|
|||
|
sql.Add('order by GOTime,pcid');
|
|||
|
|
|||
|
// showmessage(sql.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, true);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
MovePanel2.Visible := True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
InitGrid();
|
|||
|
MovePanel2.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.ToolButton2Click(Sender: TObject);
|
|||
|
var
|
|||
|
MGOIDS: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
if not CDS_Main.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
while CDS_Main.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
MGOIDS := MGOIDS + Trim(CDS_Main.fieldbyname('GOID').AsString) + ',';
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
try
|
|||
|
frmOutPutHelp := TfrmOutPutHelp.Create(Application);
|
|||
|
with frmOutPutHelp do
|
|||
|
begin
|
|||
|
FGOIDS := MGOIDS;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmOutPutHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
canshu1 := self.fParameters1;
|
|||
|
|
|||
|
initgrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
exit;
|
|||
|
// SelExportData(tv1,ADOQueryMain,self.Caption);
|
|||
|
TcxGridToExcel(self.Caption, cxGrid2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.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 TfrmTatOutputList.pcidChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.PRTColorChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatOutputList.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 Tat_Plan_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 Nap_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.
|
|||
|
|