|
|
@ -29,6 +29,7 @@ import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
@ -118,20 +119,26 @@ public class CraftsStepService { |
|
|
|
&& deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTrayStatus() == 1) { |
|
|
|
moveToSolutionModule(heatModuleCode); |
|
|
|
} |
|
|
|
JSONArray addLiquidList = params.getJSONArray("addLiquidList"); |
|
|
|
JSONArray addLiquidList = params.getJSONArray("list"); |
|
|
|
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleCode); |
|
|
|
TubeState[] tubeArray = trayState.getTubes(); |
|
|
|
for (TubeState tubeState : tubeArray) { |
|
|
|
int tubeNum = tubeState.getTubeNum(); |
|
|
|
if (tubeNum > 0) { |
|
|
|
log.info("工艺{},移动加液机械臂到指定试管", heatModuleCode); |
|
|
|
for (int i = 0; i < addLiquidList.size(); i++) { |
|
|
|
JSONObject addLiquidObject = addLiquidList.getJSONObject(i); |
|
|
|
int tubeNum = addLiquidObject.getInt("tubeNum"); |
|
|
|
TubeState tubeState = tubeArray[tubeNum - 1]; |
|
|
|
if (tubeState.isNeedAddSolution()) { |
|
|
|
log.info("工艺{},移动加液机械臂到指定试管({})", heatModuleCode, tubeNum); |
|
|
|
solutionModuleService.dualRobotMovePoint(tubeNum);//移动加液机械臂到指定试管 |
|
|
|
List<CommandFuture> futuresList = new ArrayList<>(); |
|
|
|
for (int i = 0; i < addLiquidList.size(); i++) { |
|
|
|
JSONObject addLiquid = addLiquidList.getJSONObject(i); |
|
|
|
Long containerId = addLiquid.getLong("containerId"); |
|
|
|
for (int j = 0; j < addLiquidList.size(); j++) { |
|
|
|
JSONObject addLiquid = addLiquidList.getJSONObject(j); |
|
|
|
Long solutionId = addLiquid.getLong("solutionId"); |
|
|
|
Double volume = addLiquid.getDouble("volume"); |
|
|
|
Container container = containerService.getById(containerId); |
|
|
|
Double offset = addLiquid.getDouble("offset"); |
|
|
|
if(offset != null){ |
|
|
|
volume += offset; |
|
|
|
} |
|
|
|
Container container = containerService.getContainerBySolutionId(solutionId); |
|
|
|
if (container == null) { |
|
|
|
throw new AppException(ResultCode.CONTAINER_NOT_FOUND);//未找到对应溶液容器 |
|
|
|
} |
|
|
@ -172,10 +179,13 @@ public class CraftsStepService { |
|
|
|
double trayLower = devicePositionService.getPosition(DevicePositionCode.trayLower).getDistance(); //获取托盘升降下降距离位置 |
|
|
|
moveToHeatModule(heatModuleCode); |
|
|
|
|
|
|
|
Double inTemperature = params.getDouble("inTemperature"); |
|
|
|
Double targetTemperature = params.getDouble("temperature"); |
|
|
|
Integer second = params.getInt("second"); |
|
|
|
|
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(second); |
|
|
|
Integer coolingSecond = params.getInt("coolingSecond"); |
|
|
|
Double temperature = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature(); |
|
|
|
|
|
|
|
if (temperature > targetTemperature) { |
|
|
|
log.info("工艺{},开启风扇降温中", heatModuleCode); |
|
|
|
heatModuleService.fanStart(heatModuleCode); |
|
|
@ -191,6 +201,15 @@ public class CraftsStepService { |
|
|
|
heatModuleService.heatRodOpen(heatModuleCode, targetTemperature); |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.warm_up); |
|
|
|
log.info("工艺{},等待升温", heatModuleCode); |
|
|
|
if (inTemperature != null) { |
|
|
|
while (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature() + 10 < inTemperature) { |
|
|
|
delay(1); |
|
|
|
} |
|
|
|
log.info("工艺{},温度达到可以放入的温度,下降加热模块托盘", heatModuleCode); |
|
|
|
heatModuleService.heaterMotorMove(heatModuleCode, trayLower);//下降加热模块托盘 |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//加热模块托盘升降状态 |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(LocalDateTime.now()); |
|
|
|
} |
|
|
|
while (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature() + 1 < targetTemperature) { |
|
|
|
delay(1); |
|
|
|
} |
|
|
@ -201,10 +220,18 @@ public class CraftsStepService { |
|
|
|
log.info("工艺{},温度合适,下降加热模块托盘", heatModuleCode); |
|
|
|
heatModuleService.heaterMotorMove(heatModuleCode, trayLower);//下降加热模块托盘 |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//加热模块托盘升降状态 |
|
|
|
delay(second); |
|
|
|
if (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getStartHeatTime() == null) { |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(LocalDateTime.now()); |
|
|
|
} |
|
|
|
LocalDateTime startHeatTime = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getStartHeatTime(); |
|
|
|
LocalDateTime endHeatTime = startHeatTime.plusSeconds(second); |
|
|
|
while (LocalDateTime.now().isBefore(endHeatTime)) { |
|
|
|
delay(1); |
|
|
|
} |
|
|
|
log.info("工艺{},加热完成", heatModuleCode); |
|
|
|
log.info("工艺{},抬升加热位托盘", heatModuleCode); |
|
|
|
heatModuleService.heaterMotorMove(heatModuleCode, trayLift);//抬升加热位托盘 |
|
|
|
delay(coolingSecond); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
@ -351,13 +378,7 @@ public class CraftsStepService { |
|
|
|
gantryModuleService.gantryMove(heatAreaCapClawPointPoint3D);//将机械臂移动至加热模块拍子上方 |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(1);//将加热模块托盘状态改为抬起 |
|
|
|
log.info("工艺{},抬升指定加热位托盘", heatModuleCode); |
|
|
|
|
|
|
|
double newTrayLift = trayLift; //TODO 临时调整位置 |
|
|
|
if(HeatModuleCode.heat_module_05.equals(heatModuleCode)){ |
|
|
|
newTrayLift = trayLift - 10; |
|
|
|
} |
|
|
|
|
|
|
|
heatModuleService.heaterMotorMove(heatModuleCode, newTrayLift);//抬升指定加热位托盘 |
|
|
|
heatModuleService.heaterMotorMove(heatModuleCode, trayLift);//抬升指定加热位托盘 |
|
|
|
log.info("工艺{},将夹爪打开,准备夹取拍子", heatModuleCode); |
|
|
|
gantryModuleService.clawMove(clawCapPick);//将夹爪打开,准备夹取拍子 |
|
|
|
log.info("工艺{},下降z轴,使夹爪落入加热模块拍子孔位", heatModuleCode); |
|
|
|