📄 systeminit.~pas
字号:
//
//模块名称:初始化导入
//编写:陈剑
//日期:2002年4月16日
//修改:
//参数说明:
//
unit systeminit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, basepop, TFlatListBoxUnit, StdCtrls, TFlatMemoUnit,
TFlatButtonUnit, TFlatEditUnit, DB, DBTables, TFlatCheckBoxUnit, RxMemDS;
const
cLicenseString = '17055475153342401579512r612895AS';
type
TSystemInit_form = class(Tbasepop_form)
FlatEdit1: TFlatEdit;
FlatButton1: TFlatButton;
Label1: TLabel;
FlatButton2: TFlatButton;
Label2: TLabel;
FlatEdit2: TFlatEdit;
OpenDialog1: TOpenDialog;
ListBox1: TListBox;
Memo1: TMemo;
Query1: TQuery;
FlatCheckBox1: TFlatCheckBox;
procedure FlatButton1Click(Sender: TObject);
procedure FlatButton2Click(Sender: TObject);
procedure FlatButton3Click(Sender: TObject);
procedure inittab(filename,dirname,sqlstr,fldtype:string);
private
QueryImp:array of TQuery;
k:integer;
{ Private declarations }
public
{ Public declarations }
end;
function XceedZipInitDLL : LongInt; stdcall; external 'XceedZip.DLL';
function XceedZipShutdownDLL : LongInt; stdcall; external 'XceedZip.DLL';
function XzCreateXceedZipA( pszLicense : PChar) : LongInt; stdcall; external 'XceedZip.DLL';
procedure XzSetZipFilenameA( hZip : LongInt; pszValue : PChar); stdcall; external 'XceedZip.DLL';
procedure XzSetProcessSubfolders( hZip : LongInt; bValue : LongInt ); stdcall; external 'XceedZip.DLL';
procedure XzSetUnzipToFolderA( hZip : LongInt; pszValue : PChar); stdcall; external 'XceedZip.DLL';
procedure XzDestroyXceedZip( hZip : LongInt ); stdcall; external 'XceedZip.DLL';
function XzUnzip( hZip : LongInt ) : LongInt; stdcall; external 'XceedZip.DLL';
var
SystemInit_form: TSystemInit_form;
implementation
uses datashare;
{$R *.dfm}
{procedure TSystemInit_form.inittab(filename,dirname,sqlstr,fldtype:string);
var
F:textfile;
i:integer;
catstr:string;
ch:string;
begin
if fileexists(dirname+'\'+filename+'.txt') then
begin
QueryImp[k].Close;
QueryImp[k].SQL.Clear;
QueryImp[k].SQL.Add('select '+sqlstr+' from '+filename);
QueryImp[k].Active:=true;
for i:=1 to length(sqlstr) do
begin
ch:=copy(sqlstr,i,1);
if (ch<>',') or (i<>length(sqlstr)) then
catstr:=catstr+ch
else
QueryImp[k].FieldDefList.Add(catstr);
end;
QueryImp[k].Append;
QueryImp[k].Fields[0].AsString:='ab';
queryImp[k].Post;
QueryImp[k].ApplyUpdates;
Assignfile(F,pchar(dirname+'\'+filename+'.txt'));
Reset(F);
closeFile(F);
end else
begin
application.MessageBox('选定的文件包不合法!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
flatedit1.SetFocus;
exit;
end;
end;
}
procedure TSystemInit_form.FlatButton1Click(Sender: TObject);
begin
inherited;
if OpenDialog1.Execute then
FlatEdit1.Text:=OpenDialog1.FileName;
end;
procedure TSystemInit_form.FlatButton2Click(Sender: TObject);
var
hUnZip:integer;
F:textfile;
dirstr,catstr:string;
ch:char;
p:integer;
exitflag:boolean;
i,n:integer;
sqlstr,typestr:string;
begin
inherited;
if trim(Flatedit1.Text)='' then
begin
application.MessageBox('请选择指定文件!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
Flatedit1.SetFocus;
exit;
end;
if trim(Flatedit2.Text)='' then
begin
application.MessageBox('请输入单位编号!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
Flatedit2.SetFocus;
exit;
end;
dirstr:=ExtractFileDir(Pchar(Flatedit1.Text));
XceedZipInitDLL; //解压缩
hUnZip:= XzCreateXceedZipA( cLicenseString );
XzSetZipFilenameA( hUnZip,PChar(Flatedit1.Text));
XzSetProcessSubfolders( hUnZip, 0 );
XzSetUnzipToFolderA( hUnZip, pchar(dirstr) );
XzUnzip( hUnZip );
XzDestroyXceedZip( hUnZip );
XceedZipShutdownDLL;
//单位编号的检验
if fileexists(dirstr+'\cparch.txt') then
begin
try
Assignfile(F,pchar(dirstr+'\cparch.txt'));
Reset(F);
catstr:='';
while not eof(F) do
begin
read(F,ch);
if (ch=chr(9)) then
begin
inc(p);
if p=2 then //单位编号与输入的单位编号比较
begin
if trim(catstr)<>trim(flatedit2.Text) then
begin
application.MessageBox('请检查单位编号的输入是否有误!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
flatedit2.SetFocus;
exitflag:=true;
end;
break;
end;
catstr:='';
end else
catstr:=catstr+ch;
end;
closeFile(F);
except
application.MessageBox('打开文件失败!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
exit;
end;
end
else
begin
application.MessageBox('选定的文件包不合法!','恩普软件',MB_OK+MB_IconStop+MB_SystemModal);
flatedit1.SetFocus;
exit;
end;
if exitflag then
exit
else begin
n:=2;
setlength(QueryImp,n);
for i:=0 to n-1 do
begin
QueryImp[i]:=TQuery.Create(self);
QueryImp[i].DatabaseName:='esiis';
QueryImp[i].CachedUpdates:=true;
end;
sqlstr:='CPSENO,CPCODE,CPNAME,REGNO,TAXNO,ECCODE,ATCODE,SBCODE,DPCODE,TDCODE,ADDRESS,ZIP,CHIEF,WALLA,WALLADEPT,WATEL,LICODE,LICNO,LIDATE,LILIFE,AUFILE,CHID,CHTEL';
typestr:='N,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C';
// inittab('cparch',dirstr,sqlstr,typestr);
end;
end;
procedure TSystemInit_form.FlatButton3Click(Sender: TObject);
begin
inherited;
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -