浏览代码

1. Task #2063 允许删除未计量清单
2. Task #2061 台账分解、计量台账,删除前询问
3. Bug #1594 桩号识别K0+000

MaiXinRong 6 年之前
父节点
当前提交
784b2f1aab

+ 3 - 0
DataModules/BillsCompileDm.dfm

@@ -100,6 +100,9 @@ object BillsCompileData: TBillsCompileData
       end
       item
         FieldName = 'IsGatherZJJL'
+      end
+      item
+        FieldName = 'IndexCode'
       end>
     AfterAddRecord = sdvBillsCompileAfterAddRecord
     BeforeValueChange = sdvBillsCompileBeforeValueChange

+ 7 - 0
DataModules/BillsDm.dfm

@@ -271,6 +271,13 @@ object BillsData: TBillsData
       000001044E616D65060C49734761746865725A4A4A4C094669656C644E616D65
       060C49734761746865725A4A4A4C084461746154797065020508446174615369
       7A6502010549734B6579080F4E65656450726F636573734E616D650909507265
+      636973696F6E02000453697A6502000001044E616D65060D4869734861734D65
+      6173757265094669656C644E616D65060D4869734861734D6561737572650844
+      617461547970650205084461746153697A6502010549734B6579080F4E656564
+      50726F636573734E616D650909507265636973696F6E02000453697A65020000
+      01044E616D65060D4375724861734D656173757265094669656C644E616D6506
+      0D4375724861734D656173757265084461746154797065020508446174615369
+      7A6502010549734B6579080F4E65656450726F636573734E616D650909507265
       636973696F6E02000453697A6502000000}
   end
 end

+ 22 - 3
DataModules/BillsMeasureDm.pas

@@ -72,6 +72,8 @@ type
 
     function FindNodeWithZJJL(ANode: TsdIDTreeNode): TsdIDTreeNode;
 
+    procedure CalcMeasureFilter(ANode: TsdIDTreeNode);
+
     // 计算 修改各期原报审核数据时,需对累计数据做增量
     procedure UpdateRecordDeal(ABillsID: Integer; AQuantity, ATotalPrice: Double);
     procedure UpdateRecordQc(ABillsID: Integer; AQuantity, ATotalPrice: Double);
@@ -819,11 +821,11 @@ var
   iID: Integer;
   vNode: TBillsIDTreeNode;
 begin
+  iID := AValue.Owner.ValueByName('ID').AsInteger;
+  vNode := TBillsIDTreeNode(BillsMeasureTree.FindNode(iID));
+
   if AValue.Owner.Owner.Name = 'sddBills' then
   begin
-    iID := AValue.Owner.ValueByName('ID').AsInteger;
-    vNode := TBillsIDTreeNode(BillsMeasureTree.FindNode(iID));
-
     if SameText(AValue.FieldName, 'Price') then
       TProjectData(FProjectData).BillsCompileData.Calculate(iID);
 
@@ -1219,4 +1221,21 @@ begin
   Result := TProjectData(FProjectData).ProjProperties.DecimalManager.Common;
 end;
 
+procedure TBillsMeasureData.CalcMeasureFilter(ANode: TsdIDTreeNode);
+var
+  i: Integer;
+  vNode: TMeasureBillsIDTreeNode;
+begin
+  if not Assigned(ANode) then Exit;
+
+  for i := 0 to ANode.ChildCount - 1 do
+    CalcMeasureFilter(ANode.ChildNodes[i]);
+
+  vNode := TMeasureBillsIDTreeNode(ANode);
+  vNode.Rec.HisHasMeasure.AsBoolean := vNode.Rec.HisHasMeasure.AsBoolean or vNode.Rec.CurHasMeasure.AsBoolean;
+  vNode.Rec.CurHasMeasure.AsBoolean := False;
+
+  CalcMeasureFilter(ANode.NextSibling);
+end;
+
 end.

+ 41 - 0
DataModules/StageDm.pas

@@ -380,6 +380,45 @@ begin
 end;
 
 procedure TStageData.sddStageAfterValueChanged(AValue: TsdValue);
+
+  function LeafCurHasMeasure(ANode: TMeasureBillsIDTreeNode): Boolean;
+  begin
+    Result := Assigned(ANode.StageRec) and
+       ((ANode.StageRec.DealQuantity.AsFloat <> 0) or
+        (ANode.StageRec.DealTotalPrice.AsFloat <> 0) or
+        (ANode.StageRec.QcQuantity.AsFloat <> 0) or
+        (ANode.StageRec.QcTotalPrice.AsFloat <> 0) or
+        (ANode.StageRec.PcQuantity.AsFloat <> 0) or
+        (ANode.StageRec.PcTotalPrice.AsFloat <> 0));
+  end;
+
+  function ParentCurHasMeasure(ANode: TBillsIDTreeNode): Boolean;
+  var
+    i: Integer;
+    vChild: TBillsIDTreeNode;
+  begin
+    Result := False;
+    for i := 0 to ANode.ChildCount - 1 do
+    begin
+      vChild := TMeasureBillsIDTreeNode(ANode.ChildNodes[i]);
+      if vChild.Rec.CurHasMeasure.AsBoolean then
+      begin
+        Result := True;
+        Break;
+      end;
+    end;
+  end;
+
+  procedure RecalcNodeCurHasMeasure(ANode: TBillsIDTreeNode);
+  begin
+    if not Assigned(ANode) then Exit;
+    if ANode.HasChildren then
+      ANode.Rec.CurHasMeasure.AsBoolean := ParentCurHasMeasure(ANode)
+    else
+      ANode.Rec.CurHasMeasure.AsBoolean := LeafCurHasMeasure(TMeasureBillsIDTreeNode(ANode));
+    RecalcNodeCurHasMeasure(TBillsIDTreeNode(ANode.Parent));
+  end;
+
 var
   iBillsID: Integer;
   stnNode: TsdIDTreeNode;
@@ -404,6 +443,8 @@ begin
   if (AValue.FieldName = 'DealQuantity') or
      (AValue.FieldName = 'QcQuantity') then
     UpdateProjectGL(iBillsID);
+
+  RecalcNodeCurHasMeasure(TBillsIDTreeNode(stnNode));
 end;
 
 function TStageData.GetMainBillsTree: TBillsIDTree;

+ 1 - 1
Forms/MainFrm.dfm

@@ -4,7 +4,7 @@ object MainForm: TMainForm
   Width = 750
   Height = 538
   ActiveControl = jpsMainProjectsManager
-  Caption = 'me'
+  Caption = 'measure'
   Color = clBtnFace
   Font.Charset = ANSI_CHARSET
   Font.Color = clWindowText

+ 18 - 0
Frames/BillsCompileFme.dfm

@@ -756,6 +756,24 @@ object BillsCompileFrame: TBillsCompileFrame
         Width = 50
         Visible = False
         ReadOnly = True
+      end
+      item
+        Title.Caption = 'IndexCode'
+        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 = 'IndexCode'
+        Visible = False
+        ReadOnly = False
       end>
     Grid = zgBillsCompile
     ExtendRowCount = 3

+ 10 - 1
Frames/BillsCompileFme.pas

@@ -99,6 +99,8 @@ type
     procedure SetShowDesignQuantity(const Value: Boolean);
     procedure SetShowAlias(const Value: Boolean);
     procedure SetShowApprovalCode(const Value: Boolean);
+
+    procedure OnGridBeforeDelete(Sender: TObject; var CanExecute: Boolean);
   public
     constructor Create(AParent: TFrame; ABillsCompileData: TBillsCompileData);
     destructor Destroy; override;
@@ -239,9 +241,10 @@ begin
   end;
   zgBillsCompile.OnExpandMouseDown := ExpandMouseDown;
   FBillsCompileData.RefreshRow := RefreshTreeRow;
-  
+
   if not _IsDebugView then
     zgBillsCompile.OnKeyDown := nil;
+  stdBillsCompile.OnGridBeforeDelete := OnGridBeforeDelete;
 end;
 
 destructor TBillsCompileFrame.Destroy;
@@ -736,4 +739,10 @@ begin
   zgBillsCompile.InvalidateRow(ARowIndex + zgBillsCompile.FixedRowCount);
 end;
 
+procedure TBillsCompileFrame.OnGridBeforeDelete(Sender: TObject;
+  var CanExecute: Boolean);
+begin
+  CanExecute := QuestMessage('请确认是否执行删除操作');
+end;
+
 end.

+ 9 - 0
Frames/BillsMeasureFme.pas

@@ -103,6 +103,8 @@ type
     procedure SetShowAlias(const Value: Boolean);
     procedure SetShowApprovalCode(const Value: Boolean);
     procedure SetShowIsGather(const Value: Boolean);
+
+    procedure OnGridBeforeDelete(Sender: TObject; var CanExecute: Boolean);
   public
     constructor Create(AProjectFrame: TFrame; ABillsMeasureData: TBillsMeasureData);
     destructor Destroy; override;
@@ -146,6 +148,7 @@ begin
   FColVisibleManager := TBM_ColVisibleManager.Create(stdBillsMeasure);
   if not _IsDebugView then
     zgBillsMeasure.OnKeyDown := nil;
+  stdBillsMeasure.OnGridBeforeDelete := OnGridBeforeDelete;
 end;
 
 destructor TBillsMeasureFrame.Destroy;
@@ -820,4 +823,10 @@ begin
   TAction(Sender).Enabled := PhaseData.Active and not PhaseData.StageDataReadOnly;
 end;
 
+procedure TBillsMeasureFrame.OnGridBeforeDelete(Sender: TObject;
+  var CanExecute: Boolean);
+begin
+  CanExecute := QuestMessage('请确认是否执行删除操作');
+end;
+
 end.

+ 3 - 1
Units/BillsTree.pas

@@ -172,7 +172,9 @@ function TBillsIDTree.CanDelete(ANode: TsdIDTreeNode): Boolean;
 begin
   Result := Inherited CanDelete(ANode)
             and ((ANode.ID >= 100) or (ANode.Level > 0))
-            and (not ANode.Rec.ValueByName('LockedLevel').AsBoolean)
+            and (not ANode.Rec.ValueByName('HisHasMeasure').AsBoolean)
+            and (not ANode.Rec.ValueByName('CurHasMeasure').AsBoolean)
+            //and (not ANode.Rec.ValueByName('LockedLevel').AsBoolean)
             and (ANode.Rec.ValueByName('AddDealQuantity').AsFloat = 0)
             and (ANode.Rec.ValueByName('AddDealTotalPrice').AsFloat = 0)
             and (ANode.Rec.ValueByName('AddQcQuantity').AsFloat = 0)

+ 1 - 1
Units/Connections.pas

@@ -8,7 +8,7 @@ uses
 const
   ProductName = 'Measure';
   EmptyFileVersion = '1.0.0.0';
-  FileVersion = '1.0.1.19';
+  FileVersion = '1.0.1.20';
   EncryptVersion = 'Auto1.0';
   SAdoConnectStr = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;' +
                    'User ID=Admin;Password='''';Persist Security Info=True';

+ 6 - 2
Units/DataBaseTables.pas

@@ -117,7 +117,7 @@ const
 
   {清单数据 -- 台账编辑界面}
   SBills = 'Bills';
-  tdBills: array [0..88] of TScFieldDef =(
+  tdBills: array [0..90] of TScFieldDef =(
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     (FieldName: 'ParentID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'NextSiblingID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False),
@@ -301,7 +301,11 @@ const
     // 批复编号
     (FieldName: 'ApprovalCode'; FieldType: ftString; Size: 50; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 计量汇总,生成中间计量时,是否汇总其下所有工程量清单
-    (FieldName: 'IsGatherZJJL'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+    (FieldName: 'IsGatherZJJL'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 往期是否计量
+    (FieldName: 'HisHasMeasure'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 当期是否计量
+    (FieldName: 'CurHasMeasure'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
   );
 
   {合同支付}

+ 5 - 0
Units/ProjectData.pas

@@ -1515,17 +1515,22 @@ begin
   FConnection.Open(MainFileName);
   UpdateProjectDataBase;
   FProjProperties.Open(FConnection.Connection);
+  FBillsData.Open(FConnection.Connection);
+  FBillsMeasureData.Open;
   if ProjProperties.PhaseCount > 0 then
   begin
     FPhaseIndex := ProjProperties.PhaseCount;
     FPhaseData.SimpleOpen(Format('%sPhase%d.dat', [TempPath, FPhaseIndex]));
   end;
   FStaffData.Open(FConnection.Connection);
+  FBillsMeasureData.ResetTreeNodeStageRec;
+  FBillsMeasureData.CalcMeasureFilter(FBillsMeasureData.BillsMeasureTree.FirstNode);
 end;
 
 procedure TProjectData.SaveForReceive(const AFileName: string);
 begin
   FStaffData.Save;
+  FBillsData.Save;
   if FPhaseData.Active then
     FPhaseData.SimpleSave;
   FProjProperties.Save;

+ 1 - 1
Units/UtilMethods.pas

@@ -653,7 +653,7 @@ function CheckPeg(const AStr: string): Boolean;
     iPosK := GetPosition(AStr, 'K', 'k');
     iPosPlus := GetPosition(AStr, '+', '£«');
     if (iPosK = 0) or (iPosPlus = 0) or (iPosPlus < iPosK) then Exit;
-    Result := TryStrToFloat(Copy(AStr, iPosK + 1, iPosPlus - iPosK - 1), fNum) and (fNum > 0);
+    Result := TryStrToFloat(Copy(AStr, iPosK + 1, iPosPlus - iPosK - 1), fNum) and (fNum >= 0);
   end;
 
   // K0-134.5 pass; k-2-134.5 fail;

+ 9 - 0
Units/mDataRecord.pas

@@ -110,6 +110,9 @@ type
     FCacheOrgTP: Double;
     FCacheOthTP: Double;
     FHasAttachment: TsdValue;
+
+    FCurHasMeasure: TsdValue;
+    FHisHasMeasure: TsdValue;
   protected
     procedure DoAfterAddFields; override;
   public
@@ -205,6 +208,9 @@ type
     property CacheOthTP: Double read FCacheOthTP write FCacheOthTP;
     
     property PM_AddTotalPrice: TsdValue read FPM_AddTotalPrice;
+
+    property HisHasMeasure: TsdValue read FHisHasMeasure;
+    property CurHasMeasure: TsdValue read FCurHasMeasure;
   end;
 
   TStageRecord = class(TMeasureBaseRecord)
@@ -598,6 +604,9 @@ begin
   FAddCompleteRate := ValueByName('AddCompleteRate');
   
   FPM_AddTotalPrice := ValueByName('PM_AddTotalPrice');
+
+  FHisHasMeasure := ValueByName('HisHasMeasure');
+  FCurHasMeasure := ValueByName('CurHasMeasure');
 end;
 
 { TStageRecord }