From 21dae69dd5d84eea633b948b7d7e060ad47c330b Mon Sep 17 00:00:00 2001 From: loujf Date: Sat, 12 Nov 2022 12:17:02 +0800 Subject: [PATCH] =?UTF-8?q?mes=E6=8E=A5=E5=8F=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/MaterialServiceImpl.java | 2 +- .../acs/service/impl/WmsToJnServiceImpl.java | 257 ++++++++++++++---- 2 files changed, 211 insertions(+), 48 deletions(-) diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/database/service/impl/MaterialServiceImpl.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/database/service/impl/MaterialServiceImpl.java index d3738fc..ad14212 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/database/service/impl/MaterialServiceImpl.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/database/service/impl/MaterialServiceImpl.java @@ -157,7 +157,7 @@ public class MaterialServiceImpl implements MaterialService { dto.setVehicle_type("07"); } //将静置时间从小时改为分钟 - dto.setStewing_time(String.valueOf(Integer.valueOf(dto.getStewing_time())*60)); + dto.setStewing_time(String.valueOf(Double.parseDouble(dto.getStewing_time())*60)); WQLObject wo = WQLObject.getWQLObject("md_me_material"); JSONObject materialObj = wo.query("material_code='" + material_code + "' and material_id <>'" + material_uuid + "' and is_delete='0'").uniqueResult(0); if (ObjectUtil.isNotEmpty(materialObj)) { diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToJnServiceImpl.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToJnServiceImpl.java index 218d749..f9f2534 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToJnServiceImpl.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToJnServiceImpl.java @@ -46,9 +46,15 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "WLXT"); log.info("诺力请求同步嘉耐mes物料入参为{}", obj.toString()); - String resultMsg = HttpRequest.post(URL + methon) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); + String resultMsg = null; + try { + resultMsg = HttpRequest.post(URL + methon) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("wms同步嘉耐工单失败!{}",e.getMessage()); + return null; + } JSONObject result = JSONObject.parseObject(resultMsg); log.info("诺力请求同步嘉耐mes物料出参为{}", resultMsg); String status = result.getString("status"); @@ -129,9 +135,15 @@ public class WmsToJnServiceImpl implements WmsToJnService { JSONObject obj = new JSONObject(); obj.put("ticker", "WLXT"); log.info("诺力请求同步嘉耐mes物料入参为{}", obj.toString()); - String resultMsg = HttpRequest.post(URL + methon) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); + String resultMsg = null; + try { + resultMsg = HttpRequest.post(URL + methon) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("wms同步嘉耐物料失败!{}",e.getMessage()); + return null; + } log.info("诺力请求同步嘉耐mes物料出参为{}", resultMsg); JSONObject result = JSONObject.parseObject(resultMsg); @@ -215,9 +227,15 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "WLXT"); obj.put("stringData", JSONObject.toJSON(whereJson).toString()); log.info("诺力请求嘉耐反馈物料同步入参{}", obj.toString()); - String resultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); + String resultMsg = null; + try { + resultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("wms反馈嘉耐物料失败!{}",e.getMessage()); + return null; + } JSONObject result = JSONObject.parseObject(resultMsg); log.info("诺力请求嘉耐反馈物料同步出参{}", resultMsg); //调用接口告诉wms 调用已经同步该物料 @@ -250,16 +268,30 @@ public class WmsToJnServiceImpl implements WmsToJnService { JSONObject obj = new JSONObject(); obj.put("ticker", "WLXT"); obj.put("stringData", param); - log.info("诺力请求嘉耐回传不合格记录入参{}", obj.toString()); - String resultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); + log.info("诺力请求嘉耐反馈设备状态入参{}", obj.toString()); + String resultMsg = null; + try { + resultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("诺力请求嘉耐反馈设备状失败!{}",e.getMessage()); + JSONObject jo = new JSONObject(); + jo.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); + jo.put("method", method); + jo.put("status", "2"); + jo.put("content", obj); + jo.put("create_time", DateUtil.now()); + wo.insert(jo); + + return null; + } JSONObject returnResult = JSONObject.parseObject(resultMsg); String returnStatus = returnResult.getString("status"); if (StrUtil.isNotEmpty(returnStatus) && returnStatus.equals("1")) { - log.info("诺力请求嘉耐回传不合格记录成功!"); + log.info("诺力请求嘉耐反馈设备状成功!"); } else { - log.info("诺力请求嘉耐回传不合格记录失败!"); + log.info("诺力请求嘉耐反馈设备状失败!"); JSONObject jo = new JSONObject(); jo.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); jo.put("method", method); @@ -268,7 +300,7 @@ public class WmsToJnServiceImpl implements WmsToJnService { jo.put("create_time", DateUtil.now()); wo.insert(jo); } - log.info("诺力请求嘉耐回传不合格记录出参{}", resultMsg); + log.info("诺力请求嘉耐反馈设备状出参{}", resultMsg); } JSONObject returnjo = new JSONObject(); returnjo.put("status", HttpStatus.OK.value()); @@ -293,9 +325,23 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "WLXT"); obj.put("stringData", jsonObject.toString()); log.info("诺力请求嘉耐回传搬运记录入参{}", obj.toString()); - String returnResultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); + String returnResultMsg = null; + try { + returnResultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("诺力请求嘉耐回传搬运记录入参失败!{}",e.getMessage()); + JSONObject jo = new JSONObject(); + jo.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); + jo.put("method", method); + jo.put("status", "2"); + jo.put("content", obj); + jo.put("create_time", DateUtil.now()); + wo.insert(jo); + + return null; + } JSONObject returnResult = JSONObject.parseObject(returnResultMsg); String returnStatus = returnResult.getString("status"); if (StrUtil.isNotEmpty(returnStatus) && returnStatus.equals("1")) { @@ -328,9 +374,23 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "WLXT"); obj.put("stringData", jsonObject.toString()); log.info("诺力请求嘉耐回传入窑信息入参{}", obj.toString()); - String returnResultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(jsonObject)).timeout(timeout) - .execute().body(); + String returnResultMsg = null; + try { + returnResultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(jsonObject)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("诺力请求嘉耐回传入窑信息失败!{}",e.getMessage()); + JSONObject jo = new JSONObject(); + jo.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); + jo.put("method", method); + jo.put("status", "2"); + jo.put("content", obj); + jo.put("create_time", DateUtil.now()); + wo.insert(jo); + + return null; + } JSONObject returnResult = JSONObject.parseObject(returnResultMsg); String returnStatus = returnResult.getString("status"); if (StrUtil.isNotEmpty(returnStatus) && returnStatus.equals("1")) { @@ -363,9 +423,23 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "WLXT"); obj.put("stringData", jsonObject.toString()); log.info("诺力请求嘉耐回传出窑信息入参{}", obj.toString()); - String returnResultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(jsonObject)).timeout(timeout) - .execute().body(); + String returnResultMsg = null; + try { + returnResultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(jsonObject)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("诺力请求嘉耐回传出窑信息失败!{}",e.getMessage()); + JSONObject jo = new JSONObject(); + jo.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); + jo.put("method", method); + jo.put("status", "2"); + jo.put("content", obj); + jo.put("create_time", DateUtil.now()); + wo.insert(jo); + + return null; + } JSONObject returnResult = JSONObject.parseObject(returnResultMsg); String returnStatus = returnResult.getString("status"); if (StrUtil.isNotEmpty(returnStatus) && returnStatus.equals("1")) { @@ -404,9 +478,23 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "WLXT"); obj.put("stringData", mstObj.toString()); log.info("诺力请求嘉耐回传组盘记录入参{}", obj.toString()); - String resultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); + String resultMsg = null; + try { + resultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("诺力请求嘉耐回传组盘记录失败!{}",e.getMessage()); + JSONObject jo = new JSONObject(); + jo.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); + jo.put("method", method); + jo.put("status", "2"); + jo.put("content", obj); + jo.put("create_time", DateUtil.now()); + wo.insert(jo); + + return null; + } JSONObject returnResult = JSONObject.parseObject(resultMsg); String returnStatus = returnResult.getString("status"); if (StrUtil.isNotEmpty(returnStatus) && returnStatus.equals("1")) { @@ -443,10 +531,23 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "WLXT"); obj.put("stringData", recordObj.toString()); log.info("诺力请求嘉耐回传不合格记录入参{}", obj.toString()); - String resultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); - JSONObject result = JSONObject.parseObject(resultMsg); + String resultMsg = null; + try { + resultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("诺力请求嘉耐回传组盘记录失败{}",e.getMessage()); + JSONObject jo = new JSONObject(); + jo.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); + jo.put("method", method); + jo.put("status", "2"); + jo.put("content", obj); + jo.put("create_time", DateUtil.now()); + wo.insert(jo); + + return null; + } JSONObject returnResult = JSONObject.parseObject(resultMsg); String returnStatus = returnResult.getString("status"); @@ -481,9 +582,15 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "Sbdm"); obj.put("device_code", device_code); log.info("诺力请求嘉耐当前生产工单入参{}", obj.toString()); - String resultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); + String resultMsg = null; + try { + resultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("诺力请求嘉耐当前生产工单超时{}", e.getMessage()); + return null; + } JSONObject result = JSONObject.parseObject(resultMsg); log.info("诺力请求嘉耐当前生产工单出参{}", resultMsg); String status = result.getString("status"); @@ -511,9 +618,23 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "WLXT"); obj.put("stringData", jsonObject.toString()); log.info("诺力请求嘉耐反馈入冷却缓冲区入参{}", obj.toString()); - String returnResultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); + String returnResultMsg = null; + try { + returnResultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("诺力请求嘉耐反馈入冷却缓冲区失败{}!",e.getMessage()); + JSONObject jo = new JSONObject(); + jo.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); + jo.put("method", method); + jo.put("status", "2"); + jo.put("content", obj); + jo.put("create_time", DateUtil.now()); + wo.insert(jo); + + return null; + } JSONObject returnResult = JSONObject.parseObject(returnResultMsg); String returnStatus = returnResult.getString("status"); if (StrUtil.isNotEmpty(returnStatus) && returnStatus.equals("1")) { @@ -546,9 +667,23 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "WLXT"); obj.put("stringData", jsonObject.toString()); log.info("诺力请求嘉耐反馈出冷却缓冲区入参{}", obj.toString()); - String returnResultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); + String returnResultMsg = null; + try { + returnResultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("诺力请求嘉耐反馈出冷却缓冲区失败!{}",e.getMessage()); + JSONObject jo = new JSONObject(); + jo.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); + jo.put("method", method); + jo.put("status", "2"); + jo.put("content", obj); + jo.put("create_time", DateUtil.now()); + wo.insert(jo); + + return null; + } JSONObject returnResult = JSONObject.parseObject(returnResultMsg); String returnStatus = returnResult.getString("status"); if (StrUtil.isNotEmpty(returnStatus) && returnStatus.equals("1")) { @@ -581,9 +716,23 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "WLXT"); obj.put("stringData", jsonObject.toString()); log.info("诺力请求嘉耐反馈半木托入临时库区入参{}", obj.toString()); - String returnResultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); + String returnResultMsg = null; + try { + returnResultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("诺力请求嘉耐反馈半木托入临时库区失败!{}",e.getMessage()); + JSONObject jo = new JSONObject(); + jo.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); + jo.put("method", method); + jo.put("status", "2"); + jo.put("content", obj); + jo.put("create_time", DateUtil.now()); + wo.insert(jo); + + return null; + } JSONObject returnResult = JSONObject.parseObject(returnResultMsg); String returnStatus = returnResult.getString("status"); if (StrUtil.isNotEmpty(returnStatus) && returnStatus.equals("1")) { @@ -616,9 +765,23 @@ public class WmsToJnServiceImpl implements WmsToJnService { obj.put("ticker", "WLXT"); obj.put("stringData", jsonObject.toString()); log.info("诺力请求嘉耐反馈半木托出临时库区入参{}", obj.toString()); - String returnResultMsg = HttpRequest.post(URL + method) - .body(String.valueOf(obj)).timeout(timeout) - .execute().body(); + String returnResultMsg = null; + try { + returnResultMsg = HttpRequest.post(URL + method) + .body(String.valueOf(obj)).timeout(timeout) + .execute().body(); + } catch (Exception e) { + log.info("诺力请求嘉耐反馈半木托出临时库区失败!{}",e.getMessage()); + JSONObject jo = new JSONObject(); + jo.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); + jo.put("method", method); + jo.put("status", "2"); + jo.put("content", obj); + jo.put("create_time", DateUtil.now()); + wo.insert(jo); + + return null; + } JSONObject returnResult = JSONObject.parseObject(returnResultMsg); String returnStatus = returnResult.getString("status"); if (StrUtil.isNotEmpty(returnStatus) && returnStatus.equals("1")) {