|
@@ -5,7 +5,7 @@ interface
|
|
|
|
|
|
uses
|
|
uses
|
|
stgGclSubGatherFileDm, ADODB, sdDB, stgGclGatherDm, SysUtils, ProjectData,
|
|
stgGclSubGatherFileDm, ADODB, sdDB, stgGclGatherDm, SysUtils, ProjectData,
|
|
- StageDm, mDataRecord, BillsTree, DetailExcelImport, OExport;
|
|
|
|
|
|
+ StageDm, mDataRecord, BillsTree, DetailExcelImport, OExport, stgGclImportHint;
|
|
|
|
|
|
type
|
|
type
|
|
TstgGclSubGatherFileHelper = class
|
|
TstgGclSubGatherFileHelper = class
|
|
@@ -35,14 +35,19 @@ type
|
|
|
|
|
|
TstgGclSubGatherFileImportor = class(TstgGclSubGatherFileHelper)
|
|
TstgGclSubGatherFileImportor = class(TstgGclSubGatherFileHelper)
|
|
private
|
|
private
|
|
|
|
+ FFails: TstgGclFailList;
|
|
|
|
+
|
|
procedure ClearOldData(AStageData: TStageData);
|
|
procedure ClearOldData(AStageData: TStageData);
|
|
procedure ImportGatherData(AProjectData: TProjectData);
|
|
procedure ImportGatherData(AProjectData: TProjectData);
|
|
public
|
|
public
|
|
|
|
+ constructor Create;
|
|
|
|
+ destructor Destroy; override;
|
|
|
|
+
|
|
procedure ImportGatherDataTo(AProjectData: TProjectData; const AFileName: string);
|
|
procedure ImportGatherDataTo(AProjectData: TProjectData; const AFileName: string);
|
|
end;
|
|
end;
|
|
|
|
|
|
TstgGclSubGatherFileExcelImportor = class(TDetailExcelImport)
|
|
TstgGclSubGatherFileExcelImportor = class(TDetailExcelImport)
|
|
- private
|
|
|
|
|
|
+ private
|
|
FCurRow: Integer;
|
|
FCurRow: Integer;
|
|
|
|
|
|
FB_CodeCol: Integer;
|
|
FB_CodeCol: Integer;
|
|
@@ -51,6 +56,8 @@ type
|
|
FPriceCol: Integer;
|
|
FPriceCol: Integer;
|
|
FDealQuantityCol: Integer;
|
|
FDealQuantityCol: Integer;
|
|
|
|
|
|
|
|
+ FFails: TstgGclFailList;
|
|
|
|
+
|
|
procedure ClearOldData(AStageData: TStageData);
|
|
procedure ClearOldData(AStageData: TStageData);
|
|
|
|
|
|
function LoadColumnsFromHead(ASheet: TExportWorkSheet): Boolean;
|
|
function LoadColumnsFromHead(ASheet: TExportWorkSheet): Boolean;
|
|
@@ -60,6 +67,9 @@ type
|
|
procedure EndImport; override;
|
|
procedure EndImport; override;
|
|
|
|
|
|
procedure Import; override;
|
|
procedure Import; override;
|
|
|
|
+ public
|
|
|
|
+ constructor Create(AProjectData: TProjectData); override;
|
|
|
|
+ destructor Destroy; override;
|
|
end;
|
|
end;
|
|
|
|
|
|
implementation
|
|
implementation
|
|
@@ -67,7 +77,7 @@ implementation
|
|
|
|
|
|
uses
|
|
uses
|
|
UtilMethods, ZhAPI, Connections, stgGclTables, ScAutoUpdateUnit, Math,
|
|
UtilMethods, ZhAPI, Connections, stgGclTables, ScAutoUpdateUnit, Math,
|
|
- BillsMeasureDm;
|
|
|
|
|
|
+ BillsMeasureDm, stgGclImportHintFrm;
|
|
|
|
|
|
{ TstgGclSubGatherFileExportor }
|
|
{ TstgGclSubGatherFileExportor }
|
|
|
|
|
|
@@ -192,6 +202,17 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+constructor TstgGclSubGatherFileImportor.Create;
|
|
|
|
+begin
|
|
|
|
+ FFails := TstgGclFailList.Create;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+destructor TstgGclSubGatherFileImportor.Destroy;
|
|
|
|
+begin
|
|
|
|
+ FFails.Free;
|
|
|
|
+ inherited;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TstgGclSubGatherFileImportor.ImportGatherData(
|
|
procedure TstgGclSubGatherFileImportor.ImportGatherData(
|
|
AProjectData: TProjectData);
|
|
AProjectData: TProjectData);
|
|
|
|
|
|
@@ -230,7 +251,11 @@ begin
|
|
begin
|
|
begin
|
|
vStageRec := AProjectData.PhaseData.StageData.StageRecordWithAdd(vNode.ID);
|
|
vStageRec := AProjectData.PhaseData.StageData.StageRecordWithAdd(vNode.ID);
|
|
vStageRec.DealQuantity.AsFloat := vOrgRec.ValueByName('DealQuantity').AsFloat;
|
|
vStageRec.DealQuantity.AsFloat := vOrgRec.ValueByName('DealQuantity').AsFloat;
|
|
- end;
|
|
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ FFails.AddFailGcl(vOrgRec.ValueByName('B_Code').AsString,
|
|
|
|
+ vOrgRec.ValueByName('Name').AsString, vOrgRec.ValueByName('Units').AsString,
|
|
|
|
+ vOrgRec.ValueByName('Price').AsFloat, vOrgRec.ValueByName('DealQuantity').AsFloat);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -246,7 +271,9 @@ begin
|
|
finally
|
|
finally
|
|
AProjectData.PhaseData.StageData.AfterBatchOperation;
|
|
AProjectData.PhaseData.StageData.AfterBatchOperation;
|
|
AProjectData.PhaseData.StageData.sddStage.EndUpdate;
|
|
AProjectData.PhaseData.StageData.sddStage.EndUpdate;
|
|
- end;
|
|
|
|
|
|
+ end;
|
|
|
|
+ if FFails.Count > 0 then
|
|
|
|
+ ShowGclImportForm(FFails);
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TstgGclSubGatherFileExcelImportor }
|
|
{ TstgGclSubGatherFileExcelImportor }
|
|
@@ -276,10 +303,25 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+constructor TstgGclSubGatherFileExcelImportor.Create(
|
|
|
|
+ AProjectData: TProjectData);
|
|
|
|
+begin
|
|
|
|
+ inherited Create(AProjectData);
|
|
|
|
+ FFails := TstgGclFailList.Create;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+destructor TstgGclSubGatherFileExcelImportor.Destroy;
|
|
|
|
+begin
|
|
|
|
+ FFails.Free;
|
|
|
|
+ inherited;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TstgGclSubGatherFileExcelImportor.EndImport;
|
|
procedure TstgGclSubGatherFileExcelImportor.EndImport;
|
|
begin
|
|
begin
|
|
ProjectData.PhaseData.StageData.AfterBatchOperation;
|
|
ProjectData.PhaseData.StageData.AfterBatchOperation;
|
|
- ProjectData.PhaseData.StageData.sddStage.EndUpdate;
|
|
|
|
|
|
+ ProjectData.PhaseData.StageData.sddStage.EndUpdate;
|
|
|
|
+ if FFails.Count > 0 then
|
|
|
|
+ ShowGclImportForm(FFails);
|
|
inherited;
|
|
inherited;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -362,9 +404,9 @@ var
|
|
begin
|
|
begin
|
|
while FCurRow < ASheet.Rows.Count do
|
|
while FCurRow < ASheet.Rows.Count do
|
|
begin
|
|
begin
|
|
- vRow := ASheet.Rows[FCurRow];
|
|
|
|
|
|
+ vRow := ASheet.Rows[FCurRow];
|
|
Inc(FCurRow);
|
|
Inc(FCurRow);
|
|
-
|
|
|
|
|
|
+
|
|
sB_Code := Trim(GetCellStr(vRow, FB_CodeCol));
|
|
sB_Code := Trim(GetCellStr(vRow, FB_CodeCol));
|
|
sName := Trim(GetCellStr(vRow, FNameCol));
|
|
sName := Trim(GetCellStr(vRow, FNameCol));
|
|
sUnits := Trim(GetCellStr(vRow, FUnitsCol));
|
|
sUnits := Trim(GetCellStr(vRow, FUnitsCol));
|
|
@@ -377,7 +419,9 @@ begin
|
|
begin
|
|
begin
|
|
vStageRec := ProjectData.PhaseData.StageData.StageRecordWithAdd(vNode.ID);
|
|
vStageRec := ProjectData.PhaseData.StageData.StageRecordWithAdd(vNode.ID);
|
|
vStageRec.DealQuantity.AsFloat := StrToFloatDef(GetCellStr(vRow, FDealQuantityCol), 0);
|
|
vStageRec.DealQuantity.AsFloat := StrToFloatDef(GetCellStr(vRow, FDealQuantityCol), 0);
|
|
- end;
|
|
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ FFails.AddFailGcl(sB_Code, sName, sUnits, fPrice, StrToFloatDef(GetCellStr(vRow, FDealQuantityCol), 0));
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|