|
|
@ -554,13 +554,19 @@ public class PackageController { |
|
|
|
//打印几页(生成几个包装)
|
|
|
|
BigDecimal total = printQty.divide(packQty, 2, RoundingMode.HALF_UP); |
|
|
|
total = total.setScale(0, RoundingMode.CEILING); |
|
|
|
if(packQty.compareTo(printQty)>0){ |
|
|
|
//如果打印数量小于标包数量,则打印输入的打印数量,例标包数量是3,打印数量是1,则打印一页,数量是1
|
|
|
|
packQty = printQty; |
|
|
|
} |
|
|
|
//最后一页中的数量.取余数
|
|
|
|
BigDecimal remainder = printQty.remainder(packageDO.getQty()); |
|
|
|
BigDecimal remainder = printQty.remainder(packageDO.getPackQty()); |
|
|
|
for (int i = 0; i < total.intValue(); i++) { |
|
|
|
PackageDO newPackage = new PackageDO(); |
|
|
|
BeanUtils.copyProperties(packageDO, newPackage); |
|
|
|
if (i == total.intValue() - 1 && remainder.compareTo(BigDecimal.ZERO)!=0) { |
|
|
|
newPackage.setQty(remainder); |
|
|
|
}else { |
|
|
|
newPackage.setQty(packQty); |
|
|
|
} |
|
|
|
String number = serialNumberApi.generateCode(RuleCodeEnum.PACKING_NUMBER.getCode()); |
|
|
|
newPackage.setId(null); |
|
|
|