Browse Source

update

tags/v0
zhaohe 10 months ago
parent
commit
ed7911ad12
  1. BIN
      app.db
  2. 2
      src/main/java/a8k/extapi_controler/pagecontrol/ExtApiTabConfig.java
  3. 39
      src/main/java/a8k/service/app/appctrl/AppConsumablesScanService.java
  4. 10
      src/main/java/a8k/service/app/appctrl/mainflowctrl/CondtionMgrService.java
  5. 8
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_CLEAR_ERROR_BEFORE_WORK.java
  6. 13
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_FINISH_TUBE_PROCESS.java
  7. 3
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_PAUSE.java
  8. 12
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_PROCESS_ERROR_PLATE.java
  9. 10
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_START.java
  10. 10
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_STOP.java
  11. 10
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/PLATE_OPT_SCAN.java
  12. 16
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/PROCESS_INCUBATE_COMPLETED_PLATE.java
  13. 18
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ1_ENTER_TUBEHOLDER_AND_SCAN.java
  14. 10
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ2_SWITCH_TO_THE_NEXT_TUBE.java
  15. 17
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ4_PRE_PROCESS.java
  16. 10
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ5_PROCESS.java
  17. 16
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ6_POST_PROCESS.java
  18. 10
      src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ7_EJECT_TUBEHOLDER.java
  19. 9
      src/main/java/a8k/service/app/appdata/ProjCfgMgrService.java
  20. 13
      src/main/java/a8k/service/app/background/ProjIDCardDectorService.java
  21. 15
      src/main/java/a8k/service/app/devicectrl/ctrlservice/ConsumablesScanCtrlService.java
  22. 12
      src/main/java/a8k/service/app/devicectrl/ctrlservice/DeviceInitCtrlService.java
  23. 17
      src/main/java/a8k/service/app/devicectrl/param/param_mgr/HbotLittleBSPosMgr.java
  24. 14
      src/main/java/a8k/service/app/devicectrl/param/param_mgr/HbotProbeSubstancePosMgr.java
  25. 17
      src/main/java/a8k/service/test/MainflowCtrlTestService.java
  26. 119
      src/main/java/a8k/service/test/TestStateMgrService.java
  27. 272
      src/main/java/a8k/service/test/VirtualDeviceSimulationTest.java
  28. 16
      src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_02.java
  29. 16
      src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_03.java
  30. 16
      src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_04.java
  31. 16
      src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_05.java
  32. 16
      src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_06.java
  33. 17
      src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_07_EXPIRED.java
  34. 11
      src/main/java/a8k/service/test/fakeproj/FakeProjInfo.java
  35. 2
      src/main/java/a8k/service/test/state/TestModeState.java
  36. 46
      src/main/java/a8k/service/test/state/VirtualDevice.java
  37. 6
      src/main/java/a8k/type/ConsumableScanRawResult.java
  38. 2
      src/main/java/a8k/type/consumables/ConsumablesErrorType.java
  39. 4
      src/main/java/a8k/utils/ReactionPlate2DCodeHelper.java
  40. 6
      src/main/java/a8k/utils/ZAppChecker.java
  41. 4
      src/main/java/a8k/utils/ZDateUtils.java
  42. 4
      src/main/java/a8k/utils/ZStringUtils.java

BIN
app.db

2
src/main/java/a8k/extapi_controler/pagecontrol/ExtApiTabConfig.java

@ -29,7 +29,9 @@ public enum ExtApiTabConfig {
PipetteGunLLFParamCalibration("校准.移液枪LLF参数校准", true),
VirtualDeviceSimulationTest("测试.虚拟设备测试", true),
MainflowCtrlTestService("测试.主流程控制测试", true),
A8kPipetteCtrlModule("硬件驱动测试.移液枪测试", true),

39
src/main/java/a8k/service/app/appctrl/AppConsumablesScanService.java

@ -5,7 +5,7 @@ import a8k.hardware.type.a8kcanprotocol.A8kEcode;
import a8k.service.app.appdata.ProjCfgMgrService;
import a8k.service.app.appstate.GStateService;
import a8k.service.app.devicectrl.ctrlservice.ConsumablesScanCtrlService;
import a8k.type.ConsumableGroup;
import a8k.type.ConsumableOneChResult;
import a8k.type.ConsumableScanRawResult;
@ -19,6 +19,7 @@ import a8k.service.db.type.a8kidcard.zenum.A8kReactionFlowType;
import a8k.utils.A8kProjCfg;
import a8k.utils.ReactionPlate2DCode;
import a8k.utils.ReactionPlate2DCodeHelper;
import a8k.utils.ZStringUtils;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@ -53,19 +54,33 @@ public class AppConsumablesScanService {
ConsumablesScanResult ret = new ConsumablesScanResult();
ret.chNum = ch;
if (rawResult.larBSScanResult == null && rawResult.littBSScanResult == null && rawResult.PBScanResult == null) {
if (rawResult == null) {
ret.state = ConsumablesErrorType.EMPTY;
return ret;
}
if (ZStringUtils.isNullOrEmpty(rawResult.larBSScanResult) &&
ZStringUtils.isNullOrEmpty(rawResult.littBSScanResult) &&
ZStringUtils.isNullOrEmpty(rawResult.PBScanResult)) {
ret.state = ConsumablesErrorType.EMPTY;
return ret;
}
if (rawResult.PBScanResult == null) {
if (ZStringUtils.isNullOrEmpty(rawResult.PBScanResult)) {
ret.state = ConsumablesErrorType.MISS_REACTION_PLATE;
return ret;
}
//解析板夹二维码
ReactionPlate2DCode rp2dcode = ReactionPlate2DCodeHelper.parse(rawResult.PBScanResult);
A8kProjCfg projCfg = appProjMgr.findByProjIndex(rp2dcode.lotId);
if (rp2dcode == null) {
ret.state = ConsumablesErrorType.REACTION_PLATE_2D_CODE_FORMATE_ERROR;
return ret;
}
A8kProjCfg projCfg = appProjMgr.findByProjIndex(rp2dcode.lotId);
if (projCfg.idCardInfo == null) {
logger.warn("未找到匹配的项目ID卡,LotID:{}", rp2dcode.lotId);
ret.state = ConsumablesErrorType.MISS_IDCARD;
@ -77,14 +92,20 @@ public class AppConsumablesScanService {
return ret;
}
Assert.isTrue(projCfg.projectInfo != null, "projCfg.projectInfo != null");
if (projCfg.projectInfo == null) {
logger.warn("不支持的项目,LotID:{}", rp2dcode.lotId);
ret.state = ConsumablesErrorType.UN_SUPPORT_PROJ;
return ret;
}
Assert.isTrue(projCfg.projectInfo.reactionFlowType != null, "reactionType != null");
Integer projIndex = projCfg.idCardInfo.projIndex;
A8kReactionFlowType reactionType = projCfg.projectInfo.reactionFlowType;
if (reactionType.equals(A8kReactionFlowType.FlowType1)) {
//校验小瓶缓冲液,小瓶缓冲液+样本
if (rawResult.littBSScanResult == null) {
if (ZStringUtils.isNullOrEmpty(rawResult.littBSScanResult)) {
ret.state = ConsumablesErrorType.MISS_LITTSB;
return ret;
}
@ -96,7 +117,7 @@ public class AppConsumablesScanService {
} else if (reactionType.equals(A8kReactionFlowType.FlowType2)) {
// 校验大瓶缓冲液,大瓶缓冲液+小瓶缓冲液+样本
if (rawResult.larBSScanResult == null) {
if (ZStringUtils.isNullOrEmpty(rawResult.larBSScanResult)) {
ret.state = ConsumablesErrorType.MISS_LARBS;
return ret;
}
@ -160,6 +181,8 @@ public class AppConsumablesScanService {
ConsumableScanRawResult scanRawResult;
scanRawResult = scanCtrlService.doScanConsumablesAction();
logger.info("扫描结果:{}", scanRawResult);
//解析扫描结果
for (int i = 0; i < 6; i++) {
var result = parseScanResult(i, scanRawResult.ch[i]);
@ -203,7 +226,7 @@ public class AppConsumablesScanService {
}
// For Test Only
public void LoadingConsumablesDirectly( ConsumablesScanResult result) {
public void LoadingConsumablesDirectly(ConsumablesScanResult result) {
LoadingConsumables(result.chNum, result);
}

10
src/main/java/a8k/service/app/appctrl/mainflowctrl/CondtionMgrService.java

@ -10,7 +10,7 @@ import a8k.service.app.appstate.type.state.A8kWorkState;
import a8k.service.app.appstate.type.state.TubeHolderState;
import a8k.service.app.appstate.type.state.TubeState;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
@ -23,11 +23,11 @@ public class CondtionMgrService {
static Logger logger = LoggerFactory.getLogger(CondtionMgrService.class);
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
A8kCanBusService canBus;
@ -40,7 +40,7 @@ public class CondtionMgrService {
public Boolean getTubeholderEnterPosPPS() { //入料通道是否为空
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
return virtualDevice.isTubeHolderReady();
}
try {

8
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_CLEAR_ERROR_BEFORE_WORK.java

@ -1,26 +1,18 @@
package a8k.service.app.appctrl.mainflowctrl.action;
import a8k.service.app.appctrl.mainflowctrl.CondtionMgrService;
import a8k.service.app.appctrl.mainflowctrl.base.A8kActionStepType;
import a8k.service.app.appctrl.mainflowctrl.base.A8kStepAction;
import a8k.service.app.appstate.GStateService;
import a8k.service.app.appstate.IncubationPlateStateMgrService;
import a8k.service.app.appstate.OptScanModuleStateMgrService;
import a8k.service.app.appstate.resource.A8kPublicResourceType;
import a8k.service.app.appstate.type.MainFlowCtrlState;
import a8k.service.app.appstate.type.state.A8kWorkState;
import a8k.type.exception.AppException;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.List;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.VirtualDevice;
/**
* 清空错误针对部分错误进行相应的硬件操作

13
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_FINISH_TUBE_PROCESS.java

@ -1,12 +1,9 @@
package a8k.service.app.appctrl.mainflowctrl.action;
import a8k.OS;
import a8k.service.app.appctrl.mainflowctrl.CondtionMgrService;
import a8k.service.app.appctrl.mainflowctrl.base.A8kActionStepType;
import a8k.service.app.appctrl.mainflowctrl.base.A8kStepAction;
import a8k.service.app.appstate.GStateService;
import a8k.service.app.appstate.IncubationPlateStateMgrService;
import a8k.service.app.appstate.OptScanModuleStateMgrService;
import a8k.service.app.appstate.ProjectProcessContextMgrService;
import a8k.service.app.appstate.resource.A8kPublicResourceType;
import a8k.service.app.appstate.type.MainFlowCtrlState;
@ -25,7 +22,7 @@ import org.springframework.util.Assert;
import java.util.List;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
/*
@ -49,11 +46,11 @@ public class DO_FINISH_TUBE_PROCESS extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
@ -76,7 +73,7 @@ public class DO_FINISH_TUBE_PROCESS extends A8kStepAction {
}
void resetHbotAndShakeModule() throws AppException {
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("处理错误试管", 2);
virtualDevice.doVirtualThings("复位摇匀模组", 2);
virtualDevice.doVirtualThings("复位HBOT", 2);

3
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_PAUSE.java

@ -14,8 +14,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.List;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.VirtualDevice;
@Component
public class DO_PAUSE extends A8kStepAction {
static Logger logger = LoggerFactory.getLogger(DO_PAUSE.class);

12
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_PROCESS_ERROR_PLATE.java

@ -10,7 +10,7 @@ import a8k.service.app.appstate.resource.A8kPublicResourceType;
import a8k.service.app.appstate.type.IncubationSubTank;
import a8k.service.app.appstate.type.MainFlowCtrlState;
import a8k.service.app.devicectrl.ctrlservice.OptScanModuleCtrlService;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
import a8k.type.exception.AppException;
import jakarta.annotation.PostConstruct;
@ -33,11 +33,11 @@ public class DO_PROCESS_ERROR_PLATE extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
CondtionMgrService cms;
@ -59,7 +59,7 @@ public class DO_PROCESS_ERROR_PLATE extends A8kStepAction {
void doEjectErrorPlate(IncubationSubTank errorTank) throws AppException {
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("推出板夹 From " + errorTank.toString());
return;
}
@ -68,7 +68,7 @@ public class DO_PROCESS_ERROR_PLATE extends A8kStepAction {
}
void doDropErrorPlate() throws AppException {
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("丢弃板夹");
return;
}

10
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_START.java

@ -9,7 +9,7 @@ import a8k.service.app.appstate.type.state.A8kWorkState;
import a8k.service.app.devicectrl.ctrlservice.DeviceInitCtrlService;
import a8k.service.app.devicectrl.ctrlservice.HbotCtrlService;
import a8k.service.app.devicectrl.ctrlservice.TubeFeedingCtrlService;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
import a8k.type.exception.AppException;
import jakarta.annotation.PostConstruct;
@ -29,11 +29,11 @@ public class DO_START extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
DeviceInitCtrlService deviceInitCtrlService;
@ -51,7 +51,7 @@ public class DO_START extends A8kStepAction {
@Override public void doaction() throws AppException {
mfcs.workStateChangeFlag = false;
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("弹出试管架");
return;
}

10
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/DO_STOP.java

@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
@Component
@ -34,11 +34,11 @@ public class DO_STOP extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
ProjectProcessContextMgrService projectProcessContextMgrService;
@ -66,7 +66,7 @@ public class DO_STOP extends A8kStepAction {
}
void doClearDevice() throws AppException {
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("清空设备", 1);
return;
}

10
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/PLATE_OPT_SCAN.java

@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
/**
@ -42,11 +42,11 @@ public class PLATE_OPT_SCAN extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
CondtionMgrService cms;
@ -75,7 +75,7 @@ public class PLATE_OPT_SCAN extends A8kStepAction {
List<ReactionResult> doOptScan(ProjProcessContext cxt) throws AppException {
List<ReactionResult> reactionResults = new ArrayList<>();
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("扫描板夹", 2);
reactionResults.add(new ReactionResult(ReactionResultStatus.SUCCESS, "12.8 mg/L"));
reactionResults.add(new ReactionResult(ReactionResultStatus.ERROR_RESULT_OUT_OF_RANGE, ""));

16
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/PROCESS_INCUBATE_COMPLETED_PLATE.java

@ -1,6 +1,5 @@
package a8k.service.app.appctrl.mainflowctrl.action;
import a8k.OS;
import a8k.service.app.appctrl.mainflowctrl.CondtionMgrService;
import a8k.service.app.appctrl.mainflowctrl.base.A8kActionStepType;
import a8k.service.app.appctrl.mainflowctrl.base.A8kStepAction;
@ -9,25 +8,20 @@ import a8k.service.app.appstate.IncubationPlateStateMgrService;
import a8k.service.app.appstate.OptScanModuleStateMgrService;
import a8k.service.app.appstate.ProjectProcessContextMgrService;
import a8k.service.app.appstate.resource.A8kPublicResourceType;
import a8k.service.app.appstate.type.IncubationPlate;
import a8k.service.app.appstate.type.IncubationSubTank;
import a8k.service.app.appstate.type.MainFlowCtrlState;
import a8k.service.app.appstate.type.ProjProcessContext;
import a8k.service.app.appstate.type.state.IncubationSubTankState;
import a8k.service.app.devicectrl.ctrlservice.OptScanModuleCtrlService;
import a8k.service.app.devicectrl.ctrlservice.TurnableMoveCtrlService;
import a8k.type.exception.AppException;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import org.aspectj.lang.annotation.DeclareWarning;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.List;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
/**
@ -42,11 +36,11 @@ public class PROCESS_INCUBATE_COMPLETED_PLATE extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
CondtionMgrService cms;
@ -74,7 +68,7 @@ public class PROCESS_INCUBATE_COMPLETED_PLATE extends A8kStepAction {
void doEjectPlate(IncubationSubTank tank) throws AppException {
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings(String.format("推出反应板夹从%s到光学模组", tank.getPos()));
return;
}

18
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ1_ENTER_TUBEHOLDER_AND_SCAN.java

@ -18,7 +18,7 @@ import a8k.service.app.appstate.type.state.TubeHolderState;
import a8k.service.app.appstate.type.state.TubeState;
import a8k.service.app.devicectrl.ctrlservice.TubeFeedingCtrlService;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
import a8k.type.TubeHolderScanResult;
import a8k.type.ecode.TubeError;
@ -51,11 +51,11 @@ public class SEQ1_ENTER_TUBEHOLDER_AND_SCAN extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
AppEventBusService ebus;
@ -77,9 +77,9 @@ public class SEQ1_ENTER_TUBEHOLDER_AND_SCAN extends A8kStepAction {
TubeHolderScanResult doScanHolder() throws AppException {
TubeHolderScanResult result;
if (!testStateMgrService.isVirtualDeviceEnable()) {
if (!testModeState.isVirtualDeviceEnable()) {
result = stc.scanTubeHodler();
if(testStateMgrService.getVirtualTubeScanResult()){
if(testModeState.getVirtualTubeScanResult()){
result = virtualDevice.getTubeHolderScanResult();
}
} else {
@ -89,7 +89,7 @@ public class SEQ1_ENTER_TUBEHOLDER_AND_SCAN extends A8kStepAction {
}
void doEjectHodler() throws AppException {
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("弹出试管架");
return;
}
@ -137,11 +137,9 @@ public class SEQ1_ENTER_TUBEHOLDER_AND_SCAN extends A8kStepAction {
// state.tubeStates[i].projIndex = setting.tubeSettings[i].projIndex;
if (tube.getProjIndex().isEmpty()) {
logger.error("试管{}待做项目为空", i);
return A8kEcode.APPE_PROJ_INDEX_IS_EMPTY;
logger.warn("试管{}待做项目为空", i);
}
return A8kEcode.SUC;
}

10
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ2_SWITCH_TO_THE_NEXT_TUBE.java

@ -10,7 +10,7 @@ import a8k.service.app.appstate.type.TubeHolder;
import a8k.service.app.appstate.type.Tube;
import a8k.service.app.appstate.type.state.TubeState;
import a8k.service.app.devicectrl.ctrlservice.TubeFeedingCtrlService;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
import a8k.type.exception.AppException;
import jakarta.annotation.PostConstruct;
@ -38,11 +38,11 @@ public class SEQ2_SWITCH_TO_THE_NEXT_TUBE extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
@ -66,7 +66,7 @@ public class SEQ2_SWITCH_TO_THE_NEXT_TUBE extends A8kStepAction {
//
void moveToNextTube(Integer tubeIndex) throws AppException {
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("移动到下一个试管");
} else {
tubeFeedingCtrlService.moveTubeToPreProcessPos(tubeIndex);

17
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ4_PRE_PROCESS.java

@ -1,15 +1,12 @@
package a8k.service.app.appctrl.mainflowctrl.action;
import a8k.OS;
import a8k.hardware.type.a8kcanprotocol.A8kEcode;
import a8k.service.app.appctrl.mainflowctrl.CondtionMgrService;
import a8k.service.app.appstate.type.ProjProcessContext;
import a8k.service.app.appstate.type.TubeHolder;
import a8k.service.app.devicectrl.ctrlservice.*;
import a8k.service.app.devicectrl.driver.PipetteCtrlDriver;
import a8k.service.app.devicectrl.script.DeviceCtrlScripter;
import a8k.service.db.type.a8kidcard.zenum.A8kReactionFlowType;
import a8k.type.IncubatorPos;
import a8k.type.type.A8kTubeHolderType;
import a8k.utils.*;
@ -30,7 +27,7 @@ import java.util.List;
import java.util.Objects;
import java.util.concurrent.*;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
import org.springframework.util.Assert;
@ -52,11 +49,11 @@ public class SEQ4_PRE_PROCESS extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
AppExceptionBuilder ebuilder;
@ -87,7 +84,7 @@ public class SEQ4_PRE_PROCESS extends A8kStepAction {
* @throws AppException 异常
*/
void prepareReactionPlate() throws AppException {
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("准备反应板夹", 2);
return;
}
@ -105,7 +102,7 @@ public class SEQ4_PRE_PROCESS extends A8kStepAction {
* @throws AppException 异常
*/
void shakeAndTakeCap() throws AppException {
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("摇匀并取盖", 2);
return;
}
@ -132,7 +129,7 @@ public class SEQ4_PRE_PROCESS extends A8kStepAction {
* @throws AppException exception
*/
void hbotPrepareTip() throws AppException {
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("准备Hbot Tip", 2);
return;
}

10
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ5_PROCESS.java

@ -20,7 +20,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
/**
@ -38,11 +38,11 @@ public class SEQ5_PROCESS extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
@ -73,7 +73,7 @@ public class SEQ5_PROCESS extends A8kStepAction {
ProjProcessContext cxt = projectProcessContextMgrService.getProjProcessContext(tube.getSampleId(), tube.getProjIndex().get(projProcessOff));
A8kReactionFlowType type = cxt.projCfg.projectInfo.reactionFlowType;
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("处理样本(准备反应板,取tip,摇匀,脱帽)", 5);
return;
}

16
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ6_POST_PROCESS.java

@ -1,10 +1,6 @@
package a8k.service.app.appctrl.mainflowctrl.action;
import a8k.OS;
import a8k.service.app.appstate.type.TubeHolder;
import a8k.service.app.devicectrl.ctrlservice.TubePreProcesCtrlService;
import a8k.type.type.A8kTubeHolderType;
import a8k.utils.AppExceptionBuilder;
import a8k.service.app.appctrl.mainflowctrl.CondtionMgrService;
import a8k.service.app.appctrl.mainflowctrl.base.A8kActionStepType;
@ -12,8 +8,6 @@ import a8k.service.app.appctrl.mainflowctrl.base.A8kStepAction;
import a8k.service.app.appstate.*;
import a8k.service.app.appstate.resource.A8kPublicResourceType;
import a8k.service.app.appstate.type.MainFlowCtrlState;
import a8k.service.app.appstate.type.Tube;
import a8k.service.app.appstate.type.state.TubeState;
import a8k.type.exception.AppException;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
@ -24,7 +18,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.*;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
/**
@ -42,11 +36,11 @@ public class SEQ6_POST_PROCESS extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
AppExceptionBuilder ebuilder;
@ -71,7 +65,7 @@ public class SEQ6_POST_PROCESS extends A8kStepAction {
}
void doAction() throws AppException {
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("后处理样本", 3);
}
tubePreProcesCtrlService.resteModule();

10
src/main/java/a8k/service/app/appctrl/mainflowctrl/action/SEQ7_EJECT_TUBEHOLDER.java

@ -9,7 +9,7 @@ import a8k.service.app.appstate.resource.A8kPublicResourceType;
import a8k.service.app.appstate.type.state.TubeHolderState;
import a8k.service.app.devicectrl.ctrlservice.TubeFeedingCtrlService;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
import a8k.type.exception.AppException;
import jakarta.annotation.PostConstruct;
@ -29,11 +29,11 @@ public class SEQ7_EJECT_TUBEHOLDER extends A8kStepAction {
}
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
@ -51,7 +51,7 @@ public class SEQ7_EJECT_TUBEHOLDER extends A8kStepAction {
}
@Override public void doaction() throws AppException {
if (!testStateMgrService.isVirtualDeviceEnable()) {
if (!testModeState.isVirtualDeviceEnable()) {
tubeFeedingCtrlService.ejectTubeHolder();
tubeFeedingCtrlService.moveTubeRackMoveToEnterPos();
} else {

9
src/main/java/a8k/service/app/appdata/ProjCfgMgrService.java

@ -28,6 +28,9 @@ public class ProjCfgMgrService {
public A8kProjCfg findByProjIndex(String lotid) {
A8kProjCfg projCfg = new A8kProjCfg();
projCfg.idCardInfo = a8kProjIdCardDBService.getByLotId(lotid);
if(projCfg.idCardInfo == null){
return projCfg;
}
projCfg.projectInfo = a8kProjInfoDBService.findByProjIndex(projCfg.idCardInfo.projIndex);
projCfg.projOptConfigList = a8kProjOptConfigDBService.findByProjIndex(projCfg.idCardInfo.projIndex);
return projCfg;
@ -35,11 +38,11 @@ public class ProjCfgMgrService {
public A8kProjCfg findByProjIndexWithCheck(String lotid) {
A8kProjCfg projCfg = new A8kProjCfg();
projCfg.idCardInfo = a8kProjIdCardDBService.getByLotId(lotid);
projCfg.projectInfo = a8kProjInfoDBService.findByProjIndex(projCfg.idCardInfo.projIndex);
projCfg.projOptConfigList = a8kProjOptConfigDBService.findByProjIndex(projCfg.idCardInfo.projIndex);
projCfg.idCardInfo = a8kProjIdCardDBService.getByLotId(lotid);
Assert.isTrue(projCfg.idCardInfo != null, "ID卡信息不存在");
projCfg.projectInfo = a8kProjInfoDBService.findByProjIndex(projCfg.idCardInfo.projIndex);
Assert.isTrue(projCfg.projectInfo != null, "项目信息不存在");
projCfg.projOptConfigList = a8kProjOptConfigDBService.findByProjIndex(projCfg.idCardInfo.projIndex);
Assert.isTrue(projCfg.projOptConfigList != null, "项目配置信息不存在");
return projCfg;
}

13
src/main/java/a8k/service/app/background/ProjIDCardDectorService.java

@ -4,6 +4,7 @@ package a8k.service.app.background;
import a8k.service.app.appstate.GStateService;
import a8k.service.bases.appevent.*;
import a8k.hardware.type.regindex.RegIndex;
import a8k.service.test.state.VirtualDevice;
import a8k.type.exception.AppException;
import a8k.service.bases.AppEventBusService;
import a8k.hardware.A8kCanBusService;
@ -22,6 +23,9 @@ public class ProjIDCardDectorService {
@Resource
GStateService gstate;
@Resource
VirtualDevice virtualDevice;
@Resource
A8kCanBusService canBus;
@ -37,6 +41,15 @@ public class ProjIDCardDectorService {
}
void readIDCard() {
if (virtualDevice.isEnable()) {
if (virtualDevice.isMountIdCard()) {
var mountedIdCardInfo = virtualDevice.getMountIdCard();
gstate.setMountedIdCardInfo(mountedIdCardInfo);
eventBus.pushEvent(new AppIDCardMountEvent(mountedIdCardInfo));
}
return;
}
//读取ID卡信息
try {
byte[] data = null;

15
src/main/java/a8k/service/app/devicectrl/ctrlservice/ConsumablesScanCtrlService.java

@ -4,6 +4,7 @@ import a8k.service.app.devicectrl.exdriver.CodeScanerExDriver;
import a8k.service.app.devicectrl.exdriver.HbotBaseMoveExDriver;
import a8k.service.bases.ActionReactorService;
import a8k.service.app.devicectrl.param.param_mgr.Hbot2DCodeScanParamMgr;
import a8k.service.test.state.VirtualDevice;
import a8k.type.ConsumableOneChResult;
import a8k.type.ConsumableScanRawResult;
import a8k.type.cfg.Pos2d;
@ -14,15 +15,17 @@ import org.springframework.stereotype.Component;
@Component
public class ConsumablesScanCtrlService {
@Resource
VirtualDevice virtualDevice;
@Resource
ActionReactorService ar;
@Resource
Hbot2DCodeScanParamMgr hbotScanPos;
@Resource
CodeScanerExDriver codeScaner;
CodeScanerExDriver codeScaner;
@Resource
HbotBaseMoveExDriver hbot;
HbotBaseMoveExDriver hbot;
private void hbotMoveTo(Pos2d tpos) throws AppException {
@ -55,6 +58,10 @@ public class ConsumablesScanCtrlService {
public ConsumableScanRawResult doScanConsumablesAction() throws AppException {
if (virtualDevice.isEnable()) {
return virtualDevice.getConsumablesScanRawResult();
}
ConsumableScanRawResult result = new ConsumableScanRawResult();
for (int i = 0; i < 6; i++) {
int finalI = i;
@ -87,6 +94,10 @@ public class ConsumablesScanCtrlService {
}
public ConsumableOneChResult doScanOneCh(Integer ch) throws AppException {
if (virtualDevice.isEnable()) {
return virtualDevice.getConsumablesScanResult(ch);
}
ConsumableOneChResult result = new ConsumableOneChResult(ch);
ar.dosome("扫描耗材-板夹0", () -> result.PBScanResult = scanPB(ch));
ar.dosome("扫描耗材-小瓶缓冲液", () -> result.littBSScanResult = scanLittBS(ch));

12
src/main/java/a8k/service/app/devicectrl/ctrlservice/DeviceInitCtrlService.java

@ -11,7 +11,7 @@ import a8k.service.app.devicectrl.exdriver.MotorEnableExDriver;
import a8k.service.app.devicectrl.script.DeviceCtrlScripter;
import a8k.service.bases.ActionReactorService;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
import a8k.type.CheckPointType;
import a8k.type.checkpoint.CheckResult;
@ -32,11 +32,11 @@ import java.util.List;
public class DeviceInitCtrlService {
@Resource
GStateService gstate;
GStateService gstate;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
VirtualDevice virtualDevice;
@Resource
ActionReactorService actionReactor;
@ -89,7 +89,7 @@ public class DeviceInitCtrlService {
List<CheckResult> doDeviceMoveToZero() throws AppException {
List<CheckResult> results = checkBeforeInitDevice();
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
virtualDevice.doVirtualThings("初始化设备", 3);
gstate.setDeviceInited(true);
return results;
@ -152,7 +152,7 @@ public class DeviceInitCtrlService {
result.typechinfo = checkPoint.typechinfo;
//
if (testStateMgrService.isVirtualDeviceEnable()) {
if (testModeState.isVirtualDeviceEnable()) {
result.pass = true;
} else {
result.pass = checkPoint.checkfn.check();

17
src/main/java/a8k/service/app/devicectrl/param/param_mgr/HbotLittleBSPosMgr.java

@ -28,21 +28,6 @@ public class HbotLittleBSPosMgr extends ParamMgr {
setParam(param.name(), val);
}
public LittleBottleConsumablePosInfo getPosInfo() {
LittleBottleConsumablePosInfo info = new LittleBottleConsumablePosInfo();
info.g0_000 = getParam(HbotLittleBSPos.LittleBufferGroup0_000Pos, Pos3d.class);
info.g1_000 = getParam(HbotLittleBSPos.LittleBufferGroup1_000Pos, Pos3d.class);
info.g2_000 = getParam(HbotLittleBSPos.LittleBufferGroup2_000Pos, Pos3d.class);
info.g3_000 = getParam(HbotLittleBSPos.LittleBufferGroup3_000Pos, Pos3d.class);
info.g4_000 = getParam(HbotLittleBSPos.LittleBufferGroup4_000Pos, Pos3d.class);
info.g5_000 = getParam(HbotLittleBSPos.LittleBufferGroup5_000Pos, Pos3d.class);
info.dx = getParam(HbotLittleBSPos.LittleBufferGroupDX, Double.class);
info.dy = getParam(HbotLittleBSPos.LittleBufferGroupDY, Double.class);
return info;
}
public void setPosInfo(LittleBottleConsumablePosInfo info) {
setParam(HbotLittleBSPos.LittleBufferGroup0_000Pos, info.g0_000);
setParam(HbotLittleBSPos.LittleBufferGroup1_000Pos, info.g1_000);
@ -54,8 +39,6 @@ public class HbotLittleBSPosMgr extends ParamMgr {
setParam(HbotLittleBSPos.LittleBufferGroupDY, info.dy);
}
public Pos3d getPiercePos(ConsumableGroup group, Integer off) {
HbotLittleBSPos param = HbotLittleBSPos.valueOf(HbotLittleBSPos.LittleBufferGroup0_000Pos.ordinal() + group.ordinal());

14
src/main/java/a8k/service/app/devicectrl/param/param_mgr/HbotProbeSubstancePosMgr.java

@ -30,20 +30,6 @@ public class HbotProbeSubstancePosMgr extends ParamMgr {
}
public LittleBottleConsumablePosInfo getPosInfo() {
LittleBottleConsumablePosInfo info = new LittleBottleConsumablePosInfo();
info.g0_000 = getParam(HbotProbeSubstancePos.ProbeSubstanceGroup0_000Pos, Pos3d.class);
info.g1_000 = getParam(HbotProbeSubstancePos.ProbeSubstanceGroup1_000Pos, Pos3d.class);
info.g2_000 = getParam(HbotProbeSubstancePos.ProbeSubstanceGroup2_000Pos, Pos3d.class);
info.g3_000 = getParam(HbotProbeSubstancePos.ProbeSubstanceGroup3_000Pos, Pos3d.class);
info.g4_000 = getParam(HbotProbeSubstancePos.ProbeSubstanceGroup4_000Pos, Pos3d.class);
info.g5_000 = getParam(HbotProbeSubstancePos.ProbeSubstanceGroup5_000Pos, Pos3d.class);
info.dx = getParam(HbotProbeSubstancePos.ProbeSubstanceDX, Double.class);
info.dy = getParam(HbotProbeSubstancePos.ProbeSubstanceDY, Double.class);
return info;
}
public void setPosInfo(LittleBottleConsumablePosInfo info) {
setParam(HbotProbeSubstancePos.ProbeSubstanceGroup0_000Pos, info.g0_000);
setParam(HbotProbeSubstancePos.ProbeSubstanceGroup1_000Pos, info.g1_000);

17
src/main/java/a8k/service/test/MainflowCtrlTestService.java

@ -10,15 +10,13 @@ import a8k.service.app.appctrl.AppTubeSettingMgrService;
import a8k.service.app.appstate.ConsumablesMgrService;
import a8k.service.app.appstate.GStateService;
import a8k.service.app.appstate.type.state.A8kWorkState;
import a8k.service.app.devicectrl.ctrlservice.ConsumablesScanCtrlService;
import a8k.service.db.A8kProjIdCardDBService;
import a8k.service.db.A8kProjInfoDBService;
import a8k.service.db.A8kProjOptConfigDBService;
import a8k.service.test.fakeproj.FAKE_PROJ_01;
import a8k.service.test.fakeproj.FakeProjInfo;
import a8k.service.test.fakeproj.FakeProjInfoFactory;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.VirtualDevice;
import a8k.service.test.state.TestModeState;
import a8k.service.test.type.MainFlowCtrlTestCaseType;
import a8k.type.ConsumableGroup;
import a8k.type.ConsumablesScanResult;
@ -35,7 +33,6 @@ import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ -46,12 +43,12 @@ public class MainflowCtrlTestService {
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
//
// StateService
//
@Resource
ConsumablesMgrService consumablesMgrService;
ConsumablesMgrService consumablesMgrService;
@Resource
AppConsumablesScanService appConsumablesScanService;
@Resource
@ -145,7 +142,7 @@ public class MainflowCtrlTestService {
LoadingConsumablesDirectly(ConsumableGroup.GROUP0, new FAKE_PROJ_01());
//设置试管架扫描信息全部设置成高试管
var scanResult = createScanResult(A8kTubeHolderType.BloodTube, 1);
testStateMgrService.getVirtualDevice().setTubeScanResult(scanResult);
testModeState.getVirtualDevice().setTubeScanResult(scanResult);
//设置试管架配置信息
appTubeSettingMgrService.removeAllTubeSetting();
TubeHolderSetting setting = createOneActiveTubeHolderSetting(A8kTubeHolderType.BloodTube, 1, List.of(new FAKE_PROJ_01().projIndex));
@ -173,9 +170,9 @@ public class MainflowCtrlTestService {
throw new AppException(new AppCodeError("设备正在工作中,请先停止工作"));
}
testStateMgrService.getVirtualDevice().setEnableVirtualDevice(virtualDevice);
testStateMgrService.setNoCheckMode(noCheck);
testStateMgrService.setVirtualTubeScanResult(virtualTubeScanResult);
testModeState.getVirtualDevice().setEnableVirtualDevice(virtualDevice);
testModeState.setNoCheckMode(noCheck);
testModeState.setVirtualTubeScanResult(virtualTubeScanResult);
if (Objects.requireNonNull(castType) == MainFlowCtrlTestCaseType.SIMPLE_TEST) {
return DO_SIMPLE_TEST();

119
src/main/java/a8k/service/test/TestStateMgrService.java

@ -0,0 +1,119 @@
package a8k.service.test;
import a8k.service.db.A8kProjIdCardDBService;
import a8k.service.db.A8kProjInfoDBService;
import a8k.service.db.A8kProjOptConfigDBService;
import a8k.service.test.fakeproj.FakeProjInfoFactory;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
import a8k.type.ConsumableOneChResult;
import a8k.type.TubeHolderScanResult;
import a8k.type.TubesScanResult;
import a8k.type.tube_setting.TubeHolderSetting;
import a8k.type.type.A8kTubeHolderType;
import a8k.utils.ReactionPlate2DCodeHelper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class TestStateMgrService {
@Resource
TestModeState testModeState;
@Resource
VirtualDevice virtualDevice;
@Resource
A8kProjIdCardDBService a8kProjIdCardDBService;
@Resource
A8kProjOptConfigDBService a8kProjOptConfigDBService;
@Resource
A8kProjInfoDBService a8kProjInfoDBService;
public void addProjInfo(Class<?> projClass) {
a8kProjInfoDBService.add(FakeProjInfoFactory.buildProjectInfo(projClass));
a8kProjOptConfigDBService.add(FakeProjInfoFactory.buildA8kProjOptConfigList(projClass));
}
public void addIdCardInfo(Class<?> projClass) {
a8kProjIdCardDBService.addIdCard(FakeProjInfoFactory.buildIDCardInfo(projClass));
}
public void resetProjDB() {
a8kProjInfoDBService.removeAll();
a8kProjOptConfigDBService.removeAll();
}
public void resetProjIDCardDB() {
a8kProjIdCardDBService.removeAll();
}
public Boolean isVirtualDeviceEnable() {
return virtualDevice.isEnable();
}
public TubeHolderScanResult createScanResult(A8kTubeHolderType type, Integer tubeNum) {
TubeHolderScanResult scanResult = new TubeHolderScanResult();
scanResult.tubeHolderType = type.scanCode;
for (int i = 0; i < scanResult.tube.length; i++) {
if (i < tubeNum)
scanResult.tube[i] = new TubesScanResult(true, true, "");
else
scanResult.tube[i] = new TubesScanResult(false, false, "");
}
return scanResult;
}
public void insertVirtualBloodTubeHolder(TubeHolderScanResult scanResult) {
virtualDevice.setTubeScanResult(scanResult);
}
public void initConsumablesScanResultTable() {
for (int i = 0; i < virtualDevice.getConsumablesScanResultTable().length; i++) {
virtualDevice.getConsumablesScanResultTable()[i] = new ConsumableOneChResult(i);
}
}
public void insertVirtualConsumable(int ch, String lotId) {
ConsumableOneChResult consumable = new ConsumableOneChResult(ch);
consumable.larBSScanResult = lotId;
consumable.littBSScanResult = lotId;
consumable.PBScanResult = ReactionPlate2DCodeHelper.build2DCode(lotId);
virtualDevice.getConsumablesScanResultTable()[consumable.chNum] = consumable;
}
public ConsumableOneChResult buildConsumable(int ch, String lotId) {
ConsumableOneChResult consumable = new ConsumableOneChResult(ch);
consumable.larBSScanResult = lotId;
consumable.littBSScanResult = lotId;
consumable.PBScanResult = ReactionPlate2DCodeHelper.build2DCode(lotId);
return consumable;
}
public void insertVirtualConsumable(ConsumableOneChResult consumable) {
virtualDevice.getConsumablesScanResultTable()[consumable.chNum] = consumable;
}
public void removeVirtualConsumable(int ch) {
ConsumableOneChResult consumable = new ConsumableOneChResult(ch);
virtualDevice.getConsumablesScanResultTable()[consumable.chNum] = consumable;
}
public TubeHolderSetting createOneActiveTubeHolderSetting(A8kTubeHolderType type, Integer tubeNum, List<Integer> projIndex) {
TubeHolderSetting setting = new TubeHolderSetting();
setting.tubeHolderType = type;
setting.active = true;
for (int i = 0; i < setting.tubeSettings.length; i++) {
if (i < tubeNum) {
setting.tubeSettings[i].userid = "FAUID" + i;
setting.tubeSettings[i].projIndex = projIndex;
}
}
return setting;
}
}

272
src/main/java/a8k/service/test/VirtualDeviceSimulationTest.java

@ -0,0 +1,272 @@
package a8k.service.test;
import a8k.SpringBootBeanUtil;
import a8k.extapi_controler.utils.ExtApiFn;
import a8k.extapi_controler.utils.ExtApiTab;
import a8k.hardware.type.a8kcanprotocol.A8kEcode;
import a8k.hardware.type.a8kcanprotocol.CmdId;
import a8k.hardware.type.a8kcanprotocol.MId;
import a8k.service.app.appctrl.AppTubeSettingMgrService;
import a8k.service.app.appctrl.mainflowctrl.base.A8kActionStepType;
import a8k.service.app.appctrl.mainflowctrl.base.A8kErrorContext;
import a8k.service.app.appstate.GStateService;
import a8k.service.bases.AppEventBusService;
import a8k.service.bases.appevent.*;
import a8k.service.db.ReactionRecordDBService;
import a8k.service.db.type.A8kIdCardInfo;
import a8k.service.db.type.ReactionResultRecord;
import a8k.service.test.fakeproj.*;
import a8k.service.test.state.TestModeState;
import a8k.service.test.state.VirtualDevice;
import a8k.type.ConsumableOneChResult;
import a8k.type.TubeHolderScanResult;
import a8k.type.ecode.AppCodeError;
import a8k.type.ecode.AppError;
import a8k.type.ecode.ConsumeNotEnoughError;
import a8k.type.ecode.HardwareError;
import a8k.type.reaction_result_type.ReactionResultStatus;
import a8k.type.tube_setting.TubeHolderSetting;
import a8k.type.type.A8kTubeHolderType;
import a8k.type.type.BloodType;
import a8k.utils.A8kPacketBuilder;
import a8k.utils.ReactionPlate2DCodeHelper;
import a8k.utils.ZDateUtils;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
@ExtApiTab(cfg = a8k.extapi_controler.pagecontrol.ExtApiTabConfig.VirtualDeviceSimulationTest)
public class VirtualDeviceSimulationTest {
@Resource
VirtualDevice virtualDevice;
@Resource
GStateService gstate;
@Resource
AppEventBusService eventBus;
@Resource
TestStateMgrService testStateMgrService;
@Resource
AppTubeSettingMgrService appTubeSettingMgrService;
@ExtApiFn(name = "初始化虚拟设备模式", group = "基础", order = 100)
public void initVirtualDeviceMode() {
virtualDevice.setEnableVirtualDevice(true);
testStateMgrService.resetProjDB();
testStateMgrService.resetProjIDCardDB();
testStateMgrService.initConsumablesScanResultTable();
}
@ExtApiFn(name = "模拟插入一张虚拟ID卡", group = "虚拟操作", order = 200)
public void insertVirtualIdCard() {
A8kIdCardInfo idCardInfo = new FAKE_PROJ_01().buildA8kIDCardInfo();
virtualDevice.setMountIdCard(idCardInfo);
eventBus.pushEvent(new A8kHardwareReport(A8kPacketBuilder.build_event_a8000_idcard_online()));
}
@ExtApiFn(name = "模拟移除虚拟ID卡", group = "虚拟操作", order = 201)
public void removeVirtualIdCard() {
virtualDevice.setMountIdCard(null);
eventBus.pushEvent(new A8kHardwareReport(A8kPacketBuilder.build_event_a8000_idcard_offline()));
}
@ExtApiFn(name = "A8K试管架.放一个全血试管架", group = "虚拟操作", order = 202)
public void insertVirtualBloodTubeHolder() {
var scanResult = testStateMgrService.createScanResult(A8kTubeHolderType.BloodTube, 10);
testStateMgrService.insertVirtualBloodTubeHolder(scanResult);
}
@ExtApiFn(name = "添加一组全血试管架配置(辅助调试)", group = "虚拟操作", order = 203)
public TubeHolderSetting addTubeCfg() {
appTubeSettingMgrService.removeAllTubeSetting();
TubeHolderSetting setting = testStateMgrService.createOneActiveTubeHolderSetting(A8kTubeHolderType.BloodTube, 10, List.of(new FAKE_PROJ_01().projIndex));
appTubeSettingMgrService.newTubeHolderSetting(setting);
return setting;
}
@ExtApiFn(name = "插入虚拟耗材", group = "虚拟操作", order = 250)
public void insertVirtualConsumable() {
testStateMgrService.addProjInfo(FAKE_PROJ_01.class);
testStateMgrService.addProjInfo(FAKE_PROJ_02.class);
testStateMgrService.addProjInfo(FAKE_PROJ_03.class);
testStateMgrService.addProjInfo(FAKE_PROJ_04.class);
testStateMgrService.addProjInfo(FAKE_PROJ_05.class);
testStateMgrService.addProjInfo(FAKE_PROJ_06.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_01.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_02.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_03.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_04.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_05.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_06.class);
testStateMgrService.insertVirtualConsumable(0, new FAKE_PROJ_01().lotId);
testStateMgrService.insertVirtualConsumable(1, new FAKE_PROJ_02().lotId);
testStateMgrService.insertVirtualConsumable(2, new FAKE_PROJ_03().lotId);
testStateMgrService.insertVirtualConsumable(3, new FAKE_PROJ_04().lotId);
testStateMgrService.insertVirtualConsumable(4, new FAKE_PROJ_05().lotId);
testStateMgrService.insertVirtualConsumable(5, new FAKE_PROJ_06().lotId);
}
@ExtApiFn(name = "插入错误的虚拟耗材-1", group = "虚拟操作", order = 251)
public void insertVirtualErrorConsumable1() {
testStateMgrService.resetProjIDCardDB();
testStateMgrService.resetProjDB();
ConsumableOneChResult oneChResult;
//缺少ID卡
testStateMgrService.addProjInfo(FAKE_PROJ_01.class);
testStateMgrService.insertVirtualConsumable(0, new FAKE_PROJ_01().lotId);
//缺少耗材
testStateMgrService.addProjInfo(FAKE_PROJ_02.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_02.class);
oneChResult = testStateMgrService.buildConsumable(1, new FAKE_PROJ_02().lotId);
oneChResult.littBSScanResult = "";
oneChResult.larBSScanResult = "";
testStateMgrService.insertVirtualConsumable(oneChResult);
//
testStateMgrService.insertVirtualConsumable(2, null);
//缺少耗材
testStateMgrService.addProjInfo(FAKE_PROJ_03.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_03.class);
oneChResult = testStateMgrService.buildConsumable(3, new FAKE_PROJ_03().lotId);
oneChResult.littBSScanResult = "";
oneChResult.larBSScanResult = "";
testStateMgrService.insertVirtualConsumable(oneChResult);
//反应板编码格式错误
testStateMgrService.addProjInfo(FAKE_PROJ_04.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_04.class);
oneChResult = testStateMgrService.buildConsumable(4, new FAKE_PROJ_04().lotId);
oneChResult.PBScanResult = "XXXXX";
oneChResult.littBSScanResult = "";
oneChResult.larBSScanResult = "";
testStateMgrService.insertVirtualConsumable(oneChResult);
//过期的ID卡
testStateMgrService.addProjInfo(FAKE_PROJ_07_EXPIRED.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_07_EXPIRED.class);
testStateMgrService.insertVirtualConsumable(5, new FAKE_PROJ_07_EXPIRED().lotId);
}
@ExtApiFn(name = "插入错误的虚拟耗材-2", group = "虚拟操作", order = 252)
public void insertVirtualErrorConsumabl2() {
testStateMgrService.resetProjIDCardDB();
testStateMgrService.resetProjDB();
ConsumableOneChResult oneChResult;
//缺少项目
testStateMgrService.addIdCardInfo(FAKE_PROJ_01.class);
testStateMgrService.insertVirtualConsumable(0, new FAKE_PROJ_01().lotId);
//缺少耗材
testStateMgrService.addProjInfo(FAKE_PROJ_02.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_02.class);
oneChResult = testStateMgrService.buildConsumable(1, new FAKE_PROJ_02().lotId);
oneChResult.littBSScanResult = "XXXX";
oneChResult.larBSScanResult = "XXXX";
testStateMgrService.insertVirtualConsumable(oneChResult);
//缺少耗材
testStateMgrService.addProjInfo(FAKE_PROJ_03.class);
testStateMgrService.addIdCardInfo(FAKE_PROJ_03.class);
oneChResult = testStateMgrService.buildConsumable(2, new FAKE_PROJ_03().lotId);
oneChResult.littBSScanResult = "XXXX";
oneChResult.larBSScanResult = "XXXX";
testStateMgrService.insertVirtualConsumable(oneChResult);
testStateMgrService.insertVirtualConsumable(3, null);
testStateMgrService.insertVirtualConsumable(4, null);
testStateMgrService.insertVirtualConsumable(5, null);
}
//
@ExtApiFn(name = "移除虚拟耗材", group = "虚拟操作", order = 253)
public void removeVirtualConsumable() {
testStateMgrService.removeVirtualConsumable(0);
testStateMgrService.removeVirtualConsumable(1);
testStateMgrService.removeVirtualConsumable(2);
testStateMgrService.removeVirtualConsumable(3);
testStateMgrService.removeVirtualConsumable(4);
testStateMgrService.removeVirtualConsumable(5);
}
@ExtApiFn(name = "添加一条反应结果记录", group = "虚拟数据", order = 300)
public void addVirtualReactionRecord() {
ReactionRecordDBService service = SpringBootBeanUtil.getBean(ReactionRecordDBService.class);
ReactionResultRecord record = new ReactionResultRecord();
record.sampleBloodType = BloodType.WHOLE_BLOOD;
record.sampleBarcode = "XXXXXXXXXXXXXXX";
record.sampleUserid = "ABCDEFG";
record.projName = "hscrp";
record.lotId = "CAHAC46U";
record.projIndex = 1;
record.sampleId = "20120904_1";
record.expiryDate = ZDateUtils.nextDay();
record.operator = "admin"; // 操作员
record.appVersion = gstate.getAppVersion();//上层应用版本
record.mcuVersion = gstate.getMcuVersion(); // MCU软件版本
record.sn = gstate.getSn(); // 仪器序列号 =;
record.subProjResultStatus1 = ReactionResultStatus.SUCCESS;
record.subProjResultStatus2 = ReactionResultStatus.ERROR_RESULT_OUT_OF_RANGE;
record.subProjResultStatus3 = ReactionResultStatus.ERROR_QUALITY_PEAK_DETECTION;
record.subProjResult1 = "12.3mg/L,12.5g/ml,125mol/L"; //子项目1 结果
record.subProjResult2 = ""; //子项目2 结果
record.subProjResult3 = ""; //子项目3 结果
service.add(record);
}
@ExtApiFn(name = "发送AppWarningNotifyEvent", group = "虚拟事件", order = 401)
public void buildAndSendAppWarningNotifyEvent() {
AppWarningNotifyEvent event = new AppWarningNotifyEvent(A8kEcode.USR_NOT_EXIT);
eventBus.pushEvent(event);
}
@ExtApiFn(name = "A8kErrorPromptEvent", group = "虚拟事件", order = 402)
public void buildAndSendA8kErrorPromptEvent() {
A8kErrorPromptEvent event = new A8kErrorPromptEvent(new ConsumeNotEnoughError("Hscrp"));
eventBus.pushEvent(event);
event = new A8kErrorPromptEvent(new AppCodeError("XXXX额外的错误说明XXXX"));
eventBus.pushEvent(event);
event = new A8kErrorPromptEvent(new HardwareError(A8kEcode.LOW_ERROR_CHECKCODE_IS_ERROR, MId.HbotM, CmdId.step_motor_read_pos));
eventBus.pushEvent(event);
}
@ExtApiFn(name = "发送AppTubeholderSettingUpdateEvent", group = "虚拟事件", order = 403)
public void buildAndSendAppTubeholderSettingUpdateEvent() {
eventBus.pushEvent(new AppTubeholderSettingUpdateEvent());
}
@ExtApiFn(name = "发送DoA8kStepActionEvent", group = "虚拟事件", order = 404)
public void buildAndSendDoA8kStepActionEvent() {
eventBus.pushEvent(new DoA8kStepActionEvent(A8kActionStepType.SEQ1_ENTER_TUBEHOLDER_AND_SCAN));
}
@ExtApiFn(name = "发送A8kEcodeContextListPromptEvent", group = "虚拟事件", order = 405)
public void buildAndSendA8kEcodeContextListPromptEvent() {
List<A8kErrorContext> errorContexts = new ArrayList<>();
errorContexts.add(new A8kErrorContext(A8kActionStepType.SEQ1_ENTER_TUBEHOLDER_AND_SCAN, new AppError(A8kEcode.APPE_TUBE_HOLDER_TYPE_IS_NOT_SUPPORT)));
errorContexts.add(new A8kErrorContext(A8kActionStepType.SEQ5_PROCESS, new AppError(A8kEcode.APPE_NO_TUBE_IN_HOLDER)));
eventBus.pushEvent(new A8kEcodeContextListPromptEvent(errorContexts));
}
}

16
src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_02.java

@ -0,0 +1,16 @@
package a8k.service.test.fakeproj;
import a8k.service.db.type.a8kidcard.zenum.A8kReactionFlowType;
public class FAKE_PROJ_02 extends FakeProjInfo {
public FAKE_PROJ_02() {
super(2);
subProjNum = 2; // 子项目数量
reactionTemperature = 25; // 反应温度
reactionPlateIncubationTimeMin = 1; // 反应板孵育时间(min)
reactionFlowType = A8kReactionFlowType.FlowType2; // 反应流程类型
}
}

16
src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_03.java

@ -0,0 +1,16 @@
package a8k.service.test.fakeproj;
import a8k.service.db.type.a8kidcard.zenum.A8kReactionFlowType;
public class FAKE_PROJ_03 extends FakeProjInfo {
public FAKE_PROJ_03() {
super(3);
subProjNum = 2; // 子项目数量
reactionTemperature = 25; // 反应温度
reactionPlateIncubationTimeMin = 1; // 反应板孵育时间(min)
reactionFlowType = A8kReactionFlowType.FlowType1; // 反应流程类型
}
}

16
src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_04.java

@ -0,0 +1,16 @@
package a8k.service.test.fakeproj;
import a8k.service.db.type.a8kidcard.zenum.A8kReactionFlowType;
public class FAKE_PROJ_04 extends FakeProjInfo {
public FAKE_PROJ_04() {
super(4);
subProjNum = 2; // 子项目数量
reactionTemperature = 25; // 反应温度
reactionPlateIncubationTimeMin = 1; // 反应板孵育时间(min)
reactionFlowType = A8kReactionFlowType.FlowType2; // 反应流程类型
}
}

16
src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_05.java

@ -0,0 +1,16 @@
package a8k.service.test.fakeproj;
import a8k.service.db.type.a8kidcard.zenum.A8kReactionFlowType;
public class FAKE_PROJ_05 extends FakeProjInfo {
public FAKE_PROJ_05() {
super(5);
subProjNum = 2; // 子项目数量
reactionTemperature = 25; // 反应温度
reactionPlateIncubationTimeMin = 1; // 反应板孵育时间(min)
reactionFlowType = A8kReactionFlowType.FlowType2; // 反应流程类型
}
}

16
src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_06.java

@ -0,0 +1,16 @@
package a8k.service.test.fakeproj;
import a8k.service.db.type.a8kidcard.zenum.A8kReactionFlowType;
public class FAKE_PROJ_06 extends FakeProjInfo {
public FAKE_PROJ_06() {
super(6);
subProjNum = 2; // 子项目数量
reactionTemperature = 25; // 反应温度
reactionPlateIncubationTimeMin = 1; // 反应板孵育时间(min)
reactionFlowType = A8kReactionFlowType.FlowType2; // 反应流程类型
}
}

17
src/main/java/a8k/service/test/fakeproj/FAKE_PROJ_07_EXPIRED.java

@ -0,0 +1,17 @@
package a8k.service.test.fakeproj;
import a8k.service.db.type.a8kidcard.zenum.A8kReactionFlowType;
public class FAKE_PROJ_07_EXPIRED extends FakeProjInfo {
public FAKE_PROJ_07_EXPIRED() {
super(7);
subProjNum = 2; // 子项目数量
reactionTemperature = 25; // 反应温度
reactionPlateIncubationTimeMin = 1; // 反应板孵育时间(min)
reactionFlowType = A8kReactionFlowType.FlowType2; // 反应流程类型
expired = true;
}
}

11
src/main/java/a8k/service/test/fakeproj/FakeProjInfo.java

@ -31,6 +31,7 @@ public class FakeProjInfo {
public Integer mixLiquidAspirMixingCnt = 3;
public Integer reactionPlateIncubationTimeMin = 1;
public Integer reactionPlateDropletVolUl = 100;
public Boolean expired = false;
FakeProjInfo(Integer projNum) {
projName = String.format("FA%02d", projNum);
@ -44,9 +45,13 @@ public class FakeProjInfo {
public A8kIdCardInfo buildA8kIDCardInfo() {
A8kIdCardInfo idCardInfo = new A8kIdCardInfo();
idCardInfo.projName = projName;
idCardInfo.lotId = lotId;
idCardInfo.expiryDate = ZDateUtils.nextDay();
idCardInfo.projName = projName;
idCardInfo.lotId = lotId;
if (!expired) {
idCardInfo.expiryDate = ZDateUtils.nextDay();
}else{
idCardInfo.expiryDate = ZDateUtils.theDayBeforeYesterday();
}
idCardInfo.projIndex = projIndex;
idCardInfo.updateChipVersion = updateChipVersion;
idCardInfo.subProjNum = subProjNum;

2
src/main/java/a8k/service/test/state/TestStateMgrService.java → src/main/java/a8k/service/test/state/TestModeState.java

@ -6,7 +6,7 @@ import org.springframework.stereotype.Component;
@Component
@Data
public class TestStateMgrService {
public class TestModeState {
@Resource
VirtualDevice virtualDevice;

46
src/main/java/a8k/service/test/state/VirtualDevice.java

@ -2,31 +2,47 @@ package a8k.service.test.state;
import a8k.OS;
import a8k.service.db.type.A8kIdCardInfo;
import a8k.type.ConsumableOneChResult;
import a8k.type.ConsumableScanRawResult;
import a8k.type.ConsumablesScanResult;
import a8k.type.TubeHolderScanResult;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
@Data
@Slf4j
@Component
public class VirtualDevice {
A8kIdCardInfo mountIdCard;
@Value("${VirtualDevice.enableVirtualDevice:true}")
Boolean enableVirtualDevice;
//
// 挂载的ID卡
//
TubeHolderScanResult tubeScanResult = null;
A8kIdCardInfo mountIdCard;
public Boolean isMountIdCard() {
return mountIdCard != null;
}
//
// 是否启用虚拟设备
//
@Value("${VirtualDevice.enableVirtualDevice:true}")
Boolean enableVirtualDevice;
public Boolean isEnable() {
return enableVirtualDevice;
}
//
// 虚拟试管架
//
TubeHolderScanResult tubeScanResult = null;
public TubeHolderScanResult takeTubeHolderScanResult() {
var cache = tubeScanResult;
tubeScanResult = null;
@ -41,12 +57,32 @@ public class VirtualDevice {
return tubeScanResult != null;
}
//
// 虚拟试耗材扫描结果
//
ConsumableOneChResult[] consumablesScanResultTable = new ConsumableOneChResult[6];
public ConsumableOneChResult getConsumablesScanResult(Integer ch) {
return consumablesScanResultTable[ch];
}
public ConsumableScanRawResult getConsumablesScanRawResult() {
var ret = new ConsumableScanRawResult();
ret.ch = consumablesScanResultTable;
return ret;
}
//
// Action
//
public void doVirtualThings(String msg) {
doVirtualThings(msg, 1);
}
public void doVirtualThings(String msg, Integer time) {
log.info("doSomeThings: {}", msg);
OS.forceSleep(1000);
OS.forceSleep(3000);
}
}

6
src/main/java/a8k/type/ConsumableScanRawResult.java

@ -1,5 +1,7 @@
package a8k.type;
import a8k.utils.ZJsonHelper;
public class ConsumableScanRawResult {
public ConsumableOneChResult[] ch = new ConsumableOneChResult[6];
@ -8,4 +10,8 @@ public class ConsumableScanRawResult {
ch[i] = new ConsumableOneChResult(i);
}
}
public String toString(){
return ZJsonHelper.objectToJson(this);
}
}

2
src/main/java/a8k/type/consumables/ConsumablesErrorType.java

@ -13,6 +13,8 @@ public enum ConsumablesErrorType {
LITTSB_LOTID_MISMATCH,//小缓冲液批号不匹配
LARBS_LOTID_MISMATCH,//大缓冲液批号不匹配
REACTION_PLATE_2D_CODE_FORMATE_ERROR,//反应板二维码格式错误
CODE_ERROR_PROJINFO_IS_ERROR,//代码错误项目信息异常
UN_SUPPORT_PROJ,//不支持的项目
}

4
src/main/java/a8k/utils/ReactionPlate2DCodeHelper.java

@ -12,7 +12,7 @@ public class ReactionPlate2DCodeHelper {
String[] parts = code.split("\\|\\|");
ReactionPlate2DCode ret = new ReactionPlate2DCode();
if (parts.length != 5) {
throw new AppException(A8kEcode.APPE_A8K_PLATE_2D_CODE_FORMAT_ERROR);
return null;
}
ret.projIndex = Integer.parseInt(parts[0]);
ret.lotId = parts[1];
@ -21,7 +21,7 @@ public class ReactionPlate2DCodeHelper {
try {
ret.expDate = sdf.parse(parts[2]);
} catch (ParseException e) {
throw new AppException(A8kEcode.APPE_A8K_PLATE_2D_CODE_FORMAT_ERROR);
return null;
}
ret.ID0 = Integer.parseInt(parts[3]);
ret.ID1 = Integer.parseInt(parts[4]);

6
src/main/java/a8k/utils/ZAppChecker.java

@ -1,7 +1,7 @@
package a8k.utils;
import a8k.hardware.type.a8kcanprotocol.A8kEcode;
import a8k.service.test.state.TestStateMgrService;
import a8k.service.test.state.TestModeState;
import a8k.type.exception.AppException;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
@ -14,12 +14,12 @@ public class ZAppChecker {
AppExceptionBuilder ebuilder;
@Resource
TestStateMgrService testStateMgrService;
TestModeState testModeState;
public void checkTakeTip(Boolean takeTipOk) throws AppException {
if (!takeTipOk) {
if (testStateMgrService.getNoCheckMode()) {
if (testModeState.getNoCheckMode()) {
log.warn("take tip fail, but in no check mode, ignore it");
return;
}

4
src/main/java/a8k/utils/ZDateUtils.java

@ -11,6 +11,10 @@ public class ZDateUtils {
return addOneDay(new Date());
}
public static Date theDayBeforeYesterday() {
return new Date(System.currentTimeMillis() - 48 * 60 * 60 * 1000);
}
public static Integer getTimestamp() {
return (int) (System.currentTimeMillis() / 1000);
}

4
src/main/java/a8k/utils/ZStringUtils.java

@ -43,4 +43,8 @@ public class ZStringUtils {
}
return sb.toString();
}
public static Boolean isNullOrEmpty(String str) {
return str == null || str.isEmpty();
}
}
Loading…
Cancel
Save