|
@@ -69,13 +69,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
public void addGoods(Goods goods, Integer operatorId) {
|
|
public void addGoods(Goods goods, Integer operatorId) {
|
|
Goods existsGood = goodsDao.findBySn(goods.getSn());
|
|
Goods existsGood = goodsDao.findBySn(goods.getSn());
|
|
if(Objects.nonNull(existsGood)){
|
|
if(Objects.nonNull(existsGood)){
|
|
- if(Objects.nonNull(existsGood.getComplementGoodsIdList())){
|
|
|
|
- throw new BizException("此货号组合商品已存在");
|
|
|
|
- }
|
|
|
|
- existsGood.setStockCount(existsGood.getStockCount()+goods.getStockCount());
|
|
|
|
- existsGood.setTaxStockCount(existsGood.getTaxStockCount()+existsGood.getTaxStockCount());
|
|
|
|
- existsGood.setSellCount(0);
|
|
|
|
- goodsDao.update(existsGood);
|
|
|
|
|
|
+ throw new BizException("商品货号重复");
|
|
}else{
|
|
}else{
|
|
if(Objects.isNull(goods.getStockCount())){
|
|
if(Objects.isNull(goods.getStockCount())){
|
|
goods.setStockCount(0);
|
|
goods.setStockCount(0);
|
|
@@ -90,8 +84,8 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public void addGoodsProcurement(Goods goods, Integer operatorId) {
|
|
|
|
- Goods existsGood = goodsDao.findBySn(goods.getSn());
|
|
|
|
|
|
+ public void addGoodsProcurement(GoodsProcurement goodsProcurement) {
|
|
|
|
+ Goods existsGood = goodsDao.get(goodsProcurement.getGoodsId());
|
|
|
|
|
|
if(Objects.isNull(existsGood)){
|
|
if(Objects.isNull(existsGood)){
|
|
throw new BizException("商品不存在");
|
|
throw new BizException("商品不存在");
|
|
@@ -101,29 +95,22 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
throw new BizException("此商品为组合商品");
|
|
throw new BizException("此商品为组合商品");
|
|
}
|
|
}
|
|
|
|
|
|
- if(Objects.isNull(goods.getStockCount())){
|
|
|
|
- goods.setStockCount(0);
|
|
|
|
|
|
+ if(Objects.isNull(goodsProcurement.getStockCount())){
|
|
|
|
+ goodsProcurement.setStockCount(0);
|
|
}
|
|
}
|
|
- if(Objects.isNull(goods.getTaxStockCount())){
|
|
|
|
- goods.setTaxStockCount(0);
|
|
|
|
|
|
+ if(Objects.isNull(goodsProcurement.getTaxStockCount())){
|
|
|
|
+ goodsProcurement.setTaxStockCount(0);
|
|
}
|
|
}
|
|
|
|
|
|
- existsGood.setStockCount(existsGood.getStockCount()+goods.getStockCount());
|
|
|
|
- existsGood.setTaxStockCount(existsGood.getTaxStockCount()+existsGood.getTaxStockCount());
|
|
|
|
|
|
+ existsGood.setStockCount(existsGood.getStockCount()+goodsProcurement.getStockCount());
|
|
|
|
+ existsGood.setTaxStockCount(existsGood.getTaxStockCount()+goodsProcurement.getTaxStockCount());
|
|
goodsDao.update(existsGood);
|
|
goodsDao.update(existsGood);
|
|
|
|
|
|
String batchNo = idGeneratorService.generatorId("payment") + "";
|
|
String batchNo = idGeneratorService.generatorId("payment") + "";
|
|
- GoodsProcurement gp = new GoodsProcurement();
|
|
|
|
- gp.setGoodsId(existsGood.getId());
|
|
|
|
- gp.setGoodsCategoryId(goods.getGoodsCategoryId());
|
|
|
|
- gp.setSupplyChannel(goods.getSupplyChannel());
|
|
|
|
- gp.setDiscountPrice(goods.getDiscountPrice());
|
|
|
|
- gp.setAgreeCostPrice(goods.getAgreeCostPrice());
|
|
|
|
- gp.setStockCount(goods.getStockCount());
|
|
|
|
- gp.setTaxStockCount(goods.getTaxStockCount());
|
|
|
|
- gp.setOperatorId(operatorId);
|
|
|
|
- gp.setBatchNo(batchNo);
|
|
|
|
- goodsProcurementDao.insert(gp);
|
|
|
|
|
|
+ goodsProcurement.setBatchNo(batchNo);
|
|
|
|
+ goodsProcurementDao.insert(goodsProcurement);
|
|
|
|
+
|
|
|
|
+ sellOrderBatchNoAllot();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|