如果<bby:SaleTenderType>
是电子商务,则生成所有自定义字段<Reason>102</Reason>
<c360:RestockingFee>0.00</c360:RestockingFee>
以及其他字段
否则,
生成其他字段(<Reason>
和<c360:RestockingFee>
除外)
示例XML:
<?xml version="1.0" encoding="UTF-8"?>
<Transaction>
<RetailTransaction>
<LineItem>
<Return ItemType="Stock">
<POSIdentity POSIDType="POSIdentity">
<POSItemID>6000000005</POSItemID>
</POSIdentity>
<ItemID>6000000005</ItemID>
<MerchandiseHierarchy Level="POSDepartment">800000039</MerchandiseHierarchy>
<Description>MODEM BLASTER V.92 USB</Description>
<UnitListPrice>50.99</UnitListPrice>
<ExtendedAmount>-50.99</ExtendedAmount>
<ExtendedDiscountAmount>-50.99</ExtendedDiscountAmount>
<Quantity>-1.00</Quantity>
<AssociateID>105251</AssociateID>
</Associate>
<Tax></Tax>
<TransactionLink ReasonCode="Return"></TransactionLink>
<ItemLink>01980</ItemLink>
<c360:SalesOrder>HD0010502948000010</c360:SalesOrder>
<Reason>101</Reason>
<c360:RestockingFee>0.00</c360:RestockingFee>
<c360:SizeCode></c360:SizeCode>
<Tender>
<TenderID>Gift Card</TenderID>
<Amount>-50.99</Amount>
<Authorization ElectronicSignature="false">
</Authorization>
<GiftCard>
<c360:CurrencyID>1</c360:CurrencyID>
<bby:SaleTenderType>eCommerce</bby:SaleTenderType>
<bby:OrderNumber>84838348938938934893</bby:OrderNumber>
</Tender>
</Return>
</LineItem>
</RetailTransaction>
</Transaction>
我实施的代码如下......
if(transactions.item(a1).hasChildNodes()){
NodeList nTranList = transactions.item(a1).getChildNodes();
for (int b1= 0; b1< nTranList.getLength(); b1++) {
if(nTranList.item(b1).hasChildNodes()){
NodeList retailChildren = nTranList.item(b1).getChildNodes();
for (int j = 0; j < retailChildren.getLength(); j++)
{
if(retailChildren.item(j).getNodeName().equalsIgnoreCase("LineItem"))
{
NodeList Lineitems = retailChildren.item(j).getChildNodes();
Lineitems = retailChildren.item(j).getChildNodes();
for (int z1 = 0; z1 < Lineitems.getLength(); z1++) {
if(Lineitems.item(z1).getNodeName().equalsIgnoreCase("Return")){
NodeList returnChild1 = Lineitems.item(z1).getChildNodes();
for (int z2 = 0; z2 < returnChild1.getLength(); z2++) {
if(returnChild1.item(z2).getNodeName().equalsIgnoreCase("Tender")){
for (int z3 = 0; z3 < returnChild1.getLength(); z3++) {
if(returnChild1.item(z3).getNodeName().equalsIgnoreCase("bby:SaleTenderType")){
String SaleTenderType = returnChild1.item(z3).getFirstChild().getNodeValue();
if(SaleTenderType.equalsIgnoreCase("eCommerce"))
{
Lineitems = retailChildren.item(j).getChildNodes();
for (int i2 = 0; i2 < Lineitems.getLength(); i2++) {
if(Lineitems.item(i2).getNodeName().equalsIgnoreCase("Return")){
NodeList returnChild = Lineitems.item(i2).getChildNodes();
for (int k = 0; k < returnChild.getLength(); k++) {
if(returnChild.item(k).getNodeName().equalsIgnoreCase("c360:SalesOrder")){
String POSLOGSalesOrderNo = returnChild.item(k).getFirstChild().getNodeValue();
SalesOrderNo = POSLOGSalesOrderNo.substring(2,12);
String SalesOrderNum = POSLOGSalesOrderNo.substring(0,2);
if(SalesOrderNum.equalsIgnoreCase("HD")||(SalesOrderNum.equalsIgnoreCase("SV"))||(SalesOrderNum.equalsIgnoreCase("CR"))||(SalesOrderNum.equalsIgnoreCase("CW")))
{
if ( !prevSalesOrder.equals(SalesOrderNo))
{
IDocEl = outdoc.createElement("IDOC");
ORDERS05.appendChild(createIDocHeader_GC(POSLOGSalesOrderNo,outdoc,EMPST,IDocEl,StoreID,true,returnChild,TRANS));
prevSalesOrder = SalesOrderNo;
}
IDocEl.appendChild(createE1EDP01forReturnLineItem_GC(outdoc,returnChild,StoreID));
}
}
}
}
}
}
else
{
Lineitems = retailChildren.item(j).getChildNodes();
for (int i3 = 0; i3 < Lineitems.getLength(); i3++) {
if(Lineitems.item(i3).getNodeName().equalsIgnoreCase("Return")){
NodeList returnChild = Lineitems.item(i3).getChildNodes();
for (int k = 0; k < returnChild.getLength(); k++) {
if(returnChild.item(k).getNodeName().equalsIgnoreCase("c360:SalesOrder")){
String POSLOGSalesOrderNo = returnChild.item(k).getFirstChild().getNodeValue();
SalesOrderNo = POSLOGSalesOrderNo.substring(2,12);
String SalesOrderNum = POSLOGSalesOrderNo.substring(0,2);
if(SalesOrderNum.equalsIgnoreCase("HD")||(SalesOrderNum.equalsIgnoreCase("SV"))||(SalesOrderNum.equalsIgnoreCase("CR"))||(SalesOrderNum.equalsIgnoreCase("CW")))
{
if ( !prevSalesOrder.equals(SalesOrderNo))
{
IDocEl = outdoc.createElement("IDOC");
ORDERS05.appendChild(createIDocHeader(POSLOGSalesOrderNo,outdoc,EMPST,IDocEl,StoreID,true,returnChild));
prevSalesOrder = SalesOrderNo;
}
IDocEl.appendChild(createE1EDP01forReturnLineItem(outdoc,returnChild,StoreID));
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
我已经实现了createIDocHeader_GC(POSLOGSalesOrderNo,outdoc,EMPST,IDocEl,StoreID,true,returnChild,TRANS)
和其他函数定义的逻辑。但是在输出中没有显示任何字段。请提供您宝贵的意见。
感谢..