Author: mor
Date: Thu Aug  7 08:45:44 2008
New Revision: 683634

URL: http://svn.apache.org/viewvc?rev=683634&view=rev
Log:
Improvement in Inventory Item look up

Added:
    
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
   (with props)
    
ofbiz/trunk/applications/product/webapp/facility/lookup/LookupInventoryItems.ftl
   (with props)
Modified:
    ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml
    
ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
    ofbiz/trunk/applications/product/servicedef/services_facility.xml
    ofbiz/trunk/applications/product/webapp/facility/lookup/FieldLookupForms.xml
    ofbiz/trunk/applications/product/widget/facility/LookupScreens.xml

Modified: ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml?rev=683634&r1=683633&r2=683634&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml 
(original)
+++ ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml Thu Aug 
 7 08:45:44 2008
@@ -402,6 +402,9 @@
       <member-entity entity-alias="II" entity-name="InventoryItem"/>
       <alias-all entity-alias="SR"/>
       <alias entity-alias="II" name="facilityId"/>
+      <alias entity-alias="II" name="locationSeqId"/>
+      <alias entity-alias="II" name="quantityOnHandTotal"/>
+      <alias entity-alias="II" name="availableToPromiseTotal"/>
       <alias entity-alias="II" name="unitCost"/>
       <view-link entity-alias="SR" rel-entity-alias="II">
         <key-map field-name="inventoryItemId"/>

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?rev=683634&r1=683633&r2=683634&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
 (original)
+++ 
ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
 Thu Aug  7 08:45:44 2008
@@ -1248,44 +1248,6 @@
         <remove-value value-name="lookedUpValue"/>
     </simple-method>
  
-     <simple-method 
method-name="getInventoryItemForAssociatedOrderSupplierAndProduct" 
short-description="Get Inventory Items for an order, supplier and product">
-       <set field="productId" from-field="parameters.productId"/>
-       <!-- search for the original inventory items created by order -->
-       <entity-and entity-name="ShipmentReceipt" list-name="shipmentReceipts">
-           <field-map field-name="orderId" env-name="parameters.orderId"/>
-           <field-map field-name="productId" env-name="productId"/>
-       </entity-and>
-       <if-not-empty field="shipmentReceipts">
-           <first-from-list list-name="shipmentReceipts" 
entry-name="shipmentReceipt"/>
-           <get-related value-name="shipmentReceipt" 
relation-name="InventoryItem" list-name="inventoryItems"/>
-           <field-to-result field-name="inventoryItems"/>
-           <return/>       
-       </if-not-empty>
-       <!-- search for inventory items created by other orders from the same 
supplier -->
-       <entity-and entity-name="OrderRole" list-name="orderRoles">
-           <field-map field-name="partyId" env-name="parameters.partyId"/>
-       </entity-and>
-       <iterate list-name="orderRoles" entry-name="orderRole">
-           <entity-and entity-name="ShipmentReceipt" 
list-name="shipmentReceipts">
-               <field-map field-name="orderId" env-name="orderRole.orderId"/>
-               <field-map field-name="productId" env-name="productId"/>
-           </entity-and>
-           <first-from-list list-name="shipmentReceipts" 
entry-name="shipmentReceipt"/>
-           <get-related value-name="shipmentReceipt" 
relation-name="InventoryItem" list-name="inventoryItems"/>
-           <field-to-list field-name="inventoryItems" 
list-name="inventoryItems"/>           
-       </iterate>
-       <if-not-empty field="inventoryItems">
-           <field-to-result field-name="inventoryItems"/>
-           <return/>       
-       </if-not-empty>
-       <clear-field field-name="inventoryItems"/>
-       <!-- search for all the inventory items for this product -->
-       <entity-and entity-name="InventoryItem" list-name="inventoryItems">
-           <field-map field-name="productId" env-name="productId"/>
-       </entity-and>
-       <field-to-result field-name="inventoryItems"/>
-     </simple-method>
-      
     <!-- Test Physical Inventory Adjustment -->
     <simple-method method-name="testPhysicalInventoryAdjustment" 
short-description="Test to create physical inventory and variance" 
login-required="false">
         <log level="info" message="====================Create physical 
inventory and variance test case================================"/>

Modified: ofbiz/trunk/applications/product/servicedef/services_facility.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_facility.xml?rev=683634&r1=683633&r2=683634&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_facility.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_facility.xml Thu Aug  
7 08:45:44 2008
@@ -234,14 +234,7 @@
         <attribute name="wholeSalePrice" mode="OUT" type="Double" 
optional="true"/>
         <attribute name="usageQuantity" mode="OUT" type="Double" 
optional="true"/>
     </service>
-    <service name="getInventoryItemForAssociatedOrderSupplierAndProduct" 
engine="simple"
-             location="org/ofbiz/product/inventory/InventoryServices.xml" 
invoke="getInventoryItemForAssociatedOrderSupplierAndProduct" auth="false">
-        <description>Get Inventory Items that are received against an order, 
supplier and product</description>
-        <attribute name="orderId" type="String" mode="IN" optional="true"/>
-        <attribute name="partyId" type="String" mode="IN" optional="true"/>
-        <attribute name="productId" type="String" mode="IN" optional="false"/>
-        <attribute name="inventoryItems" type="List" mode="OUT" 
optional="false"/>
-    </service>    
+    
     <service name="checkInventoryAvailability" engine="java"
             location="org.ofbiz.product.inventory.InventoryServices" 
invoke="checkInventoryAvailability">
         <description>Batch service for checking and sending backorder 
notifications.  Will also set an autoCancelDate for sales orders to 30 days 
(hard coded)

Added: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy?rev=683634&view=auto
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
 (added)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
 Thu Aug  7 08:45:44 2008
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+orderId = parameters.orderId;
+partyId = parameters.partyId;
+productId = parameters.productId;
+
+if (orderId && productId) {
+    shipmentReceiptAndItems = delegator.findByAnd("ShipmentReceiptAndItem", 
[orderId : orderId, productId : productId]);
+    context.inventoryItemsForPo = shipmentReceiptAndItems;
+    context.orderId = orderId;
+}
+
+if (partyId && productId) {
+    orderRoles = delegator.findByAnd("OrderRole", [partyId : partyId, 
roleTypeId : "BILL_FROM_VENDOR"]);
+    inventoryItemsForSupplier = [];
+    orderRoles.each { orderRole ->
+        shipmentReceiptAndItems = 
delegator.findByAnd("ShipmentReceiptAndItem", [productId : productId, orderId : 
orderRole.orderId]);
+        inventoryItemsForSupplier.addAll(shipmentReceiptAndItems);
+    }
+    context.inventoryItemsForSupplier = inventoryItemsForSupplier;
+    context.partyId = partyId;
+}
+
+if (productId) {
+    inventoryItems = delegator.findByAnd("InventoryItem", [productId : 
productId]);
+    context.inventoryItemsForProduct = inventoryItems;
+    context.productId = productId;
+    product = delegator.findByPrimaryKey("Product", [productId : productId]);
+    context.internalName = product.internalName;
+}
\ No newline at end of file

Propchange: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 
ofbiz/trunk/applications/product/webapp/facility/lookup/FieldLookupForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/lookup/FieldLookupForms.xml?rev=683634&r1=683633&r2=683634&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/lookup/FieldLookupForms.xml 
(original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/lookup/FieldLookupForms.xml 
Thu Aug  7 08:45:44 2008
@@ -129,17 +129,4 @@
         <field name="partyIdFrom" 
title="${uiLabelMap.PartyPartyFrom}"><display-entity 
entity-name="PartyNameView" key-field-name="partyId" 
description="${groupName}${lastName}[${partyId}]"/></field>
         <field name="partyIdTo" 
title="${uiLabelMap.PartyPartyTo}"><display-entity entity-name="PartyNameView" 
key-field-name="partyId" 
description="${groupName}${lastName}[${partyId}]"/></field>
     </form>
-    
-    <form name="ListInventoryItem" list-name="inventoryItems" title="" 
type="list" paginate-target="LookupInventoryItem"
-        odd-row-style="alternate-row" default-table-style="basic-table 
hover-bar" view-size="10">
-        <field name="inventoryItemId" widget-style="buttontext">
-            <hyperlink also-hidden="false" target-type="plain" 
description="${inventoryItemId}" 
target="javascript:set_value('${inventoryItemId}')"/>
-        </field>
-        <field name="inventoryItemTypeId"><display-entity 
entity-name="InventoryItemType"/></field>
-        <field name="facilityId"><display/></field>
-        <field name="locationSeqId"><display/></field>
-        <field name="quantityOnHandTotal"><display/></field>
-        <field name="availableToPromiseTotal"><display/></field>
-        <field name="unitCost"><display/></field>
-    </form>    
-</forms>
+</forms>
\ No newline at end of file

Added: 
ofbiz/trunk/applications/product/webapp/facility/lookup/LookupInventoryItems.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/lookup/LookupInventoryItems.ftl?rev=683634&view=auto
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/lookup/LookupInventoryItems.ftl
 (added)
+++ 
ofbiz/trunk/applications/product/webapp/facility/lookup/LookupInventoryItems.ftl
 Thu Aug  7 08:45:44 2008
@@ -0,0 +1,73 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<table class="basic-table hover-bar" cellspacing="0">
+  <tr class="header-row-2">
+    <td>${uiLabelMap.ProductInventoryItemId}</td>
+    <td>${uiLabelMap.ProductFacilityId}</td>
+    <td>${uiLabelMap.ProductLocationSeqId}</td>
+    <td>${uiLabelMap.ProductQoh}</td>
+    <td>${uiLabelMap.ProductAtp}</td>
+    <td>${uiLabelMap.FormFieldTitle_unitCost}</td>
+  </tr>
+  <tr><td colspan="6"><hr class="sepbar"/></td></tr>
+  <#if (inventoryItemsForPo?exists && inventoryItemsForPo?has_content)>
+    <tr class="header-row-2"><td colspan="6"><span 
class="label">&nbsp;${uiLabelMap.ProductInventoryItemsFor} 
${uiLabelMap.ProductPurchaseOrder} - ${orderId}</span></td></tr>
+    <#list inventoryItemsForPo as inventoryItem>
+      <tr>
+        <td><a class="buttontext" 
href="javascript:set_value('${inventoryItem.inventoryItemId}')">${inventoryItem.inventoryItemId}</a></td>
+        <td>${inventoryItem.facilityId?if_exists}</td>
+        <td>${inventoryItem.locationSeqId?if_exists}</td>
+        <td>${inventoryItem.quantityOnHandTotal?if_exists}</td>
+        <td>${inventoryItem.availableToPromiseTotal?if_exists}</td>
+        <td>${inventoryItem.unitCost?if_exists}</td>
+      </tr>
+    </#list>
+  </#if>
+  <#if (inventoryItemsForSupplier?exists && 
inventoryItemsForSupplier?has_content)>
+    <tr class="header-row-2"><td colspan="6"><span class="label 
centered">&nbsp;${uiLabelMap.ProductInventoryItemsFor} 
${uiLabelMap.ProductSupplier} - ${partyId}</span></td></tr>
+    <#list inventoryItemsForSupplier as inventoryItem>
+      <tr>
+        <td><a class="buttontext" 
href="javascript:set_value('${inventoryItem.inventoryItemId}')">${inventoryItem.inventoryItemId}</a></td>
+        <td>${inventoryItem.facilityId?if_exists}</td>
+        <td>${inventoryItem.locationSeqId?if_exists}</td>
+        <td>${inventoryItem.quantityOnHandTotal?if_exists}</td>
+        <td>${inventoryItem.availableToPromiseTotal?if_exists}</td>
+        <td>${inventoryItem.unitCost?if_exists}</td>
+      </tr>
+    </#list>
+  </#if>
+  <#if (inventoryItemsForProduct?exists && 
inventoryItemsForProduct?has_content)>
+    <tr class="header-row-2"><td colspan="6"><span 
class="label">&nbsp;${uiLabelMap.ProductInventoryItemsFor} 
${uiLabelMap.ProductProduct} - ${internalName?if_exists} 
[${productId}]</span></td></tr>
+    <#list inventoryItemsForProduct as inventoryItem>
+      <tr>
+        <td><a class="buttontext" 
href="javascript:set_value('${inventoryItem.inventoryItemId}')">${inventoryItem.inventoryItemId}</a></td>
+        <td>${inventoryItem.facilityId?if_exists}</td>
+        <td>${inventoryItem.locationSeqId?if_exists}</td>
+        <td>${inventoryItem.quantityOnHandTotal?if_exists}</td>
+        <td>${inventoryItem.availableToPromiseTotal?if_exists}</td>
+        <td>${inventoryItem.unitCost?if_exists}</td>
+      </tr>          
+    </#list>
+    <tr>
+  </#if>
+  <#if !(inventoryItemsForPo?exists && inventoryItemsForPo?has_content) && 
!(inventoryItemsForSupplier?exists && inventoryItemsForSupplier?has_content) && 
!(inventoryItemsForProduct?exists && inventoryItemsForProduct?has_content)>
+    <tr><td><span class="label">${uiLabelMap.CommonNo} 
${uiLabelMap.ProductInventoryItems} 
${uiLabelMap.ProductAvailable}.</span></td></tr>
+  </#if>    
+</table>
\ No newline at end of file

Propchange: 
ofbiz/trunk/applications/product/webapp/facility/lookup/LookupInventoryItems.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/trunk/applications/product/webapp/facility/lookup/LookupInventoryItems.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: 
ofbiz/trunk/applications/product/webapp/facility/lookup/LookupInventoryItems.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/product/widget/facility/LookupScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/LookupScreens.xml?rev=683634&r1=683633&r2=683634&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/facility/LookupScreens.xml 
(original)
+++ ofbiz/trunk/applications/product/widget/facility/LookupScreens.xml Thu Aug  
7 08:45:44 2008
@@ -99,13 +99,15 @@
     <screen name="LookupInventoryItem">
         <section>
             <actions>
-                <set field="title" value="${uiLabelMap.LookupInventoryItem}"/>
-                <service 
service-name="getInventoryItemForAssociatedOrderSupplierAndProduct" 
auto-field-map="parameters"/>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" 
global="true"/>
+                <property-map resource="ProductUiLabels" map-name="uiLabelMap" 
global="true"/>
+                <set field="title" 
value="${uiLabelMap.ProductLookupInventory}"/>
+                <script 
location="component://product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="LookupDecorator" 
location="component://common/widget/CommonScreens.xml">
                     <decorator-section name="search-results">
-                        <include-form name="ListInventoryItem" 
location="component://product/webapp/facility/lookup/FieldLookupForms.xml" />
+                        <platform-specific><html><html-template 
location="component://product/webapp/facility/lookup/LookupInventoryItems.ftl"/></html></platform-specific>
                     </decorator-section>
                 </decorator-screen>
             </widgets>


Reply via email to