diff --git a/src/main/java/com/dreamworks/boditech/driver/task/TaskTestTubeRackPrepare.java b/src/main/java/com/dreamworks/boditech/driver/task/TaskTestTubeRackPrepare.java index 7578d8f..0f32e42 100644 --- a/src/main/java/com/dreamworks/boditech/driver/task/TaskTestTubeRackPrepare.java +++ b/src/main/java/com/dreamworks/boditech/driver/task/TaskTestTubeRackPrepare.java @@ -62,6 +62,7 @@ public class TaskTestTubeRackPrepare extends TaskBase { this.testTubeRackFeed(); // 02. 检查试管有无 + boolean hasTestTube = false; this.testTubeExistsStatus = new boolean[10]; int tubeDistance = this.device.getLocationByName("testTubeRackTubeDistance"); int existsCheckStartPos = this.device.getLocationByName("testTubeRackExistsCheckStart"); @@ -69,6 +70,14 @@ public class TaskTestTubeRackPrepare extends TaskBase { this.testTubeMoveMotor.moveTo(existsCheckStartPos + i * tubeDistance); Integer isExists = this.testTubeMovement.readIO(ActModuleTestTubeRackMovement.IO_TEST_TUBE_EXISTS); this.testTubeExistsStatus[i] = Objects.equals(this.device.getIOValueByName("testTubeRackTubeExistsYes"), isExists); + hasTestTube = hasTestTube || this.testTubeExistsStatus[i]; + } + if ( !hasTestTube ) { + this.testService.regularTaskCancel(this.mdbTask); + this.appendTestTasksToExecutor(executor); + TaskBatchTubeExit exitTask = new TaskBatchTubeExit(); + executor.appendTask(exitTask); + return ; } // 03. 试管架类型检测 @@ -168,7 +177,7 @@ public class TaskTestTubeRackPrepare extends TaskBase { // 试管架类型检测 private MdbTestTube testTubeRackTypeDetect() { - if ( !this.mdbTask.tubeType.isEmpty() ) { + if ( !this.mdbTask.tubeType.isEmpty() ) { // @TODO : 这里不对,还是需要对全血试管架进行检查的 ~~~ return this.testService.testTubeFindByKey(this.mdbTask.tubeType); } @@ -180,7 +189,20 @@ public class TaskTestTubeRackPrepare extends TaskBase { ActMotor testTubeCapClipMotor = (ActMotor)device.getActuator(ActuatorModule.TEST_TUBE_SHAKING_CAP_CLIP_MOTOR); ActMotor testTubeShakeMoveMotor = (ActMotor)device.getActuator(ActuatorModule.TEST_TUBE_SHAKING_MOVE_MOTOR); - this.testTubeMoveMotor.moveTo("testTubeRackTubeSamplingStart"); + // 移动到一个试管的位置 + int firstTubeIndex = -1; + for (int i = 0; i<10; i++ ) { + if ( this.testTubeExistsStatus[i] ) { + firstTubeIndex = i; + break ; + } + } + Integer samplingStartPos = device.getLocationByName("testTubeRackTubeSamplingStart"); + Integer samplingDistance = device.getLocationByName("testTubeRackTubeSamplingDistance"); + int firstTubePos = samplingStartPos + samplingDistance * firstTubeIndex; + this.testTubeMoveMotor.moveTo(firstTubePos); + + // 检查高低试管 testTubeCapClipMotor.moveTo("shakeTestTubeCapClipOpen"); testTubeShakeMoveMotor.moveTo("shakeTestTubeMoveCapClip"); testTubeCapClipMotor.moveTo("shakeTestTubeCapClipClose");