|
@@ -111,6 +111,9 @@ type
|
|
|
cdsCustomHistory: TStringField;
|
|
|
cdsCustomNewestVer: TStringField;
|
|
|
cdsTemp: TClientDataSet;
|
|
|
+ cdsCode: TClientDataSet;
|
|
|
+ cdsCodeProject: TStringField;
|
|
|
+ cdsCodeCode: TStringField;
|
|
|
procedure DataModuleCreate(Sender: TObject);
|
|
|
procedure DataModuleDestroy(Sender: TObject);
|
|
|
private
|
|
@@ -134,6 +137,8 @@ type
|
|
|
procedure FilterNeedUpdates(AFilter: Boolean);
|
|
|
function HasNeedUpdateReport: Boolean;
|
|
|
function HasReport: Boolean;
|
|
|
+ procedure LoadCodes;
|
|
|
+ procedure saveCodes(AProjectName, ACode: string);
|
|
|
|
|
|
property Path: string read FPath;
|
|
|
end;
|
|
@@ -143,7 +148,7 @@ type
|
|
|
implementation
|
|
|
|
|
|
uses Variants, ScFileArchiverConsts, ArchiverRoot, PHPWebDm, CslJson,
|
|
|
- XMLDoc, XMLIntf, Windows, Math, Forms;
|
|
|
+ XMLDoc, XMLIntf, Windows, Math, Forms, iniFiles;
|
|
|
|
|
|
const G_ReportDNS = 'http://vc.6jlzf.cn'; // 最后不能带"/"
|
|
|
|
|
@@ -213,6 +218,8 @@ begin
|
|
|
Load;
|
|
|
|
|
|
cdsTemp.CloneCursor(cdsLocal, True);
|
|
|
+
|
|
|
+ LoadCodes;
|
|
|
end;
|
|
|
|
|
|
procedure TReports.DataModuleDestroy(Sender: TObject);
|
|
@@ -314,6 +321,11 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+ cdsLocal.AddIndex('idxCN','Category;NewestVer',[],'NewestVer');
|
|
|
+ cdsLocal.IndexName := 'idxCN';
|
|
|
+ // 这种不能指定降序。
|
|
|
+// cdsLocal.IndexFieldNames := 'Category;NewestVer';
|
|
|
+
|
|
|
// 线上报表按地区获取;线下广东和全国分开装,报表不会混合,所以本地无需作区分
|
|
|
{$IFDEF _mGuangDong}
|
|
|
sArea := '2'; // 广东
|
|
@@ -722,6 +734,7 @@ function TReports.LoadCustom(ACode: string): Boolean;
|
|
|
var FOnlineAry: TOVArr;
|
|
|
i, iID: Integer;
|
|
|
vReport: TReport;
|
|
|
+ sProjName: string;
|
|
|
begin
|
|
|
Result := False;
|
|
|
|
|
@@ -757,7 +770,9 @@ begin
|
|
|
|
|
|
ChangeRec(cdsCustom, vReport, ctAdd);
|
|
|
end;
|
|
|
+ sProjName := FOnlineAry[0, 7];
|
|
|
Result := True;
|
|
|
+ saveCodes(sProjName, ACode);
|
|
|
finally
|
|
|
cdsCustom.First;
|
|
|
cdsCustom.EnableControls;
|
|
@@ -810,4 +825,65 @@ begin
|
|
|
Result := cdsTemp.RecordCount > 0;
|
|
|
end;
|
|
|
|
|
|
+procedure TReports.LoadCodes;
|
|
|
+var ini: TIniFile;
|
|
|
+ vSL: TStringList;
|
|
|
+ i: Integer;
|
|
|
+ sCode: String;
|
|
|
+begin
|
|
|
+ cdsCode.DisableControls;
|
|
|
+ vSL := TStringList.Create;
|
|
|
+ ini := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Cloud.ini');
|
|
|
+ try
|
|
|
+ cdsCode.First;
|
|
|
+ while cdsCode.RecordCount > 0 do
|
|
|
+ cdsCode.Delete;
|
|
|
+
|
|
|
+ Ini.ReadSection('Codes', vSL);
|
|
|
+
|
|
|
+ for i := vSL.Count - 1 downto 0 do
|
|
|
+ begin
|
|
|
+ sCode := Ini.ReadString('Codes', vSL[i], '');
|
|
|
+ cdsCode.Append;
|
|
|
+ cdsCodeProject.AsString := vSL[i];
|
|
|
+ cdsCodeCode.AsString := sCode;
|
|
|
+ cdsCode.Post;
|
|
|
+ end;
|
|
|
+
|
|
|
+ cdsCode.First;
|
|
|
+ finally
|
|
|
+ vSL.Free;
|
|
|
+ ini.Free;
|
|
|
+ cdsCode.EnableControls;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TReports.saveCodes(AProjectName, ACode: string);
|
|
|
+var ini: TIniFile;
|
|
|
+ vSL: TStringList;
|
|
|
+ i: Integer;
|
|
|
+ sCode: String;
|
|
|
+ bExist: Boolean;
|
|
|
+begin
|
|
|
+ bExist := False;
|
|
|
+ vSL := TStringList.Create;
|
|
|
+ ini := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Cloud.ini');
|
|
|
+ try
|
|
|
+ Ini.ReadSection('Codes', vSL);
|
|
|
+
|
|
|
+ for i := 0 to vSL.Count - 1 do
|
|
|
+ begin
|
|
|
+ sCode := Ini.ReadString('Codes', vSL[i], '');
|
|
|
+ if SameText(sCode, ACode) then
|
|
|
+ Exit;
|
|
|
+ end;
|
|
|
+
|
|
|
+ ini.WriteString('Codes', AProjectName, ACode);
|
|
|
+
|
|
|
+ finally
|
|
|
+ vSL.Free;
|
|
|
+ ini.Free;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
end.
|