package com.dreamworks.boditech.service; import com.dreamworks.boditech.driver.*; import com.dreamworks.boditech.driver.consumable.*; import com.dreamworks.boditech.driver.entity.*; import com.dreamworks.boditech.driver.task.*; import com.dreamworks.boditech.driver.task.TaskStopReset; import com.dreamworks.boditech.entity.ParamTestEmergencyAppend; import com.dreamworks.boditech.entity.ParamTestRegularAppend; import com.dreamworks.boditech.entity.ParamTestRegularAppendTask; import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import java.util.*; @Service public class DeviceService { @Resource public Device device; @Resource public RuntimeVariableService runtimeVariableService; // tasks private final List tasks = new ArrayList<>(); // task executor private Executor taskExecutor; // task executor thread private Thread taskExecutorThread; /** * load consumable resources */ public void load() { TaskLoad task = new TaskLoad(); Executor.executeTask(this.device, task); } // scan and load test cards public void testCardLoad() { TaskTestCardLoad task = new TaskTestCardLoad(); Executor.executeTask(this.device, task); } // update test cards by box public void testCardUpdateByBox(ParamTestCardUpdateByBox update) { this.device.testCards.testCardUpdateByBox(update); } // update pipette tips public void pipetteTipUpdateByBox(ParamPipetteTipUpdate param) { this.device.pipetteTips.updateByBox(param); } // load large buffer tubes public List largeBufferTubeLoad() { TaskLargeBufferTubeLoad task = new TaskLargeBufferTubeLoad(); Executor.executeTask(this.device, task); return this.device.largeBufferTubes.getAll(); } // update large buffer tubes public void largeBufferTubeUpdate(ParamLargeBufferTubeUpdate param) { this.device.largeBufferTubes.update(param); } // load buffer tubes public void bufferTubeLoad() { TaskBufferTubeLoad task = new TaskBufferTubeLoad(); Executor.executeTask(this.device, task); } // update buffer tubes by box public void bufferTubeUpdateByBox(ParamBufferTubeUpdateByBox param ) { this.device.bufferTubes.updateByBox(param); } // get status public Map status() { Map status = new HashMap<>(); // large buffer tube List largeBufferTubeList = this.device.largeBufferTubes.getAll(); CsmLargeBufferTube[] largeBufferTubes = new CsmLargeBufferTube[6]; for ( int i=0; i(); for (ParamTestRegularAppendTask taskItem : param.tubes) { TaskBatchTubeTestInfo test = new TaskBatchTubeTestInfo(); // test.tubeIndex = taskItem.tubeIndex; // test.patientCode = taskItem.patientCode; // test.barcode = taskItem.barCode; // test.testTube = taskItem.tubeType; // test.projectNames = taskItem.projectNames; // test.blood = taskItem.bloodType; task.tests.add(test); } this.taskAppend(task); } // append task public void taskAppend(Task task) { synchronized (this.tasks) { this.tasks.add(task); this.tasks.notifyAll(); } } }