Menu

#974 Delivery policy to prevent orders from "starving"

Core
open-remind
Shipment (7)
5
2010-06-15
2010-05-19
Daniel Tamm
No

If you have Compiere WMS you can configure the system to prevent orders from starving. I e one order with many items not in stock have a high risk of being starved if the items on the order are never in stock at the same time and the delivery rule is complete order or complete line.
If the order is not being starved it at least is at risk of being delayed because other complete orders "steal" the items from the non complete order.

The Compiere solution to this is to add a new field QtyAllocated and orders get allocated what is on hand. When an order is completely allocated (according to its delivery rule) it can be completed.

In wait for a complete pluggable WMS for Adempiere I propose the development of a Delivery Policy.

See wiki: http://www.adempiere.com/index.php/Delivery_Policy

I'm aware that Libero has a WMS module but I haven't been able to find any documentation about how the allocation works there.

I suggest this to be in the standard release of Adempiere in the future (perhaps not the upcoming one) and be optional.

Discussion

1 2 > >> (Page 1 of 2)
  • Carlos Ruiz

    Carlos Ruiz - 2010-05-20

    Daniel, thanks, sounds like a great improvement.

    Regards,

    Carlos Ruiz

     
  • Trifon (An ADempiere founder)

    I also want to second, Carlos, comments.
    Description of the functionality on the wiki page looks very well.

    I'm keen to see it and try it.

     
  • Daniel Tamm

    Daniel Tamm - 2010-06-03

    Thanks for the encouragement :-) I'm very close to a working solution now.
    I'll post it here as a patch first.

     
  • Daniel Tamm

    Daniel Tamm - 2010-06-15

    Attaching patches and DB-scripts. The patches are created from revision 12428.
    If anyone is interested in making the equivalent oracle script for XXX-B-FR 3004020 Delivery Policy.sql I'd be very happy.

     
  • Daniel Tamm

    Daniel Tamm - 2010-06-15

    Patch FR 3004020-rev 12428

     
  • Carlos Ruiz

    Carlos Ruiz - 2010-06-15
    • status: open --> open-remind
     
  • Daniel Tamm

    Daniel Tamm - 2010-06-17

    First SQL-file Oracle

     
  • Daniel Tamm

    Daniel Tamm - 2010-06-17

    Second SQL-file Oracle

     
  • Daniel Tamm

    Daniel Tamm - 2010-06-17

    I managed to convert the PostgreSQL script to Oracle PL/SQL.
    Uploaded new Oracle scripts.
    Will commit tomorrow.

     
  • Redhuan D. Oon

    Redhuan D. Oon - 2010-06-18

    + 1 vote since it does not break backward compatibility rule and is well explained and i also not aware of Libero version on this.

     
  • Teo Sarca

    Teo Sarca - 2010-06-23

    Hi,

    Here is my quick and partial code review.

    AllocateSalesOrders.getOrderLinesToAllocate(Connection conn, int productId, String trxName)
    * don't use the conn parameter. When u need to create a prepared statement you can use DB.prepareStatement
    * please always close the PreparedStatement and ResultSet in a result set
    Please apply ABP from http://www.adempiere.com/index.php/ADempiere_Best_Practices#How_to_use_PreparedStatement.2FResultSet_.3F

    AllocateSalesOrders.doIt()
    * you could use Java5 syntax in order to iterate a List or Vector like:
    for (Iterator<StockInfo> it = products.iterator(); it.hasNext();)

    MaterialReceiptModelValidator.docValidate()
    * why are u using Connection here.
    * why are u creating a new transaction here. Please use the transaction name that comes from PO object that u have as an argument. If u want to revert on a specific point, please use savepoints (see Trx.setSavepoint).

    I_AD_ClientInfo
    MClientInfo
    * why did u add DELIVERY_POLICY_STRICT_ORDER and DELIVERY_POLICY_NO_HOLD to MCLientInfo. When u created the AD_ClientInfo.DeliveryPolicy field, you should made it as List and create a list for those constants as "Reference".
    Same for AD_OrgInfo.

    Ok, as a general rule from what i've seen here are:
    * don't use Connection. Use instead DB helper class
    * In most of the cases u don't need to pass trxName as argument to non static methods because the transaction should come from the PO itself or from other PO passed as parameter. Please review this in your code.

    Best regards,
    Teo Sarca

     
  • Daniel Tamm

    Daniel Tamm - 2010-06-23

    Thanks for the review :-) I'll adjust according to your suggestions.
    If possible, could you give me a quick brief on creating constants for lists. I tried to figure it out but didn't get far enough on that.

     
  • Teo Sarca

    Teo Sarca - 2010-06-23

    > If possible, could you give me a quick brief on creating constants for
    > lists. I tried to figure it out but didn't get far enough on that.

    at short, go to table and columns, go and select "Delivery_Policy" column. Instead of String set the reference as List. On Reference Value you will need to set the list that you need previously to create.

    Best regards,
    Teo Sarca

     
  • Teo Sarca

    Teo Sarca - 2010-06-23

    One more thing,
    > Thanks for the review :-) I'll adjust according to your suggestions.

    Yes, the idea is that your code should be complient with ABP (http://www.adempiere.com/index.php/ADempiere_Best_Practices) to reach the trunk.

    Best regards,
    Teo Sarca

     
  • Victor Perez Juarez

    Hi Daniel !

    My comment about your contribution are:

    1.- we are using the Query class to create the instante any persistence Objects, and the use the JDBC should be deprecate.

    List<MOrderLine> lines = new Query(getCtx(), I_C_OrderLine.Table_Name, whereClause, get_TrxName()).setParameters(,,,,,,)list(); .....

    Please see :

    2.- If you want use object collection please use List interface vs Vector

    Vector<MOrderLine> result = new Vector<MOrderLine>();

    http://www.adempiere.com/index.php/ADempiere_Best_Practices#How_to_use_Adempiere_Query_class.3F

    3.-please you change not the sing method because this break the back compatibility

    I saw that you change the sing method :

    /**
    * Update Storage Info add.
    * Called from MProjectIssue
    * @param ctx context
    * @param M_Warehouse_ID warehouse
    * @param M_Locator_ID locator
    * @param M_Product_ID product
    * @param M_AttributeSetInstance_ID AS Instance
    * @param reservationAttributeSetInstance_ID reservation AS Instance
    * @param diffQtyOnHand add on hand
    * @param diffQtyReserved add reserved
    * @param diffQtyOrdered add order
    * @param trxName transaction
    * @return true if updated
    */
    public static boolean add (Properties ctx, int M_Warehouse_ID, int M_Locator_ID,
    int M_Product_ID, int M_AttributeSetInstance_ID, int reservationAttributeSetInstance_ID,
    BigDecimal diffQtyOnHand,
    BigDecimal diffQtyReserved,
    BigDecimal diffQtyOrdered,
    BigDecimal diffQtyAllocated,
    String trxName)
    {

    Now the libero MFG break for this reason.

    please see

    http://www.adempiere.com/index.php/ADempiere_Best_Practices#How_to_change_parameters_of_existing_method_from_ADempiere_core

    4.- I saw that create a new transaction in MaterialReceiptModelValidator, and I think you should use the same the persisten object .

    allocateProducts(conn, trxName, line);

    and you should use

    allocateProducts(conn, PO.get_TrxName(), line);

    So is not necessary create a new transaction.

    Daniel please if you need some help or support to solve this point you can contact me.

    Now I offert as voluntary to validate each commit in trunk, and this commit break of back compatibility, So you should solve this issue.

    I think give some days before of revert this revision.

    kind regards
    Victor Perez

     
  • Daniel Tamm

    Daniel Tamm - 2010-06-24

    @Victor

    Sorry about the breaking of backwards compat for MStorage. Now it's corrected.

    http://adempiere.svn.sourceforge.net/adempiere/?rev=12778&view=rev

    It was necessary to add a column for allocated but of course I should have left a backwards compat method as well. I wasn't thinking MStorage was used outside the main project but I guess one should never assume.

    In MaterialReceiptModelValidator; if I use the PO.get_TrxName, is that automatically committed when the validator is finished? That seems to be a better way, thanks!

    I'll look through the rest of the suggestions now.

     
  • Daniel Tamm

    Daniel Tamm - 2010-06-24

    @Teo
    Removed the constants in MClientInfo (I had already generated them without knowing :-) ).

    http://adempiere.svn.sourceforge.net/adempiere/?rev=12785&view=rev

    About the Trx and Connections. I'll look over that as I continue to test this feature with high volumes. I don't want to change it right now because what I committed now is tested and if I make a quick change now I'll be committing untested code. Hope that's ok with you that I do it in that order.

    Best regards
    /Daniel T

     
  • Daniel Tamm

    Daniel Tamm - 2010-06-24

    @Victor
    About using the Query class. I'm using that as far as possible. With the particular cases in AllocateSalesOrder it was not possible nor efficient to use the Query for the specific queries. It would kill the performance. I did the best "middle way" I could.

    Best regards
    /Daniel

     
  • Teo Sarca

    Teo Sarca - 2010-06-29

    Hi Daniel,

    Do you have any updates on this tracker?

    Best regards,
    Teo Sarca

     
  • Daniel Tamm

    Daniel Tamm - 2010-06-29

    Hi Teo,

    I haven't had time to do much more testing. Is there anything in particular that you think is urgent? If so I can try to put some higher priority on that.

    Best regards
    /Daniel T

     
  • Daniel Tamm

    Daniel Tamm - 2010-07-13

    Minor GUI adjustment.

    http://adempiere.svn.sourceforge.net/adempiere/?rev=13190&view=rev

    SF3004020 - Delivery policy. Show QtyAllocated in Warehouse Tab of InfoProduct window.

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.