diff --git a/src/main/java/com/iflytop/gd/app/service/crafts/CraftsStepService.java b/src/main/java/com/iflytop/gd/app/service/crafts/CraftsStepService.java index 34e85af..1cfc8cb 100644 --- a/src/main/java/com/iflytop/gd/app/service/crafts/CraftsStepService.java +++ b/src/main/java/com/iflytop/gd/app/service/crafts/CraftsStepService.java @@ -223,7 +223,9 @@ public class CraftsStepService { if (temperature > targetTemperature) { log.info("工艺{},开启风扇降温中", heatModuleCode); - + if (HeatingType.constant.equals(heatModuleState.getHeatingType())) { + heatModuleService.heatRodClose(heatModuleCode); + } heatModuleService.fanStart(heatModuleCode); heatModuleState.setHeatingType(HeatingType.cooling); heatModuleState.setFanOpen(true); @@ -241,6 +243,7 @@ public class CraftsStepService { heatModuleState.setFanOpen(false); log.info("工艺{},开始加热至目标温度", heatModuleCode); heatModuleService.heatRodOpen(heatModuleCode, targetTemperature); + heatModuleState.setHeatingType(HeatingType.constant); heatModuleState.setStartHeatTime(LocalDateTime.now()); } else { if (heatModuleState.isFanOpen()) { diff --git a/src/main/java/com/iflytop/gd/app/service/device/ActionCommandService.java b/src/main/java/com/iflytop/gd/app/service/device/ActionCommandService.java index 9692599..6d683c9 100644 --- a/src/main/java/com/iflytop/gd/app/service/device/ActionCommandService.java +++ b/src/main/java/com/iflytop/gd/app/service/device/ActionCommandService.java @@ -99,10 +99,10 @@ public class ActionCommandService { deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setCapExist(false);//加热模块是否存在拍子 capModuleService.capMotorMoveByNumNoWait(commandId, command, -1);//拍子存放模块下降1个拍子位置 gantryModuleService.gantryZMoveZero(commandId, command);//抬升z轴 - heatModuleService.heaterMotorMoveNoWait(commandId, command, heatModuleCode, trayLower);//下降加热模块 - Thread.sleep(2500); +// heatModuleService.heaterMotorMoveNoWait(commandId, command, heatModuleCode, trayLower);//下降加热模块 +// Thread.sleep(2500); deviceCommandTempUtilService.carryMoveXYToSolutionManyPoints(commandId, command, heatModuleCode, ClawItemType.cap);//携带拍子移动至存放区 - deviceCommandTempUtilService.moveTrayHeatModuleAvoidUpNoWait(commandId, command, heatModuleCode);//移动完毕恢复抬升状态 + deviceCommandTempUtilService.moveTrayHeatModuleAvoidUpNoWait(commandId, command, null);//移动完毕恢复抬升状态 gantryModuleService.gantryZMove(capModuleCapMoveHeight);//下降z轴,使夹拍子落入存放区 gantryModuleService.clawMove(commandId, command, clawCapPick);//将夹爪打开,释放夹取的拍子 gantryModuleService.gantryZMoveZero(commandId, command);//抬升z轴 @@ -123,19 +123,18 @@ public class ActionCommandService { double capModuleCapMoveHeight = devicePositionService.getPosition(DevicePositionCode.capModuleCapMoveHeight).getDistance();//拍子升降模块拍子z轴移动高度 Point3D capStorageCapClawPoint3D = devicePositionService.getPosition(DevicePositionCode.capStorageCapClawPoint).getPoint3D();//获取拍子存放区上方点位; - heatModuleService.heaterMotorMoveNoWait(commandId, command, heatModuleCode, trayLower);//确保目标加热模块是下降状态 +// heatModuleService.heaterMotorMoveNoWait(commandId, command, heatModuleCode, trayLower);//确保目标加热模块是下降状态 gantryModuleService.gantryXYMove(commandId, command, capStorageCapClawPoint3D);//移动机械臂至拍子存放区上方 - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//将加热模块托盘状态改为下降 +// deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//将加热模块托盘状态改为下降 gantryModuleService.clawMove(commandId, command, clawCapPick);//将夹爪打开,准备夹取拍子 gantryModuleService.gantryZMove(capModuleCapMoveHeight);//下降z轴,使夹爪落入拍子升降模块拍子孔位 gantryModuleService.clawMove(commandId, command, clawCapGrip);//将夹爪收紧,夹住拍子 gantryModuleService.gantryZMoveZero(commandId, command);//抬升z轴 deviceCommandTempUtilService.carryMoveXYToHeatManyPoints(commandId, command, heatModuleCode, ClawItemType.cap);//将拍子移动至目标加热模块上方 - capModuleService.capUpBalanceNoWait(commandId, command); //提升拍子存放区 +// capModuleService.capUpBalanceNoWait(commandId, command); //提升拍子存放区 - deviceCommandTempUtilService.moveTrayHeatModuleAvoidUpNoWait(commandId, command, heatModuleCode); - Thread.sleep(3700); + deviceCommandTempUtilService.moveTrayHeatModuleAvoidUpNoWait(commandId, command, null); gantryModuleService.gantryZMove(heatModuleCapMoveHeight);//下降z轴,使夹拍子落入加热模块 gantryModuleService.clawMove(commandId, command, clawCapPick);//将夹爪打开,释放拍子 diff --git a/src/main/java/com/iflytop/gd/app/service/device/DeviceCommandTempUtilService.java b/src/main/java/com/iflytop/gd/app/service/device/DeviceCommandTempUtilService.java index 7c1e965..1b383af 100644 --- a/src/main/java/com/iflytop/gd/app/service/device/DeviceCommandTempUtilService.java +++ b/src/main/java/com/iflytop/gd/app/service/device/DeviceCommandTempUtilService.java @@ -5,7 +5,6 @@ import com.iflytop.gd.app.model.bo.status.device.HeatModuleState; import com.iflytop.gd.app.service.api.DevicePositionService; import com.iflytop.gd.app.service.device.module.GantryModuleService; import com.iflytop.gd.app.service.device.module.HeatModuleService; -import com.iflytop.gd.app.service.device.module.SolutionModuleService; import com.iflytop.gd.common.command.CommandFuture; import com.iflytop.gd.common.command.DeviceCommandBundle; import com.iflytop.gd.common.command.DeviceCommandGenerator; @@ -56,6 +55,7 @@ public class DeviceCommandTempUtilService { Point3D heatArea3TrayClawPoint3D = heatModuleService.getHeatAreaTrayClawPoint3D(HeatModuleCode.heat_module_03); Point3D heatArea4TrayClawPoint3D = heatModuleService.getHeatAreaTrayClawPoint3D(HeatModuleCode.heat_module_04); + Point3D heatArea2CapClawPoint3D = heatModuleService.getHeatAreaCapClawPointPoint3D(HeatModuleCode.heat_module_02); Point3D heatArea3CapClawPoint3D = heatModuleService.getHeatAreaCapClawPointPoint3D(HeatModuleCode.heat_module_03); Point3D[] points = new Point3D[]{}; @@ -148,7 +148,7 @@ public class DeviceCommandTempUtilService { } else if (HeatModuleCode.heat_module_05.equals(targetHeatModuleCode)) { if (ClawItemType.cap.equals(clawItemType)) {//移动拍子 //路线 存放区 - points = new Point3D[]{capStorageCapClawPoint3D}; + points = new Point3D[]{heatArea2CapClawPoint3D, capStorageCapClawPoint3D}; //不避让的模块 moveTrayHeatModuleAvoidDown(commandId, command, null, HeatModuleCode.heat_module_03, @@ -175,14 +175,14 @@ public class DeviceCommandTempUtilService { HeatModuleCode.heat_module_05, HeatModuleCode.heat_module_06); } else if (ClawItemType.tray.equals(clawItemType)) {//移动托盘 - if(deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_05).getTrayStatus() == 1){ + if (deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_05).getTrayStatus() == 1) { //路线 3、1、4、加液 points = new Point3D[]{heatArea3TrayClawPoint3D, heatArea1TrayClawPoint3D, heatArea4TrayClawPoint3D, liquidAreaTrayPoint3D}; //不避让的模块 moveTrayHeatModuleAvoidDown(commandId, command, null, HeatModuleCode.heat_module_05, HeatModuleCode.heat_module_06); - }else{ + } else { //路线 加液 points = new Point3D[]{liquidAreaTrayPoint3D}; //不避让的模块 @@ -313,11 +313,12 @@ public class DeviceCommandTempUtilService { } } else if (HeatModuleCode.heat_module_05.equals(targetHeatModuleCode)) { if (ClawItemType.cap.equals(clawItemType)) {//移动拍子 - //路线 5 - points = new Point3D[]{heatArea5CapClawPoint3D}; + //路线 2、5 + points = new Point3D[]{heatArea2CapClawPoint3D, heatArea5CapClawPoint3D}; //不避让的模块 moveTrayHeatModuleAvoidDown(commandId, command, null, HeatModuleCode.heat_module_03, + HeatModuleCode.heat_module_04, HeatModuleCode.heat_module_05, HeatModuleCode.heat_module_06); } else if (ClawItemType.tray.equals(clawItemType)) {//移动托盘 @@ -341,15 +342,15 @@ public class DeviceCommandTempUtilService { HeatModuleCode.heat_module_05, HeatModuleCode.heat_module_06); } else if (ClawItemType.tray.equals(clawItemType)) {//移动托盘 - if(deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_05).getTrayStatus() == 1 - || deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_05).getTrayUp() == 1){ + if (deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_05).getTrayStatus() == 1 + || deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_05).getTrayUp() == 1) { //路线 4、1、3、6 points = new Point3D[]{heatArea4TrayClawPoint3D, heatArea1TrayClawPoint3D, heatArea3TrayClawPoint3D, heatArea6TrayClawPoint3D}; //不避让的模块 moveTrayHeatModuleAvoidDown(commandId, command, null, HeatModuleCode.heat_module_05, HeatModuleCode.heat_module_06); - }else{ + } else { //路线 6 points = new Point3D[]{heatArea6TrayClawPoint3D}; //不避让的模块 diff --git a/src/main/java/com/iflytop/gd/app/service/device/DeviceInitService.java b/src/main/java/com/iflytop/gd/app/service/device/DeviceInitService.java index 7c13e2f..5e9c516 100644 --- a/src/main/java/com/iflytop/gd/app/service/device/DeviceInitService.java +++ b/src/main/java/com/iflytop/gd/app/service/device/DeviceInitService.java @@ -1,6 +1,5 @@ package com.iflytop.gd.app.service.device; -import ch.qos.logback.core.joran.conditional.ThenAction; import cn.hutool.json.JSONUtil; import com.iflytop.gd.app.model.bo.DeviceInitializationData; import com.iflytop.gd.app.model.bo.status.device.DeviceState; @@ -10,6 +9,7 @@ import com.iflytop.gd.app.model.entity.Container; import com.iflytop.gd.app.model.entity.DeviceParamConfig; import com.iflytop.gd.app.service.api.ContainerService; import com.iflytop.gd.app.service.api.DeviceParamConfigService; +import com.iflytop.gd.app.service.device.module.HeatModuleService; import com.iflytop.gd.common.enums.ContainerCode; import com.iflytop.gd.common.enums.ContainerType; import com.iflytop.gd.common.enums.HeatModuleCode; @@ -60,6 +60,7 @@ public class DeviceInitService { private final ObjectProvider heatModuleStateProvider; private final ObjectProvider solutionContainerStateProvider; private final AppEventBusService eventBus; + private final HeatModuleService heatModuleService; private boolean isLink = false; @PostConstruct @@ -79,6 +80,7 @@ public class DeviceInitService { initDeviceSetData(); initOvertime(); initEnable(); + initOther(); try { tricolorLightDriver.open(MId.TriColorLight, TricolorLightDriver.Color.GREEN); } catch (HardwareException e) { @@ -150,7 +152,7 @@ public class DeviceInitService { } public void initDeviceSetData() throws Exception { - while (!isLink){ + while (!isLink) { Thread.sleep(100); } if (deviceStateService.getDeviceState().isVirtual() || deviceStateService.getDeviceState().isInitComplete()) { @@ -199,4 +201,25 @@ public class DeviceInitService { } log.info("初始化 initDeviceState完毕"); } + + public void initOther() { + log.info("初始化 initOther"); + for (HeatModuleCode heatModuleCode : HeatModuleCode.values()) { + CompletableFuture.runAsync(() -> { + try { + heatModuleService.heatRodClose(heatModuleCode); + } catch (Exception e) { + log.info("初始化 initOther 关闭加热错误:{}", heatModuleCode); + } + }); + CompletableFuture.runAsync(() -> { + try { + heatModuleService.vacuumValveClose(heatModuleCode); + } catch (Exception e) { + log.info("初始化 initOther 关闭真空泵阀门错误:{}", heatModuleCode); + } + }); + } + log.info("初始化initOther完毕"); + } }