Author: mor
Date: Thu Mar 19 13:58:08 2009 New Revision: 756001 URL: http://svn.apache.org/viewvc?rev=756001&view=rev Log: Another new feature from Pranay and Co. Now Order reservation can be changed manually by setting priority (new field priority on OrderHeader and OrderItemShipGrpInvRes) for the order. This way few orders can be fulfilled while waiting for sufficient inventory to fulfill large orders. Applied patch from OFBIZ-2224 (https://issues.apache.org/jira/browse/OFBIZ-2224). Thanks Pratik Khera and Pranay Pandey. i18n Note: This commit has three new labels (IMO, they can be moved to common component with names something like CommonHigh, CommonLow etc.) Pratik, I have done minor changes in the service and they are 1) Used <if-empty field=""> instead of <if> <condition> <if-empty> as this makes the logic more clearer. 2) Removed <condition-list> because their is only one expression in the <entity-condition> 3) Added <clear-field> in the iteration, to make sure that always a new value will be set in the map that is passed to a service and <store-value> Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml ofbiz/trunk/applications/order/entitydef/entitymodel.xml ofbiz/trunk/applications/order/servicedef/secas.xml ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml ofbiz/trunk/applications/order/webapp/ordermgr/order/orderinfo.ftl ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml ofbiz/trunk/applications/product/servicedef/services_facility.xml ofbiz/trunk/specialpurpose/ecommerce/data/DemoOrderTestData.xml Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=756001&r1=756000&r2=756001&view=diff ============================================================================== --- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original) +++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Thu Mar 19 13:58:08 2009 @@ -6271,6 +6271,15 @@ <value xml:lang="zh">å ¬å¼ä¾¿ç¬º (å·²æå°)</value> <value xml:lang="zh_CN">å ¬å¼æ³¨é (å¯æå°)</value> </property> + <property key="OrderPriorityHigh"> + <value xml:lang="en">High</value> + </property> + <property key="OrderPriorityLow"> + <value xml:lang="en">Low</value> + </property> + <property key="OrderPriorityNormal"> + <value xml:lang="en">Normal</value> + </property> <property key="OrderProcessOrder"> <value xml:lang="de">Auftrag verarbeiten</value> <value xml:lang="en">Process Order</value> Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?rev=756001&r1=756000&r2=756001&view=diff ============================================================================== --- ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/order/entitydef/entitymodel.xml Thu Mar 19 13:58:08 2009 @@ -337,6 +337,7 @@ <field name="externalId" type="id"></field> <field name="salesChannelEnumId" type="id"></field> <field name="orderDate" type="date-time"></field> + <field name="priority" type="indicator"><description>Sets priority for Inventory Reservation</description></field> <field name="entryDate" type="date-time"></field> <field name="visitId" type="id"></field> <field name="statusId" type="id"></field> @@ -888,6 +889,7 @@ <field name="createdDatetime" type="date-time"></field> <field name="promisedDatetime" type="date-time"></field> <field name="currentPromisedDate" type="date-time"></field> + <field name="priority" type="indicator"><description>Sets priority for Inventory Reservation</description></field> <field name="sequenceId" type="numeric"></field> <field name="oldPickStartDate" col-name="PICK_START_DATE" type="date-time"></field> <!-- this is no longer used and is here for migration or whatever if needed --> <prim-key field="orderId"/> Modified: ofbiz/trunk/applications/order/servicedef/secas.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?rev=756001&r1=756000&r2=756001&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/secas.xml (original) +++ ofbiz/trunk/applications/order/servicedef/secas.xml Thu Mar 19 13:58:08 2009 @@ -36,6 +36,9 @@ <condition field-name="orderTypeId" operator="equals" value="PURCHASE_ORDER"/> <action service="setUnitPriceAsLastPrice" mode="sync"/> </eca> + <eca service="storeOrder" event="return"> + <action service="setOrderReservationPriority" mode="sync"/> + </eca> <eca service="updateOrderItems" event="commit"> <condition field-name="orderTypeId" operator="equals" value="PURCHASE_ORDER"/> <action service="setUnitPriceAsLastPrice" mode="sync"/> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?rev=756001&r1=756000&r2=756001&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Thu Mar 19 13:58:08 2009 @@ -1457,7 +1457,12 @@ <response name="success" type="request-redirect" value="orderview"/> <response name="error" type="request-redirect" value="orderview"/> </request-map> - + <request-map uri="setOrderReservationPriority"> + <security https="true" auth="true"/> + <event type="service" invoke="setOrderReservationPriority"/> + <response name="success" type="view" value="orderview"/> + <response name="error" type="view" value="orderview"/> + </request-map> <!-- Lookup request mappings --> <request-map uri="LookupPerson"><security https="true" auth="true"/><response name="success" type="view" value="LookupPerson"/></request-map> <request-map uri="LookupPartyGroup"><security https="true" auth="true"/><response name="success" type="view" value="LookupPartyGroup"/></request-map> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderinfo.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderinfo.ftl?rev=756001&r1=756000&r2=756001&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderinfo.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderinfo.ftl Thu Mar 19 13:58:08 2009 @@ -179,6 +179,24 @@ </td> </tr> </#if> + <#if "SALES_ORDER" == orderHeader.orderTypeId> + <form action="setOrderReservationPriority" method="post" name="setOrderReservationPriority"> + <input type = "hidden" name="orderId" value="${orderId}"/> + <tr><td colspan="3"><hr/></td></tr> + <tr> + <td align="right" valign="top" width="15%" class="label"> ${uiLabelMap.FormFieldTitle_priority}</td> + <td width="5%"> </td> + <td valign="top" width="80%"> + <select name="priority"> + <option value="1">${uiLabelMap.OrderPriorityHigh}</option> + <option value="2"selected>${uiLabelMap.OrderPriorityNormal}</option> + <option value="3">${uiLabelMap.OrderPriorityLow}</option> + </select> + <input type="submit" class="smallSubmit" value="${uiLabelMap.FormFieldTitle_reserveInventory}"/> + </td> + </tr> + </form> + </#if> </table> </div> </div> \ No newline at end of file Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml?rev=756001&r1=756000&r2=756001&view=diff ============================================================================== --- ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml (original) +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml Thu Mar 19 13:58:08 2009 @@ -201,6 +201,7 @@ <set from-field="parameters.reservedDatetime" field="reserveOisgirMap.reservedDatetime"/> <set from-field="promisedDatetime" field="reserveOisgirMap.promisedDatetime"/> <set from-field="parameters.sequenceId" field="reserveOisgirMap.sequenceId"/> + <set from-field="parameters.priority" field="reserveOisgirMap.priority"/> <call-service service-name="reserveOrderItemInventory" in-map-name="reserveOisgirMap"/> <clear-field field="reserveOisgirMap"/> <else> @@ -444,6 +445,7 @@ <set from-field="parameters.reservedDatetime" field="reserveOisgirMap.reservedDatetime"/> <set from-field="parameters.deductAmount" field="reserveOisgirMap.quantity" type="BigDecimal"/> <set from-field="promisedDatetime" field="reserveOisgirMap.promisedDatetime"/> + <set from-field="parameters.priority" field="reserveOisgirMap.priority"/> <if-not-empty field="parameters.sequenceId"> <set field="reserveOisgirMap.sequenceId" from-field="parameters.sequenceId"/> </if-not-empty> @@ -498,6 +500,7 @@ <set-nonpk-fields map="parameters" value-field="newOisgirEntity"/> <now-timestamp field="nowTimestamp"/> <set from-field="nowTimestamp" field="newOisgirEntity.createdDatetime"/> + <set from-field="parameters.priority" field="newOisgirEntity.priority"/> <if-empty field="newOisgirEntity.reservedDatetime"> <set from-field="nowTimestamp" field="newOisgirEntity.reservedDatetime"/> </if-empty> 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=756001&r1=756000&r2=756001&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 Thu Mar 19 13:58:08 2009 @@ -814,6 +814,7 @@ </condition-list> </condition-list> </condition-list> + <order-by field-name="priority"/> <order-by field-name="currentPromisedDate"/> <order-by field-name="reservedDatetime"/> <order-by field-name="sequenceId"/> @@ -875,6 +876,9 @@ <log level="verbose" message="Adding ${oisgir.orderId} to touchedOrderIdMap"/> </if-compare> </if-not-empty> + <entity-one entity-name="OrderHeader" value-field="orderHeader"> + <field-map field-name="orderId" from-field="oisgir.orderId"/> + </entity-one> <!-- require inventory is N because it had to be N to begin with to have a negative ATP --> <clear-field field="resMap"/> @@ -888,6 +892,7 @@ <set field="resMap.shipGroupSeqId" from-field="oisgir.shipGroupSeqId"/> <set field="resMap.sequenceId" from-field="oisgir.sequenceId"/> <set field="resMap.facilityId" from-field="parameters.facilityId"/> + <set field="resMap.priority" from-field="orderHeader.priority"/> <log level="info" message="Re-reserving product [${resMap.productId}] for order item [${resMap.orderId}:${resMap.orderItemSeqId}] quantity [${resMap.quantity}]; facility [${parameters.facilityId}]"/> <call-service service-name="reserveProductInventoryByFacility" in-map-name="resMap"/> </iterate> @@ -1249,5 +1254,43 @@ </if-compare> </if-not-empty> </simple-method> - -</simple-methods> + <simple-method method-name="setOrderReservationPriority" short-description="Sets priority of an order for Inventory Reservation, orders with HIGH priority would be served first."> + <set field="orderId" from-field="parameters.orderId"/> + <entity-one entity-name="OrderHeader" value-field="orderHeader"> + <field-map field-name="orderId" from-field="orderId"/> + </entity-one> + <set field="priority" from-field="parameters.priority"/> + <if-empty field="priority"> + <entity-and list="oisgirs" entity-name="OrderItemShipGrpInvRes"> + <field-map field-name="orderId" from-field="orderId"/> + </entity-and> + <iterate entry="oisgir" list="oisgirs"> + <set field="oisgir.priority" default-value="2"/> + <store-value value-field="oisgir"/> + </iterate> + <set field="orderHeader.priority" default-value="2"/> + <store-value value-field="orderHeader"/> + <else> + <set field="orderHeader.priority" from-field="priority"/> + <store-value value-field="orderHeader"/> + <entity-and list="oisgirs" entity-name="OrderItemShipGrpInvRes"> + <field-map field-name="orderId" from-field="orderId"/> + </entity-and> + <iterate entry="oisgir" list="oisgirs"> + <set field="oisgir.priority" from-field="priority"/> + <store-value value-field="oisgir"/> + <clear-field field="oisgir"/> + </iterate> + <entity-condition entity-name="OrderItemAndShipGrpInvResAndItem" list="oisgirais"> + <condition-expr field-name="orderId" operator="equals" from-field="orderId"/> + </entity-condition> + <iterate entry="oisgir" list="oisgirais"> + <set field="reassignInventoryReservationsCtx.productId" from-field="oisgir.productId"/> + <set field="reassignInventoryReservationsCtx.facilityId" from-field="oisgir.facilityId"/> + <call-service service-name="reassignInventoryReservations" in-map-name="reassignInventoryReservationsCtx"/> + <clear-field field="reassignInventoryReservationsCtx"/> + </iterate> + </else> + </if-empty> + </simple-method> +</simple-methods> \ No newline at end of file Modified: ofbiz/trunk/applications/product/servicedef/services_facility.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_facility.xml?rev=756001&r1=756000&r2=756001&view=diff ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services_facility.xml (original) +++ ofbiz/trunk/applications/product/servicedef/services_facility.xml Thu Mar 19 13:58:08 2009 @@ -262,6 +262,7 @@ <attribute name="facilityId" type="String" mode="IN" optional="false"/> <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"/> </service> <service name="balanceOrderItemsWithNegativeReservations" engine="simple" location="component://product/script/org/ofbiz/product/inventory/InventoryServices.xml" invoke="balanceOrderItemsWithNegativeReservations"> @@ -319,6 +320,7 @@ <attribute name="reserveOrderEnumId" type="String" mode="IN" optional="true"/> <attribute name="sequenceId" type="Long" mode="IN" optional="true"/> <attribute name="quantityNotReserved" type="BigDecimal" mode="OUT" optional="false"/> + <attribute name="priority" type="String" mode="IN" optional="true"/> </service> <service name="reserveProductInventoryByContainer" engine="simple" location="component://product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml" invoke="reserveProductInventory" auth="true"> @@ -345,6 +347,7 @@ <auto-attributes mode="IN" entity-name="OrderItemShipGrpInvRes" include="nonpk" optional="true"> <exclude field-name="createdDatetime"/> </auto-attributes> + <attribute name="priority" type="String" mode="IN" optional="true"/> <override name="quantity" optional="false"/> </service> <service name="cancelOrderInventoryReservation" engine="simple" @@ -873,4 +876,10 @@ <permission-service service-name="facilityGenericPermission" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> </service> + <service name="setOrderReservationPriority" engine="simple" invoke="setOrderReservationPriority" + location="component://product/script/org/ofbiz/product/inventory/InventoryServices.xml" auth="true"> + <description>set order priority</description> + <attribute name="priority" mode="IN" type="String" optional="true"/> + <attribute name="orderId" mode="IN" type="String" optional="false"/> + </service> </services> Modified: ofbiz/trunk/specialpurpose/ecommerce/data/DemoOrderTestData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/data/DemoOrderTestData.xml?rev=756001&r1=756000&r2=756001&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/data/DemoOrderTestData.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/data/DemoOrderTestData.xml Thu Mar 19 13:58:08 2009 @@ -20,7 +20,7 @@ <entity-engine-xml> <!--Demo data for a sales order --> - <OrderHeader orderId="DEMO10090" orderTypeId="SALES_ORDER" orderName="" salesChannelEnumId="WEB_SALES_CHANNEL" orderDate="2008-04-23 16:49:27.392" entryDate="2008-04-23 16:49:27.392" visitId="10002" statusId="ORDER_APPROVED" createdBy="admin" currencyUom="USD" webSiteId="OrderEntry" productStoreId="9000" remainingSubTotal="12.45" grandTotal="12.45" lastUpdatedStamp="2008-04-23 16:49:33.196" lastUpdatedTxStamp="2008-04-23 16:49:33.118" createdStamp="2008-04-23 16:49:27.716" createdTxStamp="2008-04-23 16:49:27.349"/> + <OrderHeader orderId="DEMO10090" orderTypeId="SALES_ORDER" orderName="" salesChannelEnumId="WEB_SALES_CHANNEL" orderDate="2008-04-23 16:49:27.392" entryDate="2008-04-23 16:49:27.392" priority="2" visitId="10002" statusId="ORDER_APPROVED" createdBy="admin" currencyUom="USD" webSiteId="OrderEntry" productStoreId="9000" remainingSubTotal="12.45" grandTotal="12.45" lastUpdatedStamp="2008-04-23 16:49:33.196" lastUpdatedTxStamp="2008-04-23 16:49:33.118" createdStamp="2008-04-23 16:49:27.716" createdTxStamp="2008-04-23 16:49:27.349"/> <OrderItem orderId="DEMO10090" orderItemSeqId="00001" orderItemTypeId="PRODUCT_ORDER_ITEM" productId="GZ-2644" prodCatalogId="DemoCatalog" isPromo="N" quantity="1.0" selectedAmount="0.0" unitPrice="38.4" unitListPrice="48.0" isModifiedPrice="N" itemDescription="Round Gizmo" correspondingPoId="" statusId="ITEM_APPROVED" lastUpdatedStamp="2008-04-23 16:49:33.514" lastUpdatedTxStamp="2008-04-23 16:49:33.484" createdStamp="2008-04-23 16:49:28.128" createdTxStamp="2008-04-23 16:49:27.349"/> <OrderItemPriceInfo orderItemPriceInfoId="9000" orderId="DEMO10090" orderItemSeqId="00001" productPriceRuleId="9000" productPriceActionSeqId="01" modifyAmount="-9.600000000000001" description="[PRODUCT_CATEGORY_IDIsPROMOTIONS] [list:48.0;avgCost:48.0;margin:0.0] [type:PRICE_POL]" lastUpdatedStamp="2008-04-23 16:49:28.682" lastUpdatedTxStamp="2008-04-23 16:49:27.349" createdStamp="2008-04-23 16:49:28.682" createdTxStamp="2008-04-23 16:49:27.349"/> @@ -36,7 +36,7 @@ <OrderItemShipGroup orderId="DEMO10090" shipGroupSeqId="00001" shipmentMethodTypeId="NEXT_DAY" carrierPartyId="UPS" carrierRoleTypeId="CARRIER" contactMechId="9015" maySplit="N" giftMessage="" isGift="N" lastUpdatedStamp="2008-04-23 16:49:28.412" lastUpdatedTxStamp="2008-04-23 16:49:27.349" createdStamp="2008-04-23 16:49:28.412" createdTxStamp="2008-04-23 16:49:27.349"/> <OrderItemShipGroupAssoc orderId="DEMO10090" orderItemSeqId="00001" shipGroupSeqId="00001" quantity="1.0" lastUpdatedStamp="2008-04-23 16:49:28.454" lastUpdatedTxStamp="2008-04-23 16:49:27.349" createdStamp="2008-04-23 16:49:28.454" createdTxStamp="2008-04-23 16:49:27.349"/> - <OrderItemShipGrpInvRes orderId="DEMO10090" shipGroupSeqId="00001" orderItemSeqId="00001" inventoryItemId="9001" reserveOrderEnumId="INVRO_FIFO_REC" quantity="1.0" quantityNotAvailable="0.0" reservedDatetime="2008-04-23 16:49:31.474" createdDatetime="2008-04-23 16:49:31.474" promisedDatetime="2008-05-08 16:49:27.392" lastUpdatedStamp="2008-04-23 16:49:31.474" lastUpdatedTxStamp="2008-04-23 16:49:27.349" createdStamp="2008-04-23 16:49:31.474" createdTxStamp="2008-04-23 16:49:27.349"/> + <OrderItemShipGrpInvRes orderId="DEMO10090" shipGroupSeqId="00001" orderItemSeqId="00001" inventoryItemId="9001" reserveOrderEnumId="INVRO_FIFO_REC" quantity="1.0" quantityNotAvailable="0.0" reservedDatetime="2008-04-23 16:49:31.474" createdDatetime="2008-04-23 16:49:31.474" promisedDatetime="2008-05-08 16:49:27.392" priority="2" lastUpdatedStamp="2008-04-23 16:49:31.474" lastUpdatedTxStamp="2008-04-23 16:49:27.349" createdStamp="2008-04-23 16:49:31.474" createdTxStamp="2008-04-23 16:49:27.349"/> <OrderAdjustment orderAdjustmentId="9000" orderAdjustmentTypeId="PROMOTION_ADJUSTMENT" orderId="DEMO10090" orderItemSeqId="00001" shipGroupSeqId="_NA_" amount="-38.4" productPromoId="9016" productPromoRuleId="01" productPromoActionSeqId="01" createdDate="2008-04-23 16:49:27.866" createdByUserLogin="admin" lastUpdatedStamp="2008-04-23 16:49:28.271" lastUpdatedTxStamp="2008-04-23 16:49:27.349" createdStamp="2008-04-23 16:49:28.271" createdTxStamp="2008-04-23 16:49:27.349"/> <OrderAdjustment orderAdjustmentId="9001" orderAdjustmentTypeId="SHIPPING_CHARGES" orderId="DEMO10090" orderItemSeqId="_NA_" shipGroupSeqId="00001" amount="12.45" createdDate="2008-04-23 16:49:27.866" createdByUserLogin="admin" lastUpdatedStamp="2008-04-23 16:49:28.431" lastUpdatedTxStamp="2008-04-23 16:49:27.349" createdStamp="2008-04-23 16:49:28.431" createdTxStamp="2008-04-23 16:49:27.349"/> |
Free forum by Nabble | Edit this page |