|
|
@@ -2418,6 +2418,8 @@ public class ProductServiceImpl implements ProductService {
|
|
|
product.setPcmpcode(product.getCmpCode());
|
|
|
product.setKind(product.getProdName());
|
|
|
product.setSourceApp("B2C");
|
|
|
+ product.setEnUU(enUU);
|
|
|
+ product.setUserUU(userUU);
|
|
|
product.setCreateTime(new Date(System.currentTimeMillis()));
|
|
|
// PCB产品做标准判断处理
|
|
|
if (null != isPcb && Objects.equals(IntegerConstant.YES_SHORT, isPcb)) {
|
|
|
@@ -2440,6 +2442,13 @@ public class ProductServiceImpl implements ProductService {
|
|
|
// 物料不存在,新增操作
|
|
|
productInfo = product;
|
|
|
}
|
|
|
+ if (null == productInfo.getStandard()) {
|
|
|
+ productInfo.setStandard(IntegerConstant.NO_SHORT);
|
|
|
+ }
|
|
|
+ if (StringUtilB2C.isEmpty(productInfo.getProdNum())) {
|
|
|
+ String code = "PNUM" + StringUtilB2C.getRandomNumber(6);
|
|
|
+ productInfo.setProdNum(code);
|
|
|
+ }
|
|
|
// 最小包装数默认为1
|
|
|
Double minPackQty = productInfo.getMinPackQty() == null ? DoubleConstant.minReserve : productInfo.getMinPackQty();
|
|
|
productInfo.setMinPackQty(minPackQty);
|
|
|
@@ -2447,9 +2456,9 @@ public class ProductServiceImpl implements ProductService {
|
|
|
// 最小起订量默认为最小包装数
|
|
|
Double minBuyQty = productInfo.getMinOrder() == null ? productInfo.getMinPackQty() : productInfo.getMinOrder();
|
|
|
productInfo.setMinOrder(minBuyQty);
|
|
|
+ productInfo = productDao.save(productInfo);
|
|
|
// 设置库存信息
|
|
|
assignmentGoods(goods, productInfo);
|
|
|
- productInfo = productDao.save(productInfo);
|
|
|
// 保存到商城私有库
|
|
|
ProductPrivate productPrivate = new ProductPrivate(productInfo.getId());
|
|
|
productPrivate.setAttach(product.getAttachment());
|
|
|
@@ -2675,19 +2684,6 @@ public class ProductServiceImpl implements ProductService {
|
|
|
goodsService.setGoodsDefault(goods);
|
|
|
boolean autoPublish = goods.getAutoPublish() == null ? true : goods.getAutoPublish();
|
|
|
goods.setAutoPublish(autoPublish);
|
|
|
- final Double minBuyQty = goods.getMinBuyQty();
|
|
|
- if (CollectionUtils.isNotEmpty(goods.getPrices())) {
|
|
|
- goods.getPrices().forEach(subPrice -> {
|
|
|
- // 分段数量不能超过最大数量
|
|
|
- Double endQty = NumberUtil.compare(subPrice.getEnd(), DoubleConstant.maxReserve) == 1 ? DoubleConstant.maxReserve : subPrice.getEnd();
|
|
|
- subPrice.setEnd(endQty);
|
|
|
-
|
|
|
- // 起始数量不能大于最小订购数
|
|
|
- Double startQty = NumberUtil.compare(minBuyQty, subPrice.getStart()) == 1 ? subPrice.getStart() : minBuyQty;
|
|
|
- subPrice.setStart(startQty);
|
|
|
- });
|
|
|
- }
|
|
|
- goods.setQtyPrice(JSON.toJSONString(goods.getPrices()));
|
|
|
StoreIn storeIn = storeInService.findByEnUU(SystemSession.getUser().getEnterprise().getUu());
|
|
|
if (storeIn != null && storeIn.getStatus() == StoreStatus.OPENED) {
|
|
|
goods.setStoreid(storeIn.getUuid());
|