Browse Source

总分包汇总,界面优化,增加进度条提示用户

MaiXinRong 7 years ago
parent
commit
018560fea9
2 changed files with 34 additions and 1 deletions
  1. 6 0
      SubTenderGather/stgGather.pas
  2. 28 1
      SubTenderGather/stgGatherControl.pas

+ 6 - 0
SubTenderGather/stgGather.pas

@@ -6,6 +6,8 @@ uses
   Classes, stgGatherCacheData, ProjectData, BillsTree, sdIDTree;
 
 type
+  TProgramHintEvent = procedure (const ATenderName: string) of Object;
+
   TstgSumBaseFileLoader = class
   private
     FTree: TstgGatherTree;
@@ -29,12 +31,15 @@ type
     FCacheData: TstgGatherCacheData;
     FProjectData: TProjectData;
     FCurSubTenderID: Integer;
+    FLoadHint: TProgramHintEvent;
     procedure GatherDetailData(AGatherNode: TstgGatherTreeNode; ASourceNode: TMeasureBillsIDTreeNode);
     function GatherSubTenderTreeNodeData(ANode: TsdIDTreeNode; AParent: TstgGatherTreeNode): TstgGatherTreeNode;
     procedure GatherSubTenderTreeNode(ANode: TsdIDTreeNode; AParent: TstgGatherTreeNode);
     procedure GatherSubTender(ASubTenderID: Integer);
   public
     procedure GatherTo(AGatherCacheData: TstgGatherCacheData; ASubTenders: TList);
+
+    property LoadHint: TProgramHintEvent read FLoadHint write FLoadHint;
   end;
 
   TstgErrorChecker = class
@@ -168,6 +173,7 @@ begin
   vNode := ProjectManager.ProjectsTree.FindNode(ASubTenderID);
   if vNode.Rec.ValueByName('Type').AsInteger = 1 then
   begin;
+    FLoadHint(vNode.Rec.ValueByName('Name').AsString);
     FProjectData := OpenProjectManager.FindProjectData(ASubTenderID);
     try
       if not Assigned(FProjectData) then

+ 28 - 1
SubTenderGather/stgGatherControl.pas

@@ -16,10 +16,15 @@ type
     FGatherData: TstgGatherData;
     FResultForm: TstgResultForm;
 
+    FHintPosition: Integer;
+
+    procedure LoadHint(const ATenderName: string);
+
     procedure LoadSumBaseFile;
     procedure GatherSubTenderFiles;
     procedure CheckErrorData;
     procedure SaveGatherResult;
+    procedure ShowGatherResult;
   public
     constructor Create;
     destructor Destroy; override;
@@ -32,6 +37,9 @@ type
 
 implementation
 
+uses
+  ProgressHintFrm, SysUtils;
+
 { TstgGatherControl }
 
 procedure TstgGatherControl.CheckErrorData;
@@ -63,10 +71,17 @@ end;
 
 procedure TstgGatherControl.Gather;
 begin
+  FHintPosition := 0;
+  ShowProgressHint('正在导入总包基准文件数据...', FProjects.Count + 2);
   LoadSumBaseFile;
   GatherSubTenderFiles;
+  UpdateProgressHint('正在检查汇总结果...');
+  UpdateProgressPosition(FProjects.Count + 1);
   CheckErrorData;
+  UpdateProgressPosition(FProjects.Count + 2);
   SaveGatherResult;
+  CloseProgressHint;
+  ShowGatherResult;
 end;
 
 procedure TstgGatherControl.GatherSubTenderFiles;
@@ -75,12 +90,20 @@ var
 begin
   vGather := TstgSubTenderFileGather.Create;
   try
+    vGather.LoadHint := LoadHint;
     vGather.GatherTo(FGatherCacheData, FProjects);
   finally
     vGather.Free;
   end;
 end;
 
+procedure TstgGatherControl.LoadHint(const ATenderName: string);
+begin
+  Inc(FHintPosition);
+  UpdateProgressHint(Format('正在汇总分包标段"%s"...', [ATenderName]));
+  UpdateProgressPosition(FHintPosition);
+end;
+
 procedure TstgGatherControl.LoadSumBaseFile;
 var
   vLoader: TstgSumBaseFileLoader;
@@ -94,10 +117,14 @@ begin
 end;
 
 procedure TstgGatherControl.SaveGatherResult;
+begin
+  FGatherData.LoadGatherData(FGatherCacheData);
+end;
+
+procedure TstgGatherControl.ShowGatherResult; 
 var
   Form: TstgResultForm;
 begin
-  FGatherData.LoadGatherData(FGatherCacheData);
   Form := TstgResultForm.Create(nil);
   try
     Form.SetGatherData(FGatherData);