feat:CRM接口bug修复
This commit is contained in:
@@ -58,6 +58,13 @@ public class VehicleTwoController {
|
|||||||
return new ResponseEntity<>(vehicleTwoService.returnIn(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(vehicleTwoService.returnIn(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/productionIn")
|
||||||
|
@Log("生产入库")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> productionIn(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(vehicleTwoService.returnIn(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/reback")
|
@PostMapping("/reback")
|
||||||
@Log("返检、改切入库")
|
@Log("返检、改切入库")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package org.nl.modules.logging.aspect;
|
package org.nl.modules.logging.aspect;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.Around;
|
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.entity.SysApiLog;
|
||||||
import org.nl.system.service.sysapi.service.ISysApiLogService;
|
import org.nl.system.service.sysapi.service.ISysApiLogService;
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
@@ -54,7 +54,8 @@ public class ApiLogAspect {
|
|||||||
logEntity.setBizDesc(apiLog.bizDesc());
|
logEntity.setBizDesc(apiLog.bizDesc());
|
||||||
logEntity.setTraceId(MDC.get("traceId"));
|
logEntity.setTraceId(MDC.get("traceId"));
|
||||||
logEntity.setCreateTime(DateUtil.now());
|
logEntity.setCreateTime(DateUtil.now());
|
||||||
|
Object result = null;
|
||||||
|
Throwable businessException = null;
|
||||||
try {
|
try {
|
||||||
if (attributes != null) {
|
if (attributes != null) {
|
||||||
HttpServletRequest request = attributes.getRequest();
|
HttpServletRequest request = attributes.getRequest();
|
||||||
@@ -63,51 +64,77 @@ public class ApiLogAspect {
|
|||||||
logEntity.setRequestIp(getIpAddress(request));
|
logEntity.setRequestIp(getIpAddress(request));
|
||||||
logEntity.setRequestHeaders(JSONUtil.toJsonStr(getRequestHeaders(request)));
|
logEntity.setRequestHeaders(JSONUtil.toJsonStr(getRequestHeaders(request)));
|
||||||
}
|
}
|
||||||
|
|
||||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
Method method = signature.getMethod();
|
Method method = signature.getMethod();
|
||||||
Object[] args = joinPoint.getArgs();
|
Object[] args = joinPoint.getArgs();
|
||||||
logEntity.setRequestParams(buildRequestParams(method, args));
|
logEntity.setRequestParams(buildRequestParams(method, args));
|
||||||
|
result = joinPoint.proceed();
|
||||||
Object result = joinPoint.proceed();
|
try {
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(JSONUtil.toJsonStr(result));
|
||||||
JSONObject jsonObject = JSONObject.parseObject(JSONUtil.toJsonStr(result));
|
if(null != jsonObject && jsonObject.containsKey("status")){
|
||||||
JSONObject jsonObject1 = jsonObject.getJSONObject("body");
|
String status = jsonObject.getString("status");
|
||||||
if(null == jsonObject1){
|
if ("E".equalsIgnoreCase(status)) {
|
||||||
logEntity.setResponseStatus(400);
|
logEntity.setResponseStatus(400);
|
||||||
logEntity.setStatus("FAIL");
|
logEntity.setStatus("FAIL");
|
||||||
logEntity.setErrorMsg("返回信息为空,请确认!");
|
logEntity.setErrorMsg(JSONUtil.toJsonStr(result));
|
||||||
logEntity.setResponseBody("返回信息为空,请确认!");
|
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
||||||
}else{
|
} else {
|
||||||
String rtype = jsonObject1.getString("RTYPE");
|
logEntity.setResponseStatus(200);
|
||||||
if(rtype.equalsIgnoreCase("E")){
|
logEntity.setStatus("SUCCESS");
|
||||||
logEntity.setResponseStatus(400);
|
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
||||||
logEntity.setStatus("FAIL");
|
}
|
||||||
logEntity.setErrorMsg(JSONUtil.toJsonStr(result));
|
|
||||||
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
|
||||||
}else{
|
}else{
|
||||||
logEntity.setResponseStatus(200);
|
JSONObject jsonObject1 = jsonObject != null ? jsonObject.getJSONObject("body") : null;
|
||||||
logEntity.setStatus("SUCCESS");
|
if (jsonObject1 == null) {
|
||||||
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
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) {
|
} 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;
|
long costTime = System.currentTimeMillis() - startTime;
|
||||||
logEntity.setCostTime(costTime);
|
logEntity.setCostTime(costTime);
|
||||||
logEntity.setStatus("FAIL");
|
try {
|
||||||
logEntity.setErrorMsg(throwable.getMessage());
|
apiLogService.saveAsync(logEntity);
|
||||||
|
} catch (Exception e) {
|
||||||
throw throwable;
|
log.error("保存API日志失败,但不影响主业务", e);
|
||||||
|
}
|
||||||
} finally {
|
if (businessException != null) {
|
||||||
apiLogService.saveAsync(logEntity);
|
throw businessException;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getIpAddress(HttpServletRequest request) {
|
private String getIpAddress(HttpServletRequest request) {
|
||||||
|
|||||||
@@ -1534,7 +1534,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
|||||||
|
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(jsonBox)) {
|
if (ObjectUtil.isEmpty(jsonBox)) {
|
||||||
throw new BadRequestException("此木箱不在库内:" + PackageBoxSN);
|
throw new BadRequestException("此木箱不在库内:" + PackageBoxSN +"请检查是否已被出入库分配锁定");
|
||||||
}
|
}
|
||||||
storSet.add(jsonBox.getStor_code());
|
storSet.add(jsonBox.getStor_code());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
}
|
}
|
||||||
result.put("TYPE", "S");
|
result.put("TYPE", "S");
|
||||||
result.put("MESSAGE", msg);
|
result.put("MESSAGE", msg);
|
||||||
|
result.put("RTYPE", "S");
|
||||||
|
result.put("RTMSG", msg);
|
||||||
log.info("getMaterialInfo的输出参数为:------------------------" + result.toString());
|
log.info("getMaterialInfo的输出参数为:------------------------" + result.toString());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -223,7 +225,9 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result.put("TYPE", "S");
|
result.put("TYPE", "S");
|
||||||
|
result.put("RTYPE", "S");
|
||||||
result.put("MESSAGE", msg);
|
result.put("MESSAGE", msg);
|
||||||
|
result.put("RTMSG", msg);
|
||||||
log.info("getReCutInfo的输出参数为:------------------------" + result.toString());
|
log.info("getReCutInfo的输出参数为:------------------------" + result.toString());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -261,6 +265,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
}
|
}
|
||||||
result.put("TYPE", "S");
|
result.put("TYPE", "S");
|
||||||
result.put("MESSAGE", "推送成功!");
|
result.put("MESSAGE", "推送成功!");
|
||||||
|
result.put("RTYPE", "E");
|
||||||
|
result.put("RTMSG", "推送成功!");
|
||||||
log.info("getMaterialInfo的输出参数为:------------------------" + result.toString());
|
log.info("getMaterialInfo的输出参数为:------------------------" + result.toString());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -327,6 +333,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
}
|
}
|
||||||
result.put("TYPE", "S");
|
result.put("TYPE", "S");
|
||||||
result.put("MESSAGE", "物料同步成功!");
|
result.put("MESSAGE", "物料同步成功!");
|
||||||
|
result.put("RTYPE", "S");
|
||||||
|
result.put("RTMSG", "物料同步成功!");
|
||||||
log.info("getMaterialInfo的输出参数为:------------------------" + result.toString());
|
log.info("getMaterialInfo的输出参数为:------------------------" + result.toString());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
IF 输入.flag = "1"
|
IF 输入.flag = "1"
|
||||||
QUERY
|
QUERY
|
||||||
SELECT
|
SELECT
|
||||||
|
distinct
|
||||||
sub.product_name AS material_code,
|
sub.product_name AS material_code,
|
||||||
sub.product_description AS material_name,
|
sub.product_description AS material_name,
|
||||||
sub.sap_pcsn AS pcsn,
|
sub.sap_pcsn AS pcsn,
|
||||||
@@ -72,24 +73,27 @@
|
|||||||
stor.ext_id AS warehouse_code,
|
stor.ext_id AS warehouse_code,
|
||||||
sub.date_of_production AS dateofproduction,
|
sub.date_of_production AS dateofproduction,
|
||||||
sub.container_name,
|
sub.container_name,
|
||||||
|
mmm.english_name,
|
||||||
CONCAT(sub.un_plan_product_property1,sub.un_plan_product_property2,sub.un_plan_product_property3) AS unplanproductproperty
|
CONCAT(sub.un_plan_product_property1,sub.un_plan_product_property2,sub.un_plan_product_property3) AS unplanproductproperty
|
||||||
FROM
|
FROM
|
||||||
pdm_bi_subpackagerelation sub
|
pdm_bi_subpackagerelation sub
|
||||||
INNER JOIN st_ivt_structattr sa On sa.storagevehicle_code = sub.package_box_sn
|
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
|
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
|
WHERE
|
||||||
sub.package_box_sn IN (
|
sub.package_box_sn IN (
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
package_box_sn
|
package_box_sn
|
||||||
FROM
|
FROM
|
||||||
pdm_bi_subpackagerelation sub
|
pdm_bi_subpackagerelation sub
|
||||||
|
LEFT JOIN md_me_materialbase mmm on sub.product_name = mmm.material_code
|
||||||
WHERE
|
WHERE
|
||||||
sub.`status` = '2'
|
sub.`status` = '2'
|
||||||
OPTION 输入.material_code <> ""
|
OPTION 输入.material_code <> ""
|
||||||
product_name = 输入.material_code
|
sub.product_name = 输入.material_code
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.material_name <> ""
|
OPTION 输入.material_name <> ""
|
||||||
product_description = 输入.material_name
|
(sub.product_description = 输入.material_name OR mmm.english_name = 输入.material_name)
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.mfgordername <> ""
|
OPTION 输入.mfgordername <> ""
|
||||||
SUBSTRING_INDEX(sale_order_name, "-", 1) IN 输入.mfgordername
|
SUBSTRING_INDEX(sale_order_name, "-", 1) IN 输入.mfgordername
|
||||||
@@ -130,4 +134,4 @@
|
|||||||
ENDOPTION
|
ENDOPTION
|
||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ var config = {
|
|||||||
"mesErrorTitle": "MES Error"
|
"mesErrorTitle": "MES Error"
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
|
"sectType": "Warehouse Area Type",
|
||||||
|
"sectCapacity": "Warehouse Area Capacity",
|
||||||
"charge_against":"charge against",
|
"charge_against":"charge against",
|
||||||
"select_scrap_type":"select scrap type",
|
"select_scrap_type":"select scrap type",
|
||||||
"scrap_type":"scrap type",
|
"scrap_type":"scrap type",
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ var config = {
|
|||||||
"load_text5": "Hanya dapat mengunggah satu file excel!"
|
"load_text5": "Hanya dapat mengunggah satu file excel!"
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
|
"sectType": "Tipe Area Gudang",
|
||||||
|
"sectCapacity": "Kapasitas Area Gudang",
|
||||||
"charge_against":"Penutupan",
|
"charge_against":"Penutupan",
|
||||||
"select_scrap_type":"Silakan pilih jenis pembatalan",
|
"select_scrap_type":"Silakan pilih jenis pembatalan",
|
||||||
"scrap_type":"Jenis pembatalan",
|
"scrap_type":"Jenis pembatalan",
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ var config = {
|
|||||||
"correspondingDeepLocationError": "对应的深货位错误!"
|
"correspondingDeepLocationError": "对应的深货位错误!"
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
|
"sectType": "库区类型",
|
||||||
|
"sectCapacity":"库区容量",
|
||||||
"charge_against":"冲销",
|
"charge_against":"冲销",
|
||||||
"select_scrap_type":"请选择报废类型",
|
"select_scrap_type":"请选择报废类型",
|
||||||
"scrap_type":"报废类型",
|
"scrap_type":"报废类型",
|
||||||
|
|||||||
Reference in New Issue
Block a user