Bläddra i källkod

Task #1557.1 ZJJL, DB Data replace memory data

MaiXinRong 8 år sedan
förälder
incheckning
4c3bb609d5
6 ändrade filer med 148 tillägg och 11 borttagningar
  1. 58 0
      DataModules/ZJJLDm.dfm
  2. 52 5
      DataModules/ZJJLDm.pas
  3. 1 1
      Units/Connections.pas
  4. 23 2
      Units/DataBaseTables.pas
  5. 13 0
      Units/PhaseProperty.pas
  6. 1 3
      Units/ProjectData.pas

+ 58 - 0
DataModules/ZJJLDm.dfm

@@ -51,6 +51,35 @@ object ZJJLData: TZJJLData
     object cdsZJJLType: TIntegerField
       FieldName = 'Type'
     end
+    object cdsZJJLBGLCode: TMemoField
+      FieldName = 'BGLCode'
+      BlobType = ftMemo
+      Size = 60535
+    end
+    object cdsZJJLPegName: TWideStringField
+      FieldName = 'PegName'
+      Size = 50
+    end
+    object cdsZJJLFBFXName: TWideStringField
+      FieldName = 'FBFXName'
+      Size = 255
+    end
+    object cdsZJJLBeginPeg: TWideStringField
+      FieldName = 'BeginPeg'
+      Size = 50
+    end
+    object cdsZJJLEndPeg: TWideStringField
+      FieldName = 'EndPeg'
+      Size = 50
+    end
+    object cdsZJJLUnitName: TWideStringField
+      FieldName = 'UnitName'
+      Size = 50
+    end
+    object cdsZJJLDrawingCode: TWideStringField
+      FieldName = 'DrawingCode'
+      Size = 50
+    end
   end
   object cdsZJJLView: TClientDataSet
     Aggregates = <>
@@ -88,5 +117,34 @@ object ZJJLData: TZJJLData
     object cdsZJJLViewType: TIntegerField
       FieldName = 'Type'
     end
+    object cdsZJJLViewBGLCode: TMemoField
+      FieldName = 'BGLCode'
+      BlobType = ftMemo
+      Size = 60535
+    end
+    object cdsZJJLViewPegName: TWideStringField
+      FieldName = 'PegName'
+      Size = 50
+    end
+    object cdsZJJLViewFBFXName: TWideStringField
+      FieldName = 'FBFXName'
+      Size = 50
+    end
+    object cdsZJJLViewBeginPeg: TWideStringField
+      FieldName = 'BeginPeg'
+      Size = 50
+    end
+    object cdsZJJLViewEndPeg: TWideStringField
+      FieldName = 'EndPeg'
+      Size = 50
+    end
+    object cdsZJJLViewUnitName: TWideStringField
+      FieldName = 'UnitName'
+      Size = 50
+    end
+    object cdsZJJLViewDrawingCode: TWideStringField
+      FieldName = 'DrawingCode'
+      Size = 50
+    end
   end
 end

+ 52 - 5
DataModules/ZJJLDm.pas

@@ -51,6 +51,20 @@ type
     cdsZJJLViewType: TIntegerField;
     cdsZJJLRelaFile: TMemoField;
     cdsZJJLViewRelaFile: TMemoField;
+    cdsZJJLBGLCode: TMemoField;
+    cdsZJJLPegName: TWideStringField;
+    cdsZJJLFBFXName: TWideStringField;
+    cdsZJJLBeginPeg: TWideStringField;
+    cdsZJJLEndPeg: TWideStringField;
+    cdsZJJLUnitName: TWideStringField;
+    cdsZJJLDrawingCode: TWideStringField;
+    cdsZJJLViewBGLCode: TMemoField;
+    cdsZJJLViewPegName: TWideStringField;
+    cdsZJJLViewFBFXName: TWideStringField;
+    cdsZJJLViewBeginPeg: TWideStringField;
+    cdsZJJLViewEndPeg: TWideStringField;
+    cdsZJJLViewUnitName: TWideStringField;
+    cdsZJJLViewDrawingCode: TWideStringField;
     procedure cdsZJJLViewAfterScroll(DataSet: TDataSet);
   private
     FPhaseData: TObject;
@@ -80,6 +94,8 @@ type
     // 向父项检测,直至提取到图册号为止
     function GetDrawingCode(ANode: TsdIDTreeNode): string;
 
+    procedure CheckZjjlVerison;
+
     function GetMainBillsTree: TsdIDTree;
   public
     constructor Create(APhaseData: TObject);
@@ -146,6 +162,8 @@ begin
   cdsZJJL.IndexFieldNames := 'ID';
   cdsZJJLView.CloneCursor(cdsZJJL, True);
   cdsZJJLView.IndexFieldNames := 'ID';
+
+  CheckZjjlVerison;
 end;
 
 procedure TZJJLData.Save;
@@ -178,11 +196,11 @@ begin
   for iRowIndex := 0 to FDetailGrid.RowCount - 1 do
     FDetailGrid[0, iRowIndex].Align := gaTopLeft;
   InfoRec := GetInfoRec(cdsZJJLViewBillsID.AsInteger, cdsZJJLViewType.AsInteger);
-  FDetailGrid.Cells[0, 0].Text := '变更令号:' + InfoRec.BGLCode;
-  FDetailGrid.Cells[0, 1].Text := '桩号或部位:' + InfoRec.PegName;
-  FDetailGrid.Cells[0, 2].Text := '分部分项工程:' + InfoRec.FBFXName;
-  FDetailGrid.Cells[0, 3].Text := '计量单元:' + InfoRec.UnitName;
-  FDetailGrid.Cells[0, 4].Text := '图号:' + InfoRec.DrawingCode;
+  FDetailGrid.Cells[0, 0].Text := '变更令号:' + cdsZJJLViewBGLCode.AsString;
+  FDetailGrid.Cells[0, 1].Text := '桩号或部位:' + cdsZJJLViewPegName.AsString;
+  FDetailGrid.Cells[0, 2].Text := '分部分项工程:' + cdsZJJLViewFBFXName.AsString;
+  FDetailGrid.Cells[0, 3].Text := '计量单元:' + cdsZJJLViewUnitName.AsString;
+  FDetailGrid.Cells[0, 4].Text := '图号:' + cdsZJJLViewDrawingCode.AsString;
   FDetailGrid.Cells[0, 5].Text := '计算式说明:';
   FDetailGrid.Cells[0, 6].Text := cdsZJJLViewFormulaMemo.AsString;
   FDetailGrid.Cells[0, 6].Align := gaTopLeft;
@@ -200,6 +218,7 @@ begin
   FNewID := 1;
   DeleteAll;
   GenerateNode(MainBillsTree.FirstNode);
+  TPhaseData(FPhaseData).PhaseProperty.ZjjlVersion := 1;
 end;
 
 procedure TZJJLData.GenerateNode(ANode: TsdIDTreeNode);
@@ -427,6 +446,7 @@ begin
   FNewID := 1;
   DeleteAll;
   GenerateNodeByB_Code(MainBillsTree.FirstNode);
+  TPhaseData(FPhaseData).PhaseProperty.ZjjlVersion := 1;
 end;
 
 procedure TZJJLData.GenerateNodeByB_Code(ANode: TsdIDTreeNode);
@@ -563,4 +583,31 @@ begin
   end;
 end;
 
+procedure TZJJLData.CheckZjjlVerison;
+
+  procedure LoadVersion0Info;
+    var
+    sSql: string;
+    ZJJLInfoRec: TZJJLInfoRec;
+  begin
+    cdsZJJL.First;
+    while not cdsZJJL.Eof do
+    begin
+      ZJJLInfoRec := GetInfoRec(cdsZJJLBillsID.AsInteger, cdsZJJLType.AsInteger);
+      cdsZJJL.Edit;
+      cdsZJJLBGLCode.AsString := ZJJLInfoRec.BGLCode;
+      cdsZJJLPegName.AsString := ZJJLInfoRec.PegName;
+      cdsZJJLFBFXName.AsString := ZJJLInfoRec.FBFXName;
+      cdsZJJLUnitName.AsString := ZJJLInfoRec.UnitName;
+      cdsZJJLDrawingCode.AsString := ZJJLInfoRec.DrawingCode;
+      cdsZJJL.Post;
+      cdsZJJL.Next;
+    end;
+  end;
+
+begin
+  if TPhaseData(PhaseData).PhaseProperty.ZjjlVersion = 0 then
+    LoadVersion0Info;
+end;
+
 end.

+ 1 - 1
Units/Connections.pas

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

+ 23 - 2
Units/DataBaseTables.pas

@@ -965,7 +965,7 @@ const
 
   // 中间计量表 -- 见文件“计量\需求\变更令\计量支付窗口主界面结构示意.doc”
   SZJJL = 'ZJJL';
-  tdZJJL: array [0..7] of TScFieldDef =(
+  tdZJJL: array [0..14] of TScFieldDef =(
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     // 所属项目节ID -- 仅允许在最底层项目节输入
     (FieldName: 'BillsID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False),
@@ -980,7 +980,28 @@ const
     // 草图
     (FieldName: 'RelaFile'; FieldType: ftMemo; Size: 60535; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // Type -- 真的是有病!!!
-    (FieldName: 'Type'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+    (FieldName: 'Type'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+
+    // 变更令号
+    (FieldName: 'BGLCode'; FieldType: ftMemo; Size: 60535; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 部位:取了个这么奇葩的名字不怪我。。原来这玩意叫桩号或部位,所以就用了Peg。。
+    (FieldName: 'PegName'; FieldType: ftString; Size: 50; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 分布分项
+    (FieldName: 'FBFXName'; FieldType: ftString; Size: 50; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 起始桩号
+    (FieldName: 'BeginPeg'; FieldType: ftString; Size: 50; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 终止桩号
+    (FieldName: 'EndPeg'; FieldType: ftString; Size: 50; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 计量单元
+    (FieldName: 'UnitName'; FieldType: ftString; Size: 50; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 图号
+    (FieldName: 'DrawingCode'; FieldType: ftString; Size: 50; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+  );
+
+  SZjjlHistory = 'ZjjlHistory';
+  tdZjjlHistory: array [0..1] of TScFieldDef =(
+    (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    (FieldName: 'ZjjlID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False)
   );
 
   // 报表数据

+ 13 - 0
Units/PhaseProperty.pas

@@ -25,6 +25,8 @@ type
     procedure SetAuditCount(const Value: Integer);
     function GetZJJLType: Integer;
     procedure SetZJJLType(const Value: Integer);
+    procedure SetZjjlVersion(const Value: Integer);
+    function GetZjjlVersion: Integer;
   public
     constructor Create(AConnection: TADOConnection);
     destructor Destroy; override;
@@ -36,6 +38,7 @@ type
     property FinalAudit: Boolean read FFinalAudit write SetFinalAudit;
 
     property ZJJLType: Integer read GetZJJLType write SetZJJLType;
+    property ZjjlVersion: Integer read GetZjjlVersion write SetZjjlVersion;
   end;
 
 implementation
@@ -103,6 +106,11 @@ begin
   Result := GetIntPropertyDef('ZJJLType', 0);
 end;
 
+function TPhaseProperties.GetZjjlVersion: Integer;
+begin
+  Result := GetIntPropertyDef('ZjjlVersion', 0);
+end;
+
 procedure TPhaseProperties.LoadBaseProperties;
 begin
   FFinalAudit := GetBoolPropertyDef('FinalAudit', False);
@@ -136,4 +144,9 @@ begin
   FPropertyInqurity.Value['ZJJLType'] := Value;
 end;
 
+procedure TPhaseProperties.SetZjjlVersion(const Value: Integer);
+begin
+  FPropertyInqurity.Value['ZjjlVerison'] := Value;
+end;
+
 end.

+ 1 - 3
Units/ProjectData.pas

@@ -936,13 +936,11 @@ procedure TProjectData.CopyPhaseData;
     sSql: string;
   begin
     sSql := 'Select ID, BillsID, Code, CertificateCode, BillsCode, FormulaMemo, RelaFile,' +
-            '   '''' As BGLCode, '''' As PegName, '''' As FBFXName, '''' As UnitName, '''' As DrawingCode' +
+            '    BGLCode, PegName, FBFXName, BeginPeg, EndPeg, UnitName, DrawingCode' +
             '  Into P_ZJJL' +
             '  From ' + PhaseData.ZJJLData.atZJJL.TableName +
             '  In ' + Format('''%s''', [AFileName]);
     ExecuteSql(sSql);
-    // 获取分部分项等实时统计字段值
-    UpdateZJJLData;
     CopyZJJLBillsData;
   end;