diff --git a/src/main/java/com/spring/modules/part/controller/PartInformationController.java b/src/main/java/com/spring/modules/part/controller/PartInformationController.java index 70ac8244..c175768c 100644 --- a/src/main/java/com/spring/modules/part/controller/PartInformationController.java +++ b/src/main/java/com/spring/modules/part/controller/PartInformationController.java @@ -878,4 +878,16 @@ public class PartInformationController { @RequestParam(required = false, defaultValue = "") String fieldName) { return R.ok().put("rows", partInformationService.queryFieldChangeLog(site, partNo, fieldName)); } + + /** + * 查询物料的 estimatedMaterialCost(仅编辑模式调用) + * @param inData + * @return + */ + @PostMapping("/getInventoryPartCost") + @ResponseBody + public R getInventoryPartCost(@RequestBody InventoryPartUnitCostSumEntity inData) { + Map result = partInformationService.getInventoryPartCost(inData); + return R.ok().put("rows", result); + } } diff --git a/src/main/java/com/spring/modules/part/service/PartInformationService.java b/src/main/java/com/spring/modules/part/service/PartInformationService.java index 694183ff..ebfed3c8 100644 --- a/src/main/java/com/spring/modules/part/service/PartInformationService.java +++ b/src/main/java/com/spring/modules/part/service/PartInformationService.java @@ -183,4 +183,6 @@ public interface PartInformationService { * @param fieldName 字段名,传空字符串则查两个字段 */ List queryFieldChangeLog(String site, String partNo, String fieldName); + + Map getInventoryPartCost(InventoryPartUnitCostSumEntity inData); } diff --git a/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java b/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java index 635d0984..a3ed108e 100644 --- a/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java +++ b/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java @@ -4057,6 +4057,51 @@ public class PartInformationServiceImpl extends ServiceImpl getInventoryPartCost(InventoryPartUnitCostSumEntity inData) { + log.info("[getInventoryPartCost] START - site: {}, partNo: {}, userName: {}", + inData.getSite(), inData.getPartNo(), inData.getUserName()); + Map result = new HashMap<>(); + PartInformationEntity partData = partInformationMapper.selectOne( + new QueryWrapper().eq("site", inData.getSite()).eq("part_no", inData.getPartNo())); + if (partData == null) { + log.warn("[getInventoryPartCost] Part not found in PLM - site: {}, partNo: {}", inData.getSite(), inData.getPartNo()); + result.put("estimatedMaterialCost", null); + return result; + } + log.info("[getInventoryPartCost] Part found - site: {}, partNo: {}, status: {}", inData.getSite(), inData.getPartNo(), 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); + return result; + } + log.info("[getInventoryPartCost] Part is official, fetching IFS server for user: {}", inData.getUserName()); + Server srv = getIfsServer(inData.getUserName()); + PartIfsInventory partIfsInventory = new PartIfsInventory(); + partIfsInventory.setContract(inData.getSite()); + partIfsInventory.setPartNo(inData.getPartNo()); + log.info("[getInventoryPartCost] Calling IFS getInventoryPartCost - contract: {}, partNo: {}", inData.getSite(), inData.getPartNo()); + Map 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"))) { + PartIfsInventoryConfig config = JSONObject.parseObject(costResponse.get("obj"), PartIfsInventoryConfig.class); + log.info("[getInventoryPartCost] SUCCESS - estimatedMaterialCost: {}, configurationId: {}", + config.getEstimatedMaterialCost(), config.getConfigurationId()); + result.put("estimatedMaterialCost", config.getEstimatedMaterialCost()); + } else { + log.error("[getInventoryPartCost] IFS call failed - site: {}, partNo: {}, error: {}", + inData.getSite(), inData.getPartNo(), costResponse.get("resultMsg")); + result.put("estimatedMaterialCost", null); + } + log.info("[getInventoryPartCost] END - result: {}", result); + return result; + } + /** * 同步 unitValue 到PLM */ diff --git a/src/main/java/com/spring/modules/quote/entity/Quote.java b/src/main/java/com/spring/modules/quote/entity/Quote.java index aa75b287..d976ceb7 100644 --- a/src/main/java/com/spring/modules/quote/entity/Quote.java +++ b/src/main/java/com/spring/modules/quote/entity/Quote.java @@ -116,9 +116,9 @@ public class Quote extends QueryPage { private Integer rejectStepId; /** - * 项目年销售额>100M + * 项目年销售额CNY(K) */ - private String annualSales; + private BigDecimal annualSales; /** * ------------------(额外字段)---------------------- diff --git a/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java b/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java index 7e4cc205..5ace98c3 100644 --- a/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java +++ b/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java @@ -540,7 +540,7 @@ public class QuoteServiceImpl extends ServiceImpl implements Quote updateQuote = new Quote(); updateQuote.setId(quote.getId()); // 只更新需要的字段 - if (!StringUtils.isEmpty(quote.getAnnualSales())) { + if (quote.getAnnualSales() != null) { updateQuote.setAnnualSales(quote.getAnnualSales()); } // 可以根据需要添加其他需要更新的字段