unit U_TatWBPlanCardSel; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB, cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxCheckBox, BtnEdit, RM_BarCode, cxPC, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseList, Vcl.Menus, U_BaseHelp, System.ImageList, Vcl.ImgList; type TfrmTatWBPlanCardSel = class(TfrmBaseHelp) ToolBar1: TToolBar; TBRafresh: TToolButton; TBClose: TToolButton; Panel1: TPanel; GPM_1: TcxGridPopupMenu; ADOQueryCmd: TADOQuery; ADOQueryMain: TADOQuery; ADOQueryTemp: TADOQuery; Label3: TLabel; ConNo: TEdit; ADOQueryPrint: TADOQuery; ZhuanQty: TEdit; Label9: TLabel; CarNo: TEdit; Label1: TLabel; Label2: TLabel; C_Name: TEdit; DS_1: TDataSource; CDS_1: TClientDataSet; Label4: TLabel; C_Code: TEdit; cxTabControl1: TcxTabControl; ToolButton1: TToolButton; ToolButton2: TToolButton; Label5: TLabel; OrderNo: TEdit; Label6: TLabel; BatchNo: TEdit; PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; Label7: TLabel; PCID: TEdit; cxGrid1: TcxGrid; Tv1: TcxGridDBTableView; cxGridDBColumn1: TcxGridDBColumn; V2Column4: TcxGridDBColumn; V2Column1: TcxGridDBColumn; V2Column3: TcxGridDBColumn; cxGridDBColumn15: TcxGridDBColumn; cxGridDBColumn9: TcxGridDBColumn; cxGridDBColumn10: TcxGridDBColumn; Tv1Column1: TcxGridDBColumn; Tv1Column2: TcxGridDBColumn; Tv1Column3: TcxGridDBColumn; Tv1Column4: TcxGridDBColumn; cxGridLevel1: TcxGridLevel; Tv1Column5: TcxGridDBColumn; Tv1Column6: TcxGridDBColumn; Tv1Column7: TcxGridDBColumn; Tv1Column8: TcxGridDBColumn; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure TBCloseClick(Sender: TObject); procedure TBRafreshClick(Sender: TObject); procedure ConNoChange(Sender: TObject); procedure FormShow(Sender: TObject); procedure cxTabControl1Change(Sender: TObject); procedure ToolButton2Click(Sender: TObject); procedure N1Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure ToolButton1Click(Sender: TObject); private FInt, PFInt: Integer; FFMainID, BPFlag: string; procedure InitGrid(); { Private declarations } public canshu1: string; { Public declarations } end; var frmTatWBPlanCardSel: TfrmTatWBPlanCardSel; implementation uses U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint; {$R *.dfm} procedure TfrmTatWBPlanCardSel.FormClose(Sender: TObject; var Action: TCloseAction); begin inherited; Action := caFree; WriteCxGrid('DCG13', Tv1, '坯布生产2'); end; procedure TfrmTatWBPlanCardSel.TBCloseClick(Sender: TObject); begin Close; end; procedure TfrmTatWBPlanCardSel.InitGrid(); begin FFMainID := ''; try ADOQueryMain.DisableControls; with ADOQueryMain do begin Close; sql.Clear; sql.Add('select A.* '); sql.Add(' from Tat_WB_Card A '); sql.Add(' where isnull(A.status,''0'')<>''-1'''); //PRTCount>0 and case cxTabControl1.TabIndex of 0: begin sql.Add('and not exists(select * from Tat_WB_IO X where X.WBCID=X.WBCID)'); end; 1: begin sql.Add('and exists(select * from Tat_WB_IO X where X.WBCID=X.WBCID)'); end; end; Open; end; SCreateCDS(ADOQueryMain, CDS_1); SInitCDSData(ADOQueryMain, CDS_1); finally ADOQueryMain.EnableControls; end; end; procedure TfrmTatWBPlanCardSel.N1Click(Sender: TObject); begin SelOKNo(cds_1, true) end; procedure TfrmTatWBPlanCardSel.N2Click(Sender: TObject); begin SelOKNo(cds_1, false); end; procedure TfrmTatWBPlanCardSel.TBRafreshClick(Sender: TObject); begin InitGrid(); end; procedure TfrmTatWBPlanCardSel.ToolButton1Click(Sender: TObject); begin ToolBar1.SetFocus; ModalResult := 1; end; procedure TfrmTatWBPlanCardSel.ToolButton2Click(Sender: TObject); begin WriteCxGrid(trim(self.Caption), Tv1, '坯布生产2'); end; procedure TfrmTatWBPlanCardSel.ConNoChange(Sender: TObject); begin if ADOQueryMain.Active = False then Exit; SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); SCreateCDS(ADOQueryMain, CDS_1); SInitCDSData(ADOQueryMain, CDS_1); end; procedure TfrmTatWBPlanCardSel.FormShow(Sender: TObject); begin inherited; ReadCxGrid(trim(self.Caption), Tv1, '坯布生产2'); InitGrid(); end; procedure TfrmTatWBPlanCardSel.cxTabControl1Change(Sender: TObject); begin InitGrid(); end; end.