Author: apatel
Date: Tue Jul 24 01:06:23 2007 New Revision: 558955 URL: http://svn.apache.org/viewvc?view=rev&rev=558955 Log: now show shipment handles multiple shipment items. Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?view=diff&rev=558955&r1=558954&r2=558955 ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original) +++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Tue Jul 24 01:06:23 2007 @@ -688,6 +688,7 @@ <attribute name="originFacilityId" type="String" mode="IN" optional="true"/> <attribute name="quantityNotReserved" type="Double" mode="IN" optional="false"/> <attribute name="promisedDatetime" type="Timestamp" mode="IN" optional="false"/> + <attribute name="shipmentPackageSeqId" type="String" mode="IN" optional="true"/> </service> <service name="sendShipmentCompleteNotification" engine="java" require-new-transaction="true" max-retry="3" Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java?view=diff&rev=558955&r1=558954&r2=558955 ============================================================================== --- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original) +++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Tue Jul 24 01:06:23 2007 @@ -135,7 +135,6 @@ String bsrVerb = UtilXml.childElementValue(bsrElement, "VERB"); // of String bsrNoun = UtilXml.childElementValue(bsrElement, "NOUN"); // of String bsrRevision = UtilXml.childElementValue(bsrElement, "REVISION"); // of - Map oagisMsgInfoCtx = UtilMisc.toMap("bsrVerb", bsrVerb, "bsrNoun", bsrNoun, "bsrRevision", bsrRevision); Element senderElement = UtilXml.firstChildElement(controlAreaElement, "SENDER"); // os @@ -172,85 +171,93 @@ Element daShowShipmentElement = UtilXml.firstChildElement(dataAreaElement, "SHOW_SHIPMENT"); // n Element shipmentElement = UtilXml.firstChildElement(daShowShipmentElement, "SHIPMENT"); // n String shipmentId = UtilXml.childElementValue(shipmentElement, "DOCUMENTID"); // of - - Element shipUnitElement = UtilXml.firstChildElement(daShowShipmentElement, "SHIPUNIT"); // n - String trackingNum = UtilXml.childElementValue(shipUnitElement, "TRACKINGID"); // of - List invItemElementList = UtilXml.childElementList(shipUnitElement, "INVITEM"); - if(UtilValidate.isNotEmpty(invItemElementList)) { - Iterator invItemElementItr = invItemElementList.iterator(); - while(invItemElementItr.hasNext()) { - Element invItemElement = (Element) invItemElementItr.next(); - String productId = UtilXml.childElementValue(invItemElement, "ITEM"); // of - try { - GenericValue shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId)); - String shipGroupSeqId = shipment.getString("primaryShipGroupSeqId"); - String originFacilityId = shipment.getString("originFacilityId"); - GenericValue shipmentItem = EntityUtil.getFirst(delegator.findByAnd("ShipmentItem", UtilMisc.toMap("shipmentId", shipmentId, "productId",productId))); - String shipmentItemSeqId = shipmentItem.getString("shipmentItemSeqId"); - GenericValue orderShipment = EntityUtil.getFirst(delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentItemSeqId", shipmentItemSeqId))); - String orderId = orderShipment.getString("orderId"); - String orderItemSeqId = orderShipment.getString("orderItemSeqId"); - GenericValue product = delegator.findByPrimaryKey("Product",UtilMisc.toMap("productId",productId)); - String requireInventory = product.getString("requireInventory"); - if(requireInventory == null) { - requireInventory = "N"; - } - GenericValue orderItemShipGrpInvReservation = EntityUtil.getFirst(delegator.findByAnd("OrderItemShipGrpInvRes", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId,"shipGroupSeqId",shipGroupSeqId))); - Map isitspastCtx = UtilMisc.toMap("orderId", orderId, "shipGroupSeqId", shipGroupSeqId, "orderItemSeqId", orderItemSeqId, "quantity", orderItemShipGrpInvReservation.get("quantity"), "quantityNotReserved", orderItemShipGrpInvReservation.get("quantity")); - isitspastCtx.put("productId", productId); - isitspastCtx.put("reservedDatetime", orderItemShipGrpInvReservation.get("reservedDatetime")); - isitspastCtx.put("requireInventory", requireInventory); - isitspastCtx.put("reserveOrderEnumId", orderItemShipGrpInvReservation.get("reserveOrderEnumId")); - isitspastCtx.put("sequenceId", orderItemShipGrpInvReservation.get("sequenceId")); - isitspastCtx.put("originFacilityId", originFacilityId); - isitspastCtx.put("userLogin", userLogin); - isitspastCtx.put("trackingNum", trackingNum); - isitspastCtx.put("inventoryItemId", orderItemShipGrpInvReservation.get("inventoryItemId")); - isitspastCtx.put("shipmentId", shipmentId); - isitspastCtx.put("promisedDatetime", orderItemShipGrpInvReservation.get("promisedDatetime")); - List invDetailElementList = UtilXml.childElementList(invItemElement, "INVDETAIL"); - if(UtilValidate.isNotEmpty(invDetailElementList)) { - Iterator invDetailElementItr = invDetailElementList.iterator(); - while(invDetailElementItr.hasNext()) { - Element invDetailElement = (Element) invDetailElementItr.next(); - String serialNumber = UtilXml.childElementValue(invDetailElement, "SERIALNUM"); // os - isitspastCtx.put("serialNumber", serialNumber); - isitspastCtx.remove("itemIssuanceId"); - try { - Map resultMap = dispatcher.runSync("issueSerializedInvToShipmentPackageAndSetTracking", isitspastCtx); - if (ServiceUtil.isError(resultMap)){ - String errMsg = ServiceUtil.getErrorMessage(resultMap); - errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "IssueSerializedInvServiceError")); - Debug.logError(errMsg, module); + + List shipUnitElementList = UtilXml.childElementList(daShowShipmentElement, "SHIPUNIT"); // n + if(UtilValidate.isNotEmpty(shipUnitElementList)) { + Iterator shipUnitElementItr = shipUnitElementList.iterator(); + while(shipUnitElementItr.hasNext()) { + Element shipUnitElement = (Element) shipUnitElementItr.next(); + String trackingNum = UtilXml.childElementValue(shipUnitElement, "TRACKINGID"); // of + String shipmentPackageSeqId = UtilXml.childElementValue(shipUnitElement, "SHPUNITSEQ"); // of + List invItemElementList = UtilXml.childElementList(shipUnitElement, "INVITEM"); //n + if(UtilValidate.isNotEmpty(invItemElementList)) { + Iterator invItemElementItr = invItemElementList.iterator(); + while(invItemElementItr.hasNext()) { + Element invItemElement = (Element) invItemElementItr.next(); + String productId = UtilXml.childElementValue(invItemElement, "ITEM"); // of + try { + GenericValue shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId)); + String shipGroupSeqId = shipment.getString("primaryShipGroupSeqId"); + String originFacilityId = shipment.getString("originFacilityId"); + GenericValue shipmentItem = EntityUtil.getFirst(delegator.findByAnd("ShipmentItem", UtilMisc.toMap("shipmentId", shipmentId, "productId",productId))); + String shipmentItemSeqId = shipmentItem.getString("shipmentItemSeqId"); + GenericValue orderShipment = EntityUtil.getFirst(delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentItemSeqId", shipmentItemSeqId))); + String orderId = orderShipment.getString("orderId"); + String orderItemSeqId = orderShipment.getString("orderItemSeqId"); + GenericValue product = delegator.findByPrimaryKey("Product",UtilMisc.toMap("productId",productId)); + String requireInventory = product.getString("requireInventory"); + if(requireInventory == null) { + requireInventory = "N"; + } + GenericValue orderItemShipGrpInvReservation = EntityUtil.getFirst(delegator.findByAnd("OrderItemShipGrpInvRes", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId,"shipGroupSeqId",shipGroupSeqId))); + Map isitspastCtx = FastMap.newInstance(); + isitspastCtx = UtilMisc.toMap("orderId", orderId, "shipGroupSeqId", shipGroupSeqId, "orderItemSeqId", orderItemSeqId, "quantity", orderItemShipGrpInvReservation.get("quantity"), "quantityNotReserved", orderItemShipGrpInvReservation.get("quantity")); + isitspastCtx.put("productId", productId); + isitspastCtx.put("reservedDatetime", orderItemShipGrpInvReservation.get("reservedDatetime")); + isitspastCtx.put("requireInventory", requireInventory); + isitspastCtx.put("reserveOrderEnumId", orderItemShipGrpInvReservation.get("reserveOrderEnumId")); + isitspastCtx.put("sequenceId", orderItemShipGrpInvReservation.get("sequenceId")); + isitspastCtx.put("originFacilityId", originFacilityId); + isitspastCtx.put("userLogin", userLogin); + isitspastCtx.put("trackingNum", trackingNum); + isitspastCtx.put("inventoryItemId", orderItemShipGrpInvReservation.get("inventoryItemId")); + isitspastCtx.put("shipmentId", shipmentId); + isitspastCtx.put("shipmentPackageSeqId", shipmentPackageSeqId); + isitspastCtx.put("promisedDatetime", orderItemShipGrpInvReservation.get("promisedDatetime")); + List invDetailElementList = UtilXml.childElementList(invItemElement, "n:INVDETAIL"); //n + if(UtilValidate.isNotEmpty(invDetailElementList)) { + Iterator invDetailElementItr = invDetailElementList.iterator(); + while(invDetailElementItr.hasNext()) { + Element invDetailElement = (Element) invDetailElementItr.next(); + String serialNumber = UtilXml.childElementValue(invDetailElement, "SERIALNUM"); // os + isitspastCtx.put("serialNumber", serialNumber); + isitspastCtx.remove("itemIssuanceId"); + try { + Map resultMap = dispatcher.runSync("issueSerializedInvToShipmentPackageAndSetTracking", isitspastCtx); + if (ServiceUtil.isError(resultMap)){ + String errMsg = ServiceUtil.getErrorMessage(resultMap); + errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "IssueSerializedInvServiceError")); + Debug.logError(errMsg, module); + } + } catch(GenericServiceException e) { + Debug.logInfo(e, module); + String errMsg = "Error executing issueSerializedInvToShipmentPackageAndSetTracking Service: "+e.toString(); + errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException")); + } } - } catch(GenericServiceException e) { - Debug.logInfo(e, module); - String errMsg = "Error executing issueSerializedInvToShipmentPackageAndSetTracking Service: "+e.toString(); - errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException")); - } - } - } else { - try { - Map resultMap = dispatcher.runSync("issueSerializedInvToShipmentPackageAndSetTracking", isitspastCtx); - if (ServiceUtil.isError(resultMap)){ - String errMsg = ServiceUtil.getErrorMessage(resultMap); - errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "IssueSerializedInvServiceError")); - Debug.logError(errMsg, module); + } else { + try { + Map resultMap = dispatcher.runSync("issueSerializedInvToShipmentPackageAndSetTracking", isitspastCtx); + if (ServiceUtil.isError(resultMap)){ + String errMsg = ServiceUtil.getErrorMessage(resultMap); + errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "IssueSerializedInvServiceError")); + Debug.logError(errMsg, module); + } + } catch(GenericServiceException e) { + Debug.logInfo(e, module); + String errMsg = "Error executing issueSerializedInvToShipmentPackageAndSetTracking Service: "+e.toString(); + errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException")); + } } - } catch(GenericServiceException e) { - Debug.logInfo(e, module); + } catch (GenericEntityException e) { String errMsg = "Error executing issueSerializedInvToShipmentPackageAndSetTracking Service: "+e.toString(); - errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException")); + errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericEntityException")); + Debug.logInfo(e, module); } - } - } catch (GenericEntityException e) { - String errMsg = "Error executing issueSerializedInvToShipmentPackageAndSetTracking Service: "+e.toString(); - errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericEntityException")); - Debug.logInfo(e, module); } } - } + } Map result = new HashMap(); result.put("contentType","text/plain"); |
Free forum by Nabble | Edit this page |