⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendunit.~pas

📁 企业端数据申报系统:单位管理模块 单位查询. 业务申报模块 在线数据下载 在线数据上传 在线业务申核 申报业务查询 磁盘数据导出 磁盘数据导入 在线业务模块 在线业务
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
unit SendUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, basedialog, TFlatButtonUnit, StdCtrls, CheckLst, jpeg, ExtCtrls,
  IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,
  TFlatProgressBarUnit, TFlatCheckListBoxUnit, TFlatComboBoxUnit,
  TFlatCheckBoxUnit, ComCtrls, ztvregister, ztvBase,IniFiles, ztvUnZip,Registry;

type
  TSendUnit_frm = class(Tbasedialog_form)
    Image3: TImage;
    GroupBox3: TGroupBox;
    FB_next: TFlatButton;
    FB_cancel: TFlatButton;
    IdHTTP1: TIdHTTP;
    FlatComboBox1: TFlatComboBox;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    Label5: TLabel;
    Memo1: TMemo;
    SendUnit: TLabel;
    CheckListBox1: TCheckListBox;
    FlatCheckBox1: TFlatCheckBox;
    FlatCheckBox2: TFlatCheckBox;
    FlatProgressBar1: TFlatProgressBar;
    UnZip: TUnZip;
    procedure FB_cancelClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FB_nextClick(Sender: TObject);
    procedure FlatCheckBox1Click(Sender: TObject);
    procedure IdHTTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode;
      const AWorkCountMax: Integer);
    procedure IdHTTP1Work(Sender: TObject; AWorkMode: TWorkMode;
      const AWorkCount: Integer);
    procedure IdHTTP1WorkEnd(Sender: TObject; AWorkMode: TWorkMode);

  private

    { Private declarations }
  public
    { Public declarations }

  end;

var
  SendUnit_frm: TSendUnit_frm;

implementation

uses Main, imp, datashare;

{$R *.dfm}

procedure TSendUnit_frm.FB_cancelClick(Sender: TObject);
begin
  inherited;
  close;
end;

procedure TSendUnit_frm.FormCreate(Sender: TObject);
begin
  inherited;
  screen.Cursor :=crdefault;
  FlatProgressBar1.Visible :=false;
  pagecontrol1.ActivePageIndex :=0;
end;

procedure TSendUnit_frm.FormShow(Sender: TObject);
var 
  i, MaxWidth: integer;
begin
  MaxWidth := 0;
  for i := 0 to CheckListBox1.Items.Count - 1 do
  if MaxWidth < CheckListBox1.Canvas.TextWidth(CheckListBox1.Items.Strings[i]) then
    MaxWidth := CheckListBox1.Canvas.TextWidth(CheckListBox1.Items.Strings[i]);
  SendMessage(CheckListBox1.Handle, LB_SETHORIZONTALEXTENT, MaxWidth+60, 0);
  CheckListBox1.Update ;
  CheckListBox1.Refresh ;
end;

procedure TSendUnit_frm.FB_nextClick(Sender: TObject);
var
  str,d:string;
  i,j:integer;
  DownLoadFile:TFileStream;
  sqlstr:widestring;
  ini:Tinifile;
  b:boolean;
  ProxyServer:string;
  Proxyport:string;
  Reg: TRegistry;
begin
  inherited;
  if pagecontrol1.ActivePageIndex=1 then close;
  if pagecontrol1.ActivePageIndex=0 then
  begin
  if CheckListBox1.Count<1 then
    begin
      application.MessageBox('该结算单位没有相应的基本单位!','恩普软件',mb_iconinformation+mb_ok);
      exit; 
    end;
  b:=false;
  for i:=0 to CheckListBox1.Count-1 do
    if CheckListBox1.Checked[i] then
    begin
      b:=true;
      break;
    end;
  if not b then
    begin
      application.MessageBox('请选择要下载的单位!','恩普软件',mb_iconinformation+mb_ok);
      exit;
    end;
  screen.cursor:=crhourglass;
  str:='';FlatProgressBar1.Visible:=false;
  for i:=0 to CheckListBox1.Count-1 do
    if CheckListBox1.Checked[i] then
      if str='' then  str:=flatcombobox1.Items[i] else str:=str+','+flatcombobox1.Items[i];
  if str='' then exit;
  pagecontrol1.activepageindex:=1;
  memo1.Lines.Clear ;
  memo1.Lines.Add('正在检索数据...');
  memo1.Lines.Add('根据单位大小,职工多少,所需的时间长短不一!');
  ini:=Tinifile.Create(extractfilepath(application.ExeName)+'ESDD.ini');
  try
  ini.WriteString('runtime','begingetfilename',datetimetostr(now));
  msg:=Fecho.getRequestFileName(username,str);
  ini.WriteString('runtime','endgetfilename',datetimetostr(now));
  except
    screen.cursor:=crdefault;
    application.MessageBox('网络连接异常!','恩普软件',mb_iconerror+mb_ok);
    exit; 
  end;
  if msg.msgCode<>1 then
    begin
      screen.cursor:=crdefault;
      application.MessageBox(pansichar(string(msg.msgText)),'恩普软件',mb_iconerror+mb_ok);
      close;
    end else
  begin

    if directoryexists(extractfilepath(application.ExeName)+'importfile') then
       createdir(extractfilepath(application.ExeName)+'importfile');

    if fileexists(extractfilepath(application.ExeName)+'importfile\bb.zip') then
      deletefile(extractfilepath(application.ExeName)+'importfile\bb.zip');
    DownLoadFile:=TFileStream.Create(extractfilepath(application.ExeName)+'importfile\bb.zip',fmCreate);
    FlatProgressBar1.Visible:=true;
    str:=download+msg.msgtext;
    memo1.Lines.Add('正在下载数据,下载进度如进度条所示!');
    ini.WriteString('runtime','begindownload',datetimetostr(now));
    ProxyServer:=ini.ReadString('http','ProxyServer','');
    Proxyport:=ini.ReadString('http','Proxyport','');
    if ProxyServer='' then
      begin
        Reg:=TRegistry.Create ;
        reg.RootKey :=hkey_current_user;
        reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Internet Settings',true);
        j:=reg.ReadInteger('ProxyEnable');
        if j<>0 then
          begin
            ProxyServer:=reg.ReadString('ProxyServer');
            j:=pos(':',ProxyServer);
            if j>0 then
              begin
                proxyport:=copy(ProxyServer,j+1,length(ProxyServer)-j);
                ProxyServer:=copy(ProxyServer,1,j-1);
                IdHttp1.ProxyParams.ProxyServer :=proxyserver;
                IdHttp1.ProxyParams.ProxyPort :=strtoint(proxyport);
              end;
          end;
        reg.CloseKey ;
        reg.Free ;
      end else
      begin
        IdHttp1.ProxyParams.ProxyServer :=proxyserver;
        IdHttp1.ProxyParams.ProxyPort :=strtoint(proxyport);
      end;
    if trim(proxyserver)<>'' then
       application.MessageBox(pchar('您的代理服务器为: '+proxyserver+'  您的代理端口为:'+proxyport),'恩普软件',mb_iconinformation+mb_ok);
    IdHTTP1.Get(download+msg.msgText,DownLoadFile);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -