From d4ec1afdd6327c907bf72af9c088664244afc641 Mon Sep 17 00:00:00 2001 From: sige Date: Thu, 21 Mar 2024 17:53:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../my/graphiteDigesterBg/task/TaskStartReset.java | 38 ++++++++++++++-------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/src/main/java/com/my/graphiteDigesterBg/task/TaskStartReset.java b/src/src/main/java/com/my/graphiteDigesterBg/task/TaskStartReset.java index 353a8e1..8619457 100644 --- a/src/src/main/java/com/my/graphiteDigesterBg/task/TaskStartReset.java +++ b/src/src/main/java/com/my/graphiteDigesterBg/task/TaskStartReset.java @@ -15,6 +15,9 @@ import com.my.graphiteDigesterBg.move.MoveMoveTubeRackFromLiquidPlateToHeatPlate import com.my.graphiteDigesterBg.resource.ResHeatingTubeRackSlotManager; @Task(name="StartReset") public class TaskStartReset extends DiTaskBase { + // 是否需要放置异常处理试管架 + private Boolean isErrorTubeRackRequired = true; + @Override protected void execute() { MdbOperationLog.log(this.getUser(), "设备初始化"); @@ -65,14 +68,7 @@ public class TaskStartReset extends DiTaskBase { heatPlateMotor.reset(); heatPlateMotor.moveTo("HeatPlateStandby"); - this.clearTubeRack(); - for ( int i=0; i<5; i++ ) { - this.setProgressMessage("设备初始化 : 加热盘转盘槽盖关闭 " + (i+1) + "/5"); - String key = "HeatingPlateMotorSlotCover_" + i; - DiActServo heatSlotCoverServo = this.getActuator(key, DiActServo.class); - heatSlotCoverServo.setEnable(true); - heatSlotCoverServo.setCurrentPosAsMiddle(); - } + this.setupHeatingSlotCover(); int peristalticPumpCount = 1; var actuators = this.getDevice().getActuators().getAll(); @@ -92,10 +88,12 @@ public class TaskStartReset extends DiTaskBase { var slotMan = this.getResourceManager(ResHeatingTubeRackSlotManager.class); slotMan.startTemperatureRefresh(); - this.setProgressMessage("设备初始化 : 放入异常处理试管架"); - doorMotor.reset(); // 打开设备门 - DiMdbNotification.taskAction(this, "TaskStartResetErrorTubeRackPutIn"); - this.waitAction("TaskStartResetErrorTubeRackPutIn"); + if ( this.isErrorTubeRackRequired ) { + this.setProgressMessage("设备初始化 : 放入异常处理试管架"); + doorMotor.reset(); // 打开设备门 + DiMdbNotification.taskAction(this, "TaskStartResetErrorTubeRackPutIn"); + this.waitAction("TaskStartResetErrorTubeRackPutIn"); + } this.setProgressMessage("设备初始化 : 完成"); runtimeVars.setString("YES","IsDeviceReady"); @@ -108,8 +106,9 @@ public class TaskStartReset extends DiTaskBase { * 清理试管架 * @issue : 无法获取加液位置是否存在试管架 */ - private void clearTubeRack() { + private void setupHeatingSlotCover() { boolean isDoorOpen = false; + Integer errorSlotIndex = this.getDevice().getEnv().getProperty("app.errorSlotIndex",Integer.class); for ( int i=0; i<5; i++ ) { this.setProgressMessage("设备初始化 : 检查试管架 " + (i+1) + "/5"); @@ -119,9 +118,17 @@ public class TaskStartReset extends DiTaskBase { var currentPos = heatSlotCoverServo.getCurrentPos(); LOG.info("HeatingPlateMotorSlotCover #{} : current pos = {}", i, currentPos); + // 如果是空的,则初始化位置后继续下一步 var rackExistsPos = heatSlotCoverServo.getLocationValue("HeatingPlateMotorSlotCoverRackExists"); if ( currentPos > rackExistsPos ) { - heatSlotCoverServo.setEnable(false); + heatSlotCoverServo.setCurrentPosAsMiddle(); + continue; + } + + // 如果是空试管架, 又是异常区域则不处理, 因为异常区域始终要有个试管架 + var emptyRackExistsPos = heatSlotCoverServo.getLocationValue("HeatingPlateMotorSlotCoverEmptyRackExists"); + if ( currentPos > emptyRackExistsPos && null != errorSlotIndex && errorSlotIndex == i ) { // 异常区域存在空试管架 + this.isErrorTubeRackRequired = false; continue; } @@ -143,6 +150,9 @@ public class TaskStartReset extends DiTaskBase { DiMdbNotification.taskAction(this, "TaskStartResetErrorTubeRackTakeOut"); this.waitAction("TaskStartResetErrorTubeRackTakeOut"); LOG.info("HeatingPlateMotorSlotCover #{} : take out", i); + + heatSlotCoverServo.setEnable(true); + heatSlotCoverServo.setCurrentPosAsMiddle(); } if ( isDoorOpen ) {