From d989042c57ed679028859f70429b13355734b8cf Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Thu, 19 Mar 2026 14:07:46 +0800 Subject: [PATCH] =?UTF-8?q?2026-03-19=201=E3=80=81=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=89=A9=E6=96=99=E6=88=90=E6=9C=AC=E6=97=B6=EF=BC=8C=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E6=8A=93=E5=8F=96Estimated=20Material=20Cost=E6=88=90?= =?UTF-8?q?=E6=9C=AC=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=8F=8D=E5=88=B7=E5=88=B0?= =?UTF-8?q?PLM=202=E3=80=81=E5=8F=96=E6=B6=88=E5=8B=BE=E9=80=89=E6=A1=86?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=95=B0=E5=AD=97=E5=BD=95=E5=85=A5?= =?UTF-8?q?=E6=A1=86=EF=BC=8C=E9=9C=80=E8=A6=81=E4=BC=A0=E8=BE=93=E5=88=B0?= =?UTF-8?q?OA=20=20=20=E5=B1=95=E7=A4=BA=E5=88=B0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=90=8E=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PartInformationController.java | 12 +++++ .../part/service/PartInformationService.java | 2 + .../impl/PartInformationServiceImpl.java | 45 +++++++++++++++++++ .../spring/modules/quote/entity/Quote.java | 4 +- .../quote/service/impl/QuoteServiceImpl.java | 2 +- 5 files changed, 62 insertions(+), 3 deletions(-) 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()); } // 可以根据需要添加其他需要更新的字段