unit U_PBRKSHList;

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,
  IniFiles, jpeg, U_SLT, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdHTTP, cxLookAndFeels, cxLookAndFeelPainters,
  dxBarBuiltInMenu, cxNavigator;

type
  TfrmPBRKSHList = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBFind: TToolButton;
    TBExport: 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;
    RM1: TRMGridReport;
    RMDBMain: TRMDBDataSet;
    RMXLSExport1: TRMXLSExport;
    TBDel: TToolButton;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    TBEdit: TToolButton;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label8: TLabel;
    CPName: TEdit;
    SupplierName: TEdit;
    SPID: TEdit;
    DQFactoryName: TEdit;
    cxTabControl1: TcxTabControl;
    PopupMenu2: TPopupMenu;
    N3: TMenuItem;
    N4: TMenuItem;
    ToolButton6: TToolButton;
    cxGrid2: TcxGrid;
    Tv1: TcxGridDBTableView;
    v1Column6: TcxGridDBColumn;
    v1Column2: TcxGridDBColumn;
    v1FactoryName: TcxGridDBColumn;
    v2SPName: TcxGridDBColumn;
    v1SPSpec: TcxGridDBColumn;
    v1Column1: TcxGridDBColumn;
    v1SPCF: TcxGridDBColumn;
    v1BatchNo: TcxGridDBColumn;
    v1Column9: TcxGridDBColumn;
    v2Column6: TcxGridDBColumn;
    v1Column3: TcxGridDBColumn;
    v1Column12: TcxGridDBColumn;
    cxGrid2Level1: TcxGridLevel;
    DS_DH: TDataSource;
    CDS_DH: TClientDataSet;
    cxGrid1: TcxGrid;
    TV2: TcxGridDBTableView;
    cxGridDBColumn1: TcxGridDBColumn;
    cxGridDBColumn2: TcxGridDBColumn;
    v1CRType: TcxGridDBColumn;
    cxGridDBColumn3: TcxGridDBColumn;
    cxGridDBColumn4: TcxGridDBColumn;
    cxGridDBColumn5: TcxGridDBColumn;
    cxGridDBColumn6: TcxGridDBColumn;
    cxGridDBColumn7: TcxGridDBColumn;
    cxGridDBColumn8: TcxGridDBColumn;
    cxGridDBColumn9: TcxGridDBColumn;
    cxGridDBColumn10: TcxGridDBColumn;
    cxGridDBColumn11: TcxGridDBColumn;
    v1Column10: TcxGridDBColumn;
    v1Column7: TcxGridDBColumn;
    v1Column8: TcxGridDBColumn;
    cxGridDBColumn12: TcxGridDBColumn;
    cxGridLevel1: TcxGridLevel;
    ADOQueryDH: TADOQuery;
    v1Column5: TcxGridDBColumn;
    v1Column11: TcxGridDBColumn;
    v1Column13: TcxGridDBColumn;
    V2Column1: TcxGridDBColumn;
    V2Column2: TcxGridDBColumn;
    V2Column3: TcxGridDBColumn;
    v1Column4: TcxGridDBColumn;
    ToolButton1: TToolButton;
    V2Column4: TcxGridDBColumn;
    Label6: TLabel;
    OrderNo: TEdit;
    IdHTTP1: TIdHTTP;
    CDS_WXTS: TClientDataSet;
    cxGridPopupMenu2: TcxGridPopupMenu;
    CheckBox1: TCheckBox;
    Label7: TLabel;
    DQFactoryName1: TEdit;
    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 N1Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure TBDelClick(Sender: TObject);
    procedure SPIDChange(Sender: TObject);
    procedure SupplierNameChange(Sender: TObject);
    procedure cxTabControl1Change(Sender: TObject);
    procedure ToolButton6Click(Sender: TObject);
    procedure TBEditClick(Sender: TObject);
    procedure DQFactoryNameChange(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
    procedure CheckBox1Click(Sender: TObject);
  private
    canshu1, canshu2, canshu3: string;
    procedure InitGrid();
    procedure InitDH();
    procedure SetStatus();
    procedure ReadINIFile();
    procedure SendMessageQR(Mfsid, KeyWord2: string);
    procedure SendMessageBH(GdName, Mfsid, KeyWord2: string);
    { Private declarations }
  public
    { Public declarations }
  end;

//var
 // frmShaRKList: TfrmShaRKList;
var
  Mach: array of TfrmSlt;

implementation

uses
  U_DataLink, U_RTFun, U_Fun, U_PBRKInPut, U_FileUp, U_WechatAuthority,
  U_SysLogHelp;

{$R *.dfm}
procedure TfrmPBRKSHList.InitDH();
begin

  with ADOQueryDH do
  begin
    Close;
    sql.Clear;
    sql.Add(' select * from XH_Cloth_DH  ');
    sql.Add(' where  DHType  not  in (''回修入库'',''成品出库'',''库存对冲'',''调拨出库'',''调拨入库'') ');

    case cxTabControl1.TabIndex of
      0:
        begin

          if CheckBox1.Checked then
          begin
            sql.Add(' and  ChkStatus = ''已收货''');
          end
          else
          begin
            if CDS_Main.IsEmpty then
              Exit;
            sql.Add(' and FromFactoryName=' + quotedstr(Trim(CDS_Main.fieldbyname('SupplierName').AsString)));
            sql.Add(' and  ChkStatus = ''已收货''');
          end;
        end;
      1:
        begin
          if CDS_Main.IsEmpty then
            Exit;
          sql.Add(' and FromFactoryName=' + quotedstr(Trim(CDS_Main.fieldbyname('SupplierName').AsString)));
          sql.Add(' and  ChkStatus =''仓库已确认'' ');
          sql.Add(' and FHID=' + quotedstr(Trim(CDS_Main.fieldbyname('FHID').AsString)));
        end;

    end;
//    ShowMessage(SQL.Text);
    Open;
  end;
  SCreateCDS20(ADOQueryDH, CDS_DH);
  SInitCDSData20(ADOQueryDH, CDS_DH);
end;

procedure TfrmPBRKSHList.SendMessageQR(Mfsid, KeyWord2: string);
begin
  with ADOQueryTemp do
  begin
    Close;
    SQL.Clear;
    sql.Add('select distinct A.* from SY_User A inner join SY_Purview B on A.UserID=B.UserID  where A.Valid=''Y'' ');
    SQL.Add('and isnull(A.wxid,'''')<>''''');
    SQL.Add(' and exists(select 1 from SY_ModuleSub X where X.ModuleID=B.ModuleID and X.ModuleSubID=B.ModuleSubID and X.FormName=''业务员确认'') ');
//    showmessage(sql.text);
    Open;
  end;
  SCreateCDS20(ADOQueryTemp, CDS_WXTS);
  SInitCDSData20(ADOQueryTemp, CDS_WXTS);

  if CDS_WXTS.IsEmpty then
  begin
    Application.MessageBox('用户未绑定微信,提交失败！', '提示信息', 0);
    Exit;
  end;
  CDS_WXTS.First;
  while not CDS_WXTS.eof do
  begin
    with ADOQueryCmd do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select * from WeixinMessage where 1<>1');
      Open;
      Append;
      FieldByName('MessageType').Value := 'OrderProgress';
      FieldByName('MessageName').Value := '订单进度提醒';
      FieldByName('Title').Value := '您有新的坯布到货仓库已确认，请及时处理';
      FieldByName('URL').Value := 'pages/grayfabric/ywConfirm?fhid=' + Trim(Mfsid);
      FieldByName('OpenId').Value := Trim(CDS_WXTS.FieldByName('wxid').AsString);
      FieldByName('Status').Value := '0';
      FieldByName('CreateDate').Value := FormatDateTime('yyyymmdd', SGetServerDateTime(ADOQueryTemp));
      FieldByName('CreateTime').Value := FormatDateTime('HH:mm:ss', SGetServerDateTime(ADOQueryTemp));
      FieldByName('BusinessId').Value := Trim(Mfsid);
      FieldByName('KeyWord1').Value := Trim(Mfsid);
      FieldByName('KeyWord2').Value := Trim(KeyWord2);
      Post;
    end;
    CDS_WXTS.Next;
  end;

  GetHTTP(IdHTTP1, 'http://www.rightsoft.top/yifu/api/message/Send/OrderProgress');
end;

procedure TfrmPBRKSHList.SendMessageBH(GdName, Mfsid, KeyWord2: string);
begin
  with ADOQueryTemp do
  begin
    Close;
    SQL.Clear;
    sql.Add('select A.* from SY_User A  where A.Valid=''Y'' ');
    SQL.Add('and isnull(A.wxid,'''')<>''''');
    SQL.Add(' and UserName= ' + quotedstr(Trim(GdName)));
    Open;
  end;

  if ADOQueryTemp.IsEmpty then
  begin
    Application.MessageBox('用户未绑定微信,提交失败！', '提示信息', 0);
    Exit;
  end;
  ADOQueryTemp.First;

  with ADOQueryCmd do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select * from WeixinMessage where 1<>1');
    Open;
    Append;
    FieldByName('MessageType').Value := 'OrderProgress';
    FieldByName('MessageName').Value := '订单进度提醒';
    FieldByName('Title').Value := '您有新的坯布到货被驳回，请及时处理';
    FieldByName('URL').Value := 'pages/grayfabric/gdConfirm?fhid=' + Trim(Mfsid);
    FieldByName('OpenId').Value := Trim(ADOQueryTemp.FieldByName('wxid').AsString);
    FieldByName('Status').Value := '0';
    FieldByName('CreateDate').Value := FormatDateTime('yyyymmdd', SGetServerDateTime(ADOQueryTemp));
    FieldByName('CreateTime').Value := FormatDateTime('HH:mm:ss', SGetServerDateTime(ADOQueryTemp));
    FieldByName('BusinessId').Value := Trim(Mfsid);
    FieldByName('KeyWord1').Value := Trim(Mfsid);
    FieldByName('KeyWord2').Value := Trim(KeyWord2);
    Post;
  end;

end;

procedure TfrmPBRKSHList.FormDestroy(Sender: TObject);
begin
  //frmShaRKList:=nil;
end;

procedure TfrmPBRKSHList.SetStatus();
begin

end;

procedure TfrmPBRKSHList.FormClose(Sender: TObject; var Action: TCloseAction);
var
  i, j: integer;
begin
  j := length(Mach);
  if j > 0 then
  begin
    for i := 0 to j - 1 do
    begin
      Mach[i].free;
    end;
  end;
  SetLength(Mach, 0);
  Action := caFree;
end;

procedure TfrmPBRKSHList.ReadINIFile();
var
  programIni: Tinifile;  //配置文件名
  FileName: string;
begin
  FileName := ExtractFilePath(Paramstr(0)) + 'SYSTEMSET.INI';
  programIni := Tinifile.create(FileName);
  server := programIni.ReadString('SERVER', '服务器地址', '127.0.0.1');
  programIni.Free;
end;

procedure TfrmPBRKSHList.FormCreate(Sender: TObject);
begin
  //cxGrid1.Align:=alClient;
  EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
  BegDate.DateTime := EndDate.DateTime;
  canshu1 := Trim(DParameters1);
  canshu2 := Trim(DParameters2);
  canshu3 := Trim(DParameters3);
end;

procedure TfrmPBRKSHList.InitGrid();
begin
  try
    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      Filtered := False;
      Close;
      sql.Clear;
      sql.Add(' select A.*,A.DQFactoryName  DQFactoryName1');
      sql.Add(' from SupplierDeliver A');
      sql.add(' where A.FHDate>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''');
      sql.Add(' and A.FHDate<''' + Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)) + '''');
      case cxTabControl1.TabIndex of
        0:
          begin
            Sql.Add(' and isnull(ChkStatus,'''')=''跟单已确认'' ');
          end;
        1:
          begin
            Sql.Add(' and isnull(ChkStatus,'''')=''仓库已确认'' ');
          end;
        2:
          begin
            Sql.Add(' and isnull(ChkStatus,'''') in (''跟单已确认'',''仓库已确认'') ');
          end;
      end;

      Open;
    end;
    SCreateCDS20(ADOQueryMain, CDS_Main);
    SInitCDSData20(ADOQueryMain, CDS_Main);
  finally
    ADOQueryMain.EnableControls;
  end;
end;

procedure TfrmPBRKSHList.TBRafreshClick(Sender: TObject);
begin
  BegDate.SetFocus;
  InitGrid();
end;

procedure TfrmPBRKSHList.ConNoMChange(Sender: TObject);
begin
  if ADOQueryMain.Active then
  begin
    SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
  end;
end;

procedure TfrmPBRKSHList.TBCloseClick(Sender: TObject);
begin
  if Trim(DName)='ADMIN' then
  begin
    WriteCxGridAll(trim(self.Caption), Tv1,ADOQueryCmd,ADOQueryTemp);
    WriteCxGridAll(trim(self.Caption)+'2', Tv2,ADOQueryCmd,ADOQueryTemp);
  end;


  Close;
end;

procedure TfrmPBRKSHList.FormShow(Sender: TObject);
begin
  ReadCxGridAll(trim(self.Caption), Tv1);
  ReadCxGridAll(trim(self.Caption)+'2', Tv2);
  SetStatus();
end;

procedure TfrmPBRKSHList.TBExportClick(Sender: TObject);
begin
  if ADOQueryMain.IsEmpty then
    exit;
  TcxGridToExcel('纱线入库列表', cxGrid2);
end;

procedure TfrmPBRKSHList.TBFindClick(Sender: TObject);
begin
  if ADOQueryMain.Active then
  begin
    SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
    SCreateCDS20(ADOQueryMain, CDS_Main);
    SInitCDSData20(ADOQueryMain, CDS_Main);
  end;

end;

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

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

procedure TfrmPBRKSHList.TBDelClick(Sender: TObject);
var
  str: string;
begin
  if CDS_Main.IsEmpty then
    Exit;
  if CheckBox1.Checked then
  begin
    Application.MessageBox('请取消显示全部到货!', '提示', 0);
    Exit;
  end;
  with ADOQueryCmd do
  begin
    Close;
    sql.Clear;
    sql.Add(' update  SupplierDeliver  ');
    sql.Add(' set ChkStatus=''跟单已确认'',CkChker=null');
    sql.Add(' ,CkChkTime=null');
    sql.Add(' ,CkChkNote=null');
    sql.Add(' where FHId=''' + Trim(CDS_Main.fieldbyname('FHId').AsString) + '''');
    ExecSQL;
  end;

  with ADOQueryCmd do
  begin
    Close;
    sql.Clear;
    sql.Add(' update  XH_Cloth_DH  ');
    sql.Add(' set ChkStatus=''已收货'', Chker=null');
    sql.Add(' ,ChkTime=null');
    sql.Add(' ,FHID=null');
    sql.Add(' where FHID=' + quotedstr(Trim(CDS_Main.fieldbyname('FHID').AsString)));
    ExecSQL;
  end;
  Application.MessageBox('撤销审核成功!', '提示', 0);
  CDS_Main.Delete;

end;

procedure TfrmPBRKSHList.SPIDChange(Sender: TObject);
begin
  if Length(Trim(SPID.Text)) < 4 then
  begin
    if Trim(SPID.Text) <> '' then
      Exit;
  end;
  TBFind.Click;
end;

procedure TfrmPBRKSHList.SupplierNameChange(Sender: TObject);
begin
  TBFind.Click;
end;

procedure TfrmPBRKSHList.cxTabControl1Change(Sender: TObject);
begin
  SetStatus();
  InitGrid();
end;

procedure TfrmPBRKSHList.ToolButton6Click(Sender: TObject);
var
  str, SMfsid, SKeyWord2, SUnit: string;
  QRQty: Double;
begin
  if CDS_Main.IsEmpty then
    Exit;
  if CheckBox1.Checked then
  begin
    Application.MessageBox('请取消显示全部到货!', '提示', 0);
    Exit;
  end;
  if CDS_DH.Locate('ssel', True, []) = False then
  begin
    Application.MessageBox('请选择到货数据!', '提示', 0);
    Exit;
  end;
  //判断数量是否一致
  QRQty := CDS_Main.fieldbyname('Qty').AsFloat;
  SUnit := Trim(CDS_Main.fieldbyname('Unit').AsString);

  with CDS_DH do
  begin
    first;
    while not Eof do
    begin
      if CDS_DH.fieldbyname('ssel').AsBoolean then
      begin
        QRQty := QRQty - CDS_DH.fieldbyname('DHQty').AsFloat;
      end;
      Next;
    end;
  end;
  if SUnit = 'M' then
  begin
    if (QRQty < -3) or (QRQty > 3) then
    begin
      Application.MessageBox('长度范围超出±3M!', '提示', 0);
      Exit;
    end;
  end
  else if SUnit = 'KG' then
  begin
    if (QRQty < -1) or (QRQty > 1) then
    begin
      Application.MessageBox('重量范围超出±1KG!', '提示', 0);
      Exit;
    end;
  end
  else
  begin
    Application.MessageBox('数量单位异常无法确认!', '提示', 0);
    Exit;
  end;

  if InputQuery('确认备注', '请输入：', str) then
  begin
    if trim(str) <> '' then
    begin
      with ADOQueryCmd do
      begin
        Close;
        sql.Clear;
        sql.Add(' update  SupplierDeliver  ');
        sql.Add(' set ChkStatus=''仓库已确认'', CkChker=' + quotedstr(Trim(DName)));
        sql.Add(' ,CkChkTime=getdate()');
        sql.Add(' ,CkChkNote=' + quotedstr(Trim(str)));
        sql.Add(' where FHId=''' + Trim(CDS_Main.fieldbyname('FHId').AsString) + '''');
        ExecSQL;
      end;
      while CDS_DH.Locate('ssel', True, []) do
      begin
        with ADOQueryCmd do
        begin
          Close;
          sql.Clear;
          sql.Add(' update  XH_Cloth_DH  ');
          sql.Add(' set ChkStatus=''仓库已确认'', Chker=' + quotedstr(Trim(DName)));
          sql.Add(' ,ChkTime=getdate()');
          sql.Add(' ,FHID=' + quotedstr(Trim(CDS_Main.fieldbyname('FHID').AsString)));
          sql.Add(' where DHId=''' + Trim(CDS_DH.fieldbyname('DHId').AsString) + '''');
          ExecSQL;
        end;
        CDS_DH.Edit;
        CDS_DH.FieldByName('SSel').Value := False;
      end;
//      SMfsid := Trim(CDS_Main.fieldbyname('FHId').AsString);
//      SKeyWord2 := '存放工厂：' + Trim(CDS_Main.fieldbyname('DQFactoryName').AsString) + ';品名：' + Trim(CDS_Main.fieldbyname('CPName').AsString) + ';匹数：' + Trim(CDS_Main.fieldbyname('PS').AsString) + ';数量：' + Trim(CDS_Main.fieldbyname('Qty').AsString) + '。';
//      SendMessageQR(SMfsid, SKeyWord2);
      Application.MessageBox('确认成功!', '提示', 0);
      CDS_Main.Delete;
    end
    else
    begin
      Application.MessageBox('请输入确认备注!', '提示', 0);
    end;
  end;

end;

procedure TfrmPBRKSHList.TBEditClick(Sender: TObject);
var
  str, strsql, SMfsid, SKeyWord2: string;
begin
  if CDS_DH.IsEmpty then
    Exit;
//  if CheckBox1.Checked then
//  begin
//    Application.MessageBox('请取消显示全部到货!', '提示', 0);
//    Exit;
//  end;
  if InputQuery('驳回原因', '请输入', str) then
  begin

    if trim(str) <> '' then
    begin
      while CDS_DH.Locate('SSel', True, []) do
      begin
        with ADOQueryCmd do
        begin
          Close;
          sql.Clear;
          sql.Add(' update  XH_Cloth_DH  ');
          sql.Add(' set ChkStatus=''已驳回'' ');
          sql.Add(' ,RejectReason=' + quotedstr(Trim(str)));
          sql.Add(' where DHId=''' + Trim(CDS_DH.fieldbyname('DHId').AsString) + '''');
          ExecSQL;
        end;
        strsql := '到货ID：' + Trim(CDS_DH.fieldbyname('DHId').AsString) + '驳回原因：' + trim(str);
        with ADOQueryCmd do
        begin
          Close;
          sql.Clear;
          sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
          sql.Add(' ' + quotedstr(trim(DName)));
          sql.Add(',getdate() ');
          sql.Add(',' + quotedstr(trim(self.Caption)));
          sql.Add(',' + quotedstr(trim('坯布发货驳回')));
          sql.Add(',' + quotedstr(trim(strsql)));
          sql.Add(',' + quotedstr(trim('成功')));
          sql.Add(')');
          ExecSQL;
        end;

        SMfsid := Trim(CDS_DH.fieldbyname('DHId').AsString);
        SKeyWord2 := '染厂：' + Trim(CDS_DH.fieldbyname('DQFactoryName').AsString) + ';品名：' + Trim(CDS_DH.fieldbyname('CPName').AsString) + ';匹数：' + Trim(CDS_DH.fieldbyname('DHPS').AsString) + ';数量：' + Trim(CDS_DH.fieldbyname('DHQty').AsString) + '。';
        SendMessageBH(Trim(CDS_DH.fieldbyname('GdName').AsString), SMfsid, SKeyWord2);
        CDS_DH.Delete;
      end;

//      GetHTTP(IdHTTP1, 'http://www.rightsoft.top/yifu/api/message/Send/OrderProgress');
      Application.MessageBox('驳回成功!', '提示', 0);

    end
    else
    begin
      Application.MessageBox('请输入驳回原因!', '提示', 0);
    end;
  end;

end;

procedure TfrmPBRKSHList.DQFactoryNameChange(Sender: TObject);
begin

  if ADOQueryDH.Active then
  begin
    SDofilter(ADOQueryDH, SGetFilters(Panel1, 3, 4));
    SCreateCDS20(ADOQueryDH, CDS_DH);
    SInitCDSData20(ADOQueryDH, CDS_DH);
  end;
end;

procedure TfrmPBRKSHList.ToolButton1Click(Sender: TObject);
begin
  frmSysLogHelp := TfrmSysLogHelp.create(self);
  with frmSysLogHelp do
  begin
//    fModel:=self.caption;
  //  facction:='生产指示单删除';
    showmodal;
    free;
  end;
end;

procedure TfrmPBRKSHList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
begin
  InitDH();
end;

procedure TfrmPBRKSHList.CheckBox1Click(Sender: TObject);
begin
  InitDH();
end;

end.

