?? sjsbfrm.pas
字號:
unit sjsbfrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Gauges, StdCtrls, Buttons, backup;
type
Tsjsb = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Gauge1: TGauge;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
BackupFile1: TBackupFile;
Edit1: TEdit;
Label3: TLabel;
SpeedButton4: TSpeedButton;
SaveDialog1: TSaveDialog;
ListBox1: TListBox;
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure BackupFile1NeedDisk(Sender: TObject; DiskID: Word;
var Continue: Boolean);
procedure BackupFile1Progress(Sender: TObject; Filename: String;
Percent: TPercentage; var Continue: Boolean);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
sjsb: Tsjsb;
implementation
uses datafrm, mainfrm;
{$R *.dfm}
procedure Tsjsb.SpeedButton2Click(Sender: TObject);
begin
close;
end;
procedure Tsjsb.SpeedButton4Click(Sender: TObject);
begin
sjsb.SaveDialog1.InitialDir:=extractfilepath(application.ExeName)+'sb';
sjsb.SaveDialog1.Execute;
if sjsb.SaveDialog1.FileName<>'' then
if extractFileExt(sjsb.SaveDialog1.FileName)<>'.sb' then
sjsb.Edit1.Text:=sjsb.SaveDialog1.FileName+'.sb'
else
sjsb.Edit1.Text:=sjsb.SaveDialog1.FileName;
end;
procedure Tsjsb.BackupFile1NeedDisk(Sender: TObject; DiskID: Word;
var Continue: Boolean);
begin
Continue := MessageDlg('請插入下一張磁盤' +inttostr(DiskID)+'后并按下OK鍵以繼續',mtInformation, mbOKCancel, 0) = mrOK;
end;
procedure Tsjsb.BackupFile1Progress(Sender: TObject; Filename: String;
Percent: TPercentage; var Continue: Boolean);
begin
sjsb.Label2.caption:= extractfilename(filename);
sjsb.Gauge1.Progress:= percent;
if sjsb.SpeedButton2.down then Continue := false;
end;
procedure Tsjsb.SpeedButton1Click(Sender: TObject);
begin
if sjsb.Edit1.Text<>'' then
begin
if fileexists(sjsb.Edit1.Text) then
begin
if messagebox(sjsb.Handle,'文件已經存在,確認要覆蓋此文件嗎?','營房工作管理系統',33)=1 then
begin
sjsb.Label2.Caption:='正在搜集上報數據...';
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_dwqk.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_yfzl.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_guolu.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_gx.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_xjyf.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_yfda.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_yffd.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_yfsb.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_yfwz.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_dt.*');
sjsb.SpeedButton1.Enabled:=false;
sjsb.SpeedButton2.Enabled:=false;
main.Timer1.Enabled:=false;
yfgldata.Free;
if sjsb.BackupFile1.Backup(listbox1.items,sjsb.Edit1.Text) then
messagebox(sjsb.handle,pansichar('數據上報文件制作完畢,共有'+inttostr(sjsb.BackupFile1.FilesTotal)+'個文件,'+inttostr(sjsb.BackupFile1.SizeTotal)+'字節。'),'營房工作管理系統',mb_iconexclamation)
else
messagebox(sjsb.handle,'壓縮過程發生錯誤。','營房工作管理系統',16);
application.CreateForm(tyfgldata,yfgldata);
main.Timer1.Enabled:=true;
sjsb.Close;
end
end
else
begin
sjsb.Label2.Caption:='正在搜集上報數據...';
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_dwqk.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_yfzl.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_guolu.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_gx.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_xjyf.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_yfda.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_yffd.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_yfsb.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_yfwz.*');
sjsb.ListBox1.Items.Add(extractfilepath(application.ExeName)+'data\yfgl_dt.*');
sjsb.SpeedButton1.Enabled:=false;
sjsb.SpeedButton2.Enabled:=false;
main.Timer1.Enabled:=false;
yfgldata.Free;
if sjsb.BackupFile1.Backup(listbox1.items,sjsb.Edit1.Text) then
messagebox(sjsb.handle,pansichar('數據上報文件制作完畢,共有'+inttostr(sjsb.BackupFile1.FilesTotal)+'個文件,'+inttostr(sjsb.BackupFile1.SizeTotal)+'字節。'),'營房工作管理系統',mb_iconexclamation)
else
messagebox(sjsb.handle,'壓縮過程發生錯誤。','營房工作管理系統',16);
application.CreateForm(tyfgldata,yfgldata);
main.Timer1.Enabled:=true;
sjsb.close;
end;
end
else
messagebox(sjsb.handle,'請選擇上報文件存放路徑。','營房工作管理系統',16);
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -