9 天以前 67c5d3ea86cfaad45c0150b96949dbcb6729b4d0
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/materialstock/MesWmMaterialStockController.java
@@ -36,6 +36,7 @@
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -141,6 +142,11 @@
                    area -> vo.setAreaName(area.getName()));
            MapUtils.findAndThen(vendorMap, vo.getVendorId(),
                    vendor -> vo.setVendorName(vendor.getName()));
            // 计算可用量 = 在库数量 - 冻结数量 - 占用量
            BigDecimal quantity = vo.getQuantity() != null ? vo.getQuantity() : BigDecimal.ZERO;
            BigDecimal frozenQty = vo.getFrozenQuantity() != null ? vo.getFrozenQuantity() : BigDecimal.ZERO;
            BigDecimal reservedQty = vo.getReservedQuantity() != null ? vo.getReservedQuantity() : BigDecimal.ZERO;
            vo.setAvailableQuantity(quantity.subtract(frozenQty).subtract(reservedQty));
        });
    }