1.单价四舍五入保留两位小数
This commit is contained in:
ljw 2024-11-04 21:03:36 +08:00
parent 582c32cbd8
commit cad34ebca4

View File

@ -38,7 +38,7 @@ public class ClientUtils {
String Entityname = dataEntity.getDataEntityType().getName();
BigDecimal yem_exrate = dataEntity.getBigDecimal("yem_exrate");
DynamicObjectCollection detailedinfor = getTypeColl(models);
DynamicObjectCollection materialInfo = dataEntity.getDynamicObjectCollection("yem_es_materialinfo");
// DynamicObjectCollection materialInfo = dataEntity.getDynamicObjectCollection("yem_es_materialinfo");
//提示
StringBuffer info = new StringBuffer();
@ -46,7 +46,7 @@ public class ClientUtils {
List<DynamicObject> pjDatas = new ArrayList<DynamicObject>();
List<DynamicObject> selectDatas = new ArrayList<DynamicObject>();
int rowInfo = 0;
boolean flag = false;
// boolean flag = false;
for (DynamicObject temp : detailedinfor) {
if (Entityname.equals("yem_es_xsalesorder")) {
String yem_linetype = temp.getString("yem_linetype");
@ -549,7 +549,8 @@ public class ClientUtils {
// BigDecimal pricefieldacc = (BigDecimal) model.getValue("yem_pricefieldaccba", rowNow);
BigDecimal truecaramt = (BigDecimal) model.getValue("yem_truecaramt", rowNow); // 实际整车金额
BigDecimal qty = (BigDecimal) model.getValue("yem_qty", rowNow);
model.setValue("yem_truecarprice", BigDecimalUtils.div(truecaramt, qty, 2), rowNow);
// model.setValue("yem_truecarprice", BigDecimalUtils.div(truecaramt, qty, 2), rowNow);
model.setValue("yem_truecarprice", truecaramt.divide(qty,2, RoundingMode.HALF_UP), rowNow);
} else {
model.setValue("yem_truecarprice", null, rowNow);
}
@ -1234,7 +1235,7 @@ public class ClientUtils {
BigDecimal priceFieldAccBa = (BigDecimal) model.getValue("yem_pricefieldaccba", row);//资源配置单价
BigDecimal oneCarSum = (BigDecimal) model.getValue("yem_onecarsum", row);//单车总费用
BigDecimal saamtpriceclause = (BigDecimal) model.getValue("yem_saamtpriceclause", row);// 销售金额价格条款
model.setValue("yem_sapricepriceclause", BigDecimalUtils.div(saamtpriceclause, qty, 2), row);
model.setValue("yem_sapricepriceclause", saamtpriceclause.divide(qty,2, RoundingMode.HALF_UP), row);
// if (afterFrontDisPrice.compareTo(BigDecimal.ZERO) > 0) {
// // 销售单价价格条款= 销售金额价格条款 / 数量
@ -1293,7 +1294,7 @@ public class ClientUtils {
if (billtype == null) return;
String type = billtype.getString("number");
if (ArrayUtils.contains(roundArr, type)) {
model.setValue("yem_saamtpriceclause", calculate.setScale(0, RoundingMode.UP), rowNow);
model.setValue("yem_saamtpriceclause", calculate.setScale(2, RoundingMode.UP), rowNow);
} else {
model.setValue("yem_saamtpriceclause", calculate, rowNow);
}
@ -1317,7 +1318,7 @@ public class ClientUtils {
BigDecimal onecarsum = (BigDecimal) model.getValue("yem_onecarsum", row);//单车总费用
BigDecimal pricefieldaccba = (BigDecimal) model.getValue("yem_pricefieldaccba", row);//资源配件单价
BigDecimal add = afterfrontdisprice.add(onecarsum).add(pricefieldaccba);
add = add.setScale(0, RoundingMode.UP);
add = add.setScale(2, RoundingMode.HALF_UP);
model.setValue("yem_sapricepriceclause", add, row);
}
@ -1344,7 +1345,7 @@ public class ClientUtils {
BigDecimal afterfrontdisprice = (BigDecimal) model.getValue("yem_afterfrontdisprice", row);
BigDecimal onecarsum = (BigDecimal) model.getValue("yem_onecarsum", row);
BigDecimal add = afterfrontdisprice.add(onecarsum);
add = add.setScale(0, RoundingMode.UP);
add = add.setScale(2, RoundingMode.HALF_UP);
model.setValue("yem_truecarprice", add, row);
}
@ -1900,7 +1901,8 @@ public class ClientUtils {
if (idx != -1) {
BigDecimal standardprice = (BigDecimal) model.getValue("yem_standardprice", idx);//标配FOB青岛
BigDecimal exrate = (BigDecimal) model.getValue("yem_exrate");//汇率
BigDecimal calc = BigDecimalUtils.div(standardprice, exrate, 10);
// BigDecimal calc = BigDecimalUtils.div(standardprice, exrate, 10);
BigDecimal calc = standardprice.divide(exrate,10,RoundingMode.HALF_UP);
calc = calc.setScale(0, RoundingMode.UP);
model.setValue("yem_sastandardfcaprice", calc, idx);
}