unit U_OrderMX_CX;

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, cxSplitter;

type
  TfrmOrderMX_CX = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBFind: TToolButton;
    TBClose: TToolButton;
    ADOQueryCmd: TADOQuery;
    ADOQueryMain: TADOQuery;
    ADOQueryTemp: TADOQuery;
    DataSource1: TDataSource;
    cxGridPopupMenu1: TcxGridPopupMenu;
    CDS_Main: TClientDataSet;
    cxGrid1: TcxGrid;
    TV2: TcxGridDBTableView;
    cxGridDBColumn1: TcxGridDBColumn;
    v1ConNo: TcxGridDBColumn;
    v1QianDPlace: TcxGridDBColumn;
    cxGridDBColumn2: TcxGridDBColumn;
    v1KHConNO: TcxGridDBColumn;
    v1ConPerson1: TcxGridDBColumn;
    v1pichang: TcxGridDBColumn;
    v1QtyNote: TcxGridDBColumn;
    v1CustomerNo: TcxGridDBColumn;
    v1CustomerNoName: TcxGridDBColumn;
    v1ConType: TcxGridDBColumn;
    v1OrdDate: TcxGridDBColumn;
    v1ShippMent: TcxGridDBColumn;
    v1DeliveryDate: TcxGridDBColumn;
    v1MPRTSpec: TcxGridDBColumn;
    v1OrdDefStr1: TcxGridDBColumn;
    v1ifFJ: TcxGridDBColumn;
    v1PRTOrderQty: TcxGridDBColumn;
    cxGridDBColumn3: TcxGridDBColumn;
    v1ConMoney: TcxGridDBColumn;
    v1SJFHMoney: TcxGridDBColumn;
    v1RLRMBMoney: TcxGridDBColumn;
    v1RLUSDMoney: TcxGridDBColumn;
    cxGrid1Level1: TcxGridLevel;
    DataSource2: TDataSource;
    Con_Main: TClientDataSet;
    cxGridPopupMenu2: TcxGridPopupMenu;
    cxSplitter1: TcxSplitter;
    ToolButton1: TToolButton;
    cxGrid3: TcxGrid;
    TV3: TcxGridDBTableView;
    v1OrderNo: TcxGridDBColumn;
    cxGridDBColumn4: TcxGridDBColumn;
    v1YWY: TcxGridDBColumn;
    cxGridDBColumn5: TcxGridDBColumn;
    cxGridDBColumn6: TcxGridDBColumn;
    cxGridDBColumn7: TcxGridDBColumn;
    v1GanKou: TcxGridDBColumn;
    cxGridDBColumn8: TcxGridDBColumn;
    v1MPRTCode: TcxGridDBColumn;
    v1MPRTCodeName: TcxGridDBColumn;
    cxGridDBColumn9: TcxGridDBColumn;
    v1MPRTMF: TcxGridDBColumn;
    v1MPRTKZ: TcxGridDBColumn;
    cxGridDBColumn10: TcxGridDBColumn;
    cxGridDBColumn11: TcxGridDBColumn;
    cxGridDBColumn12: TcxGridDBColumn;
    v1note: TcxGridDBColumn;
    cxGridLevel1: TcxGridLevel;
    cxSplitter2: TcxSplitter;
    Order_Main: TClientDataSet;
    cxGridPopupMenu3: TcxGridPopupMenu;
    DataSource3: TDataSource;
    cxSplitter3: TcxSplitter;
    cxGrid5: TcxGrid;
    TV1: TcxGridDBTableView;
    cxGridDBColumn41: TcxGridDBColumn;
    cxGridDBColumn42: TcxGridDBColumn;
    cxGridDBColumn43: TcxGridDBColumn;
    v1KHJC: TcxGridDBColumn;
    cxGridDBColumn44: TcxGridDBColumn;
    cxGridDBColumn45: TcxGridDBColumn;
    cxGridDBColumn46: TcxGridDBColumn;
    cxGridDBColumn47: TcxGridDBColumn;
    cxGridDBColumn48: TcxGridDBColumn;
    v1PRTSpec: TcxGridDBColumn;
    v1FactoryNo1Name: TcxGridDBColumn;
    v1Qty1: TcxGridDBColumn;
    v1C_Color: TcxGridDBColumn;
    v1C_SeNo: TcxGridDBColumn;
    v1PS: TcxGridDBColumn;
    cxGridDBColumn49: TcxGridDBColumn;
    v1OrderUnit: TcxGridDBColumn;
    cxGridDBColumn50: TcxGridDBColumn;
    v1PRTQty: TcxGridDBColumn;
    v1Column6: TcxGridDBColumn;
    cxGridDBColumn51: TcxGridDBColumn;
    v1SSChk: TcxGridDBColumn;
    v1C_Note: TcxGridDBColumn;
    cxGridDBColumn52: TcxGridDBColumn;
    cxGridDBColumn53: TcxGridDBColumn;
    v1KZQty: TcxGridDBColumn;
    v1KZ: TcxGridDBColumn;
    v1C_CF: TcxGridDBColumn;
    v1PiZhong: TcxGridDBColumn;
    cxGridLevel3: TcxGridLevel;
    cxGrid2: TcxGrid;
    TV4: TcxGridDBTableView;
    cxGridDBColumn54: TcxGridDBColumn;
    v1Column2: TcxGridDBColumn;
    v1Column4: TcxGridDBColumn;
    v1ConNoHZ: TcxGridDBColumn;
    v1Column13: TcxGridDBColumn;
    v1Column14: TcxGridDBColumn;
    v1SPCode: TcxGridDBColumn;
    v2SPName: TcxGridDBColumn;
    v1Column8: TcxGridDBColumn;
    v1Column7: TcxGridDBColumn;
    v1Column1: TcxGridDBColumn;
    v1Column10: TcxGridDBColumn;
    v1Column11: TcxGridDBColumn;
    v1Column16: TcxGridDBColumn;
    v1filler: TcxGridDBColumn;
    v1Column9: TcxGridDBColumn;
    v2Column6: TcxGridDBColumn;
    v1CKPS: TcxGridDBColumn;
    v1CKQty: TcxGridDBColumn;
    v1MXKCPiQty: TcxGridDBColumn;
    v1MXKCQty: TcxGridDBColumn;
    v1Column3: TcxGridDBColumn;
    v1Column12: TcxGridDBColumn;
    cxGrid2Level1: TcxGridLevel;
    cxGrid4: TcxGrid;
    tv6: TcxGridDBTableView;
    cxGridDBColumn14: TcxGridDBColumn;
    cxGridDBColumn15: TcxGridDBColumn;
    cxGridDBColumn16: TcxGridDBColumn;
    v1Column15: TcxGridDBColumn;
    cxGridDBColumn17: TcxGridDBColumn;
    cxGridDBColumn18: TcxGridDBColumn;
    cxGridDBColumn19: TcxGridDBColumn;
    v2Column1: TcxGridDBColumn;
    cxGridDBColumn20: TcxGridDBColumn;
    cxGridDBColumn21: TcxGridDBColumn;
    cxGridDBColumn22: TcxGridDBColumn;
    cxGridDBColumn23: TcxGridDBColumn;
    cxGridDBColumn24: TcxGridDBColumn;
    cxGridDBColumn25: TcxGridDBColumn;
    cxGridDBColumn26: TcxGridDBColumn;
    cxGridDBColumn27: TcxGridDBColumn;
    cxGridDBColumn28: TcxGridDBColumn;
    v1Column5: TcxGridDBColumn;
    v1ConNoHZCK: TcxGridDBColumn;
    cxGridDBColumn29: TcxGridDBColumn;
    cxGridDBColumn30: TcxGridDBColumn;
    cxGridLevel2: TcxGridLevel;
    cxSplitter4: TcxSplitter;
    ADOQuery1: TADOQuery;
    ADOQuery2: TADOQuery;
    ADOQuery3: TADOQuery;
    ADOQuery4: TADOQuery;
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure TBCloseClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure N1Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure SPSpecChange(Sender: TObject);
    procedure FactoryNameChange(Sender: TObject);
    procedure SPNameChange(Sender: TObject);
  private
    canshu1,canshu2:string;
    procedure InitGrid();
    { Private declarations }
  public
    FConNO,FormID:string;
    { Public declarations }
  end;

var
  frmOrderMX_CX: TfrmOrderMX_CX;

implementation
uses
  U_DataLink,U_RTFun;

{$R *.dfm}

procedure TfrmOrderMX_CX.FormDestroy(Sender: TObject);
begin
  frmOrderMX_CX:=nil;
end;

procedure TfrmOrderMX_CX.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Action:=caFree;
end;

procedure TfrmOrderMX_CX.FormCreate(Sender: TObject);
begin
  //cxGrid1.Align:=alClient;
  canshu1:=Trim(DParameters1);
  canshu2:=Trim(DParameters2);
end;

procedure TfrmOrderMX_CX.InitGrid();
begin
  try
    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      Filtered:=False;
      Close;
      sql.Clear;
      sql.Add(' select OrderNO=(select OrderNO from JYOrder_Main JM where JM.MainId=A.ORDMainIdRK)');
      sql.Add(',ConNOHZ=(select Top 1 ConnO from JYOrder_Main JM where JM.MainId=A.OrdMainIdRK ) ');
      sql.Add(' ,PRTColorNo=(select PRTColorNo from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
      sql.Add(' ,PRTColor=(select PRTColor from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
      sql.Add(' ,PRTHX=(select PRTHX from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK ),A.*');
      sql.Add(' from CK_SXPB_CR A');
      sql.add(' where A.CRFlag=''入库'' ');
      SQL.Add(' order by A.CRTime desc');
      Open;
    end;
    SCreateCDS20(ADOQueryMain,CDS_Main);
    SInitCDSData20(ADOQueryMain,CDS_Main);
  finally;
    ADOQueryMain.EnableControls;
  end;
end;

procedure TfrmOrderMX_CX.TBRafreshClick(Sender: TObject);
begin
  InitGrid();
end;

procedure TfrmOrderMX_CX.TBCloseClick(Sender: TObject);
begin
  WriteCxGrid('订单流程进度列表',Tv1,'订单流程');
  Close;
end;

procedure TfrmOrderMX_CX.FormShow(Sender: TObject);
begin
  ReadCxGrid('订单流程进度列表',Tv1,'订单流程');
  InitGrid();
end;

procedure TfrmOrderMX_CX.N1Click(Sender: TObject);
begin
  SelOKNo(CDS_Main,True);
end;

procedure TfrmOrderMX_CX.N2Click(Sender: TObject);
begin
  SelOKNo(CDS_Main,False);
end;

procedure TfrmOrderMX_CX.SPSpecChange(Sender: TObject);
begin
  TBFind.Click;
end;

procedure TfrmOrderMX_CX.FactoryNameChange(Sender: TObject);
begin
  TBFind.Click;
end;

procedure TfrmOrderMX_CX.SPNameChange(Sender: TObject);
begin
  TBFind.Click;
end;

end.
