|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|