Browse Source

2025-05-27

同步时,Bom、Routing的状态没有同步过去
master
fengyuan_yang 8 months ago
parent
commit
023784d516
  1. 26
      src/main/java/com/spring/modules/part/service/impl/BomManagementServiceImpl.java
  2. 161
      src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java
  3. 13
      src/main/java/com/spring/modules/part/service/impl/RecipeManagementServiceImpl.java

26
src/main/java/com/spring/modules/part/service/impl/BomManagementServiceImpl.java

@ -508,12 +508,12 @@ public class BomManagementServiceImpl extends ServiceImpl<BomManagementMapper, B
if ("Buildable".equals(data.getStatus())) { // 状态修改为buildable if ("Buildable".equals(data.getStatus())) { // 状态修改为buildable
Map<String, String> buildBomDetailResponse = bomServiceBean.buildBomAlternative(srv, bomIfsDetail); Map<String, String> buildBomDetailResponse = bomServiceBean.buildBomAlternative(srv, bomIfsDetail);
if (!"200".equals(buildBomDetailResponse.get("resultCode"))) { 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 } else if ("Obsolete".equals(data.getStatus())) { // 状态修改为Obsolete
Map<String, String> retireBomDetailResponse = bomServiceBean.retireBomAlternative(srv, bomIfsDetail); Map<String, String> retireBomDetailResponse = bomServiceBean.retireBomAlternative(srv, bomIfsDetail);
if (!"200".equals(retireBomDetailResponse.get("resultCode"))) { 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<BomManagementMapper, B
} }
} }
// 同步bomComponent
List<BomIfsItem> componentList = bomManagementMapper.getBomComponent(data);
if (!componentList.isEmpty()) {
Map<String, String> addBomComponentResponse = bomServiceBean.syncBomItems(srv, componentList);
if (!"200".equals(addBomComponentResponse.get("resultCode"))) {
throw new RuntimeException("IFS Bom子物料新增异常:" + addBomComponentResponse.get("resultMsg"));
}
}
// 2025-05-12 调用下状态的接口 // 2025-05-12 调用下状态的接口
if ("Buildable".equals(data.getStatus())) { // 状态修改为buildable if ("Buildable".equals(data.getStatus())) { // 状态修改为buildable
Map<String, String> buildBomDetailResponse = bomServiceBean.buildBomAlternative(srv, bomIfsAlternative); Map<String, String> buildBomDetailResponse = bomServiceBean.buildBomAlternative(srv, bomIfsAlternative);
if (!"200".equals(buildBomDetailResponse.get("resultCode"))) { 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 } else if ("Obsolete".equals(data.getStatus())) { // 状态修改为Obsolete
Map<String, String> retireBomDetailResponse = bomServiceBean.retireBomAlternative(srv, bomIfsAlternative); Map<String, String> retireBomDetailResponse = bomServiceBean.retireBomAlternative(srv, bomIfsAlternative);
if (!"200".equals(retireBomDetailResponse.get("resultCode"))) { if (!"200".equals(retireBomDetailResponse.get("resultCode"))) {
throw new RuntimeException("ifs BomAlternative Retire异常:" + retireBomDetailResponse.get("resultMsg"));
}
}
// 同步bomComponent
List<BomIfsItem> componentList = bomManagementMapper.getBomComponent(data);
if (!componentList.isEmpty()) {
Map<String, String> 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"));
} }
} }
} }

161
src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java

@ -2811,18 +2811,18 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
recipeDetail.setOfficialFlag("Y"); recipeDetail.setOfficialFlag("Y");
recipeManagementMapper.recipeDetailSave(recipeDetail); recipeManagementMapper.recipeDetailSave(recipeDetail);
// 同步数据到 IFS // 同步数据到 IFS
RecipeIfsAlternative recipeIfsAlternative = new RecipeIfsAlternative();
recipeIfsAlternative.setContract(recipeDetail.getSite());
recipeIfsAlternative.setPartNo(recipeDetail.getPartNo());
recipeIfsAlternative.setEngChgLevel(recipeDetail.getEngChgLevel().toString());
recipeIfsAlternative.setBomType(recipeDetail.getBomType());
recipeIfsAlternative.setAlternativeNo(recipeDetail.getAlternativeNo());
recipeIfsAlternative.setAlternativeDesc(recipeDetail.getAlternativeDescription());
recipeIfsAlternative.setNoteText(recipeDetail.getDetailNoteText());
recipeIfsAlternative.setDisplayWeightUom(recipeDetail.getDisplayWeightUom());
recipeIfsAlternative.setDisplayVolumeUom(recipeDetail.getDisplayVolumeUom());
recipeIfsAlternative.setRegUnit(recipeDetail.getRegUnit());
if (dataUrl) { if (dataUrl) {
RecipeIfsAlternative recipeIfsAlternative = new RecipeIfsAlternative();
recipeIfsAlternative.setContract(recipeDetail.getSite());
recipeIfsAlternative.setPartNo(recipeDetail.getPartNo());
recipeIfsAlternative.setEngChgLevel(recipeDetail.getEngChgLevel().toString());
recipeIfsAlternative.setBomType(recipeDetail.getBomType());
recipeIfsAlternative.setAlternativeNo(recipeDetail.getAlternativeNo());
recipeIfsAlternative.setAlternativeDesc(recipeDetail.getAlternativeDescription());
recipeIfsAlternative.setNoteText(recipeDetail.getDetailNoteText());
recipeIfsAlternative.setDisplayWeightUom(recipeDetail.getDisplayWeightUom());
recipeIfsAlternative.setDisplayVolumeUom(recipeDetail.getDisplayVolumeUom());
recipeIfsAlternative.setRegUnit(recipeDetail.getRegUnit());
Map<String, String> getRecipeDetailResponse = recipeServiceBean.getRecipeAlternative(srv, recipeIfsAlternative); Map<String, String> getRecipeDetailResponse = recipeServiceBean.getRecipeAlternative(srv, recipeIfsAlternative);
if (!"200".equals(getRecipeDetailResponse.get("resultCode"))) { // 新增 if (!"200".equals(getRecipeDetailResponse.get("resultCode"))) { // 新增
Map<String, String> addRecipeDetailResponse = recipeServiceBean.syncRecipeAlternative(srv, recipeIfsAlternative); Map<String, String> addRecipeDetailResponse = recipeServiceBean.syncRecipeAlternative(srv, recipeIfsAlternative);
@ -2835,30 +2835,45 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
throw new RuntimeException("IFS RecipeAlternative修改异常:" + updateRecipeDetailResponse.get("resultMsg")); throw new RuntimeException("IFS RecipeAlternative修改异常:" + updateRecipeDetailResponse.get("resultMsg"));
} }
} }
// 创建 IFS 物料 Recipe 子物料
if (!componentDataList.isEmpty()) {
List<RecipeComponentVo> 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<RecipeIfsItem> componentList = recipeManagementMapper.getRecipeComponent(recipe);
if (!componentList.isEmpty()) {
for (RecipeIfsItem item : componentList) {
Map<String, String> 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<RecipeComponentVo> 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<RecipeIfsItem> componentList = recipeManagementMapper.getRecipeComponent(recipe);
if (!componentList.isEmpty()) {
for (RecipeIfsItem item : componentList) {
Map<String, String> 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<String, String> 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<String, String> retireRecipeDetailResponse = recipeServiceBean.retireRecipeAlternative(srv, recipeIfsAlternative);
if (!"200".equals(retireRecipeDetailResponse.get("resultCode"))) {
throw new RuntimeException("IFS RecipeAlternative Retire异常:" + retireRecipeDetailResponse.get("resultMsg"));
}
}
}
} }
} else { } else {
for (BomDetailVo bomDetailVo : bomAlternativeList) { for (BomDetailVo bomDetailVo : bomAlternativeList) {
@ -2873,15 +2888,15 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
bomDetail.setOfficialFlag("Y"); bomDetail.setOfficialFlag("Y");
bomManagementMapper.bomDetailSave(bomDetail); bomManagementMapper.bomDetailSave(bomDetail);
// 同步数据到 IFS // 同步数据到 IFS
BomIfsAlternative bomIfsAlternative = new BomIfsAlternative();
bomIfsAlternative.setContract(bomDetail.getSite());
bomIfsAlternative.setPartNo(bomDetail.getPartNo());
bomIfsAlternative.setEngChgLevel(bomDetail.getEngChgLevel().toString());
bomIfsAlternative.setBomType(bomDetail.getBomType());
bomIfsAlternative.setAlternativeNo(bomDetail.getAlternativeNo());
bomIfsAlternative.setAlternativeDesc(bomDetail.getAlternativeDescription());
bomIfsAlternative.setNoteText(bomDetail.getDetailNoteText());
if (dataUrl) { if (dataUrl) {
BomIfsAlternative bomIfsAlternative = new BomIfsAlternative();
bomIfsAlternative.setContract(bomDetail.getSite());
bomIfsAlternative.setPartNo(bomDetail.getPartNo());
bomIfsAlternative.setEngChgLevel(bomDetail.getEngChgLevel().toString());
bomIfsAlternative.setBomType(bomDetail.getBomType());
bomIfsAlternative.setAlternativeNo(bomDetail.getAlternativeNo());
bomIfsAlternative.setAlternativeDesc(bomDetail.getAlternativeDescription());
bomIfsAlternative.setNoteText(bomDetail.getDetailNoteText());
Map<String, String> getBomDetailResponse = bomServiceBean.getBomAlternative(srv, bomIfsAlternative); Map<String, String> getBomDetailResponse = bomServiceBean.getBomAlternative(srv, bomIfsAlternative);
if (!"200".equals(getBomDetailResponse.get("resultCode"))) { // 新增 if (!"200".equals(getBomDetailResponse.get("resultCode"))) { // 新增
Map<String, String> addBomDetailResponse = bomServiceBean.syncBomAlternative(srv, bomIfsAlternative); Map<String, String> addBomDetailResponse = bomServiceBean.syncBomAlternative(srv, bomIfsAlternative);
@ -2925,25 +2940,42 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
return b; return b;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
bomManagementMapper.saveBomManufStructCostDistrib(collect1); bomManagementMapper.saveBomManufStructCostDistrib(collect1);
// 更新ifs的副产品成本分配数据
List<BomIfsManufStructCostDistrib> 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<BomIfsManufStructCostDistrib> 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<String, String> updateBomManufStructCostDistribResponse = bomServiceBean.modifyBomDistributions(srv, bomIfsManufStructCostDistribs);
if (!"200".equals(updateBomManufStructCostDistribResponse.get("resultCode"))) {
throw new RuntimeException("IFS Bom副产品成本分配修改异常:" + updateBomManufStructCostDistribResponse.get("resultMsg"));
}
} }
Map<String, String> 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<String, String> 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<String, String> 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<PartInformationMappe
routingDetailEntity.setOfficialFlag("Y"); routingDetailEntity.setOfficialFlag("Y");
routingManagementMapper.routingDetailSave(routingDetailEntity); routingManagementMapper.routingDetailSave(routingDetailEntity);
// 同步数据到 IFS // 同步数据到 IFS
RoutingIfsAlternative routingIfsAlternative = getIfsRoutingDetail(routingDetailEntity);
if (dataUrl) { if (dataUrl) {
RoutingIfsAlternative routingIfsAlternative = getIfsRoutingDetail(routingDetailEntity);
Map<String, String> getRoutingDetailResponse = routingServiceBean.getRoutingAlternative(srv, routingIfsAlternative); Map<String, String> getRoutingDetailResponse = routingServiceBean.getRoutingAlternative(srv, routingIfsAlternative);
if (!"200".equals(getRoutingDetailResponse.get("resultCode"))) { // 新增 if (!"200".equals(getRoutingDetailResponse.get("resultCode"))) { // 新增
Map<String, String> addRoutingDetailResponse = routingServiceBean.syncRoutingAlternative(srv, routingIfsAlternative); Map<String, String> addRoutingDetailResponse = routingServiceBean.syncRoutingAlternative(srv, routingIfsAlternative);
@ -3096,6 +3128,21 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
} }
} }
} }
if (dataUrl) {
// 2025-05-27 调用下状态的接口
if ("Buildable".equals(routingDetailEntity.getStatus())) { // 状态修改为buildable
Map<String, String> 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<String, String> retireRoutingDetailResponse = routingServiceBean.retireRoutingAlternative(srv, routingIfsAlternative);
if (!"200".equals(retireRoutingDetailResponse.get("resultCode"))) {
throw new RuntimeException("IFS RoutingAlternative Retire异常:" + retireRoutingDetailResponse.get("resultMsg"));
}
}
}
} }
} }
} }

13
src/main/java/com/spring/modules/part/service/impl/RecipeManagementServiceImpl.java

@ -1192,6 +1192,19 @@ public class RecipeManagementServiceImpl extends ServiceImpl<RecipeManagementMap
} }
} }
} }
// 2025-05-27 调用下状态的接口
if ("Buildable".equals(data.getStatus())) { // 状态修改为buildable
Map<String, String> 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<String, String> retireRecipeDetailResponse = recipeServiceBean.retireRecipeAlternative(srv, recipeIfsAlternative);
if (!"200".equals(retireRecipeDetailResponse.get("resultCode"))) {
throw new RuntimeException("IFS RecipeAlternative Retire异常:" + retireRecipeDetailResponse.get("resultMsg"));
}
}
} }
} }

Loading…
Cancel
Save