Quellcode durchsuchen

1. 导入Excel,识别工程量清单父子关系
2. 导入Excel,识别图纸工程量,并兼容导入第三部分之后的预备费等
3. PhaseIndex问题
4. 计量汇总,根据选项自动勾选

MaiXinRong vor 5 Jahren
Ursprung
Commit
69bbc91909

+ 3 - 0
DataModules/BillsCompileDm.pas

@@ -259,6 +259,9 @@ begin
     AValue.Owner.ValueByName('DgnQuantity2').Clear;
     AValue.Owner.ValueByName('DgnPrice').Clear;
   end;
+
+  if (AValue.FieldName = 'IsGatherZJJL') then
+    BillsData.SyncSetOthersGatherZJJL(vNode, BillsCompileTree);
 end;
 
 function TBillsCompileData.GatherChildrenOrg(ANode: TsdIDTreeNode): Double;

+ 1 - 0
DataModules/BillsDm.dfm

@@ -11,6 +11,7 @@ object BillsData: TBillsData
   end
   object sddBills: TsdDataSet
     Active = False
+    Filtered = False
     Provider = sdpBills
     AfterAddRecord = sddBillsAfterAddRecord
     BeforeDeleteRecord = sddBillsBeforeDeleteRecord

+ 48 - 0
DataModules/BillsDm.pas

@@ -72,6 +72,8 @@ type
 
     function GetGatherTotalPrice(ABillsID, AIndex: Integer): Double;
 
+    procedure SyncSetOthersGatherZJJL(ANode: TBillsIDTreeNode; ATree: TBillsIDTree);
+
     property ProjectData: TObject read FProjectData;
     property StageData: TStageData read GetStageData;
 
@@ -592,4 +594,50 @@ begin
   ARecordClass := TBillsRecord;
 end;
 
+procedure TBillsData.SyncSetOthersGatherZJJL(ANode: TBillsIDTreeNode;
+  ATree: TBillsIDTree);
+
+  procedure SetSibling;
+  var
+    vSibling: TBillsIDTreeNode;
+  begin
+    if Assigned(ANode.Parent) then
+      vSibling := TBillsIDTreeNode(ANode.Parent.FirstChild)
+    else
+      vSibling := TBillsIDTreeNode(ATree.FirstNode);
+    while Assigned(vSibling) do
+    begin
+      vSibling.Rec.IsGatherZJJL.AsBoolean := ANode.Rec.IsGatherZJJL.AsBoolean;
+      vSibling := TBillsIDTreeNode(vSibling.NextSibling);
+    end;
+  end;
+
+  procedure SetSameLevelXmj;
+  var
+    vParent, vChild: TBillsIDTreeNode;
+    iCount, iPosterity: Integer;
+  begin
+    if ANode.Level < 1 then Exit;
+    vParent := TBillsIDTreeNode(ANode.Parent);
+    while (vParent.Level > 1) do
+      vParent :=  TBillsIDTreeNode(vParent.Parent);
+    iCount := 0;
+    iPosterity := vParent.PosterityCount;
+    vChild := TBillsIDTreeNode(vParent.NextNode);
+    while (iCount < iPosterity) do
+    begin
+      if (vChild.Level = ANode.Level) and (vChild.Rec.B_Code.AsString = '') then
+        vChild.Rec.IsGatherZJJL.AsBoolean := ANode.Rec.IsGatherZJJL.AsBoolean;
+      vChild := TBillsIDTreeNode(vChild.NextNode);
+      Inc(iCount);
+    end;
+  end;
+
+begin
+  case SupportManager.ConfigInfo.GatherZJJLSelect of
+    1: SetSameLevelXmj;
+    2: SetSibling;
+  end;
+end;
+
 end.

+ 3 - 0
DataModules/BillsMeasureDm.pas

@@ -844,6 +844,9 @@ begin
       BillsMeasureTree.RecodeChildrenCode(vNode, VarToStrDef(AValue.OldValue, ''), AValue.AsString)
     else if (AValue.FieldName = 'B_Code') then
       BillsMeasureTree.RecodeChildrenB_Code(vNode, VarToStrDef(AValue.OldValue, ''), AValue.AsString);
+
+    if (AValue.FieldName = 'IsGatherZJJL') then
+      BillsData.SyncSetOthersGatherZJJL(vNode, BillsMeasureTree);
   end;
 end;
 

+ 104 - 1
Forms/OptionFrm.dfm

@@ -18,7 +18,7 @@ object OptionForm: TOptionForm
     Top = 8
     Width = 457
     Height = 289
-    ActivePage = tsCommon
+    ActivePage = TabSheet1
     TabOrder = 0
     object tsCommon: TTabSheet
       Caption = #24120#35268
@@ -168,6 +168,109 @@ object OptionForm: TOptionForm
         end
       end
     end
+    object TabSheet1: TTabSheet
+      Caption = #39640#32423
+      ImageIndex = 1
+      DesignSize = (
+        449
+        262)
+      object imgHelp: TImage
+        Left = 425
+        Top = 26
+        Width = 16
+        Height = 16
+        Cursor = crHandPoint
+        Anchors = [akTop, akRight]
+        AutoSize = True
+        Picture.Data = {
+          055449636F6E0000010001001010000001002000680400001600000028000000
+          1000000020000000010020000000000000000000000000000000000000000000
+          0000000000000000000000000000000000000000000000000000000000000000
+          D098A090C09090E0B06060FF802020E0801820E0A05850B0C098906000000000
+          000000000000000000000000000000000000000000000000C0808010C07870D0
+          D0B0A0FFC05830FFE0A080FFF0C8B0FFF0C0A0FFD09070FF903010FFB0787080
+          0000000000000000000000000000000000000000C0808070C08080FFE0C0B0FF
+          D07040FFFFD0B0FFFFFFF0FFE0C8C0FF904030FFFFE8D0FFF0B890FF903010FF
+          C09080600000000000000000C0888020C08080E0C09890FFE0E8E0FFE0B8A0FF
+          F0B090FFFFFFFFFFFFFFFFFFE0D0C0FFD0A090FFFFE8E0FFFFE0D0FFD09070FF
+          A05050B000000000C0788080C07880FFD0C8C0FFF0F8F0FFD0C8C0FFE08050FF
+          FFD0B0FFFFFFFFFFFFFFFFFFFFF0F0FF905040FFC08870FFFFE8E0FFF0C0A0FF
+          801810E0A08080E0C09090FFE0F0E0FFE0E8E0FFC09090FFC08880FFF08850FF
+          FFD0B0FFFFFFFFFFFFFFFFFFF0E8E0FFE0D0D0FF905040FFD0A890FFFFC0A0FF
+          902820E0C07870FFE0E8E0FFD0C0C0FFC07880FFC08080FFC08080FFF0A080FF
+          FFC0A0FFFFFFFFFFC08880FFA05840FFE0D0D0FFA05840FFC0A090FFE0A880FF
+          C06860FFC08080FFD0A8B0FFC08080FFD09090FFD09090FFD08890FFE0A8A0FF
+          FFA870FFFFC8B0FFF0E8E0FFC08880FFA05840FFC08880FFF0C8B0FFD07040FF
+          D09090F0D0A0A0FFD0A8B0FFD09090FFE0A0A0FFE098A0FFD09890FFD09090FF
+          E0A8A0FFFFA870FFFFC0A0FFFFE0D0FFFFE0D0FFFFC0A0FFE08850FFD0C0B0FF
+          E0E0E0FFD0A0A020D0A0A0FFF0D0D0FFD09890FFE0A8B0FFE0A8B0FFE0A8A0FF
+          E0A0A0FFE0B0B0FFF0A890FFFF9060FFF09050FFE0A080FFD09890FFC06870FF
+          C0B0B0FF00000000D0A0A030D0A0A0FFF0C8D0FFD09890FFE0B0B0FFF0B8B0FF
+          E0B0B0FFE0A8B0FFE0A0A0FFE0A0A0FFD09890FFD09090FFD08880FFC07070FF
+          C07070FF0000000000000000D0A0A030D0A0A0FFF0C8D0FFD09890FFE0B0B0FF
+          F0C0C0FFF0B8B0FFF0B0B0FFE0B0B0FFE0A8B0FFE0A0A0FFD098A0FFD09090FF
+          D08880E0000000000000000000000000D0A0A030D0A0A0FFF0C8D0FFD09890FF
+          F0B8B0FFF0C8C0FFF0C0C0FFF0C0C0FFF0B8C0FFE0B0B0FFD0A8A0FFD0808090
+          C080801000000000000000000000000000000000D0A0A030D0A0A0FFF0C8D0FF
+          D09890FFF0C0C0FFE0C0C0FFE0C0C0FFD0A8B0FFC08080A0C080801000000000
+          000000000000000000000000000000000000000000000000D0A0A030D0A0A0FF
+          F0D0D0FFE0A0A0FFD0A8A0FFC08080A0C0808020000000000000000000000000
+          00000000000000000000000000000000000000000000000000000000D0A0A020
+          D09090D0C08080A0C08080200000000000000000000000000000000000000000
+          00000000FE039C41F8019C41F0009C41C0009C4180009C4100009C4100009C41
+          00009C4100009C4100009C4180009C41C0009C41E0009C41F0039C41F80F9C41
+          FC3F9C41}
+        OnClick = imgHelpClick
+      end
+      object rgGatherZJJLSelect: TRadioGroup
+        Left = 8
+        Top = 8
+        Width = 409
+        Height = 49
+        Caption = #20013#38388#35745#37327#27719#24635#23618#27425
+        Columns = 3
+        Items.Strings = (
+          #26080
+          #36328#32423#36873#25321#39033#30446#33410
+          #21516#32423#36873#25321#39033#30446#33410)
+        TabOrder = 0
+      end
+      object pnlGatherZJJLSelectHint: TPanel
+        Left = 8
+        Top = 56
+        Width = 409
+        Height = 41
+        BevelOuter = bvNone
+        TabOrder = 1
+        Visible = False
+        object lHintOut: TLabel
+          Left = 5
+          Top = 5
+          Width = 276
+          Height = 12
+          Caption = #36328#32423#36873#25321#39033#30446#33410#65306#33258#21160#21246#36873#21516#19968#31456#32423#19979#30340#65292#21516#23618#33410#28857
+          Font.Charset = ANSI_CHARSET
+          Font.Color = clBlue
+          Font.Height = -12
+          Font.Name = #23435#20307
+          Font.Style = []
+          ParentFont = False
+        end
+        object lHintIn: TLabel
+          Left = 5
+          Top = 21
+          Width = 252
+          Height = 12
+          Caption = #21516#32423#36873#25321#39033#30446#33410#65306#33258#21160#21246#36873#29238#39033#19979#30340#65292#21516#23618#33410#28857
+          Font.Charset = ANSI_CHARSET
+          Font.Color = clBlue
+          Font.Height = -12
+          Font.Name = #23435#20307
+          Font.Style = []
+          ParentFont = False
+        end
+      end
+    end
   end
   object btnOk: TButton
     Left = 302

+ 14 - 0
Forms/OptionFrm.pas

@@ -29,12 +29,19 @@ type
     Label1: TLabel;
     edtOverRangePercent: TEdit;
     Label2: TLabel;
+    TabSheet1: TTabSheet;
+    rgGatherZJJLSelect: TRadioGroup;
+    imgHelp: TImage;
+    lHintOut: TLabel;
+    lHintIn: TLabel;
+    pnlGatherZJJLSelectHint: TPanel;
     procedure cbAutoSaveClick(Sender: TObject);
     procedure rbLedgerClick(Sender: TObject);
     procedure edtOverRangePercentKeyPress(Sender: TObject; var Key: Char);
     procedure edtOverRangePercentExit(Sender: TObject);
     procedure edtOverRangePercentKeyDown(Sender: TObject; var Key: Word;
       Shift: TShiftState);
+    procedure imgHelpClick(Sender: TObject);
   private
     procedure SetSaveIntervalEnable(AEnable: Boolean);
     function GetOverRangeType: Integer;
@@ -83,6 +90,7 @@ begin
     Self.OverRangeType := OverRangeType;
     edtOverRangePercent.Text := IntToStr(OverRangePercent);
     cbExcelWithMis.Checked := ExcelWithMis;
+    rgGatherZJJLSelect.ItemIndex := GatherZJJLSelect;
   end;
 end;
 
@@ -95,6 +103,7 @@ begin
     OverRangeType := Self.OverRangeType;
     OverRangePercent := StrToIntDef(edtOverRangePercent.Text, 100);
     ExcelWithMis := cbExcelWithMis.Checked;
+    GatherZJJLSelect := rgGatherZJJLSelect.ItemIndex;
   end;
 end;
 
@@ -165,4 +174,9 @@ begin
   end;
 end;
 
+procedure TOptionForm.imgHelpClick(Sender: TObject);
+begin
+  pnlGatherZJJLSelectHint.Visible := not pnlGatherZJJLSelectHint.Visible;
+end;
+
 end.

+ 4 - 0
Units/ConfigDoc.pas

@@ -26,6 +26,7 @@ type
     FBatchInsertFrmHeight: Integer;
     FBatchInsertFrmWidth: Integer;
     FOverRangePercent: Integer;
+    FGatherZJJLSelect: Integer;
 
     procedure LoadSectionOfCustomize;
     procedure LoadSectionOfUnitList;
@@ -67,6 +68,7 @@ type
     property OverRangeType: Integer read FOverRangeType write FOverRangeType;
     property OverRangePercent: Integer read FOverRangePercent write FOverRangePercent;
     property ExcelWithMis: Boolean read FExcelWithMis write FExcelWithMis;
+    property GatherZJJLSelect: Integer read FGatherZJJLSelect write FGatherZJJLSelect;
 
     // Customize
     property BatchInsertFrmHeight: Integer read FBatchInsertFrmHeight write FBatchInsertFrmHeight;
@@ -137,6 +139,7 @@ begin
   FOverRangeType := FIniFile.ReadInteger('Options', 'OverRangeType', 0);
   FOverRangePercent := FIniFile.ReadInteger('Options', 'OverRangePercent', 100);
   FExcelWithMis := FIniFile.ReadBool('Options', 'ExcelWithMis', False);
+  FGatherZJJLSelect := FIniFile.ReadInteger('Options', 'GatherZJJLSelect', 0);
 end;
 
 procedure TConfigInfo.LoadSectionOfPath;
@@ -184,6 +187,7 @@ begin
   FIniFile.WriteInteger('Options', 'OverRangeType', FOverRangeType);
   FIniFile.WriteInteger('Options', 'OverRangePercent', FOverRangePercent);
   FIniFile.WriteBool('Options', 'ExcelWithMis', FExcelWithMis);
+  FIniFile.WriteInteger('Options', 'GatherZJJLSelect', FGatherZJJLSelect);
 end;
 
 procedure TConfigInfo.SaveSectionOfStdFile;

+ 51 - 5
Units/MCacheTree.pas

@@ -532,6 +532,13 @@ end;
 
 function TBillsCacheTree.AddLeafBillsNode(const AB_Code: string): TBillsCacheNode;
 
+  function GetLastXmjParentOrg: TBillsCacheNode;
+  begin
+    Result := TBillsCacheNode(FLastNode);
+    while Assigned(Result) and ((Result.B_Code <> '') or (Result.Code = '')) do
+      Result := TBillsCacheNode(Result.Parent);
+  end;
+
   function GetLastXmjParent: TBillsCacheNode;
   begin
     Result := TBillsCacheNode(FLastNode);
@@ -599,8 +606,10 @@ function TBillsCacheTree.AddLeafBillsNode(const AB_Code: string): TBillsCacheNod
 var
   Parent: TBillsCacheNode;
 begin
-  Parent := GetLastXmjParent;
-  Result := AddNodeByParent(Parent, AB_Code);
+  Parent := GetLastXmjParentOrg;
+  Result := AddNodeByCode(Parent.Code + '-' + AB_Code, -1);
+  //Parent := GetLastXmjParent;
+  //Result := AddNodeByParent(Parent, AB_Code);
 end;
 
 procedure TBillsCacheTree.SetSeparateChar(const Value: Char);
@@ -709,6 +718,35 @@ begin
 end;
 
 function TBillsCacheTree.AddNodeByCodeName(const ACode, AName: string): TBillsCacheNode;
+
+  function GetLastXmjParentOrg: TBillsCacheNode;
+  begin
+    Result := TBillsCacheNode(FLastNode);
+    while Assigned(Result) and ((Result.B_Code <> '') or (Result.Code = '')) do
+      Result := TBillsCacheNode(Result.Parent);
+  end;
+
+  function HasSiblingGclNode(ANode: TBillsCacheNode): Boolean;
+  var
+    Sibling: TBillsCacheNode;
+  begin
+    Result := False;
+    Sibling := TBillsCacheNode(ANode.PreSibling);
+    while Assigned(Sibling) and not Result do
+    begin
+      if Sibling.B_Code <> '' then
+        Result := True;
+      Sibling := TBillsCacheNode(Sibling.PreSibling);
+    end;
+  end;
+
+  function GetParentWithBlankNode: TBillsCacheNode;
+  begin
+    Result := TBillsCacheNode(FLastBlankNode);
+    if HasSiblingGclNode(Result) then
+      Result := TBillsCacheNode(FLastBlankNode.Parent);
+  end;
+
 var
   Parent, NextSibling: TBillsCacheNode;
 begin
@@ -716,7 +754,10 @@ begin
   if Assigned(Result) then
   begin
     FLastNode := Result;
-    if (ACode = '') then FLastBlankNode := Result;
+    if (ACode = '') then
+      FLastBlankNode := Result
+    else
+      FLastBlankNode := nil;
     Exit;
   end;
 
@@ -729,12 +770,17 @@ begin
   end
   else if (AName = '其他费用项目') or (AName = '建设期贷款利息') or (Pos('公路功能以外的工程费用', AName) > 0) then
     Parent := TBillsCacheNode(Root)
+  else if Assigned(FLastBlankNode) then
+    Parent := GetParentWithBlankNode
   else
-    Parent := TBillsCacheNode(FLastBlankNode);
+    Parent := GetLastXmjParentOrg;
   Result := AddNode(Parent, NextSibling);
   Result.FLevelCode := ACode;
   FLastNode := Result;
-  if (ACode = '') then FLastBlankNode := Result;
+  if (ACode = '') then
+    FLastBlankNode := Result
+  else
+    FLastBlankNode := nil;
 end;
 
 function TBillsCacheTree.FindFxNode(const ACode,

+ 2 - 1
Units/ProjectData.pas

@@ -2075,6 +2075,7 @@ begin
       FPhaseIndex := APhaseIndex
     else
       FPhaseIndex := ProjProperties.PhaseCount;
+    ProjProperties.PhaseIndex := FPhaseIndex;
     FPhaseData.SimpleOpen2(Format('%sPhase%d.dat', [TempPath, FPhaseIndex]));
   end;
   FBillsMeasureData.ResetTreeNodeStageRec;
@@ -2091,7 +2092,7 @@ begin
   FWebID := AProjRec.ValueByName('WebID').AsInteger;
   FWebOwnerID := AProjRec.ValueByName('WebOwnerID').AsInteger;
   FWebAuthorID := AProjRec.ValueByName('WebAuthorID').AsInteger;
-  
+
   OpenForGather(GetMyProjectsFilePath + AProjRec.ValueByName('FileName').AsString, APhaseIndex);
   if _IsCloud then
     LoadCheckersData;