|
@@ -161,6 +161,8 @@ type
|
|
|
procedure OpenForImportMtf(const AFileName: string; APhaseIndex: Integer = -1; AStageIndex: Integer = -1);
|
|
|
//----------------------- End ---ºǫ́´ò¿ª ------------------------
|
|
|
|
|
|
+ procedure RepairMainData;
|
|
|
+
|
|
|
procedure SaveDebugFile(const AFileName: string);
|
|
|
procedure SaveTempDataBaseFile(const AFileName: string);
|
|
|
|
|
@@ -295,7 +297,7 @@ uses
|
|
|
mProgressProFrm, mDataRecord, ConditionalDefines, DbTreeImport,
|
|
|
StrUtils, sdProvider, CalcDecimal, Math, CslJson, OrderCheckerFme,
|
|
|
stgSubGatherFile, Forms, ProgressHintFrm, BillsTree, Controls,
|
|
|
- stgGclSubGatherFile, rmfImportFrm;
|
|
|
+ stgGclSubGatherFile, rmfImportFrm, DataBaseTables;
|
|
|
|
|
|
{ TProjectData }
|
|
|
|
|
@@ -2533,7 +2535,7 @@ begin
|
|
|
end;
|
|
|
|
|
|
procedure TProjectData.LoadWebSwitchChange;
|
|
|
-var
|
|
|
+var
|
|
|
sgs: TStrings;
|
|
|
iResult: Integer;
|
|
|
sResult: string;
|
|
@@ -2552,4 +2554,82 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+procedure TProjectData.RepairMainData;
|
|
|
+
|
|
|
+ procedure UpdateSourceFile(const AFileName: string);
|
|
|
+ var
|
|
|
+ vCon: TADOConnection;
|
|
|
+ vUpdate: TUpdateProjectDB;
|
|
|
+ begin
|
|
|
+ vCon := TADOConnection.Create(nil);
|
|
|
+ vCon.LoginPrompt := False;
|
|
|
+ try
|
|
|
+ vCon.ConnectionString := Format(SAdoConnectStr, [AFileName]);
|
|
|
+ vUpdate := TUpdateProjectDB.Create;
|
|
|
+ vUpdate.ForceUpdate(vCon);
|
|
|
+ finally
|
|
|
+ vUpdate.Free;
|
|
|
+ vCon.Free;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+ procedure ExecuteSql1(ACon: TCommonConnection; const ASql: string);
|
|
|
+ var
|
|
|
+ FQuery: TADOQuery;
|
|
|
+ begin
|
|
|
+ FQuery := TADOQuery.Create(nil);
|
|
|
+ try
|
|
|
+ FQuery.Connection := ACon.Connection;
|
|
|
+ FQuery.SQL.Clear;
|
|
|
+ FQuery.SQL.Add(ASql);
|
|
|
+ FQuery.ExecSQL;
|
|
|
+ finally
|
|
|
+ FQuery.Free;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+ procedure CopyData(const ATable, AFile: String; ACon: TCommonConnection);
|
|
|
+ var
|
|
|
+ sSql: string;
|
|
|
+ begin
|
|
|
+ sSql := Format('Insert Into %s Select * From %s In ''%s''', [ATable, ATable, AFile]);
|
|
|
+ ExecuteSql1(ACon, sSql);
|
|
|
+ end;
|
|
|
+
|
|
|
+var
|
|
|
+ sFile, sTemp: String;
|
|
|
+ vTempCon: TCommonConnection;
|
|
|
+begin
|
|
|
+ sFile := FDebugDir + '\Main.mdb';
|
|
|
+ CopyFileOrFolder(GetEmptyDataBaseFileName, sFile);
|
|
|
+ UpdateSourceFile(sFile);
|
|
|
+
|
|
|
+ sTemp := FDebugDir + '\Temp.dat';
|
|
|
+ SaveDebugFile(sTemp);
|
|
|
+
|
|
|
+ vTempCon := TCommonConnection.Create;
|
|
|
+ try
|
|
|
+ vTempCon.Open(sFile);
|
|
|
+
|
|
|
+ CopyData(SBills, sTemp, vTempCon);
|
|
|
+ CopyData(SProjProperties, sTemp, vTempCon);
|
|
|
+ CopyData(SDealPayment, sTemp, vTempCon);
|
|
|
+ CopyData(SBGL, sTemp, vTempCon);
|
|
|
+ CopyData(SBGBills, sTemp, vTempCon);
|
|
|
+ CopyData(SStaff, sTemp, vTempCon);
|
|
|
+ CopyData(SDealBills, sTemp, vTempCon);
|
|
|
+ CopyData(SMainDataList, sTemp, vTempCon);
|
|
|
+ CopyData(SDealPayFinal, sTemp, vTempCon);
|
|
|
+ CopyData(SProjectGL, sTemp, vTempCon);
|
|
|
+ CopyData(SGLPrice, sTemp, vTempCon);
|
|
|
+ CopyData(SDetailGL, sTemp, vTempCon);
|
|
|
+ CopyData(SOtherMeasureOnce, sTemp, vTempCon);
|
|
|
+ CopyData(SOtherMeasurePhase, sTemp, vTempCon);
|
|
|
+ CopyData(SOMPhaseDetail, sTemp, vTempCon);
|
|
|
+ CopyData(SAttachmentInfo, sTemp, vTempCon);
|
|
|
+ finally
|
|
|
+ vTempCon.Close;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
end.
|