Author: jacopoc
Date: Wed Jun 20 03:38:28 2007 New Revision: 549056 URL: http://svn.apache.org/viewvc?view=rev&rev=549056 Log: Implemented new inventory item search screen to search inventory items by labels. Added: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh (with props) ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl (with props) Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.properties ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml ofbiz/trunk/applications/product/widget/facility/FacilityScreens.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=549056&r1=549055&r2=549056 ============================================================================== --- ofbiz/trunk/applications/product/config/ProductUiLabels.properties (original) +++ ofbiz/trunk/applications/product/config/ProductUiLabels.properties Wed Jun 20 03:38:28 2007 @@ -1190,6 +1190,7 @@ ProductSearchResultsFound=ID Value was the actual productId of this product. ProductSearchResultsWithIdValue=Search Results for Product with ID Value ProductSearchinCategory=Search in Category +ProductSearchInventoryItemsByLabels=Search by Labels ProductSection=Section ProductSegment=Segment ProductSegmentGroupId=Segment Id Added: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh?view=auto&rev=549056 ============================================================================== --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh (added) +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh Wed Jun 20 03:38:28 2007 @@ -0,0 +1,84 @@ +/* + * 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. + */ + +import java.util.*; +import org.ofbiz.entity.*; +import org.ofbiz.base.util.*; +import org.ofbiz.entity.condition.EntityConditionList; +import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.model.DynamicViewEntity; +import org.ofbiz.entity.model.ModelKeyMap; +import org.ofbiz.entity.transaction.*; +import org.ofbiz.entity.util.EntityListIterator; + +String facilityId = parameters.get("facilityId"); + +int numberOfFields = 0; +numberOfFieldsStr = parameters.get("numberOfFields"); +try { + numberOfFields = Integer.parseInt(numberOfFieldsStr); +} catch(Exception exc) { + numberOfFields = 0; +} + +DynamicViewEntity inventoryItemAndLabelsView = new DynamicViewEntity(); +inventoryItemAndLabelsView.addMemberEntity("II", "InventoryItem"); +inventoryItemAndLabelsView.addAliasAll("II", null); +for (int i = 1; i <= numberOfFields; i++) { + String inventoryItemLabelId = parameters.get("inventoryItemLabelId_" + i); + if (UtilValidate.isNotEmpty(inventoryItemLabelId)) { + inventoryItemAndLabelsView.addMemberEntity("IL" + i, "InventoryItemLabelAppl"); + inventoryItemAndLabelsView.addViewLink("II", "IL" + i, new Boolean(false), ModelKeyMap.makeKeyMapList("inventoryItemId")); + } +} +List andCondition = UtilMisc.toList(new EntityExpr("facilityId", EntityOperator.EQUALS, facilityId)); +for (int i = 1; i <= numberOfFields; i++) { + String inventoryItemLabelId = parameters.get("inventoryItemLabelId_" + i); + if (UtilValidate.isNotEmpty(inventoryItemLabelId)) { + inventoryItemAndLabelsView.addAlias("IL" + i, "inventoryItemLabelId" + i, "inventoryItemLabelId", null, null, null, null); + andCondition.add(new EntityExpr("inventoryItemLabelId" + i, EntityOperator.EQUALS, inventoryItemLabelId)); + } +} +EntityListIterator inventoryItemsEli = null; +boolean beganTransaction = false; +List inventoryItems = null; +if (andCondition.size() > 1) { + try { + beganTransaction = TransactionUtil.begin(); + inventoryItemsEli = delegator.findListIteratorByCondition(inventoryItemAndLabelsView, new EntityConditionList(andCondition, EntityOperator.AND), null, null, null, null); + inventoryItems = inventoryItemsEli.getCompleteList(); + inventoryItemsEli.close(); + } catch (GenericEntityException e) { + String errMsg = "Failure in operation, rolling back transaction"; + Debug.logError(e, errMsg, "findInventoryItemsByLabels"); + try { + // only rollback the transaction if we started one... + TransactionUtil.rollback(beganTransaction, errMsg, e); + } catch (GenericEntityException e2) { + Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "findInventoryItemsByLabels"); + } + // after rolling back, rethrow the exception + throw e; + } finally { + // only commit the transaction if we started one... this will throw an exception if it fails + TransactionUtil.commit(beganTransaction); + } +} +context.put("inventoryItems", inventoryItems); Propchange: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml?view=diff&rev=549056&r1=549055&r2=549056 ============================================================================== --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml Wed Jun 20 03:38:28 2007 @@ -200,6 +200,10 @@ <response name="success" type="view" value="EditFacilityInventoryItems"/> <response name="error" type="view" value="EditFacilityInventoryItems"/> </request-map> --> + <request-map uri="SearchInventoryItemsByLabels"> + <security https="true" auth="true"/> + <response name="success" type="view" value="SearchInventoryItemsByLabels"/> + </request-map> <request-map uri="ViewFacilityInventoryByProduct"> <security https="true" auth="true"/> <response name="success" type="view" value="ViewFacilityInventoryByProduct"/> @@ -1159,6 +1163,7 @@ <view-map name="FindFacilityLocation" type="screen" page="component://product/widget/facility/FacilityScreens.xml#FindFacilityLocation"/> <view-map name="EditFacilityLocation" type="screen" page="component://product/widget/facility/FacilityScreens.xml#EditFacilityLocation"/> <view-map name="EditFacilityInventoryItems" type="screen" page="component://product/widget/facility/FacilityScreens.xml#EditFacilityInventoryItems"/> + <view-map name="SearchInventoryItemsByLabels" type="screen" page="component://product/widget/facility/FacilityScreens.xml#SearchInventoryItemsByLabels"/> <view-map name="ViewFacilityInventoryByProduct" type="screen" page="component://product/widget/facility/FacilityScreens.xml#ViewFacilityInventoryByProduct"/> <view-map name="ViewFacilityInventoryByProductSimple" type="screen" page="component://product/widget/facility/FacilityScreens.xml#ViewFacilityInventoryByProductSimple"/> <view-map name="ViewFacilityInventoryByProductReport" type="screenfop" page="component://product/widget/facility/FacilityScreens.xml#ViewFacilityInventoryByProductReport" content-type="application/pdf" encoding="none"/> 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=549056&r1=549055&r2=549056 ============================================================================== --- ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml (original) +++ ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml Wed Jun 20 03:38:28 2007 @@ -95,6 +95,26 @@ <hyperlink target="TransferInventoryItem?facilityId=${facilityId}&inventoryItemId=${inventoryItemId}" description="${uiLabelMap.ProductTransfer}"/> </field> </form> + <form name="ListFacilityInventoryItemsNoLocations" type="list" target="" title="" list-name="inventoryItems" + paginate-target="SearchInventoryItemsByLabels"> + <field name="inventoryItemId" widget-style="buttontext"> + <hyperlink target="EditInventoryItem?inventoryItemId=${inventoryItemId}&facilityId=${facilityId}" description="${inventoryItemId}"/> + </field> + <field name="inventoryItemTypeId"> + <display-entity entity-name="InventoryItemType"/> + </field> + <field name="statusId"><display/></field> + <field name="datetimeReceived"><display/></field> + <field name="expireDate"><display/></field> + <field name="productId"> + <hyperlink target="/catalog/control/EditProduct?productId=${productId}" target-type="inter-app" description="${productId}"/> + </field> + <field name="lotId"><display/></field> + <field name="binNumber"><display/></field> + <field name="serialNumber"><display/></field> + <field name="softIdentifier"><display/></field> + <field name="quantityOnHandTotal"><display description="${availableToPromiseTotal} / ${quantityOnHandTotal}"/></field> + </form> <form name="FindFacilityInventoryByProduct" type="single" target="${facilityInventoryByProductScreen}" title="" default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext"> <field name="facilityId"><hidden/></field> Added: ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl?view=auto&rev=549056 ============================================================================== --- ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl (added) +++ ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl Wed Jun 20 03:38:28 2007 @@ -0,0 +1,46 @@ +<#-- +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. +--> + +<form method="post" action="<@ofbizUrl>SearchInventoryItemsByLabels</@ofbizUrl>"> + <input type="hidden" name="facilityId" value="${facility.facilityId}"/> + <table> + <#assign index = 0> + <#list labelTypes as labelType> + <#assign index = index + 1> + <#assign labels = labelType.getRelated("InventoryItemLabel", Static["org.ofbiz.base.util.UtilMisc"].toList("inventoryItemLabelId"))> + <tr> + <th>${labelType.description?if_exists} [${labelType.inventoryItemLabelTypeId}]</th> + <td> + <select name="inventoryItemLabelId_${index}"> + <option></option> + <#list labels as label> + <option value="${label.inventoryItemLabelId}" <#if parameters["inventoryItemLabelId_" + index]?has_content>selected</#if>>${label.description?if_exists} [${label.inventoryItemLabelId}]</option> + </#list> + </select> + </td> + </tr> + </#list> + <tr> + <td colspan="2"> + <input type="submit" value="${uiLabelMap.CommonSubmit}"/> + </td> + </tr> + </table> + <input type="hidden" name="numberOfFields" value="${index}"/> +</form> Propchange: ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml?view=diff&rev=549056&r1=549055&r2=549056 ============================================================================== --- ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml (original) +++ ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml Wed Jun 20 03:38:28 2007 @@ -159,9 +159,48 @@ <container> <link target="EditFacility" text="${uiLabelMap.ProductNewFacility}" style="buttontext"/> <link target="EditInventoryItem?facilityId=${parameters.facilityId}" text="${uiLabelMap.ProductCreateNewInventoryItemFacility}" style="buttontext"/> + <link target="SearchInventoryItemsByLabels?facilityId=${parameters.facilityId}" text="${uiLabelMap.ProductSearchInventoryItemsByLabels}" style="buttontext"/> </container> <include-form name="SearchInventoryItemsParams" location="component://product/webapp/facility/facility/FacilityForms.xml"/> <include-form name="ListFacilityInventoryItems" location="component://product/webapp/facility/facility/FacilityForms.xml"/> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + <screen name="SearchInventoryItemsByLabels"> + <section> + <actions> + <set field="titleProperty" value="PageTitleSearchInventoryItemsByLabels"/> + <set field="headerItem" value="facility"/> + <set field="tabButtonItem" value="EditFacilityInventoryItems"/> + + <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer" default-value="0"/> + <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="50"/> + + <entity-one entity-name="Facility" value-name="facility"/> + <entity-condition entity-name="InventoryItemLabelType" list-name="labelTypes"/> + <script location="component://product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh"/> + </actions> + <widgets> + <decorator-screen name="CommonFacilityDecorator" location="${parameters.commonFacilityDecoratorLocation}"> + <decorator-section name="body"> + <container> + <label style="head1">${uiLabelMap.ProductInventoryItemsFor}</label> + <label style="head2">${facility.facilityName} [${uiLabelMap.CommonId}:${facility.facilityId}]</label> + </container> + <container> + <link target="EditFacility" text="${uiLabelMap.ProductNewFacility}" style="buttontext"/> + <link target="EditInventoryItem?facilityId=${parameters.facilityId}" text="${uiLabelMap.ProductCreateNewInventoryItemFacility}" style="buttontext"/> + <link target="EditFacilityInventoryItems?facilityId=${parameters.facilityId}" text="${uiLabelMap.ProductInventoryItems}" style="buttontext"/> + </container> + <container> + <label style="head2">${uiLabelMap.ProductSearchInventoryItemsByLabels}</label> + </container> + <platform-specific> + <html><html-template location="component://product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl"/></html> + </platform-specific> + <include-form name="ListFacilityInventoryItemsNoLocations" location="component://product/webapp/facility/facility/FacilityForms.xml"/> </decorator-section> </decorator-screen> </widgets> |
Free forum by Nabble | Edit this page |