开发:避免图纸因为PU失败导致的无法保存,并且上报错误。

pull/1342/MERGE
ChenX 4 years ago
parent 2e92c9a9f1
commit c87d3d3fb0

@ -1,6 +1,7 @@
import { Intent } from '@blueprintjs/core';
import pako from 'pako';
import { app } from '../ApplicationServices/Application';
import { ReportError } from '../Common/ErrorMonitoring';
import { FileSystem } from '../Common/FileSystem';
import { FileHistoryUrl } from '../Common/HostUrl';
import { RequestStatus, uploadLogo } from '../Common/Request';
@ -62,10 +63,25 @@ export class Save implements Command
let f = db.FileWrite();
let vf = new CADFiler();
app.Viewer.CameraCtrl.WriteFile(vf);
let isError = false;
if (userConfig.autoClearHistory)
{
db = new Database().FileRead(f);
Purge(db);
try
{
Purge(db);
}
catch (error)
{
AppToaster.show({
message: `尝试对图纸进行PU错误,可能图纸已经损坏,建议您马上联系我们的工程师反馈!`,
timeout: 15000,
intent: Intent.WARNING,
});
isError = true;
}
f = db.FileWrite();
AppToaster.show({
message: `保存的文件自动清理了所有的历史记录,如果需要手动PU清理,请使用Config命令设置!`,
@ -120,6 +136,9 @@ export class Save implements Command
//备份到服务端 或者 本地端
UploadFileHistory(file);
if (isError)
ReportError(fileServer.m_CurFileId, "报告错误! 原因:已经无法PU.");
app.Editor.Prompt("保存成功!");
}
}

Loading…
Cancel
Save