Re: [OFBiz] Users - Automatic Purchasing

Posted by Si Chen-2 on
URL: http://ofbiz.116.s1.nabble.com/OFBiz-Users-Automatic-Purchasing-tp136301p136310.html



Christopher Farley wrote:

>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.
>
It certainly can (and should) be improved to be more general.

>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.
>
>  
>
Yes, that's a bug.  Can you fix it?

>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.
>
>  
>
It seems to my novice eyes that the two services do similar things.  
Basically, what you need can be written as createRequirementFromItemATP
for all products, but I could be wrong.

By the way, how are you getting a list of all products?  From a
warehouse?  From a store?  From a catalog?  What if, for example, I had
none of something in stock, so there's no InventoryItem for it.  Will it
create a Requirement?

>I'll think a little bit more about it....
>
>  
>
 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users