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.

197 lines
6.0 KiB
Plaintext

11 months ago
unit u_sys_print_down;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid,IdFTPCommon,
DB, RxMemDS, bsSkinCtrls, IdFTP, StdCtrls, DBCtrls, ExtCtrls;
type
Tfrm_sys_print_down = class(TForm)
bsBusinessSkinForm1: TbsBusinessSkinForm;
t_down_list: TRxMemoryData;
t_down_list1: TDataSource;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridMaskColumn;
dxDBGrid1Column4: TdxDBGridColumn;
Panel1: TPanel;
bsSkinButton3: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
procedure FormShow(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_sys_print_down: Tfrm_sys_print_down;
implementation
uses u_sys_print, u_main, u_data_share,
u_sys_print_view;
{$R *.dfm}
procedure Tfrm_sys_print_down.FormShow(Sender: TObject);
var
line:string;
i:integer;
IdFTP1: TIdFTP;
str_list: TListBox;
begin
try
idftp1:=tidftp.Create(application);
str_list:=Tlistbox.Create(nil);
str_list.Visible:=false;
str_list.Parent:=frm_sys_print_down;
t_down_list.close;
t_down_list.open;
with idftp1 do
begin
Username:='xhdsoft.com';
Password:='fgerHJKy678';
Host:='218.107.216.42';
Connect;
end;
IdFTP1.ChangeDir('/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>ҵ<EFBFBD><D2B5>/<2F><><EFBFBD><EFBFBD>');
IdFTP1.TransferType := ftASCII;
str_list.Items.Clear;
IdFTP1.List(str_list.Items);
//<2F><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for i:=0 to str_list.Count -1 do
begin
try
Line:=str_list.Items[i];
while pos(' ',line) <> 0 do
begin
delete(line,1,pos(' ',line)); //<2F><><EFBFBD><EFBFBD>^<5E><><EFBFBD><EFBFBD>#<23><><EFBFBD><EFBFBD><><CBB5>&.rtm
end;
// SHOWMESSAGE(copy(str_list.Items[i],pos('$',str_list.Items[i])+1,pos('^',str_list.Items[i])-pos('$',str_list.Items[i])-1));
if copy(str_list.Items[i],pos('$',str_list.Items[i])+1,pos('^',str_list.Items[i])-pos('$',str_list.Items[i])-1)=frm_sys_print_down.caption then
begin
t_down_list.insert;
t_down_list['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=copy(str_list.Items[i],pos('^',str_list.Items[i])+1,pos('#',str_list.Items[i])-pos('^',str_list.Items[i])-1);
t_down_list['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=copy(str_list.Items[i],pos('#',str_list.Items[i])+1,pos('~',str_list.Items[i])-pos('#',str_list.Items[i])-1);
t_down_list['<27><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>']:=copy(str_list.Items[i],pos('~',str_list.Items[i])+1,pos('&',str_list.Items[i])-pos('~',str_list.Items[i])-1);
t_down_list.post;
end;
except
;
end;
//<2F><><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD>
end;
finally
str_list.free;
idftp1.Disconnect;
idftp1.Free;
end;
end;
procedure Tfrm_sys_print_down.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_sys_print_down.bsSkinButton3Click(Sender: TObject);
var
IdFTP1:TIdFTP;
str_name:widestring;
begin
if t_down_list.IsEmpty then
exit;
try
IdFTP1:=TIdFTP.Create(application);
with idftp1 do
begin
Username:='xhdsoft.com';
Password:='fgerHJKy678';
Host:='218.107.216.42';
Connect; //<2F><><EFBFBD><EFBFBD>^<5E><><EFBFBD><EFBFBD>#<23><><EFBFBD><EFBFBD><><CBB5>&.rtm
end;
if not DirectoryExists(ExtractFilePath(Application.ExeName)+'update') then
CreateDir(ExtractFilePath(Application.ExeName)+'update');
IdFTP1.ChangeDir('/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>ҵ<EFBFBD><D2B5>/<2F><><EFBFBD><EFBFBD>');
str_name:='$'+frm_sys_print_down.caption
+'^'+t_down_list['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
+'#'+t_down_list['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
+'~'+t_down_list['<27><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>']
+'&.rtm';
IdFTP1.Get(str_name,ExtractFilePath(Application.ExeName)+'update\'+str_name,true);
frm_sys_print.rp.template.DatabaseSettings.name :='';
frm_sys_print.rp.AllowPrintToFile:=false;
frm_sys_print.rp.template.FileName:=ExtractFilePath(Application.ExeName)+'update\'+str_name;
frm_sys_print.rp.Template.LoadFromFile;
if not assigned(frm_sys_print_view) then
frm_sys_print_view:=tfrm_sys_print_view.Create(self);
frm_sys_print_view.ppViewer1.Report:=frm_sys_print.rp;
frm_sys_print.rp.PrintToDevices;
frm_sys_print_view.ShowModal;
except
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
end;
idftp1.Disconnect;
IdFTP1.free;
end;
procedure Tfrm_sys_print_down.bsSkinButton1Click(Sender: TObject);
var
IdFTP1:TIdFTP;
str_name:widestring;
str:widestring;
begin
if t_down_list.IsEmpty then
exit;
try
IdFTP1:=TIdFTP.Create(application);
with idftp1 do
begin
Username:='xhdsoft.com';
Password:='fgerHJKy678';
Host:='218.107.216.42';
Connect;
end;
if not DirectoryExists(ExtractFilePath(Application.ExeName)+'update') then
CreateDir(ExtractFilePath(Application.ExeName)+'update');
IdFTP1.ChangeDir('/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>ҵ<EFBFBD><D2B5>/<2F><><EFBFBD><EFBFBD>');
str_name:='$'+frm_sys_print_down.caption
+'^'+t_down_list['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
+'#'+t_down_list['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
+'~'+t_down_list['<27><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>']
+'&.rtm';
IdFTP1.Get(str_name,ExtractFilePath(Application.ExeName)+'update\'+str_name,true);
str:=trim(InputBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>', ''));
if str=''then
begin
showmessage('<27>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
exit;
end;
if frm_sys_print.t_sys_report.locate('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',str,[]) then
begin
showmessage('<27><><EFBFBD>ݿ<EFBFBD><DDBF>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>Ƶı<C6B5><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
exit;
end;
frm_sys_print.rp.template.DatabaseSettings.name :=str;
frm_sys_print.rp.AllowPrintToFile:=true;
frm_sys_print.rp.template.FileName:=ExtractFilePath(Application.ExeName)+'update\'+str_name;
frm_sys_print.rp.Template.LoadFromFile;
frm_sys_print.rp.Template.Save;
except
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
end;
idftp1.Disconnect;
IdFTP1.free;
end;
end.