221 lines
6.3 KiB
ObjectPascal
221 lines
6.3 KiB
ObjectPascal
|
unit U_DyeProcessSel;
|
|||
|
|
|||
|
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, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, Menus,
|
|||
|
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu,
|
|||
|
System.ImageList, Vcl.ImgList, U_BaseHelp;
|
|||
|
|
|||
|
type
|
|||
|
TfrmDyeProcessSel = class(TfrmBaseHelp)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
GPM_2: TcxGridPopupMenu;
|
|||
|
DS_HZ: TDataSource;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
Label5: TLabel;
|
|||
|
SYRName: TEdit;
|
|||
|
Label1: TLabel;
|
|||
|
PSName: TEdit;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv2: TcxGridDBTableView;
|
|||
|
v2PSName: TcxGridDBColumn;
|
|||
|
v2PSNote: TcxGridDBColumn;
|
|||
|
v2SYRName: TcxGridDBColumn;
|
|||
|
vLDPrice: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
TSsel: TToolButton;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
TV1: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
cxSplitter1: TcxSplitter;
|
|||
|
DS_1: TDataSource;
|
|||
|
CDS_1: TClientDataSet;
|
|||
|
ADOQuery1: TADOQuery;
|
|||
|
V1PSXH: TcxGridDBColumn;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
ImageList1: TImageList;
|
|||
|
ADOConnection1: TADOConnection;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
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 ZdyNameChange(Sender: TObject);
|
|||
|
procedure TSselClick(Sender: TObject);
|
|||
|
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure TV1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
procedure InitGrid();
|
|||
|
public
|
|||
|
fDEFstr5: string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmDyeProcessSel: TfrmDyeProcessSel;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' select *,PSXH=0 from Dye_Process ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOConnection1 do
|
|||
|
begin
|
|||
|
Connected := false;
|
|||
|
ConnectionString := DConString;
|
|||
|
Connected := true;
|
|||
|
end;
|
|||
|
ADOQueryBaseCmd.Connection := ADOConnection1;
|
|||
|
ADOQueryBaseTemp.Connection := ADOConnection1;
|
|||
|
except
|
|||
|
{if Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>,<2C>Ƿ<EFBFBD>Ҫ<EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD><EFBFBD><EFBFBD>?','<27><>ʾ',32+4)=IDYES then
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOConnection1 do
|
|||
|
begin
|
|||
|
Connected:=false;
|
|||
|
ConnectionString:=DConString;
|
|||
|
//ConnectionString:='23242';
|
|||
|
Connected:=true;
|
|||
|
end;
|
|||
|
except
|
|||
|
end;
|
|||
|
end; }
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmDyeProcessSel := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
ReadCxGrid(trim(self.Caption) + 'TV1', Tv1, '<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
|||
|
ReadCxGrid(trim(self.Caption) + 'TV2', Tv2, '<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
WriteCxGrid(trim(self.Caption) + 'TV1', Tv1, '<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
|||
|
WriteCxGrid(trim(self.Caption) + 'TV2', Tv2, '<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.ZdyNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.TSselClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
exit;
|
|||
|
ModalResult := 1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('PSXH').Value := CDS_1.RecordCount + 1;
|
|||
|
FieldByName('PSName').Value := CDS_HZ.fieldbyname('PSName').AsString;
|
|||
|
FieldByName('PSType').Value := CDS_HZ.fieldbyname('PSType').AsString;
|
|||
|
FieldByName('Workshop').Value := CDS_HZ.fieldbyname('Workshop').AsString;
|
|||
|
FieldByName('Note').Value := CDS_HZ.fieldbyname('Note').AsString;
|
|||
|
FieldByName('PSID').Value := CDS_HZ.fieldbyname('PSID').AsString;
|
|||
|
post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeProcessSel.TV1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
CDS_1.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|