svn commit: r559305 - in /ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis: OagisInventoryServices.java OagisShipmentServices.java

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

svn commit: r559305 - in /ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis: OagisInventoryServices.java OagisShipmentServices.java

apatel-2
Author: apatel
Date: Tue Jul 24 20:42:03 2007
New Revision: 559305

URL: http://svn.apache.org/viewvc?view=rev&rev=559305
Log:
little code cleanup.

Modified:
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.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?view=diff&rev=559305&r1=559304&r2=559305
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java Tue Jul 24 20:42:03 2007
@@ -121,7 +121,8 @@
                  * In this message will it serve any purpose, since it is not handled.
                  */
                 String sign = UtilXml.childElementValue(quantityElement, "of:SIGN");
-                String uom = UtilXml.childElementValue(quantityElement, "of:UOM");
+                // TODO: Not used now, Later we may need it
+                //String uom = UtilXml.childElementValue(quantityElement, "of:UOM");
                 String productId = UtilXml.childElementValue(inventoryElement, "of:ITEM");
                 String itemStatus = UtilXml.childElementValue(inventoryElement, "of:ITEMSTATUS");
                 String statusId = null;

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=559305&r1=559304&r2=559305
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Tue Jul 24 20:42:03 2007
@@ -128,7 +128,14 @@
         String referenceId = UtilXml.childElementValue(senderElement, "of:REFERENCEID"); // of
         String confirmation = UtilXml.childElementValue(senderElement, "of:CONFIRMATION"); // of
         String authId = UtilXml.childElementValue(senderElement, "of:AUTHID"); // of
-          
+
+        Map result = new HashMap();
+        result.put("logicalId", logicalId);
+        result.put("component", component);
+        result.put("task", task);
+        result.put("referenceId", referenceId);
+        result.put("userLogin", userLogin);
+
         oagisMsgInfoCtx.put("logicalId", logicalId);
         oagisMsgInfoCtx.put("component", component);
         oagisMsgInfoCtx.put("task", task);
@@ -155,6 +162,19 @@
         Element daShowShipmentElement = UtilXml.firstChildElement(dataAreaElement, "n:SHOW_SHIPMENT"); // n
         Element shipmentElement = UtilXml.firstChildElement(daShowShipmentElement, "n:SHIPMENT"); // n                              
         String shipmentId = UtilXml.childElementValue(shipmentElement, "of:DOCUMENTID"); // of          
+        GenericValue shipment = null;
+        try {
+            shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
+        } catch (GenericEntityException e) {
+            String errMsg = "Error Shipment from database: "+ e.toString();
+            errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericEntityException"));
+            Debug.logInfo(e, module);
+            result.putAll(ServiceUtil.returnError(errMsg));
+            result.put("errorMapList", errorMapList);
+            return result;
+        }                    
+        String shipGroupSeqId = shipment.getString("primaryShipGroupSeqId");                
+        String originFacilityId = shipment.getString("originFacilityId");                              
           
         List shipUnitElementList = UtilXml.childElementList(daShowShipmentElement, "n:SHIPUNIT"); // n
         if(UtilValidate.isNotEmpty(shipUnitElementList)) {
@@ -170,9 +190,6 @@
                         Element invItemElement = (Element) invItemElementItr.next();
                         String productId = UtilXml.childElementValue(invItemElement, "of: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)));                    
@@ -243,12 +260,6 @@
             }
         }  
         
-        Map result = new HashMap();
-        result.put("logicalId", logicalId);
-        result.put("component", component);
-        result.put("task", task);
-        result.put("referenceId", referenceId);
-        result.put("userLogin", userLogin);
         
         if (errorMapList.size() > 0) {
             //result.putAll(ServiceUtil.returnError("Errors found processing message"));