|
|
@ -145,9 +145,15 @@ public class MainFlowCtrlScheduler { |
|
|
|
List<A8kActionStep> guessWhatToDo() { |
|
|
|
List<A8kActionStep> dowhatList = new ArrayList<>(); |
|
|
|
for (ConditionItem item : conditionItems) { |
|
|
|
if (item.fn.check() && appResourceMgrService.applyForResources(this, item.relayResourceList)) { |
|
|
|
Boolean cond = item.fn.check(); |
|
|
|
Boolean relayResourceSuc = appResourceMgrService.applyForResources(this, item.relayResourceList); |
|
|
|
|
|
|
|
|
|
|
|
logger.info("step {} resoure:{},conditon {},resource {}", item.key, item.relayResourceList, cond, relayResourceSuc); |
|
|
|
if (cond && relayResourceSuc) { |
|
|
|
dowhatList.add(item.key); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return dowhatList; |
|
|
|
} |
|
|
@ -196,6 +202,9 @@ public class MainFlowCtrlScheduler { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//清空NoError |
|
|
|
ecodeList.removeIf(ecode -> ecode.ecode == A8kEcode.NoError); |
|
|
|
return ecodeList; |
|
|
|
} |
|
|
|
|
|
|
@ -219,6 +228,7 @@ public class MainFlowCtrlScheduler { |
|
|
|
ecodePostProcesser.process(ecodeList); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ebus.pushEvent(new A8kEcodeContextListPromptEvent(ecodeList)); |
|
|
|
state.errorFlag = true; |
|
|
|
this.state.ecodeList = ecodeList; |
|
|
@ -228,7 +238,7 @@ public class MainFlowCtrlScheduler { |
|
|
|
void threadLoopFn() { |
|
|
|
while (workThread.isAlive()) { |
|
|
|
if (state.fatalErrorFlag) { |
|
|
|
OS.forceSleep(100); |
|
|
|
OS.forceSleep(800); |
|
|
|
} else if (clearErrorPendingFlag) { |
|
|
|
/* |
|
|
|
* 清除错误 |
|
|
@ -245,9 +255,9 @@ public class MainFlowCtrlScheduler { |
|
|
|
A8kEcodeContext context = new A8kEcodeContext(A8kActionStep.DO_CLEAR_ERROR, A8kEcode.fromInt(appe.getErrorCode())); |
|
|
|
a8kEcodePostProcesser(List.of(context)); |
|
|
|
} |
|
|
|
OS.forceSleep(100); |
|
|
|
OS.forceSleep(800); |
|
|
|
} else if (state.errorFlag) { |
|
|
|
OS.forceSleep(100); |
|
|
|
OS.forceSleep(800); |
|
|
|
} else { |
|
|
|
|
|
|
|
List<A8kActionStep> dowhatList = guessWhatToDo(); |
|
|
@ -260,8 +270,11 @@ public class MainFlowCtrlScheduler { |
|
|
|
List<A8kEcodeContext> ecodeList = waitAllActionIsDone(futureList); |
|
|
|
|
|
|
|
appResourceMgrService.releaseAllResource(this); |
|
|
|
a8kEcodePostProcesser(ecodeList); |
|
|
|
OS.forceSleep(100); |
|
|
|
if (!ecodeList.isEmpty()) { |
|
|
|
a8kEcodePostProcesser(ecodeList); |
|
|
|
} |
|
|
|
|
|
|
|
OS.forceSleep(800); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|