You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2008/01/25 16:02:35 UTC

svn commit: r615240 - in /ofbiz/trunk/applications/product: servicedef/secas.xml servicedef/services_facility.xml src/org/ofbiz/product/inventory/InventoryServices.java

Author: sichen
Date: Fri Jan 25 07:02:34 2008
New Revision: 615240

URL: http://svn.apache.org/viewvc?rev=615240&view=rev
Log:
reversing my previous commit r 614970 which may have undesirable side effects

Modified:
    ofbiz/trunk/applications/product/servicedef/secas.xml
    ofbiz/trunk/applications/product/servicedef/services_facility.xml
    ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java

Modified: ofbiz/trunk/applications/product/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/secas.xml?rev=615240&r1=615239&r2=615240&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/secas.xml Fri Jan 25 07:02:34 2008
@@ -70,22 +70,6 @@
         <action service="updateProductIfAvailableFromShipment" mode="sync"/>    
     </eca>
 
-    <!-- Before reserving inventory, ensure that we're not over reserving the item -->
-    <eca service="reserveProductInventory" event="invoke">
-        <action service="checkInventoryAlreadyReserved" mode="sync"/>
-    </eca>
-    <eca service="reserveProductInventoryByFacility" event="invoke">
-        <action service="checkInventoryAlreadyReserved" mode="sync"/>
-    </eca>
-    <eca service="reserveProductInventoryByContainer" event="invoke">
-        <action service="checkInventoryAlreadyReserved" mode="sync"/>
-    </eca>
-    <eca service="reserveStoreInventory" event="invoke">
-        <condition field-name="orderId" operator="is-not-empty"/>
-        <condition field-name="orderItemSeqId" operator="is-not-empty"/>
-        <action service="checkInventoryAlreadyReserved" mode="sync"/>
-    </eca>
-
     <!-- Product Price Change ECAs -->
     <eca service="createProductPrice" event="commit">
         <action service="saveProductPriceChange" mode="sync"/>

Modified: ofbiz/trunk/applications/product/servicedef/services_facility.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_facility.xml?rev=615240&r1=615239&r2=615240&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_facility.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_facility.xml Fri Jan 25 07:02:34 2008
@@ -312,14 +312,6 @@
         <attribute name="sequenceId" type="Long" mode="IN" optional="true"/>
         <attribute name="quantityNotReserved" type="Double" mode="OUT" optional="false"/>
     </service>
-    <service name="checkInventoryAlreadyReserved" engine="java"
-            location="org.ofbiz.product.inventory.InventoryServices" invoke="checkInventoryAlreadyReserved">
-        <description>Ensures that a request to reserve inventory for an order item does not over reserve it.  
-            This should be run as an invoke SECA on all reserveProductInventory services.</description>
-        <attribute name="orderId" type="String" mode="IN" optional="false"/>
-        <attribute name="orderItemSeqId" type="String" mode="IN" optional="false"/>
-        <attribute name="quantity" type="Double" mode="IN" optional="false"/>
-    </service>
     <service name="reserveOrderItemInventory" engine="simple"
                 location="org/ofbiz/product/inventory/InventoryReserveServices.xml" invoke="reserveOrderItemInventory" auth="true">
         <description>Create OrderItemShipGrpInvRes or increment existing reserved quantity.</description>

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=615240&r1=615239&r2=615240&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java Fri Jan 25 07:02:34 2008
@@ -1004,37 +1004,4 @@
         return result;
     }
 
-    public static Map checkInventoryAlreadyReserved(DispatchContext dctx, Map context) {
-        GenericDelegator delegator = dctx.getDelegator();
-
-        String orderId = (String) context.get("orderId");
-        String orderItemSeqId = (String) context.get("orderItemSeqId");
-        double reserving = (Double) context.get("quantity");
-        try {
-            // count quantity ordered
-            double ordered = 0.0;
-            GenericValue item = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId));
-            if (item == null) return ServiceUtil.returnError("Order Item for order ["+orderId+"] with sequence Id ["+orderItemSeqId+"] not found.");
-            ordered = item.getDouble("quantity"); 
-            ordered -= (item.get("cancelQuantity") == null ? 0 : item.getDouble("cancelQuantity"));
-
-            // count up the quantity already reserved for this item  (note that canceling a reservation deletes it, thus this data represents what's actually reserved)
-            double reserved = 0.0;
-            List<GenericValue> reservations = delegator.findByAnd("OrderItemShipGrpInvRes", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId));
-            for (GenericValue reservation : reservations) {
-                if (reservation.get("quantity") == null) continue; // paranoia
-                reserved += reservation.getDouble("quantity");
-            }
-
-            // make sure we're not over reserving the item
-            if (reserving > (ordered - reserved)) {
-                return ServiceUtil.returnError("Cannot reserve " + reserving + " of Product ["+item.get("productId")+"].  There are already " +
-                        reserved + " reserved out of " + ordered + " ordered for order ["+orderId+"] line item ["+orderItemSeqId+"].");
-            }
-
-            return ServiceUtil.returnSuccess();
-        } catch (GenericEntityException e) {
-            return ServiceUtil.returnError("Inventory Item/Transfer lookup problem [" + e.getMessage() + "]");
-        }
-    }
 }