Author: diveshdutta
Date: Sat Mar 19 14:24:49 2016 New Revision: 1735775 URL: http://svn.apache.org/viewvc?rev=1735775&view=rev Log: [OFBIZ-6042] Allowing inventory transfers based on Product instead of only InventoryItem. Thanks Christian Carlow for this patch and Suraj Khurana for testing it. Modified: 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/WEB-INF/controller.xml ofbiz/trunk/applications/product/widget/facility/FacilityForms.xml ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml 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=1735775&r1=1735774&r2=1735775&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 Sat Mar 19 14:24:49 2016 @@ -918,10 +918,6 @@ under the License. </simple-method> <simple-method method-name="createInventoryTransfersForProduct" short-description="Create inventory transfers for the given product and quantity. Return the units not available for transfers."> - - <set from-field="parameters.productId" field="lookupFieldMap.productId"/> - <set from-field="parameters.facilityId" field="lookupFieldMap.facilityId"/> - <set from-field="parameters.containerId" field="lookupFieldMap.containerId"/> <now-timestamp field="nowTimestamp"/> <!-- check the product; make sure its a physical item --> @@ -963,128 +959,74 @@ under the License. </if-compare> </else> </if-compare> - <set field="orderByList[]" from-field="orderByString"/> <set from-field="parameters.quantity" field="quantityNotTransferred"/> - - <!-- first transfer InventoryItems in FLT_PICKLOC type locations, then FLT_BULK locations, then InventoryItems with no locations --> - <find-by-and entity-name="InventoryItemAndLocation" map="lookupFieldMap" list="inventoryItemAndLocations" use-iterator="true" order-by-list="orderByList"/> - <iterate entry="inventoryItemAndLocation" list="inventoryItemAndLocations"> - <if> - <condition> - <and> - <if-compare field="inventoryItemAndLocation.locationTypeEnumId" operator="equals" value="FLT_PICKLOC"/> - <if-compare field="quantityNotTransferred" value="0.0" operator="greater" type="BigDecimal"/> - <if-compare field="inventoryItemAndLocation.availableToPromiseTotal" value="0.0" operator="greater" type="BigDecimal"/> - </and> - </condition> - <then> - <clear-field field="inputMap"/> - <set field="inputMap.inventoryItemId" from-field="inventoryItemAndLocation.inventoryItemId"/> - <set field="inputMap.statusId" value="IXF_REQUESTED"/> - <set field="inputMap.facilityId" from-field="parameters.facilityId"/> - <set field="inputMap.facilityIdTo" from-field="parameters.facilityIdTo"/> - <set field="inputMap.sendDate" from-field="parameters.sendDate"/> - <!-- TODO: inventory transfers for serialized items are not yet implemented --> - <if-compare field="inventoryItemAndLocation.inventoryItemTypeId" operator="equals" value="NON_SERIAL_INV_ITEM"> - <if-compare-field field="quantityNotTransferred" to-field="inventoryItemAndLocation.availableToPromiseTotal" operator="greater" type="BigDecimal"> - <set field="inputMap.xferQty" from-field="inventoryItemAndLocation.availableToPromiseTotal"/> - <else> - <set field="inputMap.xferQty" from-field="quantityNotTransferred"/> - </else> - </if-compare-field> - <call-service service-name="createInventoryTransfer" in-map-name="inputMap"/> - <calculate field="quantityNotTransferred"> - <calcop operator="subtract" field="quantityNotTransferred"> - <calcop operator="get" field="inputMap.xferQty"/> - </calcop> - </calculate> - </if-compare> - </then> - </if> + + <set field="locationTypeEnumIds" value="${groovy: ['FLT_PICKLOC', 'FLT_BULK', null]}"/> + <iterate entry="locationTypeEnumId" list="locationTypeEnumIds"> + <find-by-and entity-name="InventoryItemAndLocation" map="lookupFieldMap" list="inventoryItemAndLocations" use-iterator="true" order-by-list="orderByList"/> + <entity-condition list="inventoryItemAndLocations" entity-name="InventoryItemAndLocation"> + <condition-list> + <condition-expr field-name="locationTypeEnumId" value="${locationTypeEnumId}" ignore-if-empty="true" ignore-if-null="true"/> + <condition-expr field-name="productId" value="${parameters.productId}"/> + <condition-expr field-name="containerId" value="${parameters.containerId}" ignore-if-empty="true" ignore-if-null="true"/> + <condition-expr field-name="facilityId" value="${parameters.facilityId}"/> + <condition-expr field-name="availableToPromiseTotal" operator="greater" value="0"/> + </condition-list> + <order-by field-name="${orderByString}"/> + </entity-condition> + <!-- first transfer InventoryItems in FLT_PICKLOC type locations, then FLT_BULK locations, then InventoryItems with no locations --> + <iterate entry="inventoryItemAndLocation" list="inventoryItemAndLocations"> + <clear-field field="inputMap"/> + <set field="inputMap.inventoryItemId" from-field="inventoryItemAndLocation.inventoryItemId"/> + <if-empty field="parameters.statusId"> + <set field="inputMap.statusId" value="IXF_REQUESTED"/> + <else> + <set field="inputMap.statusId" value="${parameters.statusId}"/> + </else> + </if-empty> + <set field="inputMap.facilityId" from-field="parameters.facilityId"/> + <set field="inputMap.facilityIdTo" from-field="parameters.facilityIdTo"/> + <set field="inputMap.sendDate" from-field="parameters.sendDate"/> + <!-- TODO: inventory transfers for serialized items are not yet implemented --> + <if-compare field="inventoryItemAndLocation.inventoryItemTypeId" operator="equals" value="NON_SERIAL_INV_ITEM"> + <if-compare-field field="quantityNotTransferred" to-field="inventoryItemAndLocation.availableToPromiseTotal" operator="greater" type="BigDecimal"> + <set field="inputMap.xferQty" from-field="inventoryItemAndLocation.availableToPromiseTotal"/> + <else> + <set field="inputMap.xferQty" from-field="quantityNotTransferred"/> + </else> + </if-compare-field> + <add-error> + <fail-message message="inputMap = ${inputMap}"/> + </add-error> + <call-service service-name="createInventoryTransfer" in-map-name="inputMap"/> + <add-error> + <fail-message message="quantityNotTransferred = ${quantityNotTransferred}"/> + </add-error> + <calculate field="quantityNotTransferred"> + <calcop operator="subtract" field="quantityNotTransferred"> + <calcop operator="get" field="inputMap.xferQty"/> + </calcop> + </calculate> + </if-compare> + <if-compare operator="equals" value="0" field="quantityNotTransferred"> + <break/> + </if-compare> + </iterate> </iterate> - - <!-- still some left? try the FLT_BULK locations --> - <if-compare field="quantityNotTransferred" operator="greater" value="0" type="BigDecimal"> - <find-by-and entity-name="InventoryItemAndLocation" map="lookupFieldMap" list="inventoryItemAndLocations" use-iterator="true" order-by-list="orderByList"/> - <iterate entry="inventoryItemAndLocation" list="inventoryItemAndLocations"> - <if> - <condition> - <and> - <if-compare field="inventoryItemAndLocation.locationTypeEnumId" operator="equals" value="FLT_BULK"/> - <if-compare field="quantityNotTransferred" value="0.0" operator="greater" type="BigDecimal"/> - <if-compare field="inventoryItemAndLocation.availableToPromiseTotal" value="0.0" operator="greater" type="BigDecimal"/> - </and> - </condition> - <then> - <clear-field field="inputMap"/> - <set field="inputMap.inventoryItemId" from-field="inventoryItemAndLocation.inventoryItemId"/> - <set field="inputMap.statusId" value="IXF_REQUESTED"/> - <set field="inputMap.facilityId" from-field="parameters.facilityId"/> - <set field="inputMap.facilityIdTo" from-field="parameters.facilityIdTo"/> - <set field="inputMap.sendDate" from-field="parameters.sendDate"/> - <!-- TODO: inventory transfers for serialized items are not yet implemented --> - <if-compare field="inventoryItemAndLocation.inventoryItemTypeId" operator="equals" value="NON_SERIAL_INV_ITEM"> - <if-compare-field field="quantityNotTransferred" to-field="inventoryItemAndLocation.availableToPromiseTotal" operator="greater" type="BigDecimal"> - <set field="inputMap.xferQty" from-field="inventoryItemAndLocation.availableToPromiseTotal"/> - <else> - <set field="inputMap.xferQty" from-field="quantityNotTransferred"/> - </else> - </if-compare-field> - <call-service service-name="createInventoryTransfer" in-map-name="inputMap"/> - <calculate field="quantityNotTransferred"> - <calcop operator="subtract" field="quantityNotTransferred"> - <calcop operator="get" field="inputMap.xferQty"/> - </calcop> - </calculate> - </if-compare> - </then> - </if> - </iterate> - </if-compare> - - <!-- last of all transfer InventoryItems that have no locationSeqId, ie are not in any particular location --> - <if-compare field="quantityNotTransferred" operator="greater" value="0" type="BigDecimal"> - <find-by-and entity-name="InventoryItem" map="lookupFieldMap" list="inventoryItems" use-iterator="true" order-by-list="orderByList"/> - <iterate entry="inventoryItem" list="inventoryItems"> - <if> - <condition> - <and> - <if-empty field="inventoryItem.locationSeqId"/> - <if-compare field="quantityNotTransferred" value="0.0" operator="greater" type="BigDecimal"/> - <if-compare field="inventoryItem.availableToPromiseTotal" value="0.0" operator="greater" type="BigDecimal"/> - </and> - </condition> - <then> - <clear-field field="inputMap"/> - <set field="inputMap.inventoryItemId" from-field="inventoryItem.inventoryItemId"/> - <set field="inputMap.statusId" value="IXF_REQUESTED"/> - <set field="inputMap.facilityId" from-field="parameters.facilityId"/> - <set field="inputMap.facilityIdTo" from-field="parameters.facilityIdTo"/> - <set field="inputMap.sendDate" from-field="parameters.sendDate"/> - <!-- TODO: inventory transfers for serialized items are not yet implemented --> - <if-compare field="inventoryItem.inventoryItemTypeId" operator="equals" value="NON_SERIAL_INV_ITEM"> - <if-compare-field field="quantityNotTransferred" to-field="inventoryItem.availableToPromiseTotal" operator="greater" type="BigDecimal"> - <set field="inputMap.xferQty" from-field="inventoryItem.availableToPromiseTotal"/> - <else> - <set field="inputMap.xferQty" from-field="quantityNotTransferred"/> - </else> - </if-compare-field> - <call-service service-name="createInventoryTransfer" in-map-name="inputMap"/> - <calculate field="quantityNotTransferred"> - <calcop operator="subtract" field="quantityNotTransferred"> - <calcop operator="get" field="inputMap.xferQty"/> - </calcop> - </calculate> - </if-compare> - </then> - </if> - </iterate> - </if-compare> </else> </if-compare> <field-to-result field="quantityNotTransferred"/> + <if-compare operator="greater" value="0" field="quantityNotTransferred"> + <add-error> + <fail-property resource="ProductUiLabels" property="FormFieldTitle_quantityNotAvailable"/> + </add-error> + <add-error> + <fail-message message="${quantityNotTransferred}"/> + </add-error> + <check-errors/> + </if-compare> </simple-method> <simple-method method-name="changeOwnerUponIssuance" short-description="If product store setOwnerUponIssuance is Y or empty, set the inventory item owner upon issuance."> Modified: ofbiz/trunk/applications/product/servicedef/services_facility.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_facility.xml?rev=1735775&r1=1735774&r2=1735775&view=diff ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services_facility.xml (original) +++ ofbiz/trunk/applications/product/servicedef/services_facility.xml Sat Mar 19 14:24:49 2016 @@ -445,7 +445,8 @@ under the License. <service name="prepareInventoryTransfer" engine="java" location="org.ofbiz.product.inventory.InventoryServices" invoke="prepareInventoryTransfer"> <description>Prepares inventory item for transfer. If the xferQty is less than quantityOnHandTotal of the inventory item, then the inventory - item is "split," and an new inventory item will be created with xferQty and used for the inventory transfer.</description> <attribute name="inventoryItemId" type="String" mode="INOUT" optional="false"/> + item is "split," and an new inventory item will be created with xferQty and used for the inventory transfer.</description> + <attribute name="inventoryItemId" type="String" mode="INOUT" optional="false"/> <attribute name="xferQty" type="BigDecimal" mode="IN" optional="false"/> </service> <service name="completeInventoryTransfer" engine="java" @@ -472,6 +473,7 @@ under the License. <attribute name="quantity" type="BigDecimal" mode="IN" optional="false"/> <attribute name="reserveOrderEnumId" type="String" mode="IN" optional="true"/> <attribute name="quantityNotTransferred" type="BigDecimal" mode="OUT" optional="false"/> + <attribute name="statusId" type="String" mode="IN" optional="true"/> </service> <service name="issueImmediatelyFulfilledOrder" engine="simple" 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?rev=1735775&r1=1735774&r2=1735775&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml Sat Mar 19 14:24:49 2016 @@ -522,6 +522,12 @@ under the License. <security https="true" auth="true"/> <response name="success" type="view" value="TransferInventoryItem"/> </request-map> + <request-map uri="createInventoryTransfersForProduct"> + <security https="true" auth="true"/> + <event type="service" path="" invoke="createInventoryTransfersForProduct"/> + <response name="success" type="view" value="FindFacilityTransfers"/> + <response name="error" type="view" value="FindFacilityTransfers"/> + </request-map> <request-map uri="CreateInventoryTransfer"> <security https="true" auth="true"/> <event type="service" path="" invoke="createInventoryTransfer"/> Modified: ofbiz/trunk/applications/product/widget/facility/FacilityForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/FacilityForms.xml?rev=1735775&r1=1735774&r2=1735775&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/facility/FacilityForms.xml (original) +++ ofbiz/trunk/applications/product/widget/facility/FacilityForms.xml Sat Mar 19 14:24:49 2016 @@ -943,4 +943,75 @@ under the License. <field name="fromDate"><display/></field> <field name="thruDate"><display/></field> </form> + + <form name="CreateInventoryTransferForItem" type="single" default-table-style="basic-table" target="TransferInventoryItem"> + <field name="inventoryItemId" widget-style="buttontext" title="${uiLabelMap.FormFieldTitle_inventoryItemId}"><text/></field> + <field name="facilityId"><hidden/></field> + <field name="submitButton" title="${uiLabelMap.CommonSubmit}"> + <submit/> + </field> + </form> + <form name="CreateInventoryTransferForProduct" type="single" default-table-style="basic-table" target="TransferInventoryItem"> + <actions> + <set field="productId" value="${groovy: if(inventoryItem != null)inventoryItem.productId}"/> + </actions> + <field name="productId" widget-style="buttontext" title="${uiLabelMap.FormFieldTitle_productId}"> + <lookup target-form-name="LookupProduct"></lookup> + </field> + <field name="facilityId"><hidden/></field> + <field name="submitButton" title="${uiLabelMap.CommonSubmit}"> + <submit/> + </field> + </form> + <form name="CreateInventoryTransfer" type="single" default-table-style="basic-table" target="CreateInventoryTransfer"> + <alt-target use-when="${groovy: inventoryItem==null}" target="createInventoryTransfersForProduct"/> + <alt-target use-when="${groovy: inventoryTransferId!=null}" target="UpdateInventoryTransfer"/> + <field name="inventoryItemId" widget-style="buttontext" use-when="${groovy: inventoryItem != null}"> + <hyperlink target="/catalog/control/EditInventoryItem" target-type="inter-app" description="${inventoryItemId}"> + <parameter param-name="inventoryItemId"/> + </hyperlink> + </field> + <field name="inventoryItemTypeId" use-when="${groovy: inventoryItem != null}"><display description="${inventoryItemType.description}"/></field> + <field name="productId" widget-style="buttontext"> + <hyperlink target="/catalog/control/EditProduct" target-type="inter-app" description="${groovy: if(inventoryItem) inventoryItem.productId else parameters.productId}"> + <parameter param-name="productId"/> + </hyperlink> + </field> + <field name="inventoryStatusId" use-when="${groovy: inventoryItem != null}"><display description="${statusItem.description}"/></field> + <field name="inventoryComments" use-when="${groovy: inventoryItem != null}"><display description="${inventoryItem.comments}"/></field> + <field name="atpQoh" title="${uiLabelMap.ProductSerialAtpQoh}" use-when="${groovy: inventoryItem != null}"><display description="${inventoryItem.availableToPromiseTotal} / ${inventoryItem.quantityOnHandTotal}"/></field> + <field name="statusId" title="${uiLabelMap.ProductTransferStatus}" entry-name="inventoryTransfer.statusId"> + <drop-down> + <entity-options description="${description}" entity-name="StatusItem"> + <entity-constraint name="statusTypeId" value="INVENTORY_XFER_STTS"/> + <entity-order-by field-name="sequenceId"/> + </entity-options> + </drop-down> + </field> + <field name="sendDate" title="${uiLabelMap.ProductTransferSendDate}"><date-time type="timestamp" default-value="${inventoryTransfer.sendDate}"/></field> + <field name="receiveDate" title="${uiLabelMap.ProductTransferReceiveDate}" use-when="${groovy: inventoryTransfer!=null}"><date-time type="timestamp" default-value="${inventoryTransfer.receiveDate}"/></field> + <field name="facilityIdTo" use-when="${groovy: inventoryTransfer==null}"> + <drop-down> + <entity-options description="${facilityName} [${facilityId}]" entity-name="Facility" key-field-name="facilityId"> + <entity-order-by field-name="facilityName"/> + </entity-options> + </drop-down> + </field> + <field name="facilityIdTo" use-when="${groovy: inventoryTransfer!=null}" widget-style="buttontext"> + <hyperlink target="EditFacility" description="${inventoryTransfer.facilityIdTo}" also-hidden="false"> + <parameter param-name="facilityIdTo" value="${inventoryTransfer.facilityIdTo}"/> + </hyperlink> + </field> + <field name="containerIdTo" title="${uiLabelMap.FormFieldTitle_containerId}" use-when="${groovy: inventoryTransfer==null}"><text default-value="${inventoryTransfer.containerIdTo}"/></field> + <field name="containerIdTo" title="${uiLabelMap.FormFieldTitle_containerId}" use-when="${groovy: inventoryTransfer!=null}"><display/></field> + <field name="locationSeqIdTo" title="${uiLabelMap.ProductToLocation}"><lookup target-form-name="LookupFacilityLocation" default-value="${inventoryTransfer.locationSeqIdTo}"/></field> + <field name="comments" title="${uiLabelMap.ProductComments}"><textarea default-value="${inventoryTransfer.comments}"/></field> + <field name="xferQty" use-when="${groovy: inventoryItem != null && inventoryTransfer == null}" title="${uiLabelMap.ProductQuantityToTransfer}"><text size="6"/></field> + <field name="quantity" use-when="${groovy: product != null && inventoryTransfer == null}" title="${uiLabelMap.ProductQuantityToTransfer}"><text size="6"/></field> + <field name="facilityId"><hidden/></field> + <field name="inventoryTransferId"><hidden/></field> + <field name="submitButton" title="${uiLabelMap.CommonSubmit}"> + <submit/> + </field> + </form> </forms> Modified: ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml?rev=1735775&r1=1735774&r2=1735775&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml (original) +++ ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml Sat Mar 19 14:24:49 2016 @@ -1071,13 +1071,47 @@ under the License. <entity-one entity-name="Facility" value-field="facility"/> <property-map resource="ProductUiLabels" map-name="uiLabelMap"/> <set field="title" value="${uiLabelMap.PageTitleTransferInventoryItem}"/> + + <entity-one value-field="inventoryItem" entity-name="InventoryItem"/> + <entity-one value-field="inventoryItemType" entity-name="InventoryItemType"> + <field-map field-name="inventoryItemTypeId" value="${inventoryItem.inventoryItemTypeId}"/> + </entity-one> + <entity-one value-field="statusItem" entity-name="StatusItem"> + <field-map field-name="statusId" value="${inventoryItem.statusId}"/> + </entity-one> + <entity-one value-field="inventoryTransfer" entity-name="InventoryTransfer"/> + <entity-one value-field="product" entity-name="Product"/> </actions> <widgets> <decorator-screen name="CommonFacilityDecorator" location="${parameters.commonFacilityDecoratorLocation}"> <decorator-section name="body"> - <platform-specific> - <html><html-template location="component://product/webapp/facility/inventory/TransferInventoryItem.ftl"/></html> - </platform-specific> + <label text="${title}" style="h1"/> + <container style="button-bar"> + <link target="EditFacility" text="${uiLabelMap.ProductNewFacility}" style="buttontext"/> + <link target="PickMoveStockSimple" text="${uiLabelMap.CommonPrint}" style="buttontext "> + <parameter param-name="facilityId" from-field="facilityId"/> + </link> + </container> + <screenlet title="${uiLabelMap.ProductInventoryTransfersFor} ${uiLabelMap.FormFieldTitle_inventoryItemId}"> + <include-form name="CreateInventoryTransferForItem" location="component://product/widget/facility/FacilityForms.xml"/> + </screenlet> + <screenlet title="${uiLabelMap.ProductInventoryTransfersFor} ${uiLabelMap.FormFieldTitle_productId}"> + <include-form name="CreateInventoryTransferForProduct" location="component://product/widget/facility/FacilityForms.xml"/> + </screenlet> + <section> + <condition> + <or> + <not><if-empty field="inventoryTransfer"/></not> + <not><if-empty field="product"/></not> + <not><if-empty field="inventoryItem"/></not> + </or> + </condition> + <widgets> + <screenlet title="${uiLabelMap.ProductInventoryTransfer}"> + <include-form name="CreateInventoryTransfer" location="component://product/widget/facility/FacilityForms.xml"/> + </screenlet> + </widgets> + </section> </decorator-section> </decorator-screen> </widgets> @@ -1569,4 +1603,4 @@ under the License. </widgets> </section> </screen> -</screens> +</screens> \ No newline at end of file |
Free forum by Nabble | Edit this page |