diff --git a/src/main/java/com/iflytop/sgs/app/service/api/CraftsService.java b/src/main/java/com/iflytop/sgs/app/service/api/CraftsService.java index cc11b58..e4dac24 100644 --- a/src/main/java/com/iflytop/sgs/app/service/api/CraftsService.java +++ b/src/main/java/com/iflytop/sgs/app/service/api/CraftsService.java @@ -77,16 +77,6 @@ public class CraftsService extends ServiceImpl { 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 { 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());