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