|
|
@@ -26,8 +26,7 @@ import com.usoftchina.saas.document.mapper.DataImportMapper;
|
|
|
import com.usoftchina.saas.document.mapper.ProductDetailMapper;
|
|
|
import com.usoftchina.saas.document.mapper.ProductMapper;
|
|
|
import com.usoftchina.saas.document.mapper.WarehouseMapper;
|
|
|
-import com.usoftchina.saas.document.service.ProductService;
|
|
|
-import com.usoftchina.saas.document.service.WarehouseService;
|
|
|
+import com.usoftchina.saas.document.service.*;
|
|
|
import com.usoftchina.saas.exception.BizException;
|
|
|
import com.usoftchina.saas.page.PageRequest;
|
|
|
import com.usoftchina.saas.utils.CollectionUtils;
|
|
|
@@ -55,6 +54,12 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
private DataImportMapper dataImportMapper;
|
|
|
@Autowired
|
|
|
private WarehouseMapper warehouseMapper;
|
|
|
+ @Autowired
|
|
|
+ private ProductbrandService productbrandService;
|
|
|
+ @Autowired
|
|
|
+ private ProductunitService productunitService;
|
|
|
+ @Autowired
|
|
|
+ private ProducttypeService producttypeService;
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<ProductDTO> getProductsByCondition(PageRequest page, ListReqDTO listReqDTO) {
|
|
|
@@ -604,6 +609,9 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
if (!CollectionUtils.isEmpty(details)) {
|
|
|
Map<String, List<DataImportDetail>> datas = CollectionUtils.groupBy(details, DataImportDetail::getDd_codevalue);
|
|
|
Integer detno = null;
|
|
|
+ String brand = null;
|
|
|
+ String unit = null;
|
|
|
+ String kind = null;
|
|
|
for (String code : datas.keySet()) {
|
|
|
listDTO = new ProductListDTO();
|
|
|
List<ProductDetail> productDetails = new ArrayList<>();
|
|
|
@@ -616,13 +624,42 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
if (!StringUtils.isEmpty(product.getPr_whcode())) {
|
|
|
warehouse = warehouseMapper.selectWareHouse(product.getPr_whcode(), companyId);
|
|
|
if (null == warehouse) {
|
|
|
- err.append("物料编号为: " + product.getPr_code() + " 的物料仓库: "+ product.getPr_whname() +" 在系统中不存在,请确认数据是否正确");
|
|
|
+ err.append("物料编号为: " + product.getPr_code() + " 的物料仓库: "+ product.getPr_whname() +" 在系统中不存在");
|
|
|
break;
|
|
|
}
|
|
|
product.setPr_whid(warehouse.getId());
|
|
|
- product.setPr_status(Status.ENABLE.getDisplay());
|
|
|
- product.setPr_statuscode(Status.ENABLE.name());
|
|
|
+ product.setPr_whname(warehouse.getWh_description());
|
|
|
+ }
|
|
|
+ //验证品牌
|
|
|
+ brand = product.getPr_brand();
|
|
|
+ if (!StringUtils.isEmpty(brand)) {
|
|
|
+ Productbrand pr_brand = productbrandService.getComboByName(brand);
|
|
|
+ if (null == pr_brand) {
|
|
|
+ err.append("物料编号为: " + product.getPr_code() + " 的品牌: "+ product.getPr_brand() +" 在系统中不存在");
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ //验证单位
|
|
|
+ unit = product.getPr_unit();
|
|
|
+ if (!StringUtils.isEmpty(unit)) {
|
|
|
+ Productunit pr_unit = productunitService.getComboByName(unit);
|
|
|
+ if (null == pr_unit) {
|
|
|
+ err.append("物料编号为: " + product.getPr_code() + " 的单位: "+ product.getPr_unit() +" 在系统中不存在");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //验证类型
|
|
|
+ kind = product.getPr_kind();
|
|
|
+ if (!StringUtils.isEmpty(kind)) {
|
|
|
+ Producttype pr_kind = producttypeService.getTypeByName(kind);
|
|
|
+ if (null == pr_kind) {
|
|
|
+ err.append("物料编号为: " + product.getPr_code() + " 的类型: "+ product.getPr_kind() +" 在系统中不存在");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ product.setPr_status(Status.ENABLE.getDisplay());
|
|
|
+ product.setPr_statuscode(Status.ENABLE.name());
|
|
|
+
|
|
|
//编号不存在
|
|
|
if (i == 0) {
|
|
|
product.setId(0l);
|