RTFormwork/项目代码/RTBasicsV1/F00染色通用窗体/U_DyeTechnicsSel.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

211 lines
5.7 KiB
ObjectPascal
Raw Blame History

unit U_DyeTechnicsSel;
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, cxPC, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges;
type
TfrmDyeTechnicsSel = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Panel1: TPanel;
ToolButton2: TToolButton;
Label1: TLabel;
GYName: TEdit;
ADOQueryMain: TADOQuery;
RM1: TRMGridReport;
RMDB_Main: TRMDBDataSet;
Label3: TLabel;
GYNO: TEdit;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
cxGridLevel1: TcxGridLevel;
GPM_2: TcxGridPopupMenu;
DS_2: TDataSource;
CDS_2: TClientDataSet;
cxTabControl1: TcxTabControl;
v2GYGX: TcxGridDBColumn;
v2Ssel: TcxGridDBColumn;
v2GYName: TcxGridDBColumn;
v2GYNO: TcxGridDBColumn;
DS_1: TDataSource;
CDS_1: TClientDataSet;
ADOQuery1: TADOQuery;
GPM_1: TcxGridPopupMenu;
TBOK: TToolButton;
cxGrid1: TcxGrid;
TV1: TcxGridDBTableView;
XUHAO: TcxGridDBColumn;
cxGridDBColumn1: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
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 GYNOChange(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TBOKClick(Sender: TObject);
procedure Tv2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
private
{ Private declarations }
procedure InitGrid();
procedure SetStatus();
procedure InitGlide();
public
fflag: integer;
{ Public declarations }
RKFlag, FCYID, fmanage: string;
end;
var
frmDyeTechnicsSel: TfrmDyeTechnicsSel;
implementation
uses
U_DataLink, U_RTFun;
{$R *.dfm}
procedure TfrmDyeTechnicsSel.SetStatus();
begin
end;
procedure TfrmDyeTechnicsSel.InitGlide();
begin
try
ADOQueryTemp.DisableControls;
with ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add(' select A.*,B.* FROM Dye_Technics_Sub A inner join Dye_Process B on A.PSId=B.PSId ');
sql.Add(' Where A.DTMID=''' + trim(CDS_2.fieldbyname('DTMID').AsString) + '''');
SQL.Add(' ORDER BY A.PSNO');
Open;
end;
SCreateCDS(ADOQueryTemp, CDS_1);
SInitCDSData(ADOQueryTemp, CDS_1);
finally
ADOQueryTemp.EnableControls;
end;
end;
procedure TfrmDyeTechnicsSel.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered := False;
Close;
SQL.Clear;
sql.Add(' select * FROM Dye_Technics_Main');
if cxTabControl1.TabIndex < 2 then
sql.Add(' where status=''' + inttostr(cxTabControl1.TabIndex) + ''' ');
Open;
end;
SCreateCDS(ADOQueryMain, CDS_2);
SInitCDSData(ADOQueryMain, CDS_2);
finally
ADOQueryMain.EnableControls;
ToolButton2.Click;
//CDS_1.EmptyDataSet;
end;
end;
procedure TfrmDyeTechnicsSel.FormDestroy(Sender: TObject);
begin
frmDyeTechnicsSel := nil;
end;
procedure TfrmDyeTechnicsSel.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmDyeTechnicsSel.TBCloseClick(Sender: TObject);
begin
WriteCxGrid('<27><><EFBFBD>յǼ<D5B5>', Tv2, '<27><><EFBFBD>չ<EFBFBD><D5B9><EFBFBD>');
Close;
end;
procedure TfrmDyeTechnicsSel.FormShow(Sender: TObject);
begin
fflag := 0;
ReadCxGrid('<27><><EFBFBD>յǼ<D5B5>', Tv2, '<27><><EFBFBD>չ<EFBFBD><D5B9><EFBFBD>');
SetStatus();
InitGrid();
end;
procedure TfrmDyeTechnicsSel.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmDyeTechnicsSel.ToolButton2Click(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS(ADOQueryMain, CDS_2);
SInitCDSData(ADOQueryMain, CDS_2);
end;
end;
procedure TfrmDyeTechnicsSel.GYNOChange(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmDyeTechnicsSel.cxTabControl1Change(Sender: TObject);
begin
SetStatus();
InitGrid();
end;
procedure TfrmDyeTechnicsSel.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
TBOK.Click;
end;
procedure TfrmDyeTechnicsSel.Tv2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
begin
InitGlide();
end;
procedure TfrmDyeTechnicsSel.FormCreate(Sender: TObject);
begin
fmanage := Trim(DParameters1);
end;
procedure TfrmDyeTechnicsSel.TBOKClick(Sender: TObject);
begin
if CDS_2.IsEmpty then
exit;
self.ModalResult := 1;
end;
end.