svn commit: r495042 - in /ofbiz/trunk/applications/product: config/ProductUiLabels.properties webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh webapp/facility/facility/FacilityForms.xml

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

svn commit: r495042 - in /ofbiz/trunk/applications/product: config/ProductUiLabels.properties webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh webapp/facility/facility/FacilityForms.xml

sichen
Author: sichen
Date: Wed Jan 10 15:52:08 2007
New Revision: 495042

URL: http://svn.apache.org/viewvc?view=rev&rev=495042
Log:
Improve mass inventory variance form to show total product ATP/QOH.  Add some labels for the form.

Modified:
    ofbiz/trunk/applications/product/config/ProductUiLabels.properties
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh
    ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml

Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.properties?view=diff&rev=495042&r1=495041&r2=495042
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.properties (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.properties Wed Jan 10 15:52:08 2007
@@ -665,12 +665,14 @@
 ProductIssuedQuantity=Issued Quantity
 ProductIssuedReservedTotalOrdered=[Issued + Reserved=Total]=Ordered
 ProductItem=Item
+ProductItemATP=Item ATP
 ProductItemDescription=Item Description
 ProductItemId=Item ID
 ProductItemIdGiftPurchaseFreeShipping=The Item ID on an action is a Product ID for Gift With Purchase actions or for Free Shipping actions it is Shipment Method Type ID to give free shipping on (if blank any Shipment Method Types may receive free shipping)
 ProductItemOutofStock=This item is out of stock
 ProductItemPrc=Item Prc
 ProductItemProduct=Item : Product
+ProductItemQOH=Item QOH
 ProductItemType=Item Type
 ProductItems=Items
 ProductItemsIssued=Items Issued
@@ -945,6 +947,8 @@
 ProductPrimaryShipGroupSeqId=Primary Ship Group Seq Id
 ProductProdCatContentTypeId=Prod Cat Content Type Id
 ProductProduct=Product
+ProductProductATP=Product ATP
+ProductProductATPVar=ATP Var
 ProductProductCatalogsList=Product Catalogs List
 ProductProductCategory=Product Category
 ProductProductCategoryId=Product Category ID
@@ -969,6 +973,8 @@
 ProductProductNotReviewedYet=This product hasn't been reviewed yet
 ProductProductNotYetMadeAvailable=This product has not yet been made available for sale
 ProductProductPage=Product Page
+ProductProductQOH=Product QOH
+ProductProductQOHVar=QOH Var
 ProductProductPromotionsList=Product Promotions List
 ProductProductStore=Product Store
 ProductProductStoreEmailSettings=Product Store Email Settings

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh?view=diff&rev=495042&r1=495041&r2=495042
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh Wed Jan 10 15:52:08 2007
@@ -15,16 +15,23 @@
  * under the License.
  */
 
+import java.util.HashSet;
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
 import org.ofbiz.base.util.*;
+import org.ofbiz.service.ServiceUtil;
 import org.ofbiz.entity.condition.*;
 
+facilityId = parameters.get("facilityId");
+
 // fields to search by
 productId = parameters.get("productId");
 internalName = parameters.get("internalName");
 
 // build conditions
 conditions = UtilMisc.toList(
-        new EntityExpr("facilityId", EntityOperator.EQUALS, parameters.get("facilityId")),
+        new EntityExpr("facilityId", EntityOperator.EQUALS, facilityId),
         new EntityExpr("inventoryItemTypeId", EntityOperator.EQUALS, "NON_SERIAL_INV_ITEM")
         );
 if (productId != null && productId.trim().length() != 0) {
@@ -36,5 +43,34 @@
 
 if (conditions.size() > 2) {
     physicalInventory = delegator.findByAnd("ProductInventoryItem", conditions, UtilMisc.toList("productId"));
-    context.put("physicalInventory", physicalInventory);
+
+    // also need the overal product QOH and ATP for each product
+    atpMap = FastMap.newInstance();
+    qohMap = FastMap.newInstance();
+    
+    // build a list of productIds
+    productIds = new HashSet();
+    for (iter = physicalInventory.iterator(); iter.hasNext(); ) {
+        productIds.add(iter.next().get("productId"));
+    }
+
+    // for each product, call the inventory counting service
+    for (iter = productIds.iterator(); iter.hasNext(); ) {
+        productId = iter.next();
+        result = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.toMap("facilityId", facilityId, "productId", productId));
+        if (!ServiceUtil.isError(result)) {
+            atpMap.put(productId, result.get("availableToPromiseTotal"));
+            qohMap.put(productId, result.get("quantityOnHandTotal"));
+        }
+    }
+
+    // associate the quantities to each row and store the combined data as our list
+    physicalInventoryCombined = FastList.newInstance();
+    for (iter = physicalInventory.iterator(); iter.hasNext(); ) {
+        row = iter.next().getAllFields();
+        row.put("productATP", atpMap.get(row.get("productId")));
+        row.put("productQOH", qohMap.get(row.get("productId")));
+        physicalInventoryCombined.add(row);
+    }
+    context.put("physicalInventory", physicalInventoryCombined);
 }

Modified: ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml?view=diff&rev=495042&r1=495041&r2=495042
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml (original)
+++ ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml Wed Jan 10 15:52:08 2007
@@ -219,15 +219,17 @@
             <hyperlink description="${productId}" target="/catalog/control/EditProductInventoryItems?productId=${productId}" target-type="inter-app"/>
         </field>
         <field name="internalName"><display/></field>
-        <field name="availableToPromiseTotal"><display/></field>
-        <field name="quantityOnHandTotal"><display/></field>
+        <field name="availableToPromiseTotal" title="${uiLabelMap.ProductItemATP}"><display/></field>
+        <field name="quantityOnHandTotal" title="${uiLabelMap.ProductItemQOH}"><display/></field>
+        <field name="productATP" title="${uiLabelMap.ProductProductATP}"><display/></field>
+        <field name="productQOH" title="${uiLabelMap.ProductProductQOH}"><display/></field>
         <field name="varianceReasonId">
             <drop-down allow-empty="false">
                 <entity-options entity-name="VarianceReason" description="${description}"/>
             </drop-down>
         </field>
-        <field name="availableToPromiseVar"><text/></field>
-        <field name="quantityOnHandVar"><text/></field>
+        <field name="availableToPromiseVar" title="${uiLabelMap.ProductProductATPVar}"><text size="6"/></field>
+        <field name="quantityOnHandVar" title="${uiLabelMap.ProductProductQOHVar}"><text size="6"/></field>
         <field name="_rowSubmit" title="${uiLabelMap.CommonSelect}"><check/></field>
         <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit">
             <submit/>