Bläddra i källkod

Merge remote-tracking branch 'origin/mode-min-unit' into mode-min-unit

xiahan 9 månader sedan
förälder
incheckning
b9cf9786be

+ 14 - 12
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java

@@ -2603,7 +2603,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         List<ApsProcessOutputProductDo> processOutputProductDoList = apsProcessOutputProductService.list(new QueryWrapper<ApsProcessOutputProductDo>().lambda().eq(ApsProcessOutputProductDo::getBlankid, blankId));
         if (processOutputProductDoList != null && processOutputProductDoList.size() > 0) {
             //获取所有输出成品的输出成品
-            List<String> outputFinishList = processOutputProductDoList.stream().map(ApsProcessOutputProductDo::getOutputresult).sorted(String::compareTo).collect(Collectors.toList());
+            List<String> outputFinishList = processOutputProductDoList.stream().filter(item -> ObjectUtil.isNotEmpty(item.getOutputresult())).map(ApsProcessOutputProductDo::getOutputresult).sorted(String::compareTo).collect(Collectors.toList());
             //================输出成品===============
             String outputFinishProduct = "";
 
@@ -2618,15 +2618,17 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
             //================输出订单产品=================
             String outputOrderProduct = "";
             //获取所有输出成品的输出订单产品
-            List<String> outputOrderProductList = processOutputProductDoList.stream().map(item -> {
-                String outputresult = item.getOutputresult();
-                String[] s = outputresult.split(" ");
-                String res = s[0] + " " + s[1];
-                if (ObjectUtil.isNotEmpty(item.getOutputonerollweigth()) && ObjectUtil.isNotEmpty(item.getPlanoutputrollcount())) {
-                    res = res + " " + CXCommonUtils.removeExtraZerosAndDecimal(item.getOutputonerollweigth()) + "吨 * " + item.getPlanoutputrollcount() + "卷 = " + CXCommonUtils.removeExtraZerosAndDecimal(item.getPlanoutputonerollweight());
-                }
-                return res;
-            }).sorted(String::compareTo).collect(Collectors.toList());
+            List<String> outputOrderProductList = processOutputProductDoList.stream()
+                    .filter(item -> ObjectUtil.isNotEmpty(item.getOutputresult()))
+                    .map(item -> {
+                        String outputresult = item.getOutputresult();
+                        String[] s = outputresult.split(" ");
+                        String res = s[0] + " " + s[1];
+                        if (ObjectUtil.isNotEmpty(item.getOutputonerollweigth()) && ObjectUtil.isNotEmpty(item.getPlanoutputrollcount())) {
+                            res = res + " " + CXCommonUtils.removeExtraZerosAndDecimal(item.getOutputonerollweigth()) + "吨 * " + item.getPlanoutputrollcount() + "卷 = " + CXCommonUtils.removeExtraZerosAndDecimal(item.getPlanoutputonerollweight());
+                        }
+                        return res;
+                    }).sorted(String::compareTo).collect(Collectors.toList());
 
             for (int i = 0; i < outputOrderProductList.size(); i++) {
                 outputOrderProduct += "[" + (i + 1) + "]" + outputOrderProductList.get(i);
@@ -2638,7 +2640,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
 
             //==============坯料输出物料类型===============
             String outMaterType = "";
-            List<String> outMaterTypeList = processOutputProductDoList.stream().map(ApsProcessOutputProductDo::getOutmatertype).sorted(String::compareTo).collect(Collectors.toList());
+            List<String> outMaterTypeList = processOutputProductDoList.stream().filter(item -> ObjectUtil.isNotEmpty(item.getOutmatertype())).map(ApsProcessOutputProductDo::getOutmatertype).sorted(String::compareTo).collect(Collectors.toList());
             for (int i = 0; i < outMaterTypeList.size(); i++) {
                 outMaterType += "[" + (i + 1) + "]" + outMaterTypeList.get(i);
                 if (i < outMaterTypeList.size() - 1) {
@@ -2649,7 +2651,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
 
             //==============坯料输出物料规格===============
             String outMaterSpecification = "";
-            List<String> outMaterSpecificationList = processOutputProductDoList.stream().map(ApsProcessOutputProductDo::getOutmaterspecification).sorted(String::compareTo).collect(Collectors.toList());
+            List<String> outMaterSpecificationList = processOutputProductDoList.stream().filter(item -> ObjectUtil.isNotEmpty(item.getOutmaterspecification())).map(ApsProcessOutputProductDo::getOutmaterspecification).sorted(String::compareTo).collect(Collectors.toList());
             for (int i = 0; i < outMaterSpecificationList.size(); i++) {
                 outMaterSpecification += "[" + (i + 1) + "]" + outMaterSpecificationList.get(i);
                 if (i < outMaterSpecificationList.size() - 1) {

+ 23 - 19
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProcessOperationServiceImpl.java

@@ -302,18 +302,18 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                             ApsProcessOperationOutMaterDo apsProcessOperationOutMaterDo = BeanUtil.toBean(apsCraftRouteOutMaterRequestDo.get(0), ApsProcessOperationOutMaterDo.class);
                             apsProcessOperationOutMaterDo.setId(SecurityUtil.getUUID());
                             String outProducttype = apsProcessOperationOutMaterDo.getProducttype();
-                            if (apsProcessOperationOutMaterDo.getProducttyperule().equals("不变")) {
+                            if (apsProcessOperationOutMaterDo.getProducttyperule().equals("不变") || apsProcessOperationOutMaterDo.getProducttyperule().equals("自定义")) {
                                 outProducttype = outMaterDo.getProducttype() == null ? "" : outMaterDo.getProducttype();
                                 apsProcessOperationOutMaterDo.setProducttypeid(outMaterDo.getProducttypeid() == null ? "" : outMaterDo.getProducttypeid());
                                 apsProcessOperationOutMaterDo.setProducttype(outProducttype);
                             }
                             String outMeter = apsProcessOperationOutMaterDo.getMetal();
-                            if (apsProcessOperationOutMaterDo.getMetalrule().equals("不变")) {
+                            if (apsProcessOperationOutMaterDo.getMetalrule().equals("不变") || apsProcessOperationOutMaterDo.getMetalrule().equals("自定义")) {
                                 outMeter = outMaterDo.getMetal() == null ? "" : outMaterDo.getMetal();
                                 apsProcessOperationOutMaterDo.setMetal(outMeter);
                             }
                             String outMetalstate = apsProcessOperationOutMaterDo.getMetalstate();
-                            if (apsProcessOperationOutMaterDo.getMetalstaterule().equals("不变")) {
+                            if (apsProcessOperationOutMaterDo.getMetalstaterule().equals("不变") || apsProcessOperationOutMaterDo.getMetalstaterule().equals("自定义")) {
                                 outMetalstate = outMaterDo.getMetalstate() == null ? "" : outMaterDo.getMetalstate();
                                 apsProcessOperationOutMaterDo.setMetalstate(outMetalstate);
                             }
@@ -476,18 +476,18 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                         ApsProcessOperationOutMaterDo apsProcessOperationOutMaterDo = BeanUtil.toBean(apsCraftRouteOutMaterRequestDo.get(0), ApsProcessOperationOutMaterDo.class);
                         apsProcessOperationOutMaterDo.setId(SecurityUtil.getUUID());
                         String outProducttype = apsProcessOperationOutMaterDo.getProducttype();
-                        if (apsProcessOperationOutMaterDo.getProducttyperule().equals("不变")) {
+                        if (apsProcessOperationOutMaterDo.getProducttyperule().equals("不变") || apsProcessOperationOutMaterDo.getProducttyperule().equals("自定义")) {
                             outProducttype = blanckdata.getStr("PRODUCTTYPE") == null ? "" : blanckdata.getStr("PRODUCTTYPE");
                             apsProcessOperationOutMaterDo.setProducttypeid(blanckdata.getStr("PRODUCTTYPEID") == null ? "" : blanckdata.getStr("PRODUCTTYPEID"));
                             apsProcessOperationOutMaterDo.setProducttype(outProducttype);
                         }
                         String outMeter = apsProcessOperationOutMaterDo.getMetal();
-                        if (apsProcessOperationOutMaterDo.getMetalrule().equals("不变")) {
+                        if (apsProcessOperationOutMaterDo.getMetalrule().equals("不变") || apsProcessOperationOutMaterDo.getMetalrule().equals("自定义")) {
                             outMeter = blanckdata.getStr("ALLOY") == null ? "" : blanckdata.getStr("ALLOY");
                             apsProcessOperationOutMaterDo.setMetal(outMeter);
                         }
                         String outMetalstate = apsProcessOperationOutMaterDo.getMetalstate();
-                        if (apsProcessOperationOutMaterDo.getMetalstaterule().equals("不变")) {
+                        if (apsProcessOperationOutMaterDo.getMetalstaterule().equals("不变") || apsProcessOperationOutMaterDo.getMetalstaterule().equals("自定义")) {
                             outMetalstate = blanckdata.getStr("ALLOYSTATUS") == null ? "" : blanckdata.getStr("ALLOYSTATUS");
                             apsProcessOperationOutMaterDo.setMetalstate(outMetalstate);
                         }
@@ -787,18 +787,18 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                             processOperationOutMaterDo.setId(SecurityUtil.getUUID());
 
                             String outProducttype = apsProcessOperationOutMaterDo.getProducttype();
-                            if (apsProcessOperationOutMaterDo.getProducttyperule().equals("不变")) {
+                            if (apsProcessOperationOutMaterDo.getProducttyperule().equals("不变") || apsProcessOperationOutMaterDo.getProducttyperule().equals("自定义")) {
                                 outProducttype = outMaterDo.getProducttype() == null ? "" : outMaterDo.getProducttype();
                                 processOperationOutMaterDo.setProducttypeid(outMaterDo.getProducttypeid() == null ? "" : outMaterDo.getProducttypeid());
                                 processOperationOutMaterDo.setProducttype(outProducttype);
                             }
                             String outMeter = apsProcessOperationOutMaterDo.getMetal();
-                            if (apsProcessOperationOutMaterDo.getMetalrule().equals("不变")) {
+                            if (apsProcessOperationOutMaterDo.getMetalrule().equals("不变") || apsProcessOperationOutMaterDo.getMetalrule().equals("自定义")) {
                                 outMeter = outMaterDo.getMetal() == null ? "" : outMaterDo.getMetal();
                                 processOperationOutMaterDo.setMetal(outMeter);
                             }
                             String outMetalstate = apsProcessOperationOutMaterDo.getMetalstate();
-                            if (apsProcessOperationOutMaterDo.getMetalstaterule().equals("不变")) {
+                            if (apsProcessOperationOutMaterDo.getMetalstaterule().equals("不变") || apsProcessOperationOutMaterDo.getMetalstaterule().equals("自定义")) {
                                 outMetalstate = outMaterDo.getMetalstate() == null ? "" : outMaterDo.getMetalstate();
                                 processOperationOutMaterDo.setMetalstate(outMetalstate);
                             }
@@ -985,18 +985,18 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                         processOperationOutMaterDo.setId(SecurityUtil.getUUID());
                         processOperationOutMaterDo.setRoption(apsProcessOperationOutMaterDo.getId());
                         String outProducttype = apsProcessOperationOutMaterDo.getProducttype();
-                        if (apsProcessOperationOutMaterDo.getProducttyperule().equals("不变")) {
+                        if (apsProcessOperationOutMaterDo.getProducttyperule().equals("不变") || apsProcessOperationOutMaterDo.getProducttyperule().equals("自定义")) {
                             outProducttype = blanckdata.getStr("PRODUCTTYPE") == null ? "" : blanckdata.getStr("PRODUCTTYPE");
                             processOperationOutMaterDo.setProducttypeid(blanckdata.getStr("PRODUCTTYPEID") == null ? "" : blanckdata.getStr("PRODUCTTYPEID"));
                             processOperationOutMaterDo.setProducttype(outProducttype);
                         }
                         String outMeter = apsProcessOperationOutMaterDo.getMetal();
-                        if (apsProcessOperationOutMaterDo.getMetalrule().equals("不变")) {
+                        if (apsProcessOperationOutMaterDo.getMetalrule().equals("不变") || apsProcessOperationOutMaterDo.getMetalrule().equals("自定义")) {
                             outMeter = blanckdata.getStr("ALLOY") == null ? "" : blanckdata.getStr("ALLOY");
                             processOperationOutMaterDo.setMetal(outMeter);
                         }
                         String outMetalstate = apsProcessOperationOutMaterDo.getMetalstate();
-                        if (apsProcessOperationOutMaterDo.getMetalstaterule().equals("不变")) {
+                        if (apsProcessOperationOutMaterDo.getMetalstaterule().equals("不变") || apsProcessOperationOutMaterDo.getMetalstaterule().equals("自定义")) {
                             outMetalstate = blanckdata.getStr("ALLOYSTATUS") == null ? "" : blanckdata.getStr("ALLOYSTATUS");
                             processOperationOutMaterDo.setMetalstate(outMetalstate);
                         }
@@ -1398,18 +1398,18 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                     Integer outval = 0;
                     for (ApsProcessOperationOutMaterDo apsProcessOperationOutMaterDo1 : apsProcessOperationOutMaterDoList1) {
                         String outProducttype = apsProcessOperationOutMaterDo1.getProducttype();
-                        if (apsProcessOperationOutMaterDo1.getProducttyperule().equals("不变")) {
+                        if (apsProcessOperationOutMaterDo1.getProducttyperule().equals("不变") || apsProcessOperationOutMaterDo1.getProducttyperule().equals("自定义")) {
                             apsProcessOperationOutMaterDo1.setProducttypeid(apsProcessOperationOutMaterDo.getProducttypeid() == null ? "" : apsProcessOperationOutMaterDo.getProducttypeid());
                             outProducttype = apsProcessOperationOutMaterDo.getProducttype() == null ? "" : apsProcessOperationOutMaterDo.getProducttype();
                             apsProcessOperationOutMaterDo1.setProducttype(outProducttype);
                         }
                         String outMeter = apsProcessOperationOutMaterDo1.getMetal();
-                        if (apsProcessOperationOutMaterDo1.getMetalrule().equals("不变")) {
+                        if (apsProcessOperationOutMaterDo1.getMetalrule().equals("不变") || apsProcessOperationOutMaterDo1.getMetalrule().equals("自定义")) {
                             outMeter = apsProcessOperationOutMaterDo.getMetal() == null ? "" : apsProcessOperationOutMaterDo.getMetal();
                             apsProcessOperationOutMaterDo1.setMetal(outMeter);
                         }
                         String outMetalstate = apsProcessOperationOutMaterDo1.getMetalstate();
-                        if (apsProcessOperationOutMaterDo1.getMetalstaterule().equals("不变")) {
+                        if (apsProcessOperationOutMaterDo1.getMetalstaterule().equals("不变") || apsProcessOperationOutMaterDo1.getMetalstaterule().equals("自定义")) {
                             outMetalstate = apsProcessOperationOutMaterDo.getMetalstate() == null ? "" : apsProcessOperationOutMaterDo.getMetalstate();
                             apsProcessOperationOutMaterDo1.setMetalstate(outMetalstate);
                         }
@@ -1732,18 +1732,18 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
         Integer outval = 0;
         for (ApsProcessOperationOutMaterDo apsProcessOperationOutMaterDo : apsProcessOperationOutMaterDos) {
             String outProducttype = apsProcessOperationOutMaterDo.getProducttype();
-            if (apsProcessOperationOutMaterDo.getProducttyperule().equals("不变")) {
+            if (apsProcessOperationOutMaterDo.getProducttyperule().equals("不变") || apsProcessOperationOutMaterDo.getProducttyperule().equals("自定义")) {
                 outProducttype = blanckdata.getStr("PRODUCTTYPE") == null ? "" : blanckdata.getStr("PRODUCTTYPE");
                 apsProcessOperationOutMaterDo.setProducttypeid(blanckdata.getStr("PRODUCTTYPEID") == null ? "" : blanckdata.getStr("PRODUCTTYPEID"));
                 apsProcessOperationOutMaterDo.setProducttype(outProducttype);
             }
             String outMeter = apsProcessOperationOutMaterDo.getMetal();
-            if (apsProcessOperationOutMaterDo.getMetalrule().equals("不变")) {
+            if (apsProcessOperationOutMaterDo.getMetalrule().equals("不变") || apsProcessOperationOutMaterDo.getMetalrule().equals("自定义")) {
                 outMeter = blanckdata.getStr("ALLOY") == null ? "" : blanckdata.getStr("ALLOY");
                 apsProcessOperationOutMaterDo.setMetal(outMeter);
             }
             String outMetalstate = apsProcessOperationOutMaterDo.getMetalstate();
-            if (apsProcessOperationOutMaterDo.getMetalstaterule().equals("不变")) {
+            if (apsProcessOperationOutMaterDo.getMetalstaterule().equals("不变") || apsProcessOperationOutMaterDo.getMetalstaterule().equals("自定义")) {
                 outMetalstate = blanckdata.getStr("ALLOYSTATUS") == null ? "" : blanckdata.getStr("ALLOYSTATUS");
                 apsProcessOperationOutMaterDo.setMetalstate(outMetalstate);
             }
@@ -2343,7 +2343,11 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
             }
         }
         if (countRule.equals("自定义")) {
-            newVal = curVal;
+            if (curVal == null) {
+                newVal = oldVal;
+            } else {
+                newVal = curVal;
+            }
         }
         return newVal;
     }

+ 197 - 120
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsReportRecordsServiceImpl.java

@@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
@@ -83,6 +84,8 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
     private ReportCheckServiceImpl reportCheckService;
     @Resource
     private ApsProcessOutputProductDao apsProcessOutputProductDao;
+    @Autowired
+    private ApsOrderAlloyCompositionService apsOrderAlloyCompositionService;
 
     @Override
     @Transactional
@@ -690,72 +693,111 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
 
             }
             //=============坯料成分子表信息=============
-            //工序作业的是否坯料工序=是 时,根据客户合金成分设置自动生成
-            if (apsProcessOperationDo.getIfblankprocess().equals("是")) {
-                //工序作业的合金
-                String metal = apsProcessOperationDo.getMetal();
-                //订单的客户ID
-                String customid = apsProductionOrderDo.getCustomid();
-                String alloyId = "";
-                //查询合金对应的所有主表信息
-                List<ApsAlloyDo> apsAlloyDoList = apsAlloyService.list(new QueryWrapper<ApsAlloyDo>().lambda().eq(ApsAlloyDo::getAlloy, metal));
-                if (ObjectUtil.isNotEmpty(apsAlloyDoList)) {
-                    //查询客户标准
-                    List<ApsAlloyDo> collect = apsAlloyDoList.stream().filter(item -> ObjectUtil.isNotEmpty(item.getCustomerid()) && item.getCustomerid().contains(customid)).collect(Collectors.toList());
-                    if (ObjectUtil.isNotEmpty(collect)) {
-                        alloyId = collect.get(0).getId();
-                    } else {//查询国标
-                        List<ApsAlloyDo> collect1 = apsAlloyDoList.stream().filter(item -> ObjectUtil.isEmpty(item.getCustomerid())).collect(Collectors.toList());
-                        if (ObjectUtil.isNotEmpty(collect1)) {
-                            alloyId = collect1.get(0).getId();
+            //显示订单中加载的该报工记录该客户的输入物料合金的合金成分,坯料工序检验时填写,不是坯料工序报工和检验只能查看
+            ApsOrderAlloyCompositionDo apsOrderAlloyCompositionDo = apsOrderAlloyCompositionService.getOne(new QueryWrapper<ApsOrderAlloyCompositionDo>().lambda()
+                    .eq(ApsOrderAlloyCompositionDo::getProductionorderid, apsProductionOrderDo.getId())
+                    .eq(ApsOrderAlloyCompositionDo::getAlloy, apsProcessOperationDo.getMetal()));
+
+            if (ObjectUtil.isNotEmpty(apsOrderAlloyCompositionDo) && ObjectUtil.isNotEmpty(apsOrderAlloyCompositionDo.getCompontentrequirement())) {
+                String compontentrequirement = apsOrderAlloyCompositionDo.getCompontentrequirement();
+                LinkedList<String> strings = new LinkedList<>(Arrays.asList(compontentrequirement.split(",\n")));
+                if (strings.size() > 0) {
+                    List<ApsReportBlankCompentDo> needInsertApsReportBlankCompentList = new LinkedList<>();
+                    for (String string : strings) {
+                        String[] s = string.split(" ");
+                        ApsReportBlankCompentDo apsReportBlankCompentDo = new ApsReportBlankCompentDo();
+                        apsReportBlankCompentDo.setId(SecurityUtil.getUUID());
+                        apsReportBlankCompentDo.setTenantid(tenantId);
+                        apsReportBlankCompentDo.setMainid(apsReportRecordsDo.getId());
+                        apsReportBlankCompentDo.setCompent(s[0]);
+                        String start = s[1].split("-")[0].replace("%", "");
+                        String end = s[1].split("-")[1].replace("%", "");
+                        if (ObjectUtil.isEmpty(start)) {
+                            start = "0";
                         }
-                    }
-                }
-                //查询合金成分要求
-                if (ObjectUtil.isNotEmpty(alloyId)) {
-                    List<ApsAlloyCompositionDo> apsAlloyCompositionDoList = apsAlloyCompositionService.list(new QueryWrapper<ApsAlloyCompositionDo>().lambda().eq(ApsAlloyCompositionDo::getAlloyid, alloyId));
-
-                    if (ObjectUtil.isNotEmpty(apsAlloyCompositionDoList)) {
-                        List<ApsReportBlankCompentDo> needInsertApsReportBlankCompentList = new LinkedList<>();
-                        for (ApsAlloyCompositionDo apsAlloyCompositionDo : apsAlloyCompositionDoList) {
-                            ApsReportBlankCompentDo apsReportBlankCompentDo = new ApsReportBlankCompentDo();
-                            apsReportBlankCompentDo.setId(SecurityUtil.getUUID());
-                            apsReportBlankCompentDo.setTenantid(tenantId);
-                            apsReportBlankCompentDo.setMainid(apsReportRecordsDo.getId());
-                            apsReportBlankCompentDo.setCompent(apsAlloyCompositionDo.getIngredient());
-                            apsReportBlankCompentDo.setStartproportion(apsAlloyCompositionDo.getLeftproportion());
-                            apsReportBlankCompentDo.setEndproportion(apsAlloyCompositionDo.getRightproportion());
-                            needInsertApsReportBlankCompentList.add(apsReportBlankCompentDo);
+                        if (ObjectUtil.isEmpty(end)) {
+                            end = "100";
                         }
-                        if (ObjectUtil.isNotEmpty(needInsertApsReportBlankCompentList)) {
-                            apsReportBlankCompentService.saveBatch(needInsertApsReportBlankCompentList);
-                        }
-
+                        apsReportBlankCompentDo.setStartproportion(new BigDecimal(start));
+                        apsReportBlankCompentDo.setEndproportion(new BigDecimal(end));
+                        needInsertApsReportBlankCompentList.add(apsReportBlankCompentDo);
                     }
-                }
-            } else {//不是坯料工序,根据输入物料批次号,查询来源报工的坯料成分,copy一份
-                String inputBatchNumber = req.getInputBatchNumber();
-                //查询上一个的报工ID
-                String lastReportRecordId = this.baseMapper.selectLastReoprtRecordByBatchNumber(inputBatchNumber);
-                if (ObjectUtil.isNotEmpty(lastReportRecordId)) {
-                    //查询上一个报工的坯料成分
-                    List<ApsReportBlankCompentDo> apsReportBlankCompentDoList = apsReportBlankCompentService.list(new QueryWrapper<ApsReportBlankCompentDo>().lambda().eq(ApsReportBlankCompentDo::getMainid, lastReportRecordId));
-                    //复制新增
-                    List<ApsReportBlankCompentDo> needAddList = new LinkedList<>();
-                    for (ApsReportBlankCompentDo apsReportBlankCompentDo : apsReportBlankCompentDoList) {
-                        ApsReportBlankCompentDo needAdd = new ApsReportBlankCompentDo();
-                        needAdd.setId(SecurityUtil.getUUID());
-                        needAdd.setTenantid(tenantId);
-                        needAdd.setMainid(apsReportRecordsDo.getId());
-                        needAdd.setCompent(apsReportBlankCompentDo.getCompent());
-                        needAdd.setStartproportion(apsReportBlankCompentDo.getStartproportion());
-                        needAdd.setEndproportion(apsReportBlankCompentDo.getEndproportion());
-                        needAdd.setActualproportion(apsReportBlankCompentDo.getActualproportion());
-                        needAddList.add(needAdd);
+                    if (ObjectUtil.isNotEmpty(needInsertApsReportBlankCompentList)) {
+                        apsReportBlankCompentService.saveBatch(needInsertApsReportBlankCompentList);
                     }
-                    apsReportBlankCompentService.saveBatch(needAddList);
+
                 }
             }
+
+
+//            //工序作业的是否坯料工序=是 时,根据客户合金成分设置自动生成
+//            if (apsProcessOperationDo.getIfblankprocess().equals("是")) {
+//                //工序作业的合金
+//                String metal = apsProcessOperationDo.getMetal();
+//
+//
+//                //订单的客户ID
+//                String customid = apsProductionOrderDo.getCustomid();
+//                String alloyId = "";
+//                //查询合金对应的所有主表信息
+//                List<ApsAlloyDo> apsAlloyDoList = apsAlloyService.list(new QueryWrapper<ApsAlloyDo>().lambda().eq(ApsAlloyDo::getAlloy, metal));
+//                if (ObjectUtil.isNotEmpty(apsAlloyDoList)) {
+//                    //查询客户标准
+//                    List<ApsAlloyDo> collect = apsAlloyDoList.stream().filter(item -> ObjectUtil.isNotEmpty(item.getCustomerid()) && item.getCustomerid().contains(customid)).collect(Collectors.toList());
+//                    if (ObjectUtil.isNotEmpty(collect)) {
+//                        alloyId = collect.get(0).getId();
+//                    } else {//查询国标
+//                        List<ApsAlloyDo> collect1 = apsAlloyDoList.stream().filter(item -> ObjectUtil.isEmpty(item.getCustomerid())).collect(Collectors.toList());
+//                        if (ObjectUtil.isNotEmpty(collect1)) {
+//                            alloyId = collect1.get(0).getId();
+//                        }
+//                    }
+//                }
+//                //查询合金成分要求
+//                if (ObjectUtil.isNotEmpty(alloyId)) {
+//                    List<ApsAlloyCompositionDo> apsAlloyCompositionDoList = apsAlloyCompositionService.list(new QueryWrapper<ApsAlloyCompositionDo>().lambda().eq(ApsAlloyCompositionDo::getAlloyid, alloyId));
+//
+//                    if (ObjectUtil.isNotEmpty(apsAlloyCompositionDoList)) {
+//                        List<ApsReportBlankCompentDo> needInsertApsReportBlankCompentList = new LinkedList<>();
+//                        for (ApsAlloyCompositionDo apsAlloyCompositionDo : apsAlloyCompositionDoList) {
+//                            ApsReportBlankCompentDo apsReportBlankCompentDo = new ApsReportBlankCompentDo();
+//                            apsReportBlankCompentDo.setId(SecurityUtil.getUUID());
+//                            apsReportBlankCompentDo.setTenantid(tenantId);
+//                            apsReportBlankCompentDo.setMainid(apsReportRecordsDo.getId());
+//                            apsReportBlankCompentDo.setCompent(apsAlloyCompositionDo.getIngredient());
+//                            apsReportBlankCompentDo.setStartproportion(apsAlloyCompositionDo.getLeftproportion());
+//                            apsReportBlankCompentDo.setEndproportion(apsAlloyCompositionDo.getRightproportion());
+//                            needInsertApsReportBlankCompentList.add(apsReportBlankCompentDo);
+//                        }
+//                        if (ObjectUtil.isNotEmpty(needInsertApsReportBlankCompentList)) {
+//                            apsReportBlankCompentService.saveBatch(needInsertApsReportBlankCompentList);
+//                        }
+//
+//                    }
+//                }
+//            } else {//不是坯料工序,根据输入物料批次号,查询来源报工的坯料成分,copy一份
+//                String inputBatchNumber = req.getInputBatchNumber();
+//                //查询上一个的报工ID
+//                String lastReportRecordId = this.baseMapper.selectLastReoprtRecordByBatchNumber(inputBatchNumber);
+//                if (ObjectUtil.isNotEmpty(lastReportRecordId)) {
+//                    //查询上一个报工的坯料成分
+//                    List<ApsReportBlankCompentDo> apsReportBlankCompentDoList = apsReportBlankCompentService.list(new QueryWrapper<ApsReportBlankCompentDo>().lambda().eq(ApsReportBlankCompentDo::getMainid, lastReportRecordId));
+//                    //复制新增
+//                    List<ApsReportBlankCompentDo> needAddList = new LinkedList<>();
+//                    for (ApsReportBlankCompentDo apsReportBlankCompentDo : apsReportBlankCompentDoList) {
+//                        ApsReportBlankCompentDo needAdd = new ApsReportBlankCompentDo();
+//                        needAdd.setId(SecurityUtil.getUUID());
+//                        needAdd.setTenantid(tenantId);
+//                        needAdd.setMainid(apsReportRecordsDo.getId());
+//                        needAdd.setCompent(apsReportBlankCompentDo.getCompent());
+//                        needAdd.setStartproportion(apsReportBlankCompentDo.getStartproportion());
+//                        needAdd.setEndproportion(apsReportBlankCompentDo.getEndproportion());
+//                        needAdd.setActualproportion(apsReportBlankCompentDo.getActualproportion());
+//                        needAddList.add(needAdd);
+//                    }
+//                    apsReportBlankCompentService.saveBatch(needAddList);
+//                }
+//            }
             //更新生产状态
             CommonUpdateProductionStatusReq req3 = new CommonUpdateProductionStatusReq();
             req3.setProcessOperationEquId(apsProcessOperationProcessEquDo.getId());
@@ -1410,72 +1452,107 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
 
             }
             //=============坯料成分子表信息=============
-            //工序作业的是否坯料工序=是 时,根据客户合金成分设置自动生成
-            if (apsProcessOperationDo.getIfblankprocess().equals("是")) {
-                //工序作业的合金
-                String metal = apsProcessOperationDo.getMetal();
-                //订单的客户ID
-                String customid = apsProductionOrderDo.getCustomid();
-                String alloyId = "";
-                //查询合金对应的所有主表信息
-                List<ApsAlloyDo> apsAlloyDoList = apsAlloyService.list(new QueryWrapper<ApsAlloyDo>().lambda().eq(ApsAlloyDo::getAlloy, metal));
-                if (ObjectUtil.isNotEmpty(apsAlloyDoList)) {
-                    //查询客户标准
-                    List<ApsAlloyDo> collect = apsAlloyDoList.stream().filter(item -> ObjectUtil.isNotEmpty(item.getCustomerid()) && item.getCustomerid().contains(customid)).collect(Collectors.toList());
-                    if (ObjectUtil.isNotEmpty(collect)) {
-                        alloyId = collect.get(0).getId();
-                    } else {//查询国标
-                        List<ApsAlloyDo> collect1 = apsAlloyDoList.stream().filter(item -> ObjectUtil.isEmpty(item.getCustomerid())).collect(Collectors.toList());
-                        if (ObjectUtil.isNotEmpty(collect1)) {
-                            alloyId = collect1.get(0).getId();
-                        }
-                    }
-                }
-                //查询合金成分要求
-                if (ObjectUtil.isNotEmpty(alloyId)) {
-                    List<ApsAlloyCompositionDo> apsAlloyCompositionDoList = apsAlloyCompositionService.list(new QueryWrapper<ApsAlloyCompositionDo>().lambda().eq(ApsAlloyCompositionDo::getAlloyid, alloyId));
-
-                    if (ObjectUtil.isNotEmpty(apsAlloyCompositionDoList)) {
-                        List<ApsReportBlankCompentDo> needInsertApsReportBlankCompentList = new LinkedList<>();
-                        for (ApsAlloyCompositionDo apsAlloyCompositionDo : apsAlloyCompositionDoList) {
-                            ApsReportBlankCompentDo apsReportBlankCompentDo = new ApsReportBlankCompentDo();
-                            apsReportBlankCompentDo.setId(SecurityUtil.getUUID());
-                            apsReportBlankCompentDo.setTenantid(tenantId);
-                            apsReportBlankCompentDo.setMainid(apsReportRecordsDo.getId());
-                            apsReportBlankCompentDo.setCompent(apsAlloyCompositionDo.getIngredient());
-                            apsReportBlankCompentDo.setStartproportion(apsAlloyCompositionDo.getLeftproportion());
-                            apsReportBlankCompentDo.setEndproportion(apsAlloyCompositionDo.getRightproportion());
-                            needInsertApsReportBlankCompentList.add(apsReportBlankCompentDo);
+            //显示订单中加载的该报工记录该客户的输入物料合金的合金成分,坯料工序检验时填写,不是坯料工序报工和检验只能查看
+            ApsOrderAlloyCompositionDo apsOrderAlloyCompositionDo = apsOrderAlloyCompositionService.getOne(new QueryWrapper<ApsOrderAlloyCompositionDo>().lambda()
+                    .eq(ApsOrderAlloyCompositionDo::getProductionorderid, apsProductionOrderDo.getId())
+                    .eq(ApsOrderAlloyCompositionDo::getAlloy, apsProcessOperationDo.getMetal()));
+
+            if (ObjectUtil.isNotEmpty(apsOrderAlloyCompositionDo) && ObjectUtil.isNotEmpty(apsOrderAlloyCompositionDo.getCompontentrequirement())) {
+                String compontentrequirement = apsOrderAlloyCompositionDo.getCompontentrequirement();
+                LinkedList<String> strings = new LinkedList<>(Arrays.asList(compontentrequirement.split(",\n")));
+                if (strings.size() > 0) {
+                    List<ApsReportBlankCompentDo> needInsertApsReportBlankCompentList = new LinkedList<>();
+                    for (String string : strings) {
+                        String[] s = string.split(" ");
+                        ApsReportBlankCompentDo apsReportBlankCompentDo = new ApsReportBlankCompentDo();
+                        apsReportBlankCompentDo.setId(SecurityUtil.getUUID());
+                        apsReportBlankCompentDo.setTenantid(tenantId);
+                        apsReportBlankCompentDo.setMainid(apsReportRecordsDo.getId());
+                        apsReportBlankCompentDo.setCompent(s[0]);
+                        String start = s[1].split("-")[0].replace("%", "");
+                        String end = s[1].split("-")[1].replace("%", "");
+                        if (ObjectUtil.isEmpty(start)) {
+                            start = "0";
                         }
-                        if (ObjectUtil.isNotEmpty(needInsertApsReportBlankCompentList)) {
-                            apsReportBlankCompentService.saveBatch(needInsertApsReportBlankCompentList);
+                        if (ObjectUtil.isEmpty(end)) {
+                            end = "100";
                         }
-
+                        apsReportBlankCompentDo.setStartproportion(new BigDecimal(start));
+                        apsReportBlankCompentDo.setEndproportion(new BigDecimal(end));
+                        needInsertApsReportBlankCompentList.add(apsReportBlankCompentDo);
                     }
-                }
-            } else {//不是坯料工序,根据输入物料批次号,查询来源报工的坯料成分,copy一份
-                String inputBatchNumber = req.getInputBatchNumberList().get(0);
-                //查询上一个的报工ID
-                String lastReportRecordId = this.baseMapper.selectLastReoprtRecordByBatchNumber(inputBatchNumber);
-                if (ObjectUtil.isNotEmpty(lastReportRecordId)) {
-                    //查询上一个报工的坯料成分
-                    List<ApsReportBlankCompentDo> apsReportBlankCompentDoList = apsReportBlankCompentService.list(new QueryWrapper<ApsReportBlankCompentDo>().lambda().eq(ApsReportBlankCompentDo::getMainid, lastReportRecordId));
-                    //复制新增
-                    List<ApsReportBlankCompentDo> needAddList = new LinkedList<>();
-                    for (ApsReportBlankCompentDo apsReportBlankCompentDo : apsReportBlankCompentDoList) {
-                        ApsReportBlankCompentDo needAdd = new ApsReportBlankCompentDo();
-                        needAdd.setId(SecurityUtil.getUUID());
-                        needAdd.setTenantid(tenantId);
-                        needAdd.setMainid(apsReportRecordsDo.getId());
-                        needAdd.setCompent(apsReportBlankCompentDo.getCompent());
-                        needAdd.setStartproportion(apsReportBlankCompentDo.getStartproportion());
-                        needAdd.setEndproportion(apsReportBlankCompentDo.getEndproportion());
-                        needAdd.setActualproportion(apsReportBlankCompentDo.getActualproportion());
-                        needAddList.add(needAdd);
+                    if (ObjectUtil.isNotEmpty(needInsertApsReportBlankCompentList)) {
+                        apsReportBlankCompentService.saveBatch(needInsertApsReportBlankCompentList);
                     }
-                    apsReportBlankCompentService.saveBatch(needAddList);
+
                 }
             }
+//            //工序作业的是否坯料工序=是 时,根据客户合金成分设置自动生成
+//            if (apsProcessOperationDo.getIfblankprocess().equals("是")) {
+//                //工序作业的合金
+//                String metal = apsProcessOperationDo.getMetal();
+//                //订单的客户ID
+//                String customid = apsProductionOrderDo.getCustomid();
+//                String alloyId = "";
+//                //查询合金对应的所有主表信息
+//                List<ApsAlloyDo> apsAlloyDoList = apsAlloyService.list(new QueryWrapper<ApsAlloyDo>().lambda().eq(ApsAlloyDo::getAlloy, metal));
+//                if (ObjectUtil.isNotEmpty(apsAlloyDoList)) {
+//                    //查询客户标准
+//                    List<ApsAlloyDo> collect = apsAlloyDoList.stream().filter(item -> ObjectUtil.isNotEmpty(item.getCustomerid()) && item.getCustomerid().contains(customid)).collect(Collectors.toList());
+//                    if (ObjectUtil.isNotEmpty(collect)) {
+//                        alloyId = collect.get(0).getId();
+//                    } else {//查询国标
+//                        List<ApsAlloyDo> collect1 = apsAlloyDoList.stream().filter(item -> ObjectUtil.isEmpty(item.getCustomerid())).collect(Collectors.toList());
+//                        if (ObjectUtil.isNotEmpty(collect1)) {
+//                            alloyId = collect1.get(0).getId();
+//                        }
+//                    }
+//                }
+//                //查询合金成分要求
+//                if (ObjectUtil.isNotEmpty(alloyId)) {
+//                    List<ApsAlloyCompositionDo> apsAlloyCompositionDoList = apsAlloyCompositionService.list(new QueryWrapper<ApsAlloyCompositionDo>().lambda().eq(ApsAlloyCompositionDo::getAlloyid, alloyId));
+//
+//                    if (ObjectUtil.isNotEmpty(apsAlloyCompositionDoList)) {
+//                        List<ApsReportBlankCompentDo> needInsertApsReportBlankCompentList = new LinkedList<>();
+//                        for (ApsAlloyCompositionDo apsAlloyCompositionDo : apsAlloyCompositionDoList) {
+//                            ApsReportBlankCompentDo apsReportBlankCompentDo = new ApsReportBlankCompentDo();
+//                            apsReportBlankCompentDo.setId(SecurityUtil.getUUID());
+//                            apsReportBlankCompentDo.setTenantid(tenantId);
+//                            apsReportBlankCompentDo.setMainid(apsReportRecordsDo.getId());
+//                            apsReportBlankCompentDo.setCompent(apsAlloyCompositionDo.getIngredient());
+//                            apsReportBlankCompentDo.setStartproportion(apsAlloyCompositionDo.getLeftproportion());
+//                            apsReportBlankCompentDo.setEndproportion(apsAlloyCompositionDo.getRightproportion());
+//                            needInsertApsReportBlankCompentList.add(apsReportBlankCompentDo);
+//                        }
+//                        if (ObjectUtil.isNotEmpty(needInsertApsReportBlankCompentList)) {
+//                            apsReportBlankCompentService.saveBatch(needInsertApsReportBlankCompentList);
+//                        }
+//
+//                    }
+//                }
+//            } else {//不是坯料工序,根据输入物料批次号,查询来源报工的坯料成分,copy一份
+//                String inputBatchNumber = req.getInputBatchNumberList().get(0);
+//                //查询上一个的报工ID
+//                String lastReportRecordId = this.baseMapper.selectLastReoprtRecordByBatchNumber(inputBatchNumber);
+//                if (ObjectUtil.isNotEmpty(lastReportRecordId)) {
+//                    //查询上一个报工的坯料成分
+//                    List<ApsReportBlankCompentDo> apsReportBlankCompentDoList = apsReportBlankCompentService.list(new QueryWrapper<ApsReportBlankCompentDo>().lambda().eq(ApsReportBlankCompentDo::getMainid, lastReportRecordId));
+//                    //复制新增
+//                    List<ApsReportBlankCompentDo> needAddList = new LinkedList<>();
+//                    for (ApsReportBlankCompentDo apsReportBlankCompentDo : apsReportBlankCompentDoList) {
+//                        ApsReportBlankCompentDo needAdd = new ApsReportBlankCompentDo();
+//                        needAdd.setId(SecurityUtil.getUUID());
+//                        needAdd.setTenantid(tenantId);
+//                        needAdd.setMainid(apsReportRecordsDo.getId());
+//                        needAdd.setCompent(apsReportBlankCompentDo.getCompent());
+//                        needAdd.setStartproportion(apsReportBlankCompentDo.getStartproportion());
+//                        needAdd.setEndproportion(apsReportBlankCompentDo.getEndproportion());
+//                        needAdd.setActualproportion(apsReportBlankCompentDo.getActualproportion());
+//                        needAddList.add(needAdd);
+//                    }
+//                    apsReportBlankCompentService.saveBatch(needAddList);
+//                }
+//            }
 
             /**
              * 检查每个输入批次号,