Netsuite,如何搜索开放供应商账单(交易)
Netsuite, how to search for Open Vendor Bills (Transactions)
这看起来很简单,但与 netsuite 一样,这很痛苦。这是我目前所拥有的:
TransactionSearch invoiceSearch = new TransactionSearch();
TransactionSearchBasic invoiceSearchBasic = new TransactionSearchBasic();
SearchEnumMultiSelectField criteria = new SearchEnumMultiSelectField();
criteria.setOperator(SearchEnumMultiSelectFieldOperator.ANY_OF);
String[] statuses = new String[] { TransactionStatus.BILL_OPEN.toString() };
stats.getSearchValue().addAll(Arrays.asList(statuses));
invoiceSearchBasic.setStatus(stats);
如果我注释掉 invoiceSearchBasic.setStatus 行,我会得到所有交易(包括我想要的状态为 "Open" 的交易)但是当它出现时我什么也得不到。不用说将 TransactionStatus.BILL_OPEN.toString() 更改为 "Open" 也不起作用,那太容易了!
好的,我已经解决了。对于其他人来说,这就是问题所在:
来自 TransactionStatus 枚举:
@XmlEnumValue("_billOpen")
BILL_OPEN("_billOpen")
当您记录 toString 值时,它给出 BILL_OPEN(不是 _billOpen)
但我们需要 _billOpen!
解决方案:
SearchEnumMultiSelectField criteria = new SearchEnumMultiSelectField();
criteria.setOperator(SearchEnumMultiSelectFieldOperator.ANY_OF);
String[] statuses = new String[] { "_billOpen" };
criteria.getSearchValue().addAll(Arrays.asList(statuses));
这看起来很简单,但与 netsuite 一样,这很痛苦。这是我目前所拥有的:
TransactionSearch invoiceSearch = new TransactionSearch();
TransactionSearchBasic invoiceSearchBasic = new TransactionSearchBasic();
SearchEnumMultiSelectField criteria = new SearchEnumMultiSelectField();
criteria.setOperator(SearchEnumMultiSelectFieldOperator.ANY_OF);
String[] statuses = new String[] { TransactionStatus.BILL_OPEN.toString() };
stats.getSearchValue().addAll(Arrays.asList(statuses));
invoiceSearchBasic.setStatus(stats);
如果我注释掉 invoiceSearchBasic.setStatus 行,我会得到所有交易(包括我想要的状态为 "Open" 的交易)但是当它出现时我什么也得不到。不用说将 TransactionStatus.BILL_OPEN.toString() 更改为 "Open" 也不起作用,那太容易了!
好的,我已经解决了。对于其他人来说,这就是问题所在:
来自 TransactionStatus 枚举:
@XmlEnumValue("_billOpen")
BILL_OPEN("_billOpen")
当您记录 toString 值时,它给出 BILL_OPEN(不是 _billOpen)
但我们需要 _billOpen!
解决方案:
SearchEnumMultiSelectField criteria = new SearchEnumMultiSelectField();
criteria.setOperator(SearchEnumMultiSelectFieldOperator.ANY_OF);
String[] statuses = new String[] { "_billOpen" };
criteria.getSearchValue().addAll(Arrays.asList(statuses));