Browse Source

异常工艺数据库只存三个加热区的三条记录每次都覆盖

master
王梦远 2 months ago
parent
commit
46722d8758
  1. 21
      src/main/java/com/iflytop/sgs/app/service/api/CraftsService.java

21
src/main/java/com/iflytop/sgs/app/service/api/CraftsService.java

@ -77,16 +77,6 @@ public class CraftsService extends ServiceImpl<CraftsMapper, Crafts> {
Crafts craft = this.getById(startCraftsDTO.getCraftId());
HeatModuleCode heatModuleCode = startCraftsDTO.getHeatId();
int currentIndex = 0;
CraftMonitor craftMonitor = new CraftMonitor();
if (startCraftsDTO.getCraftMonitorId() != null) {
craftMonitor = craftMonitorService.getById(startCraftsDTO.getCraftMonitorId());
craftMonitor.setModifyParam(startCraftsDTO.getModifyParam());
currentIndex = craftMonitor.getCurrentStepId();
} else {
craftMonitor.setColumns(JSONUtil.toJsonStr(startCraftsDTO.getColumns()));
craftMonitor.setCraftsId(startCraftsDTO.getCraftId());
craftMonitor.setCurrentStepId(currentIndex);
}
if (craft == null) {
throw new AppException(ResultCode.INVALID_PARAMETER);
}
@ -119,6 +109,17 @@ public class CraftsService extends ServiceImpl<CraftsMapper, Crafts> {
log.error("加热模块温度过高");
throw new AppException(ResultCode.HEAT_MODULE_TEMPERATURE_IS_HEIGHT);
}
CraftMonitor craftMonitor = craftMonitorService.getByHeatModule(heatModuleCode);
if (craftMonitor == null) {
craftMonitor = new CraftMonitor();
craftMonitor.setCurrentStepId(currentIndex);
}else{
//currentIndex = craftMonitor.getCurrentStepId(); todo测试后放开
}
craftMonitor.setModifyParam(startCraftsDTO.getModifyParam());
craftMonitor.setColumns(JSONUtil.toJsonStr(startCraftsDTO.getColumns()));
craftMonitor.setCraftsId(startCraftsDTO.getCraftId());
craftMonitor.setCurrentStepId(currentIndex);
craftMonitor.setHeatId(heatModuleCode);
craftMonitorService.saveMonitor(craftMonitor);
log.info("准备开始工艺,加热模块{},工艺{}", heatModuleCode, craft.getName());

Loading…
Cancel
Save