Pārlūkot izejas kodu

检查是否含有价差调整节点,无则不允许使用价差调整功能

MaiXinRong 9 gadi atpakaļ
vecāks
revīzija
75ed69a44a
3 mainītis faili ar 26 papildinājumiem un 2 dzēšanām
  1. 14 0
      DataModules/StageDm.pas
  2. 10 1
      Frames/ProjectFme.pas
  3. 2 1
      Units/Connections.pas

+ 14 - 0
DataModules/StageDm.pas

@@ -31,6 +31,8 @@ type
     procedure UpdateParentRecord(ABillsID: Integer; ATotalPrice: Double; const AFieldName: string);
     procedure UpdateComplete(ABillsID: Integer; AQuantity, ATotalPrice: Double);
 
+    function HasPriceMarginBills: Boolean;
+
     // 向父项增量--PM_TotalPrice
     procedure UpdateParentPriceMargin(ABillsID: Integer; ADiffer: Double);
     // 向价差调整节点增量--GatherTotalPrice
@@ -812,6 +814,8 @@ var
   Rec: TStageRecord;
   fDiffer: Double;
 begin
+  if not HasPriceMarginBills then Exit;
+   
   with TProjectData(TPhaseData(FPhaseData).ProjectData) do
   begin
     Rec := StageRecord(iPriceMarginID);
@@ -854,6 +858,8 @@ var
   Rec: TStageRecord;
   fPM, fPMDiffer: Double;
 begin
+  if not HasPriceMarginBills then Exit;
+  
   Rec := StageRecord(ABillsID);
   if not Assigned(Rec) then Exit;
 
@@ -940,4 +946,12 @@ begin
   end;
 end;
 
+function TStageData.HasPriceMarginBills: Boolean;
+var
+  vPM_Node: TsdIDTreeNode;
+begin
+  vPM_Node := MainBillsTree.FindNode(iPriceMarginID);
+  Result := Assigned(vPM_Node);
+end;
+
 end.

+ 10 - 1
Frames/ProjectFme.pas

@@ -566,8 +566,17 @@ procedure TProjectFrame.dxsbViewControlItemClick(Sender: TObject;
   end;
 
   procedure DisplayPriceMargin;
+  var
+    vPM_Node: TsdIDTreeNode;
   begin
-    if ProjectData.ProjProperties.PhaseCount = 0 then
+    vPM_Node := FProjectData.BillsCompileData.BillsCompileTree.FindNode(iPriceMarginID);
+    if not Assigned(vPM_Node) then
+    begin
+      ErrorMessage('台账中无预定义价差节点,不可使用价差功能');
+      dxsbViewControl.SelectedItem := dxsbViewControl.ActiveGroup.Items[jpsMain.ActivePageIndex];
+      Abort;
+    end
+    else if ProjectData.ProjProperties.PhaseCount = 0 then
     begin
       TipMessage('未计量前不可进行材料调差。');
       dxsbViewControl.SelectedItem := dxsbViewControl.ActiveGroup.Items[jpsMain.ActivePageIndex];

+ 2 - 1
Units/Connections.pas

@@ -7,6 +7,7 @@ uses
 
 const
   ProductName = 'Measure';
+  EmptyFileVersion = '1.0.0.0';
   FileVersion = '1.0.0.1';
   EncryptVersion = 'Auto1.0';
 
@@ -344,7 +345,7 @@ begin
     FFileHead.ProductName := ProductName;
     FFileHead.FileType := 1;
     FFileHead.EncryptVersion := EncryptVersion;
-    FFileHead.FileVersion := FileVersion;
+    FFileHead.FileVersion := EmptyFileVersion;
     FFileHead.CreateExeVersion := GetVersion;
     FFileHead.LastestExeVersion := GetVersion;
     FFileHead.MaxExeVersion := GetVersion;