You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ap...@apache.org on 2014/09/20 15:00:32 UTC

svn commit: r1626436 - in /ofbiz/trunk/applications/product: script/org/ofbiz/shipment/picklist/PicklistServices.xml servicedef/services_picklist.xml webapp/facility/facility/PicklistManage.ftl widget/facility/FacilityScreens.xml

Author: apatel
Date: Sat Sep 20 13:00:32 2014
New Revision: 1626436

URL: http://svn.apache.org/r1626436
Log:
[OFBIZ-5778] Add pagination to picklists screen. This simple change helps when we have big list of picklist.
Thanks Arun Patidar for load tests, reporting issue and providing fix.
 

Modified:
    ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml
    ofbiz/trunk/applications/product/servicedef/services_picklist.xml
    ofbiz/trunk/applications/product/webapp/facility/facility/PicklistManage.ftl
    ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml?rev=1626436&r1=1626435&r2=1626436&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml Sat Sep 20 13:00:32 2014
@@ -1213,6 +1213,8 @@ under the License.
         </check-permission>
         <check-errors/>
 
+        <set field="viewSize" from-field="parameters.viewSize" type="Integer"/>
+        <set field="viewIndex" from-field="parameters.viewIndex" type="Integer"/>
         <entity-condition entity-name="Picklist" list="picklistList">
             <condition-list combine="and">
                 <condition-expr field-name="facilityId" operator="equals" from-field="parameters.facilityId"/>
@@ -1220,14 +1222,36 @@ under the License.
                 <condition-expr field-name="statusId" operator="not-equals" value="PICKLIST_CANCELLED"/>
             </condition-list>
             <order-by field-name="picklistDate"/>
+            <limit-view view-size="${viewSize}" view-index="${viewIndex+1}"/>
         </entity-condition>
 
+        <entity-count entity-name="Picklist" count-field="picklistCount">
+            <condition-list combine="and">
+                <condition-expr field-name="facilityId" operator="equals" from-field="parameters.facilityId"/>
+                <condition-expr field-name="statusId" operator="not-equals" value="PICKLIST_PICKED"/>
+                <condition-expr field-name="statusId" operator="not-equals" value="PICKLIST_CANCELLED"/>
+            </condition-list>
+        </entity-count>
         <iterate entry="picklist" list="picklistList">
             <call-simple-method method-name="getPicklistSingleInfoInline"/>
             <field-to-list field="picklistInfo" list="picklistInfoList"/>
         </iterate>
 
+        <set field="lowIndex" value="${(viewIndex * viewSize) + 1}" type="Integer"/>
+        <set field="highIndex" value="${(viewIndex + 1) * viewSize}" type="Integer"/>
+        <if-compare-field field="highIndex" operator="greater" to-field="picklistCount" type="Integer">
+            <set field="highIndex" from-field="picklistCount" type="Integer"/>
+        </if-compare-field>
+        <if-compare-field field="viewSize" operator="greater" to-field="picklistCount" type="Integer">
+            <set field="highIndex" from-field="picklistCount" type="Integer"/>
+        </if-compare-field>
+        
         <field-to-result field="picklistInfoList"/>
+        <field-to-result field="viewIndex"/>
+        <field-to-result field="viewSize"/>
+        <field-to-result field="lowIndex"/>
+        <field-to-result field="highIndex"/>
+        <field-to-result field="picklistCount"/>
     </simple-method>
 
     <simple-method method-name="getPickAndPackReportInfo" short-description="getPickAndPackReportInfo">

Modified: ofbiz/trunk/applications/product/servicedef/services_picklist.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_picklist.xml?rev=1626436&r1=1626435&r2=1626436&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_picklist.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_picklist.xml Sat Sep 20 13:00:32 2014
@@ -79,6 +79,11 @@ under the License.
             location="component://product/script/org/ofbiz/shipment/picklist/PicklistServices.xml" invoke="getPicklistDisplayInfo">
         <description>Create Picklist From Orders</description>
         <attribute name="facilityId" type="String" mode="IN" optional="false"/>
+        <attribute name="viewIndex" mode="INOUT" type="Integer" optional="true"/>
+        <attribute name="viewSize" mode="INOUT" type="Integer" optional="true"/>
+        <attribute name="highIndex" mode="OUT" type="Integer" optional="true"/>
+        <attribute name="lowIndex" mode="OUT" type="Integer" optional="true"/>
+        <attribute name="picklistCount" mode="OUT" type="Long" optional="true"/>
         <attribute name="picklistInfoList" type="List" mode="OUT" optional="true"/>
     </service>
 

Modified: ofbiz/trunk/applications/product/webapp/facility/facility/PicklistManage.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/facility/PicklistManage.ftl?rev=1626436&r1=1626435&r2=1626436&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/facility/PicklistManage.ftl (original)
+++ ofbiz/trunk/applications/product/webapp/facility/facility/PicklistManage.ftl Sat Sep 20 13:00:32 2014
@@ -16,14 +16,41 @@ KIND, either express or implied.  See th
 specific language governing permissions and limitations
 under the License.
 -->
+<script language="JavaScript" type="text/javascript">
+    function paginateOrderList(viewSize, viewIndex) {
+        document.paginationForm.viewSize.value = viewSize;
+        document.paginationForm.viewIndex.value = viewIndex;
+        document.paginationForm.submit();
+    }
+</script>
 
 <div class="screenlet">
   <div class="screenlet-title-bar">
     <ul>
       <li class="h3">${uiLabelMap.ProductPicklistManage}</li>
+      <#if (picklistInfoList?has_content && 0 < picklistInfoList?size)>
+        <#if (picklistCount > highIndex)>
+          <li><a href="javascript:paginateOrderList('${viewSize}', '${viewIndex+1}')">${uiLabelMap.CommonNext}</a></li>
+        <#else>
+          <li><span class="disabled">${uiLabelMap.CommonNext}</span></li>
+        </#if>
+        <#if (picklistCount > 0)>
+          <li><span>${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${picklistCount}</span></li>
+        </#if>
+        <#if (viewIndex > 0)>
+          <li><a href="javascript:paginateOrderList('${viewSize}', '${viewIndex-1}')">${uiLabelMap.CommonPrevious}</a></li>
+        <#else>
+          <li><span class="disabled">${uiLabelMap.CommonPrevious}</span></li>
+        </#if>
+      </#if>
     </ul>
     <br class="clear"/>
   </div>
+  <form name="paginationForm" method="post" action="<@o...@ofbizUrl>">
+    <input type="hidden" name="viewSize" value="${viewSize}"/>
+    <input type="hidden" name="viewIndex" value="${viewIndex}"/>
+    <input type="hidden" name="facilityId" value="${facilityId}"/>
+  </form>
   <div class="screenlet-body">
     <#if picklistInfoList?has_content>
       <#list picklistInfoList as picklistInfo>

Modified: ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml?rev=1626436&r1=1626435&r2=1626436&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml Sat Sep 20 13:00:32 2014
@@ -1247,6 +1247,8 @@ under the License.
                 <set field="tabButtonItem" value="PicklistManage"/>
 
                 <set field="facilityId" from-field="parameters.facilityId"/>
+                <set field="viewIndex" from-field="parameters.viewIndex" default-value="0"/>
+                <set field="viewSize" from-field="parameters.viewSize" default-value="10"/>
                 <service service-name="getPicklistDisplayInfo">
                     <field-map field-name="facilityId"/>
                 </service>