|
@@ -131,7 +131,7 @@ public class ChannelGoodsOrderServiceImpl extends ServiceImpl<ChannelGoodsOrderM
|
|
|
throw new ServiceException(channelGoods.getTitle() + "库存不足,请重新下单");
|
|
|
}
|
|
|
|
|
|
- // 更新库存
|
|
|
+ // 更新sku库存
|
|
|
boolean updateSku = goodsSkuService.update(new LambdaUpdateWrapper<GoodsSku>()
|
|
|
.set(GoodsSku::getQuantity, goodsSku.getQuantity() - channelGoods.getQuantity())
|
|
|
.set(GoodsSku::getSoldQty, goodsSku.getSoldQty() + channelGoods.getQuantity())
|
|
@@ -141,6 +141,14 @@ public class ChannelGoodsOrderServiceImpl extends ServiceImpl<ChannelGoodsOrderM
|
|
|
Assert.isTrue(updateSku,
|
|
|
"门店购买采购商品更新SKU库存失败。goodsId:" + goodsSku.getGoodsId() + ",skuId:" + goodsSku.getSkuId());
|
|
|
|
|
|
+ // 更新goods库存
|
|
|
+ boolean updateGoods = goodsService.update(new LambdaUpdateWrapper<Goods>()
|
|
|
+ .set(goods.getQuantity() - channelGoods.getQuantity() == 0, Goods::getStatus,
|
|
|
+ GoodsStatusEnum.PUT_OFF)
|
|
|
+ .set(Goods::getQuantity, goods.getQuantity() - channelGoods.getQuantity())
|
|
|
+ .eq(Goods::getGoodsId, goods.getGoodsId()));
|
|
|
+ Assert.isTrue(updateGoods, "门店购买采购商品更新GOODS库存失败。goodsId:" + goods.getGoodsId());
|
|
|
+
|
|
|
} else {
|
|
|
if (goods.getQuantity() < channelGoods.getQuantity()) {
|
|
|
throw new ServiceException(channelGoods.getTitle() + "库存不足,请重新下单");
|