Author: jacopoc
Date: Sat Sep 23 23:48:27 2006 New Revision: 449366 URL: http://svn.apache.org/viewvc?view=rev&rev=449366 Log: Implemented a new service that, when atp goes under minimum stock, creates a requirement for the reorder qty. So now we have three different requirement services that look at inventory levels: STOCK_QOH: when qoh goes under minimum stock a requirement is created for the reorder qty STOCK_ATP (new): when atp goes under minimum stock a requirement is created for the reorder qty ATP (was STOCK_ATP): creates a requirement on ATP levels and links it to the order item that caused the reservations Modified: incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml incubator/ofbiz/trunk/applications/order/servicedef/secas.xml incubator/ofbiz/trunk/applications/order/servicedef/services_requirement.xml incubator/ofbiz/trunk/applications/product/data/ProductTypeData.xml Modified: incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml?view=diff&rev=449366&r1=449365&r2=449366 ============================================================================== --- incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml (original) +++ incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml Sat Sep 23 23:48:27 2006 @@ -191,7 +191,7 @@ </if-compare> </simple-method> - <simple-method method-name="checkCreateStockRequirement" short-description="Create a Requirement if QOH goes under the minimum stock level"> + <simple-method method-name="checkCreateStockRequirementQoh" short-description="Create a Requirement if QOH goes under the minimum stock level"> <check-permission permission="ORDERMGR" action="_CREATE"> <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCheckCreateStockRequirement"/> </check-permission> @@ -243,6 +243,52 @@ </if-compare> </simple-method> + <simple-method method-name="checkCreateStockRequirementAtp" short-description="Create a Requirement if ATP goes under the minimum stock level"> + <check-permission permission="ORDERMGR" action="_CREATE"> + <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCheckCreateStockRequirement"/> + </check-permission> + <check-errors/> + + <!-- assumes that inventoryItemId is one of the parameters and get the inventory item of the reservation --> + <entity-one entity-name="InventoryItem" value-name="inventoryItem" auto-field-map="true"/> + + <!-- find the requirement method for this product --> + <set from-field="inventoryItem.productId" field="parameters.productId"/> + <call-simple-method method-name="getProductRequirementMethod"/> + + <if-compare field-name="requirementMethodId" operator="equals" value="PRODRQM_STOCK_ATP"> + <!-- get QOH, ATP quantities and find ProductFacility which has the minimum stock --> + <call-simple-method method-name="getProductFacilityAndQuantities"/> + + <if-not-empty field-name="productFacility.minimumStock"> + <!-- No requirements are created if we are not under stock --> + <!-- this service is supposed to be called after inventory is reserved, so inventory should have been updated already --> + <if-compare-field field-name="availableToPromiseTotal" to-field-name="productFacility.minimumStock" operator="less" type="Double"> + <calculate field-name="oldAvailableToPromise"> + <calcop field-name="availableToPromiseTotal" operator="add"> + <calcop operator="get" field-name="parameters.quantity"/> + </calcop> + </calculate> + <!-- If before this reservation the availableToPromiseTotal was over minimumStock, create a new requirement --> + <if-compare-field field-name="oldAvailableToPromise" to-field-name="productFacility.minimumStock" operator="greater-equals" type="Double"> + <field-to-field field-name="inventoryItem.productId" to-map-name="inputMap" to-field-name="productId"/> + <if-not-empty field-name="productFacility.reorderQuantity"> + <field-to-field field-name="productFacility.reorderQuantity" to-map-name="inputMap" to-field-name="quantity"/> + <else> + <field-to-field field-name="parameters.quantity" to-map-name="inputMap" to-field-name="quantity"/> + </else> + </if-not-empty> + <string-to-field string="PRODUCT_REQUIREMENT" map-name="inputMap" field-name="requirementTypeId"/> + <call-service service-name="createRequirement" in-map-name="inputMap"> + <result-to-field field-name="parameters.requirementId" result-name="requirementId"/> + </call-service> + <field-to-result field-name="parameters.requirementId" result-name="requirementId"/> + </if-compare-field> + </if-compare-field> + </if-not-empty> + </if-compare> + </simple-method> + <simple-method method-name="createRequirementFromItemATP" short-description="Create a Requirement for an item based on ATP inventory quantity and minimum"> <check-permission permission="ORDERMGR" action="_CREATE"> <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateRequirementFromItemATP"/> @@ -256,7 +302,7 @@ <set from-field="inventoryItem.productId" field="parameters.productId"/> <call-simple-method method-name="getProductRequirementMethod"/> - <if-compare field-name="requirementMethodId" operator="equals" value="PRODRQM_STOCK_ATP"> + <if-compare field-name="requirementMethodId" operator="equals" value="PRODRQM_ATP"> <!-- get the ATP, QOH quantities and the product facility's minimum stock --> <call-simple-method method-name="getProductFacilityAndQuantities"/> Modified: incubator/ofbiz/trunk/applications/order/servicedef/secas.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/servicedef/secas.xml?view=diff&rev=449366&r1=449365&r2=449366 ============================================================================== --- incubator/ofbiz/trunk/applications/order/servicedef/secas.xml (original) +++ incubator/ofbiz/trunk/applications/order/servicedef/secas.xml Sat Sep 23 23:48:27 2006 @@ -239,15 +239,16 @@ <!-- Requirement / stock level --> <eca service="createItemIssuance" event="invoke"> <condition field-name="quantity" value="0" operator="greater" type="Double"/> - <action service="checkCreateStockRequirement" mode="sync" runAsUser="system"/> + <action service="checkCreateStockRequirementQoh" mode="sync" runAsUser="system"/> </eca> <eca service="updateItemIssuance" event="invoke"> <condition field-name="quantity" value="0" operator="greater" type="Double"/> - <action service="checkCreateStockRequirement" mode="sync" runAsUser="system"/> + <action service="checkCreateStockRequirementQoh" mode="sync" runAsUser="system"/> </eca> <eca service="reserveOrderItemInventory" event="commit"> <condition field-name="quantity" value="0" operator="greater" type="Double"/> <action service="createRequirementFromItemATP" mode="sync" runAsUser="system"/> + <action service="checkCreateStockRequirementAtp" mode="sync" runAsUser="system"/> </eca> <!-- WorkEffort --> <eca service="createQuoteWorkEffort" event="invoke"> Modified: incubator/ofbiz/trunk/applications/order/servicedef/services_requirement.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/servicedef/services_requirement.xml?view=diff&rev=449366&r1=449365&r2=449366 ============================================================================== --- incubator/ofbiz/trunk/applications/order/servicedef/services_requirement.xml (original) +++ incubator/ofbiz/trunk/applications/order/servicedef/services_requirement.xml Sat Sep 23 23:48:27 2006 @@ -113,13 +113,24 @@ <attribute name="quantity" type="Double" mode="IN" optional="true"/> <attribute name="requirementId" type="String" mode="OUT" optional="true"/> </service> - <service name="checkCreateStockRequirement" engine="simple" auth="true" default-entity-name="ItemIssuance" - location="org/ofbiz/order/order/OrderServices.xml" invoke="checkCreateStockRequirement"> - <description>Create a STOCK Requirement</description> + <service name="checkCreateStockRequirementQoh" engine="simple" auth="true" default-entity-name="ItemIssuance" + location="org/ofbiz/order/order/OrderServices.xml" invoke="checkCreateStockRequirementQoh"> + <description>Create a Product Requirement based on QOH inventory</description> <auto-attributes include="pk" mode="IN" optional="true"/> <auto-attributes include="nonpk" mode="IN" optional="true"> <exclude field-name="issuedDateTime"/> </auto-attributes> + <attribute name="requirementId" type="String" mode="OUT" optional="true"/> + </service> + <service name="checkCreateStockRequirementAtp" engine="simple" auth="true" + location="org/ofbiz/order/order/OrderServices.xml" invoke="checkCreateStockRequirementAtp"> + <description>Create a Product Requirement based on ATP inventory</description> + <attribute name="orderId" type="String" mode="IN" optional="false"/> + <attribute name="shipGroupSeqId" type="String" mode="IN" optional="false"/> + <attribute name="orderItemSeqId" type="String" mode="IN" optional="false"/> + <attribute name="inventoryItemId" type="String" mode="IN" optional="true"/> + <attribute name="productId" type="String" mode="IN" optional="true"/> + <attribute name="quantity" type="Double" mode="IN" optional="true"/> <attribute name="requirementId" type="String" mode="OUT" optional="true"/> </service> <service name="createRequirementFromItemATP" engine="simple" auth="true" Modified: incubator/ofbiz/trunk/applications/product/data/ProductTypeData.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/data/ProductTypeData.xml?view=diff&rev=449366&r1=449365&r2=449366 ============================================================================== --- incubator/ofbiz/trunk/applications/product/data/ProductTypeData.xml (original) +++ incubator/ofbiz/trunk/applications/product/data/ProductTypeData.xml Sat Sep 23 23:48:27 2006 @@ -386,17 +386,19 @@ <EnumerationType description="Product Requirement Method" enumTypeId="PROD_REQ_METHOD" hasTable="N" parentTypeId=""/> <!-- NONE: no requirement is created (default) --> <Enumeration description="No Requirement Created" enumCode="NONE" enumId="PRODRQM_NONE" sequenceId="01" enumTypeId="PROD_REQ_METHOD"/> - <!-- AUTO: a requirement is created every time a sales order is entered --> + <!-- AUTO: a requirement is created every time a sales order is entered; the requirement is then associated to the order item --> <!-- This is useful to implement cross-dock shipping processes --> <Enumeration description="Automatic For Every Sales Order" enumCode="AUTO" enumId="PRODRQM_AUTO" sequenceId="02" enumTypeId="PROD_REQ_METHOD"/> <!-- STOCK: a requirement is created when qoh reaches the minimum stock quantity (from ProductFacility) --> <Enumeration description="When QOH Reaches Minimum Stock for Product-Facility" enumCode="STOCK_QOH" enumId="PRODRQM_STOCK" sequenceId="03" enumTypeId="PROD_REQ_METHOD"/> - <!-- ATP: a requirement is created when atp reaches the minimum stock quantity (from ProductFacility) --> + <!-- STOCK_ATP: a requirement is created when atp reaches the minimum stock quantity (from ProductFacility) --> <Enumeration description="When ATP Reaches Minimum Stock for Product-Facility" enumCode="STOCK_ATP" enumId="PRODRQM_STOCK_ATP" sequenceId="04" enumTypeId="PROD_REQ_METHOD"/> + <!-- ATP: a requirement is created when atp reaches the minimum stock quantity (from ProductFacility); the requirement is then associated to the order item --> + <Enumeration description="Requirement for order when ATP Reaches Minimum Stock for Product-Facility" enumCode="ATP" enumId="PRODRQM_ATP" sequenceId="05" enumTypeId="PROD_REQ_METHOD"/> <!-- PRODRQM_DS: a drop ship group is created to trigger automatic creation of a purchase order (drop shipment) every time a sales order is created--> - <Enumeration description="Drop-ship only" enumCode="DROPS" enumId="PRODRQM_DS" sequenceId="05" enumTypeId="PROD_REQ_METHOD"/> + <Enumeration description="Drop-ship only" enumCode="DROPS" enumId="PRODRQM_DS" sequenceId="06" enumTypeId="PROD_REQ_METHOD"/> <!-- PRODRQM_DSQOH: auto drop ship on low quantity on hand --> - <Enumeration description="Auto drop-ship on low quantity" enumCode="DROPS_QOH" enumId="PRODRQM_DSQOH" sequenceId="06" enumTypeId="PROD_REQ_METHOD"/> + <Enumeration description="Auto drop-ship on low quantity" enumCode="DROPS_QOH" enumId="PRODRQM_DSQOH" sequenceId="07" enumTypeId="PROD_REQ_METHOD"/> <!-- inventory item status --> <StatusType description="Inventory Item" hasTable="N" parentTypeId="" statusTypeId="INVENTORY_ITEM_STTS"/> |
Free forum by Nabble | Edit this page |