库存扣减

This commit is contained in:
2026-03-31 14:11:02 +08:00
parent 5874571200
commit 0f2ecc5b7d

View File

@@ -78,9 +78,7 @@ public class ProductRpcServiceImpl implements ProductRpcService {
continue;
}
// 商品未开启库存
if (product.getIsStock() == SystemConstants.OneZero.ZERO) {
continue;
}
if (product.getIsStock() == SystemConstants.OneZero.ONE) {
productMapper.updateProductStockNum(dto.getProductId(), dto.getShopId(), "sub", dto.getNum());
// 记录商品库存流水
ProductStockFlow flow = new ProductStockFlow();
@@ -102,6 +100,8 @@ public class ProductRpcServiceImpl implements ProductRpcService {
if (!isLowWarnLine && NumberUtil.isLess(flow.getAfterNumber(), Convert.toBigDecimal(warnLine))) {
isLowWarnLine = true;
}
}
// 查询商品绑定耗材信息
List<ProdConsRelation> relationList = prodConsRelationMapper.selectListByQuery(QueryWrapper.create().eq(ProdConsRelation::getProductId, dto.getProductId()));
if (CollUtil.isEmpty(relationList)) {