diff --git a/src/app/application.cjs b/src/app/application.cjs index 847ba35..197190c 100644 --- a/src/app/application.cjs +++ b/src/app/application.cjs @@ -109,7 +109,7 @@ async function main(options = {}) { workspace.markSessionChecksPending(); server=await startService({token,port,outputDir,scale:config.scale,installedExtension,extensionSourceDir:path.join(root,'extension'),store,storage,watchdog,renderSnapshot:options.renderSnapshot}); dashboard=createDashboard({store,workspace,outputDir,bpmSessions,bpmMonitor,mail,scanner,storage,notifications,orderRules,orderExecution,orderDispatcher,assistant,health,watchdog,trustedProxy:dashboardConfig.trustedProxy===true,updateChecker:createUpdateChecker({currentVersion:appVersion})}); - await new Promise((resolve,reject)=>{dashboard.once('error',reject);dashboard.listen(dashboardPort,dashboardHost,resolve);});store.recoverJobs();mailStore.recoverSends();custodian.start();mail.start();bpmMonitor.start(); + await new Promise((resolve,reject)=>{dashboard.once('error',reject);dashboard.listen(dashboardPort,dashboardHost,resolve);});store.recoverJobs();mailStore.recoverSends();custodian.start();mail.start();bpmMonitor.start();{let lastSlot='';const slotTimer=setInterval(()=>{try{const hm=new Intl.DateTimeFormat('en-GB',{timeZone:'Asia/Shanghai',hour:'2-digit',minute:'2-digit',hour12:false}).format(new Date());const times=store.settings().schedule?.times||[];if(times.includes(hm)&&lastSlot!==hm){lastSlot=hm;bpmMonitor.rescanNow().catch(()=>{});}}catch{}},15000);slotTimer.unref?.();} health.start(); orderExecution.start(); orderDispatcher.start(); diff --git a/src/modules/bpm/arrival-monitor.cjs b/src/modules/bpm/arrival-monitor.cjs index 023a49e..caf240c 100644 --- a/src/modules/bpm/arrival-monitor.cjs +++ b/src/modules/bpm/arrival-monitor.cjs @@ -23,7 +23,7 @@ class BpmArrivalMonitor{ let status='removed';try{status=this.workspace.getConnection(id).status==='disabled'||!this.scanner.store.config().enabled?'paused':'waiting';}catch{}return {status,lastSignalAt:null,lastSyncAt:null,nextReconcileAt:null,sources:{},delivery:this.deliveryState(id)}; } updateInterval(entry,config){if(entry.intervalMinutes===config.intervalMinutes)return;entry.intervalMinutes=config.intervalMinutes;entry.nextReconcile=(entry.lastReconcileAt??this.clock())+config.intervalMinutes*60000;} - async reconfigure(){await this.tick();} + async reconfigure(){await this.tick();} async rescanNow(){if(this.stopped)return;for(const entry of this.entries.values()){entry.nextReconcile=0;for(const kind of ['todo','inform'])this.source(entry,kind).nextAttempt=0;this.queue(entry,['todo','inform']);}await this.tick();} start(){if(this.timer||this.stopped)return;this.timer=setInterval(()=>this.tick().catch(()=>{}),this.pollMs);this.timer.unref?.();this.tick().catch(()=>{});} async tick(){ if(this.stopped)return;const config=this.scanner.store.config(),connections=this.workspace.snapshot().connections,ids=new Set(connections.map(c=>c.id)); diff --git a/src/modules/order-execution/coordinator.cjs b/src/modules/order-execution/coordinator.cjs index 54c4334..e17f448 100644 --- a/src/modules/order-execution/coordinator.cjs +++ b/src/modules/order-execution/coordinator.cjs @@ -146,7 +146,7 @@ class OrderExecutionCoordinator{ let p={},a={};this.blockers=[]; try{p=await this.provider.capabilities();}catch(error){this.blockers.push('待办提供器探测失败:'+error.message);} try{a=rule&&this.archive.probe?await this.archive.probe(rule):await this.archive.capabilities();}catch(error){this.blockers.push('归档运行条件探测失败:'+error.message);} - const capabilities={liveTodo:p.liveTodo===true,pdfExport:p.pdfExport===true&&a.pdfExport===true,automaticArchive:a.automaticArchive===true}; + const capabilities={liveTodo:p.liveTodo===true,pdfExport:a.pdfExport===true,automaticArchive:a.automaticArchive===true}; for(const key of Object.keys(capabilities))if(!capabilities[key])this.blockers.push(key+' 尚未通过实际探测。');this.store.capabilities=capabilities;return capabilities; } canRetry(task,principal){ diff --git a/src/modules/storage/order-archive.cjs b/src/modules/storage/order-archive.cjs index 0a2432f..f3364e0 100644 --- a/src/modules/storage/order-archive.cjs +++ b/src/modules/storage/order-archive.cjs @@ -53,7 +53,7 @@ class OrderArchiveProvider{ if(subfolder)target.relative=[target.relative,subfolder].filter(Boolean).join('/'); let filename; if(previous?.filename)filename=previous.filename; - else if(rule.filenameScheme==='orderDateSeq'){let names=[];try{const listing=await this.storage.list(target.server.id,target.relative);names=(listing?.entries||[]).map(entry=>entry.name);}catch{}filename=archiveSequenceFilename(event,chosen,names);} + else if(rule.filenameScheme==='orderDateSeq'){let names=[];try{const listing=await this.storage.list(target.server.id,target.relative);names=(listing?.entries||[]).map(entry=>entry.name);}catch{}filename=archiveSequenceFilename(event,this.clock(),names);} else filename=archiveFilename(event,rule.filenameDate,chosen); const outputFingerprint=fingerprint({sourceHash:order.sourceHash,event,directory:rule.archiveDirectory,filenameDate:rule.filenameDate,filename,chosen:new Date(chosen).toISOString(),generation}); if(legacy){