You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
155 lines
5.3 KiB
Plaintext
155 lines
5.3 KiB
Plaintext
unit u_sys_update_net;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, ComCtrls, ExtCtrls, DB, ADODB,inifiles, StdCtrls,ShellApi;
|
|
|
|
type
|
|
Tfrm_sys_update_net = class(TForm)
|
|
Animate1: TAnimate;
|
|
Panel1: TPanel;
|
|
t_sys_soft_do: TADOQuery;
|
|
t_sys_soft_doDSDesigner: TStringField;
|
|
t_sys_soft_doDSDesigner2: TBlobField;
|
|
t_sys_soft_doDSDesigner1: TStringField;
|
|
t_sys_soft_doDSDesigner22: TStringField;
|
|
t_sys_soft_doDSDesigner3: TStringField;
|
|
RichEdit1: TMemo;
|
|
p_update: TADOStoredProc;
|
|
t_sys_soft_update: TADOQuery;
|
|
db_update: TADOConnection;
|
|
t_sql: TADOQuery;
|
|
t_readme: TADOQuery;
|
|
procedure FormShow(Sender: TObject);
|
|
procedure db_updateBeforeConnect(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frm_sys_update_net: Tfrm_sys_update_net;
|
|
|
|
implementation
|
|
|
|
uses u_main, my_sys_function, u_sys_update, my_sys_chat;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure Tfrm_sys_update_net.FormShow(Sender: TObject);
|
|
var
|
|
table:Tadoquery;
|
|
inifile1:Tinifile;
|
|
str:string;
|
|
j:integer;
|
|
if_add:boolean;
|
|
if_error:boolean;
|
|
begin
|
|
try
|
|
if not DirectoryExists(ExtractFilePath(Application.ExeName)+'update') then
|
|
CreateDir(ExtractFilePath(Application.ExeName)+'update');
|
|
frm_main.Hide;
|
|
table:=Tadoquery.Create(application);
|
|
table.Connection:=frm_main.db;
|
|
table.SQL.text:='select 版本号,版本1,版本2,版本3 from t_sys_soft';
|
|
table.open;
|
|
j:=strtoint(table.fieldbyname('版本1').asstring)*10000
|
|
+strtoint(table.fieldbyname('版本2').asstring)*100
|
|
+strtoint(table.fieldbyname('版本3').asstring);
|
|
Panel1.Caption:='软件下载中...';
|
|
update_soft_down;
|
|
Panel1.Caption:='软件升级中...';
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'update\'+'版本号.ini');
|
|
str:=inifile1.ReadString('版本号','版本1','');
|
|
str:=str+inifile1.ReadString('版本号','版本2','');
|
|
str:=str+inifile1.ReadString('版本号','版本3','');
|
|
inifile1.Free;
|
|
t_sql.close;
|
|
t_sql.Parameters.ParamByName('版本号').value:=j;
|
|
t_sql.open;
|
|
t_readme.close;
|
|
t_readme.Parameters.ParamByName('版本号').value:=j;
|
|
t_readme.open;
|
|
t_sys_soft_update.open;
|
|
|
|
t_sql.first;
|
|
while not t_sql.eof do
|
|
begin
|
|
try
|
|
p_update.Parameters.ParamByName('SQLStr').value:=t_sql.fieldbyname('执行').asstring;
|
|
p_update.ExecProc;
|
|
except
|
|
frm_sys_update.t_sys_soft_error.insert;
|
|
frm_sys_update.t_sys_soft_error['针对版本']:=j;
|
|
frm_sys_update.t_sys_soft_error['升级日期']:=date;
|
|
frm_sys_update.t_sys_soft_error['升级人']:=employee;
|
|
frm_sys_update.t_sys_soft_error['执行文件']:=t_sql.fieldbyname('执行').asstring;
|
|
frm_sys_update.t_sys_soft_error.post;
|
|
if_error:=true;
|
|
end;
|
|
t_sql.next;
|
|
end;
|
|
|
|
t_readme.first;
|
|
while not t_readme.eof do
|
|
begin
|
|
t_sys_soft_update.insert;
|
|
t_sys_soft_update['版本号']:=copy(t_readme.fieldbyname('版本号').asstring,1,1)
|
|
+'.'+copy(t_readme.fieldbyname('版本号').asstring,2,2)
|
|
+'.'+copy(t_readme.fieldbyname('版本号').asstring,4,2);
|
|
t_sys_soft_update['升级说明']:=t_readme.fieldbyname('更新说明').asstring;
|
|
t_sys_soft_update['升级日期']:=date;
|
|
t_sys_soft_update.post;
|
|
t_readme.next;
|
|
end;
|
|
|
|
t_sys_soft_do.close;
|
|
t_sys_soft_do.open;
|
|
if_add:=true;
|
|
while if_add do
|
|
begin
|
|
try
|
|
t_sys_soft_do.edit;
|
|
t_sys_soft_do['版本号']:=copy(str,1,1)+'.'+copy(str,2,2)+'.'+copy(str,4,2);
|
|
t_sys_soft_do['版本1']:=copy(str,1,1);
|
|
t_sys_soft_do['版本2']:=copy(str,2,2);
|
|
t_sys_soft_do['版本3']:=copy(str,4,2);
|
|
t_sys_soft_doDSDesigner2.LoadFromFile(ExtractFilePath(Application.ExeName)+'update\'+'鑫海达航运物流管理系统.zip');
|
|
t_sys_soft_do.Post;
|
|
if_add:=false;
|
|
except
|
|
sleep(1000);
|
|
end;
|
|
end;
|
|
if if_error then
|
|
showmessage('软件升级过程中产生错误,请登陆软件进行修复!!');
|
|
if update_soft_banben_bendi(frm_main.db) then
|
|
begin
|
|
SendMsg_gonggao('52','软件系统已经升级,请退出重新登陆新版本!!');
|
|
ShellExecute(Application.Handle,nil,PChar(ExtractFilePath(Application.ExeName)+'update.exe'),nil,nil,SW_NORMAL);
|
|
application.Terminate;
|
|
end;
|
|
finally
|
|
table.free;
|
|
end;
|
|
end;
|
|
|
|
procedure Tfrm_sys_update_net.db_updateBeforeConnect(Sender: TObject);
|
|
begin
|
|
db_update.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='
|
|
+ExtractFilePath(Application.ExeName)+'update\update.mdb;'
|
|
+'Mode=Share Deny None;Extended Properties="";'
|
|
+'Jet OLEDB:System database="";Jet OLEDB:Registry Path="";'
|
|
+'Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;'
|
|
+'Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;'
|
|
+'Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";'
|
|
+'Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;'
|
|
+'Jet OLEDB:Don'+''''+'t Copy Locale on Compact=False;'
|
|
+'Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False';
|
|
end;
|
|
|
|
end.
|