Bläddra i källkod

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

fangpy 7 månader sedan
förälder
incheckning
ad2f63e8bd

+ 28 - 28
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProcessOperationProcessEquServiceImpl.java

@@ -287,15 +287,15 @@ public class ApsProcessOperationProcessEquServiceImpl extends ServiceImpl<ApsPro
         }
         // 工序作业明细ID
         List<String> detailIds = changingWiresVos.stream().map(ChangingWiresVo::getId).collect(Collectors.toList());
-//        SysUserVo nowWorkUser = CXCommonUtils.getCurrentUser();
-//        for (String equId:detailIds){
-//            if (changeWiresLock.containsKey(equId)) {
-//                log.error("该作业明细已被:{}其他操作员换线", changeWiresLock.get(equId));
-//                return R.error("该作业明细已被其他操作员换线");
-//            }
-//            changeWiresLock.put(equId, nowWorkUser.getId());
-//        }
-//        try {
+        SysUserVo nowWorkUser = CXCommonUtils.getCurrentUser();
+        for (String equId:detailIds){
+            if (changeWiresLock.containsKey(equId)) {
+                log.error("该作业明细已被:{}其他操作员换线", changeWiresLock.get(equId));
+                return R.error("该作业明细已被其他操作员换线");
+            }
+            changeWiresLock.put(equId, nowWorkUser.getId());
+        }
+        try {
             // 需要返回的相关ID
             List<String> returnAboutIds = changingWiresVos.stream().map(ChangingWiresVo::getReturnAboutIds).flatMap(Collection::stream).collect(Collectors.toList());
             if (detailIds.isEmpty()) {
@@ -567,11 +567,11 @@ public class ApsProcessOperationProcessEquServiceImpl extends ServiceImpl<ApsPro
 
             // 重新获取甘特图数据并返回前段
             return R.ok(ganttService.getListById(aboutIds));
-//        }finally {
-//            for (String equId:detailIds){
-//                changeWiresLock.remove(equId);
-//            }
-//        }
+        }finally {
+            for (String equId:detailIds){
+                changeWiresLock.remove(equId);
+            }
+        }
     }
 
     /**
@@ -854,15 +854,15 @@ public class ApsProcessOperationProcessEquServiceImpl extends ServiceImpl<ApsPro
             log.error("无法找到对应工序作业明细");
             throw new CustomException("参数异常,工序作业明细ID为空");
         }
-//        SysUserVo nowWorkUser = CXCommonUtils.getCurrentUser();
-//        for (String equId:ids){
-//            if (splitLock.containsKey(equId)) {
-//                log.error("该作业明细已被:{}其他操作员拆分", splitLock.get(equId));
-//                throw new CustomException("该作业明细已被其他操作员拆分");
-//            }
-//            splitLock.put(equId, nowWorkUser.getId());
-//        }
-//        try {
+        SysUserVo nowWorkUser = CXCommonUtils.getCurrentUser();
+        for (String equId:ids){
+            if (splitLock.containsKey(equId)) {
+                log.error("该作业明细已被:{}其他操作员拆分", splitLock.get(equId));
+                throw new CustomException("该作业明细已被其他操作员拆分");
+            }
+            splitLock.put(equId, nowWorkUser.getId());
+        }
+        try {
             // 所有的工序作业明细
             List<ApsProcessOperationProcessEquDo> apsProcessOperationProcessEquDos = (List<ApsProcessOperationProcessEquDo>) this.listByIds(ids);
             // 前一个工序作业明细Id
@@ -1118,11 +1118,11 @@ public class ApsProcessOperationProcessEquServiceImpl extends ServiceImpl<ApsPro
                         .set(ApsProcessOperationProcessEquDo::getNextprocessesids, strAppendListConvertStr(apsProcessOperationProcessEquDo.getNextprocessesids(), collect1)));
             });
             return R.ok(this.ganttService.getListById(aboutIds));
-//        }finally {
-//            for (String equId:ids){
-//                splitLock.remove(equId);
-//            }
-//        }
+        }finally {
+            for (String equId:ids){
+                splitLock.remove(equId);
+            }
+        }
     }
 
     public void updateBlank(String processOperationId) {

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

@@ -2228,7 +2228,25 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                 processOperationProcessEquDo.setBachmaterialprocess(String.join(",", newpch));
                 //将这些批次号对应在制品退回备料库
                 if (delpch.size() > 0) {
+                    //如果存在该批次号在制品,则在制品状态=备料中;在制品的备料计划ID=(空)
                     apsProcessOperationDao.updateProgressInventory(delpch);
+
+                    //如果作业明细没有前道作业明细,并且对应坯料计划的备料批次号包含该批次号,则将该批次号从对应坯料计划的备料批次号中删除
+                    if (StringUtils.isBlank(processOperationProcessEquDo.getPreviousprocessesids())) {
+                        ApsBlankOrderDo apsBlankOrderDo = apsBlankOrderService.getById(processOperationProcessEquDo.getBlankid());
+                        if (StringUtils.isNotBlank(apsBlankOrderDo.getPreparematerialbatchno())) {
+                            List<String> newPreparematerialbatchno = new ArrayList<>();
+                            for (String delbatchno : delpch) {
+                                for (String batchno : apsBlankOrderDo.getPreparematerialbatchno().split(",")) {
+                                    if (!batchno.equals(delbatchno)) {
+                                        newPreparematerialbatchno.add(batchno);
+                                    }
+                                }
+                            }
+                            apsBlankOrderDo.setPreparematerialbatchno(String.join(",", newPreparematerialbatchno));
+                            apsBlankOrderService.save(apsBlankOrderDo);
+                        }
+                    }
                 }
             }
         }
@@ -2246,6 +2264,7 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                 processOperationProcessEquDo.setWorkstatus(SaveConstans.JobStatus.JOBSTATUS_TO_BE_STARTING);
             }
         }
+        processOperationProcessEquDo.setLeavewaitjobroll(leaveWaitJobRoll);
 
         //取消和更新该作业明细每个后道作业明细
         if (StringUtils.isNotBlank(processOperationProcessEquDo.getNextprocessesids())) {

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

@@ -393,8 +393,11 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
                     if (ObjectUtil.isNotEmpty(apsProcessOperationProcessEquDo.getBachmaterialprocess())) {
                         List<String> list1 = Arrays.asList(req.getInputBatchNumber().split(","));
                         List<String> list2 = Arrays.asList(apsProcessOperationProcessEquDo.getBachmaterialprocess().split(","));
-                        for (String s : list1) {
-                            if (!list2.contains(s)) {
+                        //扫码开工输入批次号,系统校验批次号不要区分大小写,应该都可以开工
+                        List<String> upCaseList = list1.stream().map(String::toUpperCase).collect(Collectors.toList());
+                        List<String> upTarget = list2.stream().map(String::toUpperCase).collect(Collectors.toList());
+                        for (String s : upCaseList) {
+                            if (!upTarget.contains(s)) {
                                 return R.error("批次号不在待加工料卷批次号中或已被使用,请刷新列表后重试");
                             }
                         }
@@ -637,7 +640,8 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
                 String bachmaterialprocess = apsProcessOperationProcessEquDo.getBachmaterialprocess();
                 //如果存在被使用的批次号,则删除此批次号
                 if (ObjectUtil.isNotEmpty(bachmaterialprocess)) {
-                    LinkedList<String> strings = new LinkedList<>(Arrays.asList(bachmaterialprocess.split(",")));
+                    List<String> batchNumberList = Arrays.asList(bachmaterialprocess.split(","));
+                    LinkedList<String> strings = batchNumberList.stream().map(String::toUpperCase).collect(Collectors.toCollection(LinkedList::new));
                     if (strings.contains(req.getInputBatchNumber())) {
                         strings.remove(req.getInputBatchNumber());
                         ApsProcessOperationProcessEquDo equDo = new ApsProcessOperationProcessEquDo();
@@ -1453,8 +1457,11 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
                 if (ObjectUtil.isNotEmpty(apsProcessOperationProcessEquDo.getBachmaterialprocess())) {
                     List<String> list1 = req.getInputBatchNumberList();
                     List<String> list2 = Arrays.asList(apsProcessOperationProcessEquDo.getBachmaterialprocess().split(","));
-                    for (String s : list1) {
-                        if (!list2.contains(s)) {
+                    //扫码开工输入批次号,系统校验批次号不要区分大小写,应该都可以开工
+                    List<String> upCaseList = list1.stream().map(String::toUpperCase).collect(Collectors.toList());
+                    List<String> upCaseTarget = list2.stream().map(String::toUpperCase).collect(Collectors.toList());
+                    for (String s : upCaseList) {
+                        if (!upCaseTarget.contains(s)) {
                             return R.error("批次号不在待加工料卷批次号中或已被使用,请刷新列表后重试");
                         }
                     }
@@ -1806,7 +1813,8 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
             List<String> oldList = new LinkedList<>();
             //原待加工批次号不为空
             if (ObjectUtil.isNotEmpty(apsProcessOperationProcessEquDo.getBachmaterialprocess())) {
-                oldList = new LinkedList<>(Arrays.asList(apsProcessOperationProcessEquDo.getBachmaterialprocess().split(",")));
+                List<String> batchNumberList = Arrays.asList(apsProcessOperationProcessEquDo.getBachmaterialprocess().split(","));
+                oldList = batchNumberList.stream().map(String::toUpperCase).collect(Collectors.toCollection(LinkedList::new));
                 oldList.removeAll(inputBatchNumberList);
                 String newBatch = String.join(",", oldList);
                 ApsProcessOperationProcessEquDo needUpdate = new ApsProcessOperationProcessEquDo();
@@ -2017,23 +2025,27 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
                 String nextChar = "";
                 int index = outputCode.indexOf(nowYear);
                 if (index != -1) {
-                    nextChar = String.valueOf(outputCode.charAt(index + nowYear.length()));
                     //需要判断每条数据在当前月
-                    if ("铸轧".equals(apsProcessOperationDo.getProcess()) && nodeMonthCode.equals(nextChar)) {
-                        //取出批次号最后三位字符串
-                        String lastThreeChars = outputCode.substring(outputCode.length() - 3);
-                        //校验序列号大小是否大于等于批次号后三位
-                        if (info.getSerialnumber() != null && info.getSerialnumber() >= Long.parseLong(lastThreeChars)) {
-                            // 删除批次号原来的后三位字符串,将序列号的三位数字更新到批次号中
-                            String newOutput = outputCode.substring(0, outputCode.length() - 3);
-                            String formatSerialnumber = String.format("%03d", info.getSerialnumber());
-                            info.setOutputnumber(newOutput + formatSerialnumber);
-                            //加工设备ID
-                            String processdeviceid = apsProcessOperationProcessEquDo.getProcessdeviceid();
-                            //在流水表中的标识
-                            String moduleCode = "aps_report_output_" + processdeviceid;
-                            //更新流水表中的当前值
-                            apsProcessOperationProcessEquDao.updateSerialNumberCurvalue(moduleCode, info.getSerialnumber());
+                    if ("铸轧".equals(apsProcessOperationDo.getProcess())) {
+                        if (outputCode.length()>index + nowYear.length()){
+                            nextChar = String.valueOf(outputCode.charAt(index + nowYear.length()));
+                            if (nodeMonthCode.equals(nextChar)){
+                                //取出批次号最后三位字符串
+                                String lastThreeChars = outputCode.substring(outputCode.length() - 3);
+                                //校验序列号大小是否大于等于批次号后三位
+                                if (info.getSerialnumber() != null && info.getSerialnumber() >= Long.parseLong(lastThreeChars)) {
+                                    // 删除批次号原来的后三位字符串,将序列号的三位数字更新到批次号中
+                                    String newOutput = outputCode.substring(0, outputCode.length() - 3);
+                                    String formatSerialnumber = String.format("%03d", info.getSerialnumber());
+                                    info.setOutputnumber(newOutput + formatSerialnumber);
+                                    //加工设备ID
+                                    String processdeviceid = apsProcessOperationProcessEquDo.getProcessdeviceid();
+                                    //在流水表中的标识
+                                    String moduleCode = "aps_report_output_" + processdeviceid;
+                                    //更新流水表中的当前值
+                                    apsProcessOperationProcessEquDao.updateSerialNumberCurvalue(moduleCode, info.getSerialnumber());
+                                }
+                            }
                         }
                     }
                 }

+ 60 - 35
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ReportCheckServiceImpl.java

@@ -4,9 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.rongwei.bscommon.sys.service.ApsBlankOrderService;
-import com.rongwei.bscommon.sys.service.ApsReportRecordsService;
-import com.rongwei.bscommon.sys.service.ReportCheckService;
+import com.rongwei.bscommon.sys.service.*;
 import com.rongwei.bsentity.domain.*;
 import com.rongwei.bsentity.vo.CancelProcessOperationVo;
 import com.rongwei.bsentity.vo.CommonUpdateProductionStatusReq;
@@ -88,6 +86,10 @@ public class ReportCheckServiceImpl implements ReportCheckService {
     private RunTaskService runTaskService;
     @Autowired
     private RedisService redisService;
+    @Autowired
+    private ApsProductDetailService apsProductDetailService;
+    @Autowired
+    private ApsProductionMergeOrderService apsProductionMergeOrderService;
 
     /**
      * 保存检验结果后更新相关信息
@@ -346,6 +348,8 @@ public class ReportCheckServiceImpl implements ReportCheckService {
         }
         List<ApsProcessOperationProcessEquDo> nextProcessOperationProcessEquDos = new ArrayList<>();
         List<ApsProcessOperationDo> nextProcessList = new ArrayList<>();
+        List<ApsProductionMergeOrderDo> apsProductionMergeOrderDoList = apsProductionMergeOrderService.list(new LambdaQueryWrapper<ApsProductionMergeOrderDo>().eq(BaseDo::getDeleted, NO_DELETED));
+        List<ApsProductDetailDo> apsProductDetailDoList = apsProductDetailService.list(new LambdaQueryWrapper<ApsProductDetailDo>().eq(BaseDo::getDeleted, NO_DELETED));
         if (StringUtils.isNotBlank(nextProcessesIds)) {
             // 被流转的工序作业明细
             nextProcessOperationProcessEquDos = apsProcessOperationProcessEquService.list(new LambdaQueryWrapper<ApsProcessOperationProcessEquDo>()
@@ -553,7 +557,28 @@ public class ReportCheckServiceImpl implements ReportCheckService {
                     // 添加需要流转的编号信息
                     toBeProcessedDataMap.put(outputId, outputNumbers);
                 }
-                if (MATERIAL_PREPARATION_ORDER.equals(productionOrderDo.getOrdertype())) {
+                /**
+                 * 新增需求:临时计算订单类型,如果输出物料的产品明细ID对应产品明细的合并订单号不为空,则订单类型=该合并订单的订单类型;否则订单类型=订单的订单类型
+                 */
+                String temporaryOrderType = "";
+                List<ApsProductDetailDo> queryProductDetailList= apsProductDetailDoList.stream().filter(info -> info.getId().equals(apsProcessOperationOutMaterDo.getOrderdetailid())).collect(Collectors.toList());
+                if (!queryProductDetailList.isEmpty()){
+                    ApsProductDetailDo queryProductDetailDo = queryProductDetailList.get(0);
+                    if (queryProductDetailDo!= null&&ObjectUtil.isNotEmpty(queryProductDetailDo.getMergeordernumber())){
+                        List<ApsProductionMergeOrderDo> queryProductionMergeOrderList = apsProductionMergeOrderDoList.stream().filter(data->(data.getOrderno().equals(queryProductDetailDo.getMergeordernumber()))).collect(Collectors.toList());
+                        if (!queryProductionMergeOrderList.isEmpty()){
+                            ApsProductionMergeOrderDo queryProductMergeOrderDo = queryProductionMergeOrderList.get(0);
+                            temporaryOrderType = queryProductMergeOrderDo.getOrdertype();
+                        }else {
+                            temporaryOrderType = productionOrderDo.getOrdertype();
+                        }
+                    }else {
+                        temporaryOrderType = productionOrderDo.getOrdertype();
+                    }
+                }else {
+                    temporaryOrderType = productionOrderDo.getOrdertype();
+                }
+                if (MATERIAL_PREPARATION_ORDER.equals(temporaryOrderType)) {
                     log.debug("订单类型为备料");
                     // 更新成品的在制品状态
                     updateWorkInProgressInventoryStatus(blScNum + lzScNum, cpScNum, YES,
@@ -1214,44 +1239,44 @@ public class ReportCheckServiceImpl implements ReportCheckService {
         List<SysDictDo> defectTypes = apsReportOutputService.getQualityDefectsDictsByType();
         apsReportOutputDos.forEach(apsReportOutputDo -> {
             workInProgressInventoryDos.stream()
-                    .filter(inventory -> apsReportOutputDo.getOutputnumber().equals(inventory.getBatchnumber()))
-                    .collect(Collectors.toList()).forEach(data -> {
-                        if ("是".equals(ifblankprocess)) {
-                            data.setBlankname(apsReportOutputDo.getOutputdesc());
+            .filter(inventory -> apsReportOutputDo.getOutputnumber().equals(inventory.getBatchnumber()))
+            .collect(Collectors.toList()).forEach(data -> {
+                if ("是".equals(ifblankprocess)) {
+                    data.setBlankname(apsReportOutputDo.getOutputdesc());
+                }
+                data.setWorkinprocess(apsReportOutputDo.getOutputdesc());
+                data.setInspectionlevel(apsReportOutputDo.getInsepctionlevel());
+                data.setIsqualified(apsReportOutputDo.getQualified());
+                String formatMajor = handleDefect(apsReportOutputDo.getMajor(), defectTypes);
+                String formatMinor = handleDefect(apsReportOutputDo.getMinor(), defectTypes);
+                if (StringUtils.isNotBlank(formatMajor) && StringUtils.isNotBlank(formatMinor)) {
+                    if (StringUtils.isNotBlank(apsReportOutputDo.getCheckremark())) {
+                        data.setRemark("主要缺陷:" + formatMajor + ";次要缺陷:" + formatMinor + ";检验备注:" + apsReportOutputDo.getCheckremark() + ";");
+                    } else {
+                        data.setRemark("主要缺陷:" + formatMajor + ";次要缺陷:" + formatMinor + ";");
+                    }
+                } else {
+                    if (StringUtils.isNotBlank(formatMajor)) {
+                        if (StringUtils.isNotBlank(apsReportOutputDo.getCheckremark())) {
+                            data.setRemark("主要缺陷:" + formatMajor + ";检验备注:" + apsReportOutputDo.getCheckremark() + ";");
+                        } else {
+                            data.setRemark("主要缺陷:" + formatMajor + ";");
                         }
-                        data.setWorkinprocess(apsReportOutputDo.getOutputdesc());
-                        data.setInspectionlevel(apsReportOutputDo.getInsepctionlevel());
-                        data.setIsqualified(apsReportOutputDo.getQualified());
-                        String formatMajor = handleDefect(apsReportOutputDo.getMajor(), defectTypes);
-                        String formatMinor = handleDefect(apsReportOutputDo.getMinor(), defectTypes);
-                        if (StringUtils.isNotBlank(formatMajor) && StringUtils.isNotBlank(formatMinor)) {
+                    } else {
+                        if (StringUtils.isNotBlank(formatMinor)) {
                             if (StringUtils.isNotBlank(apsReportOutputDo.getCheckremark())) {
-                                data.setRemark("主要缺陷:" + formatMajor + ";次要缺陷:" + formatMinor + ";检验备注:" + apsReportOutputDo.getCheckremark() + ";");
+                                data.setRemark("次要缺陷:" + formatMinor + ";检验备注:" + apsReportOutputDo.getCheckremark() + ";");
                             } else {
-                                data.setRemark("主要缺陷:" + formatMajor + ";次要缺陷:" + formatMinor + ";");
+                                data.setRemark("次要缺陷:" + formatMinor + ";");
                             }
                         } else {
-                            if (StringUtils.isNotBlank(formatMajor)) {
-                                if (StringUtils.isNotBlank(apsReportOutputDo.getCheckremark())) {
-                                    data.setRemark("主要缺陷:" + formatMajor + ";检验备注:" + apsReportOutputDo.getCheckremark() + ";");
-                                } else {
-                                    data.setRemark("主要缺陷:" + formatMajor + ";");
-                                }
-                            } else {
-                                if (StringUtils.isNotBlank(formatMinor)) {
-                                    if (StringUtils.isNotBlank(apsReportOutputDo.getCheckremark())) {
-                                        data.setRemark("次要缺陷:" + formatMinor + ";检验备注:" + apsReportOutputDo.getCheckremark() + ";");
-                                    } else {
-                                        data.setRemark("次要缺陷:" + formatMinor + ";");
-                                    }
-                                } else {
-                                    if (StringUtils.isNotBlank(apsReportOutputDo.getCheckremark())) {
-                                        data.setRemark("检验备注:" + apsReportOutputDo.getCheckremark() + ";");
-                                    }
-                                }
+                            if (StringUtils.isNotBlank(apsReportOutputDo.getCheckremark())) {
+                                data.setRemark("检验备注:" + apsReportOutputDo.getCheckremark() + ";");
                             }
                         }
-                    });
+                    }
+                }
+            });
         });
     }
 

+ 1 - 1
cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsReportRecordController.java

@@ -33,7 +33,7 @@ public class ApsReportRecordController {
     private ApsReportRecordsService apsReportRecordsService;
 
     /**
-     * 取消
+     * 取消
      *
      * @param req
      * @return