diff --git a/src/main/java/com/gaotao/modules/api/service/impl/IfsApiIssueAndReturnServiceImpl.java b/src/main/java/com/gaotao/modules/api/service/impl/IfsApiIssueAndReturnServiceImpl.java index 4e5e846..ea00094 100644 --- a/src/main/java/com/gaotao/modules/api/service/impl/IfsApiIssueAndReturnServiceImpl.java +++ b/src/main/java/com/gaotao/modules/api/service/impl/IfsApiIssueAndReturnServiceImpl.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.gaotao.common.exception.XJException; +import com.gaotao.common.utils.ErrorLogUtils; import com.gaotao.common.utils.IfsErrorMessageUtils; import com.gaotao.common.utils.HttpUtils; import com.gaotao.modules.api.dao.IfsShipmentReserveLogMapper; @@ -96,6 +97,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getInventoryPart(String partNo, String site){ + String jsonBody=""; try{ Map params = Map.of( "ifsDBName", ifsDBName, @@ -104,7 +106,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ "ifsPartNo", partNo ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","InventoryPart", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl+"InventoryPart",jsonBody,null); ObjectMapper mapper = new ObjectMapper(); @@ -114,6 +116,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ return inventoryPartVos; }catch (Exception e){ + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs库存", + "IFS", + "InventoryPart", + partNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException("获取IFS物料列表失败"+e.getMessage() ); } @@ -121,6 +131,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getWorkOrderInfo(String workOrderNo, String site,String releaseNo,String sequenceNo){ + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -131,7 +142,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ "ifsSequenceNo", sequenceNo ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","ShopOrder", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl+"ShopOrder",jsonBody,null); ObjectMapper mapper = new ObjectMapper(); @@ -140,6 +151,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ }); return shopOrders; } catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs工单", + "IFS", + "ShopOrder", + workOrderNo+";"+releaseNo+";"+ sequenceNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new RuntimeException(e); } @@ -147,6 +166,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getShopOrderLine(String workOrderNo, String site){ + String jsonBody=""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -155,7 +175,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ "ifsOrderNo", workOrderNo ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","ShopOrderLine", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl+"ShopOrderLine",jsonBody,null); ObjectMapper mapper = new ObjectMapper(); @@ -164,6 +184,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ }); return shopOrders; } catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "模糊查询ifs工单", + "IFS", + "ShopOrderLine", + workOrderNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new RuntimeException(e); } @@ -171,6 +199,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getShopOrderMaterial(String workOrderNo, String site,String releaseNo,String sequenceNo){ + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -181,7 +210,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ "ifsSequenceNo", sequenceNo ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","ShopOrderMaterial", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl+"ShopOrderMaterial",jsonBody,null); ObjectMapper mapper = new ObjectMapper(); @@ -191,6 +220,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ return shopOrderMaterialVos; }catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs工单材料", + "IFS", + "ShopOrderMaterial", + workOrderNo+";"+releaseNo+";"+ sequenceNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -199,6 +236,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getIssueForShopOrder(String workOrderNo, String site,String releaseNo,String sequenceNo){ + String jsonBody = ""; try{ Map params = Map.of( "ifsDBName", ifsDBName, @@ -209,7 +247,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ "ifsSequenceNo", sequenceNo ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","IssueForShopOrder", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl+"IssueForShopOrder",jsonBody,null); ObjectMapper mapper = new ObjectMapper(); @@ -219,6 +257,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ return issueForShopOrderVos; }catch (Exception e){ + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs工单发料记录", + "IFS", + "IssueForShopOrder", + workOrderNo+";"+releaseNo+";"+ sequenceNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -227,6 +273,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addShopOrderManualIssue(IssueShopOrderDto issueShopOrderDto){ + String jsonBody = ""; try{ Map params = new HashMap<>(); params.put("ifsDBName",ifsDBName); @@ -246,7 +293,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsHandlingUnitID",0); params.put("ifsTransQty",issueShopOrderDto.getIfsTransQty()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","ShopOrderManualIssue", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl+"ShopOrderManualIssue",jsonBody,null); if ("IFSUpdated".equals(ifsResponse) || "\"IFSUpdated\"".equals(ifsResponse)){ @@ -258,6 +305,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ } return ifsResponse; }catch (Exception e){ + ErrorLogUtils.logInterface(issueShopOrderDto.getIfsSiteID(), + "IFS接口", + "查询ifs工单发料预留", + "IFS", + "ShopOrderManualIssue", + issueShopOrderDto.getIfsOrderNo()+";"+issueShopOrderDto.getIfsReleaseNo()+";"+ issueShopOrderDto.getIfsSequenceNo(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -265,6 +320,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addShopOrderManualUnIssue(UnissueShopOrderDto unissueShopOrderDto) { + String jsonBody = ""; try{ Map params = new HashMap<>(); params.put("ifsDBName",ifsDBName); @@ -288,7 +344,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsTransactionID",unissueShopOrderDto.getIfsTransactionID()); params.put("ifsAccountingID",unissueShopOrderDto.getIfsAccountingID()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","ShopOrderManualUnIssue", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl+"ShopOrderManualUnIssue",jsonBody,null); if ("IFSUpdated".equals(ifsResponse) || "\"IFSUpdated\"".equals(ifsResponse)){ @@ -300,6 +356,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ } return ifsResponse; }catch (Exception e){ + ErrorLogUtils.logInterface(unissueShopOrderDto.getIfsSiteID(), + "IFS接口", + "查询ifs工单退料", + "IFS", + "ShopOrderManualUnIssue", + unissueShopOrderDto.getIfsOrderNo()+";"+unissueShopOrderDto.getIfsReleaseNo()+";"+ unissueShopOrderDto.getIfsSequenceNo(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -307,6 +371,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getMaterialRequisition(String workOrderNo, String site) { + String jsonBody = ""; try { // 调用IFS接口获取MR列表 Map params = Map.of( @@ -317,7 +382,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","MaterialRequisition", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "MaterialRequisition", jsonBody, null); ObjectMapper mapper = new ObjectMapper(); @@ -325,6 +390,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ List mrList = mapper.readValue(ifsResponse, new TypeReference>() {}); return mrList; } catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifsMR", + "IFS", + "MaterialRequisition", + workOrderNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -332,6 +405,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getMaterialRequisitionMaterialLine(String workOrderNo, String site) { + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -341,7 +415,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","MaterialRequisitionMaterialLine", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "MaterialRequisitionMaterialLine", jsonBody, null); ObjectMapper mapper = new ObjectMapper(); @@ -349,6 +423,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ List mrList = mapper.readValue(ifsResponse, new TypeReference>() {}); return mrList; } catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifsMR材料", + "IFS", + "MaterialRequisitionMaterialLine", + workOrderNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -356,6 +438,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addMaterialRequisitionReserve(MaterialRequisitionIssueDto materialRequisitionIssueDto){ + String jsonBody = ""; try{ Map params = new HashMap<>(); params.put("ifsDBName",ifsDBName); @@ -375,7 +458,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsHandlingUntitID",materialRequisitionIssueDto.getIfsHandlingUntitID()); params.put("ifsQuantity",materialRequisitionIssueDto.getIfsQuantity()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","MaterialRequisitionReserve", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl+"MaterialRequisitionReserve",jsonBody,null); if ("IFSUpdated".equals(ifsResponse) || "\"IFSUpdated\"".equals(ifsResponse)){ @@ -387,6 +470,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ } return ifsResponse; }catch (Exception e){ + ErrorLogUtils.logInterface(materialRequisitionIssueDto.getIfsSiteID(), + "IFS接口", + "查询ifsMR预留", + "IFS", + "MaterialRequisitionMaterialLine", + materialRequisitionIssueDto.getIfsOrderNo(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -394,6 +485,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addMaterialRequisitionIssue(MaterialRequisitionIssueDto materialRequisitionIssueDto){ + String jsonBody = ""; try{ Map params = new HashMap<>(); params.put("ifsDBName",ifsDBName); @@ -413,7 +505,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsHandlingUntitID",materialRequisitionIssueDto.getIfsHandlingUntitID()); params.put("ifsQuantity",materialRequisitionIssueDto.getIfsQuantity()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","MaterialRequisitionIssue", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl+"MaterialRequisitionIssue",jsonBody,null); if ("IFSUpdated".equals(ifsResponse) || "\"IFSUpdated\"".equals(ifsResponse)){ @@ -425,6 +517,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ } return ifsResponse; }catch (Exception e){ + ErrorLogUtils.logInterface(materialRequisitionIssueDto.getIfsSiteID(), + "IFS接口", + "查询ifsMR发料", + "IFS", + "MaterialRequisitionIssue", + materialRequisitionIssueDto.getIfsOrderNo(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -432,7 +532,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addOtherInbound(OtherTransactionIfsDto otherTransactionIfsDto) { - + String jsonBody = ""; try { Map params = new HashMap<>(); params.put("ifsDBName", ifsDBName); @@ -451,12 +551,20 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsNote", otherTransactionIfsDto.getIfsReason()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","ReceiveInventoryPart", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl + "ReceiveInventoryPart", jsonBody, null); return ifsResponse; } catch (Exception e) { + ErrorLogUtils.logInterface(otherTransactionIfsDto.getIfsSiteID(), + "IFS接口", + "查询ifs其他预留", + "IFS", + "ReceiveInventoryPart", + otherTransactionIfsDto.getIfsPartNo(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException("其它入库同步IFS失败"); } @@ -464,7 +572,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addOtherOutbound(OtherTransactionIfsDto otherTransactionIfsDto) { - + String jsonBody = ""; try { Map params = new HashMap<>(); params.put("ifsDBName", ifsDBName); @@ -482,12 +590,20 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsNote", otherTransactionIfsDto.getIfsReason()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","IssueInventoryPart", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl + "IssueInventoryPart", jsonBody, null); return ifsResponse; } catch (Exception e) { + ErrorLogUtils.logInterface(otherTransactionIfsDto.getIfsSiteID(), + "IFS接口", + "查询ifs其他发料", + "IFS", + "IssueInventoryPart", + otherTransactionIfsDto.getIfsPartNo(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException("其它出库同步IFS失败"); } @@ -495,6 +611,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getIssueForMaterialRequisition(String workOrderNo, String site,String releaseNo,String sequenceNo) { + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -506,7 +623,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","IssueForMaterialRequisition", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "IssueForMaterialRequisition", jsonBody, null); ObjectMapper mapper = new ObjectMapper(); @@ -514,6 +631,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ List mrList = mapper.readValue(ifsResponse, new TypeReference>() {}); return mrList; } catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifsMR发料", + "IFS", + "IssueForMaterialRequisition", + workOrderNo+";"+releaseNo+";"+ sequenceNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -521,6 +646,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addMaterialRequisitionUnIssue(MaterialRequisitionUnIssueDto materialRequisitionUnIssueDto){ + String jsonBody = ""; try{ Map params = new HashMap<>(); params.put("ifsDBName",ifsDBName); @@ -544,7 +670,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsQty",materialRequisitionUnIssueDto.getIfsQty()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","MaterialRequisitionUnIssue", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl+"MaterialRequisitionUnIssue",jsonBody,null); if ("IFSUpdated".equals(ifsResponse) || "\"IFSUpdated\"".equals(ifsResponse)){ @@ -556,6 +682,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ } return ifsResponse; }catch (Exception e){ + ErrorLogUtils.logInterface(materialRequisitionUnIssueDto.getIfsSiteID(), + "IFS接口", + "查询ifs退料", + "IFS", + "MaterialRequisitionUnIssue", + materialRequisitionUnIssueDto.getIfsPartNo(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -563,6 +697,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getPurchaseOrder(String outsourcingNo, String site) { + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -572,7 +707,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","PurchaseOrder", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "PurchaseOrder", jsonBody, null); ObjectMapper mapper = new ObjectMapper(); @@ -580,6 +715,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ List orderVos = mapper.readValue(ifsResponse, new TypeReference>() {}); return orderVos; } catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs委外", + "IFS", + "PurchaseOrder", + outsourcingNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -587,6 +730,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getPurchaseOrderLine(String outsourcingNo, String site) { + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -596,7 +740,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","PurchaseOrderLine", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "PurchaseOrderLine", jsonBody, null); ObjectMapper mapper = new ObjectMapper(); @@ -604,6 +748,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ List orderVos = mapper.readValue(ifsResponse, new TypeReference>() {}); return orderVos; } catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs委外", + "IFS", + "PurchaseOrderLine", + outsourcingNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -611,6 +763,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getPOLineSupplierMaterial(String outsourcingNo, String site) { + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -620,7 +773,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","POLineSupplierMaterial", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "POLineSupplierMaterial", jsonBody, null); ObjectMapper mapper = new ObjectMapper(); @@ -628,6 +781,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ List orderVos = mapper.readValue(ifsResponse, new TypeReference>() {}); return orderVos; } catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs委外", + "IFS", + "POLineSupplierMaterial", + outsourcingNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException("获取IFS采购供应商材料失败"+e.getMessage()); } @@ -635,6 +796,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addPurchaseOrderReserveComponent(PurchaseOrderReserveComponentDto purchaseOrderReserveComponentDto){ + String jsonBody = ""; try{ Map params = new HashMap<>(); params.put("ifsDBName",ifsDBName); @@ -656,7 +818,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsReverseQty",purchaseOrderReserveComponentDto.getIfsReverseQty()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","PurchaseOrderReserveComponent", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl+"PurchaseOrderReserveComponent",jsonBody,null); if ("IFSUpdated".equals(ifsResponse) || "\"IFSUpdated\"".equals(ifsResponse)){ @@ -668,6 +830,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ } return ifsResponse; }catch (Exception e){ + ErrorLogUtils.logInterface(purchaseOrderReserveComponentDto.getIfsSiteID(), + "IFS接口", + "查询ifs委外预留", + "IFS", + "PurchaseOrderReserveComponent", + purchaseOrderReserveComponentDto.getIfsOrderNo(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -675,6 +845,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addPurchaseOrderIssueComponent(PurchaseOrderReserveComponentDto purchaseOrderReserveComponentDto){ + String jsonBody = ""; try{ Map params = new HashMap<>(); params.put("ifsDBName",ifsDBName); @@ -696,7 +867,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsQtyToShip",purchaseOrderReserveComponentDto.getIfsQtyToShip()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","PurchaseOrderIssueComponent", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl+"PurchaseOrderIssueComponent",jsonBody,null); if ("IFSUpdated".equals(ifsResponse) || "\"IFSUpdated\"".equals(ifsResponse)){ @@ -708,6 +879,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ } return ifsResponse; }catch (Exception e){ + ErrorLogUtils.logInterface(purchaseOrderReserveComponentDto.getIfsSiteID(), + "IFS接口", + "查询ifs委外发料", + "IFS", + "PurchaseOrderIssueComponent", + purchaseOrderReserveComponentDto.getIfsOrderNo(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -715,6 +894,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getIssueForPurchaseOrder(String orderNo, String site, String releaseNo,String sequenceNo,String lineItemNo) { + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -727,7 +907,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","IssueForPurchaseOrder", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "IssueForPurchaseOrder", jsonBody, null); ObjectMapper mapper = new ObjectMapper(); @@ -735,6 +915,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ List orderVos = mapper.readValue(ifsResponse, new TypeReference>() {}); return orderVos; } catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs委外发料", + "IFS", + "IssueForPurchaseOrder", + orderNo+";"+releaseNo+";"+ sequenceNo+";"+lineItemNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException("获取IFS采购供应商材料失败"+e.getMessage()); } @@ -742,6 +930,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addPurchaseOrderUnIssueComponent(PurchaseOrderUnIssueComponentDto purchaseOrderUnIssueComponentDto){ + String jsonBody = ""; try{ Map params = new HashMap<>(); params.put("ifsDBName",ifsDBName); @@ -763,7 +952,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsQty",purchaseOrderUnIssueComponentDto.getIfsQty()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","PurchaseOrderUnIssueComponent", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl+"PurchaseOrderUnIssueComponent",jsonBody,null); if ("IFSUpdated".equals(ifsResponse) || "\"IFSUpdated\"".equals(ifsResponse)){ @@ -775,6 +964,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ } return ifsResponse; }catch (Exception e){ + ErrorLogUtils.logInterface(purchaseOrderUnIssueComponentDto.getIfsSiteId(), + "IFS接口", + "查询ifs委外退料", + "IFS", + "PurchaseOrderUnIssueComponent", + purchaseOrderUnIssueComponentDto.getIfsOrderNo(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -782,6 +979,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getPurchaseOrderReceipt(String purchaseOrderNo, String site) { + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -791,11 +989,19 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","PurchaseOrderReceiptLocation", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "PurchaseOrderReceiptLocation", jsonBody, null); return objectMapper.readValue(ifsResponse, new TypeReference>() {}); } catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs委外退料", + "IFS", + "PurchaseOrderReceiptLocation", + purchaseOrderNo, + jsonBody, + e.getMessage(),e.getMessage()); log.error("获取采购订单接收记录失败: {}", e.getMessage()); throw new XJException("获取采购订单接收记录失败: " + e.getMessage()); } @@ -803,6 +1009,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String purchaseOrderMoveToStockOneLocation(PurchaseOrderMoveToStockDto dto) { + String jsonBody = ""; try { Map params = new HashMap<>(); params.put("ifsDBName", dto.getIfsDBName()); @@ -828,7 +1035,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsInQtyToMove", dto.getIfsInQtyToMove()); params.put("ifsCatchQtyToMove", dto.getIfsCatchQtyToMove() != null ? dto.getIfsCatchQtyToMove() : 0); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","PurchaseOrderMoveToStockOneLocation", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl + "PurchaseOrderMoveToStockOneLocation", jsonBody, null); @@ -842,6 +1049,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ throw new XJException(errorMessage); } } catch (Exception e) { + ErrorLogUtils.logInterface(dto.getIfsSiteID(), + "IFS接口", + "查询ifs采购订单移库", + "IFS", + "PurchaseOrderMoveToStockOneLocation", + dto.getIfsPartNo(), + jsonBody, + e.getMessage(),e.getMessage()); log.error("采购订单移库失败: {}", e.getMessage()); throw new XJException(e.getMessage()); } @@ -849,6 +1064,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getInventoryPartInStock(String site) { + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -856,7 +1072,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ "ifsSiteID", site ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","InventoryPartInStock", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "InventoryPartInStock", jsonBody, null); ObjectMapper mapper = new ObjectMapper(); @@ -866,6 +1082,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ return inventoryPartInStockVos; }catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs在库库存", + "IFS", + "InventoryPartInStock", + site, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException("获取IFS库存在库信息失败"+e.getMessage()); } @@ -873,6 +1097,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getAnInventoryPartInStock(String site,String partNo) { + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -881,7 +1106,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ "ifsPartNo",partNo ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","AnInventoryPartInStock", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "AnInventoryPartInStock", jsonBody, null); ObjectMapper mapper = new ObjectMapper(); @@ -891,6 +1116,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ return inventoryPartInStockVos; }catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs物料库存", + "IFS", + "AnInventoryPartInStock", + partNo, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException("获取IFS库存在库信息失败"+e.getMessage()); } @@ -898,6 +1131,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getShipment(String site,String shipmentId) { + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -906,7 +1140,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ "ifsShipmentID",shipmentId ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","Shipment", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "Shipment", jsonBody, null); ObjectMapper mapper = new ObjectMapper(); @@ -916,6 +1150,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ return shipmentVos; }catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs Shipment查询", + "IFS", + "Shipment", + shipmentId, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException("获取IFS shipment信息失败:"+e.getMessage()); } @@ -923,6 +1165,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public List getShipmentLineVo(String site,String shipmentId) { + String jsonBody = ""; try { Map params = Map.of( "ifsDBName", ifsDBName, @@ -931,7 +1174,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ "ifsShipmentID",shipmentId ); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","ShipmentLine", jsonBody); String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "ShipmentLine", jsonBody, null); ObjectMapper mapper = new ObjectMapper(); @@ -941,6 +1184,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ return shipmentLineVos; }catch (Exception e) { + ErrorLogUtils.logInterface(site, + "IFS接口", + "查询ifs ShipmentLine查询", + "IFS", + "ShipmentLine", + shipmentId, + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException("获取IFS shipmentLine信息失败"+e.getMessage()); } @@ -948,6 +1199,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addShipmentCreatePickList(ShipmentCreateDto shipmentCreateDto){ + String jsonBody = ""; try{ Map params = new HashMap<>(); params.put("ifsDBName",ifsDBName); @@ -958,7 +1210,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsLocationNo",shipmentCreateDto.getIfsLocationNo()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); log.info("IFS请求接口名称:{},请求参数: {}","ShipmentCreatePickList", jsonBody); String ifsResponse = HttpUtils.doPost(ifsUrl+"ShipmentCreatePickList",jsonBody,null); if ("IFSUpdated".equals(ifsResponse) || "\"IFSUpdated\"".equals(ifsResponse)){ @@ -970,6 +1222,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ } return ifsResponse; }catch (Exception e){ + ErrorLogUtils.logInterface(shipmentCreateDto.getIfsSiteID(), + "IFS接口", + "查询ifs成品发货", + "IFS", + "ShipmentCreatePickList", + shipmentCreateDto.getIfsShipmentID(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); throw new XJException(e.getMessage()); } @@ -979,6 +1239,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ @Override public String addShipmentLineManualReserve(ShipmentLineManualReserveDto shipmentLineManualReserveDto){ IfsShipmentReserveLog log = new IfsShipmentReserveLog(); + String jsonBody = ""; try{ Map params = new HashMap<>(); params.put("ifsDBName",ifsDBName); @@ -1010,7 +1271,7 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ params.put("ifsBlockedForPickByChoice",shipmentLineManualReserveDto.getIfsBlockedForPickByChoice()); ObjectMapper objectMapper = new ObjectMapper(); - String jsonBody = objectMapper.writeValueAsString(params); + jsonBody = objectMapper.writeValueAsString(params); // 记录日志 - 请求数据 log.setSite(shipmentLineManualReserveDto.getIfsSiteID()); @@ -1053,6 +1314,14 @@ public class IfsApiIssueAndReturnServiceImpl implements IfsApiIssueAndReturnServ ifsShipmentReserveLogService.saveShipmentReserveLog(log); return ifsResponse; }catch (Exception e){ + ErrorLogUtils.logInterface(shipmentLineManualReserveDto.getIfsSiteID(), + "IFS接口", + "查询ifs成品发货预留", + "IFS", + "ShipmentLineManualReserve", + shipmentLineManualReserveDto.getIfsShipmentID(), + jsonBody, + e.getMessage(),e.getMessage()); e.printStackTrace(); // 更新日志 - 错误信息 if (log.getId() != null) {