svn commit: r575815 - /ofbiz/trunk/specialpurpose/oagis/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: r575815 - /ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java

jonesde
Author: jonesde
Date: Fri Sep 14 16:01:32 2007
New Revision: 575815

URL: http://svn.apache.org/viewvc?rev=575815&view=rev
Log:
Added error message if receive status change for an item not in the expected status

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

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?rev=575815&r1=575814&r2=575815&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java Fri Sep 14 16:01:32 2007
@@ -1237,7 +1237,7 @@
         Map omiPkMap = UtilMisc.toMap("logicalId", logicalId, "component", component, "task", task, "referenceId", referenceId);
 
         // always log this to make messages easier to find
-        Debug.log("Processing oagisReceiveAcknowledgeDeliveryRma for message ID [" + omiPkMap + "]", module);
+        Debug.log("Processing oagisReceiveAcknowledgeDeliveryStatus for message ID [" + omiPkMap + "]", module);
         
         // before getting into this check to see if we've tried once and had an error, if so set isErrorRetry even if it wasn't passed in
         GenericValue previousOagisMessageInfo = null;
@@ -1329,11 +1329,14 @@
                     */
 
                     String invItemStatusId = null;
+                    String reqFromItemStatusId = null;
                     String disposition = UtilXml.childElementValue(receiptLnElement, "of:DISPOSITN");
                     if ("NotAvailableTOAvailable".equals(disposition)) {
                         invItemStatusId = "INV_AVAILABLE";
+                        reqFromItemStatusId = "INV_ON_HOLD";
                     } else if ("AvailableTONotAvailable".equals(disposition)) {
                         invItemStatusId = "INV_ON_HOLD";
+                        reqFromItemStatusId = "INV_AVAILABLE";
                     } else if ("ReceivedTOAvailable".equals(disposition) || "ReceivedTONotAvailable".equals(disposition)) {
                         String errMsg = "Got DISPOSITN value [" + disposition + "] that is not valid for Status Change, only for RMA/return.";
                         errorMapList.add(UtilMisc.toMap("reasonCode", "DispositnNotValidForStatusChange", "description", errMsg));
@@ -1402,6 +1405,12 @@
                             }
                             
                             GenericValue inventoryItem = EntityUtil.getFirst(inventoryItemsBySerialNumber);
+                            if (UtilValidate.isNotEmpty(reqFromItemStatusId) && !reqFromItemStatusId.equals(inventoryItem.getString("statusId"))) {
+                                String errMsg = "Referenced serial number [" + serialNum + "] has status [" + inventoryItem.getString("statusId") + "] but we were expecting [" + reqFromItemStatusId + "]; this may mean the Acknowledge Delivery RMA message has not yet come in for this item.";
+                                errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "SerialNumberRequiredButNotFound"));
+                                continue;
+                            }
+                            
                             Map updateInvItmMap = FastMap.newInstance();
                             updateInvItmMap.put("inventoryItemId", inventoryItem.getString("inventoryItemId"));
                             updateInvItmMap.put("userLogin", userLogin);