6 changed files with 170 additions and 2 deletions
-
33src/src/main/java/com/my/graphiteDigesterBg/step/StepChecking.java
-
24src/src/main/java/com/my/graphiteDigesterBg/step/StepExecuteErrorTask.java
-
33src/src/main/java/com/my/graphiteDigesterBg/step/StepMoveErrorTubesToErrorSlot.java
-
5src/src/main/java/com/my/graphiteDigesterBg/task/TaskDigestion.java
-
40src/src/main/java/com/my/graphiteDigesterBg/task/TaskErrorDigestion.java
-
37src/web/src/pages/main/contents/TaskStepManagement.vue
@ -0,0 +1,33 @@ |
|||||
|
package com.my.graphiteDigesterBg.step; |
||||
|
import com.my.graphiteDigesterBg.diframe.*; |
||||
|
import com.my.graphiteDigesterBg.diframe.model.DiMdbNotification; |
||||
|
import com.my.graphiteDigesterBg.resource.ResHeatingTubeRackSlot; |
||||
|
import com.my.graphiteDigesterBg.task.TaskDigestion; |
||||
|
import java.util.LinkedHashMap; |
||||
|
import java.util.List; |
||||
|
@TaskStep(name="Checking") |
||||
|
public class StepChecking extends DiTaskStepBase { |
||||
|
@Override |
||||
|
public void run() { |
||||
|
var task = (TaskDigestion)this.getTask(); |
||||
|
var slot = task.getSlot(); |
||||
|
|
||||
|
if (!ResHeatingTubeRackSlot.LOCATION_LIQUID_PLATE.equals(slot.rackPosition)) { |
||||
|
task.throwException("试管架尚未移至加液区域,无法执行检测操作"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
DiMdbNotification.taskAction(task,"TaskDigestionStepChecking"); |
||||
|
var action = task.waitAction("TaskDigestionStepChecking"); |
||||
|
task.errorTubeIndexes = action.getResult(List.class); |
||||
|
} |
||||
|
|
||||
|
// action done |
||||
|
public void actionDone( LinkedHashMap<String,Object> params ) { |
||||
|
var task = (TaskDigestion)this.getTask(); |
||||
|
var action = task.getAction("TaskDigestionStepChecking"); |
||||
|
|
||||
|
Object tubes = params.get("tubes"); |
||||
|
action.finish(tubes); |
||||
|
} |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.my.graphiteDigesterBg.step; |
||||
|
import com.my.graphiteDigesterBg.diframe.*; |
||||
|
import com.my.graphiteDigesterBg.task.TaskDigestion; |
||||
|
import java.util.Map; |
||||
|
@TaskStep(name="ExecuteErrorTask") |
||||
|
public class StepExecuteErrorTask extends DiTaskStepBase { |
||||
|
// duration in minutes |
||||
|
public Integer errorTaskId; |
||||
|
|
||||
|
@Override |
||||
|
public void run() { |
||||
|
var task = (TaskDigestion)this.getTask(); |
||||
|
DiTaskManager taskManager = task.getDevice().getTaskManager(); |
||||
|
DiTask errorTask = taskManager.generateTask("ErrorDigestion", Map.of( |
||||
|
"id", this.errorTaskId, |
||||
|
"errorTubes", task.errorRackTubeIndexes |
||||
|
)); |
||||
|
errorTask.setUser(task.getUser()); |
||||
|
errorTask.prepare(); |
||||
|
errorTask.init(); |
||||
|
DiTaskExecutor executor = task.getDevice().getTaskManager().getExecutor(); |
||||
|
executor.appendTask(errorTask); |
||||
|
} |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
package com.my.graphiteDigesterBg.step; |
||||
|
import com.my.graphiteDigesterBg.diframe.DiTaskStepBase; |
||||
|
import com.my.graphiteDigesterBg.diframe.TaskStep; |
||||
|
import com.my.graphiteDigesterBg.move.MoveTubeToErrorRackSlot; |
||||
|
import com.my.graphiteDigesterBg.resource.ResHeatingTubeRackSlotManager; |
||||
|
import com.my.graphiteDigesterBg.task.TaskDigestion; |
||||
|
@TaskStep(name="MoveErrorTubesToErrorSlot") |
||||
|
public class StepMoveErrorTubesToErrorSlot extends DiTaskStepBase { |
||||
|
@Override |
||||
|
public void run() { |
||||
|
var task = (TaskDigestion)this.getTask(); |
||||
|
var slot = task.getSlot(); |
||||
|
var errorTubes = task.errorTubeIndexes; |
||||
|
|
||||
|
var slotMan = task.getResourceManager(ResHeatingTubeRackSlotManager.class); |
||||
|
var errorSlot = slotMan.getErrorSlot(); |
||||
|
var emptyTubeIndexList = errorSlot.allocEmptyTubeIndexes(errorTubes.size()); |
||||
|
task.errorRackTubeIndexes = emptyTubeIndexList; |
||||
|
|
||||
|
// move error tubes to error rack |
||||
|
for (int i = 0; i < errorTubes.size(); i++) { |
||||
|
var move = new MoveTubeToErrorRackSlot(); |
||||
|
move.setDevice(task.getDevice()); |
||||
|
move.srcSlotIndex = slot.index; |
||||
|
move.srcTubeIndex = (Integer)errorTubes.get(i); |
||||
|
move.errorTubeIndex = emptyTubeIndexList.get(i); |
||||
|
move.run(); |
||||
|
} |
||||
|
|
||||
|
throw new RuntimeException("无法正常加液"); |
||||
|
// @TODO: 取出收需要标记响应位置为空, 不然后面加液会出错 ~~~ |
||||
|
} |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.my.graphiteDigesterBg.task; |
||||
|
import com.my.graphiteDigesterBg.diframe.DiActiveRecord; |
||||
|
import com.my.graphiteDigesterBg.diframe.DiTaskStepTaskBase; |
||||
|
import com.my.graphiteDigesterBg.diframe.Task; |
||||
|
import com.my.graphiteDigesterBg.model.MdbDigestionTask; |
||||
|
import com.my.graphiteDigesterBg.model.MdbOperationLog; |
||||
|
import com.my.graphiteDigesterBg.resource.ResHeatingTubeRackSlot; |
||||
|
import com.my.graphiteDigesterBg.resource.ResHeatingTubeRackSlotManager; |
||||
|
import java.util.List; |
||||
|
@Task(name="ErrorDigestion") |
||||
|
public class TaskErrorDigestion extends DiTaskStepTaskBase { |
||||
|
// id of error digestion task |
||||
|
public Integer id; |
||||
|
// list of error tubes |
||||
|
public List<Integer> errorTubes; |
||||
|
// taskModel |
||||
|
private MdbDigestionTask taskModel; |
||||
|
|
||||
|
@Override |
||||
|
protected void setup() { |
||||
|
this.taskModel = DiActiveRecord.findOne(MdbDigestionTask.class, this.id); |
||||
|
if ( this.taskModel == null ) { |
||||
|
throw new RuntimeException("task [" + this.id.toString() + "] not found"); |
||||
|
} |
||||
|
this.loadStepsByJson(this.taskModel.steps); |
||||
|
MdbOperationLog.log(this.getUser(), "异常试管架 : 执行预设【%s】", this.taskModel.name); |
||||
|
} |
||||
|
|
||||
|
// throw exception |
||||
|
public void throwException(String message) { |
||||
|
String msg = String.format("[异常试管架 - %s] : %s", this.taskModel.name, message); |
||||
|
throw new RuntimeException(msg); |
||||
|
} |
||||
|
|
||||
|
// get slot |
||||
|
public ResHeatingTubeRackSlot getSlot() { |
||||
|
var slotMan = this.getResourceManager(ResHeatingTubeRackSlotManager.class); |
||||
|
return slotMan.getErrorSlot(); |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue