|
|
|
|
@ -125,14 +125,16 @@ public class ErpProductServiceImpl implements ErpProductService {
|
|
|
|
|
throw exception(PRODUCT_CATEGORY_NOT_EXISTS);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Long id = productCategory.getParentId();
|
|
|
|
|
// Long id = productCategory.getParentId();
|
|
|
|
|
product.setSubCategoryName(productCategory.getName());
|
|
|
|
|
product.setSubCategoryId(product.getCategoryId());
|
|
|
|
|
while(id != 0) {
|
|
|
|
|
productCategory = productCategoryMapper.selectById(id);
|
|
|
|
|
product.setCategoryId(id);
|
|
|
|
|
id = productCategory.getParentId();
|
|
|
|
|
}
|
|
|
|
|
product.setCategoryId(product.getCategoryId());
|
|
|
|
|
|
|
|
|
|
// while(id != 0) {
|
|
|
|
|
// productCategory = productCategoryMapper.selectById(id);
|
|
|
|
|
// product.setCategoryId(id);
|
|
|
|
|
// id = productCategory.getParentId();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 自动生成才拼接 分类编码-流水号;手工输入则原样保存
|
|
|
|
|
if (autoGeneratedCode) {
|
|
|
|
|
@ -311,6 +313,8 @@ public class ErpProductServiceImpl implements ErpProductService {
|
|
|
|
|
if (product == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
ErpProductCategoryDO erpProductCategoryDO = productCategoryMapper.selectOne(Wrappers.<ErpProductCategoryDO>lambdaQuery().eq(ErpProductCategoryDO::getId, product.getSubCategoryId()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String qrcodeUrl = qrcodeService.selectQrcodeUrlByIdAndCode(
|
|
|
|
|
QrcodeBizTypeEnum.PRODUCT.getCode(), id, product.getBarCode());
|
|
|
|
|
@ -319,6 +323,9 @@ public class ErpProductServiceImpl implements ErpProductService {
|
|
|
|
|
ErpProductRespVO respVO = BeanUtils.toBean(product, ErpProductRespVO.class);
|
|
|
|
|
respVO.setDevices(productMapper.selectDevicesByProductId(id));
|
|
|
|
|
respVO.setMolds(productMapper.selectMoldsByProductId(id));
|
|
|
|
|
if (erpProductCategoryDO !=null ){
|
|
|
|
|
respVO.setCategoryType(erpProductCategoryDO.getType());
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// respVO.setDeviceIds(respVO.getDevices().stream()
|
|
|
|
|
// .map(ProductRelationRespVO::getId)
|
|
|
|
|
@ -377,6 +384,15 @@ public class ErpProductServiceImpl implements ErpProductService {
|
|
|
|
|
return buildProductVOList(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ErpProductRespVO> getProductVOListByCategory(Integer categoryId, Integer categoryType) {
|
|
|
|
|
ErpProductListReqVO reqVO = new ErpProductListReqVO();
|
|
|
|
|
reqVO.setCategoryId(categoryId == null ? null : categoryId.longValue());
|
|
|
|
|
reqVO.setCategoryType(categoryType);
|
|
|
|
|
List<ErpProductDO> list = productMapper.selectList(reqVO);
|
|
|
|
|
return buildProductVOList(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ErpProductRespVO> getProductVOList(Collection<Long> ids) {
|
|
|
|
|
if (CollUtil.isEmpty(ids)) {
|
|
|
|
|
|