Commit 1bf7197c authored by shiyu's avatar shiyu

转拍卖商品卖出后,原商品也扣减库存

parent 326120bb
...@@ -444,6 +444,16 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -444,6 +444,16 @@ public class SupplierItemServiceImpl implements SupplierItemService {
}*/ }*/
int updateStock = currentStock - stock; int updateStock = currentStock - stock;
supplierItemDao.updateStock(itemId, updateStock); supplierItemDao.updateStock(itemId, updateStock);
//拍卖商品,检查是否是别的商品转拍卖,是的话原商品的库存也要扣减
if (supplierItem.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) {
if (supplierItem.getSupplierId() != null) {
SupplierItem sourceItem = supplierItemDao.findById(supplierItem.getSupplierId());
//当前库存
int sourceItemStock = sourceItem.getStock();
supplierItemDao.updateStock(supplierItem.getSupplierId(), (sourceItemStock - stock));
}
}
return Result.success(); return Result.success();
} else { } else {
return Result.failed("扣减库存失败"); return Result.failed("扣减库存失败");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment