refactor(log): 统一API日志记录实现并优化MES服务日志

- 在MES服务中统一使用OutboundApiLogger进行API
- 为所有MES接口方法添加开始时间戳用于性能监控
- 标准化所有API接口的日志记录格式和异常处理机制
This commit is contained in:
yangyufu
2026-06-12 10:01:17 +08:00
committed by zhouz
parent a814c82387
commit 73ec6042d5
4 changed files with 106 additions and 58 deletions

View File

@@ -23,7 +23,6 @@ public class CrmToLmsController {
private final CrmToLmsService crmToLmsService;
@PostMapping("/getCustomerInfo")
// @Log("CRM给LMS推送客户信息")
@ApiLog(
bizCode = "/crm/getCustomerInfo",
bizDesc = "CRM给LMS推送客户信息",
@@ -35,7 +34,6 @@ public class CrmToLmsController {
}
@PostMapping("/getCPIvtInfo")
// @Log("CRM获取LMS成品库存信息")
@ApiLog(
bizCode = "/crm/getCPIvtInfo",
bizDesc = "CRM获取LMS成品库存信息",

View File

@@ -24,7 +24,6 @@ public class MesToLmsController {
private final MesToLmsService mesToLmsService;
@PostMapping("/momRollFoilStart")
// @Log("母卷批次创建信息发送智能物流MES生箔工序Move In")
@SaIgnore
@ApiLog(
bizCode = "/mes/momRollFoilStart",
@@ -36,7 +35,6 @@ public class MesToLmsController {
}
@PostMapping("momRollFoilWeighing")
// @Log("MES获取AGV称重信息")
@SaIgnore
@ApiLog(
bizCode = "/mes/momRollFoilWeighing",
@@ -48,7 +46,6 @@ public class MesToLmsController {
}
@PostMapping("/momRollFoilComplete")
// @Log("MES执行下卷动作告诉LMS")
@SaIgnore
@ApiLog(
bizCode = "/mes/momRollFoilComplete",
@@ -60,7 +57,6 @@ public class MesToLmsController {
}
@PostMapping("/momRollBakeNextSpecTransfer")
// @Log("MES下达烘箱温度和时间配方给智能物流(MES 包装防护工序Move Out)")
@SaIgnore
@ApiLog(
bizCode = "/mes/momRollBakeNextSpecTransfer",
@@ -72,7 +68,6 @@ public class MesToLmsController {
}
@PostMapping("/cutPlanTransfer")
// @Log("分切包装段:分切计划(单表,包含母卷/改制子卷-包装箱号、空包装箱物料、纸筒/FRP管MES下发智能物流")
@SaIgnore
@ApiLog(
bizCode = "/mes/cutPlanTransfer",
@@ -84,7 +79,6 @@ public class MesToLmsController {
}
@PostMapping("/callNextAssAndMomRoll")
// @Log("分切即将完成,呼叫配送下一个母卷/改制子卷MES传智能物流")
@SaIgnore
@ApiLog(
bizCode = "/mes/callNextAssAndMomRoll",
@@ -96,7 +90,6 @@ public class MesToLmsController {
}
@PostMapping("/childRollCutStartComp")
// @Log("当母卷开始分切时MES系统会将对应的子卷进站信息发送给只能物流系统一方面物流系统可以预估下个母卷的送达时间也可以闭环期分切计划指令")
@SaIgnore
@ApiLog(
bizCode = "/mes/childRollCutStartComp",
@@ -108,7 +101,6 @@ public class MesToLmsController {
}
@PostMapping("/childRollPackComplete")
// @Log("包装完成传智能物流包装箱与子卷关系及子卷属性值LMS执行入库")
@SaIgnore
@ApiLog(
bizCode = "/mes/childRollPackComplete",
@@ -120,7 +112,6 @@ public class MesToLmsController {
}
@PostMapping("/inventoryTransferInfoSync")
// @Log("转单指令在MES平台查看后更新信息发送LMS是否拆包、更新后的入库日期、是否更换外包装箱标签,LMS重打子卷标签、包装箱外标签")
@SaIgnore
@ApiLog(
bizCode = "/mes/inventoryTransferInfoSync",
@@ -132,7 +123,6 @@ public class MesToLmsController {
}
@PostMapping("/childRollInfoUpdate")
// @Log("子卷信息更新:计划外需求有可能入库完成后ERP才回传计划外需求SalesOrder")
@SaIgnore
@ApiLog(
bizCode = "/mes/childRollInfoUpdate",
@@ -144,7 +134,6 @@ public class MesToLmsController {
}
@PostMapping("/cutPlanTransferCancel")
// @Log("分切计划取消")
@SaIgnore
@ApiLog(
bizCode = "/mes/cutPlanTransferCancel",
@@ -156,7 +145,6 @@ public class MesToLmsController {
}
@PostMapping("/sendAuditResult")
// @Log("子卷报废审批结果回传")
@SaIgnore
@ApiLog(
bizCode = "/mes/sendAuditResult",
@@ -168,7 +156,6 @@ public class MesToLmsController {
}
@PostMapping("/sendProcessInfo")
// @Log("表处母卷上料、下料接口")
@SaIgnore
@ApiLog(
bizCode = "/mes/sendProcessInfo",
@@ -180,7 +167,6 @@ public class MesToLmsController {
}
@PostMapping("/momRollTRStartMock")
// @Log("表处工单推送")
@SaIgnore
@ApiLog(
bizCode = "/mes/momRollTRStartMock",
@@ -193,7 +179,6 @@ public class MesToLmsController {
@PostMapping("/sendTargetHouse")
// @Log("MES传递给LMS入线边库或者入成品库")
@SaIgnore
@ApiLog(
bizCode = "/mes/sendTargetHouse",
@@ -205,7 +190,6 @@ public class MesToLmsController {
}
@PostMapping("/momSendSplitMfgOrderBOM")
// @Log("MES传递LMS订单BOM")
@SaIgnore
@ApiLog(
bizCode = "/mes/momSendSplitMfgOrderBOM",
@@ -217,7 +201,6 @@ public class MesToLmsController {
}
@PostMapping("/getRollInfo")
// @Log("MES传递LMS获取子卷重量信息")
@SaIgnore
@ApiLog(
bizCode = "/mes/getRollInfo",
@@ -229,7 +212,6 @@ public class MesToLmsController {
}
@PostMapping("/sendLevelInfo")
// @Log("MES传递LMS定级数据")
@SaIgnore
@ApiLog(
bizCode = "/mes/sendLevelInfo",
@@ -241,7 +223,6 @@ public class MesToLmsController {
}
@PostMapping("/containerNeedDown")
// @Log("子卷拼接完成是否下轴")
@SaIgnore
@ApiLog(
bizCode = "/mes/containerNeedDown",
@@ -253,7 +234,6 @@ public class MesToLmsController {
}
@PostMapping("/sendSubInfo")
// @Log("子卷下料信息MES传递给LMS")
@SaIgnore
@ApiLog(
bizCode = "/mes/sendSubInfo",
@@ -265,7 +245,6 @@ public class MesToLmsController {
}
@PostMapping("/changeSect")
// @Log("MES传递给LMS入线边库或者入成品库、撤销入线边库、人工改变入线边还是包装")
@SaIgnore
@ApiLog(
bizCode = "/mes/changeSect",
@@ -277,7 +256,6 @@ public class MesToLmsController {
}
@PostMapping("/getWasteFoilWeight")
// @Log("分切子卷获取LMSAGV废箔称重重量")
@SaIgnore
@ApiLog(
bizCode = "/mes/getWasteFoilWeight",
@@ -289,7 +267,6 @@ public class MesToLmsController {
}
@PostMapping("/WasteFoilSuccess")
// @Log("分切子卷获取LMSAGV废箔称重重量")
@SaIgnore
@ApiLog(
bizCode = "/mes/WasteFoilSuccess",
@@ -301,7 +278,6 @@ public class MesToLmsController {
}
@PostMapping("/boxIsPass")
// @Log("飞书通知LMS木箱是否通过")
@SaIgnore
@ApiLog(
bizCode = "/mes/boxIsPass",
@@ -313,7 +289,6 @@ public class MesToLmsController {
}
@PostMapping("/changeBomInfo")
// @Log("MES更新LMS分切工单、订单BOM信息")
@SaIgnore
@ApiLog(
bizCode = "/mes/changeBomInfo",

View File

@@ -63,7 +63,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
@Override
public JSONObject momRollFoilWeighing(JSONObject param) {
log.info("momRollFoilWeighing接口输入参数为-------------------" + param);
long startTime = System.currentTimeMillis();
JSONObject result = new JSONObject();
if (StrUtil.equals("0", is_connect_mes)) {
result.put("status", HttpStatus.OK.value());
@@ -71,7 +71,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result.put("data", new JSONObject());
return result;
}
long startTime = System.currentTimeMillis();
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
@@ -97,13 +97,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
// 记录失败日志
OutboundApiLogger.logFail("mes", "/sap/center/lms/004", "LMS的PDA操作AGV下卷AGV称重完成后AGV称重信息发送MES",
OutboundApiLogger.logFail("mes", "/CamstarApi/momRollFoilWeighing", "LMS的PDA操作AGV下卷AGV称重完成后AGV称重信息发送MES",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
throw new BadRequestException("MES提示错误" + e.getMessage());
}
// 记录成功日志
OutboundApiLogger.logSuccess("sap", "/sap/center/lms/004", "LMS的PDA操作AGV下卷AGV称重完成后AGV称重信息发送MES",
OutboundApiLogger.logSuccess("mes", "/CamstarApi/momRollFoilWeighing", "LMS的PDA操作AGV下卷AGV称重完成后AGV称重信息发送MES",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
@@ -211,7 +211,6 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result.put("data", new JSONObject());
return result;
}
long startTime = System.currentTimeMillis();
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
@@ -255,7 +254,6 @@ public class LmsToMesServiceImpl implements LmsToMesService {
@Override
public JSONObject momRollSemiFGInboundComplete(JSONObject param) {
log.info("momRollSemiFGInboundComplete接口输入参数为-------------------" + param.toString());
JSONObject result = new JSONObject();
if (StrUtil.equals("0", is_connect_mes)) {
result.put("status", HttpStatus.OK.value());
@@ -263,7 +261,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result.put("data", new JSONObject());
return result;
}
long startTime = System.currentTimeMillis();
JSONArray list = new JSONArray();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
@@ -285,8 +283,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
// 记录失败日志
OutboundApiLogger.logFail("mes", "/CamstarApi/MomRollSemiFGInboundComplete", "AGV将母卷从烘箱暂存位转移至暂存区传MES",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
log.info("MES提示错误" + e.getMessage());
}
// 记录成功日志
OutboundApiLogger.logSuccess("mes", "/CamstarApi/MomRollSemiFGInboundComplete", "AGV将母卷从烘箱暂存位转移至暂存区传MES",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
}
@@ -299,7 +305,6 @@ public class LmsToMesServiceImpl implements LmsToMesService {
@Override
public JSONObject airSwellWithPaperTubeAssComplete(JSONObject param) {
log.info("airSwellWithPaperTubeAssComplete接口输入参数为-------------------" + param.toString());
String container_name = param.getString("container_name");
if (StrUtil.isEmpty(container_name)) {
throw new BadRequestException("子卷号不能为空!");
@@ -312,7 +317,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result.put("data", new JSONObject());
return result;
}
long startTime = System.currentTimeMillis();
JSONObject jo = new JSONObject();
jo.put("iContainerName", container_name);
jo.put("iisAirSwellAssComplete", 1);
@@ -339,8 +344,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
// 记录失败日志
OutboundApiLogger.logFail("mes", "/CamstarApi/AirSwellWithPaperTubeAssComplete", "套轴任务完成上架暂存区智能物流PDA选任务、扫轴、扫料架货位传MES套轴任务完成信息",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
log.info("MES提示错误" + e.getMessage());
}
// 记录成功日志
OutboundApiLogger.logSuccess("mes", "/CamstarApi/AirSwellWithPaperTubeAssComplete", "套轴任务完成上架暂存区智能物流PDA选任务、扫轴、扫料架货位传MES套轴任务完成信息",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
}
@@ -353,7 +366,6 @@ public class LmsToMesServiceImpl implements LmsToMesService {
@Override
public JSONObject cutPlanMomRollDeliveryComplete(JSONObject param) {
log.info("cutPlanMomRollDeliveryComplete接口输入参数为-------------------" + param.toString());
JSONObject result = new JSONObject();
if (StrUtil.equals("0", is_connect_mes)) {
result.put("status", HttpStatus.OK.value());
@@ -361,6 +373,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result.put("data", new JSONObject());
return result;
}
long startTime = System.currentTimeMillis();
String container_name = param.getString("container_name");
String package_box_sn = param.getString("package_box_sn");
@@ -399,8 +412,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
// 记录失败日志
OutboundApiLogger.logFail("mes", "/CamstarApi/CutPlanMomRollDeliveryComplete", "LMS提前做/MES呼叫后做立库子卷出库完成/母卷配送至分切机暂存位AGV传MES 母卷配送完成信息/立库子卷出库完成信息",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
throw new BadRequestException("MES提示错误" + e.getMessage());
}
// 记录成功日志
OutboundApiLogger.logSuccess("mes", "/CamstarApi/CutPlanMomRollDeliveryComplete", "LMS提前做/MES呼叫后做立库子卷出库完成/母卷配送至分切机暂存位AGV传MES 母卷配送完成信息/立库子卷出库完成信息",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
}
@@ -413,12 +434,10 @@ public class LmsToMesServiceImpl implements LmsToMesService {
@Override
public JSONObject airSwellWithPaperTubeAssArrival(JSONObject param) {
log.info("airSwellWithPaperTubeAssArrival接口输入参数为-------------------" + param.toString());
String container_name = param.getString("container_name");
if (StrUtil.isEmpty(container_name)) {
throw new BadRequestException("子卷号不能为空!");
}
JSONObject result = new JSONObject();
if (StrUtil.equals("0", is_connect_mes)) {
result.put("status", HttpStatus.OK.value());
@@ -426,6 +445,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result.put("data", new JSONObject());
return result;
}
long startTime = System.currentTimeMillis();
JSONObject jo = new JSONObject();
jo.put("iContainerName", container_name);
@@ -450,8 +470,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
// 记录失败日志
OutboundApiLogger.logFail("mes", "/CamstarApi/AirSwellWithPaperTubeAssArrival", "提前将/按呼叫指令配送扫码校验配送先后顺序气涨轴套装运输到分切机智能物流传MES 到位信息",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
log.info("MES提示错误" + e.getMessage());
}
// 记录成功日志
OutboundApiLogger.logSuccess("mes", "/CamstarApi/AirSwellWithPaperTubeAssArrival", "提前将/按呼叫指令配送扫码校验配送先后顺序气涨轴套装运输到分切机智能物流传MES 到位信息",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
}
@@ -464,7 +492,6 @@ public class LmsToMesServiceImpl implements LmsToMesService {
@Override
public JSONObject childRollFGInboundComplete(JSONObject param) {
log.info("childRollFGInboundComplete接口输入参数为-------------------" + param.toString());
String PackageBoxSN = param.getString("PackageBoxSN");
String User = param.getString("User");
JSONObject result = new JSONObject();
@@ -529,8 +556,6 @@ public class LmsToMesServiceImpl implements LmsToMesService {
@Override
public JSONObject childRollFGOutboundComplete(JSONObject param) {
log.info("childRollFGOutboundComplete接口输入参数为-------------------" + param.toString());
JSONObject result = new JSONObject();
if (StrUtil.equals("0", is_connect_mes)) {
result.put("status", HttpStatus.OK.value());
@@ -694,7 +719,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result.put("data", new JSONObject());
return result;
}
long startTime = System.currentTimeMillis();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
String api = "/FeiShuNoticesWebApi/CreateApproval";
url = url + api;
@@ -715,8 +740,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
// 记录失败日志
OutboundApiLogger.logFail("feishu", "/FeiShuNoticesWebApi/CreateApproval", "触发飞书报废审核流程",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
throw new BadRequestException("飞书提示错误:" + e.getMessage());
}
// 记录成功日志
OutboundApiLogger.logSuccess("feishu", "/FeiShuNoticesWebApi/CreateApproval", "触发飞书报废审核流程",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
}
@@ -731,7 +764,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result.put("data", new JSONObject());
return result;
}
long startTime = System.currentTimeMillis();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
String api = "/FeiShuNoticesWebApi/SendCard";
url = url + api;
@@ -768,7 +801,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result.put("data", new JSONObject());
return result;
}
long startTime = System.currentTimeMillis();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
String api = "CamstarApi/ChildScrapUpdate";
url = url + api;
@@ -794,8 +827,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
// 记录失败日志
OutboundApiLogger.logFail("mes", "/CamstarApi/ChildScrapUpdate", "报废出库回传mes箱号、子卷号",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
throw new BadRequestException("MES提示错误" + e.getMessage());
}
// 记录成功日志
OutboundApiLogger.logSuccess("mes", "/CamstarApi/ChildScrapUpdate", "报废出库回传mes箱号、子卷号",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
}
@@ -809,7 +850,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result.put("data", new JSONObject());
return result;
}
long startTime = System.currentTimeMillis();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
String api = "/FeiShuNoticesWebApi/UploadImage";
url = url + api + "?fileName=" + file_name;
@@ -846,7 +887,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result.put("data", new JSONObject());
return result;
}
long startTime = System.currentTimeMillis();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
String api = "/FeiShuNoticesWebApi/SendCard";
url = url + api;
@@ -893,7 +934,6 @@ public class LmsToMesServiceImpl implements LmsToMesService {
JSONObject result = new JSONObject();
log.info("momAutoTransterMoveIn接口输入参数为-------------------" + param.toString());
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
String api = "CamstarApi/momAutoTransterMoveIn";
url = url + api;
@@ -936,7 +976,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
}
JSONObject result = new JSONObject();
long startTime = System.currentTimeMillis();
log.info("momGetPackingInfo接口输入参数为-------------------" + param.toString());
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
@@ -967,8 +1007,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
// 记录失败日志
OutboundApiLogger.logFail("mes", "/CamstarApi/momGetPackingInfo", "根据木想号母卷获取包装信息",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
throw new BadRequestException("MES提示错误" + e.getMessage());
}
// 记录成功日志
OutboundApiLogger.logSuccess("mes", "/CamstarApi/momGetPackingInfo", "根据木想号母卷获取包装信息",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
}
@@ -998,7 +1046,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
if (ObjectUtil.isEmpty(rows)) {
throw new BadRequestException("箱内子卷信息不能为空!");
}
long startTime = System.currentTimeMillis();
JSONObject result = new JSONObject();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL2").getValue();
@@ -1043,8 +1091,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
PdmProductSpecServiceImpl.doRecord(SpecEnum.BZ_MES, param, Boolean.TRUE, null, list);
} catch (Exception e) {
PdmProductSpecServiceImpl.doRecord(SpecEnum.BZ_MES, param, Boolean.FALSE, e.getMessage(), list);
// 记录失败日志
OutboundApiLogger.logFail("mes", "/CamstarApi/momBoxPackageSubmit", "包装回传",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
throw new BadRequestException("MES提示错误" + e.getMessage());
}
// 记录成功日志
OutboundApiLogger.logSuccess("mes", "/CamstarApi/momBoxPackageSubmit", "包装回传",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
}
@@ -1067,7 +1123,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
}
JSONObject result = new JSONObject();
long startTime = System.currentTimeMillis();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL2").getValue();
String api = "CamstarApi/BoxDataCollectionSubmit2";
url = url + api;
@@ -1160,9 +1216,17 @@ public class LmsToMesServiceImpl implements LmsToMesService {
}
} catch (Exception e) {
PdmProductSpecServiceImpl.doRecord(SpecEnum.YX_MES, param, Boolean.FALSE, e.getMessage(), containerName);
// 记录失败日志
OutboundApiLogger.logFail("mes", "/CamstarApi/BoxDataCollectionSubmit2", "mes验箱",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
throw new BadRequestException("MES错误" + e.getMessage());
}
PdmProductSpecServiceImpl.doRecord(SpecEnum.YX_MES, param, Boolean.TRUE, null, containerName);
// 记录成功日志
OutboundApiLogger.logSuccess("mes", "/CamstarApi/BoxDataCollectionSubmit2", "mes验箱",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
}
@@ -1178,7 +1242,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
}
JSONObject result = new JSONObject();
long startTime = System.currentTimeMillis();
String isConnect2 = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("IS_CONNECT_MES2").getValue();
if ("0".equals(isConnect2)) {
return result;
@@ -1321,8 +1385,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
log.info("getInspectionResult接口输出参数为-------------------" + result.toString());
} catch (Exception e) {
// 记录失败日志
OutboundApiLogger.logFail("mes", "/CamstarApi/GetInspectionResult", "/CamstarApi/GetInspectionResult",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
throw new BadRequestException("MES提示错误" + e.getMessage());
}
// 记录成功日志
OutboundApiLogger.logSuccess("mes", "/CamstarApi/GetInspectionResult", "/CamstarApi/GetInspectionResult",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
}
@@ -1335,7 +1407,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
}
JSONObject result = new JSONObject();
long startTime = System.currentTimeMillis();
log.info("GetChildWeightIsSamplePDA接口输入参数为-------------------" + param.toString());
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
@@ -1380,8 +1452,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
// 记录失败日志
OutboundApiLogger.logFail("mes", "/CamstarApi/GetChildWeightIsSamplePDA", "/CamstarApi/GetChildWeightIsSamplePDA",
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
System.currentTimeMillis() - startTime);
throw new BadRequestException("MES提示错误" + e.getMessage());
}
// 记录成功日志
OutboundApiLogger.logSuccess("mes", "/CamstarApi/GetChildWeightIsSamplePDA", "/CamstarApi/GetChildWeightIsSamplePDA",
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
System.currentTimeMillis() - startTime);
return result;
}

View File

@@ -31,7 +31,6 @@ public class LmsToBigScreenController {
@PostMapping("/getStructInfo")
@Log("数字孪生请求LMS获取设备信息")
@SaIgnore
public ResponseEntity<Object> getStructInfo(@RequestBody JSONObject jo) {
return new ResponseEntity<>(LmsToBigScreenService.getStructInfo(jo), HttpStatus.OK);
@@ -39,7 +38,6 @@ public class LmsToBigScreenController {
@PostMapping("/getMonthFreight")
@Log("当月发货运费信息")
@SaIgnore
public ResponseEntity<Object> getMonthFreight(@RequestBody JSONObject jo) {
return new ResponseEntity<>(LmsToBigScreenService.getMonthFreight(jo), HttpStatus.OK);
@@ -47,7 +45,6 @@ public class LmsToBigScreenController {
@PostMapping("/getMonthYield")
@Log("当月产量信息")
@SaIgnore
public ResponseEntity<Object> getMonthYield(@RequestBody JSONObject jo) {
return new ResponseEntity<>(LmsToBigScreenService.getMonthYield(jo), HttpStatus.OK);
@@ -55,7 +52,6 @@ public class LmsToBigScreenController {
@PostMapping("/getMonthDelivery")
@Log("当月发货信息")
@SaIgnore
public ResponseEntity<Object> getMonthDelivery(@RequestBody JSONObject jo) {
return new ResponseEntity<>(LmsToBigScreenService.getMonthDelivery(jo), HttpStatus.OK);
@@ -63,7 +59,6 @@ public class LmsToBigScreenController {
@PostMapping("/getProudDayData")
@Log("成品日报")
@SaIgnore
public ResponseEntity<Object> getProudDayData(@RequestBody JSONObject jo) {
return new ResponseEntity<>(LmsToBigScreenService.getProudDayData(jo), HttpStatus.OK);