179 lines
4.3 KiB
ObjectPascal
179 lines
4.3 KiB
ObjectPascal
|
unit U_ProductInfoSel;
|
|||
|
|
|||
|
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, cxButtonEdit,
|
|||
|
cxDropDownEdit;
|
|||
|
|
|||
|
type
|
|||
|
TfrmProductInfoSel = class(TfrmBaseHelp)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
DS_1: TDataSource;
|
|||
|
CDS_1: TClientDataSet;
|
|||
|
TBSave: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ADOConnection1: TADOConnection;
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
CoName: TEdit;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
ImageList1: TImageList;
|
|||
|
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;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
procedure TV1DblClick(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure CoNameChange(Sender: TObject);
|
|||
|
private
|
|||
|
procedure InitGrid();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
FSTKName: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmProductInfoSel: TfrmProductInfoSel;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmProductInfoSel.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 TfrmProductInfoSel.CoNameChange(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 TfrmProductInfoSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
|
|||
|
CoName.SetFocus;
|
|||
|
|
|||
|
Action := cahide;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmProductInfoSel.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
sql.Add(' from BS_Product_Info A');
|
|||
|
sql.Add(' where isnull(STKNAME,'''')=''' + Trim(FSTKName) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmProductInfoSel.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + Trim(FSTKName), TV1, 'ͨ<>ô<EFBFBD><C3B4><EFBFBD>');
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmProductInfoSel.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmProductInfoSel.TBSaveClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + Trim(FSTKName), TV1, 'ͨ<>ô<EFBFBD><C3B4><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmProductInfoSel.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
CoName.SetFocus;
|
|||
|
ModalResult := 1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmProductInfoSel.TV1DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
ModalResult := 1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmProductInfoSel.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
frmProductInfoSel := nil;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|