From 67711c0be90020fa1495d9d543587d142fd6ff5d Mon Sep 17 00:00:00 2001 From: "DESKTOP-5DIJMF9\\admin" <2388969634@qq.com> Date: Fri, 7 Mar 2025 10:14:41 +0800 Subject: [PATCH] =?UTF-8?q?opt:=E4=BC=98=E5=8C=96=E7=A9=BA=E6=8C=87?= =?UTF-8?q?=E9=92=88=E6=8F=90=E7=A4=BA=E5=92=8C=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mps/service/impl/BakingServiceImpl.java | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) 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 c8c115049..09ffa8cf3 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 @@ -142,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; @@ -159,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; @@ -427,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 { @@ -544,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); @@ -553,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;