unit U_CpkcSel;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, ToolWin, StdCtrls, ExtCtrls, cxStyles, cxCustomData,
  cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData,
  cxButtonEdit, cxDropDownEdit, cxGridLevel, cxGridCustomTableView,
  cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
  cxGrid, DBClient, ADODB, cxGridCustomPopupMenu, cxGridPopupMenu, cxCheckBox,
  IdFTP, ShellAPI, strutils, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
  RM_Common, RM_Class, RM_GridReport, RM_e_Xls, RM_System, RM_Dataset, Menus,
  MovePanel, cxContainer, cxTextEdit, cxCurrencyEdit, dxSkinsCore,
  dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee,
  dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
  dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans,
  dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky,
  dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
  dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
  dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
  dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
  dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
  dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin,
  dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
  dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
  dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine,
  dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter;

type
  TfrmCpkcSel = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBExport: TToolButton;
    TBPrint: TToolButton;
    TBClose: TToolButton;
    Panel1: TPanel;
    Label1: TLabel;
    BegDate: TDateTimePicker;
    EndDate: TDateTimePicker;
    cxGrid1: TcxGrid;
    Tv1: TcxGridDBTableView;
    v1P_CodeName: TcxGridDBColumn;
    v1P_SPEC: TcxGridDBColumn;
    v1Qty: TcxGridDBColumn;
    v1Note: TcxGridDBColumn;
    cxGrid1Level1: TcxGridLevel;
    v1CRType: TcxGridDBColumn;
    v1CRTime: TcxGridDBColumn;
    Label2: TLabel;
    Label3: TLabel;
    custName: TEdit;
    CRType: TComboBox;
    Label5: TLabel;
    ADOQueryCmd: TADOQuery;
    ADOQueryTmp: TADOQuery;
    DataSource1: TDataSource;
    CDS_Main: TClientDataSet;
    cxGridPopupMenu1: TcxGridPopupMenu;
    TOk: TToolButton;
    v1Ssel: TcxGridDBColumn;
    CheckBox1: TCheckBox;
    v1MJID: TcxGridDBColumn;
    v1MJXH: TcxGridDBColumn;
    v1CPType: TcxGridDBColumn;
    ckName: TComboBox;
    Label6: TLabel;
    v1P_Code: TcxGridDBColumn;
    Label7: TLabel;
    batchNo: TEdit;
    Label8: TLabel;
    v1Column2: TcxGridDBColumn;
    v1Column3: TcxGridDBColumn;
    P_CodeName: TEdit;
    Label9: TLabel;
    P_Spec: TEdit;
    Label10: TLabel;
    Label11: TLabel;
    P_Color: TEdit;
    Label12: TLabel;
    P_KZ_S: TEdit;
    orderNo: TEdit;
    Label4: TLabel;
    v1Column4: TcxGridDBColumn;
    ToolButton1: TToolButton;
    defstr1: TEdit;
    Label13: TLabel;
    P_Code: TEdit;
    Label14: TLabel;
    v1Column6: TcxGridDBColumn;
    v1Column7: TcxGridDBColumn;
    Tv1Column1: TcxGridDBColumn;
    Tv1Column2: TcxGridDBColumn;
    CDS_Sub: TClientDataSet;
    DataSource2: TDataSource;
    ADOQuerySub: TADOQuery;
    Tv1Column3: TcxGridDBColumn;
    RMDB_Main: TRMDBDataSet;
    AdoPrint: TADOQuery;
    RMXLSExport1: TRMXLSExport;
    RMGridReport1: TRMGridReport;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    MovePanel2: TMovePanel;
    Label15: TLabel;
    DRCKName: TEdit;
    GroupBox2: TGroupBox;
    cxGrid2: TcxGrid;
    TV2: TcxGridDBTableView;
    TV2Column1: TcxGridDBColumn;
    TV2Column14: TcxGridDBColumn;
    TV2Column2: TcxGridDBColumn;
    TV2Column3: TcxGridDBColumn;
    TV2Column4: TcxGridDBColumn;
    TV2Column5: TcxGridDBColumn;
    TV2Column6: TcxGridDBColumn;
    TV2Column7: TcxGridDBColumn;
    TV2Column15: TcxGridDBColumn;
    TV2Column8: TcxGridDBColumn;
    TV2Column9: TcxGridDBColumn;
    TV2Column10: TcxGridDBColumn;
    TV2Column11: TcxGridDBColumn;
    TV2Column12: TcxGridDBColumn;
    TV2Column13: TcxGridDBColumn;
    cxGridLevel1: TcxGridLevel;
    GroupBox1: TGroupBox;
    cxGrid3: TcxGrid;
    TV3: TcxGridDBTableView;
    cxGridLevel2: TcxGridLevel;
    ADOQueryYck: TADOQuery;
    DataSource3: TDataSource;
    CDS_Yck: TClientDataSet;
    TV3Column1: TcxGridDBColumn;
    TV3Column2: TcxGridDBColumn;
    TV3Column3: TcxGridDBColumn;
    TV3Column4: TcxGridDBColumn;
    TV3Column5: TcxGridDBColumn;
    TV3Column6: TcxGridDBColumn;
    TV3Column7: TcxGridDBColumn;
    TV3Column8: TcxGridDBColumn;
    TV3Column9: TcxGridDBColumn;
    TV3Column10: TcxGridDBColumn;
    TV3Column11: TcxGridDBColumn;
    TV3Column12: TcxGridDBColumn;
    TV3Column13: TcxGridDBColumn;
    TV3Column14: TcxGridDBColumn;
    TV3Column15: TcxGridDBColumn;
    ToolButton2: TToolButton;
    Panel9: TPanel;
    Label32: TLabel;
    Button11: TButton;
    Button12: TButton;
    Edit1: TEdit;
    ToolButton3: TToolButton;
    Panel2: TPanel;
    Label16: TLabel;
    Button1: TButton;
    Button2: TButton;
    Edit2: TEdit;
    TV2Column16: TcxGridDBColumn;
    TV3Column16: TcxGridDBColumn;
    TV2Column17: TcxGridDBColumn;
    TV3Column17: TcxGridDBColumn;
    Tv1Column5: TcxGridDBColumn;
    Tv1Column6: TcxGridDBColumn;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormDestroy(Sender: TObject);
    procedure custNameChange(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure TBCloseClick(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure TBPrintClick(Sender: TObject);
    procedure TBExportClick(Sender: TObject);
    procedure TOkClick(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
    procedure N1Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    procedure Button11Click(Sender: TObject);
    procedure Button12Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure ToolButton3Click(Sender: TObject);

 
  private
    procedure InitGrid();
    procedure InitSub();
    procedure SetComboBox();
    { Private declarations }
  public
    fType: integer;
    fCKName: string;

    { Public declarations }
  end;

var
  frmCpkcSel: TfrmCpkcSel;

implementation

uses
  U_DataLink, U_Fun10, U_ZDYHelp, U_BpRk;
{$R *.dfm}

procedure TfrmCpkcSel.SetComboBox();
begin
  ckName.Items.Clear;
  with adoQueryTmp do
  begin
    close;
    sql.Clear;
    sql.Add('select * from KH_ZDY where Type=''CPCK'' ');
    if trim(fCKName) <> '' then
      sql.Add('and zdyName=' + quotedstr(trim(fCKName)));
    open;
    while not eof do
    begin
      ckName.Items.Add(trim(fieldbyname('zdyName').AsString));
      next;
    end;
  end;
  if ckName.Items.Count > 0 then
    ckName.ItemIndex := 0;

  CRType.Items.Clear;
  CRType.Items.Add('');
  with adoQueryTmp do
  begin
    close;
    sql.Clear;
    sql.Add('select * from KH_ZDY where Type=''CPRKTYPE''');
    if trim(fCKName) <> '' then
      sql.Add('and note=' + quotedstr(trim(fCKName)));
    open;
    while not eof do
    begin
      CRType.Items.Add(trim(fieldbyname('zdyName').AsString));
      next;
    end;
  end;
  if CRType.Items.Count > 0 then
    CRType.ItemIndex := 0;                          
end;

procedure TfrmCpkcSel.InitGrid();
begin
  MovePanel2.Visible := True;
  try
    with adoqueryTmp do
    begin
      close;
      sql.Clear;
      sql.Add('exec P_Get_CP_KCsel');
      open;
    end;
    SCreateCDS20(adoqueryTmp, CDS_Main);
    SInitCDSData20(adoqueryTmp, CDS_Main);
  finally
  end;
  MovePanel2.Visible := False;
end;

procedure TfrmCpkcSel.InitSub();
begin
  if CDS_Main.IsEmpty then
    Exit;
  try
    with adoquerysub do
    begin
      close;
      sql.Clear;
      sql.Add('exec P_Get_CP_KC_MX ''' + Cds_main.fieldbyname('P_CodeName').AsString + ''' ,''' + Cds_main.fieldbyname('P_Code').AsString + ''' ');
      sql.Add(',''' + Cds_main.fieldbyname('DRCKNO').AsString + ''' ,''' + Cds_main.fieldbyname('DRCKName').AsString + '''');
//      ShowMessage(SQL.text);
      open;
    end;
    SCreateCDS20(adoquerysub, CDS_Sub);
    SInitCDSData20(adoquerysub, CDS_Sub);

    with ADOQueryYck do
    begin
      close;
      sql.Clear;
      sql.Add('exec P_Get_CP_KC_MX_Yck ''' + Cds_main.fieldbyname('P_CodeName').AsString + ''' ,''' + Cds_main.fieldbyname('P_Code').AsString + ''' ');
      sql.Add(',''' + Cds_main.fieldbyname('DRCKNO').AsString + ''' ,''' + Cds_main.fieldbyname('DRCKName').AsString + '''');
//      ShowMessage(SQL.text);
      open;
    end;
    SCreateCDS20(ADOQueryYck, CDS_Yck);
    SInitCDSData20(ADOQueryYck, CDS_Yck);
  finally
  end;                                               
end;

procedure TfrmCpkcSel.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  writeCxGrid(self.Caption + tv1.Name + '3', Tv1, '成品仓库');
  if fType = 10 then
    Action := cahide
  else
    Action := cafree;
end;

procedure TfrmCpkcSel.FormDestroy(Sender: TObject);
begin
  frmCpkcSel := nil;
end;

procedure TfrmCpkcSel.custNameChange(Sender: TObject);
begin
  if ADOQueryTmp.Active = False then
    Exit;
  SDofilter(ADOQueryTmp, SGetFilters(Panel1, 1, 2));
  SCreateCDS20(ADOQueryTmp, CDS_Main);
  SInitCDSData20(ADOQueryTmp, CDS_Main);
end;

procedure TfrmCpkcSel.FormShow(Sender: TObject);
begin
  if fType = 10 then
  begin
    TOk.Visible := true;
  end;
  v1Ssel.Visible := true;
  readCxGrid(self.Caption + tv1.Name + 'KC', Tv1, '成品仓库');
  SetComboBox();
  InitGrid();
end;

procedure TfrmCpkcSel.FormCreate(Sender: TObject);
begin
  BegDate.Date := DServerDate - 7;
  EndDate.Date := DServerDate;
  cxGrid1.Align := alclient;

end;

procedure TfrmCpkcSel.TBCloseClick(Sender: TObject);
begin
  close;
end;

procedure TfrmCpkcSel.TBRafreshClick(Sender: TObject);
begin

  initGrid();
end;

procedure TfrmCpkcSel.TBPrintClick(Sender: TObject);
begin
  if CDS_Main.IsEmpty then
    Exit;
  TcxGridToExcel(self.Caption, cxgrid1);
end;

procedure TfrmCpkcSel.TBExportClick(Sender: TObject);
var
  filepath: string;
  sqlstr: string;
  i: Integer;
begin
  if CDS_Main.IsEmpty then
    exit;

  if CDS_Main.Locate('SSel', True, []) = False then
  begin
    Application.MessageBox('没有选择数据!', '提示', 0);
    Exit;
  end;

  with ADOQueryTmp do
  begin
    close;
    SQL.Clear;
    sql.Add('delete CPKC_Print ');
    ExecSQL;
  end;
  Tv1.OnFocusedRecordChanged := nil;
  sqlstr := '';
  i := 0;
  MovePanel2.Visible := True;
  with CDS_Main do                               
  begin
    First;
    while CDS_Main.Locate('SSel', true, []) do
    begin
      sqlstr := sqlstr + Cds_main.fieldbyname('P_CodeName').AsString + Cds_main.fieldbyname('P_Code').AsString + Cds_main.fieldbyname('DRCKNO').AsString + Cds_main.fieldbyname('DRCKName').AsString + ',';

//      sqlstr := sqlstr + 'exec P_Get_CP_KC_copy1 ''' + Cds_main.fieldbyname('P_CodeName').AsString + ''' ,''' + Cds_main.fieldbyname('P_Code').AsString + '''';
//      sqlstr := sqlstr + ',''' + Cds_main.fieldbyname('DRCKNO').AsString + ''' ,''' + Cds_main.fieldbyname('DRCKName').AsString + ''' ';
//      i := i + 1;
//      with ADOQueryTmp do
//      begin
//        close;
//        sql.Clear;
//        sql.Add('exec P_Get_CP_KC_copy1 ''' + Cds_main.fieldbyname('P_CodeName').AsString + ''' ,''' + Cds_main.fieldbyname('P_Code').AsString + ''' ');
//        sql.Add(',''' + Cds_main.fieldbyname('DRCKNO').AsString + ''' ,''' + Cds_main.fieldbyname('DRCKName').AsString + '''');
////      ShowMessage(SQL.text);
//        ExecSQL;
//      end;
      Delete;
//      if i = 50 then
//      begin
//        i := 0;
//        sqlstr := '';
//      end;

    end;
  end;

  sqlstr := Copy(sqlstr, 1, Length(sqlstr) - 1);

  with ADOQueryTmp do
  begin
    close;
    SQL.Clear;
    sql.Add('exec P_Get_CP_KC_copy3 ' + QuotedStr(sqlstr));
//    ShowMessage(SQL.Text);
    ExecSQL;
  end;
//  ShowMessage(sqlstr);
//  with ADOQueryTmp do
//  begin
//    close;
//    SQL.Clear;
//    sql.Add(sqlstr);
////          ShowMessage(SQL.text);
//    ExecSQL;
//  end;

  with AdoPrint do
  begin
    close;
    sql.Clear;
    sql.Add('select A.* from CPKC_Print A');
    sql.Add('order by P_Code,P_Color,');
    sql.Add('case when defstr1=''CXXS'' then 1 when defstr1=''CXS'' then 2 when defstr1=''CS'' then 3 ');
    sql.Add(' when defstr1=''CM'' then 4 when defstr1=''CL'' then 5 when defstr1=''CXL'' then 6');
    sql.Add(' when defstr1=''AXS'' then 7 when defstr1=''AS'' then 8 when defstr1=''AM'' then 9');
    sql.Add(' when defstr1=''AL'' then 10 when defstr1=''AXL'' then 11 when defstr1=''AXXL'' then 12');
    sql.Add('else 99 end ');
//       ShowMessage(sql.Text);
    open;
  end;

  try
    filepath := ExtractFilePath(Application.ExeName) + 'report\库存明细.rmf';
    if not FileExists(Pchar(filepath)) then
    begin
      application.MessageBox(pchar('文件[' + filepath + ']不存在！'), '提示信息', MB_IConError);
      exit;
    end;
    RMGridReport1.LoadFromFile(filepath);
    RMGridReport1.ShowReport;
  finally
    Tv1.OnFocusedRecordChanged := Tv1FocusedRecordChanged;
    InitGrid();
  end;
  MovePanel2.Visible := False;

end;
//begin                                        
//  if CDS_Main.IsEmpty then
//    Exit;
//  TcxGridToExcel(self.Caption, cxgrid1);

//end;

procedure TfrmCpkcSel.TOkClick(Sender: TObject);
begin
  if CDS_Main.IsEmpty then
    Exit;
  ModalResult := 1;
end;

procedure TfrmCpkcSel.ToolButton1Click(Sender: TObject);
var
  IdFTP1: TIdFTP;
  FileName, FPath, FFName: string;
  FInt: integer;
begin
  if CDS_Main.IsEmpty then
    Exit;
  with adoqueryCmd do
  begin
    close;
    sql.Clear;
    sql.Add('select * from TP_File ');
    sql.Add('where WBID=' + quotedstr(trim(CDS_Main.fieldbyname('orderNo').AsString)));
    //sql.Add('and TFType=''产品''');
    open;
  end;
  if adoqueryCmd.IsEmpty then
  begin
    application.MessageBox('此指示单没有图样信息！', '提示信息', MB_ICONERROR);
    exit;
  end;
  FileName := adoqueryCmd.fieldbyname('FileName').AsString;

  try
    IdFTP1 := TIdFTP.Create(self);
    IdFTP1.Host := server;
    IdFTP1.Username := 'three';
    IdFTP1.Password := '641010';
    IdFTP1.Connect();
  except
    IdFTP1.Quit;
    IdFTP1.Free;
    Application.MessageBox('无法连接到文件服务器，请检查！', '提示', MB_ICONWARNING);
    Exit;
  end;
  FPath := Leftstr(ExtractFilePath(Application.ExeName), 1) + ':\图片查看\';
  if not DirectoryExists(ExtractFileDir(FPath)) then
    CreateDir(ExtractFileDir(FPath));
  FFName := Trim(FileName);
  FFName := FPath + FFName;
  deleteFile(FFName);
  IdFTP1.Get('TP\' + FileName, FFName);
  if IdFTP1.Connected then
  begin
    IdFTP1.Quit;
    IdFTP1.Free;
  end;
  try
    ShellExecute(Handle, 'open', PChar(FFName), '', '', SW_SHOWNORMAL);
  except
  end;

end;

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

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

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

procedure TfrmCpkcSel.ToolButton2Click(Sender: TObject);
begin
  Panel9.Left := (self.Width - Panel9.Width) div 2;
  Panel9.Visible := true;
end;

procedure TfrmCpkcSel.Button11Click(Sender: TObject);
begin
  if CDS_Main.IsEmpty then
    Exit;
  if CDS_Main.Locate('SSel', True, []) = False then
  begin
    Application.MessageBox('没有选择数据!', '提示', 0);
    Exit;
  end;
  try
    CDS_Main.DisableControls;
    ADOQueryCmd.Connection.BeginTrans;
    with CDS_Main do
    begin
      First;
      while not Eof do
      begin
        if CDS_Main.FieldByName('SSel').AsBoolean = True then
        begin
          with ADOQueryCmd do
          begin
            Close;
            sql.Clear;
            sql.Add('Update CP_inout Set DRCKNO=''' + trim(Edit1.Text) + ''' ');
            sql.Add('where P_CodeName=''' + Trim(CDS_Main.fieldbyname('P_CodeName').AsString) + '''');
            sql.Add('and  P_Code=''' + Trim(CDS_Main.fieldbyname('P_Code').AsString) + '''');
            sql.Add('and DRCKNO=''' + Trim(CDS_Main.fieldbyname('DRCKNO').AsString) + '''');
            sql.Add('and DRCKName=''' + Trim(CDS_Main.fieldbyname('DRCKName').AsString) + '''');
//            sql.add('where AA.P_CodeName='FAIRY' and AA.P_Code='1505-C'  and isnull(DRCKNO,'')='101' and isnull(DRCKName,'')='工厂成衣仓'');
            ExecSQL;
          end;
        end;
        Next;
      end;
    end;
    ADOQueryCmd.Connection.CommitTrans;
    CDS_Main.EnableControls;
    application.MessageBox('数据保存成功！', '提示信息');
    Panel9.Visible := false;
    TBRafresh.Click;
  except
    ADOQueryCmd.Connection.RollbackTrans;
    CDS_Main.EnableControls;
    application.MessageBox('数据保存失败！', '提示信息', 0);
  end;
end;

procedure TfrmCpkcSel.Button12Click(Sender: TObject);
begin
  Panel9.Visible := false;
end;

procedure TfrmCpkcSel.Button1Click(Sender: TObject);
begin
  if CDS_Main.IsEmpty then
    Exit;
  if CDS_Main.Locate('SSel', True, []) = False then
  begin
    Application.MessageBox('没有选择数据!', '提示', 0);
    Exit;
  end;
  try
    CDS_Main.DisableControls;
    ADOQueryCmd.Connection.BeginTrans;
    with CDS_Main do
    begin
      First;
      while not Eof do
      begin
        if CDS_Main.FieldByName('SSel').AsBoolean = True then
        begin
          with ADOQueryCmd do
          begin
            Close;
            sql.Clear;
            sql.Add('Update CP_inout Set DRCKName=''' + trim(Edit2.Text) + ''' ');
            sql.Add('where P_CodeName=''' + Trim(CDS_Main.fieldbyname('P_CodeName').AsString) + '''');
            sql.Add('and P_Code=''' + Trim(CDS_Main.fieldbyname('P_Code').AsString) + '''');
            sql.Add('and DRCKNO=''' + Trim(CDS_Main.fieldbyname('DRCKNO').AsString) + '''');
            sql.Add('and DRCKName=''' + Trim(CDS_Main.fieldbyname('DRCKName').AsString) + '''');
//            sql.add('where AA.P_CodeName='FAIRY' and AA.P_Code='1505-C'  and isnull(DRCKNO,'')='101' and isnull(DRCKName,'')='工厂成衣仓'');
            ExecSQL;
          end;
        end;
        Next;
      end;
    end;
    ADOQueryCmd.Connection.CommitTrans;
    CDS_Main.EnableControls;
    application.MessageBox('数据保存成功！', '提示信息');
    Panel2.Visible := false;
    TBRafresh.Click;
  except
    ADOQueryCmd.Connection.RollbackTrans;
    CDS_Main.EnableControls;
    application.MessageBox('数据保存失败！', '提示信息', 0);
  end;
end;

procedure TfrmCpkcSel.Button2Click(Sender: TObject);
begin
  Panel2.Visible := false;
end;

procedure TfrmCpkcSel.ToolButton3Click(Sender: TObject);
begin
  Panel2.Left := (self.Width - Panel2.Width) div 2;
  Panel2.Visible := true;
end;


end.

