From 42fa93d055fbbc475f3467fa64e64c5b307bb232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=87=A4=E5=90=89?= Date: Fri, 13 Jun 2025 15:17:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=B7=A5=E8=89=BA=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=BF=9E=E7=BB=AD=E5=8A=A0=E7=83=AD=EF=BC=8C=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E9=85=8D=E7=BD=AE=E5=86=B7=E5=8D=B4=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=9D=A5=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gd/app/service/crafts/CraftsStepService.java | 79 +++++++++++++--------- 1 file changed, 48 insertions(+), 31 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 736e745..b98f79b 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 @@ -7,6 +7,7 @@ import com.iflytop.gd.app.core.CraftsContext; import com.iflytop.gd.app.core.CraftsDebugGenerator; import com.iflytop.gd.app.model.bo.CraftsStep; import com.iflytop.gd.app.model.bo.Point3D; +import com.iflytop.gd.app.model.bo.status.device.HeatModuleState; import com.iflytop.gd.app.model.bo.status.device.TrayState; import com.iflytop.gd.app.model.bo.status.device.TubeState; import com.iflytop.gd.app.model.entity.Container; @@ -194,67 +195,83 @@ public class CraftsStepService { Integer coolingSecond = params.getInt("coolingSecond"); Double temperature = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature(); + HeatModuleState heatModuleState = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode); + if (temperature > targetTemperature) { log.info("工艺{},开启风扇降温中", heatModuleCode); + heatModuleService.fanStart(heatModuleCode); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.cooling); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setFanOpen(true); + heatModuleState.setHeatingType(HeatingType.cooling); + heatModuleState.setFanOpen(true); + + heatModuleService.heaterMotorMove(heatModuleCode, trayLift);//抬升加热模块托盘 + heatModuleState.setTrayUp(1);//加热模块托盘升降状态 log.info("工艺{},等待降温", heatModuleCode); - while (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature() - 1 > targetTemperature) { + while (heatModuleState.getTemperature() - 1 > targetTemperature) { sleep(1); } heatModuleService.fanClose(heatModuleCode); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setFanOpen(false); + heatModuleState.setFanOpen(false); heatModuleService.heatRodOpen(heatModuleCode, targetTemperature); + heatModuleState.setTemperature(targetTemperature); + heatModuleState.setStartHeatTime(LocalDateTime.now()); } else { - if (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).isFanOpen()) { + if (heatModuleState.isFanOpen()) { heatModuleService.fanClose(heatModuleCode);//工艺加热前,尝试关闭风扇 - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setFanOpen(false); + heatModuleState.setFanOpen(false); } log.info("工艺{},开启加热棒", heatModuleCode); heatModuleService.heatRodOpen(heatModuleCode, targetTemperature); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.warm_up); + heatModuleState.setTemperature(targetTemperature); + heatModuleState.setHeatingType(HeatingType.warm_up); log.info("工艺{},等待升温", heatModuleCode); if (inTemperature != null) { - while (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature() + 1 < inTemperature) { + while (heatModuleState.getTemperature() + 1 < inTemperature) { sleep(1); } log.info("工艺{},温度达到可以放入的温度,下降加热模块托盘", heatModuleCode); heatModuleService.heaterMotorMove(heatModuleCode, trayLower);//下降加热模块托盘 - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//加热模块托盘升降状态 - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(LocalDateTime.now()); + heatModuleState.setTrayUp(0);//加热模块托盘升降状态 } - while (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature() + 1 < targetTemperature) { + heatModuleState.setStartHeatTime(LocalDateTime.now()); + while (heatModuleState.getTemperature() + 1 < targetTemperature) { sleep(1); } } log.info("工艺{},恒温中", heatModuleCode); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.constant); - - log.info("工艺{},温度合适,下降加热模块托盘", heatModuleCode); - heatModuleService.heaterMotorMove(heatModuleCode, trayLower);//下降加热模块托盘 - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//加热模块托盘升降状态 - if (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getStartHeatTime() == null) { - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(LocalDateTime.now()); + heatModuleState.setHeatingType(HeatingType.constant); + if (heatModuleState.getTrayUp() == 1) { + log.info("工艺{},温度合适,但是托盘没有降下,现在降下", heatModuleCode); + heatModuleService.heaterMotorMove(heatModuleCode, trayLower);//下降加热模块托盘 + heatModuleState.setTrayUp(0);//加热模块托盘升降状态 + if (heatModuleState.getStartHeatTime() == null) { + heatModuleState.setStartHeatTime(LocalDateTime.now()); + } } - LocalDateTime startHeatTime = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getStartHeatTime(); + log.info("工艺{},温度合适,开始计时", heatModuleCode); + LocalDateTime startHeatTime = heatModuleState.getStartHeatTime(); LocalDateTime endHeatTime = startHeatTime.plusSeconds(second); while (LocalDateTime.now().isBefore(endHeatTime)) { sleep(1); } - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(null); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(null); + heatModuleState.setStartHeatTime(null); + heatModuleState.setTargetTime(null); log.info("工艺{},加热完成", heatModuleCode); - log.info("工艺{},抬升加热位托盘", heatModuleCode); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(1);//加热模块托盘升降状态 - heatModuleService.heaterMotorMove(heatModuleCode, trayLift);//抬升加热位托盘 - log.info("工艺{},等待冷却", heatModuleCode); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(LocalDateTime.now()); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(coolingSecond); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.trayCooling); - sleep(coolingSecond); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(null); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(null); + if (coolingSecond != null) {//如果需要降温,则关闭加热棒并抬起托盘等待降温 + log.info("工艺{},关闭加热棒", heatModuleCode); + heatModuleService.heatRodClose(heatModuleCode); + log.info("工艺{},抬升加热位托盘", heatModuleCode); + heatModuleState.setTrayUp(1);//加热模块托盘升降状态 + heatModuleService.heaterMotorMove(heatModuleCode, trayLift);//抬升加热位托盘 + log.info("工艺{},等待冷却", heatModuleCode); + heatModuleState.setStartHeatTime(LocalDateTime.now()); + heatModuleState.setTargetTime(coolingSecond); + heatModuleState.setHeatingType(HeatingType.trayCooling); + sleep(coolingSecond); + heatModuleState.setStartHeatTime(null); + heatModuleState.setTargetTime(null); + heatModuleState.setHeatingType(HeatingType.stop); + } return true; }