unit U_DyeClothInspStaffOutputList; 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, MovePanel, cxButtonEdit, cxCalendar, cxPC, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, U_BaseList, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges; type TfrmDyeClothInspStaffOutputList = class(TfrmBaseList) ToolBar1: TToolBar; TBRafresh: TToolButton; TBFind: TToolButton; TBExport: TToolButton; TBPrint: TToolButton; TBClose: TToolButton; Panel1: TPanel; ADOQueryCmd: TADOQuery; ADOQueryMain: TADOQuery; ADOQueryTemp: TADOQuery; DataSource1: TDataSource; cxGridPopupMenu1: TcxGridPopupMenu; Label1: TLabel; Label2: TLabel; BegDate: TDateTimePicker; EndDate: TDateTimePicker; CDS_Main: TClientDataSet; Label8: TLabel; MPRTKZ: TEdit; Label9: TLabel; MPRTMF: TEdit; Label7: TLabel; CPType: TComboBox; MovePanel2: TMovePanel; Label11: TLabel; Label12: TLabel; YWY: TEdit; OrdPerson1: TEdit; orderNo: TEdit; Label5: TLabel; Label3: TLabel; C_Name: TEdit; Label6: TLabel; C_Color: TEdit; Label13: TLabel; Filler: TEdit; conNo: TEdit; Label4: TLabel; KHCONNO: TEdit; Label15: TLabel; begTime: TDateTimePicker; endTime: TDateTimePicker; PCId: TEdit; Label18: TLabel; cxGrid1: TcxGrid; Tv1: TcxGridDBTableView; v1Column1: TcxGridDBColumn; v1Column13: TcxGridDBColumn; v1Column4: TcxGridDBColumn; v1Column18: TcxGridDBColumn; v1Column8: TcxGridDBColumn; v1Column10: TcxGridDBColumn; v1Column20: TcxGridDBColumn; v1Column6: TcxGridDBColumn; v1Column3: TcxGridDBColumn; v1Column5: TcxGridDBColumn; Tv1Column3: TcxGridDBColumn; cxGrid1Level1: TcxGridLevel; procedure FormDestroy(Sender: TObject); 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 TBFindClick(Sender: TObject); procedure C_NameChange(Sender: TObject); procedure v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure PRTColorChange(Sender: TObject); procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure cxTabControl1Change(Sender: TObject); private FLeft, FTop: Integer; procedure InitGrid(); { Private declarations } public { Public declarations } end; var frmDyeClothInspStaffOutputList: TfrmDyeClothInspStaffOutputList; implementation uses U_DataLink, U_RTFun, U_ZDYHelp; {$R *.dfm} procedure TfrmDyeClothInspStaffOutputList.FormDestroy(Sender: TObject); begin inherited; frmDyeClothInspStaffOutputList := nil; end; procedure TfrmDyeClothInspStaffOutputList.FormClose(Sender: TObject; var Action: TCloseAction); begin inherited; Action := caFree; end; procedure TfrmDyeClothInspStaffOutputList.FormCreate(Sender: TObject); begin inherited; //cxGrid1.Align:=alClient; BegDate.DateTime := SGetServerDateTime(ADOQueryTemp); EndDate.DateTime := SGetServerDateTime(ADOQueryTemp) + 1; end; procedure TfrmDyeClothInspStaffOutputList.InitGrid(); var mBegdate, mEnddate: string; begin mBegdate := FormatDateTime('yyyy-MM-dd', begdate.Date) + ' ' + FormatDateTime('HH:nn', begTime.Time); mEnddate := FormatDateTime('yyyy-MM-dd', enddate.Date) + ' ' + FormatDateTime('HH:nn', endTime.Time); try ADOQueryMain.DisableControls; with ADOQueryMain do begin Close; sql.Clear; Filtered := False; sql.Add(' select OrderNo,C_Name,C_Name,PCId,Filler,C_Width,C_GramWeight,C_ColorNo,C_Color '); sql.Add(', Piece=COUNT(CIID),GrossWeight=SUM(GrossWeight),Meter=SUM(Meter) '); sql.Add('from Dye_Cloth_Inspect '); sql.add('where Filltime>=''' + trim(mBegdate) + ''' '); sql.add('and Filltime<''' + trim(mEnddate) + ''' '); sql.Add('group by OrderNo,C_Name,C_Name,PCId,Filler,C_Width,C_GramWeight,C_ColorNo,C_Color '); Open; end; SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); SCreateCDS(ADOQueryMain, CDS_Main); SInitCDSData(ADOQueryMain, CDS_Main); finally ADOQueryMain.EnableControls; end; end; procedure TfrmDyeClothInspStaffOutputList.TBRafreshClick(Sender: TObject); begin //BegDate.SetFocus; MovePanel2.Visible := True; MovePanel2.Refresh; InitGrid(); MovePanel2.Visible := False; end; procedure TfrmDyeClothInspStaffOutputList.ConNoMChange(Sender: TObject); begin if ADOQueryMain.Active then begin SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); end; end; procedure TfrmDyeClothInspStaffOutputList.TBCloseClick(Sender: TObject); begin WriteCxGrid(self.Caption + tv1.Name, Tv1, '成品仓库'); Close; end; procedure TfrmDyeClothInspStaffOutputList.FormShow(Sender: TObject); begin inherited; ReadCxGrid(self.Caption + tv1.Name, Tv1, '成品仓库'); if Trim(DParameters2) = '管理' then begin //v1Column5.Options.Focusing:=True; end else begin //v1Column5.Options.Focusing:=False; end; //InitGrid(); end; procedure TfrmDyeClothInspStaffOutputList.TBExportClick(Sender: TObject); begin if ADOQueryMain.IsEmpty then exit; TcxGridToExcel(self.Caption, cxGrid1); end; procedure TfrmDyeClothInspStaffOutputList.TBFindClick(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 TfrmDyeClothInspStaffOutputList.C_NameChange(Sender: TObject); begin TBFind.Click; end; procedure TfrmDyeClothInspStaffOutputList.v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := 'SOrdDefStr10'; flagname := '库存存放地点'; if ShowModal = 1 then begin with CDS_Main do begin Edit; FieldByName('SOrdDefStr10').Value := Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; with ADOQueryCmd do begin Close; sql.Clear; sql.Add('Update JYOrder_Sub Set SOrdDefStr10=''' + Trim(ClientDataSet1.fieldbyname('ZdyName').AsString) + ''''); sql.Add(' where SubId=''' + Trim(Self.CDS_Main.fieldbyname('SubId').AsString) + ''''); ExecSQL; end; end; end; finally frmZDYHelp.Free; end; end; procedure TfrmDyeClothInspStaffOutputList.PRTColorChange(Sender: TObject); begin TBFind.Click; end; procedure TfrmDyeClothInspStaffOutputList.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin FLeft := X; FTop := Y; end; procedure TfrmDyeClothInspStaffOutputList.cxTabControl1Change(Sender: TObject); begin TBRafresh.Click; end; end.