unit U_ClothPDInfoList;

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;

type
  TfrmClothPDInfoList = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBFind: TToolButton;
    TBClose: TToolButton;
    Panel1: TPanel;
    cxGridPopupMenu1: TcxGridPopupMenu;
    ADOQueryCmd: TADOQuery;
    ADOQueryMain: TADOQuery;
    ADOQueryTemp: TADOQuery;
    DataSource1: TDataSource;
    Label3: TLabel;
    OrderNo: TEdit;
    Label5: TLabel;
    MPRTCodeName: TEdit;
    TBExport: TToolButton;
    Order_Main: TClientDataSet;
    Label4: TLabel;
    C_Spec: TEdit;
    cxGrid1: TcxGrid;
    Tv1: TcxGridDBTableView;
    v1OrderNo: TcxGridDBColumn;
    v1Column2: TcxGridDBColumn;
    v1PRTSpec: TcxGridDBColumn;
    v1PRTMF: TcxGridDBColumn;
    v1PRTKZ: TcxGridDBColumn;
    v1PRTOrderQty: TcxGridDBColumn;
    v1OrderUnit: TcxGridDBColumn;
    cxGrid1Level1: TcxGridLevel;
    v1Column8: TcxGridDBColumn;
    v1Column9: TcxGridDBColumn;
    v1Column11: TcxGridDBColumn;
    v1Column1: TcxGridDBColumn;
    v1Column4: TcxGridDBColumn;
    v1Column5: TcxGridDBColumn;
    v1Column7: TcxGridDBColumn;
    v1Column10: TcxGridDBColumn;
    v1JY_PS: TcxGridDBColumn;
    v1JY_Qty: TcxGridDBColumn;
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure TBCloseClick(Sender: TObject);
    procedure TBFindClick(Sender: TObject);
    procedure TBExportClick(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure OrderNoChange(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Tv2MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    FInt,PFInt:Integer;
    procedure InitGrid();
    procedure InitForm();
    function  DelData():Boolean;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmClothPDInfoList: TfrmClothPDInfoList;

implementation
uses
  U_DataLink,U_ClothContractInPut,U_Fun,U_ProductOrderList,U_ZDYHelp;

{$R *.dfm}

procedure TfrmClothPDInfoList.FormDestroy(Sender: TObject);
begin
  frmClothPDInfoList:=nil;
end;

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

procedure TfrmClothPDInfoList.TBCloseClick(Sender: TObject);
begin
  Close;
  WriteCxGrid('待检布库存1',Tv1,'指示单管理');
end;

procedure TfrmClothPDInfoList.InitGrid();
begin
  try
    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      filtered:=False;
      Close;
      sql.Clear;
      sql.Add('exec p_view_DJBKC ');
      Open;
    end;
    SCreateCDS20(ADOQueryMain,Order_Main);
    SInitCDSData20(ADOQueryMain,Order_Main);
  finally
    ADOQueryMain.EnableControls;
  end;
end;

procedure TfrmClothPDInfoList.InitForm();
begin
  ReadCxGrid('待检布库存1',Tv1,'指示单管理');
  InitGrid();
end;

procedure TfrmClothPDInfoList.TBFindClick(Sender: TObject);
begin
  if ADOQueryMain.Active=False then Exit;
  SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
  SCreateCDS20(ADOQueryMain,Order_Main);
  SInitCDSData20(ADOQueryMain,Order_Main);
end;

function TfrmClothPDInfoList.DelData():Boolean;
begin
  
end;

procedure TfrmClothPDInfoList.TBExportClick(Sender: TObject);
begin
  if ADOQueryMain.IsEmpty then Exit;
  TcxGridToExcel('待检布库存',cxGrid1);
end;

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

procedure TfrmClothPDInfoList.OrderNoChange(Sender: TObject);
begin
  if ADOQueryMain.Active=False then Exit;
  SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
  SCreateCDS20(ADOQueryMain,Order_Main);
  SInitCDSData20(ADOQueryMain,Order_Main);
end;

procedure TfrmClothPDInfoList.FormShow(Sender: TObject);
begin
  InitForm();
end;

procedure TfrmClothPDInfoList.Tv2MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  FInt:=2;
end;

end.
