sjsbfrm.pas
来自「本人编写的有关军队营房工作的管理系统」· PAS 代码 · 共 138 行
PAS
138 行
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 + =
减小字号Ctrl + -
显示快捷键?