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

📄 ne2kapp.dpr

📁 delphi开发的抄表数据管理系统
💻 DPR
字号:
program ne2kapp;

uses
  Windows,
  SysUtils,
  Controls,
  Forms,
  Dialogs,
  StrUtils,
  shellapi,
  Unit1 in 'Unit1.pas' {Form1},
  datasourceformunit1 in 'DataSourceFormUnit1.pas' {ComSettingForm},
  PComm in 'PComm.pas',
  HrUnit1 in 'HrUnit1.pas',
  Pack_CRCUnit1 in 'Pack_CRCUnit1.pas',
  DataModuleUnit1 in 'DataModuleUnit1.pas' {DataModule1: TDataModule},
  AppUtil in 'AppUtil.pas',
  Unit2 in 'Unit2.pas',
  SelectDateFormUnit1 in 'SelectDateFormUnit1.pas' {SelectDateForm},
  SelectOperatorFormUnit in 'SelectOperatorFormUnit.pas' {SelectOperatorForm},
  DataAnalyseFormUnit1 in 'DataAnalyseFormUnit1.pas' {DataAnalyseForm},
  ManualVerifyFormUnit1 in 'ManualVerifyFormUnit1.pas' {ManualVerifyForm},
  DataBrowseFormUnit1 in 'DataBrowseFormUnit1.pas' {DataBrowseForm},
  DataCurveFormUnit in 'DataCurveFormUnit.pas' {DataCurveForm};

{$R *.res}
var
  para:string;
  thread1:MyThread;
  i:Integer;
  fnum1:textfile;
begin
  Application.Initialize;
  if Paramcount>0 then
  begin
    para:=Paramstr(1);
    if para='0' then
    begin
      Application.CreateForm(TComSettingForm, ComSettingForm);
  end;
    if para='1' then //下载任务
    begin
      openConn(Paramstr(2));
      //Application.CreateForm(TDataModule1, DataModule1);
      Application.CreateForm(TForm1, Form1);
      form1.Show;
      thread1:=MyThread.Create(false);
      XLDownData_Task;
      thread1.exit;
      thread1.Terminate;
      form1.Close;
      DataModule1.ADOConnection1.Close;
      assignfile(fnum1,extractfilepath(application.ExeName) + 'temp' +'.ls');
        rewrite(fnum1);
        writeln(fnum1,'1');
        closefile(fnum1);
      shellexecute(0,'open',pchar(extractfilepath(application.ExeName)+'\comm.exe'),'','',SW_SHOWNORMAL);
    end;
    if para='2' then  //上传数据
    begin
    if (fileexists(extractfilepath(application.ExeName) + 'Data\cIM_DA.dbf')) then
        begin
            if not DeleteFile(extractfilepath(application.ExeName) + 'Data\cIM_DA.dbf') then
            begin
                messagedlg('请手动删除上次数据文件,否则影响接收数据'+'<'+extractfilepath(application.ExeName) + 'Data\cIM_DA.dbf'+'>',mterror,[mbok],0);
                exit;
            end;
        end;
        if (fileexists(extractfilepath(application.ExeName) + 'Data\cIM_TA.db')) then
        begin
            if not DeleteFile(extractfilepath(application.ExeName) + 'Data\cIM_TA.db') then
            begin
               messagedlg('请手动删除上次数据文件,否则影响接收数据'+'<'+extractfilepath(application.ExeName) + 'Data\cIM_TA.db'+'>',mterror,[mbok],0);
               exit;
            end;
        end;
      assignfile(fnum1,extractfilepath(application.ExeName) + 'temp' +'.ls');
        rewrite(fnum1);
        writeln(fnum1,'2');
        closefile(fnum1);
      shellexecute(0,'open',pchar(extractfilepath(application.ExeName)+'\comm.exe'),'','',SW_SHOWNORMAL);
    end;
    if para='3' then  //解析数据
    begin
      if (not fileexists(extractfilepath(application.ExeName) + 'Data\cIM_DA.dbf')) then
      begin
         messagedlg('数据文件不存在,请先上传抄表数据!',mterror,[mbok],0);
         exit;
      end;
      openConn(Paramstr(2));
      //Application.CreateForm(TDataModule1, DataModule1);
      Application.CreateForm(TForm1, Form1);
      form1.Caption:='正在解析数据,请稍后 ......';
      form1.Show;
      thread1:=MyThread.Create(false);
      ParseData;
      saveData;
      thread1.exit;
      thread1.Terminate;
      form1.Close;
      DataModule1.ADOConnection1.Close;
      messagedlg('解析完毕!',mtInformation,[mbok],0);
    end;
    if para='4' then  //上传48天曲线
    begin
        assignfile(fnum1,extractfilepath(application.ExeName) + 'temp' +'.ls');
        rewrite(fnum1);
        writeln(fnum1,'4');
        closefile(fnum1);
        if (fileexists(extractfilepath(application.ExeName) + 'Data\cIM_CUA.db')) then
        begin
          if not DeleteFile(extractfilepath(application.ExeName) + 'Data\cIM_CUA.db') then
          begin
            messagedlg('请手动删除上次数据文件,否则影响接收数据'+'<'+extractfilepath(application.ExeName) + 'Data\cIM_CUA.db'+'>',mterror,[mbok],0);
            exit;
          end;
        end;
        shellexecute(0,'open',pchar(extractfilepath(application.ExeName)+'\comm.exe'),'','',SW_SHOWNORMAL);
    end;
    if para='5' then  //解析48天曲线
    begin
      if (not fileexists(extractfilepath(application.ExeName) + 'Data\cIM_CUA.db')) then
      begin
         messagedlg('数据文件不存在,请先上传48天曲线数据!',mterror,[mbok],0);
         exit;
      end;
      openConn(Paramstr(2));
      //Application.CreateForm(TDataModule1, DataModule1);
      Application.CreateForm(TForm1, Form1);
      form1.Caption:='正在解析数据,请稍后 ......';
      form1.Show;
      thread1:=MyThread.Create(false);
      Parse48DayCurveData;
      saveCurveData;
      thread1.exit;
      thread1.Terminate;
      form1.Close;
      DataModule1.ADOConnection1.Close;
      messagedlg('解析完毕!',mtInformation,[mbok],0);
    end;
    if para='6' then  //上传38天小时曲线
    begin
      assignfile(fnum1,extractfilepath(application.ExeName) + 'temp' +'.ls');
      rewrite(fnum1);
      writeln(fnum1,'5');
      closefile(fnum1);
      if (fileexists(extractfilepath(application.ExeName) + 'Data\cIM_CUB.dbf')) then
      begin
        if not DeleteFile(extractfilepath(application.ExeName) + 'Data\cIM_CUB.dbf') then
        begin
          messagedlg('请手动删除上次数据文件,否则影响接收数据'+'<'+extractfilepath(application.ExeName) + 'Data\cIM_CUB.dbf'+'>',mterror,[mbok],0);
          exit;
        end;
      end;
      shellexecute(0,'open',pchar(extractfilepath(application.ExeName)+'\comm.exe'),'','',SW_SHOWNORMAL);
    end;
    if para='7' then  //解析38天小时曲线
    begin
      if (not fileexists(extractfilepath(application.ExeName) + 'Data\cIM_CUB.dbf')) then
      begin
         messagedlg('数据文件不存在,请先上传38天小时曲线数据!',mterror,[mbok],0);
         exit;
      end;
      openConn(Paramstr(2));
      //Application.CreateForm(TDataModule1, DataModule1);
      Application.CreateForm(TForm1, Form1);
      form1.Caption:='正在解析数据,请稍后 ......';
      form1.Show;
      thread1:=MyThread.Create(false);
      Parse38DayHourCurveData;
      saveCurveData;
      thread1.exit;
      thread1.Terminate;
      form1.Close;
      DataModule1.ADOConnection1.Close;
      messagedlg('解析完毕!',mtInformation,[mbok],0);
    end;
    if para='8' then  //月报打印
    begin
      openConn(Paramstr(2));
      report;
      DataModule1.ADOConnection1.Close;
    end;
    if para='9' then  //抄表数据复合(自动)报表
    begin
      openConn(Paramstr(2));
      //Application.CreateForm(TDataAnalyseForm, DataAnalyseForm);
      viewreport;
      DataModule1.ADOConnection1.Close;
    end;
    if para='10' then  //抄表数据复合(手动)
    begin
      openConn(Paramstr(2));
      Application.CreateForm(TManualVerifyForm, ManualVerifyForm);
    end;
    if para='11' then  //抄表数据查询
    begin
      openConn(Paramstr(2));
      Application.CreateForm(TDataBrowseForm, DataBrowseForm);
    end;
    if para='12' then  //浏览曲线
    begin
      openConn(Paramstr(2));
      Application.CreateForm(TDataCurveForm, DataCurveForm);
    end;
  end;
  Application.Run;
end.

⌨️ 快捷键说明

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