|
|
@ -4062,43 +4062,28 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public Map<String, Object> getInventoryPartCost(InventoryPartUnitCostSumEntity inData) { |
|
|
public Map<String, Object> getInventoryPartCost(InventoryPartUnitCostSumEntity inData) { |
|
|
log.info("[getInventoryPartCost] START - site: {}, partNo: {}, userName: {}", |
|
|
|
|
|
inData.getSite(), inData.getPartNo(), inData.getUserName()); |
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
PartInformationEntity partData = partInformationMapper.selectOne( |
|
|
PartInformationEntity partData = partInformationMapper.selectOne( |
|
|
new QueryWrapper<PartInformationEntity>().eq("site", inData.getSite()).eq("part_no", inData.getPartNo())); |
|
|
new QueryWrapper<PartInformationEntity>().eq("site", inData.getSite()).eq("part_no", inData.getPartNo())); |
|
|
if (partData == null) { |
|
|
if (partData == null) { |
|
|
log.warn("[getInventoryPartCost] Part not found in PLM - site: {}, partNo: {}", inData.getSite(), inData.getPartNo()); |
|
|
|
|
|
result.put("estimatedMaterialCost", null); |
|
|
result.put("estimatedMaterialCost", null); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
log.info("[getInventoryPartCost] Part found - site: {}, partNo: {}, status: {}", inData.getSite(), inData.getPartNo(), partData.getStatus()); |
|
|
|
|
|
if (!"Y".equals(partData.getStatus())) { |
|
|
if (!"Y".equals(partData.getStatus())) { |
|
|
log.info("[getInventoryPartCost] Part is not an official part (status={}), skip IFS query - site: {}, partNo: {}", |
|
|
|
|
|
partData.getStatus(), inData.getSite(), inData.getPartNo()); |
|
|
|
|
|
result.put("estimatedMaterialCost", null); |
|
|
result.put("estimatedMaterialCost", null); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
log.info("[getInventoryPartCost] Part is official, fetching IFS server for user: {}", inData.getUserName()); |
|
|
|
|
|
Server srv = getIfsServer(inData.getUserName()); |
|
|
Server srv = getIfsServer(inData.getUserName()); |
|
|
PartIfsInventory partIfsInventory = new PartIfsInventory(); |
|
|
PartIfsInventory partIfsInventory = new PartIfsInventory(); |
|
|
partIfsInventory.setContract(inData.getSite()); |
|
|
partIfsInventory.setContract(inData.getSite()); |
|
|
partIfsInventory.setPartNo(inData.getPartNo()); |
|
|
partIfsInventory.setPartNo(inData.getPartNo()); |
|
|
log.info("[getInventoryPartCost] Calling IFS getInventoryPartCost - contract: {}, partNo: {}", inData.getSite(), inData.getPartNo()); |
|
|
|
|
|
Map<String, String> costResponse = inventoryServiceBean.getInventoryPartCost(srv, partIfsInventory); |
|
|
Map<String, String> costResponse = inventoryServiceBean.getInventoryPartCost(srv, partIfsInventory); |
|
|
log.info("[getInventoryPartCost] IFS response - resultCode: {}, obj: {}, resultMsg: {}", |
|
|
|
|
|
costResponse.get("resultCode"), costResponse.get("obj"), costResponse.get("resultMsg")); |
|
|
|
|
|
if ("200".equals(costResponse.get("resultCode"))) { |
|
|
if ("200".equals(costResponse.get("resultCode"))) { |
|
|
PartIfsInventoryConfig config = JSONObject.parseObject(costResponse.get("obj"), PartIfsInventoryConfig.class); |
|
|
PartIfsInventoryConfig config = JSONObject.parseObject(costResponse.get("obj"), PartIfsInventoryConfig.class); |
|
|
log.info("[getInventoryPartCost] SUCCESS - estimatedMaterialCost: {}, configurationId: {}", |
|
|
|
|
|
config.getEstimatedMaterialCost(), config.getConfigurationId()); |
|
|
|
|
|
result.put("estimatedMaterialCost", config.getEstimatedMaterialCost()); |
|
|
result.put("estimatedMaterialCost", config.getEstimatedMaterialCost()); |
|
|
} else { |
|
|
} else { |
|
|
log.error("[getInventoryPartCost] IFS call failed - site: {}, partNo: {}, error: {}", |
|
|
|
|
|
inData.getSite(), inData.getPartNo(), costResponse.get("resultMsg")); |
|
|
|
|
|
result.put("estimatedMaterialCost", null); |
|
|
result.put("estimatedMaterialCost", null); |
|
|
} |
|
|
} |
|
|
log.info("[getInventoryPartCost] END - result: {}", result); |
|
|
|
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|