|
@@ -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();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 自动生成案件编号
|
|
|
*
|