浏览代码

aps-报工前校验实测卷重

sucheng 4 月之前
父节点
当前提交
0beccea2c7

+ 2 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsReportRecordsService.java

@@ -2,6 +2,7 @@ package com.rongwei.bscommon.sys.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.rongwei.bsentity.domain.ApsReportRecordsDo;
+import com.rongwei.bsentity.vo.CheckReportRecordVo;
 import com.rongwei.bsentity.vo.SaveReportReq;
 import com.rongwei.bsentity.vo.SmallRollStartReportReq;
 import com.rongwei.bsentity.vo.StartRePortReq;
@@ -22,7 +23,7 @@ public interface ApsReportRecordsService extends IService<ApsReportRecordsDo> {
     R saveReport(SaveReportReq req);
 
     R checkMergeProcess(ApsReportRecordsDo req);
-    R checkMergeProcess2(ApsReportRecordsDo req);
+    R checkMergeProcess2(CheckReportRecordVo req);
 
     R smallRollStartReport(SmallRollStartReportReq req);
 

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

@@ -1502,7 +1502,7 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
     }
 
     @Override
-    public R checkMergeProcess2(ApsReportRecordsDo req) {
+    public R checkMergeProcess2(CheckReportRecordVo req) {
         //作业明细的ID
         String processequid = req.getProcessequid();
         //当前报工的作业明细的详情
@@ -1552,6 +1552,24 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
             }
         }
 
+        //如果实测单卷重/输出单卷重大于1.5或小于0.5,
+        // 则添加警告确认信息:输出物料{输出物料描述}实测卷重超出工艺要求单卷重50%
+        List<ApsReportOutputDo> apsReportOutputDoList = req.getApsReportOutputDoList();
+        List<ApsProcessOperationOutMaterDo> list = apsProcessOperationOutMaterService.list(new LambdaQueryWrapper<ApsProcessOperationOutMaterDo>().eq(ApsProcessOperationOutMaterDo::getMainid, apsProcessOperationDo.getId()));
+        for (ApsReportOutputDo apsReportOutputDo : apsReportOutputDoList) {
+            ApsProcessOperationOutMaterDo apsProcessOperationOutMaterDo = list.stream().filter(item -> item.getId().equals(apsReportOutputDo.getOutputid())).findFirst().orElse(null);
+            if (apsProcessOperationOutMaterDo != null) {
+                BigDecimal singlerollweight = apsProcessOperationOutMaterDo.getSinglerollweight();
+                BigDecimal weight = apsReportOutputDo.getWeight();
+                BigDecimal weightDivide = weight.divide(singlerollweight, 2, RoundingMode.HALF_UP);
+                if (weightDivide.compareTo(new BigDecimal("1.5")) > 0
+                        || weightDivide.compareTo(new BigDecimal("0.5")) < 0) {
+                    needWarning = true;
+                    warningMessage += ("<b>输出物料" + apsReportOutputDo.getOutputmaterial() + "实测卷重超出/低于工艺要求单卷重50%;</b><br>");
+                }
+            }
+        }
+
 
         CheckMergeProcessResopnse res = new CheckMergeProcessResopnse();
         res.setNeedWarning(needWarning);

+ 16 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/CheckReportRecordVo.java

@@ -0,0 +1,16 @@
+package com.rongwei.bsentity.vo;
+
+import com.rongwei.bsentity.domain.ApsReportOutputDo;
+import com.rongwei.bsentity.domain.ApsReportRecordsDo;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author :sc
+ * @since :2025/4/10
+ */
+@Data
+public class CheckReportRecordVo extends ApsReportRecordsDo {
+    private List<ApsReportOutputDo> apsReportOutputDoList;
+}

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

@@ -3,6 +3,7 @@ package com.rongwei.bsserver.controller;
 
 import com.rongwei.bscommon.sys.service.ApsReportRecordsService;
 import com.rongwei.bsentity.domain.ApsReportRecordsDo;
+import com.rongwei.bsentity.vo.CheckReportRecordVo;
 import com.rongwei.bsentity.vo.SaveReportReq;
 import com.rongwei.bsentity.vo.SmallRollStartReportReq;
 import com.rongwei.bsentity.vo.StartRePortReq;
@@ -75,7 +76,7 @@ public class ApsReportRecordController {
      * 报工时,查询是否存在警告
      */
     @PostMapping("/checkMergeProcess2")
-    public R checkMergeProcess2(@RequestBody ApsReportRecordsDo req) {
+    public R checkMergeProcess2(@RequestBody CheckReportRecordVo req) {
         log.info("报工时,查询是否存在警告;参数为:{}", req);
         return apsReportRecordsService.checkMergeProcess2(req);
     }