|
@@ -23,6 +23,8 @@ import com.abi.qms.platform.dto.req.*;
|
|
|
import com.abi.qms.platform.dto.res.*;
|
|
|
import com.abi.qms.platform.infrastructure.mq.GenerateCodeConsumer;
|
|
|
import com.abi.qms.platform.infrastructure.util.*;
|
|
|
+import com.abi.qms.platform.service.FactoryService;
|
|
|
+import com.abi.qms.platform.service.MaterialService;
|
|
|
import com.abi.qms.platform.service.QrPackageService;
|
|
|
import com.abi.task.common.api.exception.BusinessException;
|
|
|
import com.abi.task.common.api.exception.ErrorCodeEnum;
|
|
@@ -108,9 +110,19 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
|
|
|
@Autowired
|
|
|
private BaseMaterialMapper baseMaterialMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private BaseBrandMapper baseBrandMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private QrPackageSapOrderItemMapper qrPackageSapOrderItemMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MaterialService materialService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FactoryService factoryService;
|
|
|
+
|
|
|
/**
|
|
|
* 保存码包
|
|
|
*/
|
|
@@ -786,19 +798,35 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
|
throw new BusinessException("更新tableStore异常");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public GetPackageCodeRes getPackageCodeType(GetPackageCodeReq req){
|
|
|
- //判断ID是否为空
|
|
|
- AssertUtil.isNull(req.getId(),"物料ID为空");
|
|
|
- //查询物料类型
|
|
|
- BaseSapMateriVO BaseSap=baseMaterialMapper.getPackageCodeType(req);
|
|
|
- AssertUtil.isNull(BaseSap, "物料不存在");
|
|
|
- //根据物料类型转换箱码类型
|
|
|
- Integer qrType = getPackageCode(BaseSap.getMaterialType());
|
|
|
- //转化出参
|
|
|
- GetPackageCodeRes res = PojoConverterUtils.copy(BaseSap, GetPackageCodeRes.class);
|
|
|
- //码类型赋值
|
|
|
- res.setQrType(qrType);
|
|
|
+ //1-查询sap订单明细
|
|
|
+ QrPackageSapOrderItem orderItem = qrPackageSapOrderItemMapper.selectById(req.getOrderItemId());
|
|
|
+ AssertUtil.isNull(orderItem,"订单明细不存在");
|
|
|
+
|
|
|
+ //2-查询对应物料
|
|
|
+ BaseMaterial material = materialService.getMaterialByCode(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()));
|
|
|
+
|
|
|
+ //4-查询啤酒厂
|
|
|
+ BaseFactory beerFactory = factoryService.getFactoryByCode(orderItem.getSapBeerFactoryId(), FactoryTypeEnum.BEER.getCode());
|
|
|
+ AssertUtil.isNull(beerFactory,String.format("SAP啤酒厂%s未创建对应的QMS系统内啤酒厂!",orderItem.getSapBeerFactoryId()));
|
|
|
+
|
|
|
+ GetPackageCodeRes res = new GetPackageCodeRes();
|
|
|
+ res.setFactoryCoverId(coverFactory.getId());
|
|
|
+ res.setFactoryBeerId(beerFactory.getId());
|
|
|
+ res.setFactoryCoverName(coverFactory.getFactoryName());
|
|
|
+ res.setFactoryBeerName(beerFactory.getFactoryName());
|
|
|
+ res.setIsFirstFactory(coverFactory.getIsFirstFactory());
|
|
|
+ res.setMaterialId(material.getId());
|
|
|
+ res.setPurchaseCount(orderItem.getPurchaseCount());
|
|
|
+ res.setQrType(getPackageCode(material.getMaterialType()));
|
|
|
+
|
|
|
return res;
|
|
|
}
|
|
|
|