소스 검색

Merge branch 'master' of http://192.168.1.12:3000/maixinrong/measure

builder 8 년 전
부모
커밋
9fa2c0f020

+ 12 - 2
Forms/BillsPasteSelectFrm.pas

@@ -17,12 +17,15 @@ type
     Label1: TLabel;
     procedure btnOkClick(Sender: TObject);
   private
+    FCanBeChild: Boolean;
     function GetPos: Integer;
+    procedure SetCanBeChild(const Value: Boolean);
   public
     property Pos: Integer read GetPos;
+    property CanBeChild: Boolean read FCanBeChild write SetCanBeChild;
   end;
 
-  function SelectBillsPasteType(var APos: Integer): Boolean;
+  function SelectBillsPasteType(var APos: Integer; ACanBeChild: Boolean): Boolean;
 
 implementation
 
@@ -31,12 +34,13 @@ uses
 
 {$R *.dfm}
 
-function SelectBillsPasteType(var APos: Integer): Boolean;
+function SelectBillsPasteType(var APos: Integer; ACanBeChild: Boolean): Boolean;
 var
   SelectForm: TBillsPasteSelectForm;
 begin
   SelectForm := TBillsPasteSelectForm.Create(nil);
   try
+    SelectForm.CanBeChild := ACanBeChild;
     Result := SelectForm.ShowModal = mrOk;
     if Result then
       APos := SelectForm.Pos;
@@ -67,4 +71,10 @@ begin
     ModalResult := mrOk;
 end;
 
+procedure TBillsPasteSelectForm.SetCanBeChild(const Value: Boolean);
+begin
+  FCanBeChild := Value;
+  rbChild.Enabled := FCanBeChild;
+end;
+
 end.

+ 9 - 1
Frames/BillsCompileFme.pas

@@ -135,11 +135,19 @@ end;
 
 procedure TBillsCompileFrame.PasteBillsBlock(ANode: TsdIDTreeNode;
   ABounds: TRect);
+
+  function CanHasChild: Boolean;
+  begin
+    Result := True;
+    if not ANode.HasChildren then
+      Result := ANode.Rec.ValueByName('Quantity').AsFloat = 0;
+  end;
+
 var
   Clipboard: TBillsClipboard;
   iPos: Integer;
 begin
-  if SelectBillsPasteType(iPos) then
+  if SelectBillsPasteType(iPos, CanHasChild) then
   begin
     if iPos = -1 then Exit;
 

+ 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

+ 46 - 11
ProjGather/ProjGatherSelectFrm.dfm

@@ -4,7 +4,7 @@ object ProjGatherSelectForm: TProjGatherSelectForm
   BorderStyle = bsSingle
   Caption = #36873#25321#27719#24635#39033#30446
   ClientHeight = 523
-  ClientWidth = 750
+  ClientWidth = 816
   Color = clBtnFace
   Font.Charset = ANSI_CHARSET
   Font.Color = clWindowText
@@ -15,7 +15,7 @@ object ProjGatherSelectForm: TProjGatherSelectForm
   PixelsPerInch = 96
   TextHeight = 12
   object lblProjectList: TLabel
-    Left = 11
+    Left = 8
     Top = 8
     Width = 72
     Height = 12
@@ -28,7 +28,7 @@ object ProjGatherSelectForm: TProjGatherSelectForm
     ParentFont = False
   end
   object lblResult: TLabel
-    Left = 384
+    Left = 451
     Top = 8
     Width = 48
     Height = 12
@@ -41,18 +41,17 @@ object ProjGatherSelectForm: TProjGatherSelectForm
     ParentFont = False
   end
   object zgSelectProject: TZJGrid
-    Left = 8
+    Left = 5
     Top = 24
-    Width = 369
+    Width = 441
     Height = 457
     Options = [goRangeSelect, goRowSizing, goColSizing, goCellNotMaintainData, goFixedRowShowNo, goFixedColShowNo, goAlwaysShowSelection, goShowTreeLine]
     OptionsEx = []
-    ColCount = 3
     RowCount = 1
     ShowGridLine = False
     DefaultColWidth = 35
     DefaultFixedColWidth = 25
-    DefaultFixedRowHeight = 25
+    DefaultFixedRowHeight = 32
     Selection.AlphaBlend = False
     Selection.TransparentColor = False
     FrozenCol = 0
@@ -63,7 +62,7 @@ object ProjGatherSelectForm: TProjGatherSelectForm
     OnDrawCellText = zgSelectProjectDrawCellText
   end
   object zgResult: TZJGrid
-    Left = 384
+    Left = 451
     Top = 24
     Width = 360
     Height = 457
@@ -73,7 +72,7 @@ object ProjGatherSelectForm: TProjGatherSelectForm
     ShowGridLine = False
     DefaultColWidth = 308
     DefaultFixedColWidth = 25
-    DefaultFixedRowHeight = 25
+    DefaultFixedRowHeight = 32
     Selection.AlphaBlend = False
     Selection.TransparentColor = False
     FrozenCol = 0
@@ -82,7 +81,7 @@ object ProjGatherSelectForm: TProjGatherSelectForm
     OnSetCellText = zgResultSetCellText
   end
   object btnOk: TButton
-    Left = 583
+    Left = 649
     Top = 489
     Width = 74
     Height = 25
@@ -91,7 +90,7 @@ object ProjGatherSelectForm: TProjGatherSelectForm
     OnClick = btnOkClick
   end
   object btnCancel: TButton
-    Left = 670
+    Left = 736
     Top = 489
     Width = 74
     Height = 25
@@ -136,6 +135,42 @@ object ProjGatherSelectForm: TProjGatherSelectForm
         FieldName = 'Name'
         Width = 280
         ReadOnly = True
+      end
+      item
+        Title.Caption = #35745#37327#26399#25968
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'PhaseCount'
+        Width = 35
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #23457#25209#29366#24577
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'AuditStatus'
+        Width = 35
+        ReadOnly = False
       end>
     Grid = zgSelectProject
     ExtendRowCount = 0

+ 8 - 6
ProjGather/ProjGatherSelectFrm.pas

@@ -122,9 +122,11 @@ begin
   end;
 
   FValidProjs := TList.Create;
-  FilterValidProject;
-  ProjectManager.sdvProjectsSpare.OnFilterRecord := DoOnFilterRecord;
+  // È¡Ïû¹ýÂË
+  //FilterValidProject;
+  //ProjectManager.sdvProjectsSpare.OnFilterRecord := DoOnFilterRecord;
   ProjectManager.sdvProjectsSpare.Filtered := True;
+
   stdSelectProject.DataView := ProjectManager.sdvProjectsSpare;
 
   FSelectProjs := TList.Create;
@@ -134,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;
@@ -329,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;
@@ -423,7 +425,7 @@ end;
 procedure TProjGatherSelectForm.RefreshDiffWindows;
 begin
   ClientHeight := 523;
-  ClientWidth := 750;
+  ClientWidth := 816;
 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';

+ 46 - 9
Report/ProjGather/rpgGatherControl.pas

@@ -3,13 +3,13 @@ unit rpgGatherControl;
 interface
 
 uses
-  Classes, rpgGatherData, ADODB, ReportManager;
+  Classes, rpgGatherData, ADODB, ReportManager, ProjectData;
 
 type
   TrpgGatherControl = class
   private
     // 当前打开项目,根据其筛选项目
-    FProjectID: Integer;
+    FProjectData: TProjectData;
     // 当前汇总的报表 -- 主要用于读取报表中的附加信息
     FTemplate: TTemplateNode;
     FHistroyProjs: TList;
@@ -21,9 +21,12 @@ type
     function SelectProject: Boolean;
     function SameSelect: Boolean;
 
+    procedure CopyTables(const AFileName, ATableName: string);
+    procedure CopyRelaData;
+
     procedure RefreshGather;
   public
-    constructor Create(AProjectID: Integer);
+    constructor Create(AProjectData: TProjectData);
     destructor Destroy; override;
 
     function RefreshConnection(ATemplate: TTemplateNode): TADOConnection;
@@ -33,16 +36,17 @@ implementation
 
 uses
   ZhAPI, GatherProjInfo, ProjGather, ProjGatherSelectFrm, Globals, Forms,
-  Controls;
+  Controls, UtilMethods, SysUtils;
 
 { TrpgGatherControl }
 
-constructor TrpgGatherControl.Create(AProjectID: Integer);
+constructor TrpgGatherControl.Create(AProjectData: TProjectData);
 begin
-  FProjectID := AProjectID;
+  FProjectData := AProjectData;
   FHistroyProjs := TList.Create;
   FSelectProjs := TList.Create;
   FGatherData := TrpgGatherData.Create;
+  CopyRelaData;
 end;
 
 destructor TrpgGatherControl.Destroy;
@@ -54,6 +58,20 @@ begin
   inherited;
 end;
 
+procedure TrpgGatherControl.CopyRelaData;
+var
+  sTempFile: string;
+begin
+  sTempFile := GetTempFileName;
+  try
+    FProjectData.SaveTempDataBaseFile(sTempFile);
+    CopyTables(sTempFile, 'ProjProperties');
+  finally
+    if FileExists(sTempFile) then
+      DeleteFile(sTempFile);
+  end;
+end;
+
 function TrpgGatherControl.RefreshConnection(ATemplate: TTemplateNode): TADOConnection;
 begin
   FTemplate := ATemplate;
@@ -79,7 +97,7 @@ begin
       Gather.Gather(FSelectProjs, FTemplate.InteractInfo.SpecialProjGatherTypes)
     else
       Gather.Gather(FSelectProjs, nil);
-    FGatherData.LoadRelaData(FProjectID);
+    FGatherData.LoadRelaData(FProjectData.ProjectID);
     ClearObjects(FHistroyProjs);
     FHistroyProjs.Assign(FSelectProjs);
   finally
@@ -132,9 +150,28 @@ end;
 function TrpgGatherControl.SelectProject: Boolean;
 begin
   if FTemplate.IsExtra then
-    Result := SelectGatherProject(FProjectID, FHistroyProjs, FSelectProjs, FTemplate.InteractInfo.SpecialProjGatherTypes)
+    Result := SelectGatherProject(FProjectData.ProjectID, FHistroyProjs, FSelectProjs, FTemplate.InteractInfo.SpecialProjGatherTypes)
   else
-    Result := SelectGatherProject(FProjectID, FHistroyProjs, FSelectProjs);
+    Result := SelectGatherProject(FProjectData.ProjectID, FHistroyProjs, FSelectProjs);
+end;
+
+procedure TrpgGatherControl.CopyTables(const AFileName,
+  ATableName: string);
+const
+  sCopySql = 'Select * Into %s' +
+             '  From %s In ''%s''';
+var
+  vQuery: TADOQuery;
+begin
+  vQuery := TADOQuery.Create(nil);
+  try
+    vQuery.Connection := FGatherData.Connection;
+    vQuery.SQL.Clear;
+    vQuery.SQL.Add(Format(sCopySql, [ATableName, ATableName, AFileName]));
+    vQuery.ExecSQL;
+  finally
+    vQuery.Free;
+  end;
 end;
 
 end.

+ 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;
 

+ 1 - 1
Report/ReportConnection.pas

@@ -27,7 +27,7 @@ implementation
 constructor TReportConnection.Create(AProjectData: TProjectData);
 begin
   FProjectData := AProjectData;
-  FCommonGather := TrpgGatherControl.Create(AProjectData.ProjectID);
+  FCommonGather := TrpgGatherControl.Create(AProjectData);
   FConnection := AProjectData.ADOConnection;
 end;