Ver código fonte

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

Chenshilong 9 anos atrás
pai
commit
6683e2395f

+ 9 - 9
Forms/MainFrm.dfm

@@ -20,7 +20,7 @@ object MainForm: TMainForm
   TextHeight = 12
   object jtsProjects: TJimTabSet
     Left = 0
-    Top = 48
+    Top = 49
     Width = 742
     Height = 21
     Align = alTop
@@ -45,7 +45,7 @@ object MainForm: TMainForm
   end
   object dxStatusBar: TdxStatusBar
     Left = 0
-    Top = 484
+    Top = 487
     Width = 742
     Height = 20
     Panels = <
@@ -93,9 +93,9 @@ object MainForm: TMainForm
   end
   object jpsMain: TJimPages
     Left = 0
-    Top = 69
+    Top = 70
     Width = 742
-    Height = 415
+    Height = 417
     ActivePage = jpsMainProjectsManager
     ActivePageIndex = 0
     Align = alClient
@@ -104,7 +104,7 @@ object MainForm: TMainForm
       Left = 0
       Top = 0
       Width = 742
-      Height = 415
+      Height = 417
       TabName = 'ProjectsManager'
       Caption = 'ProjsMgr'
       object pnlUser: TPanel
@@ -202,7 +202,7 @@ object MainForm: TMainForm
       Left = 0
       Top = 0
       Width = 742
-      Height = 415
+      Height = 417
       TabName = 'Projects'
       Caption = 'Projects'
       object jpsProjects: TJimPages
@@ -220,7 +220,7 @@ object MainForm: TMainForm
     Font.Charset = DEFAULT_CHARSET
     Font.Color = clWindowText
     Font.Height = -12
-    Font.Name = #23435#20307
+    Font.Name = 'Microsoft YaHei UI'
     Font.Style = []
     Bars = <
       item
@@ -270,7 +270,7 @@ object MainForm: TMainForm
         Caption = #24037#20855#26639
         DockedDockingStyle = dsTop
         DockedLeft = 0
-        DockedTop = 26
+        DockedTop = 27
         DockingStyle = dsTop
         FloatLeft = 484
         FloatTop = 279
@@ -379,7 +379,7 @@ object MainForm: TMainForm
     DockControlHeights = (
       0
       0
-      48
+      49
       0)
     object dxsiFile: TdxBarSubItem
       Caption = #25991#20214'(&F)'

+ 8 - 2
Forms/MainFrm.pas

@@ -715,7 +715,10 @@ begin
   begin
     Exportor := TIDTreeExcelExportor.Create;
     try
-      Exportor.DefineCol(@ciLedger, Length(ciLedger));
+      if SupportManager.ConfigInfo.ExcelWithMis then
+        Exportor.DefineCol(@ciLedgerWithMis, Length(ciLedgerWithMis))
+      else
+        Exportor.DefineCol(@ciLedger, Length(ciLedger));
       Exportor.HasLevelCode := True;
       Exportor.ExportToFile(CurProjectFrame.ProjectData.BillsCompileData.BillsCompileTree, sFileName);
     finally
@@ -799,7 +802,10 @@ begin
   begin
     Exportor := TIDTreeExcelExportor.Create;
     try
-      Exportor.DefineCol(@ciFxBills, Length(ciFxBills));
+      if SupportManager.ConfigInfo.ExcelWithMis then
+        Exportor.DefineCol(@ciFxBillsWithMis, Length(ciFxBillsWithMis))
+      else
+        Exportor.DefineCol(@ciFxBills, Length(ciFxBills));
       Exportor.ExportToFile(CurProjectFrame.ProjectData.BillsCompileData.BillsCompileTree, sFileName);
     finally
       Exportor.Free;

+ 17 - 0
Forms/OptionFrm.dfm

@@ -125,6 +125,23 @@ object OptionForm: TOptionForm
           OnClick = rbLedgerClick
         end
       end
+      object GroupBox1: TGroupBox
+        Left = 11
+        Top = 176
+        Width = 430
+        Height = 49
+        Caption = #23548#20986'Excel'
+        TabOrder = 4
+        object cbExcelWithMis: TCheckBox
+          Left = 11
+          Top = 20
+          Width = 142
+          Height = 17
+          Caption = #21253#21547#38169#28431#22686#20943#25968#37327
+          TabOrder = 0
+          OnClick = cbAutoSaveClick
+        end
+      end
     end
   end
   object btnOk: TButton

+ 4 - 0
Forms/OptionFrm.pas

@@ -24,6 +24,8 @@ type
     rbLedger: TRadioButton;
     rbDeal: TRadioButton;
     rbBoth: TRadioButton;
+    GroupBox1: TGroupBox;
+    cbExcelWithMis: TCheckBox;
     procedure cbAutoSaveClick(Sender: TObject);
     procedure rbLedgerClick(Sender: TObject);
   private
@@ -70,6 +72,7 @@ begin
     SetSaveIntervalEnable(cbAutoSave.Checked);
     cbbSaveIntervall.Text := IntToStr(AutoSaveInterval);
     Self.OverRangeType := OverRangeType;
+    cbExcelWithMis.Checked := ExcelWithMis;
   end;
 end;
 
@@ -80,6 +83,7 @@ begin
     AutoSave := cbAutoSave.Checked;
     AutoSaveInterval := StrToIntDef(cbbSaveIntervall.Text, 15);
     OverRangeType := Self.OverRangeType;
+    ExcelWithMis := cbExcelWithMis.Checked;
   end;
 end;
 

+ 4 - 0
Units/ConfigDoc.pas

@@ -21,6 +21,7 @@ type
     FAutoSave: Boolean;
     FAutoSaveInterval: Integer;
     FOverRangeType: Integer;
+    FExcelWithMis: Boolean;
 
     procedure LoadSectionOfUnitList;
     procedure LoadSectionOfStdFile;
@@ -56,6 +57,7 @@ type
     property AutoSave: Boolean read FAutoSave write FAutoSave;
     property AutoSaveInterval: Integer read FAutoSaveInterval write FAutoSaveInterval;
     property OverRangeType: Integer read FOverRangeType write FOverRangeType;
+    property ExcelWithMis: Boolean read FExcelWithMis write FExcelWithMis;
   end;
 
 implementation
@@ -111,6 +113,7 @@ begin
   FAutoSave := FIniFile.ReadBool('Options', 'AutoSave', True);
   FAutoSaveInterval := FIniFile.ReadInteger('Options', 'AutoSaveInterval', 15);
   FOverRangeType := FIniFile.ReadInteger('Options', 'OverRangeType', 0);
+  FExcelWithMis := FIniFile.ReadBool('Options', 'ExcelWithMis', False);
 end;
 
 procedure TConfigInfo.LoadSectionOfPath;
@@ -149,6 +152,7 @@ begin
   FIniFile.WriteBool('Options', 'AutoSave', FAutoSave);
   FIniFile.WriteInteger('Options', 'AutoSaveInterval', FAutoSaveInterval);
   FIniFile.WriteInteger('Options', 'OverRangeType', FOverRangeType);
+  FIniFile.WriteBool('Options', 'ExcelWithMis', FExcelWithMis);
 end;
 
 procedure TConfigInfo.SaveSectionOfStdFile;

+ 65 - 1
Units/ExcelImport.pas

@@ -82,6 +82,8 @@ type
     FMemoCol: Integer;
     FLevelCol: Integer;
 
+    procedure CheckFixedIDNodes;
+
     procedure BeginImport; override;
     procedure EndImport; override;
 
@@ -171,7 +173,7 @@ type
 implementation
 
 uses Variants, CacheTree, SysUtils, UtilMethods, sdDataSet, BillsDm,
-  DealBillsDm, SheetSelectFrm, ADODB, Math;
+  DealBillsDm, SheetSelectFrm, ADODB, Math, ConstUnit;
 
 { TExcelImport }
 
@@ -361,6 +363,10 @@ procedure TBillsEdtExcelImport.EndImport;
 begin
   // For Test
   // FCacheTree.SaveTreeToFile('E:\Tree.txt');
+
+  if FWithLevelCode then
+    CheckFixedIDNodes;
+
   FFixedIDNodes.Free;
   FBaseTree.Free;
   FProjectData.BillsData.EnableEvents;
@@ -598,6 +604,64 @@ begin
   UpdateProgressPosition(100, 100);
 end;
 
+procedure TBillsEdtExcelImport.CheckFixedIDNodes;
+
+  function GetHintStr(ANode: TBillsCacheNode): string;
+  begin
+    Result := '';
+    if ANode.Code <> '' then
+      Result := Result + '编号:' + ANode.Code + ';';
+    if ANode.Name <> '' then
+      Result := Result + '名称:' + ANode.Name + ';';
+  end;
+
+  function GetInvalidModel(ANoPM: Boolean; ACount: Integer): string;
+  begin
+    if ANoPM then
+    begin
+      if ACount > 1 then
+        Result := '价差功能,部分报表'
+      else
+        Result := '价差功能'
+    end
+    else
+      Result := '部分报表';
+    Result := Result + '将不可使用' + #13#10 + '如有疑问,请联系纵横客服,企业QQ:800003850 电话:(0756)3850888';
+  end;
+
+var
+  sgs: TStrings;
+  iBase: Integer;
+  vBase, vImport: TBillsCacheNode;
+  sHint: string;
+  bNoPM: Boolean;
+begin
+  bNoPM := False;
+  sgs := TStringList.Create;
+  try
+    sgs.Add('缺少如下固定清单节点:');
+    for iBase := 0 to FBaseTree.FixedIDNodes.Count - 1 do
+    begin
+      vBase := TBillsCacheNode(FBaseTree.FixedIDNodes.Items[iBase]);
+
+      vImport := FCacheTree.FindFixedIDNode(vBase.ID);
+      if not Assigned(vImport) then
+      begin
+        sgs.Add(GetHintStr(vBase));
+        if vBase.ID = iPriceMarginID then
+          bNoPM := True;
+      end;
+    end;
+  finally
+    if sgs.Count > 1 then
+    begin
+      sgs.Add(GetInvalidModel(bNoPM, sgs.Count - 1));
+      WarningMessage(sgs.Text);
+    end;
+    sgs.Free;
+  end;
+end;
+
 { TBillsPriceExcelImport }
 
 procedure TBillsPriceExcelImport.BeginImport;

+ 30 - 0
Units/ExportExcel.pas

@@ -96,6 +96,20 @@ const
     (FieldName: 'MemoStr'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '구鬧'; Width: 80; HorTextAlign: htaLeft)
   );
 
+  ciLedgerWithMis: array [0..10] of TColInfo =(
+    (FieldName: 'Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '淃커쌘긍뵀'; Width: 120; HorTextAlign: htaLeft),
+    (FieldName: 'B_Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '헌데긍뵀'; Width: 80; HorTextAlign: htaLeft),
+    (FieldName: 'Name'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '츰냔'; Width: 200; HorTextAlign: htaLeft),
+    (FieldName: 'Units'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '데貫'; Width: 40; HorTextAlign: htaCenter),
+    (FieldName: 'Price'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '데송'; Width: 60; HorTextAlign: htaRight),
+    (FieldName: 'OrgQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '嘉묏暠鑒좆'; Width: 90; HorTextAlign: htaRight),
+    (FieldName: 'MisQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '�셕댄짤鑒좆'; Width: 90; HorTextAlign: htaRight),
+    (FieldName: 'OthQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '페儉댄짤鑒좆'; Width: 90; HorTextAlign: htaRight),
+    (FieldName: 'TotalPrice'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '쏜띨'; Width: 80; HorTextAlign: htaRight),
+    (FieldName: 'DrawingCode'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '暠뵀'; Width: 100; HorTextAlign: htaLeft),
+    (FieldName: 'MemoStr'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '구鬧'; Width: 80; HorTextAlign: htaLeft)
+  );
+
   ciFxBills: array [0..10] of TColInfo =(
     (FieldName: 'Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '渡炬淃커쌘'; Width: 120; HorTextAlign: htaLeft),
     (FieldName: 'B_Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '헌데綾커뵀'; Width: 80; HorTextAlign: htaLeft),
@@ -110,6 +124,22 @@ const
     (FieldName: 'MemoStr'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '구鬧'; Width: 80; HorTextAlign: htaLeft)
   );
 
+  ciFxBillsWithMis: array [0..12] of TColInfo =(
+    (FieldName: 'Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '渡炬淃커쌘'; Width: 120; HorTextAlign: htaLeft),
+    (FieldName: 'B_Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '헌데綾커뵀'; Width: 80; HorTextAlign: htaLeft),
+    (FieldName: 'Name'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '츰냔'; Width: 200; HorTextAlign: htaLeft),
+    (FieldName: 'Units'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '데貫'; Width: 40; HorTextAlign: htaCenter),
+    (FieldName: 'OrgQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '헌데鑒좆'; Width: 902; HorTextAlign: htaRight),
+    (FieldName: 'MisQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '�셕댄짤鑒좆'; Width: 90; HorTextAlign: htaRight),
+    (FieldName: 'OthQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '페儉댄짤鑒좆'; Width: 90; HorTextAlign: htaRight),
+    (FieldName: 'DgnQuantity1'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '�셕鑒좆1'; Width: 80; HorTextAlign: htaRight),
+    (FieldName: 'DgnQuantity2'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '�셕鑒좆2'; Width: 80; HorTextAlign: htaRight),
+    (FieldName: 'Price'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '데송'; Width: 60; HorTextAlign: htaRight),
+    (FieldName: 'TotalPrice'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '북송'; Width: 80; HorTextAlign: htaRight),
+    (FieldName: 'DrawingCode'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '暠뵀'; Width: 100; HorTextAlign: htaLeft),
+    (FieldName: 'MemoStr'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '구鬧'; Width: 80; HorTextAlign: htaLeft)
+  );
+
 implementation
 
 uses

+ 40 - 0
Units/MCacheTree.pas

@@ -42,6 +42,8 @@ type
     FLastNode: TCacheNode;
     FSeparateChar: Char;
     FAutoSort: Boolean;
+
+    FFixedIDNodes: TList;
     function GetNewNode(AID: Integer = -1): TBillsCacheNode; overload;
 
     function FindNode(const ACode: string): TBillsCacheNode; overload;
@@ -51,6 +53,9 @@ type
 
     procedure SetSeparateChar(const Value: Char);
   public
+    constructor Create; override;
+    destructor Destroy; override;
+
     function AddNode(AParent: TCacheNode; ANextSibling: TCacheNode = nil; AFixedID: Integer = -1): TBillsCacheNode;
     function AddNodeByCode(const ACode: string; AFixedID: Integer = -1): TBillsCacheNode;
     function AddLeafBillsNode(const AB_Code: string): TBillsCacheNode;
@@ -58,11 +63,15 @@ type
     function FindXmjChild(AParent: TBillsCacheNode; const ACode, AName: string): TBillsCacheNode;
     function FindGclChild(AParent: TBillsCacheNode; const AB_Code, AName, AUnits: string; APrice: Double): TBillsCacheNode;
 
+    function FindFixedIDNode(AID: Integer): TBillsCacheNode;
+
     // Only for Debugging lot of Data
     procedure SaveTreeToFile(const AFileName: string);
 
     property SeparateChar: Char read FSeparateChar write SetSeparateChar;
     property AutoSort: Boolean read FAutoSort write FAutoSort;
+
+    property FixedIDNodes: TList read FFixedIDNodes;
   end;
 
   // 此树仅用于导入工程量清单,禁止作为它用
@@ -402,6 +411,8 @@ begin
   else
     Result := TBillsCacheNode.Create(Self, AID);
   CacheNodes.Add(Result);
+  if Result.ID < 100 then
+    FFixedIDNodes.Add(Result);
 end;
 
 function TBillsCacheTree.AddNode(AParent, ANextSibling: TCacheNode;
@@ -508,6 +519,35 @@ begin
   end;
 end;
 
+constructor TBillsCacheTree.Create;
+begin
+  inherited;
+  FFixedIDNodes := TList.Create;
+end;
+
+destructor TBillsCacheTree.Destroy;
+begin
+  FFixedIDNodes.Free;
+  inherited;
+end;
+
+function TBillsCacheTree.FindFixedIDNode(AID: Integer): TBillsCacheNode;
+var
+  iNode: Integer;
+  vNode: TCacheNode;
+begin
+  Result := nil;
+  for iNode := 0 to FFixedIDNodes.Count - 1 do
+  begin
+    vNode := TCacheNode(FFixedIDNodes.Items[iNode]);
+    if vNode.ID = AID then
+    begin
+      Result := TBillsCacheNode(vNode);
+      Break;
+    end;
+  end;
+end;
+
 { TReportCacheNode }
 
 constructor TReportCacheNode.Create(ACacheTree: TCacheTree; AID,