sige 1 year ago
parent
commit
77c376acfb
  1. 57
      src/src/main/java/com/my/graphiteDigesterBg/step/StepMoveToLiquidPlate.java

57
src/src/main/java/com/my/graphiteDigesterBg/step/StepMoveToLiquidPlate.java

@ -0,0 +1,57 @@
package com.my.graphiteDigesterBg.step;
import com.my.graphiteDigesterBg.diframe.DiTask;
import com.my.graphiteDigesterBg.diframe.DiTaskStepBase;
import com.my.graphiteDigesterBg.diframe.TaskStep;
import com.my.graphiteDigesterBg.move.MoveMoveTubeRackFromHeatPlateToLiquidPlate;
import com.my.graphiteDigesterBg.resource.ResHeatingTubeRackSlot;
import com.my.graphiteDigesterBg.resource.ResHeatingTubeRackSlotManager;
import com.my.graphiteDigesterBg.task.TaskDigestion;
import java.util.Timer;
import java.util.TimerTask;
@TaskStep(name="MoveToLiquidPlate")
public class StepMoveToLiquidPlate extends DiTaskStepBase {
@Override
public void run() {
TaskDigestion task = (TaskDigestion)this.getTask();
var slot = task.getSlot();
// 如果试管架在加液板位置则不需要移动
if (ResHeatingTubeRackSlot.LOCATION_LIQUID_PLATE.equals(slot.rackPosition)) {
return;
}
var isReady = this.waitForLiquidPlate();
if ( !isReady ) {
return;
}
// 移动试管架至加热板位置
slot.setRackPosition(ResHeatingTubeRackSlot.LOCATION_LIQUID_PLATE);
var move = new MoveMoveTubeRackFromHeatPlateToLiquidPlate();
move.setDevice(task.getDevice());
move.slotIndex = slot.index;
move.run();
}
// 等待加液板位置空闲
private Boolean waitForLiquidPlate() {
TaskDigestion task = (TaskDigestion)this.getTask();
var slotMan = task.getResourceManager(ResHeatingTubeRackSlotManager.class);
if ( null == slotMan.getSlotAtLiquidPlate() ) {
return true;
}
LOG.info("等待加液板位置空闲 ...");
task.setStatus(DiTask.TaskStatus.STEP_WAITING);
var timerTask = new TimerTask() {
@Override
public void run() {
task.setStatus(DiTask.TaskStatus.READY);
}
};
var timer = new Timer();
timer.schedule(timerTask, 1000);
return false;
}
}
Loading…
Cancel
Save