Prechádzať zdrojové kódy

稽查案件流向查询完善

zhangzhao 3 rokov pred
rodič
commit
afc73e6c97

+ 2 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/GetBoxCodeReq.java

@@ -1,6 +1,7 @@
 package com.abi.qms.platform.dto.req;
 
 import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
 import lombok.Data;
 
 import javax.validation.constraints.NotNull;
@@ -14,6 +15,7 @@ import java.io.Serializable;
  */
 @Data
 @Schema
+@AllArgsConstructor
 public class GetBoxCodeReq implements Serializable {
 
     @Schema(name = "箱码")

+ 4 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/GetBoxCodeRes.java

@@ -13,6 +13,7 @@ import java.util.List;
 /**
  * 箱码查询出参
  * TODO 测试使用,待流向查询接口完成后,根据实际情况调整结构
+ *
  * @author WeiganCai
  * @date: 2021-08-02
  */
@@ -80,6 +81,9 @@ public class GetBoxCodeRes implements Serializable {
         @Schema(name = "节点状态")
         private Integer nodeStatus;
 
+        @Schema(name = "异常形式 0-无异常 1-流出异常 2-流入异常")
+        private Integer abnormalForm = 0;
+
         @Schema(name = "是否拆垛")
         private Integer isSplit;
 

+ 2 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/FlowQueryServiceImpl.java

@@ -67,6 +67,7 @@ public class FlowQueryServiceImpl implements FlowQueryService {
         flow = new GetBoxCodeRes.FlowBean()
                 .setNodeName("二级经销商")
                 .setNodeStatus(0)
+                .setAbnormalForm(1)
                 .setIsSplit(1)
                 .setSplitStackCode("200712348457ADB2")
                 .setInStorageTime(LocalDateTime.of(2020, 12, 26, 11, 12, 38))
@@ -76,6 +77,7 @@ public class FlowQueryServiceImpl implements FlowQueryService {
         flow = new GetBoxCodeRes.FlowBean()
                 .setNodeName("杭州市延海百利超市(新华小区店)")
                 .setNodeStatus(0)
+                .setAbnormalForm(2)
                 .setIsSplit(0)
                 .setInStorageTime(LocalDateTime.of(2020, 12, 27, 11, 12, 38));
         flowList.add(flow);

+ 33 - 4
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/InspectionCaseServiceImpl.java

@@ -4,6 +4,7 @@ package com.abi.qms.platform.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.StrUtil;
 import com.abi.qms.platform.dao.entity.InspectionCase;
 import com.abi.qms.platform.dao.entity.InspectionCaseBoxCode;
 import com.abi.qms.platform.dao.enums.CaseNumberGenerateStrategyEnum;
@@ -15,12 +16,15 @@ import com.abi.qms.platform.dao.vo.result.ListInspectionCaseVO;
 import com.abi.qms.platform.dao.vo.result.ListRoleVO;
 import com.abi.qms.platform.dto.req.AddInspectionCaseReq;
 import com.abi.qms.platform.dto.req.EditInspectionCaseReq;
+import com.abi.qms.platform.dto.req.GetBoxCodeReq;
 import com.abi.qms.platform.dto.req.PageListInspectionCaseReq;
+import com.abi.qms.platform.dto.res.GetBoxCodeRes;
 import com.abi.qms.platform.dto.res.GetInspectionCaseInfoRes;
 import com.abi.qms.platform.dto.res.ListRoleRes;
 import com.abi.qms.platform.dto.res.PageListInspectionCaseRes;
 import com.abi.qms.platform.infrastructure.util.AssertUtil;
 import com.abi.qms.platform.infrastructure.util.PageUtil;
+import com.abi.qms.platform.service.FlowQueryService;
 import com.abi.qms.platform.service.IInspectionCaseService;
 import com.abi.qms.platform.service.InspectionCaseNumberService;
 import com.abi.task.common.api.exception.BusinessException;
@@ -32,10 +36,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.validation.constraints.NotNull;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.time.LocalDateTime;
+import java.util.*;
 import java.util.function.Consumer;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
@@ -60,6 +62,9 @@ public class InspectionCaseServiceImpl implements IInspectionCaseService {
     @Autowired
     private InspectionCaseNumberService caseNumberService;
 
+    @Autowired
+    private FlowQueryService flowQueryService;
+
     /**
      * 新增案件
      *
@@ -258,6 +263,29 @@ public class InspectionCaseServiceImpl implements IInspectionCaseService {
      */
     private Map validatedBoxCode(List<String> boxCodeList) {
 
+        List<GetBoxCodeRes> boxCodeResList = new ArrayList<>();
+
+        Set<Long> skuIdSet = new HashSet<Long>();
+        List<String> skuErrBoxCode = new ArrayList<>();
+
+        boxCodeList.forEach(s -> {
+            GetBoxCodeReq boxCodeReq = new GetBoxCodeReq(s);
+            GetBoxCodeRes res = flowQueryService.boxCode(boxCodeReq);
+            AssertUtil.isNull(res, "案件新增失败!箱码:" + s + ",失败原因:未查询到此箱码信息!");
+            boxCodeResList.add(res);
+
+            //判断SKU信息是否一致
+            Long skuId = res.getSku().getSkuId();
+            if (!skuIdSet.add(skuId)) {
+                skuErrBoxCode.add(s);
+            }
+
+
+
+        });
+
+        AssertUtil.isEmpty(skuErrBoxCode, "案件新增失败!箱码:" + StrUtil.str(skuErrBoxCode, ";") + ",失败原因:SKU信息不一致");
+
         //TODO 查询流向信息
         //TODO  校验提交箱码所对应的SKU信息是否正确;、校验提交箱码的流向信息是否相同
         //List<String> errorBoxCodeList=new ArrayList<>();
@@ -268,6 +296,7 @@ public class InspectionCaseServiceImpl implements IInspectionCaseService {
         return MapUtil.empty();
     }
 
+
     /**
      * 自动生成案件编号
      *