优化浮点数bug

This commit is contained in:
lihao 2025-09-03 15:56:23 +08:00
parent 05c0570c0f
commit 06e7bd7acb
1 changed files with 4 additions and 3 deletions

View File

@ -12,6 +12,7 @@ import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
import nc.vo.mmpac.pmo.pac0002.entity.PMOHeadVO;
import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO;
import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFDouble;
import nc.vo.so.m30.entity.SaleOrderBVO;
import nccloud.baseapp.core.log.NCCForUAPLogger;
@ -84,9 +85,9 @@ public class saveBeforeCheckRule implements IRule<PMOAggVO> {
String ntotaloutnums = (ntotaloutnumsObj != null) ? ntotaloutnumsObj.toString() : "";
double ntotaloutnum = (ntotaloutnums.isEmpty()) ? 0 : Double.parseDouble(ntotaloutnums);// 累计生产数量
double bdnum = itemvo.getNastnum().getDouble();
if (sQty < (ntotaloutnum + bdnum)) {
throw new BusinessException("生产订单明细" + (i + 1) + ",累计生产数量'" + (ntotaloutnum + bdnum)
+ "'大于销售订单累计排产申请数量'" + sQty + "',无法保存!");
if (new UFDouble(sQty).compareTo((new UFDouble(ntotaloutnum).add(new UFDouble(bdnum)))) <0) {
throw new BusinessException("生产订单明细" + (i + 1) + ",累计生产数量'" + (new UFDouble(ntotaloutnum).add(new UFDouble(bdnum)).toString())
+ "'大于销售订单累计排产申请数量'" + (new UFDouble(sQty)).toString() + "',无法保存!");
}
} catch (NumberFormatException e) {
throw new BusinessException("累计排产申请数量转化数值失败" + e);