|
@@ -3,26 +3,71 @@ 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.constant.RedisKeysConstant;
|
|
|
+import com.abi.qms.platform.dao.entity.BaseBrand;
|
|
|
import com.abi.qms.platform.dao.entity.BaseFactory;
|
|
|
+import com.abi.qms.platform.dao.entity.BaseMaterial;
|
|
|
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.enums.*;
|
|
|
-import com.abi.qms.platform.dao.mapper.*;
|
|
|
-import com.abi.qms.platform.dao.entity.*;
|
|
|
+import com.abi.qms.platform.dao.enums.CodePackageOrderTypeEnum;
|
|
|
import com.abi.qms.platform.dao.enums.FactoryTypeEnum;
|
|
|
+import com.abi.qms.platform.dao.enums.FirstFactoryEnum;
|
|
|
import com.abi.qms.platform.dao.enums.InvalidEnum;
|
|
|
+import com.abi.qms.platform.dao.enums.MaterialTypeEnum;
|
|
|
import com.abi.qms.platform.dao.enums.QrPackageApplyStatusEnum;
|
|
|
import com.abi.qms.platform.dao.enums.QrPackageGenerateStatusEnum;
|
|
|
import com.abi.qms.platform.dao.enums.QrRepertoryTypeEnum;
|
|
|
+import com.abi.qms.platform.dao.enums.QrTypeEnum;
|
|
|
+import com.abi.qms.platform.dao.mapper.BaseActiveMapper;
|
|
|
+import com.abi.qms.platform.dao.mapper.BaseBrandMapper;
|
|
|
+import com.abi.qms.platform.dao.mapper.BaseFactoryMapper;
|
|
|
+import com.abi.qms.platform.dao.mapper.BaseMaterialMapper;
|
|
|
+import com.abi.qms.platform.dao.mapper.QrBoxMappingMapper;
|
|
|
+import com.abi.qms.platform.dao.mapper.QrPackageBatchMapper;
|
|
|
+import com.abi.qms.platform.dao.mapper.QrPackageDownloadRecordMapper;
|
|
|
+import com.abi.qms.platform.dao.mapper.QrPackageMapper;
|
|
|
+import com.abi.qms.platform.dao.mapper.QrPackageSapOrderItemMapper;
|
|
|
+import com.abi.qms.platform.dao.mapper.QrRepertoryColumnMapper;
|
|
|
import com.abi.qms.platform.dao.tablestore.entity.QrCode;
|
|
|
-import com.abi.qms.platform.dao.vo.result.*;
|
|
|
-import com.abi.qms.platform.dto.req.*;
|
|
|
-import com.abi.qms.platform.dto.res.*;
|
|
|
+import com.abi.qms.platform.dao.vo.result.PackageActiveVO;
|
|
|
+import com.abi.qms.platform.dao.vo.result.QrBoxMappingVO;
|
|
|
+import com.abi.qms.platform.dao.vo.result.QrPackageBatchVO;
|
|
|
+import com.abi.qms.platform.dao.vo.result.QrPackageVO;
|
|
|
+import com.abi.qms.platform.dao.vo.result.QrSingleCheckVO;
|
|
|
+import com.abi.qms.platform.dto.req.DeleteQrPackageReq;
|
|
|
+import com.abi.qms.platform.dto.req.DownloadQrPackageReq;
|
|
|
+import com.abi.qms.platform.dto.req.GetPackageCodeReq;
|
|
|
+import com.abi.qms.platform.dto.req.GetQrPackageDetailReq;
|
|
|
+import com.abi.qms.platform.dto.req.GetQrSingleCheckDetailCodeReq;
|
|
|
+import com.abi.qms.platform.dto.req.InvalidQrPackageReq;
|
|
|
+import com.abi.qms.platform.dto.req.InvalidQrSingleReq;
|
|
|
+import com.abi.qms.platform.dto.req.ListQrPackageReq;
|
|
|
+import com.abi.qms.platform.dto.req.ListQrPackageWxReq;
|
|
|
+import com.abi.qms.platform.dto.req.PassQrPackageReq;
|
|
|
+import com.abi.qms.platform.dto.req.QrOneBoxCodeMappingReq;
|
|
|
+import com.abi.qms.platform.dto.req.QrOnePackageBatchReq;
|
|
|
+import com.abi.qms.platform.dto.req.RefuseQrPackageReq;
|
|
|
+import com.abi.qms.platform.dto.req.SaveQrPackageReq;
|
|
|
+import com.abi.qms.platform.dto.req.SendMobileMsgReq;
|
|
|
+import com.abi.qms.platform.dto.req.ValidSAPOrderNoAndMaterialReq;
|
|
|
+import com.abi.qms.platform.dto.res.GetPackageCodeRes;
|
|
|
+import com.abi.qms.platform.dto.res.GetQrPackageDetailRes;
|
|
|
+import com.abi.qms.platform.dto.res.GetQrSingleCheckDetailRes;
|
|
|
+import com.abi.qms.platform.dto.res.ListQrPackageRes;
|
|
|
+import com.abi.qms.platform.dto.res.ListQrPackageWxRes;
|
|
|
+import com.abi.qms.platform.dto.res.ValidSAPOrderNoAndMaterialRes;
|
|
|
import com.abi.qms.platform.infrastructure.mq.GenerateCodeConsumer;
|
|
|
-import com.abi.qms.platform.infrastructure.util.*;
|
|
|
+import com.abi.qms.platform.infrastructure.util.AssertUtil;
|
|
|
+import com.abi.qms.platform.infrastructure.util.FreeMarkerUtils;
|
|
|
+import com.abi.qms.platform.infrastructure.util.OssFileDownloadUtil;
|
|
|
+import com.abi.qms.platform.infrastructure.util.PageUtil;
|
|
|
+import com.abi.qms.platform.infrastructure.util.RandomCodeUtils;
|
|
|
+import com.abi.qms.platform.infrastructure.util.SendmailUtil;
|
|
|
+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.QrPackageService;
|
|
@@ -34,7 +79,6 @@ import com.abi.task.common.utils.PojoConverterUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import org.apache.commons.collections.CollectionUtils;
|
|
|
import freemarker.template.Template;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
@@ -311,15 +355,15 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
}
|
|
|
|
|
|
//根据类型判断订单号不能为空
|
|
|
- if(CodePackageOrderTypeEnum.SAP_ORDER.is(req.getOrderType()) && StringUtils.isBlank(req.getSapOrderNo())){
|
|
|
+ if (CodePackageOrderTypeEnum.SAP_ORDER.is(req.getOrderType()) && StringUtils.isBlank(req.getSapOrderNo())) {
|
|
|
throw new BusinessException("SAP订单号不能为空");
|
|
|
}
|
|
|
- if(CodePackageOrderTypeEnum.BOOKING_ORDER.is(req.getOrderType()) && StringUtils.isBlank(req.getBookingOrder())){
|
|
|
+ if (CodePackageOrderTypeEnum.BOOKING_ORDER.is(req.getOrderType()) && StringUtils.isBlank(req.getBookingOrder())) {
|
|
|
throw new BusinessException("预订单号不能为空");
|
|
|
}
|
|
|
|
|
|
//如果SAP订单号和物料有重复数据,需提交额外申请原因
|
|
|
- if(StringUtils.isNotBlank(req.getSapOrderNo())){
|
|
|
+ if (StringUtils.isNotBlank(req.getSapOrderNo())) {
|
|
|
ValidSAPOrderNoAndMaterialReq reqValid = new ValidSAPOrderNoAndMaterialReq();
|
|
|
reqValid.setMaterialId(req.getMaterialId());
|
|
|
reqValid.setSapOrderNo(req.getSapOrderNo());
|
|
@@ -349,8 +393,8 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
//查询物料信息
|
|
|
BaseMaterial material = baseMaterialMapper.selectById(req.getMaterialId());
|
|
|
AssertUtil.isNull(material, "物料信息不存在");
|
|
|
- if(QrTypeEnum.CARTON.is(getPackageCode(material.getMaterialType()))
|
|
|
- && req.getBoxCodeFormatId()==null){
|
|
|
+ if (QrTypeEnum.CARTON.is(getPackageCode(material.getMaterialType()))
|
|
|
+ && req.getBoxCodeFormatId() == null) {
|
|
|
throw new BusinessException("箱码幅面为空");
|
|
|
}
|
|
|
|
|
@@ -448,17 +492,18 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
|
|
|
//存在活动数据
|
|
|
if (ObjectUtils.isNotEmpty(packageActive)) {
|
|
|
- getBrandCodeName(res,packageActive);
|
|
|
+ getBrandCodeName(res, packageActive);
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 活动详情封装出参,显示品牌名称
|
|
|
+ *
|
|
|
* @param res
|
|
|
* @param packageActive
|
|
|
*/
|
|
|
- private void getBrandCodeName(GetQrPackageDetailRes res,PackageActiveVO packageActive){
|
|
|
+ private void getBrandCodeName(GetQrPackageDetailRes res, PackageActiveVO packageActive) {
|
|
|
|
|
|
res.setActiveCode(packageActive.getActiveCode());
|
|
|
res.setActiveName(packageActive.getActiveName());
|
|
@@ -470,7 +515,7 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
StringBuffer brandNames = new StringBuffer();
|
|
|
//查询品牌一级列表
|
|
|
QueryWrapper<BaseBrand> baseBrandQW = new QueryWrapper<>();
|
|
|
- baseBrandQW.eq("brand_level",1);
|
|
|
+ baseBrandQW.eq("brand_level", 1);
|
|
|
List<BaseBrand> baseBrands = baseBrandMapper.selectList(baseBrandQW);
|
|
|
Map<String, String> brandCodeMap = baseBrands.stream().collect(Collectors.toMap(BaseBrand::getBrandCode, BaseBrand::getBrandName));
|
|
|
|
|
@@ -483,8 +528,8 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (brandNames.length()>0){
|
|
|
- brandNames.deleteCharAt(brandNames.length()-1);
|
|
|
+ if (brandNames.length() > 0) {
|
|
|
+ brandNames.deleteCharAt(brandNames.length() - 1);
|
|
|
res.setBrandNames(brandNames.toString());
|
|
|
}
|
|
|
}
|
|
@@ -599,7 +644,7 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
.setQrPackageId(qrPackage.getId());
|
|
|
qrPackageDownloadRecordMapper.insert(downloadRecord);
|
|
|
//更新码包表下载时间
|
|
|
- QrPackage qrPackages=new QrPackage()
|
|
|
+ QrPackage qrPackages = new QrPackage()
|
|
|
.setDownloadTime(LocalDateTime.now());
|
|
|
qrPackageMapper.updateById(qrPackages);
|
|
|
}
|
|
@@ -819,22 +864,22 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public GetPackageCodeRes getPackageCodeType(GetPackageCodeReq req){
|
|
|
+ public GetPackageCodeRes getPackageCodeType(GetPackageCodeReq req) {
|
|
|
//1-查询sap订单明细
|
|
|
QrPackageSapOrderItem orderItem = qrPackageSapOrderItemMapper.selectById(req.getOrderItemId());
|
|
|
- AssertUtil.isNull(orderItem,"订单明细不存在");
|
|
|
+ AssertUtil.isNull(orderItem, "订单明细不存在");
|
|
|
|
|
|
//2-查询对应物料
|
|
|
BaseMaterial material = materialService.getMaterialByCode(orderItem.getSapMaterialId());
|
|
|
- AssertUtil.isNull(material,String.format("SAP物料%s未创建对应的QMS系统内物料!",orderItem.getSapMaterialId()));
|
|
|
+ AssertUtil.isNull(material, String.format("SAP物料%s未创建对应的QMS系统内物料!", orderItem.getSapMaterialId()));
|
|
|
|
|
|
//3-查询包材厂
|
|
|
BaseFactory coverFactory = factoryService.getFactoryByCode(orderItem.getSapCoverFactoryId(), FactoryTypeEnum.COVER.getCode());
|
|
|
- AssertUtil.isNull(coverFactory,String.format("SAP包材厂%s未创建对应的QMS系统内包材厂!",orderItem.getSapCoverFactoryId()));
|
|
|
+ AssertUtil.isNull(coverFactory, String.format("SAP包材厂%s未创建对应的QMS系统内包材厂!", orderItem.getSapCoverFactoryId()));
|
|
|
|
|
|
//4-查询啤酒厂
|
|
|
BaseFactory beerFactory = factoryService.getFactoryByCode(orderItem.getSapBeerFactoryId(), FactoryTypeEnum.BEER.getCode());
|
|
|
- AssertUtil.isNull(beerFactory,String.format("SAP啤酒厂%s未创建对应的QMS系统内啤酒厂!",orderItem.getSapBeerFactoryId()));
|
|
|
+ AssertUtil.isNull(beerFactory, String.format("SAP啤酒厂%s未创建对应的QMS系统内啤酒厂!", orderItem.getSapBeerFactoryId()));
|
|
|
|
|
|
GetPackageCodeRes res = new GetPackageCodeRes();
|
|
|
res.setFactoryCoverId(coverFactory.getId());
|
|
@@ -849,19 +894,25 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ListQrPackageWxRes listWxQrPackage(ListQrPackageWxReq listQrPackageWxReq) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据物料类型转换码类型
|
|
|
* 物料类型: 3-罐子 4-瓶盖 5-纸板箱
|
|
|
* 码类型:1-箱码 2-盖码
|
|
|
+ *
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
- public Integer getPackageCode(Integer type){
|
|
|
+ public Integer getPackageCode(Integer type) {
|
|
|
if (MaterialTypeEnum.CARTON.is(type)) {
|
|
|
- return QrTypeEnum.CARTON.getCode();
|
|
|
- }else if(MaterialTypeEnum.BOTTLE_CAP.is(type) || MaterialTypeEnum.JAR.is(type)){
|
|
|
+ return QrTypeEnum.CARTON.getCode();
|
|
|
+ } else if (MaterialTypeEnum.BOTTLE_CAP.is(type) || MaterialTypeEnum.JAR.is(type)) {
|
|
|
return QrTypeEnum.CAP.getCode();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
throw new BusinessException("物料类型和对应的箱码类型不匹配!");
|
|
|
}
|
|
|
|