diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java index 2fe497bf1..50365855b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java @@ -77,7 +77,11 @@ public class BakingServiceImpl implements BakingService { String temperature = whereJson.getString("temperature"); // 温度 String hours = whereJson.getString("hours"); // 时间 String point_code1 = whereJson.getString("point_code"); // 点位 - + //查询该点位是否存在未完成的任务 + JSONObject hasTask = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code1 = '" + point_code1 + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0); + if (hasTask!=null) { + throw new BadRequestException("当前点位"+point_code1+"存在正在执行的任务"+hasTask.getString("task_code")); + } //校验该设备是否启用,且母卷MES是否请求烘烤 //查询该母卷号、设备号对应的生箔工单 JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + container_name + "'").uniqueResult(0); @@ -138,8 +142,12 @@ public class BakingServiceImpl implements BakingService { for (int i = 0; i < hot_rows.size(); i++) { JSONObject hot_row = hot_rows.getJSONObject(i); String point_code = hot_row.getString("point_code"); - String point_temperature = (String) redisUtils.hget(point_code, "temperature"); - if (!ObjectUtil.isEmpty(point_temperature)) { + boolean exists = redisUtils.hHasKey(point_code, "temperature"); + String point_temperature = ""; + if(exists){ + point_temperature = (String) redisUtils.hget(point_code, "temperature"); + } + if (ObjectUtil.isNotEmpty(point_temperature)) { if (point_temperature.equals(temperature)) { jsonHotIvt = hot_row; break; @@ -155,8 +163,12 @@ public class BakingServiceImpl implements BakingService { for (int i = 0; i < hot_rows.size(); i++) { JSONObject hot_row = hot_rows.getJSONObject(i); String point_code = hot_row.getString("point_code"); - String point_temperature = (String) redisUtils.hget(point_code, "temperature"); - if (!ObjectUtil.isEmpty(point_temperature)) { + boolean exists = redisUtils.hHasKey(point_code, "temperature"); + String point_temperature = ""; + if(exists){ + point_temperature = (String) redisUtils.hget(point_code, "temperature"); + } + if (ObjectUtil.isNotEmpty(point_temperature)) { if (point_temperature.equals(temperature)) { jsonHotIvt = hot_row; break; @@ -423,8 +435,15 @@ public class BakingServiceImpl implements BakingService { hotParam.put("task_id", task_id); hotParam.put("start_point_code", point_code1); hotParam.put("end_point_code", cache_jo.getString("point_code")); - String point_temperature = (String) redisUtils.hget(point_code1, "temperature"); + boolean exists = redisUtils.hHasKey(point_code1, "temperature"); + String point_temperature = ""; + if(exists){ + point_temperature = (String) redisUtils.hget(point_code1, "temperature"); + }else{ + throw new BadRequestException("当前操作点位设备:"+point_code1+",无法获取温度,请稍后再试!"); + } hotParam.put("temperature", point_temperature); + if (ObjectUtil.isEmpty(last_hot_mst)) { hotParam.put("oven_time", "480"); } else { @@ -540,6 +559,9 @@ public class BakingServiceImpl implements BakingService { } public JSONObject getJsonObject(String product_area, JSONObject point_code2_jo, String temperature) { + if (ObjectUtil.isEmpty(point_code2_jo)) { + throw new BadRequestException("暂无满足条件的烘箱位置!"); + } JSONObject jsonMap = new JSONObject(); jsonMap.put("flag", "1"); jsonMap.put("product_area", product_area); @@ -549,8 +571,12 @@ public class BakingServiceImpl implements BakingService { for (int i = 0; i < hot_rows.size(); i++) { JSONObject hot_row = hot_rows.getJSONObject(i); String point_code = hot_row.getString("point_code"); - String point_temperature = (String) redisUtils.hget(point_code, "temperature"); - if (!ObjectUtil.isEmpty(point_temperature)) { + boolean exists = redisUtils.hHasKey(point_code, "temperature"); + String point_temperature = ""; + if(exists){ + point_temperature = (String) redisUtils.hget(point_code, "temperature"); + } + if (ObjectUtil.isNotEmpty(point_temperature)) { if (point_temperature.equals(temperature)) { jsonHotIvt = hot_row; break;