D10sxYilanbuyi/A02基础产品管理/U_CraftSel.pas

178 lines
4.1 KiB
ObjectPascal
Raw Normal View History

2025-07-09 16:55:19 +08:00
unit U_CraftSel;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, DB, cxDBData, ToolWin, ComCtrls, U_BaseHelp, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls,
cxGridCustomView, cxGrid, DBClient, ADODB, ImgList, StdCtrls, ExtCtrls,
cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels,
cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters, cxNavigator,
dxDateRanges, dxBarBuiltInMenu, System.ImageList, U_BaseInput,
dxScrollbarAnnotations, cxDropDownEdit, cxCheckBox, cxCheckComboBox,
cxCheckGroup;
type
TfrmCraftSel = class(TfrmBaseHelp)
TV1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
ToolBar1: TToolBar;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
DS_1: TDataSource;
CDS_1: TClientDataSet;
TBSaveFormat: TToolButton;
TBClose: TToolButton;
ToolButton1: TToolButton;
ADOConnection1: TADOConnection;
Panel1: TPanel;
Label1: TLabel;
DTMNo: TEdit;
GPM_1: TcxGridPopupMenu;
ImageList1: TImageList;
TV1Column1: TcxGridDBColumn;
TV1Column2: TcxGridDBColumn;
TV1Column3: TcxGridDBColumn;
ThreeColorBase: TcxStyleRepository;
SHuangSe: TcxStyle;
SkyBlue: TcxStyle;
Default: TcxStyle;
QHuangSe: TcxStyle;
Red: TcxStyle;
FontBlue: TcxStyle;
TextSHuangSe: TcxStyle;
FonePurple: TcxStyle;
FoneClMaroon: TcxStyle;
FoneRed: TcxStyle;
RowColor: TcxStyle;
handBlack: TcxStyle;
cxBlue: TcxStyle;
SHuangSeCu: TcxStyle;
TV1SSel: TcxGridDBColumn;
Label2: TLabel;
DTMName: TEdit;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure TBSaveFormatClick(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure DTMNoChange(Sender: TObject);
private
procedure InitGrid();
{ Private declarations }
public
FCoType, FAuthority, FBCIID: string;
{ Public declarations }
end;
var
frmCraftSel: TfrmCraftSel;
implementation
uses
U_DataLink, U_RTFun;
{$R *.dfm}
procedure TfrmCraftSel.FormCreate(Sender: TObject);
begin
inherited;
try
with ADOConnection1 do
begin
Connected := false;
ConnectionString := DConString;
Connected := true;
end;
ADOQueryBaseCmd.Connection := ADOConnection1;
ADOQueryBaseTemp.Connection := ADOConnection1;
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
end;
end;
procedure TfrmCraftSel.DTMNoChange(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 TfrmCraftSel.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := cahide;
end;
procedure TfrmCraftSel.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.Add('select A.* from Dye_Technics_Main A');
Open;
end;
SCreateCDS(ADOQueryMain, CDS_1);
SInitCDSData(ADOQueryMain, CDS_1);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmCraftSel.FormShow(Sender: TObject);
begin
inherited;
InitGrid();
ReadCxGrid(self.Caption + 'TV1', TV1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣѡ<CFA2><D1A1>');
end;
procedure TfrmCraftSel.TBCloseClick(Sender: TObject);
begin
inherited;
Close;
end;
procedure TfrmCraftSel.TBSaveFormatClick(Sender: TObject);
begin
WriteCxGrid(self.Caption + 'TV1', TV1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣѡ<CFA2><D1A1>');
end;
procedure TfrmCraftSel.ToolButton1Click(Sender: TObject);
begin
if CDS_1.IsEmpty then
Exit;
if CDS_1.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
ModalResult := 1;
end;
procedure TfrmCraftSel.FormDestroy(Sender: TObject);
begin
inherited;
frmCraftSel := nil;
end;
end.