Re: [OFBiz] Users - Automatic Purchasing

Posted by Christopher Farley on
URL: http://ofbiz.116.s1.nabble.com/OFBiz-Users-Automatic-Purchasing-tp136301p136309.html

Si Chen ([hidden email]) wrote:

> Christopher,
>
> It's great what you're doing, but I think it might be better to try to
> modify or extend createRequirementFromItemATP rather than add another
> service that does something so similar.  The reason is because OFBiz is
> already huge (1300+ services), and it would be nice to keep it as
> manageable as possible by reusing the existing logic.
>
> I'm looking at your issues with the existing service, and I think the
> requirement for seqGroupSeqId and orderItemSeqId are related to it
> needing to link the requirement to orders.  We can probably change the
> code to make it so that if these are not available, it just won't link
> them to orders, so they become optional.
>
> You maybe right about needing a separate requirement type, then.  I see
> what you want: bulk generate rather than one at a time when each sale is
> created.  Still there should be a lot of code in that existing service
> which you can reuse, either by isolating it or by modifying the original?

Maybe I could isolate some code and re-use it in both services. Maybe.

See, as I investigate createRequirementFromItemATP, I see that it is
quite specialized for its purpose. For example, if you have a product
with the following properties:

minimumStock: 10
reorderQuantity: 20
availableToPromiseTotal: 5
order line Quantity: 1

The createRequirementFromItemATP service creates a requirement for...
only 1. It chooses the lesser of the quantityShortfall (based only
on minimumStock, it doesn't even consider reorderQuantity) or the
order line quantity. My service would take into account minimumStock
and reorderQuantity, and create a requirement for 25.

Now maybe there is some code that can be shared with respect to querying
for the actual quantity shortfall. It would be maybe 5 lines of code
at present, but it could be more than that if we start querying for
incoming shipments, etc.

I'll think a little bit more about it....

--
Christopher Farley
www.northernbrewer.com
 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users