unit U_TradePlanScheduleDetail; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGrid, cxCheckBox, cxCalendar, ADODB, DBClient, cxGridCustomPopupMenu, cxGridPopupMenu, Menus, cxTextEdit, cxButtonEdit, ComCtrls, cxContainer, cxMaskEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, cxDropDownEdit, BtnEdit, Vcl.ToolWin, math, dxSkinWXI, dxScrollbarAnnotations; type TfrmTradePlanScheduleDetail = class(TForm) GroupBox1: TGroupBox; CDS_1: TClientDataSet; DS_1: TDataSource; ADOQueryMain: TADOQuery; CDS_2: TClientDataSet; DS_2: TDataSource; CDS_4: TClientDataSet; DS_4: TDataSource; GroupBox3: TGroupBox; GPM_2: TcxGridPopupMenu; GPM_1: TcxGridPopupMenu; GPM_4: TcxGridPopupMenu; GPM_5: TcxGridPopupMenu; CDS_5: TClientDataSet; DS_5: TDataSource; GPM_6: TcxGridPopupMenu; CDS_6: TClientDataSet; DS_6: TDataSource; ADOQueryTemp: TADOQuery; ADOQueryCmd: TADOQuery; DS_3: TDataSource; CDS_3: TClientDataSet; GPM_3: TcxGridPopupMenu; GPM_CKKC: TcxGridPopupMenu; PM_CKKC: TPopupMenu; MenuItem1: TMenuItem; MenuItem2: TMenuItem; ToolBar1: TToolBar; TBRafresh: TToolButton; ToolButton3: TToolButton; TBClose: TToolButton; GroupBox4: TGroupBox; cxGrid3: TcxGrid; TV3: TcxGridDBTableView; cxGridDBColumn1: TcxGridDBColumn; cxGridDBColumn11: TcxGridDBColumn; v1Column4: TcxGridDBColumn; v1Column14: TcxGridDBColumn; cxGridDBColumn12: TcxGridDBColumn; v1Column15: TcxGridDBColumn; v2Column6: TcxGridDBColumn; v1Column3: TcxGridDBColumn; v1Column12: TcxGridDBColumn; cxGrid1Level1: TcxGridLevel; cxGrid5: TcxGrid; TV5: TcxGridDBTableView; cxGridDBColumn13: TcxGridDBColumn; cxGridDBColumn14: TcxGridDBColumn; cxGridDBColumn15: TcxGridDBColumn; cxGridDBColumn16: TcxGridDBColumn; cxGridDBColumn17: TcxGridDBColumn; cxGridDBColumn18: TcxGridDBColumn; cxGridDBColumn19: TcxGridDBColumn; cxGridDBColumn20: TcxGridDBColumn; cxGridDBColumn21: TcxGridDBColumn; cxGridLevel3: TcxGridLevel; cxGrid4: TcxGrid; TV4: TcxGridDBTableView; cxGridDBColumn28: TcxGridDBColumn; cxGridDBColumn29: TcxGridDBColumn; cxGridDBColumn30: TcxGridDBColumn; cxGridDBColumn31: TcxGridDBColumn; cxGridDBColumn32: TcxGridDBColumn; cxGridDBColumn33: TcxGridDBColumn; cxGridDBColumn34: TcxGridDBColumn; cxGridDBColumn35: TcxGridDBColumn; cxGridDBColumn48: TcxGridDBColumn; cxGridLevel4: TcxGridLevel; cxGrid7: TcxGrid; TV7: TcxGridDBTableView; cxGridDBColumn49: TcxGridDBColumn; cxGridDBColumn50: TcxGridDBColumn; cxGridDBColumn51: TcxGridDBColumn; cxGridDBColumn52: TcxGridDBColumn; cxGridDBColumn53: TcxGridDBColumn; cxGridDBColumn54: TcxGridDBColumn; cxGridDBColumn55: TcxGridDBColumn; cxGridDBColumn56: TcxGridDBColumn; cxGridDBColumn57: TcxGridDBColumn; cxGridLevel6: TcxGridLevel; cxGrid1: TcxGrid; TV1: TcxGridDBTableView; cxGridDBColumn3: TcxGridDBColumn; cxGridDBColumn6: TcxGridDBColumn; cxGridDBColumn7: TcxGridDBColumn; cxGridDBColumn8: TcxGridDBColumn; cxGridLevel1: TcxGridLevel; cxGrid8: TcxGrid; TV8: TcxGridDBTableView; cxGridDBColumn58: TcxGridDBColumn; cxGridDBColumn59: TcxGridDBColumn; cxGridDBColumn60: TcxGridDBColumn; cxGridDBColumn62: TcxGridDBColumn; cxGridDBColumn63: TcxGridDBColumn; cxGridDBColumn64: TcxGridDBColumn; cxGridDBColumn65: TcxGridDBColumn; cxGridLevel7: TcxGridLevel; GPM_7: TcxGridPopupMenu; CDS_7: TClientDataSet; DS_7: TDataSource; GPM_8: TcxGridPopupMenu; CDS_8: TClientDataSet; DS_8: TDataSource; TV1Column1: TcxGridDBColumn; TV1Column2: TcxGridDBColumn; TV8Column1: TcxGridDBColumn; TV5Column1: TcxGridDBColumn; TV4Column1: TcxGridDBColumn; TV5Column2: TcxGridDBColumn; TV4Column2: TcxGridDBColumn; TV4Column3: TcxGridDBColumn; pnl1: TPanel; pnl2: TPanel; lbl3: TLabel; lbl4: TLabel; lbl6: TLabel; ConNo: TEdit; OrderNo: TEdit; CustName: TEdit; MasterOrderNo: TEdit; lbl1: TLabel; cxGrid2: TcxGrid; TV2: TcxGridDBTableView; TV1Column8: TcxGridDBColumn; cxGridDBColumn2: TcxGridDBColumn; v1PRTColor: TcxGridDBColumn; TV1Column5: TcxGridDBColumn; TV1Column6: TcxGridDBColumn; v1Column5: TcxGridDBColumn; TV1Column3: TcxGridDBColumn; VC_PRTPs: TcxGridDBColumn; v1PRTOrderQty: TcxGridDBColumn; cxGridDBColumn4: TcxGridDBColumn; TV1Column4: TcxGridDBColumn; cxGridLevel2: TcxGridLevel; TV2Column1: TcxGridDBColumn; C_Name: TEdit; lbl7: TLabel; Edit1: TEdit; lbl2: TLabel; Edit2: TEdit; lbl5: TLabel; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure ToolButton3Click(Sender: TObject); procedure TBCloseClick(Sender: TObject); procedure TBRafreshClick(Sender: TObject); procedure FormResize(Sender: TObject); private procedure InitOrder(); { Private declarations } public FConNo, FConMainId: string; FMainId, FOrderNo, FMasterOrderNo: string; { Public declarations } end; var frmTradePlanScheduleDetail: TfrmTradePlanScheduleDetail; implementation uses U_DataLink, U_RTFun; {$R *.dfm} procedure TfrmTradePlanScheduleDetail.InitOrder(); begin with ADOQueryTemp do begin Close; SQL.Clear; sql.Add('exec P_Trade_Plan_ScheduleDetail '); sql.Add(' @DataFlag=''计划单'' '); sql.Add(',@OrderNo= ' + quotedstr(trim(FOrderNo))); sql.Add(',@MainId= ' + quotedstr(trim(FMainId))); sql.Add(',@MasterOrderNo= ' + quotedstr(trim(FMasterOrderNo))); Open; end; SCSHData(ADOQueryTemp, pnl2, 2); with ADOQueryTemp do begin Close; SQL.Clear; sql.Add('exec P_Trade_Plan_ScheduleDetail '); sql.Add(' @DataFlag=''计划单明细'' '); sql.Add(',@OrderNo= ' + quotedstr(trim(FOrderNo))); sql.Add(',@MainId= ' + quotedstr(trim(FMainId))); sql.Add(',@MasterOrderNo= ' + quotedstr(trim(FMasterOrderNo))); Open; end; SCreateCDS(ADOQueryTemp, CDS_2); SInitCDSData(ADOQueryTemp, CDS_2); with ADOQueryTemp do begin Close; SQL.Clear; sql.Add('exec P_Trade_Plan_ScheduleDetail '); sql.Add(' @DataFlag=''坯布入库'' '); sql.Add(',@OrderNo= ' + quotedstr(trim(FOrderNo))); sql.Add(',@MainId= ' + quotedstr(trim(FMainId))); sql.Add(',@MasterOrderNo= ' + quotedstr(trim(FMasterOrderNo))); Open; end; SCreateCDS(ADOQueryTemp, CDS_3); SInitCDSData(ADOQueryTemp, CDS_3); with ADOQueryTemp do begin Close; SQL.Clear; sql.Add('exec P_Trade_Plan_ScheduleDetail '); sql.Add(' @DataFlag=''坯布出库'' '); sql.Add(',@OrderNo= ' + quotedstr(trim(FOrderNo))); sql.Add(',@MainId= ' + quotedstr(trim(FMainId))); sql.Add(',@MasterOrderNo= ' + quotedstr(trim(FMasterOrderNo))); Open; end; SCreateCDS(ADOQueryTemp, CDS_5); SInitCDSData(ADOQueryTemp, CDS_5); // with ADOQueryTemp do // begin // Close; // SQL.Clear; // sql.Add('exec P_Trade_Plan_ScheduleDetail '); // sql.Add(' @DataFlag=''外加工入库'' '); // sql.Add(',@OrderNo= ' + quotedstr(trim(FOrderNo))); // sql.Add(',@MainId= ' + quotedstr(trim(FMainId))); // sql.Add(',@MasterOrderNo= ' + quotedstr(trim(FMasterOrderNo))); // Open; // end; // // SCreateCDS(ADOQueryTemp, CDS_2); // SInitCDSData(ADOQueryTemp, CDS_2); // // with ADOQueryTemp do // begin // Close; // SQL.Clear; // sql.Add('exec P_Trade_Plan_ScheduleDetail '); // sql.Add(' @DataFlag=''外加工出库'' '); // sql.Add(',@OrderNo= ' + quotedstr(trim(FOrderNo))); // sql.Add(',@MainId= ' + quotedstr(trim(FMainId))); // sql.Add(',@MasterOrderNo= ' + quotedstr(trim(FMasterOrderNo))); // Open; // end; // // SCreateCDS(ADOQueryTemp, CDS_6); // SInitCDSData(ADOQueryTemp, CDS_6); with ADOQueryTemp do begin Close; SQL.Clear; sql.Add('exec P_Trade_Plan_ScheduleDetail '); sql.Add(' @DataFlag=''待检布入库'' '); sql.Add(',@OrderNo= ' + quotedstr(trim(FOrderNo))); sql.Add(',@MainId= ' + quotedstr(trim(FMainId))); sql.Add(',@MasterOrderNo= ' + quotedstr(trim(FMasterOrderNo))); Open; end; SCreateCDS(ADOQueryTemp, CDS_4); SInitCDSData(ADOQueryTemp, CDS_4); with ADOQueryTemp do begin Close; SQL.Clear; sql.Add('exec P_Trade_Plan_ScheduleDetail '); sql.Add(' @DataFlag=''待检布出库'' '); sql.Add(',@OrderNo= ' + quotedstr(trim(FOrderNo))); sql.Add(',@MainId= ' + quotedstr(trim(FMainId))); sql.Add(',@MasterOrderNo= ' + quotedstr(trim(FMasterOrderNo))); Open; end; SCreateCDS(ADOQueryTemp, CDS_7); SInitCDSData(ADOQueryTemp, CDS_7); with ADOQueryTemp do begin Close; SQL.Clear; sql.Add('exec P_Trade_Plan_ScheduleDetail '); sql.Add(' @DataFlag=''成品检验'' '); sql.Add(',@OrderNo= ' + quotedstr(trim(FOrderNo))); sql.Add(',@MainId= ' + quotedstr(trim(FMainId))); sql.Add(',@MasterOrderNo= ' + quotedstr(trim(FMasterOrderNo))); Open; end; SCreateCDS(ADOQueryTemp, CDS_1); SInitCDSData(ADOQueryTemp, CDS_1); with ADOQueryTemp do begin Close; SQL.Clear; sql.Add('exec P_Trade_Plan_ScheduleDetail '); sql.Add(' @DataFlag=''成品出库'' '); sql.Add(',@OrderNo= ' + quotedstr(trim(FOrderNo))); sql.Add(',@MainId= ' + quotedstr(trim(FMainId))); sql.Add(',@MasterOrderNo= ' + quotedstr(trim(FMasterOrderNo))); Open; end; SCreateCDS(ADOQueryTemp, CDS_8); SInitCDSData(ADOQueryTemp, CDS_8); end; procedure TfrmTradePlanScheduleDetail.FormDestroy(Sender: TObject); begin frmTradePlanScheduleDetail := nil; end; procedure TfrmTradePlanScheduleDetail.FormResize(Sender: TObject); begin cxGrid3.Width := ceil(Self.Width / 2); cxGrid4.Width := ceil(Self.Width / 2); cxGrid1.Width := ceil(Self.Width / 2); GroupBox3.Height := ceil((Self.Height - ToolBar1.Height - pnl1.Height) / 3); GroupBox4.Height := ceil((Self.Height - ToolBar1.Height - pnl1.Height) / 3); end; procedure TfrmTradePlanScheduleDetail.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := cafree; end; procedure TfrmTradePlanScheduleDetail.TBCloseClick(Sender: TObject); begin Close; end; procedure TfrmTradePlanScheduleDetail.TBRafreshClick(Sender: TObject); begin InitOrder(); end; procedure TfrmTradePlanScheduleDetail.ToolButton3Click(Sender: TObject); begin WriteCxGrid('订单明细进度Tv1', Tv1, '订单明细进度管理'); WriteCxGrid('订单明细进度Tv3', Tv3, '订单明细进度管理'); WriteCxGrid('订单明细进度Tv4', Tv4, '订单明细进度管理'); WriteCxGrid('订单明细进度Tv5', Tv5, '订单明细进度管理'); WriteCxGrid('订单明细进度Tv7', Tv7, '订单明细进度管理'); WriteCxGrid('订单明细进度Tv8', Tv8, '订单明细进度管理'); end; procedure TfrmTradePlanScheduleDetail.FormShow(Sender: TObject); begin ReadCxGrid('订单明细进度Tv1', Tv1, '订单明细进度管理'); ReadCxGrid('订单明细进度Tv3', Tv3, '订单明细进度管理'); ReadCxGrid('订单明细进度Tv4', Tv4, '订单明细进度管理'); ReadCxGrid('订单明细进度Tv5', Tv5, '订单明细进度管理'); ReadCxGrid('订单明细进度Tv7', Tv7, '订单明细进度管理'); ReadCxGrid('订单明细进度Tv8', Tv8, '订单明细进度管理'); InitOrder(); end; end.