|
|
@ -2,6 +2,9 @@ package a8k.app.service.mainctrl.mainflowctrl; |
|
|
|
|
|
|
|
import a8k.OS; |
|
|
|
import a8k.SpringBootBeanUtil; |
|
|
|
import a8k.app.engineer.service.qatest.EngineerModeActionCtrlService; |
|
|
|
import a8k.app.engineer.service.state.EngineerModeStateMgrService; |
|
|
|
import a8k.app.engineer.service.type.EngineerWorkState; |
|
|
|
import a8k.app.type.DeviceRunMode; |
|
|
|
//import a8k.app.a8ktype.appevent.A8kErrorsPromptEvent; |
|
|
|
import a8k.app.type.a8k.pos.TipGroupPos; |
|
|
@ -40,11 +43,12 @@ import java.util.Objects; |
|
|
|
public class MainFlowCtrlScheduler implements ApplicationListener<ApplicationStartedEvent> { |
|
|
|
|
|
|
|
|
|
|
|
private final GStateMgrService gstate; |
|
|
|
private final DeviceWorkStateMgrService deviceWorkStateMgrService; |
|
|
|
private final AppEventBusService ebus; |
|
|
|
private final ModuleEnableCtrlDriver moduleEnableCtrlDriver; |
|
|
|
private final LiquidOperationCtrlService liquidOperationCtrlService; |
|
|
|
private final GStateMgrService gstate; |
|
|
|
private final DeviceWorkStateMgrService deviceWorkStateMgrService; |
|
|
|
private final AppEventBusService ebus; |
|
|
|
private final ModuleEnableCtrlDriver moduleEnableCtrlDriver; |
|
|
|
private final LiquidOperationCtrlService liquidOperationCtrlService; |
|
|
|
private final EngineerModeStateMgrService engineerModeStateMgrService; |
|
|
|
|
|
|
|
List<A8kActionTask> allActions = new ArrayList<>(); |
|
|
|
IMainFlowStateChangeProcesser stateChangeProcesser; |
|
|
@ -94,6 +98,10 @@ public class MainFlowCtrlScheduler implements ApplicationListener<ApplicationSta |
|
|
|
deviceWorkStateMgrService.clearPending(); |
|
|
|
throw new AppException(A8kEcode.APPE_DEVICE_IS_IN_FATAL_ERROR); |
|
|
|
} |
|
|
|
|
|
|
|
if (engineerModeStateMgrService.getState().engineerWorkState.equals(EngineerWorkState.WORKING)) { |
|
|
|
throw new AppException(A8kEcode.DEVICE_IS_BUSY); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Resource |
|
|
@ -282,24 +290,24 @@ public class MainFlowCtrlScheduler implements ApplicationListener<ApplicationSta |
|
|
|
|
|
|
|
void workFn() { |
|
|
|
while (workThread.isAlive()) { |
|
|
|
try{ |
|
|
|
var state = deviceWorkStateMgrService.getDeviceWorkState(); |
|
|
|
if (state.fatalErrorFlag) { |
|
|
|
OS.forceSleep(500); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
switch (state.workState) { |
|
|
|
case IDLE -> onIDLE(); |
|
|
|
case WORKING -> onWorking(); |
|
|
|
case PAUSE -> onPause(); |
|
|
|
} |
|
|
|
|
|
|
|
onPostProcessing(); |
|
|
|
OS.forceSleep(500); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("workFn error {}", e.getMessage(), e); |
|
|
|
} |
|
|
|
try { |
|
|
|
var state = deviceWorkStateMgrService.getDeviceWorkState(); |
|
|
|
if (state.fatalErrorFlag) { |
|
|
|
OS.forceSleep(500); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
switch (state.workState) { |
|
|
|
case IDLE -> onIDLE(); |
|
|
|
case WORKING -> onWorking(); |
|
|
|
case PAUSE -> onPause(); |
|
|
|
} |
|
|
|
|
|
|
|
onPostProcessing(); |
|
|
|
OS.forceSleep(500); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("workFn error {}", e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|