unit U_WarpBeamInfoSel; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView, cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls, ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient, cxDropDownEdit, cxCheckBox, RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, Menus, cxCalendar, cxButtonEdit, cxTextEdit, cxPC, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, U_BaseHelp, U_BaseList, System.ImageList, Vcl.ImgList; type TfrmWarpBeamInfoSel = class(TfrmBaseHelp) ToolBar1: TToolBar; TBRafresh: TToolButton; TBFind: TToolButton; TBExport: TToolButton; TBClose: TToolButton; Panel1: TPanel; ADOQueryCmd: TADOQuery; ADOQueryMain: TADOQuery; ADOQueryTemp: TADOQuery; DataSource1: TDataSource; cxGridPopupMenu1: TcxGridPopupMenu; CDS_Main: TClientDataSet; RM1: TRMGridReport; RMDBMain: TRMDBDataSet; RMXLSExport1: TRMXLSExport; RMDBHZ: TRMDBDataSet; CDS_HZ: TClientDataSet; CDS_PRT: TClientDataSet; PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; cxGrid2: TcxGrid; Tv1: TcxGridDBTableView; cxGrid2Level1: TcxGridLevel; v1Column1: TcxGridDBColumn; Label4: TLabel; WBNo: TEdit; ToolButton1: TToolButton; ToolButton2: TToolButton; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormCreate(Sender: TObject); procedure TBRafreshClick(Sender: TObject); procedure ConNoMChange(Sender: TObject); procedure TBCloseClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure TBExportClick(Sender: TObject); procedure N1Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure ToolButton1Click(Sender: TObject); procedure WBNoChange(Sender: TObject); procedure ToolButton2Click(Sender: TObject); procedure Tv1DblClick(Sender: TObject); private canshu1, FSTKName, canshu3: string; procedure InitGrid(); { Private declarations } public { Public declarations } end; var frmWarpBeamInfoSel: TfrmWarpBeamInfoSel; implementation uses U_DataLink, U_RTFun; {$R *.dfm} procedure TfrmWarpBeamInfoSel.FormClose(Sender: TObject; var Action: TCloseAction); begin inherited; Action := caFree; end; procedure TfrmWarpBeamInfoSel.FormCreate(Sender: TObject); begin inherited; canshu1 := Trim(DParameters1); FSTKName := Trim(DParameters2); canshu3 := Trim(DParameters3); end; procedure TfrmWarpBeamInfoSel.InitGrid(); begin try ADOQueryMain.DisableControls; with ADOQueryMain do begin Filtered := False; Close; sql.Clear; sql.Add(' select A.* '); sql.Add(' from Tat_WB_Stk A'); Open; end; SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); SCreateCDS(ADOQueryMain, CDS_Main); SInitCDSData(ADOQueryMain, CDS_Main); finally ADOQueryMain.EnableControls; end; end; procedure TfrmWarpBeamInfoSel.TBRafreshClick(Sender: TObject); begin InitGrid(); end; procedure TfrmWarpBeamInfoSel.ToolButton1Click(Sender: TObject); begin WriteCxGrid(Self.Caption, Tv1, 'ȾɫÅ÷²¼²Ö¿â'); end; procedure TfrmWarpBeamInfoSel.ToolButton2Click(Sender: TObject); begin WBNo.SetFocus; ModalResult := 1; end; procedure TfrmWarpBeamInfoSel.Tv1DblClick(Sender: TObject); begin WBNo.SetFocus; ModalResult := 1; end; procedure TfrmWarpBeamInfoSel.WBNoChange(Sender: TObject); begin if ADOQueryMain.Active then begin SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); SCreateCDS(ADOQueryMain, CDS_Main); SInitCDSData(ADOQueryMain, CDS_Main); end; end; procedure TfrmWarpBeamInfoSel.ConNoMChange(Sender: TObject); begin if ADOQueryMain.Active then begin SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); end; end; procedure TfrmWarpBeamInfoSel.TBCloseClick(Sender: TObject); begin Close; end; procedure TfrmWarpBeamInfoSel.FormShow(Sender: TObject); begin inherited; ReadCxGrid(Self.Caption, Tv1, 'ȾɫÅ÷²¼²Ö¿â'); InitGrid(); end; procedure TfrmWarpBeamInfoSel.TBExportClick(Sender: TObject); begin if ADOQueryMain.IsEmpty then exit; TcxGridToExcel(trim(self.Caption), cxGrid2); end; procedure TfrmWarpBeamInfoSel.N1Click(Sender: TObject); begin SelOKNo(CDS_Main, True); end; procedure TfrmWarpBeamInfoSel.N2Click(Sender: TObject); begin SelOKNo(CDS_Main, False); end; end.