303 lines
7.8 KiB
ObjectPascal
303 lines
7.8 KiB
ObjectPascal
unit U_TatDCGCLCXList;
|
||
|
||
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, cxContainer, dxScrollbarAnnotations,
|
||
cxProgressBar;
|
||
|
||
type
|
||
TfrmTatDCGCLCXList = class(TfrmBaseList)
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Label3: TLabel;
|
||
C_Name: 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;
|
||
Tv1Column10: TcxGridDBColumn;
|
||
Tv1Column11: TcxGridDBColumn;
|
||
lbHx: TEdit;
|
||
Label7: TLabel;
|
||
begtime: TDateTimePicker;
|
||
endTime: TDateTimePicker;
|
||
Tv1Column14: TcxGridDBColumn;
|
||
Tv1Column7: TcxGridDBColumn;
|
||
GlideName1: TEdit;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Label4: TLabel;
|
||
JBSCPerson: TEdit;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
ToolBar2: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
TBClose: TToolButton;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
Tv1Column6: TcxGridDBColumn;
|
||
Tv1Column8: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBRafresh1Click(Sender: TObject);
|
||
procedure ConNoMChange(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure PRTColorChange(Sender: TObject);
|
||
procedure TBdelClick(Sender: TObject);
|
||
procedure ToolButton11Click(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure C_NameKeyPress(Sender: TObject; var Key: Char);
|
||
procedure JBSCPersonKeyPress(Sender: TObject; var Key: Char);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
private
|
||
FLeft, FTop: Integer;
|
||
procedure InitGrid();
|
||
{ Private declarations }
|
||
public
|
||
fsyrName, canshu1: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmTatDCGCLCXList: TfrmTatDCGCLCXList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmTatDCGCLCXList.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmTatDCGCLCXList := nil;
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.FormCreate(Sender: TObject);
|
||
var
|
||
DayNum: Integer; // <20>洢<EFBFBD><E6B4A2><EFBFBD>ա<EFBFBD><D5A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD>1-31<33><31>
|
||
begin
|
||
EndDate.DateTime := Date;
|
||
// DayNum := DayOfTheMonth(EndDate.DateTime);
|
||
BegDate.DateTime := Date - 1;
|
||
fsyrName := trim(DdataBase);
|
||
canshu1 := trim(DParameters1);
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.InitGrid();
|
||
var
|
||
FFiltration: string;
|
||
begin
|
||
FFiltration := DateToStr(BegDate.DATE) + '*' + DateToStr(EndDate.DATE);
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Tat_Cloth_Inspect_Refresh ');
|
||
sql.Add(' @Filtration=' + quotedstr(Trim(FFiltration)));
|
||
// showmessage(sql.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, CDS_Main);
|
||
SInitCDSData(ADOQueryMain, CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main, true);
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main, False);
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.TBRafresh1Click(Sender: TObject);
|
||
begin
|
||
MovePanel2.Visible := True;
|
||
MovePanel2.Refresh;
|
||
InitGrid();
|
||
MovePanel2.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.ToolButton11Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
// CDS_Main.EnableControls;
|
||
|
||
try
|
||
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
||
with frmLabelPrint do
|
||
begin
|
||
FLMType := 'BSYarnInPrt2';
|
||
FFiltration1 := DateToStr(BegDate.DATE) + '*' + DateToStr(EndDate.DATE) + '*' + JBSCPerson.text;
|
||
// ShowMessage(FFiltration1);
|
||
if ShowModal = 1 then
|
||
begin
|
||
// Self.InitGrid();
|
||
end;
|
||
|
||
end;
|
||
finally
|
||
frmLabelPrint.Free;
|
||
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
ReadCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
canshu1 := self.fParameters1;
|
||
|
||
initgrid();
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
exit;
|
||
// SelExportData(tv1,ADOQueryMain,self.Caption);
|
||
TcxGridToExcel(self.Caption, cxGrid2);
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.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 TfrmTatDCGCLCXList.C_NameKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
inherited;
|
||
// ֻ<>ڰ<EFBFBD><DAB0>س<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ˢ<EFBFBD>£<EFBFBD>Key = #13 <20>ǻس<C7BB><D8B3><EFBFBD> ASCII <20>룩
|
||
if Key = #13 then
|
||
begin
|
||
InitGrid(); // <20>س<EFBFBD>ʱִ<CAB1><D6B4>ˢ<EFBFBD><CBA2>
|
||
Key := #0; // <20><><EFBFBD><EFBFBD>ϵͳĬ<CDB3>ϵĻس<C4BB><D8B3><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧȥ<CAA7><C8A5><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.JBSCPersonKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
inherited;
|
||
// ֻ<>ڰ<EFBFBD><DAB0>س<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ˢ<EFBFBD>£<EFBFBD>Key = #13 <20>ǻس<C7BB><D8B3><EFBFBD> ASCII <20>룩
|
||
if Key = #13 then
|
||
begin
|
||
InitGrid(); // <20>س<EFBFBD>ʱִ<CAB1><D6B4>ˢ<EFBFBD><CBA2>
|
||
Key := #0; // <20><><EFBFBD><EFBFBD>ϵͳĬ<CDB3>ϵĻس<C4BB><D8B3><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧȥ<CAA7><C8A5><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.PRTColorChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmTatDCGCLCXList.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.
|
||
|