unit U_JYHZList;

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, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System, RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus,
  MovePanel, cxTextEdit, cxContainer, cxCurrencyEdit, BtnEdit, RM_e_main, RM_e_htm, RM_e_Graphic, RM_e_Jpeg, RM_e_txt, RM_e_csv, RM_E_llPDF, Math,
  cxPC;

type
  TfrmJYHZList = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBClose: TToolButton;
    Panel1: TPanel;
    BegDate: TDateTimePicker;
    EndDate: TDateTimePicker;
    Tv1: TcxGridDBTableView;
    cxGrid1Level1: TcxGridLevel;
    cxGrid1: TcxGrid;
    cxGridPopupMenu1: TcxGridPopupMenu;
    ADOQueryCmd: TADOQuery;
    ADOQueryMain: TADOQuery;
    ADOQueryTemp: TADOQuery;
    DataSource1: TDataSource;
    Label3: TLabel;
    MLOrderNo: TEdit;
    TBExport: TToolButton;
    Order_Main: TClientDataSet;
    MLConNo: TEdit;
    Label7: TLabel;
    Label8: TLabel;
    Label10: TLabel;
    JYNo: TEdit;
    Label2: TLabel;
    MLCodeName: TEdit;
    Panel4: TPanel;
    Label11: TLabel;
    Panel10: TPanel;
    Image2: TImage;
    RichEdit1: TRichEdit;
    v1MLOrderNo: TcxGridDBColumn;
    v1GangNo: TcxGridDBColumn;
    v1KHName: TcxGridDBColumn;
    v1JYType: TcxGridDBColumn;
    v1JYKG: TcxGridDBColumn;
    v1JYLen: TcxGridDBColumn;
    v1JYUnit: TcxGridDBColumn;
    Label4: TLabel;
    v1MLCodeName: TcxGridDBColumn;
    v1RKType: TcxGridDBColumn;
    v1Column20: TcxGridDBColumn;
    v1FillTime: TcxGridDBColumn;
    v1Column22: TcxGridDBColumn;
    v1JYNo: TcxGridDBColumn;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    TBZF: TToolButton;
    RM2: TRMGridReport;
    RMDB_Main: TRMDBDataSet;
    ADOQueryPrint: TADOQuery;
    MovePanel2: TMovePanel;
    v1JYPZ: TcxGridDBColumn;
    v1JYJZ: TcxGridDBColumn;
    CDS_CD: TClientDataSet;
    RMCD: TRMGridReport;
    RMDBCD: TRMDBDataSet;
    CDS_LS: TClientDataSet;
    Label14: TLabel;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    KHNameJC: TEdit;
    gangNO: TEdit;
    MLColor: TEdit;
    RM3: TRMGridReport;
    v1Column31: TcxGridDBColumn;
    v1MLConNo: TcxGridDBColumn;
    Label22: TLabel;
    ISHZ: TComboBox;
    RMllPDFExport1: TRMllPDFExport;
    RMXLSExport1: TRMXLSExport;
    CDS_HZ: TClientDataSet;
    RMDBHZ: TRMDBDataSet;
    RMDBPRT: TRMDBDataSet;
    CDS_PRT: TClientDataSet;
    v1MLColorNo: TcxGridDBColumn;
    v1MLHX: TcxGridDBColumn;
    Filler: TEdit;
    IsJYTime: TCheckBox;
    Panel6: TPanel;
    LBCPAP: TLabel;
    Label1: TLabel;
    BTLP: TButton;
    BTNP: TButton;
    TCBNOR: TComboBox;
    v1Column1: TcxGridDBColumn;
    v1Column2: TcxGridDBColumn;
    v1Column3: TcxGridDBColumn;
    ToolButton1: TToolButton;
    v1Column4: TcxGridDBColumn;
    Label6: TLabel;
    JYID: TEdit;
    cxTabControl1: TcxTabControl;
    Label9: TLabel;
    HZPS: TEdit;
    Label12: TLabel;
    HZQty: TEdit;
    Panel2: TPanel;
    Label13: TLabel;
    NewMLID: TEdit;
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure TBCloseClick(Sender: TObject);
    procedure TBExportClick(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Panel10MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    procedure Image2Click(Sender: TObject);
    procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
    procedure N1Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure TBZFClick(Sender: TObject);
    procedure v1Column15PropertiesEditValueChanged(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure BTLPClick(Sender: TObject);
    procedure BTNPClick(Sender: TObject);
    procedure TCBNORChange(Sender: TObject);
    procedure MLColorKeyPress(Sender: TObject; var Key: Char);
    procedure ToolButton1Click(Sender: TObject);
    procedure cxTabControl1Change(Sender: TObject);
    procedure NewMLIDKeyPress(Sender: TObject; var Key: Char);
  private
    DQdate: TDateTime;
    FLeft, FTop: Integer;
    CurrentPage, RecordsNumber: Integer;
    canshu1,FNewMLID: string;
    procedure InitGrid();
    procedure GetHZData(fwhere:string);
    procedure InitForm();
    function Savedata(): Boolean;
    procedure GetCDSData();
    procedure GetBGData();
    procedure PrtDataMD(FMJID: string);
    { Private declarations }
  public
    FFInt: Integer;
    { Public declarations }
  end;

var
  frmJYHZList: TfrmJYHZList;

implementation

uses
  U_DataLink, U_Fun, U_ZDYHelp;

{$R *.dfm}
procedure TfrmJYHZList.PrtDataMD(FMJID: string);
var
  fPrintFile: string;
  Txt, fImagePath: string;
  Moudle: THandle;
  Makebar: TMakebar;
  Mixtext: TMixtext;
  i: Integer;
begin

  with ADOQueryPrint do
  begin
    Close;
    SQL.Clear;
    sql.Add('select A.*,B.*,C.*,CPBQName1=isnull(CPBQName,''通用标签'') ');
    SQL.Add('from JTJY_New A ');
    SQL.Add('inner join ML_OrderMainNew B on B.NewMLID=A.NewMLID ');
    SQL.Add('inner join ML_OrderSubidNew C on C.NewSubid=A.NewSubid ');
    sql.Add('where A.JYID=''' + trim(FMJID) + '''');
    Open;
  end;
  FPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('CPBQName1').AsString) + '.rmf';
  try
    Moudle := LoadLibrary('MakeQRBarcode.dll');
    @Makebar := GetProcAddress(Moudle, 'Make');
    @Mixtext := GetProcAddress(Moudle, 'MixText');
    Txt := Trim(ADOQueryPrint.fieldbyname('JYID').AsString);
    fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
    if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
      CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
    if FileExists(fImagePath) then
      DeleteFile(fImagePath);
    Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
  except
    application.MessageBox('条形码生成失败！', '提示信息', MB_ICONERROR);

    exit;
  end;

  if FileExists(fPrintFile) then
  begin
    RMVariables['QRBARCODE'] := fImagePath;
    RM2.LoadFromFile(fPrintFile);

    RM2.PrintReport;

  end
  else
  begin
    Application.MessageBox(pchar('没有找' + FPrintFile), '提示', 0);

    exit;
  end;
end;

procedure TfrmJYHZList.FormDestroy(Sender: TObject);
begin
  frmJYHZList := nil;
end;

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

procedure TfrmJYHZList.FormCreate(Sender: TObject);
begin
  cxgrid1.Align := alClient;
  DQdate := SGetServerDate(ADOQueryTemp);
  canshu1 := Trim(DParameters1);
  FNewMLID:='';
end;

procedure TfrmJYHZList.TBCloseClick(Sender: TObject);
begin
  Close;
  WriteCxGrid('检验信息管理', Tv1, '检验管理');
end;

procedure TfrmJYHZList.InitGrid();
var
  fwhere, Pwhere: string;
begin
  HZPS.Text:='';
  HZQty.Text:='';
  MovePanel2.Left := (self.Width - MovePanel2.Width) div 2;
  MovePanel2.Visible := True;
  MovePanel2.Refresh;
  Pwhere := SGetFilters(Panel1, 1, 2);

  if trim(Pwhere) <> '' then
    fwhere := fwhere + ' where ' + trim(Pwhere);

  try
    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      Filtered := False;
      Close;
      sql.Clear;
      sql.Add(' select top ' + inttostr(RecordsNumber) + ' *  from  ');
      sql.Add('(select rownumber=Cast(row_number() over(order by AA.filltime desc) as int) ');
      sql.Add(',TotalCount=Cast(COUNT(1) OVER() AS int) ,* from (select ');
      sql.Add('  A.*  ');
      sql.Add(' ,B.MLOrderNo,B.MLConNo,B.MLCodeName,B.KHName,KM.KHNameJC ');
      sql.Add(' ,C.MLColor,C.MLColorNo,C.MLHX,C.MLColorEng,C.MLColorNoKH ');
      sql.Add(',KHConNo=(select TOP 1 X.KHConNo from ML_ConMain X where X.MLConID=B.ConMainId)');
      sql.Add('  from JTJY_New A ');
      sql.Add('inner join ML_OrderMainNew B on B.NewMLID=A.NewMLID ');
      sql.Add('inner join ML_OrderSubidNew C on C.NewSubid=A.NewSubid ');
      sql.Add('inner join KH_Main KM on B.KHNO=KM.KHNO');
      sql.Add(' where 1=1');
      if Trim(FNewMLID)<>'' then
      begin
        sql.Add(' and A.NewMLID='''+Trim(FNewMLID)+'''');
      end;
      if IsJYTime.Checked then
      begin
        sql.Add('and A.FillTime>=''' + trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
        sql.add(' and A.Filltime<''' + trim(FormatDateTime('yyyy-MM-dd', enddate.Date + 1)) + '''');
      end;
      if cxTabControl1.TabIndex=0 then
      begin
        sql.Add(' and JYTYpe=''成品'' ');
      end else
      if cxTabControl1.TabIndex=1 then
      begin
        sql.Add(' and JYTYpe=''面布'' ');
      end else
      if cxTabControl1.TabIndex=2 then
      begin
        sql.Add(' and JYTYpe=''底布'' ');
      end;
      sql.Add('   ) AA');
      sql.Add(fwhere + ') temp_row');
      sql.Add(' where rownumber> ' + inttostr((CurrentPage - 1) * RecordsNumber));
//      ShowMessage(SQL.Text);
      Open;
    end;

    SCreateCDS20(ADOQueryMain, Order_Main);
    SInitCDSData20(ADOQueryMain, Order_Main);
    LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(Order_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
    MovePanel2.Visible := false;
    GetHZData(fwhere);
    FNewMLID:='';
  finally
    ADOQueryMain.EnableControls;
    MovePanel2.Visible := false;
  end;
end;
procedure TfrmJYHZList.GetHZData(fwhere:string);
begin
  with ADOQueryTemp do
  begin
    Close;
    sql.Clear;
    sql.Add(' select HZPS=count(*),HZQty=sum(JYLen) from  ');
    sql.Add('(select  ');
    sql.Add(' * from (select ');
    sql.Add('  A.*  ');
    sql.Add(' ,B.MLOrderNo,B.MLConNo,B.MLCodeName,B.KHName,KM.KHNameJC ');
    sql.Add(' ,C.MLColor,C.MLColorNo,C.MLHX,C.MLColorEng,C.MLColorNoKH ');
    sql.Add(',KHConNo=(select TOP 1 X.KHConNo from ML_ConMain X where X.MLConID=B.ConMainId)');
    sql.Add('  from JTJY_New A ');
    sql.Add('inner join ML_OrderMainNew B on B.NewMLID=A.NewMLID ');
    sql.Add('inner join ML_OrderSubidNew C on C.NewSubid=A.NewSubid ');
    sql.Add('inner join KH_Main KM on B.KHNO=KM.KHNO');
    sql.Add(' where 1=1');
    if Trim(FNewMLID)<>'' then
    begin
      sql.Add(' and A.NewMLID='''+Trim(FNewMLID)+'''');
    end;
    if IsJYTime.Checked then
    begin
      sql.Add('and A.FillTime>=''' + trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
      sql.add(' and A.Filltime<''' + trim(FormatDateTime('yyyy-MM-dd', enddate.Date + 1)) + '''');
    end;
    if cxTabControl1.TabIndex=0 then
    begin
      sql.Add(' and JYTYpe=''成品'' ');
    end else
    if cxTabControl1.TabIndex=1 then
    begin
      sql.Add(' and JYTYpe=''面布'' ');
    end else
    if cxTabControl1.TabIndex=2 then
    begin
      sql.Add(' and JYTYpe=''底布'' ');
    end;
    sql.Add('   ) AA');
    sql.Add(fwhere + ') temp_row');

    Open;
  end;
  HZPS.Text:=Trim(ADOQueryTemp.fieldbyname('HZPS').AsString);
  HZQty.Text:=Trim(ADOQueryTemp.fieldbyname('HZQty').AsString);
end;

procedure TfrmJYHZList.InitForm();
var
  fsj: string;
begin
  ReadCxGrid('检验信息管理', Tv1, '检验管理');
  BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 1;
  EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
//  TBZF.Visible := false;
  if canshu1 = '高权限' then
  begin
    TBZF.Visible := true;
  end;
  //InitGrid();
end;

procedure TfrmJYHZList.TBExportClick(Sender: TObject);
begin
  if ADOQueryMain.IsEmpty then
    Exit;
  SelExportData(Tv1, ADOQueryMain, '检验报告');
end;

procedure TfrmJYHZList.TBRafreshClick(Sender: TObject);
begin
  toolbar1.SetFocus;

  InitGrid();
end;

procedure TfrmJYHZList.FormShow(Sender: TObject);
begin
  CurrentPage := 1;
  RecordsNumber := 500;
  InitForm();
end;

procedure TfrmJYHZList.Panel10MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture;
  TWinControl(Panel4).Perform(WM_SYSCOMMAND, $F012, 0);
end;

procedure TfrmJYHZList.Image2Click(Sender: TObject);
begin
  Panel4.Visible := False;
end;

procedure TfrmJYHZList.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  FLeft := X;
  FTop := Y;
end;

procedure TfrmJYHZList.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
  Panel4.Left := FLeft;
  Panel4.Top := FTop + 110;
  Panel4.Visible := True;
  Panel4.Refresh;
  Panel10.Caption := Trim(TV1.Controller.FocusedColumn.Caption);
  RichEdit1.Text := Order_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString;
end;

procedure TfrmJYHZList.N1Click(Sender: TObject);
begin
  SelOKNo(Order_Main, True);
end;

procedure TfrmJYHZList.N2Click(Sender: TObject);
begin
  SelOKNo(Order_Main, False);
end;

procedure TfrmJYHZList.TBZFClick(Sender: TObject);
begin
  if Order_Main.Locate('ssel', True, []) = False then
  begin
    Application.MessageBox('没有选择数据!', '提示', 0);
    Exit;
  end;
  if Application.MessageBox('确定要作废数据吗？作废后数据不能恢复。', '提示', 32 + 4) <> IDYES then
    Exit;
  Order_Main.DisableControls;
  with Order_Main do
  begin
    First;
    while not Eof do
    begin
      if Order_Main.FieldByName('SSel').AsBoolean = True then
      begin
        with ADOQueryTemp do
        begin
          Close;
          sql.Clear;
          sql.Add('select * from CK_MLCP_CR where MJID=' + quotedstr(Trim(Order_Main.fieldbyname('JYID').AsString)));
          sql.Add('and CRFlag=''出库'' ');
          Open;
        end;
        if ADOQueryTemp.RecordCount >= 1 then
        begin
          ADOQueryCmd.Connection.RollbackTrans;
          Application.MessageBox('已出库不能删除!', '提示', 0);
          Exit;
        end;
        with ADOQueryCmd do
        begin
          Close;
          sql.Clear;
          sql.Add('delete JTJY_New where JYID=''' + Trim(Order_Main.fieldbyname('JYID').AsString) + '''');
          sql.Add('delete CK_MLCP_CR where MJID=''' + Trim(Order_Main.fieldbyname('JYID').AsString) + '''');
          sql.Add('delete CK_MLCP_KC where MJID=''' + Trim(Order_Main.fieldbyname('JYID').AsString) + '''');
          ExecSQL;
        end;
        with ADOQueryCmd do
        begin
          Close;
          sql.Clear;
          sql.Add(' exec P_Update_OrderSub :SubId');
          Parameters.ParamByName('SubId').Value:=Trim(Order_Main.fieldbyname('NewSubid').AsString);
          ExecSQL;
        end;
        Order_Main.Delete;
      end
      else
        Next;
    end;
  end;
  Order_Main.EnableControls;
end;

function TfrmJYHZList.Savedata(): Boolean;
var
  maxno, LLID: string;
  HXPS: Integer;
  HXQty, HXMQty: Double;
begin
  HXPS := 0;
  HXQty := 0;
  with ADOQueryTemp do
  begin
    Close;
    sql.Clear;
    sql.Add('select Top 1 * from Contract_Cloth_LL where OrdSubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
    sql.Add(' and FirstName=''' + Trim(Order_Main.fieldbyname('AOrddefstr4').AsString) + '''');
    Open;
  end;
  LLID := Trim(ADOQueryTemp.fieldbyname('LLID').AsString);
  if Trim(LLID) = '' then
  begin
    Result := False;
    Application.MessageBox('没有相对应的加工厂!', '提示', 0);
    Exit;
  end;
  try
    ADOQueryCmd.Connection.BeginTrans;
    if GetLSNo(ADOQueryCmd, maxno, 'HX', 'Contract_Cloth_BefChkHX', 2, 1) = False then
    begin
      Result := False;
      ADOQueryCmd.Connection.RollbackTrans;
      Application.MessageBox('取回修最大号失败!', '提示', 0);
      Exit;
    end;
    with Order_Main do
    begin
      First;
      while not Eof do
      begin
        if Order_Main.FieldByName('SSel').AsBoolean = True then
        begin
          HXPS := HXPS + 1;
          HXQty := HXQty + Order_Main.FieldByName('MJLen').Value;
        end;
        Next;
      end;
    end;
    with ADOQueryCmd do
    begin
      Close;
      sql.Clear;
      sql.Add('');
      Open;
    end;
  except
  end;
end;

procedure TfrmJYHZList.GetCDSData();
begin
  CDS_CD.FieldByName('MJXH').Value := CDS_LS.fieldbyname('MJXH').Value;
  CDS_CD.FieldByName('GangNo').Value := CDS_LS.fieldbyname('Aorddefstr1').Value;
  CDS_CD.FieldByName('PRTColor').Value := CDS_LS.fieldbyname('PRTColor').Value;
  CDS_CD.FieldByName('PRTEColor').Value := CDS_LS.fieldbyname('SOrddefstr4').Value;
  CDS_CD.FieldByName('MJLen').Value := CDS_LS.fieldbyname('MJLen').Value;
  CDS_CD.FieldByName('MJJZ').Value := CDS_LS.fieldbyname('MJQty4').Value;
  CDS_CD.FieldByName('MJMZ').Value := CDS_LS.fieldbyname('MJMaoZ').Value;
  CDS_CD.FieldByName('MJFK').Value := CDS_LS.fieldbyname('MJFK').Value;
  CDS_CD.FieldByName('KFQtyHZ').Value := CDS_LS.fieldbyname('KFQtyHZ').Value;
  CDS_CD.FieldByName('DengJi').Value := CDS_LS.fieldbyname('DengJi').Value;
  CDS_CD.FieldByName('PanDing').Value := CDS_LS.fieldbyname('PanDing').Value;
  CDS_CD.FieldByName('MJID').Value := CDS_LS.fieldbyname('MJID').Value;
end;

procedure TfrmJYHZList.GetBGData();
begin

end;

procedure TfrmJYHZList.v1Column15PropertiesEditValueChanged(Sender: TObject);
var
  mvalue: string;
begin
  mvalue := TcxTextEdit(Sender).EditingText;
  with Order_Main do
  begin
    Edit;
    FieldByName('PanDing').Value := Trim(mvalue);
    Post;
  end;
  with ADOQueryCmd do
  begin
    Close;
    sql.Clear;
    sql.Add('UPdate WFB_MJJY Set PanDing=''' + Trim(mvalue) + '''');
    SQL.Add(' where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
    ExecSQL;
  end;
end;

procedure TfrmJYHZList.CheckBox2Click(Sender: TObject);
begin
  SelOKNo(Order_Main, CheckBox2.Checked);
end;

procedure TfrmJYHZList.BTLPClick(Sender: TObject);
begin
  if CurrentPage > 1 then
    CurrentPage := CurrentPage - 1;
  InitGrid();
end;

procedure TfrmJYHZList.BTNPClick(Sender: TObject);
begin
  if CurrentPage < Order_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
    CurrentPage := CurrentPage + 1;
  InitGrid();
end;

procedure TfrmJYHZList.TCBNORChange(Sender: TObject);
begin
  RecordsNumber := StrToInt(TCBNOR.Text);
  CurrentPage := 1;
  InitGrid();
end;

procedure TfrmJYHZList.MLColorKeyPress(Sender: TObject; var Key: Char);
begin
  if Key=#13 then
  begin
    InitGrid();
  end;
end;

procedure TfrmJYHZList.ToolButton1Click(Sender: TObject);
begin
  PrtDataMD(Trim(Order_Main.fieldbyname('JYID').AsString));
end;

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

procedure TfrmJYHZList.NewMLIDKeyPress(Sender: TObject; var Key: Char);
begin
  if Key=#13 then
  begin
    FNewMLID:=Trim(NewMLID.Text);
    NewMLID.Text:='';
    InitGrid();
  end;
end;

end.


