|
@@ -2,16 +2,7 @@ package com.abi.qms.platform.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.abi.base.foundation.util.RedisClient;
|
|
|
-import com.abi.qms.platform.dao.entity.BaseFactory;
|
|
|
-import com.abi.qms.platform.dao.entity.BaseMaterial;
|
|
|
-import com.abi.qms.platform.dao.entity.QrBoxCodeFormat;
|
|
|
-import com.abi.qms.platform.dao.entity.QrBoxMapping;
|
|
|
-import com.abi.qms.platform.dao.entity.QrPackage;
|
|
|
-import com.abi.qms.platform.dao.entity.QrPackageBatch;
|
|
|
-import com.abi.qms.platform.dao.entity.QrPackageDownloadRecord;
|
|
|
-import com.abi.qms.platform.dao.entity.QrPackageSapOrderItem;
|
|
|
-import com.abi.qms.platform.dao.entity.QrRepertoryColumn;
|
|
|
-import com.abi.qms.platform.dao.entity.UserInfo;
|
|
|
+import com.abi.qms.platform.dao.entity.*;
|
|
|
import com.abi.qms.platform.dao.enums.BoxMappingActiveStatusEnum;
|
|
|
import com.abi.qms.platform.dao.enums.CodePackageOrderTypeEnum;
|
|
|
import com.abi.qms.platform.dao.enums.FactoryTypeEnum;
|
|
@@ -75,6 +66,7 @@ import com.abi.qms.platform.infrastructure.util.SmsUtil;
|
|
|
import com.abi.qms.platform.infrastructure.util.UserUtil;
|
|
|
import com.abi.qms.platform.service.FactoryService;
|
|
|
import com.abi.qms.platform.service.MaterialService;
|
|
|
+import com.abi.qms.platform.service.QrPackageBookingOrderService;
|
|
|
import com.abi.qms.platform.service.QrPackageService;
|
|
|
import com.abi.task.common.api.exception.BusinessException;
|
|
|
import com.abi.task.common.api.exception.ErrorCodeEnum;
|
|
@@ -175,6 +167,9 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
@Autowired
|
|
|
private QrBoxCodeFormatMapper qrBoxCodeFormatMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private QrPackageBookingOrderService qrPackageBookingOrderService;
|
|
|
+
|
|
|
|
|
|
* 保存码包
|
|
|
*/
|
|
@@ -250,24 +245,26 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
req.setPackageBatchBeanList(batchBeanList);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- QueryWrapper<QrBoxCodeFormat> formatQw = new QueryWrapper<>();
|
|
|
- formatQw.eq("is_sys", 1);
|
|
|
-
|
|
|
- formatQw.eq("sys_type", 1);
|
|
|
- formatQw.eq("is_delete", 0);
|
|
|
- List<QrBoxCodeFormat> beerFormatList = qrBoxCodeFormatMapper.selectList(formatQw);
|
|
|
- if (CollectionUtil.isEmpty(beerFormatList)) {
|
|
|
- throw new BusinessException("盖码默认幅面与码格式不存在,请检查初始数据");
|
|
|
- }
|
|
|
- QrBoxCodeFormat beerFormat = beerFormatList.get(0);
|
|
|
- req.setBoxCodeFormatId(beerFormat.getId());
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
BaseMaterial material = baseMaterialMapper.selectById(req.getMaterialId());
|
|
|
AssertUtil.isNull(material, "物料信息不存在");
|
|
|
req.setQrType(getPackageCode(material.getMaterialType()));
|
|
|
|
|
|
+
|
|
|
+ if(QrTypeEnum.CAP.is(req.getQrType())){
|
|
|
+ QueryWrapper<QrBoxCodeFormat> formatQw = new QueryWrapper<>();
|
|
|
+ formatQw.eq("is_sys", 1);
|
|
|
+
|
|
|
+ formatQw.eq("sys_type", 1);
|
|
|
+ formatQw.eq("is_delete", 0);
|
|
|
+ List<QrBoxCodeFormat> beerFormatList = qrBoxCodeFormatMapper.selectList(formatQw);
|
|
|
+ if (CollectionUtil.isEmpty(beerFormatList)) {
|
|
|
+ throw new BusinessException("盖码默认幅面与码格式不存在,请检查初始数据");
|
|
|
+ }
|
|
|
+ QrBoxCodeFormat beerFormat = beerFormatList.get(0);
|
|
|
+ req.setBoxCodeFormatId(beerFormat.getId());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -391,23 +388,23 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
if (TrueFalseEnum.TRUE.is(validSAPOrderNoAndMaterialRes.getIsOverstepNum())) {
|
|
|
throw new BusinessException("该SAP订单号和物料已超额申请码包,若仍需申请需要提交额外码包申请原因");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- Set<Long> validQrPackageIdSet = validSAPOrderNoAndMaterialRes.getPackageBeanList().stream().map(bean -> bean.getId()).collect(Collectors.toSet());
|
|
|
- if(validQrPackageIdSet.size()>1
|
|
|
- ||(isAdd && validQrPackageIdSet.size()==1)
|
|
|
- ||(!isAdd && !validQrPackageIdSet.contains(req.getId()))){
|
|
|
- Long id = validSAPOrderNoAndMaterialRes.getPackageBeanList().get(0).getId();
|
|
|
- throw new BusinessException("该SAP订单号和物料与码包" + id + "重复,若仍需申请需要提交额外码包申请原因");
|
|
|
- }
|
|
|
- }*/
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- BaseMaterial material = baseMaterialMapper.selectById(req.getMaterialId());
|
|
|
- AssertUtil.isNull(material, "物料信息不存在");
|
|
|
- if (QrTypeEnum.CARTON.is(getPackageCode(material.getMaterialType()))
|
|
|
- && req.getBoxCodeFormatId() == null) {
|
|
|
+
|
|
|
+ boolean isCarton = false;
|
|
|
+ if(CodePackageOrderTypeEnum.SAP_ORDER.is(req.getOrderType())){
|
|
|
+
|
|
|
+ BaseMaterial material = baseMaterialMapper.selectById(req.getMaterialId());
|
|
|
+ AssertUtil.isNull(material, "物料信息不存在");
|
|
|
+ isCarton = QrTypeEnum.CARTON.is(getPackageCode(material.getMaterialType()));
|
|
|
+ }else{
|
|
|
+
|
|
|
+ QrPackageBookingOrder bookingOrder = qrPackageBookingOrderService.getBookingOrder(req.getBookingOrder());
|
|
|
+ AssertUtil.isNull(bookingOrder, "预订单不存在");
|
|
|
+ isCarton = QrTypeEnum.CARTON.is(bookingOrder.getQrType());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isCarton && req.getBoxCodeFormatId() == null) {
|
|
|
throw new BusinessException("箱码幅面为空");
|
|
|
}
|
|
|
|
|
@@ -446,14 +443,7 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(req.getPackageBatchBeanList())) {
|
|
|
-
|
|
|
List<SaveQrPackageReq.PackageBatchBean> packageBatchBeanList = req.getPackageBatchBeanList();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
long sum = packageBatchBeanList.stream().mapToLong(SaveQrPackageReq.PackageBatchBean::getBatchQrNumber).sum();
|
|
|
if (sum != req.getQrNumber()) {
|