2

I have been working on ADempiere these past few days and I am confused about something.

I created a new column on my database table named Other_Number with the reference type Quantity. Max length is 20.

On my Java source, I used BigDecimal.

Now every time I try to input exactly 20 digits on the Other_Number field, the last 4 digits gets rounded. Say if I input 12345678901234567891. When I try to save it, it becomes 12345678901234567000.

Other than that. All the records that gets saved on the database (PSQL) gets appended with ".000000000000" (that's 12 zeros).

Now I need to do something so that when I input 20 digits, the last 4 digits don't get rounded.

Also I need to get rid of that ".000000000000"

Can you please tell me why this is happening?

4

4 回答 4

2

ADempiere 作为财务 ERP 软件对于如何处理财务金额至关重要。在数据库中,确切的 BigDecimal 值必须保持其数据完整性。精度和舍入已在代码中尽可能完美地完成。作为知名项目 Compiere ERP 的一部分,iDempiere 和 Openbravo 也是其中的分支,这样的财务金额管理已经得到了很好的定义和解决。也许您需要在相应的窗口中设置精度http://wiki.idempiere.org/en/Currency_%28Window_ID-115%29 在此处输入图像描述

于 2016-01-02T03:01:59.197 回答
2

如果它实际上不是您想要的数字,而是某种仅包含数字的参考字段,请将应用程序字典中的定义更改为:

Reference: String 
Length: 20 
Value Format: 00000000000000000000 (i.e. 20 Zeros!)

这将强制输入仅为数字(即字母字符将被忽略!)并且因为它是一个字符串,所以不会四舍五入包含 20 个数字的字符串

于 2015-10-14T14:16:03.967 回答
1

在 Adempiere java 代码中使用“setScale”方法对值进行四舍五入

例子:

    BigDecimal len= value           
    len= len.setScale(2,4);
    setLength(len);
于 2013-11-22T07:40:15.753 回答
1

Adempiere 将支持多达 14(+5) 位数(万亿)的业务金额/数量(美元货币)。

What currency you are using, is it possible to use this much amount/quantity in ERP system ?

如果要更改逻辑,可以在DispalyType.java类的getNumberFormat方法中更改逻辑。

业务场景是什么?

于 2013-11-20T09:01:09.937 回答