157 lines
4.2 KiB
ObjectPascal
157 lines
4.2 KiB
ObjectPascal
![]() |
unit U_MachHelp;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
|
|||
|
cxGridTableView, cxGridDBTableView, cxClasses, cxControls,
|
|||
|
cxGridCustomView, cxGrid, ImgList, ComCtrls, ToolWin, ADODB, cxTL,
|
|||
|
cxMaskEdit, cxInplaceContainer, cxDBTL, StdCtrls, ExtCtrls, cxTLData;
|
|||
|
|
|||
|
type
|
|||
|
TfrmMachHelp = class(TForm)
|
|||
|
ToolBar2: TToolBar;
|
|||
|
TOk: TToolButton;
|
|||
|
Tclose: TToolButton;
|
|||
|
pics: TImageList;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
tv2: TcxGridDBTableView;
|
|||
|
tv2deviceNo: TcxGridDBColumn;
|
|||
|
tv2deviceName: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1frameNo: TcxGridDBColumn;
|
|||
|
v1frameName: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
DataSource1: TDataSource;
|
|||
|
ADOQueryDept: TADOQuery;
|
|||
|
DataSource2: TDataSource;
|
|||
|
ADOQueryHelp: TADOQuery;
|
|||
|
ADOConnection1: TADOConnection;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
cxStyle_gridRow: TcxStyle;
|
|||
|
cxStyle_gridFoot: TcxStyle;
|
|||
|
cxStyle_gridHead: TcxStyle;
|
|||
|
cxStyle_gridGroupBox: TcxStyle;
|
|||
|
cxStyle_yellow: TcxStyle;
|
|||
|
cxStyle_Red: TcxStyle;
|
|||
|
v1frameTop: TcxGridDBColumn;
|
|||
|
Splitter1: TSplitter;
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView;
|
|||
|
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
|||
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure TcloseClick(Sender: TObject);
|
|||
|
procedure TOkClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure tv2DblClick(Sender: TObject);
|
|||
|
private
|
|||
|
|
|||
|
procedure IntDeptGrid();
|
|||
|
procedure IntMachGrid();
|
|||
|
public
|
|||
|
fFrameNo:string;
|
|||
|
fMachGroup:string;
|
|||
|
fSelDept:string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmMachHelp: TfrmMachHelp;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_global;
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmMachHelp.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
cxGrid2.Align :=alClient;
|
|||
|
with ADOConnection1 do
|
|||
|
begin
|
|||
|
Connected:=false;
|
|||
|
ConnectionString:=gConString;
|
|||
|
Connected:=true;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
//////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>
|
|||
|
/////////////////////////////////////////////////////////
|
|||
|
procedure TfrmMachHelp.IntDeptGrid();
|
|||
|
begin
|
|||
|
with ADOQueryDept do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add('select distinct B.frameNo,B.frameName,B.frameTop,');
|
|||
|
sql.Add('frameTopName=(select frameName from yc_frame where frameNo=B.frameTop)');
|
|||
|
sql.Add('from dc_machine A');
|
|||
|
sql.Add('inner join yc_frame B on A.dept=B.frameNO');
|
|||
|
if trim(fFrameNo)<>'' then
|
|||
|
sql.Add('where A.dept='''+trim(fFrameNo)+'''');
|
|||
|
if trim(fMachGroup)<>'' then
|
|||
|
sql.Add('where A.MachGroup like ''%'+trim(fMachGroup)+'%''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure TfrmMachHelp.Tv1FocusedRecordChanged(
|
|||
|
Sender: TcxCustomGridTableView; APrevFocusedRecord,
|
|||
|
AFocusedRecord: TcxCustomGridRecord;
|
|||
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
IntMachGrid();
|
|||
|
end;
|
|||
|
//////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>
|
|||
|
/////////////////////////////////////////////////////////
|
|||
|
procedure TfrmMachHelp.IntMachGrid();
|
|||
|
begin
|
|||
|
with ADOQueryHelp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add('select *');
|
|||
|
sql.Add('from dc_machine A');
|
|||
|
sql.Add('where A.dept='''+trim(ADOQueryDept.fieldByName('frameNo').asString)+'''');
|
|||
|
if trim(fMachGroup)<>'' then
|
|||
|
sql.Add('and A.MachGroup like ''%'+trim(fMachGroup)+'%''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure TfrmMachHelp.TcloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMachHelp.TOkClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryHelp.IsEmpty then
|
|||
|
ModalResult:=-1
|
|||
|
else
|
|||
|
begin
|
|||
|
fSelDept:=trim(ADOQueryDept.fieldByName('frameNo').asString);
|
|||
|
ModalResult:=1;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMachHelp.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
if trim(fMachGroup)<>'' then
|
|||
|
self.Caption:='<27><><EFBFBD>顾'+fMachGroup+'<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>̨ѡ<CCA8><D1A1>';
|
|||
|
if trim(fFrameNo)<>'' then
|
|||
|
self.Caption:='<27><><EFBFBD>ű<EFBFBD><C5B1>š<EFBFBD>'+fMachGroup+'<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>̨ѡ<CCA8><D1A1>';
|
|||
|
IntDeptGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMachHelp.tv2DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Tok.Click ;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|