Bläddra i källkod

汇总,提供汇总项目的文件夹,顶层文件夹名称、期数、审核状态以供查询

MaiXinRong 8 år sedan
förälder
incheckning
f8cba808bb

+ 39 - 7
ProjGather/GatherProjInfo.pas

@@ -3,7 +3,7 @@ unit GatherProjInfo;
 interface
 
 uses
-  sdDB;
+  sdIDTree, sdDB;
 
 type
   TGatherProjInfo = class
@@ -11,16 +11,25 @@ type
     FProjectID: Integer;
     FProjectName: string;
     FFileName: string;
+    FParentName: string;
+    FTopParentName: string;
+    FGatherPhase: Integer;
 
     FProjRec: TsdDataRecord;
     FProjType: Integer;
+
+    function GetParentName(ANode: TsdIDTreeNode): string;
+    function GetTopParentName(ANode: TsdIDTreeNode): string;
   public
-    constructor Create(ARec: TsdDataRecord; AProjType: Integer); virtual;
+    constructor Create(ANode: TsdIDTreeNode; AGatherPhase: Integer; AProjType: Integer); virtual;
     destructor Destroy; override;
 
     property ProjectID: Integer read FProjectID;
     property ProjectName: string read FProjectName;
     property FileName: string read FFileName;
+    property ParentName: string read FParentName;
+    property TopParentName: string read FTopParentName;
+    property GatherPhase: Integer read FGatherPhase;
 
     property ProjRec: TsdDataRecord read FProjRec;
     // 值为0 普通汇总项目,值非0 项目类型根据报表
@@ -31,7 +40,7 @@ type
   private
     FIsTender: Boolean;
   public
-    constructor Create(ARec: TsdDataRecord; AProjType: Integer); override;
+    constructor Create(ANode: TsdIDTreeNode; AGatherPhase: Integer; AProjType: Integer); override;
 
     property IsTender: Boolean read FIsTender;
   end;
@@ -40,17 +49,20 @@ implementation
 
 { TGatherProjInfo }
 
-constructor TGatherProjInfo.Create(ARec: TsdDataRecord; AProjType: Integer);
+constructor TGatherProjInfo.Create(ANode: TsdIDTreeNode; AGatherPhase: Integer; AProjType: Integer);
 begin
-  FProjRec := ARec;
-  if Assigned(FProjRec) then
+  FProjRec := ANode.Rec;
+  if Assigned(ANode) and Assigned(ANode.Rec) then
   begin
     FProjectID := FProjRec.ValueByName('ID').AsInteger;
     FProjectName := FProjRec.ValueByName('Name').AsString;
     FFileName := FProjRec.ValueByName('FileName').AsString;
+    FParentName := GetParentName(ANode);
+    FTopParentName := GetTopParentName(ANode);
   end
   else
     FProjectID := -1;
+  FGatherPhase := AGatherPhase;
   FProjType := AProjType;
 end;
 
@@ -59,9 +71,29 @@ begin
   inherited;
 end;
 
+function TGatherProjInfo.GetParentName(ANode: TsdIDTreeNode): string;
+begin
+  Result := '';
+  if Assigned(ANode.Parent) and Assigned(ANode.Parent.Rec) then
+    Result := ANode.Parent.Rec.ValueByName('Name').AsString;
+end;
+
+function TGatherProjInfo.GetTopParentName(ANode: TsdIDTreeNode): string;
+var
+  vParent: TsdIDTreeNode;
+begin
+  Result := '';
+  vParent := ANode.Parent;
+  while Assigned(vParent) and Assigned(vParent.Rec) do
+  begin
+    Result := vParent.Rec.ValueByName('Name').AsString;
+    vParent := vParent.Parent;
+  end;
+end;
+
 { TSelectProjInfo }
 
-constructor TSelectProjInfo.Create(ARec: TsdDataRecord; AProjType: Integer);
+constructor TSelectProjInfo.Create(ANode: TsdIDTreeNode; AGatherPhase: Integer; AProjType: Integer);
 begin
   inherited;
   FIsTender := FProjRec.ValueByName('Type').AsInteger = 1;

+ 2 - 2
ProjGather/ProjGather.pas

@@ -173,13 +173,13 @@ end;
 procedure TProjGather.FilterProjs;
 var
   i: Integer;
-  vProjInfo: TSelectProjInfo;
+  vProjInfo: TGatherProjInfo;
 begin
   FCommonProjs.Clear;
   FSpecialProjs.Clear;
   for i := 0 to FProjs.Count - 1 do
   begin
-    vProjInfo := TSelectProjInfo(FProjs.Items[i]);
+    vProjInfo := TGatherProjInfo(FProjs.Items[i]);
     if vProjInfo.ProjType = 0 then
       FCommonProjs.Add(vProjInfo)
     else

+ 6 - 7
ProjGather/ProjGatherSelectFrm.pas

@@ -123,11 +123,10 @@ begin
 
   FValidProjs := TList.Create;
   // È¡Ïû¹ýÂË
-  {
-  FilterValidProject;
-  ProjectManager.sdvProjectsSpare.OnFilterRecord := DoOnFilterRecord;
+  //FilterValidProject;
+  //ProjectManager.sdvProjectsSpare.OnFilterRecord := DoOnFilterRecord;
   ProjectManager.sdvProjectsSpare.Filtered := True;
-  }
+
   stdSelectProject.DataView := ProjectManager.sdvProjectsSpare;
 
   FSelectProjs := TList.Create;
@@ -137,8 +136,8 @@ end;
 
 destructor TProjGatherSelectForm.Destroy;
 begin
-  ProjectManager.sdvProjectsSpare.Filtered := False;
-  ProjectManager.sdvProjectsSpare.OnFilterRecord := nil;
+  //ProjectManager.sdvProjectsSpare.Filtered := False;
+  //ProjectManager.sdvProjectsSpare.OnFilterRecord := nil;
   FValidProjs.Free;
   FSelectProjs.Free;
   inherited;
@@ -332,7 +331,7 @@ begin
   for iRow := 1 to zgResult.RowCount - 1 do
   begin
     stnNode := TsdIDTreeNode(zgResult.Rows[iRow].Data);
-    vGatherProj := TGatherProjInfo.Create(stnNode.Rec, SpecialProjType(stnNode.ID));
+    vGatherProj := TGatherProjInfo.Create(stnNode, -1, SpecialProjType(stnNode.ID));
     AProjs.Add(vGatherProj);
   end;
 end;

+ 10 - 2
Report/ProjGather/rProjGatherTables.pas

@@ -7,14 +7,22 @@ uses
 
 const
   SGatherProj = 'r_GatherProj';
-  tdGatherProj: array [0..3] of TScFieldDef =(
+  tdGatherProj: array [0..7] of TScFieldDef =(
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     // 标段类型
     (FieldName: 'ProjType'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     // 标段 -- 项目管理ID
     (FieldName: 'ProjectID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 标段 -- 名称
-    (FieldName: 'ProjectName'; FieldType: ftString; Size: 255; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+    (FieldName: 'ProjectName'; FieldType: ftString; Size: 255; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 标段 -- 期数
+    (FieldName: 'PhaseCount'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 标段 -- 审核状态
+    (FieldName: 'AuditStatus'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 标段 -- 父节点 -- 名称
+    (FieldName: 'ParentName'; FieldType: ftString; Size: 255; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 标段 -- 顶层父节点 -- 名称
+    (FieldName: 'TopParentName'; FieldType: ftString; Size: 255; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
   );
 
   SBills = 'r_Bills';

+ 15 - 1
Report/ProjGather/rpgGatherProjDm.dfm

@@ -22,7 +22,21 @@ object rpgGatherProjData: TrpgGatherProjData
       000453697A6502000001044E616D65060B50726F6A6563744E616D6509466965
       6C644E616D65060B50726F6A6563744E616D6508446174615479706502180844
       61746153697A6503FF000549734B6579080F4E65656450726F636573734E616D
-      650909507265636973696F6E02000453697A6502000000}
+      650909507265636973696F6E02000453697A6502000001044E616D65060A5061
+      72656E744E616D65094669656C644E616D65060A506172656E744E616D650844
+      617461547970650218084461746153697A6503FF000549734B6579080F4E6565
+      6450726F636573734E616D650909507265636973696F6E02000453697A650200
+      0001044E616D65060D546F70506172656E744E616D65094669656C644E616D65
+      060D546F70506172656E744E616D650844617461547970650218084461746153
+      697A6503FF000549734B6579080F4E65656450726F636573734E616D65090950
+      7265636973696F6E02000453697A6502000001044E616D65060A506861736543
+      6F756E74094669656C644E616D65060A5068617365436F756E74084461746154
+      7970650203084461746153697A6502040549734B6579080F4E65656450726F63
+      6573734E616D650909507265636973696F6E02000453697A6502000001044E61
+      6D65060B4175646974537461747573094669656C644E616D65060B4175646974
+      5374617475730844617461547970650203084461746153697A6502040549734B
+      6579080F4E65656450726F636573734E616D650909507265636973696F6E0200
+      0453697A6502000000}
   end
   object sdpGatherProj: TsdADOProvider
     Left = 56

+ 4 - 0
Report/ProjGather/rpgGatherProjDm.pas

@@ -60,6 +60,10 @@ begin
     Rec.ValueByName('ProjectID').AsInteger := ProjInfo.ProjectID;
     Rec.ValueByName('ProjectName').AsString := ProjInfo.ProjectName;
     Rec.ValueByName('ProjType').AsInteger := ProjInfo.ProjType;
+    Rec.ValueByName('ParentName').AsString := ProjInfo.ParentName;
+    Rec.ValueByName('TopParentName').AsString := ProjInfo.TopParentName;
+    Rec.ValueByName('PhaseCount').AsInteger := ProjInfo.ProjRec.ValueByName('PhaseCount').AsInteger;
+    Rec.ValueByName('AuditStatus').AsInteger := ProjInfo.ProjRec.ValueByName('AuditStatus').AsInteger;
   end;
 end;