|
@@ -73,7 +73,9 @@ import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
|
|
|
import com.uas.platform.b2c.prod.product.component.dao.ComponentSubmitDao;
|
|
import com.uas.platform.b2c.prod.product.component.dao.ComponentSubmitDao;
|
|
|
import com.uas.platform.b2c.prod.product.component.modal.Component;
|
|
import com.uas.platform.b2c.prod.product.component.modal.Component;
|
|
|
import com.uas.platform.b2c.prod.product.component.modal.ComponentSubmit;
|
|
import com.uas.platform.b2c.prod.product.component.modal.ComponentSubmit;
|
|
|
|
|
+import com.uas.platform.b2c.prod.product.kind.dao.KindInfoDao;
|
|
|
import com.uas.platform.b2c.prod.product.kind.model.Kind;
|
|
import com.uas.platform.b2c.prod.product.kind.model.Kind;
|
|
|
|
|
+import com.uas.platform.b2c.prod.product.kind.model.KindInfo;
|
|
|
import com.uas.platform.b2c.prod.store.model.StoreIn;
|
|
import com.uas.platform.b2c.prod.store.model.StoreIn;
|
|
|
import com.uas.platform.b2c.prod.store.model.StoreStatus;
|
|
import com.uas.platform.b2c.prod.store.model.StoreStatus;
|
|
|
import com.uas.platform.b2c.prod.store.service.StoreInService;
|
|
import com.uas.platform.b2c.prod.store.service.StoreInService;
|
|
@@ -243,6 +245,9 @@ public class ProductServiceImpl implements ProductService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ProductReplaceDao productReplaceDao;
|
|
private ProductReplaceDao productReplaceDao;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private KindInfoDao kindInfoDao;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 控制任务提交速度的线程池
|
|
* 控制任务提交速度的线程池
|
|
|
*/
|
|
*/
|
|
@@ -2616,14 +2621,13 @@ public class ProductServiceImpl implements ProductService {
|
|
|
}
|
|
}
|
|
|
// 如果当前库存减去已存在的库存大于0,继续减去后面的库存数据
|
|
// 如果当前库存减去已存在的库存大于0,继续减去后面的库存数据
|
|
|
Goods goods = goodsList.get(i);
|
|
Goods goods = goodsList.get(i);
|
|
|
- if (subQty >= 0) {
|
|
|
|
|
- goods.setReserve(0D);
|
|
|
|
|
- goods = goodsDao.save(goods);
|
|
|
|
|
- } else {
|
|
|
|
|
- goods.setReserve(Math.abs(subQty));
|
|
|
|
|
- goods = goodsDao.save(goods);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Double reserve = subQty >= 0 ? 0 : subQty;
|
|
|
|
|
+ goods.setReserve(Math.abs(reserve));
|
|
|
|
|
+ goods = goodsDao.save(goods);
|
|
|
logger.info("上架商品库存操作", "卖家中心单个物料上传进行出库操作", existQty + "->" + goods.getReserve(), goods.getCode(), goods.getId());
|
|
logger.info("上架商品库存操作", "卖家中心单个物料上传进行出库操作", existQty + "->" + goods.getReserve(), goods.getCode(), goods.getId());
|
|
|
|
|
+ if (reserve <= 0) {
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2637,15 +2641,16 @@ public class ProductServiceImpl implements ProductService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public ResultMap checkCriterion(Product product) {
|
|
public ResultMap checkCriterion(Product product) {
|
|
|
- List<Brand> brands = brandDao.findByName(product.getBrand());
|
|
|
|
|
- // 先判断标准品牌信息
|
|
|
|
|
- if (CollectionUtils.isEmpty(brands)) {
|
|
|
|
|
- return ResultMap.error(new NotFoundException("品牌为非标准品牌"));
|
|
|
|
|
- }
|
|
|
|
|
- // 判断标准器件信息
|
|
|
|
|
- List<Component> components = componentDao.findByBrandidAndCode(brands.get(0).getId(), product.getCmpCode());
|
|
|
|
|
- if (CollectionUtils.isEmpty(components)) {
|
|
|
|
|
- return ResultMap.error(new NotFoundException("器件为非标准器件"));
|
|
|
|
|
|
|
+ if (!StringUtils.isEmpty(product.getKind())) {
|
|
|
|
|
+ KindInfo kindInfo = kindInfoDao.findByNameCn(product.getKind());
|
|
|
|
|
+ if (null == kindInfo) {
|
|
|
|
|
+ ResultMap.error(new NotFoundException(ErrorInfoConstant.KIND_UNSTANDARD.getInfo()));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Integer existChild = kindInfoDao.existsChildByParentId(UploadConstant.PCB_PARENTID, kindInfo.getId());
|
|
|
|
|
+ if (existChild == 0) {
|
|
|
|
|
+ ResultMap.error(new NotFoundException(ErrorInfoConstant.KIND_UNSTANDARD.getInfo()));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return ResultMap.success();
|
|
return ResultMap.success();
|
|
|
}
|
|
}
|