Browse Source

错误日志记录

master
han\hanst 8 months ago
parent
commit
7098687df2
  1. 4
      src/main/java/com/gaotao/modules/api/service/impl/IfsApiIssueAndReturnServiceImpl.java
  2. 12
      src/main/java/com/gaotao/modules/po/service/impl/PoServiceImpl.java
  3. 9
      src/main/java/com/gaotao/modules/production/service/impl/ProductionInboundServiceImpl.java
  4. 9
      src/main/java/com/gaotao/modules/production/service/impl/ProductionWithdrawalServiceImpl.java
  5. 12
      src/main/java/com/gaotao/modules/salesreturn/service/impl/SalesReturnServiceImpl.java
  6. 12
      src/main/java/com/gaotao/modules/scrap/service/impl/ScrapServiceImpl.java

4
src/main/java/com/gaotao/modules/api/service/impl/IfsApiIssueAndReturnServiceImpl.java

@ -559,7 +559,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ
} catch (Exception e) {
ErrorLogUtils.logInterface(otherTransactionIfsDto.getIfsSiteID(),
"IFS接口",
"查询ifs其他预留",
"其他入库",
"IFS",
"ReceiveInventoryPart",
otherTransactionIfsDto.getIfsPartNo(),
@ -598,7 +598,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ
} catch (Exception e) {
ErrorLogUtils.logInterface(otherTransactionIfsDto.getIfsSiteID(),
"IFS接口",
"查询ifs其他发料",
"其他出库",
"IFS",
"IssueInventoryPart",
otherTransactionIfsDto.getIfsPartNo(),

12
src/main/java/com/gaotao/modules/po/service/impl/PoServiceImpl.java

@ -531,6 +531,7 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen
* 同步到IFS
*/
private void syncToIFS(TransDetailDto inData) {
String jsonBody = null;
try {
BigDecimal sp = inData.getSamplePercent()!=null?new BigDecimal(inData.getSamplePercent()):BigDecimal.ZERO;
BigDecimal qtyToInspect;
@ -568,7 +569,7 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen
);
log.info("同步接收记录到IFS,params: {}", params);
ObjectMapper objectMapper = new ObjectMapper();
String jsonBody = objectMapper.writeValueAsString(params);
jsonBody = objectMapper.writeValueAsString(params);
log.info("IFS请求接口名称:{},请求参数: {}","registerArrival", jsonBody);
String ifsResponse = HttpUtils.doPost(ifsUrl+"registerArrival",jsonBody,null);
log.info("同步接收记录到IFS,PO号: {}", inData.getOrderNo());
@ -584,6 +585,15 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen
// 重新抛出业务异常确保事务回滚
throw e;
} catch (Exception e) {
ErrorLogUtils.logInterface(inData.getSite(),
"IFS接口",
"采购入库",
"IFS",
"registerArrival",
inData.getPartNo()+";"+inData.getBatchNo()+";"+
inData.getTransQty()+";"+(inData.getWdr() != null ? inData.getWdr() : "*"),
jsonBody,
e.getMessage(),e.getMessage());
log.error("IFS同步异常,PO号: {}, 错误: {}", inData.getOrderNo(), e.getMessage());
// 同步异常需要回滚前面所有的数据库操作
String errorMessage = IfsErrorMessageUtils.extractOracleErrorMessage(e.getMessage());

9
src/main/java/com/gaotao/modules/production/service/impl/ProductionInboundServiceImpl.java

@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gaotao.common.exception.XJException;
import com.gaotao.common.utils.DateUtils;
import com.gaotao.common.utils.ErrorLogUtils;
import com.gaotao.common.utils.HttpUtils;
import com.gaotao.common.utils.IfsErrorMessageUtils;
import com.gaotao.modules.api.entity.IfsShopOrder;
@ -948,6 +949,14 @@ public class ProductionInboundServiceImpl implements ProductionInboundService {
} else {
log.error("IFS生产订单入库失败: {}", ifsResponse);
String errorMessage = IfsErrorMessageUtils.extractOracleErrorMessage(ifsResponse);
ErrorLogUtils.logInterface(dto.getSite(),
"IFS接口",
"生产入库",
"IFS",
"ManualReceiveShopOrder",
dto.getPartNo()+";"+dto.getBatchNo()+";"+
dto.getTransQty()+";"+(dto.getWdr() != null ? dto.getWdr() : "*"),
jsonBody, errorMessage,errorMessage);
throw new Exception(errorMessage);
}
}

9
src/main/java/com/gaotao/modules/production/service/impl/ProductionWithdrawalServiceImpl.java

@ -3,6 +3,7 @@ package com.gaotao.modules.production.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gaotao.common.exception.XJException;
import com.gaotao.common.utils.ErrorLogUtils;
import com.gaotao.common.utils.HttpUtils;
import com.gaotao.common.utils.IfsErrorMessageUtils;
import com.gaotao.modules.handlingunit.entity.HandlingUnit;
@ -454,6 +455,14 @@ public class ProductionWithdrawalServiceImpl implements ProductionWithdrawalServ
} else {
log.error("IFS生产退库失败: {}", ifsResponse);
String errorMessage = IfsErrorMessageUtils.extractOracleErrorMessage(ifsResponse);
ErrorLogUtils.logInterface(dto.getSite(),
"IFS接口",
"生产退库",
"IFS",
"ManualUnreceiveShopOrder",
dto.getPartNo()+";"+dto.getBatchNo()+";"+
dto.getTransQty()+";"+(dto.getWdr() != null ? dto.getWdr() : "*"),
jsonBody, errorMessage,errorMessage);
throw new Exception(errorMessage);
}
}

12
src/main/java/com/gaotao/modules/salesreturn/service/impl/SalesReturnServiceImpl.java

@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gaotao.common.exception.XJException;
import com.gaotao.common.utils.DateUtils;
import com.gaotao.common.utils.ErrorLogUtils;
import com.gaotao.common.utils.HttpUtils;
import com.gaotao.modules.handlingunit.entity.HandlingUnit;
import com.gaotao.modules.handlingunit.service.HandlingUnitIdGeneratorService;
@ -462,6 +463,7 @@ public class SalesReturnServiceImpl implements SalesReturnService {
* 同步到IFS - 调用RMAReceiveIntoInventory API
*/
private void syncToIfs(String rmaNo, SalesReturnDto dto) {
String jsonBody = "";
try {
log.info("开始同步到IFS: RMA={}, 物料={}", rmaNo, dto.getPartNo());
@ -487,7 +489,7 @@ public class SalesReturnServiceImpl implements SalesReturnService {
params.put("ifsOwningVendorNo", null);
ObjectMapper objectMapper = new ObjectMapper();
String jsonBody = objectMapper.writeValueAsString(params);
jsonBody = objectMapper.writeValueAsString(params);
log.info("IFS请求接口名称:{},请求参数: {}","RMAReceiveIntoInventory", jsonBody);
@ -514,6 +516,14 @@ public class SalesReturnServiceImpl implements SalesReturnService {
throw e;
} catch (Exception e) {
log.error("IFS同步异常: RMA={}, 物料={}, 错误={}", rmaNo, dto.getPartNo(), e.getMessage());
ErrorLogUtils.logInterface(dto.getSite(),
"IFS接口",
"销售退货",
"IFS",
"RMAReceiveIntoInventory",
dto.getPartNo()+";"+dto.getBatchNo()+";"+
dto.getProcessQty()+";"+(dto.getWdr() != null ? dto.getWdr() : "*"),
jsonBody, e.getMessage(),e.getMessage());
throw new XJException("IFS同步异常: " + e.getMessage());
}
}

12
src/main/java/com/gaotao/modules/scrap/service/impl/ScrapServiceImpl.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gaotao.common.exception.XJException;
import com.gaotao.common.utils.ErrorLogUtils;
import com.gaotao.common.utils.HttpUtils;
import com.gaotao.common.utils.IfsErrorMessageUtils;
import com.gaotao.modules.scrap.entity.*;
@ -319,6 +320,7 @@ public class ScrapServiceImpl extends AbstractController implements ScrapService
* 调用IFS的ScrapInventoryPart接口单个汇总项
*/
private void callIfsScrapInventoryPartSingle(String site, ScrapSummaryInfo summaryInfo, String scrapReason) {
String jsonBody = "";
try {
// 构建IFS接口参数
Map<String, Object> params = Map.ofEntries(
@ -338,7 +340,7 @@ public class ScrapServiceImpl extends AbstractController implements ScrapService
Map.entry("ifsScrapNote", "WMS批量报废")
);
ObjectMapper objectMapper = new ObjectMapper();
String jsonBody = objectMapper.writeValueAsString(params);
jsonBody = objectMapper.writeValueAsString(params);
log.info("IFS请求接口名称:{},请求参数: {}","ScrapInventoryPart", jsonBody);
String ifsResponse = HttpUtils.doPost(ifsUrl + "ScrapInventoryPart", jsonBody, null);
if ("IFSUpdated".equals(ifsResponse) || "\"IFSUpdated\"".equals(ifsResponse)) {
@ -356,6 +358,14 @@ public class ScrapServiceImpl extends AbstractController implements ScrapService
} catch (Exception e) {
log.error("调用IFS报废接口失败 - 物料: {}, 批次: {}, 库位: {}, 错误: {}",
summaryInfo.getPartNo(), summaryInfo.getBatchNo(), summaryInfo.getLocationId(), e.getMessage(), e);
ErrorLogUtils.logInterface(site,
"IFS接口",
"物料报废",
"IFS",
"ScrapInventoryPart",
summaryInfo.getPartNo()+";"+summaryInfo.getBatchNo()+";"+
summaryInfo.getTotalQty()+";"+(summaryInfo.getWdr() != null ? summaryInfo.getWdr() : "*"),
jsonBody, e.getMessage(),e.getMessage());
throw new XJException(e.getMessage());
}
}

Loading…
Cancel
Save