Browse Source

Merge branch 'master' of http://192.168.1.41:3000/MaiXinRong/Measure

chenshilong 5 years ago
parent
commit
8e1595b1b8
3 changed files with 35 additions and 16 deletions
  1. 13 7
      DataModules/BillsMeasureDm.pas
  2. 3 2
      Frames/BillsMeasureFme.dfm
  3. 19 7
      Frames/BillsMeasureFme.pas

+ 13 - 7
DataModules/BillsMeasureDm.pas

@@ -352,22 +352,28 @@ procedure TBillsMeasureData.sdvBillsMeasureSetText(var Text: String;
   var
   var
     vNode: TBillsIDTreeNode;
     vNode: TBillsIDTreeNode;
   begin
   begin
-    // ±ä¸üӦѡÔñ±ä¸üÁî
-    if SameText(AField , 'Qc') or SameText(AField , 'Pc') then
-      Allow := SelectAndUpdateBGL(GetBillsID, AValue.Owner, StrToFloatDef(Text, 0), AField);
-    if not Allow then Exit;
-
     if CheckStringNull(Text) or CheckNumeric(Text) then
     if CheckStringNull(Text) or CheckNumeric(Text) then
     begin
     begin
+      Text := FloatToStr(QuantityRoundTo(StrToFloatDef(Text, 0)));
+
+      // ±ä¸üӦѡÔñ±ä¸üÁî
+      if SameText(AField , 'Qc') or SameText(AField , 'Pc') then
+        Allow := SelectAndUpdateBGL(GetBillsID, AValue.Owner, StrToFloatDef(Text, 0), AField);
+      if not Allow then Exit;
+
       AValue.Owner.ValueByName(AField + 'Flag').AsInteger := 0;
       AValue.Owner.ValueByName(AField + 'Flag').AsInteger := 0;
       AValue.Owner.ValueByName(AField + 'Formula').AsString := '';
       AValue.Owner.ValueByName(AField + 'Formula').AsString := '';
-      Text := FloatToStr(QuantityRoundTo(StrToFloatDef(Text, 0)));
     end
     end
     else
     else
     begin
     begin
+      Text := FloatToStr(QuantityRoundTo(EvaluateExprs(Text)));
+      // ±ä¸üӦѡÔñ±ä¸üÁî
+      if SameText(AField , 'Qc') or SameText(AField , 'Pc') then
+        Allow := SelectAndUpdateBGL(GetBillsID, AValue.Owner, StrToFloatDef(Text, 0), AField);
+      if not Allow then Exit;
+
       AValue.Owner.ValueByName(AField + 'Flag').AsInteger := 1;
       AValue.Owner.ValueByName(AField + 'Flag').AsInteger := 1;
       AValue.Owner.ValueByName(AField + 'Formula').AsString := Text;
       AValue.Owner.ValueByName(AField + 'Formula').AsString := Text;
-      Text := FloatToStr(QuantityRoundTo(EvaluateExprs(Text)));
     end;
     end;
 
 
     ANode.Rec.SetIntValue(ANode.Rec.CalcType, 0);
     ANode.Rec.SetIntValue(ANode.Rec.CalcType, 0);

+ 3 - 2
Frames/BillsMeasureFme.dfm

@@ -64,6 +64,7 @@ object BillsMeasureFrame: TBillsMeasureFrame
       FrozenCol = 0
       FrozenCol = 0
       FrozenRow = 0
       FrozenRow = 0
       OnCurrentChanged = zgBillsMeasureCurrentChanged
       OnCurrentChanged = zgBillsMeasureCurrentChanged
+      OnCellCanEdit = zgBillsMeasureCellCanEdit
       OnCellButtonClick = zgBillsMeasureCellButtonClick
       OnCellButtonClick = zgBillsMeasureCellButtonClick
       OnCustomPaste = zgBillsMeasureCustomPaste
       OnCustomPaste = zgBillsMeasureCustomPaste
       OnCellGetColor = zgBillsMeasureCellGetColor
       OnCellGetColor = zgBillsMeasureCellGetColor
@@ -372,7 +373,7 @@ object BillsMeasureFrame: TBillsMeasureFrame
         Font.Style = []
         Font.Style = []
         FieldName = 'CurQcQuantity'
         FieldName = 'CurQcQuantity'
         Width = 60
         Width = 60
-        ReadOnly = False
+        ReadOnly = True
       end
       end
       item
       item
         Title.Caption = '|'#37329#39069
         Title.Caption = '|'#37329#39069
@@ -427,7 +428,7 @@ object BillsMeasureFrame: TBillsMeasureFrame
         Font.Style = []
         Font.Style = []
         FieldName = 'CurPcQuantity'
         FieldName = 'CurPcQuantity'
         Width = 60
         Width = 60
-        ReadOnly = False
+        ReadOnly = True
       end
       end
       item
       item
         Title.Caption = '|'#37329#39069
         Title.Caption = '|'#37329#39069

+ 19 - 7
Frames/BillsMeasureFme.pas

@@ -7,7 +7,7 @@ uses
   ColVisibleManager,
   ColVisibleManager,
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, ZJGrid, ComCtrls, ToolWin, StdCtrls, ExtCtrls, sdGridDBA,
   Dialogs, ZJGrid, ComCtrls, ToolWin, StdCtrls, ExtCtrls, sdGridDBA,
-  sdGridTreeDBA, sdDB, ActnList, dxBar, sdIDTree, JimLabels;
+  sdGridTreeDBA, sdDB, ActnList, dxBar, sdIDTree, JimLabels, ZJCells;
 
 
 type
 type
   TBillsMeasureFrame = class(TFrame)
   TBillsMeasureFrame = class(TFrame)
@@ -61,6 +61,8 @@ type
     procedure actnLocateZJJLExecute(Sender: TObject);
     procedure actnLocateZJJLExecute(Sender: TObject);
     procedure actnLocateZJJLUpdate(Sender: TObject);
     procedure actnLocateZJJLUpdate(Sender: TObject);
     procedure actnCalculateAllUpdate(Sender: TObject);
     procedure actnCalculateAllUpdate(Sender: TObject);
+    procedure zgBillsMeasureCellCanEdit(Sender: TObject;
+      const ACoord: TPoint; var Allow: Boolean);
   private
   private
     FBillsMeasureData: TBillsMeasureData;
     FBillsMeasureData: TBillsMeasureData;
     FShowPriceChange: Boolean;
     FShowPriceChange: Boolean;
@@ -133,7 +135,7 @@ implementation
 
 
 uses
 uses
   MainFrm, ProjectFme, ProjectData, ExportExcel, BGLDm, BGLSelectFrm,
   MainFrm, ProjectFme, ProjectData, ExportExcel, BGLDm, BGLSelectFrm,
-  Types, ZhAPI, BillsTree, mDataRecord, ConditionalDefines;
+  Types, ZhAPI, BillsTree, mDataRecord, ConditionalDefines, Math;
 
 
 { TBillsFrame }
 { TBillsFrame }
 
 
@@ -317,11 +319,11 @@ var
 begin
 begin
   iCol := zgBillsMeasure.CurCol - zgBillsMeasure.FixedColCount;
   iCol := zgBillsMeasure.CurCol - zgBillsMeasure.FixedColCount;
   Result := (iCol = stdBillsMeasure.VisibleCol('CurDealQuantity'))
   Result := (iCol = stdBillsMeasure.VisibleCol('CurDealQuantity'))
-         or (iCol = stdBillsMeasure.VisibleCol('CurDealTotalPrice'))
-         or (iCol = stdBillsMeasure.VisibleCol('CurQcQuantity'))
-         or (iCol = stdBillsMeasure.VisibleCol('CurQcTotalPrice'))
-         or (iCol = stdBillsMeasure.VisibleCol('CurPcQuantity'))
-         or (iCol = stdBillsMeasure.VisibleCol('CurPcTotalPrice'));
+         or (iCol = stdBillsMeasure.VisibleCol('CurDealTotalPrice'));
+         //or (iCol = stdBillsMeasure.VisibleCol('CurQcQuantity'))
+         //or (iCol = stdBillsMeasure.VisibleCol('CurQcTotalPrice'))
+         //or (iCol = stdBillsMeasure.VisibleCol('CurPcQuantity'))
+         //or (iCol = stdBillsMeasure.VisibleCol('CurPcTotalPrice'));
 end;
 end;
 
 
 procedure TBillsMeasureFrame.zgBillsMeasureCellButtonClick(Sender: TObject;
 procedure TBillsMeasureFrame.zgBillsMeasureCellButtonClick(Sender: TObject;
@@ -468,6 +470,9 @@ begin
   if (ssCtrl in Shift) and (ssShift in Shift) and (ssAlt in Shift)
   if (ssCtrl in Shift) and (ssShift in Shift) and (ssAlt in Shift)
       and (Key in [66, 98]) then
       and (Key in [66, 98]) then
     ShowIsGather := not ShowIsGather;
     ShowIsGather := not ShowIsGather;
+
+  if (Key in [48..57]) and (zgBillsMeasure.CurCol = 11) then
+    zgBillsMeasureCellButtonClick(Sender, zgBillsMeasure.CurCol, zgBillsMeasure.CurRow);
 end;
 end;
 
 
 procedure TBillsMeasureFrame.actnSetStageBookmarkExecute(Sender: TObject);
 procedure TBillsMeasureFrame.actnSetStageBookmarkExecute(Sender: TObject);
@@ -829,4 +834,11 @@ begin
   CanExecute := QuestMessage('请确认是否执行删除操作');
   CanExecute := QuestMessage('请确认是否执行删除操作');
 end;
 end;
 
 
+procedure TBillsMeasureFrame.zgBillsMeasureCellCanEdit(Sender: TObject;
+  const ACoord: TPoint; var Allow: Boolean);
+begin
+  if (ACoord.X = 11) then
+    Allow := False;
+end;
+
 end.
 end.