diff --git a/src/main/java/com/spring/modules/part/service/impl/BomManagementServiceImpl.java b/src/main/java/com/spring/modules/part/service/impl/BomManagementServiceImpl.java index 4019f35b..32d86503 100644 --- a/src/main/java/com/spring/modules/part/service/impl/BomManagementServiceImpl.java +++ b/src/main/java/com/spring/modules/part/service/impl/BomManagementServiceImpl.java @@ -508,12 +508,12 @@ public class BomManagementServiceImpl extends ServiceImpl buildBomDetailResponse = bomServiceBean.buildBomAlternative(srv, bomIfsDetail); if (!"200".equals(buildBomDetailResponse.get("resultCode"))) { - throw new RuntimeException("ifs BomAlternative Build异常:" + buildBomDetailResponse.get("resultMsg")); + throw new RuntimeException("IFS BomAlternative Build异常:" + buildBomDetailResponse.get("resultMsg")); } } else if ("Obsolete".equals(data.getStatus())) { // 状态修改为Obsolete Map retireBomDetailResponse = bomServiceBean.retireBomAlternative(srv, bomIfsDetail); if (!"200".equals(retireBomDetailResponse.get("resultCode"))) { - throw new RuntimeException("ifs BomAlternative Retire异常:" + retireBomDetailResponse.get("resultMsg")); + throw new RuntimeException("IFS BomAlternative Retire异常:" + retireBomDetailResponse.get("resultMsg")); } } } @@ -1140,25 +1140,25 @@ public class BomManagementServiceImpl extends ServiceImpl componentList = bomManagementMapper.getBomComponent(data); + if (!componentList.isEmpty()) { + Map addBomComponentResponse = bomServiceBean.syncBomItems(srv, componentList); + if (!"200".equals(addBomComponentResponse.get("resultCode"))) { + throw new RuntimeException("IFS Bom子物料新增异常:" + addBomComponentResponse.get("resultMsg")); + } + } + // 2025-05-12 调用下状态的接口 if ("Buildable".equals(data.getStatus())) { // 状态修改为buildable Map buildBomDetailResponse = bomServiceBean.buildBomAlternative(srv, bomIfsAlternative); if (!"200".equals(buildBomDetailResponse.get("resultCode"))) { - throw new RuntimeException("ifs BomAlternative Build异常:" + buildBomDetailResponse.get("resultMsg")); + throw new RuntimeException("IFS BomAlternative Build异常:" + buildBomDetailResponse.get("resultMsg")); } } else if ("Obsolete".equals(data.getStatus())) { // 状态修改为Obsolete Map retireBomDetailResponse = bomServiceBean.retireBomAlternative(srv, bomIfsAlternative); if (!"200".equals(retireBomDetailResponse.get("resultCode"))) { - throw new RuntimeException("ifs BomAlternative Retire异常:" + retireBomDetailResponse.get("resultMsg")); - } - } - - // 同步bomComponent - List componentList = bomManagementMapper.getBomComponent(data); - if (!componentList.isEmpty()) { - Map addBomComponentResponse = bomServiceBean.syncBomItems(srv, componentList); - if (!"200".equals(addBomComponentResponse.get("resultCode"))) { - throw new RuntimeException("IFS Bom子物料新增异常:" + addBomComponentResponse.get("resultMsg")); + throw new RuntimeException("IFS BomAlternative Retire异常:" + retireBomDetailResponse.get("resultMsg")); } } } 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 56554955..5885c0ef 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 @@ -2811,18 +2811,18 @@ public class PartInformationServiceImpl extends ServiceImpl getRecipeDetailResponse = recipeServiceBean.getRecipeAlternative(srv, recipeIfsAlternative); if (!"200".equals(getRecipeDetailResponse.get("resultCode"))) { // 新增 Map addRecipeDetailResponse = recipeServiceBean.syncRecipeAlternative(srv, recipeIfsAlternative); @@ -2835,30 +2835,45 @@ public class PartInformationServiceImpl extends ServiceImpl ifsRecipeComponentList = componentDataList.stream().map(c -> { - c.setPartNo(ifsPart.getPartNo()); - c.setAlternativeNo(recipeDetail.getAlternativeNo()); - return c; - }).collect(Collectors.toList()); - recipeManagementMapper.saveRecipeComponents(ifsRecipeComponentList); - // 同步数据到 IFS - if (dataUrl) { - recipe.setPartNo(ifsPart.getPartNo()); - recipe.setAlternativeNo(recipeDetail.getAlternativeNo()); - List componentList = recipeManagementMapper.getRecipeComponent(recipe); - if (!componentList.isEmpty()) { - for (RecipeIfsItem item : componentList) { - Map addRecipeComponentResponse = recipeServiceBean.syncRecipeItem(srv, item); - if (!"200".equals(addRecipeComponentResponse.get("resultCode"))) { - throw new RuntimeException("IFS Recipe子物料新增异常:" + addRecipeComponentResponse.get("resultMsg")); - } + } + // 创建 IFS 物料 Recipe 的 子物料 + if (!componentDataList.isEmpty()) { + List ifsRecipeComponentList = componentDataList.stream().map(c -> { + c.setPartNo(ifsPart.getPartNo()); + c.setAlternativeNo(recipeDetail.getAlternativeNo()); + return c; + }).collect(Collectors.toList()); + recipeManagementMapper.saveRecipeComponents(ifsRecipeComponentList); + // 同步数据到 IFS + if (dataUrl) { + recipe.setPartNo(ifsPart.getPartNo()); + recipe.setAlternativeNo(recipeDetail.getAlternativeNo()); + List componentList = recipeManagementMapper.getRecipeComponent(recipe); + if (!componentList.isEmpty()) { + for (RecipeIfsItem item : componentList) { + Map addRecipeComponentResponse = recipeServiceBean.syncRecipeItem(srv, item); + if (!"200".equals(addRecipeComponentResponse.get("resultCode"))) { + throw new RuntimeException("IFS Recipe子物料新增异常:" + addRecipeComponentResponse.get("resultMsg")); } } } } } + + if (dataUrl) { + // 2025-05-27 调用下状态的接口 + if ("Buildable".equals(recipeDetail.getStatus())) { // 状态修改为buildable + Map buildRecipeDetailResponse = recipeServiceBean.buildRecipeAlternative(srv, recipeIfsAlternative); + if (!"200".equals(buildRecipeDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RecipeAlternative Build异常:" + buildRecipeDetailResponse.get("resultMsg")); + } + } else if ("Obsolete".equals(recipeDetail.getStatus())) { // 状态修改为Obsolete + Map retireRecipeDetailResponse = recipeServiceBean.retireRecipeAlternative(srv, recipeIfsAlternative); + if (!"200".equals(retireRecipeDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RecipeAlternative Retire异常:" + retireRecipeDetailResponse.get("resultMsg")); + } + } + } } } else { for (BomDetailVo bomDetailVo : bomAlternativeList) { @@ -2873,15 +2888,15 @@ public class PartInformationServiceImpl extends ServiceImpl getBomDetailResponse = bomServiceBean.getBomAlternative(srv, bomIfsAlternative); if (!"200".equals(getBomDetailResponse.get("resultCode"))) { // 新增 Map addBomDetailResponse = bomServiceBean.syncBomAlternative(srv, bomIfsAlternative); @@ -2925,25 +2940,42 @@ public class PartInformationServiceImpl extends ServiceImpl bomIfsManufStructCostDistribs = new ArrayList<>(); - for (BomManufStructCostDistribVo bomManufStructCostDistribVo : collect1) { - BomIfsManufStructCostDistrib bomIfsManufStructCostDistrib = new BomIfsManufStructCostDistrib(); - bomIfsManufStructCostDistrib.setContract(bomManufStructCostDistribVo.getSite()); - bomIfsManufStructCostDistrib.setPartNo(bomManufStructCostDistribVo.getPartNo()); - bomIfsManufStructCostDistrib.setEngChgLevel(bomManufStructCostDistribVo.getEngChgLevel().toString()); - bomIfsManufStructCostDistrib.setBomType(bomManufStructCostDistribVo.getBomType()); - bomIfsManufStructCostDistrib.setAlternativeNo(bomManufStructCostDistribVo.getAlternativeNo()); - bomIfsManufStructCostDistrib.setByProdLineItemNo(bomManufStructCostDistribVo.getByProdLineItemNo().toString()); - bomIfsManufStructCostDistrib.setComponentLineItemNo(bomManufStructCostDistribVo.getComponentLineItemNo().toString()); - bomIfsManufStructCostDistrib.setItemCostDistribution(bomManufStructCostDistribVo.getItemCostDistribution() == null ? "" : bomManufStructCostDistribVo.getItemCostDistribution().toString()); - bomIfsManufStructCostDistrib.setComponentPartNo(bomManufStructCostDistribVo.getComponentPartNo()); - bomIfsManufStructCostDistrib.setByProductPartNo(bomManufStructCostDistribVo.getByProdPartNo()); - bomIfsManufStructCostDistribs.add(bomIfsManufStructCostDistrib); + if (dataUrl) { + // 更新ifs的副产品成本分配数据 + List bomIfsManufStructCostDistribs = new ArrayList<>(); + for (BomManufStructCostDistribVo bomManufStructCostDistribVo : collect1) { + BomIfsManufStructCostDistrib bomIfsManufStructCostDistrib = new BomIfsManufStructCostDistrib(); + bomIfsManufStructCostDistrib.setContract(bomManufStructCostDistribVo.getSite()); + bomIfsManufStructCostDistrib.setPartNo(bomManufStructCostDistribVo.getPartNo()); + bomIfsManufStructCostDistrib.setEngChgLevel(bomManufStructCostDistribVo.getEngChgLevel().toString()); + bomIfsManufStructCostDistrib.setBomType(bomManufStructCostDistribVo.getBomType()); + bomIfsManufStructCostDistrib.setAlternativeNo(bomManufStructCostDistribVo.getAlternativeNo()); + bomIfsManufStructCostDistrib.setByProdLineItemNo(bomManufStructCostDistribVo.getByProdLineItemNo().toString()); + bomIfsManufStructCostDistrib.setComponentLineItemNo(bomManufStructCostDistribVo.getComponentLineItemNo().toString()); + bomIfsManufStructCostDistrib.setItemCostDistribution(bomManufStructCostDistribVo.getItemCostDistribution() == null ? "" : bomManufStructCostDistribVo.getItemCostDistribution().toString()); + bomIfsManufStructCostDistrib.setComponentPartNo(bomManufStructCostDistribVo.getComponentPartNo()); + bomIfsManufStructCostDistrib.setByProductPartNo(bomManufStructCostDistribVo.getByProdPartNo()); + bomIfsManufStructCostDistribs.add(bomIfsManufStructCostDistrib); + } + Map updateBomManufStructCostDistribResponse = bomServiceBean.modifyBomDistributions(srv, bomIfsManufStructCostDistribs); + if (!"200".equals(updateBomManufStructCostDistribResponse.get("resultCode"))) { + throw new RuntimeException("IFS Bom副产品成本分配修改异常:" + updateBomManufStructCostDistribResponse.get("resultMsg")); + } } - Map updateBomManufStructCostDistribResponse = bomServiceBean.modifyBomDistributions(srv, bomIfsManufStructCostDistribs); - if (!"200".equals(updateBomManufStructCostDistribResponse.get("resultCode"))) { - throw new RuntimeException("IFS Bom副产品成本分配修改异常:" + updateBomManufStructCostDistribResponse.get("resultMsg")); + } + + if (dataUrl) { + // 2025-05-12 调用下状态的接口 + if ("Buildable".equals(bomDetail.getStatus())) { // 状态修改为buildable + Map buildBomDetailResponse = bomServiceBean.buildBomAlternative(srv, bomIfsAlternative); + if (!"200".equals(buildBomDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS BomAlternative Build异常:" + buildBomDetailResponse.get("resultMsg")); + } + } else if ("Obsolete".equals(bomDetail.getStatus())) { // 状态修改为Obsolete + Map retireBomDetailResponse = bomServiceBean.retireBomAlternative(srv, bomIfsAlternative); + if (!"200".equals(retireBomDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS BomAlternative Retire异常:" + retireBomDetailResponse.get("resultMsg")); + } } } } @@ -2994,8 +3026,8 @@ public class PartInformationServiceImpl extends ServiceImpl getRoutingDetailResponse = routingServiceBean.getRoutingAlternative(srv, routingIfsAlternative); if (!"200".equals(getRoutingDetailResponse.get("resultCode"))) { // 新增 Map addRoutingDetailResponse = routingServiceBean.syncRoutingAlternative(srv, routingIfsAlternative); @@ -3096,6 +3128,21 @@ public class PartInformationServiceImpl extends ServiceImpl buildRoutingDetailResponse = routingServiceBean.buildRoutingAlternative(srv, routingIfsAlternative); + if (!"200".equals(buildRoutingDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingAlternative Build异常:" + buildRoutingDetailResponse.get("resultMsg")); + } + } else if ("Obsolete".equals(routingDetailEntity.getStatus())) { // 状态修改为Obsolete + Map retireRoutingDetailResponse = routingServiceBean.retireRoutingAlternative(srv, routingIfsAlternative); + if (!"200".equals(retireRoutingDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingAlternative Retire异常:" + retireRoutingDetailResponse.get("resultMsg")); + } + } + } } } } diff --git a/src/main/java/com/spring/modules/part/service/impl/RecipeManagementServiceImpl.java b/src/main/java/com/spring/modules/part/service/impl/RecipeManagementServiceImpl.java index 5d44f1d0..eb6d1f5a 100644 --- a/src/main/java/com/spring/modules/part/service/impl/RecipeManagementServiceImpl.java +++ b/src/main/java/com/spring/modules/part/service/impl/RecipeManagementServiceImpl.java @@ -1192,6 +1192,19 @@ public class RecipeManagementServiceImpl extends ServiceImpl buildRecipeDetailResponse = recipeServiceBean.buildRecipeAlternative(srv, recipeIfsAlternative); + if (!"200".equals(buildRecipeDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RecipeAlternative Build异常:" + buildRecipeDetailResponse.get("resultMsg")); + } + } else if ("Obsolete".equals(data.getStatus())) { // 状态修改为Obsolete + Map retireRecipeDetailResponse = recipeServiceBean.retireRecipeAlternative(srv, recipeIfsAlternative); + if (!"200".equals(retireRecipeDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RecipeAlternative Retire异常:" + retireRecipeDetailResponse.get("resultMsg")); + } + } } }