rev:double相加丢精度问题;
This commit is contained in:
@@ -253,7 +253,9 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
jo_in.put("frozen_qty", jo_in.getDoubleValue("frozen_qty") + change_qty);
|
||||
|
||||
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||
if (ivt_num_now != ivt_qty) {
|
||||
BigDecimal ivt_num_now_dec = new BigDecimal(ivt_num_now).setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal ivt_qty_dec = new BigDecimal(ivt_qty).setScale(3, RoundingMode.HALF_UP);
|
||||
if (!ivt_num_now_dec.equals(ivt_qty_dec)) {
|
||||
throw new BadRequestException("输入数据异常,请检查");
|
||||
}
|
||||
|
||||
@@ -269,9 +271,13 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
jo_in.put("frozen_qty", NumberUtil.sub(jo_in.getDoubleValue("frozen_qty"),change_qty));
|
||||
|
||||
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||
if (ivt_num_now != ivt_qty) {
|
||||
|
||||
BigDecimal ivt_num_now_dec = new BigDecimal(ivt_num_now).setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal ivt_qty_dec = new BigDecimal(ivt_qty).setScale(3, RoundingMode.HALF_UP);
|
||||
if (!ivt_num_now_dec.equals(ivt_qty_dec)) {
|
||||
throw new BadRequestException("输入数据异常,请检查");
|
||||
}
|
||||
|
||||
if (jo_in.getDoubleValue("frozen_qty") < 0) {
|
||||
throw new BadRequestException("冻结数不允许为负数!");
|
||||
}
|
||||
@@ -287,9 +293,14 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
jo_in.put("frozen_qty", NumberUtil.sub(jo_in.getDoubleValue("frozen_qty"),change_qty));
|
||||
|
||||
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||
if (ivt_num_now != ivt_qty) {
|
||||
|
||||
|
||||
BigDecimal ivt_num_now_dec = new BigDecimal(ivt_num_now).setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal ivt_qty_dec = new BigDecimal(ivt_qty).setScale(3, RoundingMode.HALF_UP);
|
||||
if (!ivt_num_now_dec.equals(ivt_qty_dec)) {
|
||||
throw new BadRequestException("输入数据异常,请检查");
|
||||
}
|
||||
|
||||
if (jo_in.getDoubleValue("ivt_qty") < 0) {
|
||||
throw new BadRequestException("库存数不允许为负数!");
|
||||
}
|
||||
@@ -308,7 +319,9 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
jo_in.put("frozen_qty", jo_in.getDoubleValue("frozen_qty") + change_qty);
|
||||
|
||||
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||
if (ivt_num_now != ivt_qty) {
|
||||
BigDecimal ivt_num_now_dec = new BigDecimal(ivt_num_now).setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal ivt_qty_dec = new BigDecimal(ivt_qty).setScale(3, RoundingMode.HALF_UP);
|
||||
if (!ivt_num_now_dec.equals(ivt_qty_dec)) {
|
||||
throw new BadRequestException("输入数据异常,请检查");
|
||||
}
|
||||
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'");
|
||||
@@ -327,7 +340,9 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
jo_in.put("canuse_qty", jo_in.getDoubleValue("canuse_qty") + change_qty);
|
||||
|
||||
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||
if (ivt_num_now != ivt_qty) {
|
||||
BigDecimal ivt_num_now_dec = new BigDecimal(ivt_num_now).setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal ivt_qty_dec = new BigDecimal(ivt_qty).setScale(3, RoundingMode.HALF_UP);
|
||||
if (!ivt_num_now_dec.equals(ivt_qty_dec)) {
|
||||
throw new BadRequestException("输入数据异常,请检查");
|
||||
}
|
||||
if (jo_in.getDoubleValue("canuse_qty") < 0) {
|
||||
@@ -350,9 +365,12 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
jo_in.put("canuse_qty", NumberUtil.sub(jo_in.getDoubleValue("canuse_qty"),change_qty));
|
||||
|
||||
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||
if (ivt_num_now != ivt_qty) {
|
||||
BigDecimal ivt_num_now_dec = new BigDecimal(ivt_num_now).setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal ivt_qty_dec = new BigDecimal(ivt_qty).setScale(3, RoundingMode.HALF_UP);
|
||||
if (!ivt_num_now_dec.equals(ivt_qty_dec)) {
|
||||
throw new BadRequestException("输入数据异常,请检查");
|
||||
}
|
||||
|
||||
if (jo_in.getDoubleValue("ivt_qty") < 0) {
|
||||
throw new BadRequestException("库存数不允许为负数!");
|
||||
}
|
||||
@@ -395,7 +413,9 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
jo_in.put("warehousing_qty", NumberUtil.sub(jo_in.getDoubleValue("warehousing_qty"),change_qty));
|
||||
|
||||
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||
if (ivt_num_now != ivt_qty) {
|
||||
BigDecimal ivt_num_now_dec = new BigDecimal(ivt_num_now).setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal ivt_qty_dec = new BigDecimal(ivt_qty).setScale(3, RoundingMode.HALF_UP);
|
||||
if (!ivt_num_now_dec.equals(ivt_qty_dec)) {
|
||||
throw new BadRequestException("输入数据异常,请检查");
|
||||
}
|
||||
if (jo_in.getDoubleValue("warehousing_qty") < 0) {
|
||||
@@ -414,7 +434,9 @@ public class StorPublicServiceImpl implements StorPublicService {
|
||||
jo_in.put("warehousing_qty", jo_in.getDoubleValue("warehousing_qty") + change_qty);
|
||||
|
||||
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||
if (ivt_num_now != ivt_qty) {
|
||||
BigDecimal ivt_num_now_dec = new BigDecimal(ivt_num_now).setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal ivt_qty_dec = new BigDecimal(ivt_qty).setScale(3, RoundingMode.HALF_UP);
|
||||
if (!ivt_num_now_dec.equals(ivt_qty_dec)) {
|
||||
throw new BadRequestException("输入数据异常,请检查");
|
||||
}
|
||||
if (jo_in.getDoubleValue("ivt_qty") < 0) {
|
||||
|
||||
Reference in New Issue
Block a user