|
@@ -127,6 +127,8 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
|
|
private ProcessInstService processInstService;
|
|
private ProcessInstService processInstService;
|
|
@Resource
|
|
@Resource
|
|
private CXAdminFeginClient cxAdminFeginClient;
|
|
private CXAdminFeginClient cxAdminFeginClient;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ApsProductionTechnicalRequirementService apsProductionTechnicalRequirementService;
|
|
|
|
|
|
|
|
|
|
public static final String ERROR_MSG = "%s上诉订单的排程交货期大于承诺交货期";
|
|
public static final String ERROR_MSG = "%s上诉订单的排程交货期大于承诺交货期";
|
|
@@ -331,6 +333,76 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
+ //==========校验订单技术要求============
|
|
|
|
+ /**
|
|
|
|
+ * 如果技术要求的订单产品在产品明细中不存在,错误提示:技术要求的订单产品{订单产品}已删除或已变更,请重新选择该技术要求的订单产品
|
|
|
|
+ * 如果有产品明细没有技术要求,错误提示:请填写{订单产品1},{订单产品2}的技术要求
|
|
|
|
+ * 如果合金成分要求为空,错误提示:请加载合金成分要求
|
|
|
|
+ * 校验所有坯料输出成品合金成分
|
|
|
|
+ * 如果坯料输出成品没有替代合金,并且合金没有加载合金成分要求,错误提示:{合金}合金成分要求没有加载
|
|
|
|
+ * 如果坯料输出成品有替代合金,并且替代合金没有加载合金成分要求,错误提示:{合金}替代合金成分要求没有加载
|
|
|
|
+ * 如果合金有多个合金成分要求,错误提示:{合金}合金成分要求不能有多个
|
|
|
|
+ */
|
|
|
|
+ //已有的产品明细的ID集合
|
|
|
|
+ List<String> nowOrderDetailIdList = apsProductDetailVoList.stream().map(ApsProductDetailVo::getId).collect(Collectors.toList());
|
|
|
|
+ //查询技术要求
|
|
|
|
+ List<ApsProductionTechnicalRequirementDo> apsProductionTechnicalRequirementDoList = apsProductionTechnicalRequirementService.list(new LambdaQueryWrapper<ApsProductionTechnicalRequirementDo>().eq(ApsProductionTechnicalRequirementDo::getOrderid, id));
|
|
|
|
+ //技术要求对应的产品明细ID集合
|
|
|
|
+ List<String> technicalHaveDetailIdList = new LinkedList<>();
|
|
|
|
+ for (ApsProductionTechnicalRequirementDo apsProductionTechnicalRequirementDo : apsProductionTechnicalRequirementDoList) {
|
|
|
|
+ if (ObjectUtil.isNotEmpty(apsProductionTechnicalRequirementDo.getOrderdetailids())) {
|
|
|
|
+ String[] split1 = apsProductionTechnicalRequirementDo.getOrderdetailids().split(",");
|
|
|
|
+ technicalHaveDetailIdList.addAll(Arrays.asList(split1));
|
|
|
|
+ String[] split2 = apsProductionTechnicalRequirementDo.getOrderdetailnames().split(",");
|
|
|
|
+ for (int i = 0; i < split1.length; i++) {
|
|
|
|
+ String orderDetailId = split1[i];
|
|
|
|
+ if (!nowOrderDetailIdList.contains(orderDetailId)) {
|
|
|
|
+ return R.error("技术要求的订单产品" + split2[i] + "已删除或已变更,请重新选择该技术要求的订单产品");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (String nowOrderDetailId : nowOrderDetailIdList) {
|
|
|
|
+ if (!technicalHaveDetailIdList.contains(nowOrderDetailId)) {
|
|
|
|
+ ApsProductDetailVo apsProductDetailVo = apsProductDetailVoList.stream().filter(item -> item.getId().equals(nowOrderDetailId)).findFirst().orElse(null);
|
|
|
|
+ return R.error("请填写" + apsProductDetailVo.getInputmaterialdescription() + "的技术要求");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<ApsOrderAlloyCompositionDo> apsOrderAlloyCompositionDoList = apsOrderAlloyCompositionService.list(new LambdaQueryWrapper<ApsOrderAlloyCompositionDo>().eq(ApsOrderAlloyCompositionDo::getProductionorderid, id));
|
|
|
|
+ if (ObjectUtil.isEmpty(apsOrderAlloyCompositionDoList)) {
|
|
|
|
+ return R.error("请加载合金成分要求");
|
|
|
|
+ }
|
|
|
|
+ List<String> productDetailAlloyList = apsProductDetailVoList.stream().map(ApsProductDetailVo::getAlloy).collect(Collectors.toList());
|
|
|
|
+ for (String productDetailAlloy : productDetailAlloyList) {
|
|
|
|
+ if (ObjectUtil.isEmpty(apsOrderAlloyCompositionDoList.stream().filter(item -> item.getAlloy().equals(productDetailAlloy)).findFirst().orElse(null))) {
|
|
|
|
+ return R.error(productDetailAlloy + "合金成分要求没有加载");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<String> changeAlloyList = this.baseMapper.selectChangeAlloyByOrderId(id);
|
|
|
|
+ for (String changeAlloy : changeAlloyList) {
|
|
|
|
+ if (ObjectUtil.isEmpty(apsOrderAlloyCompositionDoList.stream().filter(item -> item.getAlloy().equals(changeAlloy)).findFirst().orElse(null))) {
|
|
|
|
+ return R.error(changeAlloy + "替代合金成分要求没有加载");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String, Integer> alloyCountMap = new HashMap<>();
|
|
|
|
+ apsOrderAlloyCompositionDoList.forEach(item -> {
|
|
|
|
+ if (alloyCountMap.containsKey(item.getAlloy())) {
|
|
|
|
+ alloyCountMap.put(item.getAlloy(), alloyCountMap.get(item.getAlloy()) + 1);
|
|
|
|
+ } else {
|
|
|
|
+ alloyCountMap.put(item.getAlloy(), 1);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ for (String key : alloyCountMap.keySet()) {
|
|
|
|
+ if (alloyCountMap.get(key) > 1) {
|
|
|
|
+ return R.error(key + "合金成分要求不能有多个");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 校验每个订单产品
|
|
* 校验每个订单产品
|
|
* 如果订单产品暂不评审=否,并且坯料计划输出总重量 = 0,则错误提示:订单产品 {输入物料描述}坯料计划未填写
|
|
* 如果订单产品暂不评审=否,并且坯料计划输出总重量 = 0,则错误提示:订单产品 {输入物料描述}坯料计划未填写
|