|
@ -1,6 +1,7 @@ |
|
|
package com.iflytop.gd.app.service.scheduled; |
|
|
package com.iflytop.gd.app.service.scheduled; |
|
|
|
|
|
|
|
|
import com.iflytop.gd.app.model.bo.status.device.HeatModuleState; |
|
|
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.vo.HeatCountdownVO; |
|
|
import com.iflytop.gd.app.model.vo.HeatCountdownVO; |
|
|
import com.iflytop.gd.app.service.api.DevicePositionService; |
|
|
import com.iflytop.gd.app.service.api.DevicePositionService; |
|
|
import com.iflytop.gd.app.service.device.DeviceStateService; |
|
|
import com.iflytop.gd.app.service.device.DeviceStateService; |
|
@ -21,7 +22,7 @@ import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 加热倒计时 |
|
|
|
|
|
|
|
|
* 加热时间到自动抬起 |
|
|
*/ |
|
|
*/ |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
@ -36,8 +37,12 @@ public class HeatCountdownScheduledTask { |
|
|
public void fetchTemperature() { |
|
|
public void fetchTemperature() { |
|
|
try { |
|
|
try { |
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
List<HeatCountdownVO> heatCountdownVOList = new ArrayList<>(); |
|
|
|
|
|
for (HeatModuleState heatModuleState : deviceStateService.getDeviceState().getHeatModule()) { |
|
|
for (HeatModuleState heatModuleState : deviceStateService.getDeviceState().getHeatModule()) { |
|
|
|
|
|
//工艺除外 |
|
|
|
|
|
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleState.getModuleCode()); |
|
|
|
|
|
if (trayState != null && trayState.getCrafts() != null) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
if (heatModuleState.getHeatingType() == HeatingType.thermostatic) {//如果这个加热模块在加热中 |
|
|
if (heatModuleState.getHeatingType() == HeatingType.thermostatic) {//如果这个加热模块在加热中 |
|
|
if (heatModuleState.getTemperature() + 1 > heatModuleState.getHeatTemperature()) {//当前温度达到目标温度,允许有1度以内的误差 |
|
|
if (heatModuleState.getTemperature() + 1 > heatModuleState.getHeatTemperature()) {//当前温度达到目标温度,允许有1度以内的误差 |
|
|
heatModuleState.setStartHeatTime(now); |
|
|
heatModuleState.setStartHeatTime(now); |
|
@ -55,34 +60,15 @@ public class HeatCountdownScheduledTask { |
|
|
//关闭加棒 |
|
|
//关闭加棒 |
|
|
heatModuleService.heatRodClose(heatModuleState.getModuleCode()); |
|
|
heatModuleService.heatRodClose(heatModuleState.getModuleCode()); |
|
|
//还原状态 |
|
|
//还原状态 |
|
|
// heatModuleState.setStartHeatTime(null); |
|
|
|
|
|
// heatModuleState.setTargetTime(null); |
|
|
|
|
|
// heatModuleState.setWarmUpTemperature(null); |
|
|
|
|
|
// heatModuleState.setHeatTemperature(null); |
|
|
|
|
|
// heatModuleState.setTargetTemperature(null); |
|
|
|
|
|
|
|
|
heatModuleState.setStartHeatTime(null);//开始加热时间 |
|
|
|
|
|
heatModuleState.setTargetTime(null);//加热器目标加热时间 |
|
|
|
|
|
heatModuleState.setWarmUpTemperature(null);//加热器预热温度 |
|
|
|
|
|
heatModuleState.setHeatTemperature(null);//加热器加热温度 |
|
|
|
|
|
heatModuleState.setTargetTemperature(null);//加热器目标温度 |
|
|
heatModuleState.setHeatingType(HeatingType.finish); |
|
|
heatModuleState.setHeatingType(HeatingType.finish); |
|
|
|
|
|
|
|
|
// HeatCountdownVO heatCountdownVO = new HeatCountdownVO(); |
|
|
|
|
|
// heatCountdownVO.setHeatModuleCode(heatModuleState.getModuleCode()); |
|
|
|
|
|
// heatCountdownVO.setCountdown((int) diffSeconds); |
|
|
|
|
|
// heatCountdownVO.setCountdownStr("加热完毕"); |
|
|
|
|
|
// heatCountdownVO.setStartTime(heatModuleState.getStartHeatTime()); |
|
|
|
|
|
// heatCountdownVO.setEndTime(endTime); |
|
|
|
|
|
// heatCountdownVOList.add(heatCountdownVO); |
|
|
|
|
|
} else {//加热中 推送倒计时 |
|
|
|
|
|
// HeatCountdownVO heatCountdownVO = new HeatCountdownVO(); |
|
|
|
|
|
// heatCountdownVO.setHeatModuleCode(heatModuleState.getModuleCode()); |
|
|
|
|
|
// heatCountdownVO.setCountdown((int) diffSeconds); |
|
|
|
|
|
// heatCountdownVO.setCountdownStr(LocalDateTimeUtil.formatSecondsToHMS(diffSeconds)); |
|
|
|
|
|
// heatCountdownVO.setStartTime(heatModuleState.getStartHeatTime()); |
|
|
|
|
|
// heatCountdownVO.setEndTime(endTime); |
|
|
|
|
|
// heatCountdownVOList.add(heatCountdownVO); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (!heatCountdownVOList.isEmpty()) { |
|
|
|
|
|
webSocketSender.pushHeatCountdown(heatCountdownVOList); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("加热倒计时错误", e); |
|
|
log.error("加热倒计时错误", e); |
|
|
} |
|
|
} |
|
|