Author: jacopoc
Date: Fri May 25 23:16:12 2007
New Revision: 541862

URL: http://svn.apache.org/viewvc?view=rev&rev=541862
Log:
Now the same inventory counting routine is shared by the MARKETING_PKG_AUTO and 
MARKETING_PKG_PICK products.

Modified:
    
ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
    
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh
    ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl
    ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
    
ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
    
ofbiz/trunk/applications/product/script/org/ofbiz/product/store/ProductStoreServices.xml
    ofbiz/trunk/applications/product/servicedef/services_facility.xml
    
ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
    
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductInventoryItems.bsh

Modified: 
ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml?view=diff&rev=541862&r1=541861&r2=541862
==============================================================================
--- 
ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml 
(original)
+++ 
ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml 
Fri May 25 23:16:12 2007
@@ -172,6 +172,7 @@
                 <condition>
                     <and>
                         <if-compare field-name="product.productTypeId" 
operator="not-equals" value="MARKETING_PKG_AUTO"/>
+                        <if-compare field-name="product.productTypeId" 
operator="not-equals" value="MARKETING_PKG_PICK"/>
                         <if-compare field-name="product.productTypeId" 
operator="not-equals" value="DIGITAL_GOOD"/>
                     </and>
                 </condition>

Modified: 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh?view=diff&rev=541862&r1=541861&r2=541862
==============================================================================
--- 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh
 (original)
+++ 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh
 Fri May 25 23:16:12 2007
@@ -36,9 +36,9 @@
 context.put("shipGroups", shipGroups);
 
 // method to expand the marketing packages
-FastList expandProductGroup(product, quantityInGroup, quantityShipped, 
quantityOpen) {
+FastList expandProductGroup(product, quantityInGroup, quantityShipped, 
quantityOpen, assocType) {
     sublines = FastList.newInstance();
-    associations = product.getRelatedByAnd("MainProductAssoc", 
UtilMisc.toMap("productAssocTypeId", "MANUF_COMPONENT"));
+    associations = product.getRelatedByAnd("MainProductAssoc", 
UtilMisc.toMap("productAssocTypeId", assocType));
     associations = EntityUtil.filterByDate( associations );
     for (iter = associations.iterator(); iter.hasNext(); ) {
         association = iter.next();
@@ -111,8 +111,10 @@
         line.put("quantityShipped", quantityShipped);
         line.put("quantityOpen", quantityOpen);
 
-        if ("MARKETING_PKG_AUTO".equals(product.get("productTypeId"))) {
-            sublines = expandProductGroup(product, quantityInGroup, 
quantityShipped, quantityOpen);
+        if ("MARKETING_PKG_AUTO".equals(product.get("productTypeId")) ||
+                "MARKETING_PKG_PICK".equals(product.get("productTypeId"))) {
+            String assocType = 
("MARKETING_PKG_AUTO".equals(product.get("productTypeId"))? "MANUF_COMPONENT": 
"PRODUCT_COMPONENT");
+            sublines = expandProductGroup(product, quantityInGroup, 
quantityShipped, quantityOpen, assocType);
             line.put("expandedList", sublines);
         }
 

Modified: 
ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl?view=diff&rev=541862&r1=541861&r2=541862
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl 
(original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl 
Fri May 25 23:16:12 2007
@@ -142,7 +142,7 @@
                   <div class="tabletext">
                     <a 
href="/catalog/control/EditProductInventoryItems?productId=${productId}" 
class="buttontext"><b>${uiLabelMap.ProductInventory}</b></a>: 
                     ${uiLabelMap.ProductAtp} = 
${availableToPromiseMap.get(productId)}, ${uiLabelMap.ProductQoh} = 
${quantityOnHandMap.get(productId)}
-                    <#if product.productTypeId == "MARKETING_PKG_AUTO"> 
+                    <#if product.productTypeId == "MARKETING_PKG_AUTO" || 
product.productTypeId == "MARKETING_PKG_PICK">
                     ${uiLabelMap.ProductMarketingPackageATP} = 
${mktgPkgATPMap.get(productId)}, ${uiLabelMap.ProductMarketingPackageQOH} = 
${mktgPkgQOHMap.get(productId)}
                     </#if>
                   </div>

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl?view=diff&rev=541862&r1=541861&r2=541862
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl 
(original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl Fri May 
25 23:16:12 2007
@@ -114,7 +114,7 @@
                                 <td style="padding-left: 15px; text-align: 
left;">${requiredQuantity}</td></tr>
                               <tr><td 
align="left">${uiLabelMap.ProductInInventory} ${uiLabelMap.ProductQoh}</td>
                                 <td style="padding-left: 15px; text-align: 
left;">${qohQuantity} (${uiLabelMap.ProductAtp}: ${atpQuantity})</td></tr>
-                              <#if (product != null) && (product.productTypeId 
!= null) && (product.productTypeId == "MARKETING_PKG_AUTO")>
+                              <#if (product != null) && (product.productTypeId 
!= null) && (product.productTypeId == "MARKETING_PKG_AUTO" || 
product.productTypeId == "MARKETING_PKG_PICK")>
                                 <tr><td 
align="left">${uiLabelMap.ProductMarketingPackageQOH}</td>
                                   <td style="padding-left: 15px; text-align: 
left;">${mktgPkgQOH} (${uiLabelMap.ProductAtp}: ${mktgPkgATP})</td></tr>
                               </#if>

Modified: 
ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml?view=diff&rev=541862&r1=541861&r2=541862
==============================================================================
--- 
ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
 (original)
+++ 
ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
 Fri May 25 23:16:12 2007
@@ -545,11 +545,17 @@
         <set field="availableToPromiseTotal" value="0" type="Double"/>
         <set field="quantityOnHandTotal" value="0" type="Double"/>
         <set from-field="parameters.productId" 
field="lookupMktgPkgParams.productId"/>
-        <set value="MANUF_COMPONENT" field="lookupMktgPkgParams.type"/>
+        <entity-one entity-name="Product" value-name="product"/>
+        <if-compare field-name="product.productTypeId" operator="equals" 
value="MARKETING_PKG_AUTO">
+            <set value="MANUF_COMPONENT" field="lookupMktgPkgParams.type"/>
+        <else>
+            <set value="PRODUCT_COMPONENT" field="lookupMktgPkgParams.type"/>
+        </else>
+        </if-compare>
         <call-service service-name="getAssociatedProducts" 
in-map-name="lookupMktgPkgParams">
             <result-to-field result-name="assocProducts"/>
         </call-service>
-        <!-- if there are any MANUF_COMPONENT components, then the ATP and QOH 
are based on the quantities of those component
+        <!-- if there are any components, then the ATP and QOH are based on 
the quantities of those component
             products and found with another service -->
         <if-not-empty field-name="assocProducts">
             <set from-field="assocProducts" 
field="inventoryByAssocProductsParams.assocProducts"/>

Modified: 
ofbiz/trunk/applications/product/script/org/ofbiz/product/store/ProductStoreServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/store/ProductStoreServices.xml?view=diff&rev=541862&r1=541861&r2=541862
==============================================================================
--- 
ofbiz/trunk/applications/product/script/org/ofbiz/product/store/ProductStoreServices.xml
 (original)
+++ 
ofbiz/trunk/applications/product/script/org/ofbiz/product/store/ProductStoreServices.xml
 Fri May 25 23:16:12 2007
@@ -500,17 +500,24 @@
 
             <set from-field="parameters.productId" 
field="callServiceMap.productId"/>
             <set from-field="productStore.inventoryFacilityId" 
field="callServiceMap.facilityId"/>
-            <if-compare field-name="product.productTypeId" 
value="MARKETING_PKG_AUTO" operator="equals">
-                <call-service service-name="getMktgPackagesAvailable" 
in-map-name="callServiceMap">
-                    <result-to-field result-name="availableToPromiseTotal"/>
-                </call-service>
-            <else>
-                <call-service service-name="getInventoryAvailableByFacility" 
in-map-name="callServiceMap">
-                    <result-to-field result-name="availableToPromiseTotal"/>
-                </call-service>
-            </else>
-            </if-compare>
-
+            <if>
+                <condition>
+                    <or>
+                        <if-compare field-name="product.productTypeId" 
value="MARKETING_PKG_AUTO" operator="equals"/>
+                        <if-compare field-name="product.productTypeId" 
value="MARKETING_PKG_PICK" operator="equals"/>
+                    </or>
+                </condition>
+                <then>
+                    <call-service service-name="getMktgPackagesAvailable" 
in-map-name="callServiceMap">
+                        <result-to-field 
result-name="availableToPromiseTotal"/>
+                    </call-service>
+                </then>
+                <else>
+                    <call-service 
service-name="getInventoryAvailableByFacility" in-map-name="callServiceMap">
+                        <result-to-field 
result-name="availableToPromiseTotal"/>
+                    </call-service>
+                </else>
+            </if>
             <!-- check to see if we got enough back... -->
             <if-compare-field field-name="availableToPromiseTotal" 
operator="greater-equals" to-field-name="parameters.quantity" type="Double">
                 <set value="Y" field="available"/>
@@ -533,16 +540,25 @@
                     <!-- Right now the answer is yes, it only succeeds if one 
facility has sufficient inventory for the order. -->
                     <set from-field="parameters.productId" 
field="callServiceMap.productId"/>
                     <set from-field="productStoreFacility.facilityId" 
field="callServiceMap.facilityId"/>
-                    <if-compare field-name="product.productTypeId" 
value="MARKETING_PKG_AUTO" operator="equals">
-                        <call-service service-name="getMktgPackagesAvailable" 
in-map-name="callServiceMap">
-                            <result-to-field 
result-name="availableToPromiseTotal"/>
-                        </call-service>
-                    <else>
-                        <call-service 
service-name="getInventoryAvailableByFacility" in-map-name="callServiceMap">
-                            <result-to-field 
result-name="availableToPromiseTotal"/>
-                        </call-service>
-                    </else>
-                    </if-compare>
+                    <if>
+                        <condition>
+                            <or>
+                                <if-compare field-name="product.productTypeId" 
value="MARKETING_PKG_AUTO" operator="equals"/>
+                                <if-compare field-name="product.productTypeId" 
value="MARKETING_PKG_PICK" operator="equals"/>
+                            </or>
+                        </condition>
+                        <then>
+                            <call-service 
service-name="getMktgPackagesAvailable" in-map-name="callServiceMap">
+                                <result-to-field 
result-name="availableToPromiseTotal"/>
+                            </call-service>
+                        </then>
+                        <else>
+                            <call-service 
service-name="getInventoryAvailableByFacility" in-map-name="callServiceMap">
+                                <result-to-field 
result-name="availableToPromiseTotal"/>
+                            </call-service>
+                        </else>
+                    </if>
+
                     <clear-field field-name="callServiceMap"/>
                     
                     <if-compare-field field-name="availableToPromiseTotal" 
operator="greater-equals" to-field-name="parameters.quantity" type="Double">

Modified: ofbiz/trunk/applications/product/servicedef/services_facility.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_facility.xml?view=diff&rev=541862&r1=541861&r2=541862
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_facility.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_facility.xml Fri May 
25 23:16:12 2007
@@ -184,7 +184,7 @@
     </service>
     <service name="getProductInventorySummaryForItems" engine="java"
                 location="org.ofbiz.product.inventory.InventoryServices" 
invoke="getProductInventorySummaryForItems" auth="false" 
use-transaction="false">
-        <description>Get ATP/QOH Availability for a list of OrderItems by 
summing over all facilities.  If the item is a MARKETING_PKG_AUTO, then put its 
quantity available from components
+        <description>Get ATP/QOH Availability for a list of OrderItems by 
summing over all facilities.  If the item is a MARKETING_PKG_AUTO/PICK, then 
put its quantity available from components
             in the mktgPkgATPMap and mktgPkgQOHMap.</description>
         <attribute name="orderItems" type="List" mode="IN" optional="false"/>
         <attribute name="quantityOnHandMap" type="Map" mode="OUT" 
optional="false"/>
@@ -194,7 +194,7 @@
     </service>
     <service name="getProductInventoryAndFacilitySummary" engine="java"
                 location="org.ofbiz.product.inventory.InventoryServices" 
invoke="getProductInventoryAndFacilitySummary" auth="false" 
use-transaction="false">
-        <description>Get ATP/QOH Availability for a list of OrderItems by 
summing over all facilities.  If the item is a MARKETING_PKG_AUTO, then put its 
quantity available from components
+        <description>Get ATP/QOH Availability for a list of OrderItems by 
summing over all facilities.  If the item is a MARKETING_PKG_AUTO/PICK, then 
put its quantity available from components
             in the mktgPkgATPMap and mktgPkgQOHMap.</description>
         <attribute name="checkTime" type="Timestamp" mode="IN" 
optional="true"/>
         <attribute name="facilityId" type="String" mode="IN" optional="false"/>

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?view=diff&rev=541862&r1=541861&r2=541862
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
 Fri May 25 23:16:12 2007
@@ -754,9 +754,10 @@
 
                 // get both the real ATP/QOH available and the quantities 
available from marketing packages
                 try {
-                    if 
("MARKETING_PKG_AUTO".equals(product.getString("productTypeId"))) {
+                    if 
("MARKETING_PKG_AUTO".equals(product.getString("productTypeId")) ||
+                            
"MARKETING_PKG_PICK".equals(product.getString("productTypeId"))) {
                         mktgPkgInvResult = 
dispatcher.runSync("getMktgPackagesAvailable", UtilMisc.toMap("productId", 
productId, "facilityId", facility.getString("facilityId")));
-                    } 
+                    }
                     invResult = 
dispatcher.runSync("getInventoryAvailableByFacility", 
UtilMisc.toMap("productId", productId, "facilityId", 
facility.getString("facilityId")));
                 } catch (GenericServiceException e) {
                     String msg = "Could not find inventory for facility [" + 
facility.getString("facilityId") + "]";
@@ -771,7 +772,7 @@
                     if (fatp != null) atp += fatp.doubleValue();
                     if (fqoh != null) qoh += fqoh.doubleValue();
                 }
-                if 
(("MARKETING_PKG_AUTO".equals(product.getString("productTypeId"))) && 
(!ServiceUtil.isError(mktgPkgInvResult))) {
+                if 
(("MARKETING_PKG_AUTO".equals(product.getString("productTypeId")) || 
"MARKETING_PKG_PICK".equals(product.getString("productTypeId"))) && 
(!ServiceUtil.isError(mktgPkgInvResult))) {
                     Double fatp = (Double) 
mktgPkgInvResult.get("availableToPromiseTotal");
                     Double fqoh = (Double) 
mktgPkgInvResult.get("quantityOnHandTotal");
                     if (fatp != null) mktgPkgAtp += fatp.doubleValue();
@@ -812,7 +813,8 @@
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
-        if ("MARKETING_PKG_AUTO".equals(product.getString("productTypeId"))) {
+        if ("MARKETING_PKG_AUTO".equals(product.getString("productTypeId")) ||
+                
"MARKETING_PKG_PICK".equals(product.getString("productTypeId"))) {
             try {
                 resultOutput = dispatcher.runSync("getMktgPackagesAvailable", 
contextInput);
             } catch (GenericServiceException e) {

Modified: 
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductInventoryItems.bsh
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductInventoryItems.bsh?view=diff&rev=541862&r1=541861&r2=541862
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductInventoryItems.bsh
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductInventoryItems.bsh
 Fri May 25 23:16:12 2007
@@ -89,8 +89,9 @@
         quantitySummary.put("totalQuantityOnHand", 
resultOutput.get("quantityOnHandTotal"));
         quantitySummary.put("totalAvailableToPromise", 
resultOutput.get("availableToPromiseTotal"));
 
-        // if the product is a MARKETING_PKG_AUTO, then also get the quantity 
which can be produced from components
-        if ("MARKETING_PKG_AUTO".equals(product.getString("productTypeId"))) {
+        // if the product is a MARKETING_PKG_AUTO/PICK, then also get the 
quantity which can be produced from components
+        if ("MARKETING_PKG_AUTO".equals(product.getString("productTypeId")) ||
+                
"MARKETING_PKG_PICK".equals(product.getString("productTypeId"))) {
             contextInput = UtilMisc.toMap("productId",productId, "facilityId", 
facility.getString("facilityId"));
             resultOutput = dispatcher.runSync("getMktgPackagesAvailable", 
contextInput);
             quantitySummary.put("mktgPkgQOH", 
resultOutput.get("quantityOnHandTotal"));


Reply via email to