库存扣减

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