From d124027df48201ece25863ef747945dfb58033a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=97=AD=E6=98=8E=5C73939?= <739390650@QQ.COM> Date: Wed, 1 Jul 2026 16:12:27 +0700 Subject: [PATCH] =?UTF-8?q?feat:CRM=E6=8E=A5=E5=8F=A3bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pda/controller/VehicleTwoController.java | 7 ++ .../modules/logging/aspect/ApiLogAspect.java | 101 +++++++++++------- .../mes/service/impl/MesToLmsServiceImpl.java | 2 +- .../sap/service/impl/SapToLmsServiceImpl.java | 8 ++ .../main/java/org/nl/wms/ext/wql/QCRM_001.wql | 10 +- .../src/main/resources/language/i18n/en.js | 2 + .../src/main/resources/language/i18n/id.js | 2 + .../src/main/resources/language/i18n/zh.js | 2 + 8 files changed, 93 insertions(+), 41 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/pda/controller/VehicleTwoController.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/pda/controller/VehicleTwoController.java index 29ba4b6..02af2bf 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/pda/controller/VehicleTwoController.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/pda/controller/VehicleTwoController.java @@ -58,6 +58,13 @@ public class VehicleTwoController { return new ResponseEntity<>(vehicleTwoService.returnIn(whereJson), HttpStatus.OK); } + @PostMapping("/productionIn") + @Log("生产入库") + @SaIgnore + public ResponseEntity productionIn(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(vehicleTwoService.returnIn(whereJson), HttpStatus.OK); + } + @PostMapping("/reback") @Log("返检、改切入库") @SaIgnore diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/logging/aspect/ApiLogAspect.java b/lms/nladmin-system/src/main/java/org/nl/modules/logging/aspect/ApiLogAspect.java index a9d3bf7..a8c8284 100644 --- a/lms/nladmin-system/src/main/java/org/nl/modules/logging/aspect/ApiLogAspect.java +++ b/lms/nladmin-system/src/main/java/org/nl/modules/logging/aspect/ApiLogAspect.java @@ -1,7 +1,8 @@ package org.nl.modules.logging.aspect; import cn.hutool.core.date.DateUtil; -import cn.hutool.json.JSONUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson2.JSONObject; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -12,7 +13,6 @@ import org.nl.modules.logging.annotation.ApiLog; import org.nl.system.service.sysapi.entity.SysApiLog; import org.nl.system.service.sysapi.service.ISysApiLogService; import org.slf4j.MDC; -import com.alibaba.fastjson2.JSONObject; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -54,7 +54,8 @@ public class ApiLogAspect { logEntity.setBizDesc(apiLog.bizDesc()); logEntity.setTraceId(MDC.get("traceId")); logEntity.setCreateTime(DateUtil.now()); - + Object result = null; + Throwable businessException = null; try { if (attributes != null) { HttpServletRequest request = attributes.getRequest(); @@ -63,51 +64,77 @@ public class ApiLogAspect { logEntity.setRequestIp(getIpAddress(request)); logEntity.setRequestHeaders(JSONUtil.toJsonStr(getRequestHeaders(request))); } - MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); Object[] args = joinPoint.getArgs(); logEntity.setRequestParams(buildRequestParams(method, args)); - - Object result = joinPoint.proceed(); - - JSONObject jsonObject = JSONObject.parseObject(JSONUtil.toJsonStr(result)); - JSONObject jsonObject1 = jsonObject.getJSONObject("body"); - if(null == jsonObject1){ - logEntity.setResponseStatus(400); - logEntity.setStatus("FAIL"); - logEntity.setErrorMsg("返回信息为空,请确认!"); - logEntity.setResponseBody("返回信息为空,请确认!"); - }else{ - String rtype = jsonObject1.getString("RTYPE"); - if(rtype.equalsIgnoreCase("E")){ - logEntity.setResponseStatus(400); - logEntity.setStatus("FAIL"); - logEntity.setErrorMsg(JSONUtil.toJsonStr(result)); - logEntity.setResponseBody(JSONUtil.toJsonStr(result)); + result = joinPoint.proceed(); + try { + JSONObject jsonObject = JSONObject.parseObject(JSONUtil.toJsonStr(result)); + if(null != jsonObject && jsonObject.containsKey("status")){ + String status = jsonObject.getString("status"); + if ("E".equalsIgnoreCase(status)) { + logEntity.setResponseStatus(400); + logEntity.setStatus("FAIL"); + logEntity.setErrorMsg(JSONUtil.toJsonStr(result)); + logEntity.setResponseBody(JSONUtil.toJsonStr(result)); + } else { + logEntity.setResponseStatus(200); + logEntity.setStatus("SUCCESS"); + logEntity.setResponseBody(JSONUtil.toJsonStr(result)); + } }else{ - logEntity.setResponseStatus(200); - logEntity.setStatus("SUCCESS"); - logEntity.setResponseBody(JSONUtil.toJsonStr(result)); + JSONObject jsonObject1 = jsonObject != null ? jsonObject.getJSONObject("body") : null; + if (jsonObject1 == null) { + logEntity.setResponseStatus(400); + logEntity.setStatus("FAIL"); + logEntity.setErrorMsg("返回信息为空,请确认!"); + logEntity.setResponseBody(JSONUtil.toJsonStr(result)); + } else { + String key = ""; + if (jsonObject1.containsKey("RTYPE")) { + key = "RTYPE"; + } else if (jsonObject1.containsKey("TYPE")) { + key = "TYPE"; + } + String rtype = StrUtil.isNotBlank(key) ? jsonObject1.getString(key) : null; + if ("E".equalsIgnoreCase(rtype)) { + logEntity.setResponseStatus(400); + logEntity.setStatus("FAIL"); + logEntity.setErrorMsg(JSONUtil.toJsonStr(result)); + logEntity.setResponseBody(JSONUtil.toJsonStr(result)); + } else { + logEntity.setResponseStatus(200); + logEntity.setStatus("SUCCESS"); + logEntity.setResponseBody(JSONUtil.toJsonStr(result)); + } + } } + } catch (Exception e) { + log.error("解析响应结果失败,记录原始响应", e); + logEntity.setResponseStatus(200); + logEntity.setStatus("SUCCESS"); + logEntity.setResponseBody(JSONUtil.toJsonStr(result)); } - - long costTime = System.currentTimeMillis() - startTime; - logEntity.setCostTime(costTime); - - return result; - } catch (Throwable throwable) { + businessException = throwable; + logEntity.setStatus("FAIL"); + String errorMsg = throwable.getMessage(); + logEntity.setErrorMsg(errorMsg != null && errorMsg.length() > 2000 ? + errorMsg.substring(0, 2000) : errorMsg); + } finally { long costTime = System.currentTimeMillis() - startTime; logEntity.setCostTime(costTime); - logEntity.setStatus("FAIL"); - logEntity.setErrorMsg(throwable.getMessage()); - - throw throwable; - - } finally { - apiLogService.saveAsync(logEntity); + try { + apiLogService.saveAsync(logEntity); + } catch (Exception e) { + log.error("保存API日志失败,但不影响主业务", e); + } + if (businessException != null) { + throw businessException; + } } + return result; } private String getIpAddress(HttpServletRequest request) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java index 787b62c..c005c01 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java @@ -1534,7 +1534,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { if (ObjectUtil.isEmpty(jsonBox)) { - throw new BadRequestException("此木箱不在库内:" + PackageBoxSN); + throw new BadRequestException("此木箱不在库内:" + PackageBoxSN +"请检查是否已被出入库分配锁定"); } storSet.add(jsonBox.getStor_code()); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java index 59b320a..d6d2ed6 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java @@ -125,6 +125,8 @@ public class SapToLmsServiceImpl implements SapToLmsService { } result.put("TYPE", "S"); result.put("MESSAGE", msg); + result.put("RTYPE", "S"); + result.put("RTMSG", msg); log.info("getMaterialInfo的输出参数为:------------------------" + result.toString()); return result; } @@ -223,7 +225,9 @@ public class SapToLmsServiceImpl implements SapToLmsService { return result; } result.put("TYPE", "S"); + result.put("RTYPE", "S"); result.put("MESSAGE", msg); + result.put("RTMSG", msg); log.info("getReCutInfo的输出参数为:------------------------" + result.toString()); return result; } @@ -261,6 +265,8 @@ public class SapToLmsServiceImpl implements SapToLmsService { } result.put("TYPE", "S"); result.put("MESSAGE", "推送成功!"); + result.put("RTYPE", "E"); + result.put("RTMSG", "推送成功!"); log.info("getMaterialInfo的输出参数为:------------------------" + result.toString()); return result; } @@ -327,6 +333,8 @@ public class SapToLmsServiceImpl implements SapToLmsService { } result.put("TYPE", "S"); result.put("MESSAGE", "物料同步成功!"); + result.put("RTYPE", "S"); + result.put("RTMSG", "物料同步成功!"); log.info("getMaterialInfo的输出参数为:------------------------" + result.toString()); return result; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/wql/QCRM_001.wql b/lms/nladmin-system/src/main/java/org/nl/wms/ext/wql/QCRM_001.wql index fe564d0..d0457bc 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/wql/QCRM_001.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/wql/QCRM_001.wql @@ -55,6 +55,7 @@ IF 输入.flag = "1" QUERY SELECT + distinct sub.product_name AS material_code, sub.product_description AS material_name, sub.sap_pcsn AS pcsn, @@ -72,24 +73,27 @@ stor.ext_id AS warehouse_code, sub.date_of_production AS dateofproduction, sub.container_name, + mmm.english_name, CONCAT(sub.un_plan_product_property1,sub.un_plan_product_property2,sub.un_plan_product_property3) AS unplanproductproperty FROM pdm_bi_subpackagerelation sub INNER JOIN st_ivt_structattr sa On sa.storagevehicle_code = sub.package_box_sn INNER JOIN st_ivt_bsrealstorattr stor ON stor.stor_id = sa.stor_id + LEFT JOIN md_me_materialbase mmm on sub.product_name = mmm.material_code WHERE sub.package_box_sn IN ( SELECT DISTINCT package_box_sn FROM pdm_bi_subpackagerelation sub + LEFT JOIN md_me_materialbase mmm on sub.product_name = mmm.material_code WHERE sub.`status` = '2' OPTION 输入.material_code <> "" - product_name = 输入.material_code + sub.product_name = 输入.material_code ENDOPTION OPTION 输入.material_name <> "" - product_description = 输入.material_name + (sub.product_description = 输入.material_name OR mmm.english_name = 输入.material_name) ENDOPTION OPTION 输入.mfgordername <> "" SUBSTRING_INDEX(sale_order_name, "-", 1) IN 输入.mfgordername @@ -130,4 +134,4 @@ ENDOPTION ENDSELECT ENDQUERY - ENDIF \ No newline at end of file + ENDIF diff --git a/lms/nladmin-system/src/main/resources/language/i18n/en.js b/lms/nladmin-system/src/main/resources/language/i18n/en.js index f9fce16..d89bf42 100644 --- a/lms/nladmin-system/src/main/resources/language/i18n/en.js +++ b/lms/nladmin-system/src/main/resources/language/i18n/en.js @@ -49,6 +49,8 @@ var config = { "mesErrorTitle": "MES Error" }, "common": { + "sectType": "Warehouse Area Type", + "sectCapacity": "Warehouse Area Capacity", "charge_against":"charge against", "select_scrap_type":"select scrap type", "scrap_type":"scrap type", diff --git a/lms/nladmin-system/src/main/resources/language/i18n/id.js b/lms/nladmin-system/src/main/resources/language/i18n/id.js index 781fc98..349bf82 100644 --- a/lms/nladmin-system/src/main/resources/language/i18n/id.js +++ b/lms/nladmin-system/src/main/resources/language/i18n/id.js @@ -48,6 +48,8 @@ var config = { "load_text5": "Hanya dapat mengunggah satu file excel!" }, "common": { + "sectType": "Tipe Area Gudang", + "sectCapacity": "Kapasitas Area Gudang", "charge_against":"Penutupan", "select_scrap_type":"Silakan pilih jenis pembatalan", "scrap_type":"Jenis pembatalan", diff --git a/lms/nladmin-system/src/main/resources/language/i18n/zh.js b/lms/nladmin-system/src/main/resources/language/i18n/zh.js index 944b103..c7a842f 100644 --- a/lms/nladmin-system/src/main/resources/language/i18n/zh.js +++ b/lms/nladmin-system/src/main/resources/language/i18n/zh.js @@ -93,6 +93,8 @@ var config = { "correspondingDeepLocationError": "对应的深货位错误!" }, "common": { + "sectType": "库区类型", + "sectCapacity":"库区容量", "charge_against":"冲销", "select_scrap_type":"请选择报废类型", "scrap_type":"报废类型",