Browse Source

Fix some bug

master
zhaohe 2 months ago
parent
commit
0af71043b0
  1. 3
      src/main/java/a8k/app/controler/api/v1/engineer/ExperimentConsistencyTestingControler.java
  2. 94
      src/main/java/a8k/app/engineer/service/qatest/ExperimentConsistencyTestingService.java
  3. 5
      src/main/java/a8k/app/engineer/service/state/TubeholderExSettingMgr.java
  4. 1
      src/main/java/a8k/app/engineer/service/type/TubeHolderExConfig.java
  5. 3
      src/main/java/a8k/app/service/ctrlmodule/TipOperationCtrlModule.java
  6. 13
      src/main/java/a8k/app/service/mainctrl/MainFlowCtrlScheduler.java
  7. 28
      src/main/java/a8k/app/service/module/SamplePreProcessModule.java
  8. 2
      src/main/java/a8k/extui/page/test/verification/P34LiquidOperationTestPage.java

3
src/main/java/a8k/app/controler/api/v1/engineer/ExperimentConsistencyTestingControler.java

@ -6,6 +6,7 @@ import a8k.app.engineer.service.state.TubeholderExSettingMgr;
import a8k.app.engineer.service.type.TubeHolderExConfig;
import a8k.app.type.exception.AppException;
import a8k.app.type.ui.ApiRet;
import a8k.app.utils.ZJsonHelper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
@ -36,10 +37,12 @@ public class ExperimentConsistencyTestingControler {
@Operation(summary = "提交配置")
@PostMapping("/submitConfig")
public ApiRet<Void> submitConfig(@RequestBody TubeHolderExConfig tubeHolderExConfig) {
log.info("提交试管架配置 {}", ZJsonHelper.objectToJson(tubeHolderExConfig));
tubeholderExSettingMgr.submitTubeExConfig(tubeHolderExConfig);
return ApiRet.success();
}
@Operation(summary = "获取配置")
@PostMapping("/getConfig")
public ApiRet<TubeHolderExConfig> getConfig() {

94
src/main/java/a8k/app/engineer/service/qatest/ExperimentConsistencyTestingService.java

@ -41,53 +41,53 @@ public class ExperimentConsistencyTestingService {
* @throws AppException
*/
public void startTest() throws AppException {
/*
* 检查当前是否有其他项目正在进行测试
*/
BeforeDoEngineerActionChecker.check();
/*
* 核对试管配置是否符合要求
*/
TubeHolderSetting tubeHolderSetting = tubeHolderSettingMgrService.getThelastActiveTubeHolderSetting();
if (tubeHolderSetting == null) {
throw AppException.of(A8kEcode.APPE_TUBEHOLDER_SETTING_ERROR, "缺少试管配置");
}
for (TubeSetting tubeSetting : tubeHolderSetting.tubeSettings) {
for (Integer projId : tubeSetting.projId) {
if (projId != 1) {
throw AppException.of(A8kEcode.APPE_TUBEHOLDER_SETTING_ERROR, "目前只支持HsCrp项目");
}
}
}
/*
* 核对耗材数量是否足够
*/
int testTotalTimes = 0;
for (TubeSetting tubeSetting : tubeHolderSetting.tubeSettings) {
for (Integer ignored : tubeSetting.projId) {
testTotalTimes += tubeholderExSettingMgr.getTubeExConfig().tubeExConfigs.get(tubeSetting.tubeIndex).repeatTimes;
}
}
Integer consumableNum = consumablesMgrService.getConsumableNum(projInfoMgrService.getProjBuildInInfo(1));
if (consumableNum < testTotalTimes) {
throw AppException.of(A8kEcode.APPE_CONSUME_NOT_ENOUGH,
String.format("反应板,当前剩余:%d,需要:%d",consumableNum, testTotalTimes));
}
if (!consumablesMgrService.isHasEnoughTips((int) (testTotalTimes * 1.2))) {
throw AppException.of(A8kEcode.APPE_TIP_NOT_ENOUGH,
String.format("Tip不足,需要:%d", (int) (testTotalTimes * 1.2)));
}
log.info("开始试剂实验一致性检测");
tubeholderExSettingMgr.setEnabled(true);
mainFlowCtrlScheduler.startWork(() -> {
log.info("试剂实验一致性检测工作线程结束");
tubeholderExSettingMgr.setEnabled(false);
});
// /*
// * 检查当前是否有其他项目正在进行测试
// */
// BeforeDoEngineerActionChecker.check();
// /*
// * 核对试管配置是否符合要求
// */
// TubeHolderSetting tubeHolderSetting = tubeHolderSettingMgrService.getThelastActiveTubeHolderSetting();
// if (tubeHolderSetting == null) {
// throw AppException.of(A8kEcode.APPE_TUBEHOLDER_SETTING_ERROR, "缺少试管配置");
// }
//
// for (TubeSetting tubeSetting : tubeHolderSetting.tubeSettings) {
// for (Integer projId : tubeSetting.projId) {
// if (projId != 1) {
// throw AppException.of(A8kEcode.APPE_TUBEHOLDER_SETTING_ERROR, "目前只支持HsCrp项目");
// }
// }
// }
//
//
// /*
// * 核对耗材数量是否足够
// */
// int testTotalTimes = 0;
// for (TubeSetting tubeSetting : tubeHolderSetting.tubeSettings) {
// for (Integer ignored : tubeSetting.projId) {
// testTotalTimes += tubeholderExSettingMgr.getTubeExConfig().tubeExConfigs.get(tubeSetting.tubeIndex).repeatTimes;
// }
// }
// Integer consumableNum = consumablesMgrService.getConsumableNum(projInfoMgrService.getProjBuildInInfo(1));
// if (consumableNum < testTotalTimes) {
// throw AppException.of(A8kEcode.APPE_CONSUME_NOT_ENOUGH,
// String.format("反应板,当前剩余:%d,需要:%d",consumableNum, testTotalTimes));
// }
// if (!consumablesMgrService.isHasEnoughTips((int) (testTotalTimes * 1.2))) {
// throw AppException.of(A8kEcode.APPE_TIP_NOT_ENOUGH,
// String.format("Tip不足,需要:%d", (int) (testTotalTimes * 1.2)));
// }
//
//
// log.info("开始试剂实验一致性检测");
// tubeholderExSettingMgr.setEnabled(true);
// mainFlowCtrlScheduler.startWork(() -> {
// log.info("试剂实验一致性检测工作线程结束");
// tubeholderExSettingMgr.setEnabled(false);
// });
}

5
src/main/java/a8k/app/engineer/service/state/TubeholderExSettingMgr.java

@ -11,7 +11,6 @@ import org.springframework.stereotype.Component;
@Slf4j
public class TubeholderExSettingMgr {
private TubeHolderExConfig tubeHolderExConfig = new TubeHolderExConfig();
private Boolean enabled = false;
synchronized public void submitTubeExConfig(TubeHolderExConfig tubeExTubeHolderExConfig) {
if (tubeExTubeHolderExConfig != null) {
@ -25,11 +24,11 @@ public class TubeholderExSettingMgr {
}
synchronized public void setEnabled(Boolean enabled) {
this.enabled = enabled;
this.tubeHolderExConfig.enable = enabled;
log.info("设置试管架配置使能状态 {}", enabled);
}
synchronized public Boolean isEnabled() {
return enabled;
return this.tubeHolderExConfig.enable;
}
}

1
src/main/java/a8k/app/engineer/service/type/TubeHolderExConfig.java

@ -9,6 +9,7 @@ import java.util.List;
@Data
public class TubeHolderExConfig {
public List<TubeExConfig> tubeExConfigs = new ArrayList<>();
public Boolean enable = true;
public TubeHolderExConfig() {
for (int i = 0; i < AppConstant.TUBEHOLER_SIZE; i++) {

3
src/main/java/a8k/app/service/ctrlmodule/TipOperationCtrlModule.java

@ -57,7 +57,7 @@ public class TipOperationCtrlModule {
public void testDoTakeTipAction(TipGroupPos tipGroupPos, Integer index) throws AppException {
doTakeTipAction(tipGroupPos, index);
}
public Boolean isHasTip() throws AppException {
public Boolean isHasTipInGun() throws AppException {
return pipetteCtrlDriver.readTipState();
}
@ -133,6 +133,7 @@ public class TipOperationCtrlModule {
}
//********************************************************************************
// 私有方法
//********************************************************************************

13
src/main/java/a8k/app/service/mainctrl/MainFlowCtrlScheduler.java

@ -4,6 +4,7 @@ import a8k.OS;
import a8k.app.engineer.service.state.EngineerModeStateMgrService;
import a8k.app.engineer.service.type.EngineerWorkState;
import a8k.app.service.ctrlmodule.TipOperationCtrlModule;
import a8k.app.service.lowerctrl.HbotMoveExCtrlService;
import a8k.app.service.lowerctrl.OptScanModuleLowerCtrlService;
import a8k.app.service.lowerctrl.TubeFeedingCtrlService;
import a8k.app.service.module.*;
@ -56,6 +57,7 @@ public class MainFlowCtrlScheduler {
private final OptScanModuleLowerCtrlService optScanModuleLowerCtrlService;
private final TubeFeedingCtrlService tubeFeedingCtrlService;
private final AppWarningFlagStateMgr appWarningFlagStateMgr;
private final HbotMoveExCtrlService hbotMoveExCtrlService;
private ZWorkThread workThread;
@ -81,6 +83,7 @@ public class MainFlowCtrlScheduler {
}
}
public void checkBeforeStartOrContinueWork() throws AppException {
//1. 检查所有试管架配置是否都已激活
UISender.txInfoMsg(log, "核对试管架配置是否都已激活");
@ -100,13 +103,17 @@ public class MainFlowCtrlScheduler {
}
synchronized public void startWork() throws AppException {
appWarningFlagStateMgr.clearAllFlagState();
startWork(null);
}
synchronized public void startWork(Runnable onStop) throws AppException {
appWarningFlagStateMgr.clearAllFlagState();
checkBeforeCall();
checkBeforeStartOrContinueWork();
if (tipOperationCtrlModule.isHasTipInGun()) {
tipOperationCtrlModule.dropTip();
}
hbotMoveExCtrlService.moveQuickToZero();
deviceWorkStateMgrService.setStartActionPending(A8kWorkTaskType.MainFlowTask, true);
this.onStop = onStop;
workThread.start(this::workThreadFn);
@ -126,6 +133,10 @@ public class MainFlowCtrlScheduler {
appWarningFlagStateMgr.clearAllFlagState();
checkBeforeCall();
checkBeforeStartOrContinueWork();
if (tipOperationCtrlModule.isHasTipInGun()) {
tipOperationCtrlModule.dropTip();
}
hbotMoveExCtrlService.moveQuickToZero();
deviceWorkStateMgrService.setResumeActionPending(true);
}

28
src/main/java/a8k/app/service/module/SamplePreProcessModule.java

@ -139,10 +139,6 @@ public class SamplePreProcessModule {
Boolean isHasEnoughIncubationIDLEPos = incubationPlateStateMgr.isHasEnoughIncubationIDLEPos(tubePosInfo.tube.getProjIds().size());
if (isHasEnoughIncubationIDLEPos) {
processTube(tubePosInfo);
//假装已经处理了试管架
//tubeStateMgrService.pendTube(tubePosInfo.isEmergency, tubePosInfo.tubeIndex);
//tubeStateMgrService.changeTubeStateToProcessComplete();
continue;
}
}
@ -152,7 +148,15 @@ public class SamplePreProcessModule {
state.setFatalAppError(AppErrorFactory.exceptionToAppError(e));
}
}
synchronized (this) {
try {
docmd("丢TIP", tipOperationCtrlModule::dropTip);
docmd("HBOT复位", hbotMoveCtrlService::moveToZero);
} catch (AppException e) {
log.error("Error during cleanup", e);
state.setFatalAppError(AppErrorFactory.exceptionToAppError(e));
}
}
state.isWorking = false;
}
@ -176,6 +180,7 @@ public class SamplePreProcessModule {
projBuildInInfo.reactionPlateIncubationTimeMin * 60
);
docmd("丢TIP", tipOperationCtrlModule::dropTip);
docmd("HBOT复位", hbotMoveCtrlService::moveToZero);
}
@ -211,13 +216,12 @@ public class SamplePreProcessModule {
//
startTask();
actionTaskPool.waitAllDone();
if (actionTaskPool.isHasError()) {
docmd("摇匀模组复位", tubePreProcessCtrlService::resteModule);
docmd("HBOT复位", () -> {
tipOperationCtrlModule.dropTip();
hbotMoveCtrlService.moveToZero();
});
}
docmd("摇匀模组复位", tubePreProcessCtrlService::resteModule);
docmd("HBOT复位", () -> {
tipOperationCtrlModule.dropTip();
hbotMoveCtrlService.moveToZero();
});
AppError fatalError = actionTaskPool.getFatalError();

2
src/main/java/a8k/extui/page/test/verification/P34LiquidOperationTestPage.java

@ -97,7 +97,7 @@ public class P34LiquidOperationTestPage {
public void tryDropTip() {
if (autoDropTip) {
try {
if (tipOperationCtrlModule.isHasTip())
if (tipOperationCtrlModule.isHasTipInGun())
tipOperationCtrlModule.dropTip();
} catch (AppException e) {
log.error("自动丢弃Tip失败", e);

Loading…
Cancel
Save