Просмотр исходного кода

Task #1227 变更令&变更令清单,不在根据上报审核批复锁定

MaiXinRong 9 лет назад
Родитель
Сommit
275de6f358
5 измененных файлов с 11 добавлено и 84 удалено
  1. 0 12
      DataModules/BGLDm.dfm
  2. 0 52
      DataModules/BGLDm.pas
  3. 7 7
      Units/DataBaseTables.pas
  4. 4 1
      Units/ExcelImport.pas
  5. 0 12
      Units/ProjectData.pas

+ 0 - 12
DataModules/BGLDm.dfm

@@ -47,9 +47,6 @@ object BGLData: TBGLData
       FieldName = 'DrawingCode'
       Size = 50
     end
-    object cdsBGLLocked: TBooleanField
-      FieldName = 'Locked'
-    end
     object cdsBGLApprovalCode: TWideStringField
       FieldName = 'ApprovalCode'
       Size = 50
@@ -96,9 +93,6 @@ object BGLData: TBGLData
       FieldName = 'Direction'
       BlobType = ftMemo
     end
-    object cdsBGLViewLocked: TBooleanField
-      FieldName = 'Locked'
-    end
     object cdsBGLViewDrawingCode: TWideStringField
       FieldName = 'DrawingCode'
       Size = 50
@@ -169,9 +163,6 @@ object BGLData: TBGLData
     object cdsBGBillsUsedQuantity: TFloatField
       FieldName = 'UsedQuantity'
     end
-    object cdsBGBillsLocked: TBooleanField
-      FieldName = 'Locked'
-    end
   end
   object cdsBGBillsView: TClientDataSet
     Aggregates = <>
@@ -219,8 +210,5 @@ object BGLData: TBGLData
     object cdsBGBillsViewUsedQuantity: TFloatField
       FieldName = 'UsedQuantity'
     end
-    object cdsBGBillsViewLocked: TBooleanField
-      FieldName = 'Locked'
-    end
   end
 end

+ 0 - 52
DataModules/BGLDm.pas

@@ -53,7 +53,6 @@ type
     cdsBGLPos_Reason: TMemoField;
     cdsBGLDirection: TMemoField;
     cdsBGLDrawingCode: TWideStringField;
-    cdsBGLLocked: TBooleanField;
     cdsBGLApprovalCode: TWideStringField;
     cdsBGLCreatePhaseID: TIntegerField;
     cdsBGLExecutionRate: TFloatField;
@@ -66,7 +65,6 @@ type
     cdsBGLViewPos_Reason: TMemoField;
     cdsBGLViewDirection: TMemoField;
     cdsBGLViewDrawingCode: TWideStringField;
-    cdsBGLViewLocked: TBooleanField;
     cdsBGLViewApprovalCode: TWideStringField;
     cdsBGLViewCreatePhaseID: TIntegerField;
     cdsBGLViewExecutionRate: TFloatField;
@@ -85,7 +83,6 @@ type
     cdsBGBillsQuantity: TFloatField;
     cdsBGBillsTotalPrice: TFloatField;
     cdsBGBillsUsedQuantity: TFloatField;
-    cdsBGBillsLocked: TBooleanField;
     
     cdsBGBillsView: TClientDataSet;
     cdsBGBillsViewID: TIntegerField;
@@ -97,7 +94,6 @@ type
     cdsBGBillsViewQuantity: TFloatField;
     cdsBGBillsViewTotalPrice: TFloatField;
     cdsBGBillsViewUsedQuantity: TFloatField;
-    cdsBGBillsViewLocked: TBooleanField;
     cdsBGLBGLType: TWideStringField;
     cdsBGLViewBGLType: TWideStringField;
     procedure cdsBGBillsViewAfterInsert(DataSet: TDataSet);
@@ -130,9 +126,6 @@ type
 
     function LocateBGL(const ACode: string): Boolean;
     function LocateBGBills(ABGID: Integer; const AB_Code: string): Boolean;
-
-    procedure LockAllBGL;
-    procedure LockAllBGBills;
   public
     constructor Create(AProjectData: TObject);
     destructor Destroy; override;
@@ -148,8 +141,6 @@ type
 
     procedure BatchWritePos_Reason;
 
-    procedure LockAll;
-
     property ProjectData: TObject read FProjectData;
   end;
 
@@ -412,16 +403,12 @@ begin
       (cdsBGBillsViewUnits.Tag = 1) or
       (cdsBGBillsViewPrice.Tag = 1) then
   begin
-    if cdsBGBillsViewLocked.AsBoolean then
-      DisplayErrorMessage('变更清单已被锁定,不可修改!');
     if cdsBGBillsViewUsedQuantity.AsFloat <> 0 then
       DisplayErrorMessage('变更令已被应用至清单,不可修改!');
   end;
 
   if (cdsBGBillsViewQuantity.Tag = 1) then
   begin
-    if cdsBGBillsViewLocked.AsBoolean then
-      DisplayErrorMessage('变更清单已被锁定,不可修改!');
     if (cdsBGBillsViewUsedQuantity.AsFloat <> 0) and
        (cdsBGBillsViewQuantity.AsFloat < cdsBGBillsViewUsedQuantity.AsFloat) then
       DisplayErrorMessage('变更清单的清单数量应大于已变更数量!');
@@ -451,11 +438,6 @@ begin
   begin
     cdsBGLViewCode.Tag := 0;
 
-    if cdsBGLViewLocked.AsBoolean then
-    begin
-      ErrorMessage('当前变更令已锁定,不可修改!');
-      Abort;
-    end;
     if CheckBGLUsed(cdsBGLViewID.AsInteger) then
     begin
       ErrorMessage('当前变更令下变更清单已被应用到清单,不可修改!');
@@ -499,8 +481,6 @@ end;
 
 procedure TBGLData.cdsBGLViewBeforeDelete(DataSet: TDataSet);
 begin
-  if cdsBGLViewLocked.AsBoolean then
-    raise Exception.Create('变更令已被锁定,不可删除!');
   if CheckBGLUsed(cdsBGLViewID.AsInteger) then
     raise Exception.Create('变更令下变更清单已被应用到清单,不可删除!');
   DeleteBGBills(cdsBGLViewID.AsInteger);
@@ -526,8 +506,6 @@ end;
 
 procedure TBGLData.cdsBGBillsViewBeforeDelete(DataSet: TDataSet);
 begin
-  if cdsBGBillsViewLocked.AsBoolean then
-    raise Exception.Create('变更清单已被锁定,不可删除!');
   if cdsBGBillsViewUsedQuantity.AsFloat <> 0 then
     raise Exception.Create('变更清单已被应用至清单,不可删除!');
 end;
@@ -549,36 +527,6 @@ begin
   end;
 end;
 
-procedure TBGLData.LockAll;
-begin
-  LockAllBGL;
-  LockAllBGBills;
-end;
-
-procedure TBGLData.LockAllBGBills;
-begin
-  cdsBGBills.First;
-  while not cdsBGBills.Eof do
-  begin
-    cdsBGBills.Edit;
-    cdsBGBillsLocked.AsBoolean := True;
-    cdsBGBills.Post;
-    cdsBGBills.Next;
-  end;
-end;
-
-procedure TBGLData.LockAllBGL;
-begin
-  cdsBGL.First;
-  while not cdsBGL.Eof do
-  begin
-    cdsBGL.Edit;
-    cdsBGLLocked.AsBoolean := True;
-    cdsBGL.Post;
-    cdsBGL.Next;
-  end;
-end;
-
 procedure TBGLData.cdsBGBillsViewAfterDelete(DataSet: TDataSet);
 begin
   GatherBGLTotalPrice(cdsBGLViewID.AsInteger);

+ 7 - 7
Units/DataBaseTables.pas

@@ -331,7 +331,7 @@ const
 
   {变更令}
   SBGL = 'BGL';
-  tdBGL: array [0..11] of TScFieldDef =(
+  tdBGL: array [0..10] of TScFieldDef =(
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     // 变更令号
     (FieldName: 'Code'; FieldType: ftString; Size: 50; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
@@ -343,8 +343,8 @@ const
     (FieldName: 'Pos_Reason'; FieldType: ftMemo; Size: 60535; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更工程量说明
     (FieldName: 'Direction'; FieldType: ftMemo; Size: 60535; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
-    // 锁定
-    (FieldName: 'Locked'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 锁定 -- 废弃,不再使用
+    //(FieldName: 'Locked'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 变更图号
     (FieldName: 'DrawingCode'; FieldType: ftString; Size: 50; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 批准文号
@@ -358,7 +358,7 @@ const
   );
 
   SBGBills = 'BGBills';
-  tdBGBills: array [0..9] of TScFieldDef =(
+  tdBGBills: array [0..8] of TScFieldDef =(
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     (FieldName: 'BGID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False),
     // 清单编号
@@ -374,9 +374,9 @@ const
     // 金额
     (FieldName: 'TotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 已变更数量
-    (FieldName: 'UsedQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
-    // 锁定
-    (FieldName: 'Locked'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+    (FieldName: 'UsedQuantity'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+    // 锁定 -- 废弃,不再使用
+    //(FieldName: 'Locked'; FieldType: ftBoolean; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
   );
 
   {项目属性}

+ 4 - 1
Units/ExcelImport.pas

@@ -155,6 +155,8 @@ begin
   FCurRow := 0;
   FCacheTree := TBillsCacheTree.Create;
   FCacheTree.AutoSort := True;
+  FCacheTree.SeparateChar := '.';
+  FCacheTree.NewNodeID := Max(FCacheTree.NewNodeID, 101);
 end;
 
 procedure TBillsExcelImport.EndImport;
@@ -192,7 +194,7 @@ var
   iCol: Integer;
   sColName: string;
 begin
-  for iCol := 0 to ASheet.Cells.UsedRowCount do
+  for iCol := 0 to ASheet.Cells.UsedColCount do
   begin
     sColName := VarToStrDef(ASheet.Cells.GetValue(iCol, FCurRow), '');
     if sColName = '²ã´Î±àºÅ' then
@@ -239,6 +241,7 @@ begin
     LoadNode(ASheet);
     Inc(FCurRow);
   end;
+  FCacheTree.SaveTreeToFile('E:\Tree.txt');
 end;
 
 procedure TBillsExcelImport.WriteNode(ADataSet: TsdDataSet;

+ 0 - 12
Units/ProjectData.pas

@@ -76,7 +76,6 @@ type
     // 锁定数据 -- Sql语句方式(使用时注意相应的DataMoudle应处于关闭状态)
     procedure LockBillsBaseData;
     procedure LockDealPaymentData;
-    procedure LockBGLData;
     procedure LockProjectGLData;
     procedure LockDetailGLData;
 
@@ -379,7 +378,6 @@ begin
   FProjProperties.AuditStatus := -1;
   FProjProperties.FinalAuditCount := FProjProperties.PhaseCount;
   FStaffData.LockedDataForReply;
-  LockBGLData;
 end;
 
 procedure TProjectData.LockedDataForSubmit;
@@ -388,7 +386,6 @@ begin
   LockDealPaymentData;
   FProjProperties.AuditCompany := FStaffData.FinalStaffCompany;
   FStaffData.LockedDataForAudit;
-  LockBGLData;
 end;
 
 procedure TProjectData.Open(AProjRec: TsdDataRecord);
@@ -1411,15 +1408,6 @@ begin
   ExecuteSql(sLockFormulaSql);
 end;
 
-procedure TProjectData.LockBGLData;
-const
-  sBGSql = 'Update BGL Set Locked = True';
-  sBGBillsSql = 'Update BGBills Set Locked = True';
-begin
-  ExecuteSql(sBGSql);
-  ExecuteSql(sBGBillsSql);
-end;
-
 procedure TProjectData.OpenForReport(const AFileName: string);
 begin
   FProjectID := -1;