From 3eaa4ac83c6a2a93aff0d05c3a93473f92d84446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=87=A4=E5=90=89?= Date: Sat, 21 Jun 2025 16:46:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201=E3=80=81=E8=AE=BE=E5=A4=87=E5=BC=80?= =?UTF-8?q?=E6=9C=BA=E5=90=8E=E4=B8=8D=E5=86=8D=E8=87=AA=E5=8A=A8=E5=8A=A0?= =?UTF-8?q?=E7=83=AD=E3=80=81=E5=85=B3=E9=97=AD=E6=89=80=E6=9C=89=E7=9C=9F?= =?UTF-8?q?=E7=A9=BA=E9=98=80=E9=97=A8=202=E3=80=81=E5=B7=A5=E8=89=BA?= =?UTF-8?q?=E9=99=8D=E6=B8=A9=E7=9A=84=E6=97=B6=E5=80=99=E5=81=9C=E6=AD=A2?= =?UTF-8?q?=E5=8A=A0=E7=83=AD=EF=BC=8C=E6=AD=A3=E7=A1=AE=E8=B5=8B=E4=BA=88?= =?UTF-8?q?=E7=8A=B6=E6=80=81=203=E3=80=81=E5=B7=A5=E8=89=BA=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E6=8B=8D=E5=AD=90=E4=B8=8D=E5=86=8D=E4=B8=8B=E9=99=8D?= =?UTF-8?q?=E6=89=98=E7=9B=98=EF=BC=8C=E4=BD=86=E6=98=AF5=E5=8F=B7?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E8=A6=81=E4=BB=8E2=E5=8F=B7=E4=BD=8D?= =?UTF-8?q?=E7=BB=95=E8=A1=8C=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gd/app/service/crafts/CraftsStepService.java | 5 +++- .../app/service/device/ActionCommandService.java | 15 ++++++------ .../device/DeviceCommandTempUtilService.java | 19 +++++++-------- .../gd/app/service/device/DeviceInitService.java | 27 ++++++++++++++++++++-- 4 files changed, 46 insertions(+), 20 deletions(-) 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完毕"); + } }