To calculate the sum of the TotalQuantity field in the List vmiListGtZero, you can use the following code:

import java.math.BigDecimal;
import java.util.List;

public BigDecimal calculateTotalQuantitySum(List<VmiMaterialDocument> vmiListGtZero) {
    BigDecimal sum = BigDecimal.ZERO;
    for (VmiMaterialDocument document : vmiListGtZero) {
        sum = sum.add(document.getTotalQuantity());
    }
    return sum;
}

This code iterates over each VmiMaterialDocument object in the list and adds its TotalQuantity field to the sum variable using the add() method of BigDecimal. Finally, it returns the sum as a BigDecimal object.

Note: Make sure to replace VmiMaterialDocument with the actual class name of your object.

ListVmiMaterialDocument vmiListGtZero;累计上述对象的TotalQuantity字段的合计返回BigDecimal

原文地址: http://www.cveoy.top/t/topic/i8CJ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录