213 lines
5.3 KiB
ObjectPascal
213 lines
5.3 KiB
ObjectPascal
unit U_DyeProcessList;
|
||
|
||
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, Menus, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
||
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu,
|
||
U_BaseList;
|
||
|
||
type
|
||
TfrmDyeProcessList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel1: TPanel;
|
||
ToolButton2: TToolButton;
|
||
ADOQueryMain: TADOQuery;
|
||
ToolButton1: TToolButton;
|
||
DS_1: TDataSource;
|
||
CDS_1: TClientDataSet;
|
||
ToolButton3: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
Label5: TLabel;
|
||
Workshop: TEdit;
|
||
Label1: TLabel;
|
||
PSName: TEdit;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ZdyNameChange(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure Tv2DblClick(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
public
|
||
fDEFstr5: string;
|
||
end;
|
||
|
||
var
|
||
frmDyeProcessList: TfrmDyeProcessList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_DyeProcessInput;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmDyeProcessList.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from Dye_Process ');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, CDS_1);
|
||
SInitCDSData(ADOQueryMain, CDS_1);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
// ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmDyeProcessList := nil;
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(trim(Self.Caption), Tv2, 'Ⱦɫ<C8BE>ƻ<EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
if Trim(CDS_1.fieldbyname('PSID').AsString) <> '' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete Dye_Process where PSID=''' + Trim(CDS_1.fieldbyname('PSID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_1.Delete;
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
ReadCxGrid(trim(Self.Caption), Tv2, 'Ⱦɫ<C8BE>ƻ<EFBFBD>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_1);
|
||
SInitCDSData(ADOQueryMain, CDS_1);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.ZdyNameChange(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
TcxGridToExcel(self.Caption, cxgrid2);
|
||
// SelExportData(Tv2,ADOQueryMain,'<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmDyeProcessInput := TfrmDyeProcessInput.Create(Application);
|
||
with frmDyeProcessInput do
|
||
begin
|
||
FCYID := Trim(Self.CDS_1.fieldbyname('PSID').AsString);
|
||
fDEFstr5 := self.fDEFstr5;
|
||
if ShowModal = 1 then
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
end;
|
||
finally
|
||
frmDyeProcessInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmDyeProcessInput := TfrmDyeProcessInput.Create(Application);
|
||
with frmDyeProcessInput do
|
||
begin
|
||
FCYID := '';
|
||
fDEFstr5 := self.fDEFstr5;
|
||
if ShowModal = 1 then
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
end;
|
||
finally
|
||
frmDyeProcessInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeProcessList.Tv2DblClick(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
ModalResult := 1;
|
||
end;
|
||
|
||
end.
|
||
|