agritheory / beam

General Purpose 2D barcode scanning for ERPNext
https://agritheory.com/documentation/beam/
Other
23 stars 11 forks source link

Netting Handling Unit quantities #52

Closed agritheory closed 1 year ago

agritheory commented 1 year ago

Given the following case:

Desired behavior: If the Handling Unit's stock qty is greater than the required qty, we should assume that it should associate and allow the 50 lbs to be consumed, leaving a net qty associated with that handling unit of 6.26lbs.

If that Handling Unit's stock qty is less than the 50lbs required, it should modify the row to reflect the qty associated with the Handling Unit. We should assume that multiple handling units would be required here. It looks like a real-world Handling Unit for this Item would be a Box of 36 Boxes of (4) 1/4lb sticks. So we should expect to see something like one row that consumes an entire HU and another that consumes 16lbs / 22lb net qty.

Now, here's the problem. When we go to scan the handling unit for that box that we split 16lbs and 22lbs, what is the right answer? The material has been transferred to WIP but it hasn't been consumed. If we want to to cancel the Work Order and return the Items to their warehouse, we may be in a situation where the HU with the net qty has been consumed and we can't "unify" them again.

I think the solution to this is to disallow netting the quantities in Material Transfer for Manufacture but to allow them in Manufacture. Though the case where we have to "unify" a Handling Unit again seems kind of crazy. An alternative would be to create (or prompt) new Handling Units for the items when the Stock Entry has been cancelled.

Screenshot 2023-07-28 at 16-45-34 Material Transfer for Manufacture - MAT-STE-2023-00001

federicocalvo commented 1 year ago

This is what I wrote down on Friday about the issue, where I think I had a hard time understanding what the main problem is (due maybe to little sentences that I don't quite translate well), and I think I would do the following:

"If we want to cancel the Work Order and return the Items to their warehouse, we may be in a situation where the HU with the net qty has been consumed and we can't "unify" them again."

If at the moment of canceling a Work Order, it warns us the documents to be canceled among which are the material movements that generated these HU, we could eliminate them. And modify the message adding the HU warning.

Captura de pantalla 2023-08-08 a la(s) 11 32 48

Is there any problem about any audit on this that I mention? It is like the most logical option from my point of view, and I say this with doubts because it is difficult for me to understand the problem if it is not that.

Of course, we should consider also the cancellation of individual documents, with some kind of Stock Entry (Material Transfer for Manufacture). I only raise the problem, then if we move forward we can consider several things and make it more neat.

agritheory commented 1 year ago

After some consideration I think the design that makes the most sense is one where new handling units are created on every transfer. This could be improved by re-using the HU when it is 100% of the HU's quantity, but I couldn't get it to work correctly. Currently, one can only trans 100% of HUs due to the overconsumption validation and the bug that started this issue.

Excerpt from the docs in #63

Send to Contractor, Material Transfer for Manufacture and Material Transfer

When material is transferred from one warehouse to another, it will generate a new Handling Unit, even if the entire Handling Unit is being transferred. In a case where less than the total quantity associated with a Handling Unit is moved from one warehouse to another, a new Handling Unit is generated for the new units. Subsequent scans or lookups of the original Handling Unit (123) will return the remainder or net quantity.

Item Warehouse Handling Unit Quantity
Cocoplum Storeroom 123 -40 Ea
Cocoplum Subcontractor Warehouse 456 40 Ea
Item Warehouse Handling Unit Quantity
Cocoplum Storeroom 123 -20 Ea
Cocoplum Work In Progress 456 20 Ea