You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by su...@apache.org on 2019/04/27 13:05:31 UTC
svn commit: r1858270 [3/3] - in /ofbiz/ofbiz-framework/trunk/applications:
datamodel/data/demo/ datamodel/data/seed/ datamodel/entitydef/
order/config/ order/data/ order/entitydef/
order/groovyScripts/allocationplan/ order/servicedef/ order/src/main/ja...
Added: ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/AllocationPlanScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/AllocationPlanScreens.xml?rev=1858270&view=auto
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/AllocationPlanScreens.xml (added)
+++ ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/AllocationPlanScreens.xml Sat Apr 27 13:05:30 2019
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://ofbiz.apache.org/Widget-Screen" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Screen http://ofbiz.apache.org/dtds/widget-screen.xsd">
+ <screen name="CommonAllocationPlanDecorator">
+ <section>
+ <widgets>
+ <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+ <decorator-section name="body">
+ <section>
+ <!-- do check for ALLOCPLAN, _VIEW permission -->
+ <condition>
+ <if-has-permission permission="ALLOCPLAN" action="_VIEW"/>
+ </condition>
+ <widgets>
+ <decorator-section-include name="body"/>
+ </widgets>
+ <fail-widgets>
+ <label style="h3">${uiLabelMap.OrderAllocationPlanViewPermissionError}</label>
+ </fail-widgets>
+ </section>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+ <screen name="CreateAllocationPlan">
+ <section>
+ <actions>
+ <set field="titleProperty" value="PageTitleCreateAllocationPlan"/>
+ <set field="headerItem" value="allocationPlan"/>
+ <set field="tabButtonItem" value="CreateAllocationPlan"/>
+ <!-- <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
+ <set field="viewSizeDefaultValue" value="${groovy: modelTheme.getDefaultViewSize()}" type="Integer"/>
+ <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>-->
+ <script location="component://order/groovyScripts/allocationplan/CreateAllocationPlan.groovy"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="CommonAllocationPlanDecorator" location="${parameters.commonAllocationPlanDecoratorLocation}">
+ <decorator-section name="body">
+ <platform-specific>
+ <html><html-template location="component://common-theme/template/includes/SetMultipleSelectJs.ftl"/></html>
+ </platform-specific>
+ <platform-specific>
+ <html><html-template location="component://order/template/order/CreateAllocationPlan.ftl"/></html>
+ </platform-specific>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+ <screen name="FindAllocationPlan">
+ <section>
+ <actions>
+ <set field="titleProperty" value="PageTitleFindAllocationPlan"/>
+ <set field="headerItem" value="allocationPlan"/>
+ <set field="tabButtonItem" value="FindAllocatoinPlan"/>
+ <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
+ <set field="viewSizeDefaultValue" value="${groovy: modelTheme.getDefaultViewSize()}" type="Integer"/>
+ <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>
+ <script location="component://order/groovyScripts/allocationplan/ListAllocationPlan.groovy"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="CommonAllocationPlanDecorator" location="${parameters.commonAllocationPlanDecoratorLocation}">
+ <decorator-section name="body">
+ <section>
+ <condition>
+ <if-has-permission permission="ALLOCPLAN" action="_CREATE"/>
+ </condition>
+ <widgets>
+ <container style="button-bar">
+ <link target="CreateAllocationPlan" text="${uiLabelMap.OrderNewAllocationPlan}" style="buttontext"/>
+ </container>
+ </widgets>
+ </section>
+ <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
+ <decorator-section name="search-options">
+ <include-form name="FindAllocationPlan" location="component://order/widget/ordermgr/AllocationPlanForms.xml"/>
+ </decorator-section>
+ <decorator-section name="search-results">
+ <include-grid name="ListAllocationPlan" location="component://order/widget/ordermgr/AllocationPlanForms.xml"/>
+ </decorator-section>
+ </decorator-screen>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+ <screen name="ViewAllocationPlan">
+ <section>
+ <actions>
+ <set field="titleProperty" value="PageTitleViewAllocationPlan"/>
+ <set field="headerItem" value="allocationPlan"/>
+ <set field="tabButtonItem" value="ViewAllocationPlan"/>
+ <set field="planId" from-field="parameters.planId"/>
+ <script location="component://order/groovyScripts/allocationplan/ViewAllocationPlan.groovy"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="CommonAllocationPlanDecorator" location="${parameters.commonAllocationPlanDecorator}">
+ <decorator-section name="body">
+ <section>
+ <condition>
+ <if-has-permission permission="ALLOCPLAN" action="_CREATE"/>
+ </condition>
+ <widgets>
+ <container style="button-bar">
+ <link target="CreateAllocationPlan" text="${uiLabelMap.OrderNewAllocationPlan}" style="buttontext"/>
+ </container>
+ </widgets>
+ </section>
+ <platform-specific>
+ <html><html-template location="component://order/template/order/ViewAllocationPlan.ftl"/></html>
+ </platform-specific>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+ <screen name="EditAllocationPlan">
+ <section>
+ <actions>
+ <set field="titleProperty" value="PageTitleViewAllocationPlan"/>
+ <set field="headerItem" value="allocationPlan"/>
+ <set field="tabButtonItem" value="EditAllocationPlan"/>
+ <set field="planId" from-field="parameters.planId"/>
+ <set field="editMode" value="true" type="Boolean"/>
+ <!-- asmselect parameters, must be prefixed by asm_ for SetMultipleSelectJs.ftl -->
+ <set field="asm_multipleSelectForm" value="updateAllocationPlanItems"/>
+ <set field="asm_formSize" value="1000"/>
+ <set field="asm_asmListItemPercentOfForm" value="95"/>
+ <set field="asm_sortable" value="false"/>
+ <script location="component://order/groovyScripts/allocationplan/ViewAllocationPlan.groovy"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="CommonAllocationPlanDecorator" location="${parameters.commonAllocationPlanDecorator}">
+ <decorator-section name="body">
+ <section>
+ <widgets>
+ <container style="button-bar">
+ <link target="CreateAllocationPlan" text="${uiLabelMap.OrderNewAllocationPlan}" style="buttontext"/>
+ </container>
+ </widgets>
+ </section>
+ <platform-specific>
+ <html><html-template location="component://common-theme/template/includes/SetMultipleSelectJs.ftl"/></html>
+ </platform-specific>
+ <platform-specific>
+ <html><html-template location="component://order/template/order/ViewAllocationPlan.ftl"/></html>
+ </platform-specific>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+</screens>
\ No newline at end of file
Propchange: ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/AllocationPlanScreens.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/AllocationPlanScreens.xml
------------------------------------------------------------------------------
svn:keywords = Date Rev Author URL Id
Propchange: ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/AllocationPlanScreens.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderMenus.xml?rev=1858270&r1=1858269&r2=1858270&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderMenus.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderMenus.xml Sat Apr 27 13:05:30 2019
@@ -87,6 +87,10 @@ under the License.
<menu-item name="stats" title="${uiLabelMap.CommonStats}">
<link target="orderstats"/>
</menu-item>
+
+ <menu-item name="allocationPlan" title="${uiLabelMap.OrderAllocationPlan}">
+ <link target="FindAllocationPlan"/>
+ </menu-item>
</menu>
<menu name="RequirementsTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
Modified: ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/inventory/InventoryServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/inventory/InventoryServices.xml?rev=1858270&r1=1858269&r2=1858270&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/inventory/InventoryServices.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/inventory/InventoryServices.xml Sat Apr 27 13:05:30 2019
@@ -747,7 +747,21 @@ under the License.
<set field="reassignInventoryReservationsCtx.productId" from-field="inventoryItem.productId"/>
<set field="reassignInventoryReservationsCtx.facilityId" from-field="inventoryItem.facilityId"/>
<set field="reassignInventoryReservationsCtx.fromDate" from-field="nowTimestamp"/>
- <call-service service-name="reassignInventoryReservations" in-map-name="reassignInventoryReservationsCtx"/>
+ <entity-condition entity-name="AllocationPlanAndItem" list="allocationPlanAndItemList">
+ <condition-list combine="and">
+ <condition-expr field-name="productId" operator="equals" from-field="inventoryItem.productId"/>
+ <condition-expr field-name="planItemStatusId" operator="equals" value="ALLOC_PLAN_ITEM_APRV"/>
+ <condition-expr field-name="planMethodEnumId" operator="equals" value="MANUAL"/>
+ </condition-list>
+ <order-by field-name="prioritySeqId"/>
+ </entity-condition>
+ <if-empty field="allocationPlanAndItemList">
+ <call-service service-name="reassignInventoryReservations" in-map-name="reassignInventoryReservationsCtx"/>
+ <else>
+ <set field="reassignInventoryReservationsCtx.allocationPlanAndItemList" from-field="allocationPlanAndItemList"/>
+ <call-service service-name="reassignInventoryReservationsByAllocationPlan" in-map-name="reassignInventoryReservationsCtx"/>
+ </else>
+ </if-empty>
</simple-method>
<simple-method method-name="reassignInventoryReservations" short-description="Balances available-to-promise on inventory items">
@@ -852,6 +866,98 @@ under the License.
<!-- now go through touchedOrderIdMap keys and make a Set/Map of orderIds that are no longer on back-order -->
<iterate-map key="touchedOrderId" value="throwAwayValue" map="touchedOrderIdMap">
<set field="checkOrderIsOnBackOrderMap.orderId" from-field="touchedOrderId"/>
+ <call-service service-name="checkOrderIsOnBackOrder" in-map-name="checkOrderIsOnBackOrderMap">
+ <result-to-field result-name="isBackOrder"/>
+ </call-service>
+
+ <if-compare field="isBackOrder" operator="equals" value="false" type="Boolean">
+ <set field="noLongerOnBackOrderIdMap[touchedOrderId]" value="Y"/>
+ </if-compare>
+ </iterate-map>
+ <if-not-empty field="noLongerOnBackOrderIdMap">
+ <call-object-method obj-field="noLongerOnBackOrderIdMap" method-name="keySet" ret-field="noLongerOnBackOrderIdSet"/>
+ <field-to-result field="noLongerOnBackOrderIdSet"/>
+ </if-not-empty>
+ </simple-method>
+
+ <simple-method method-name="reassignInventoryReservationsByAllocationPlan" short-description="Balances available-to-promise on inventory items">
+ <now-timestamp field="nowTimestamp"/>
+ <iterate list="parameters.allocationPlanAndItemList" entry="allocationPlanAndItem">
+ <entity-one entity-name="OrderHeader" value-field="orderHeader">
+ <field-map field-name="orderId" from-field="allocationPlanAndItem.orderId"/>
+ </entity-one>
+ <get-related-one value-field="orderHeader" relation-name="ProductStore" to-value-field="productStore"/>
+ <if-compare field="productStore.allocateInventory" operator="not-equals" value="Y">
+ <continue></continue>
+ </if-compare>
+ <entity-one entity-name="OrderItem" value-field="orderItem">
+ <field-map field-name="orderId" from-field="allocationPlanAndItem.orderId"/>
+ <field-map field-name="orderItemSeqId" from-field="allocationPlanAndItem.orderItemSeqId"/>
+ </entity-one>
+ <if-not-empty field="orderItem.reserveAfterDate">
+ <if-compare-field field="orderItem.reserveAfterDate" operator="greater" to-field="nowTimestamp" type="Timestamp">
+ <continue></continue>
+ </if-compare-field>
+ </if-not-empty>
+
+ <!-- maintain a Set (in a Map) of orderIds that we have inventory allocated-->
+ <if-not-empty field="allocationPlanAndItem.allocatedQuantity">
+ <if-compare field="allocationPlanAndItem.allocatedQuantity" operator="greater" value="0" type="BigDecimal">
+ <set field="touchedOrderIdMap[allocationPlanAndItem.orderId]" value="Y"/>
+ <log level="verbose" message="Adding ${allocationPlanAndItem.orderId} to touchedOrderIdMap"/>
+ </if-compare>
+ </if-not-empty>
+
+ <entity-and entity-name="OrderItemShipGroup" list="orderItemShipGroups">
+ <field-map field-name="orderId" from-field="allocationPlanAndItem.orderId"/>
+ </entity-and>
+ <first-from-list list="orderItemShipGroups" entry="orderItemShipGroup"/>
+
+ <!-- Check for existing reservations of the order item -->
+ <entity-condition entity-name="OrderItemShipGrpInvRes" list="orderItemShipGrpInvResList">
+ <condition-list combine="and">
+ <condition-expr field-name="orderId" operator="equals" from-field="allocationPlanAndItem.orderId"/>
+ <condition-expr field-name="orderItemSeqId" operator="equals" from-field="allocationPlanAndItem.orderItemSeqId"/>
+ <condition-expr field-name="shipGroupSeqId" operator="equals" from-field="orderItemShipGroup.shipGroupSeqId"/>
+ </condition-list>
+ </entity-condition>
+
+ <!-- Calculated already reserved quantity for the order item -->
+ <set field="totalReservedQuantity" value="0.0"/>
+ <iterate list="orderItemShipGrpInvResList" entry="orderItemShipGrpInvRes">
+ <calculate field="reservedQuantity" decimal-scale="6">
+ <calcop operator="add" field="orderItemShipGrpInvRes.quantity"/>
+ <calcop operator="subtract" field="orderItemShipGrpInvRes.quantityNotAvailable"/>
+ </calculate>
+ <calculate field="totalReservedQuantity" decimal-scale="6">
+ <calcop operator="add" field="reservedQuantity"/>
+ <calcop operator="add" field="totalReservedQuantity"/>
+ </calculate>
+ </iterate>
+ <calculate field="toBeRservedQuantity">
+ <calcop operator="subtract">
+ <calcop operator="get" field="allocationPlanAndItem.allocatedQuantity"/>
+ <calcop operator="get" field="totalReservedQuantity"/>
+ </calcop>
+ </calculate>
+
+ <!-- require inventory is N because it had to be N to begin with to have a negative ATP -->
+ <clear-field field="resMap"/>
+ <set field="resMap.productId" from-field="parameters.productId"/>
+ <set field="resMap.orderId" from-field="allocationPlanAndItem.orderId"/>
+ <set field="resMap.orderItemSeqId" from-field="allocationPlanAndItem.orderItemSeqId"/>
+ <set field="resMap.quantity" from-field="toBeRservedQuantity"/>
+ <set field="resMap.reservedDatetime" value="${nowTimestamp}"/>
+ <set field="resMap.requireInventory" value="Y"/>
+ <set field="resMap.shipGroupSeqId" from-field="orderItemShipGroup.shipGroupSeqId"/>
+ <set field="resMap.facilityId" from-field="parameters.facilityId"/>
+ <set field="resMap.priority" from-field="allocationPlanAndItem.prioritySeqId" type="String"/>
+ <log level="info" message="Reserving product [${resMap.productId}] for order item [${resMap.orderId}:${resMap.orderItemSeqId}] quantity [${toBeRservedQuantity}]; facility [${parameters.facilityId}]"/>
+ <call-service service-name="reserveProductInventoryByFacility" in-map-name="resMap"/>
+ </iterate>
+ <!-- now go through touchedOrderIdMap keys and make a Set/Map of orderIds that are no longer on back-order -->
+ <iterate-map key="touchedOrderId" value="throwAwayValue" map="touchedOrderIdMap">
+ <set field="checkOrderIsOnBackOrderMap.orderId" from-field="touchedOrderId"/>
<call-service service-name="checkOrderIsOnBackOrder" in-map-name="checkOrderIsOnBackOrderMap">
<result-to-field result-name="isBackOrder"/>
</call-service>
Modified: ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_facility.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_facility.xml?rev=1858270&r1=1858269&r2=1858270&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_facility.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_facility.xml Sat Apr 27 13:05:30 2019
@@ -430,6 +430,24 @@ under the License.
<attribute name="noLongerOnBackOrderIdSet" type="Set" mode="OUT" optional="true"/>
<attribute name="priority" type="String" mode="IN" optional="true"/>
</service>
+ <service name="reassignInventoryReservationsByAllocationPlan" engine="simple" transaction-timeout="600"
+ location="component://product/minilang/product/inventory/InventoryServices.xml" invoke="reassignInventoryReservationsByAllocationPlan" auth="true">
+ <description>Balance inventory reservations for a given product/facility, considering all the reservations with promised date greater than fromDate.</description>
+ <attribute name="productId" type="String" mode="IN" optional="false">
+ <type-validate>
+ <fail-property resource="ProductErrorUiLabels" property="facility.productId"/>
+ </type-validate>
+ </attribute>
+ <attribute name="facilityId" type="String" mode="IN" optional="false">
+ <type-validate>
+ <fail-property resource="ProductErrorUiLabels" property="facility.facilityId"/>
+ </type-validate>
+ </attribute>
+ <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
+ <attribute name="noLongerOnBackOrderIdSet" type="Set" mode="OUT" optional="true"/>
+ <attribute name="priority" type="String" mode="IN" optional="true"/>
+ <attribute name="allocationPlanAndItemList" mode="IN" type="List"/>
+ </service>
<service name="balanceOrderItemsWithNegativeReservations" engine="simple"
location="component://product/minilang/product/inventory/InventoryServices.xml" invoke="balanceOrderItemsWithNegativeReservations">
<description>For each product with a negative reservation in the order, calls reassignInventoryReservations</description>