浏览代码

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

CSL 9 年之前
父节点
当前提交
72dc1d7cbd

+ 23 - 2
DataModules/BGLDm.pas

@@ -127,6 +127,7 @@ type
     function CheckBGLUsed(ABGID: Integer): Boolean;
 
     function LocateBGL(const ACode: string): Boolean;
+    function LocateBGBills(ABGID: Integer; const AB_Code: string): Boolean;
 
     procedure LockAllBGL;
     procedure LockAllBGBills;
@@ -376,7 +377,7 @@ var
 begin
   for I := 0 to ABGLInfo.Count - 1 do
     if LocateBGL(ABGLInfo.Codes[I]) and
-        cdsBGBills.Locate('BGID;B_Code', VarArrayOf([cdsBGLID.AsInteger, ABGLInfo.B_Code]), []) then
+        LocateBGBills(cdsBGLID.AsInteger, ABGLInfo.B_Code) then
     begin
       cdsBGBills.Edit;
       if ABGLInfo.IsOrg then
@@ -617,7 +618,10 @@ begin
   if cdsBGL.FindKey([ABGLID]) then
   begin
     cdsBGL.Edit;
-    cdsBGLExecutionRate.AsFloat := AdvRoundTo(GetBGLExecutionTotalPrice/cdsBGLTotalPrice.AsFloat*100);
+    if cdsBGLTotalPrice.AsFloat <> 0 then
+      cdsBGLExecutionRate.AsFloat := AdvRoundTo(GetBGLExecutionTotalPrice/cdsBGLTotalPrice.AsFloat*100)
+    else
+      cdsBGLExecutionRate.AsFloat := 0;
     cdsBGL.Post;
   end;
 end;
@@ -667,4 +671,21 @@ begin
   end;
 end;
 
+function TBGLData.LocateBGBills(ABGID: Integer;
+  const AB_Code: string): Boolean;
+begin
+  Result := False;
+  cdsBGBills.First;
+  while (not cdsBGBills.Eof) do
+  begin
+    if (cdsBGBillsBGID.AsInteger = ABGID) and
+       SameText(cdsBGBillsB_Code.AsString, AB_Code) then
+    begin
+      Result := True;
+      Break;
+    end;
+    cdsBGBills.Next;
+  end;
+end;
+
 end.

+ 9 - 0
DataModules/BillsMeasureDm.pas

@@ -288,9 +288,18 @@ procedure TBillsMeasureData.sdvBillsMeasureSetText(var Text: String;
     vNode := BillsMeasureTree.FindNode(GetBillsID);
     iCreatePhase := vNode.Rec.ValueByName('CreatePhaseID').AsInteger;
 
+    if SameText('B_Code', AColumn.FieldName) or
+        SameText('Name', AColumn.FieldName) or
+        SameText('Units', AColumn.FieldName) then
+      if vNode.Rec.ValueByName('AddQcQuantity').AsFloat <> 0 then
+        DataSetErrorMessage(Allow, '该清单已进行过变更,不可修改清单编号、名称、单位!');
+    if not Allow then Exit;
+
     if SameText('Price', AColumn.FieldName) then
       if vNode.Rec.ValueByName('AddGatherTotalPrice').AsFloat <> 0 then
         DataSetErrorMessage(Allow, '该清单已经计量,不可修改清单单价!');
+    if not Allow then Exit;
+
     if SameText('NewPrice', AColumn.FieldName) then
       if vNode.Rec.ValueByName('AddPcTotalPrice').AsFloat <> 0 then
         DataSetErrorMessage(Allow, '该清单已经计量,不可修改清单变更单价!');

+ 78 - 0
Forms/BillsPasteSelectFrm.dfm

@@ -0,0 +1,78 @@
+object BillsPasteSelectForm: TBillsPasteSelectForm
+  Left = 596
+  Top = 356
+  Width = 251
+  Height = 124
+  Caption = #20301#32622#36873#25321
+  Color = clBtnFace
+  Font.Charset = DEFAULT_CHARSET
+  Font.Color = clWindowText
+  Font.Height = -11
+  Font.Name = 'MS Sans Serif'
+  Font.Style = []
+  OldCreateOrder = False
+  PixelsPerInch = 96
+  TextHeight = 13
+  object Label1: TLabel
+    Left = 6
+    Top = 5
+    Width = 132
+    Height = 13
+    Caption = #35831#36873#25321#25554#20837#33410#28857#30340#31867#22411#65306
+  end
+  object btnOk: TButton
+    Left = 114
+    Top = 63
+    Width = 55
+    Height = 21
+    Caption = #30830#23450
+    TabOrder = 0
+    OnClick = btnOkClick
+  end
+  object btnCancel: TButton
+    Left = 178
+    Top = 63
+    Width = 55
+    Height = 21
+    Caption = #21462#28040
+    ModalResult = 2
+    TabOrder = 1
+  end
+  object pnlPos: TPanel
+    Left = 18
+    Top = 24
+    Width = 207
+    Height = 33
+    BevelInner = bvRaised
+    BevelOuter = bvLowered
+    TabOrder = 2
+    object rbNext: TRadioButton
+      Tag = 1
+      Left = 71
+      Top = 9
+      Width = 49
+      Height = 17
+      Caption = #21518#39033
+      Checked = True
+      TabOrder = 0
+      TabStop = True
+    end
+    object rbPre: TRadioButton
+      Tag = 2
+      Left = 137
+      Top = 9
+      Width = 49
+      Height = 17
+      Caption = #21069#39033
+      TabOrder = 1
+    end
+    object rbChild: TRadioButton
+      Left = 8
+      Top = 9
+      Width = 49
+      Height = 17
+      Caption = #23376#39033
+      TabOrder = 2
+    end
+  end
+end

+ 70 - 0
Forms/BillsPasteSelectFrm.pas

@@ -0,0 +1,70 @@
+unit BillsPasteSelectFrm;
+
+interface
+
+uses
+  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
+  Dialogs, ExtCtrls, StdCtrls;
+
+type
+  TBillsPasteSelectForm = class(TForm)
+    btnOk: TButton;
+    btnCancel: TButton;
+    pnlPos: TPanel;
+    rbNext: TRadioButton;
+    rbPre: TRadioButton;
+    rbChild: TRadioButton;
+    Label1: TLabel;
+    procedure btnOkClick(Sender: TObject);
+  private
+    function GetPos: Integer;
+  public
+    property Pos: Integer read GetPos;
+  end;
+
+  function SelectBillsPasteType(var APos: Integer): Boolean;
+
+implementation
+
+uses
+  UtilMethods;
+
+{$R *.dfm}
+
+function SelectBillsPasteType(var APos: Integer): Boolean;
+var
+  SelectForm: TBillsPasteSelectForm;
+begin
+  SelectForm := TBillsPasteSelectForm.Create(nil);
+  try
+    Result := SelectForm.ShowModal = mrOk;
+    if Result then
+      APos := SelectForm.Pos;
+  finally
+    SelectForm.Free;
+  end;
+end;
+
+{ TBillsPasteSelectForm }
+
+function TBillsPasteSelectForm.GetPos: Integer;
+begin
+  if rbChild.Checked then
+    Result := 0
+  else if rbNext.Checked then
+    Result := 1
+  else if rbPre.Checked then
+    Result := 2
+  else
+    Result := -1;
+end;
+
+procedure TBillsPasteSelectForm.btnOkClick(Sender: TObject);
+begin
+  if (Pos = -1) then
+    WarningMessage('粘贴层次结构模式下,须选择插入节点的类型!')
+  else
+    ModalResult := mrOk;
+end;
+
+end.

+ 3 - 0
Forms/MainFrm.pas

@@ -709,6 +709,9 @@ begin
   sFileName := SupportManager.ConfigInfo.OutputPath + CurProjectFrame.ProjectData.ProjectName;
   if SaveFile(sFileName, '.ctf') then
   begin
+    if FileExists(sFileName) and not QuestMessage(Format('存在同名文件“%s”,是否替换?', [ExtractFileName(sFileName)])) then
+      Exit;
+
     Screen.Cursor := crHourGlass;
     try
       Rec := ProjectManagerFrame.Rec(CurProjectFrame.ProjectData.ProjectID);

+ 3 - 0
Forms/ProjectPropertiesFrm.dfm

@@ -107,6 +107,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
       ButtonWidth = 17
       DropDownBox.Width = 145
       DropDownBox.Height = 150
+      DropDownBox.ShowToolBar = False
       Style = cbsOfficeXP
       ItemIndex = -1
       ItemHeight = 14
@@ -950,6 +951,8 @@ object ProjectPropertiesForm: TProjectPropertiesForm
         DefaultColWidth = 73
         Selection.AlphaBlend = False
         Selection.TransparentColor = False
+        FrozenCol = 0
+        FrozenRow = 0
         OnCellGetColor = zgStaffCellGetColor
         OnCellGetFont = zgStaffCellGetFont
         Font.Charset = ANSI_CHARSET

+ 2 - 1
Forms/ProjectPropertiesFrm.pas

@@ -455,7 +455,8 @@ begin
     if leNewUnLockPassword.Text = leNewUnlockPasswordAgain.Text then
       FProjProperties.UnlockInfoPassword := leNewUnLockPassword.Text
     else ShowErrorMessage('两次密码输入不一致,密码修改不成功!')
-  else ShowErrorMessage('原密码输入错误,密码修改不成功!');
+  else if leUnlockPassword.Text <> '' then
+    ShowErrorMessage('原密码输入错误,密码修改不成功!');
 end;
 
 procedure TProjectPropertiesForm.leUnlockPasswordKeyPress(Sender: TObject;

+ 2 - 0
Frames/BillsCompileFme.dfm

@@ -61,6 +61,8 @@ object BillsCompileFrame: TBillsCompileFrame
       DefaultFixedColWidth = 30
       Selection.AlphaBlend = False
       Selection.TransparentColor = False
+      FrozenCol = 0
+      FrozenRow = 0
       OnCustomPaste = zgBillsCompileCustomPaste
       OnCopy = zgBillsCompileCopy
       OnPaste = zgBillsCompilePaste

+ 13 - 7
Frames/BillsCompileFme.pas

@@ -4,7 +4,7 @@ interface
 
 uses
   BillsCompileDm, UtilMethods, BillsClipboard, sdIDTree, BatchReplaceBillsFrm,
-  CheckAndClearFrm, DealBillsFrm,
+  CheckAndClearFrm, DealBillsFrm, BillsPasteSelectFrm,
   sdDB,
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
   Dialogs, ActnList, sdGridDBA, sdGridTreeDBA, dxBar, ZJGrid, StdCtrls,
@@ -130,13 +130,19 @@ procedure TBillsCompileFrame.PasteBillsBlock(ANode: TsdIDTreeNode;
   ABounds: TRect);
 var
   Clipboard: TBillsClipboard;
+  iPos: Integer;
 begin
-  Clipboard := TBillsClipboard.Create(FBillsCompileData.BillsData);
-  try
-    Clipboard.Paste(ANode, 1);
-  finally
-    FBillsCompileData.CalculateAll;
-    Clipboard.Free;
+  if SelectBillsPasteType(iPos) then
+  begin
+    if iPos = -1 then Exit;
+
+    Clipboard := TBillsClipboard.Create(FBillsCompileData.BillsData);
+    try
+      Clipboard.Paste(ANode, iPos);
+    finally
+      FBillsCompileData.CalculateAll;
+      Clipboard.Free;
+    end;
   end;
 end;
 

+ 1 - 1
Frames/ProjectFme.pas

@@ -813,7 +813,7 @@ begin
 
       // Éú³ÉÎÞËøÎļþ
       vRec := MainForm.ProjectManagerFrame.Rec(ProjectData.ProjectID);
-      vExportor := TTenderExport.Create(vRec, sAppFile_UnLock, True);
+      vExportor := TTenderExport.Create(vRec, sAppFile_UnLock);
       try
         vExportor.Execute;
       finally

+ 6 - 2
Frames/ProjectManagerFme.pas

@@ -905,6 +905,9 @@ procedure TProjectManagerFrame.actnExportExecute(Sender: TObject);
     sFileName := SupportManager.ConfigInfo.OutputPath + ANode.Rec.ValueByName('Name').AsString + '.mtf';
     if SaveFile(sFileName, '.mtf') then
     begin
+      if FileExists(sFileName) and not QuestMessage(Format('存在同名文件“%s”,是否替换?', [ExtractFileName(sFileName)])) then
+        Exit;
+
       Screen.Cursor := crHourGlass;
       try
         Exportor := TTenderExport.Create(ANode.Rec, sFileName);
@@ -938,6 +941,9 @@ procedure TProjectManagerFrame.actnExportExecute(Sender: TObject);
     sFileName := SupportManager.ConfigInfo.OutputPath + ANode.Rec.ValueByName('Name').AsString + '.mpf';
     if SaveFile(sFileName, '.mpf') then
     begin
+      if FileExists(sFileName) and not QuestMessage(Format('存在同名文件“%s”,是否替换?', [ExtractFileName(sFileName)])) then
+        Exit;
+
       Screen.Cursor := crHourGlass;
       try
         bExpAtch := False;
@@ -969,10 +975,8 @@ begin
   stnNode := stdProjects.IDTree.Selected;
   if stnNode.Rec.ValueByName('Type').AsInteger = 1 then
   begin
-
     ExportTender(stnNode);
   end
-
   else
     ExportProject(stnNode);
 end;

+ 1 - 0
Units/BillsClipboard.pas

@@ -68,6 +68,7 @@ type
     destructor Destroy; override;
 
     procedure Copy(ANode: TsdIDTreeNode; ACount: Integer);
+    // APos: 0[×ÓÏî] 1[ºóÏî] 2[ǰÏî]
     procedure Paste(ANode: TsdIDTreeNode; APos: Integer);
   end;
 

+ 5 - 9
Units/ProjectCommands.pas

@@ -121,7 +121,6 @@ type
    6. 删除临时文件夹}
   TTenderExport = class
   private
-    FIngore: Boolean;
     // 临时文件夹(生成的项目文件、xml属性文件)
     FTempFolder: string;
     FProjectName: string;
@@ -139,7 +138,7 @@ type
     procedure SaveInfoToXmlDocument(AXmlNode: IXMLNode);
     procedure ExportXmlInfo;
   public
-    constructor Create(ARec: TsdDataRecord; const AFileName: string; AIngore: Boolean = False);
+    constructor Create(ARec: TsdDataRecord; const AFileName: string);
     destructor Destroy; override;
     // 参数AExportAttachment:是否导出附件
     procedure Execute(AExportAttachment: Boolean = False);
@@ -610,9 +609,8 @@ end;
 { TTenderExport }
 
 constructor TTenderExport.Create(ARec: TsdDataRecord;
-  const AFileName: string; AIngore: Boolean = False);
+  const AFileName: string);
 begin
-  FIngore := AIngore;
   FProjectName := ARec.ValueByName('Name').AsString;
   FFileName := GetMyProjectsFilePath +  ARec.ValueByName('FileName').AsString;
   if not G_IsCloud then
@@ -641,8 +639,7 @@ begin
     if AExportAttachment then
       CopyFolder(FAttachmentPath, FTempFolder + '\' + sFileName + '[附件包]');
 
-  if FIngore or (not FileExists(FResultFile) or QuestMessage('存在同名文件,是否替换?')) then
-    ZipFolder(FTempFolder, FResultFile);
+  ZipFolder(FTempFolder, FResultFile);
 end;
 
 procedure TTenderExport.ExportXmlInfo;
@@ -724,8 +721,7 @@ procedure TProjectExport.Execute;
 begin
   ExportXmlInfo;
   ExportNode(FExportNode.FirstChild, FTempFolder + '\');
-  if not FileExists(FResultFile) or QuestMessage('存在同名文件,是否替换?') then
-    ZipFolder(FTempFolder, FResultFile);
+  ZipFolder(FTempFolder, FResultFile);
 end;
 
 procedure TProjectExport.ExportNode(ANode: TsdIDTreeNode;
@@ -749,7 +745,7 @@ procedure TProjectExport.ExportTender(ANode: TsdIDTreeNode;
   const AExportPath: string);
 begin
   FTenderExportor := TTenderExport.Create(ANode.Rec,
-    AExportPath + ANode.Rec.ValueByName('Name').AsString, True);
+    AExportPath + ANode.Rec.ValueByName('Name').AsString);
   try
     FTenderExportor.Execute(FExportAttachment);
   finally