From e17d82d433cb2a2df71e23fdcf4797fa280df2af Mon Sep 17 00:00:00 2001 From: Anil Patel Date: Tue, 7 Aug 2007 01:53:46 +0000 Subject: [PATCH] Storing carrierPartyId in ShipmentRouteSegment git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@563368 13f79535-47bb-0310-9956-ffa450edef68 --- .../ofbiz/oagis/OagisShipmentServices.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java b/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java index c16cac2a60..7c0d056e4a 100644 --- a/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java +++ b/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java @@ -191,10 +191,33 @@ public class OagisShipmentServices { List shipUnitElementList = UtilXml.childElementList(daShowShipmentElement, "ns:SHIPUNIT"); // n if(UtilValidate.isNotEmpty(shipUnitElementList)) { + Element shipUnitElement = (Element)shipUnitElementList.get(0); + String trackingNum = UtilXml.childElementValue(shipUnitElement, "of:TRACKINGID"); // of + String carrierCode = UtilXml.childElementValue(shipUnitElement, "of:CARRIER"); // of + if(UtilValidate.isNotEmpty(carrierCode)){ + String carrierPartyId = null; + if( carrierCode.startsWith("F")) { + carrierPartyId = "FEDEX"; + } else if(carrierCode.startsWith("U")) { + carrierPartyId = "UPS"; + } + try { + Map resultMap = dispatcher.runSync("updateShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", "00001", "carrierPatyId", carrierPartyId, "trackingIdNumber", trackingNum, "userLogin", userLogin)); + if (ServiceUtil.isError(resultMap)){ + String errMsg = ServiceUtil.getErrorMessage(resultMap); + errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "updateShipmentRouteSegmentError")); + Debug.logError(errMsg, module); + } + }catch (GenericServiceException e) { + Debug.logInfo(e, module); + String errMsg = "Error executing updateShipmentRouteSegment Service: "+e.toString(); + errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException")); + } + } + Iterator shipUnitElementItr = shipUnitElementList.iterator(); while(shipUnitElementItr.hasNext()) { - Element shipUnitElement = (Element) shipUnitElementItr.next(); - String trackingNum = UtilXml.childElementValue(shipUnitElement, "of:TRACKINGID"); // of + shipUnitElement = (Element) shipUnitElementItr.next(); String shipmentPackageSeqId = UtilXml.childElementValue(shipUnitElement, "of:SHPUNITSEQ"); // of List invItemElementList = UtilXml.childElementList(shipUnitElement, "ns:INVITEM"); //n if(UtilValidate.isNotEmpty(invItemElementList)) {