Import UnitCode of basisQuantity to product.
I don't know which node is the better one to read the unitCode: grossPriceProductTradePrice or netPriceProductTradePrice. I have chosen the last one.
This commit is contained in:
@@ -788,8 +788,7 @@ public class ZUGFeRDImporter {
|
|||||||
List<Node> nodeList = getLineItemNodes();
|
List<Node> nodeList = getLineItemNodes();
|
||||||
List<Item> lineItemList = new ArrayList<>();
|
List<Item> lineItemList = new ArrayList<>();
|
||||||
|
|
||||||
for (Node n: nodeList
|
for (Node n: nodeList) {
|
||||||
) {
|
|
||||||
Item lineItem = new Item(null, null, null);
|
Item lineItem = new Item(null, null, null);
|
||||||
lineItem.setProduct(new Product(null,null,null,null));
|
lineItem.setProduct(new Product(null,null,null,null));
|
||||||
|
|
||||||
@@ -803,13 +802,21 @@ public class ZUGFeRDImporter {
|
|||||||
|
|
||||||
node = getNodeByName(nn.getChildNodes(), "ram:NetPriceProductTradePrice");
|
node = getNodeByName(nn.getChildNodes(), "ram:NetPriceProductTradePrice");
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
node = getNodeByName(node.getChildNodes(), "ram:ChargeAmount");
|
NodeList tradeAgreementChildren = node.getChildNodes();
|
||||||
lineItem.setPrice(tryBigDecimal(getNodeValue(node)));
|
node = getNodeByName(tradeAgreementChildren, "ram:ChargeAmount");
|
||||||
|
lineItem.setPrice(tryBigDecimal(getNodeValue(node)));
|
||||||
|
node = getNodeByName(tradeAgreementChildren, "ram:BasisQuantity");
|
||||||
|
if(node.getAttributes()!=null) {
|
||||||
|
Node unitCodeAttribute = node.getAttributes().getNamedItem("unitCode");
|
||||||
|
if(unitCodeAttribute != null) {
|
||||||
|
lineItem.getProduct().setUnit(unitCodeAttribute.getNodeValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node = getNodeByName(nn.getChildNodes(), "ram:GrossPriceProductTradePrice");
|
node = getNodeByName(nn.getChildNodes(), "ram:GrossPriceProductTradePrice");
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
node = getNodeByName(node.getChildNodes(), "ram:ChargeAmount");
|
node = getNodeByName(node.getChildNodes(), "ram:ChargeAmount");
|
||||||
lineItem.setGrossPrice(tryBigDecimal(getNodeValue(node)));
|
lineItem.setGrossPrice(tryBigDecimal(getNodeValue(node)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user