svn commit: r565555 - in /ofbiz/trunk/specialpurpose/oagis: servicedef/services.xml src/org/ofbiz/oagis/OagisInventoryServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r565555 - in /ofbiz/trunk/specialpurpose/oagis: servicedef/services.xml src/org/ofbiz/oagis/OagisInventoryServices.java

apatel-2
Author: apatel
Date: Mon Aug 13 15:18:55 2007
New Revision: 565555

URL: http://svn.apache.org/viewvc?view=rev&rev=565555
Log:
added list of inventoryItemIds in result.

Modified:
    ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java

Modified: ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml?view=diff&rev=565555&r1=565554&r2=565555
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml Mon Aug 13 15:18:55 2007
@@ -175,12 +175,16 @@
         <description>Process RMA Acknowledge message</description>
         <implements service="oagisMessageErrorInfoInterface"/>
         <attribute name="document" type="org.w3c.dom.Document" mode="IN" optional="false"/>
+        <attribute name="inventoryItemIdList" type="List" mode="OUT" optional="true"/>
     </service>
 
     <service name="oagisMessageHandler" engine="java" transaction-timeout="300"
             location="org.ofbiz.oagis.OagisServices" invoke="oagisMessageHandler" auth="false">
         <implements service="serviceStreamInterface"/>
         <implements service="oagisMessageErrorInfoInterface"/>
+        <!--Added the following attribute for RMA Acknowledge service to be used in the development environment.
+            Might not be used and hence can be removed in the production when the RMA service is called Asynchronously.-->
+        <attribute name="inventoryItemIdList" type="List" mode="OUT" optional="true"/>
     </service>
     
 </services>

Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java?view=diff&rev=565555&r1=565554&r2=565555
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java Mon Aug 13 15:18:55 2007
@@ -589,6 +589,7 @@
         }
         
         String statusId = null;
+        List invItemIds = FastList.newInstance();
         // get RECEIPTLN elements from message
         List acknowledgeElementList = UtilXml.childElementList(acknowledgeDeliveryElement, "ns:RECEIPTLN");
         if (UtilValidate.isNotEmpty(acknowledgeElementList)) {
@@ -709,10 +710,6 @@
                     }
                     if (quantityAccepted > 0) {
                         if (serialNumsList.size() > 0) {
-                            if (serialNumsList.size() != quantityAccepted) {
-                               String errMsg = "Error: the quantity [" + quantityAccepted + "] did not match the number of serial numbers passed [" + serialNumsList.size() + "].";
-                                errorMapList.add(UtilMisc.toMap("reasonCode", "QuantitySerialMismatch", "description", errMsg));
-                            }
                             Iterator serialNumIter = serialNumsList.iterator();
                             while (serialNumIter.hasNext()) {
                                 String serialNum = (String) serialNumIter.next();
@@ -725,7 +722,7 @@
                                 }
                                 if (inventoryItem != null) {
                                     Map updateInvItmMap = FastMap.newInstance();
-                                    updateInvItmMap.put( "inventoryItemId" , inventoryItem.get("inventoryItemId").toString());
+                                    updateInvItmMap.put( "inventoryItemId" , inventoryItem.getString("inventoryItemId"));
                                     updateInvItmMap.put( "userLogin" , userLogin);
                                     updateInvItmMap.put( "statusId",invItemStatusId);
                                     String inventoryItemProductId = inventoryItem.getString("productId");
@@ -739,6 +736,7 @@
                                         errorMapList.add(UtilMisc.toMap("reasonCode", "GenericServiceException", "description", errMsg));
                                         Debug.logError(e, errMsg, module);
                                     }
+                                    invItemIds.add(UtilMisc.toMap("inventoryItemId", inventoryItem.getString("inventoryItemId")));
                                     
                                 } else {
                                     //clone the context as it may be changed in the call
@@ -750,7 +748,7 @@
                                     localRipCtx.put("serialNumber", serialNum);
                                     localRipCtx.put("productId", productId);
                                     localRipCtx.put("returnItemSeqId", returnItemSeqId);
-                                    runReceiveInventoryProduct( localRipCtx , errorMapList , dispatcher);
+                                    runReceiveInventoryProduct( localRipCtx , errorMapList , dispatcher, invItemIds);
                                 }
                             }
                         } else {
@@ -763,7 +761,7 @@
                             localRipCtx.put("quantityRejected", new Double(0.0));
                             localRipCtx.put("productId", productId);
                             localRipCtx.put("returnItemSeqId", returnItemSeqId);
-                            runReceiveInventoryProduct( localRipCtx , errorMapList , dispatcher);
+                            runReceiveInventoryProduct( localRipCtx , errorMapList , dispatcher, invItemIds);
                         }
                     } else {
                         // TODOLATER: need to run service receiveInventoryProduct and updateInventoryItem when quantityRejected > 0
@@ -776,7 +774,7 @@
                 }
             }
             
-            if (statusId.equals("RETURN_ACCEPTED")) {
+            if (UtilValidate.isNotEmpty(statusId) && statusId.equals("RETURN_ACCEPTED")) {
                 statusId = "RETURN_COMPLETED";
                 try {
                     dispatcher.runSync("updateReturnHeader", UtilMisc.toMap("statusId", statusId, "returnId", returnId, "userLogin", userLogin));
@@ -812,15 +810,18 @@
         }
         
         result.putAll(ServiceUtil.returnSuccess("Action Performed Successfully"));
+        result.put("inventoryItemIdList", invItemIds);
         return result;
     }
 
-    public static void runReceiveInventoryProduct(Map localRipCtx, List errorMapList, LocalDispatcher dispatcher) {
+    public static void runReceiveInventoryProduct(Map localRipCtx, List errorMapList, LocalDispatcher dispatcher, List invItemIds) {
         try {
             Map ripResult = dispatcher.runSync("receiveInventoryProduct", localRipCtx);
             if (ServiceUtil.isError(ripResult)) {
                 String errMsg = ServiceUtil.getErrorMessage(ripResult);
                 errorMapList.add(UtilMisc.toMap("reasonCode", "ReceiveInventoryServiceError", "description", errMsg));
+            } else {
+                invItemIds.add(UtilMisc.toMap("inventoryItemId", (String) ripResult.get("inventoryItemId")));
             }
         } catch (GenericServiceException e) {
             String errMsg = "Error running service receiveInventoryProduct: "