|
|
@@ -15,10 +15,7 @@ import com.uas.platform.b2c.prod.commodity.constant.DoubleConstant;
|
|
|
import com.uas.platform.b2c.prod.commodity.constant.StringConstant;
|
|
|
import com.uas.platform.b2c.prod.commodity.dao.*;
|
|
|
import com.uas.platform.b2c.prod.commodity.model.*;
|
|
|
-import com.uas.platform.b2c.prod.commodity.service.GoodsHistoryService;
|
|
|
-import com.uas.platform.b2c.prod.commodity.service.GoodsService;
|
|
|
-import com.uas.platform.b2c.prod.commodity.service.ProductService;
|
|
|
-import com.uas.platform.b2c.prod.commodity.service.UASBatchPutOnPropertyService;
|
|
|
+import com.uas.platform.b2c.prod.commodity.service.*;
|
|
|
import com.uas.platform.b2c.prod.commodity.type.ProductConstant;
|
|
|
import com.uas.platform.b2c.prod.product.brand.dao.BrandDao;
|
|
|
import com.uas.platform.b2c.prod.product.brand.modal.Brand;
|
|
|
@@ -126,6 +123,9 @@ public class ProductServiceImpl implements ProductService {
|
|
|
@Autowired
|
|
|
private ProductModifyHistoryDao productModifyHistoryDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ReleaseProductByBatchService releaseProductByBatchService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private GoodsHistoryService goodsHistoryService;
|
|
|
|
|
|
@@ -242,7 +242,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
}
|
|
|
}
|
|
|
// 拿私有物料信息
|
|
|
- ProductPrivate productPrivate = productPrivateDao.findByPrId(product.getId());
|
|
|
+ ProductPrivate productPrivate = releaseProductByBatchService.findByPrId(product.getId());
|
|
|
if (null != productPrivate) {
|
|
|
product.setB2cEnabled(productPrivate.getB2cEnabled());
|
|
|
product.setBatchCount(productPrivate.getBatchCount());
|
|
|
@@ -414,7 +414,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
if (CollectionUtils.isNotEmpty(goodses)) {
|
|
|
goodsService.deleteGoods(goodses);
|
|
|
}
|
|
|
- ProductPrivate productPrivate = productPrivateDao.findByPrId(product.getId());
|
|
|
+ ProductPrivate productPrivate = releaseProductByBatchService.findByPrId(product.getId());
|
|
|
if (productPrivate == null) {
|
|
|
productPrivate = new ProductPrivate();
|
|
|
}
|
|
|
@@ -440,6 +440,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
List<ProductPerson> personList = new ArrayList<>();
|
|
|
Integer fail = 0;
|
|
|
Integer success = 0;
|
|
|
+ Integer isHave = 0;
|
|
|
Long uu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
if(ProductConstant.STANDARD.equals(type)) {
|
|
|
standard = IntegerConstant.YES_SHORT;
|
|
|
@@ -491,13 +492,18 @@ public class ProductServiceImpl implements ProductService {
|
|
|
productMatchResultDao.delete(productMatchResultSet);
|
|
|
goodsService.deleteGoods(goodses);
|
|
|
//productDao.delete(product.getId());
|
|
|
- ProductPrivate productPrivate = productPrivateDao.findByPrId(product.getId());
|
|
|
+ ProductPrivate productPrivate = releaseProductByBatchService.findByPrId(product.getId());
|
|
|
+ if (productPrivate.getB2cEnabled().equals(IntegerConstant.NO_SHORT)) {
|
|
|
+ fail++;
|
|
|
+ isHave++;
|
|
|
+ } else {
|
|
|
+ success++;
|
|
|
+ }
|
|
|
productPrivate.setB2cEnabled(IntegerConstant.NO_SHORT);
|
|
|
productPrivateDao.save(productPrivate);
|
|
|
if (!StringUtils.isEmpty(product.getCmpUuId())) {
|
|
|
uuids.add(product.getCmpUuId());
|
|
|
}
|
|
|
- success++;
|
|
|
}else {
|
|
|
fail++;
|
|
|
}
|
|
|
@@ -515,7 +521,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
if(success != 0) {
|
|
|
message += ",";
|
|
|
}
|
|
|
- message += "删除失败" + fail + "条,原因:该产品可能已经被其他单据引用,无法删除";
|
|
|
+ message += "删除失败" + (fail-isHave) + "条,原因:该产品可能已经被其他单据或个人物料库引用,无法删除";
|
|
|
}
|
|
|
//如果是全部都不能删除,才能设置失败的状态码
|
|
|
if((products.size() != 0) && (products.size() == fail.intValue())) {
|
|
|
@@ -880,7 +886,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
if (standardProduct == null) {
|
|
|
standardProduct = afterProduct;
|
|
|
} else {
|
|
|
- ProductPrivate productPrivate = productPrivateDao.findByPrId(product.getId());
|
|
|
+ ProductPrivate productPrivate = releaseProductByBatchService.findByPrId(product.getId());
|
|
|
if (productPrivate == null) {
|
|
|
productPrivate = new ProductPrivate();
|
|
|
}
|
|
|
@@ -908,7 +914,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
}
|
|
|
goodsHistoryDao.save(goodsHistoryList);
|
|
|
Product beforeProduct = productDao.findOne(beforeId);
|
|
|
- ProductPrivate productPrivate = productPrivateDao.findByPrId(beforeProduct.getId());
|
|
|
+ ProductPrivate productPrivate = releaseProductByBatchService.findByPrId(beforeProduct.getId());
|
|
|
if (productPrivate == null) {
|
|
|
productPrivate = new ProductPrivate();
|
|
|
}
|
|
|
@@ -981,7 +987,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
}
|
|
|
}
|
|
|
goodsDao.save(saveList);
|
|
|
- ProductPrivate productPrivate = productPrivateDao.findByPrId(product.getId());
|
|
|
+ ProductPrivate productPrivate = releaseProductByBatchService.findByPrId(product.getId());
|
|
|
if (productPrivate == null) {
|
|
|
productPrivate = new ProductPrivate();
|
|
|
}
|
|
|
@@ -1130,7 +1136,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
product.setKinden(matchResult.getKinden());
|
|
|
product.setKindid(matchResult.getKindid());
|
|
|
List<Product> products = productDao.findProductByPcmpcodeAndPbrandenAndEnUUAndStandard(product.getPcmpcode(), product.getPbranden(), product.getEnUU(), IntegerConstant.YES_SHORT);
|
|
|
- ProductPrivate productPrivate = productPrivateDao.findByPrId(product.getId());
|
|
|
+ ProductPrivate productPrivate = releaseProductByBatchService.findByPrId(product.getId());
|
|
|
if (productPrivate == null) {
|
|
|
productPrivate = new ProductPrivate();
|
|
|
}
|