2026-07-29 22:58
BUG20260729_06 - 切换公司帐套提示"ServerList.xml未找到"
LoadConfigFromXML 直接从 Self.XMLFilePath 加载 XMLExit,主流程不报错但后续连接失败var 区增加 DLL 外部函数: function GetServerListByWCF: string; external 'BlueWhaleDingWCall.dll';
LoadConfigFromXML 增加容错逻辑:Self.XMLFilePath 为空或文件不存在 → 重置为 ExeName\ServerList.xml[ServerList] XMLFilePath=...)持久化ExeName\ServerList.xml 仍不存在 → 调用 GetServerListByWCF 下载if (Self.XMLFilePath = '') or (not FileExists(Self.XMLFilePath)) then
begin
Self.XMLFilePath := ExtractFilePath(Application.ExeName) + 'ServerList.xml';
FIniFix := TIniFile.Create(Self.GetIniFileName());
try
FIniFix.WriteString('ServerList', 'XMLFilePath', Self.XMLFilePath);
finally
FIniFix.Free;
end;
if not FileExists(Self.XMLFilePath) then
begin
try
XmlContent := GetServerListByWCF;
if (XmlContent <> '') and (Pos('<?xml', XmlContent) > 0) then
begin
MS := TMemoryStream.Create;
try
MS.Write(PAnsiChar(AnsiString(XmlContent))^, Length(XmlContent));
MS.Position := 0;
MS.SaveToFile(Self.XMLFilePath);
Pub.WriteLog('ServerList.xml downloaded: ' + Self.XMLFilePath, False);
finally
MS.Free;
end;
end;
except
on E: Exception do
Pub.WriteLog('GetServerListByWCF failed: ' + E.Message, False);
end;
end;
end;
BlueWhaleDingWCall.dll(已全局部署)BlueWhaleERP.dpr 推送即可