UBL updates : adding delivery (incomplete)
This commit is contained in:
@@ -74,6 +74,50 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
|||||||
|
|
||||||
if (currentItemNode.getLocalName() != null) {
|
if (currentItemNode.getLocalName() != null) {
|
||||||
String currentUBLChild = currentItemNode.getLocalName();
|
String currentUBLChild = currentItemNode.getLocalName();
|
||||||
|
if (currentUBLChild.equals("Delivery")) {
|
||||||
|
NodeList delivery = currentItemNode.getChildNodes();
|
||||||
|
for (int deliveryIndex = 0; deliveryIndex < delivery.getLength(); deliveryIndex++) {
|
||||||
|
if (delivery.item(deliveryIndex).getLocalName() != null) {
|
||||||
|
Node currentNode = delivery.item(deliveryIndex);
|
||||||
|
if (currentNode.getLocalName().equals("DeliveryLocation")) {
|
||||||
|
NodeList deliveryLocation = currentNode.getChildNodes();
|
||||||
|
for (int deliveryLocationIndex = 0; deliveryLocationIndex < deliveryLocation.getLength(); deliveryLocationIndex++) {
|
||||||
|
if (deliveryLocation.item(deliveryLocationIndex).getLocalName() != null){
|
||||||
|
if (deliveryLocation.item(deliveryLocationIndex).getLocalName().equals("ID")) {
|
||||||
|
//Node currentNode = partyID.item(partyIDIndex);
|
||||||
|
setID(deliveryLocation.item(deliveryLocationIndex).getTextContent());
|
||||||
|
if ((deliveryLocation.item(deliveryLocationIndex).getAttributes() != null &&
|
||||||
|
(deliveryLocation.item(deliveryLocationIndex).getAttributes().getNamedItem("schemeID") != null))
|
||||||
|
) {
|
||||||
|
//SchemedID gid = new SchemedID().setScheme(nodes.item(nodeIndex).getAttributes().getNamedItem("schemeID").getNodeValue()).setId(nodes.item(nodeIndex).getTextContent());
|
||||||
|
// addGlobalID(gid);
|
||||||
|
SchemedID sID = new SchemedID().setScheme(deliveryLocation.item(deliveryLocationIndex).getAttributes().getNamedItem("schemeID").getTextContent());
|
||||||
|
addGlobalID(sID);
|
||||||
|
|
||||||
|
//&& ((currentNode.getAttributes().getNamedItem("schemeID").getNodeValue().equals("0110") && currentNode.getAttributes().getNamedItem("schemeID").getNodeValue().equals("0100"))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (deliveryLocation.item(deliveryLocationIndex).getLocalName().equals("Address")) {
|
||||||
|
NodeList address = deliveryLocation.item(deliveryLocationIndex).getChildNodes();
|
||||||
|
for (int addressIndex = 0; addressIndex < address.getLength(); addressIndex++) {
|
||||||
|
if (address.item(addressIndex).getLocalName() != null) {
|
||||||
|
if (address.item(addressIndex).getLocalName().equals("StreetName")) {
|
||||||
|
//Node currentNode = partyID.item(partyIDIndex);
|
||||||
|
setStreet(address.item(addressIndex).getTextContent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (currentUBLChild.equals("Party")) {
|
if (currentUBLChild.equals("Party")) {
|
||||||
|
|
||||||
NodeList party = currentItemNode.getChildNodes();
|
NodeList party = currentItemNode.getChildNodes();
|
||||||
@@ -173,6 +217,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTopElementName.equals("PostalAddress")) {
|
if (currentTopElementName.equals("PostalAddress")) {
|
||||||
|
|
||||||
NodeList postal = party.item(partyIndex).getChildNodes();
|
NodeList postal = party.item(partyIndex).getChildNodes();
|
||||||
@@ -280,6 +325,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
XPath xpath = xpathFact.newXPath();
|
XPath xpath = xpathFact.newXPath();
|
||||||
XPathExpression xpr = xpath.compile("//*[local-name()=\"SellerTradeParty\"]|//*[local-name()=\"AccountingSupplierParty\"]/*");
|
XPathExpression xpr = xpath.compile("//*[local-name()=\"SellerTradeParty\"]|//*[local-name()=\"AccountingSupplierParty\"]/*");
|
||||||
NodeList SellerNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
NodeList SellerNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
XPathExpression shipEx = xpath.compile("//*[local-name()=\"ShipToTradeParty\"]");
|
XPathExpression shipEx = xpath.compile("//*[local-name()=\"ShipToTradeParty\"]|//*[local-name()=\"DeliveryLocation\"]");
|
||||||
NodeList deliveryNodes = (NodeList) shipEx.evaluate(getDocument(), XPathConstants.NODESET);
|
NodeList deliveryNodes = (NodeList) shipEx.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
if (deliveryNodes != null) {
|
if (deliveryNodes != null) {
|
||||||
zpp.setDeliveryAddress(new TradeParty(deliveryNodes));
|
zpp.setDeliveryAddress(new TradeParty(deliveryNodes));
|
||||||
@@ -371,7 +371,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
deliveryDate = new SimpleDateFormat("yyyy-MM-dd").parse(deliveryDt);
|
deliveryDate = new SimpleDateFormat("yyyy-MM-dd").parse(deliveryDt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xpr = xpath.compile("//*[local-name()=\"ApplicableHeaderTradeDelivery\"]");
|
xpr = xpath.compile("//*[local-name()=\"ApplicableHeaderTradeDelivery\"]|//*[local-name()=\"Delivery\"]");
|
||||||
NodeList headerTradeDeliveryNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
NodeList headerTradeDeliveryNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
|
|
||||||
for (int i = 0; i < headerTradeDeliveryNodes.getLength(); i++) {
|
for (int i = 0; i < headerTradeDeliveryNodes.getLength(); i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user