BOM type for chemical processing

I would like to modify the manufacturing module to support processing chemical items. The solution I need to accomplish is creating and calculate the production order material amounts from a batch size not the qty field and by using a custom batch_size_qty. So to better understand let me explain the desired workflow. There is a “batch” item created for each product line that is a WIP material. Meaning its material that still needs to be packaged for sale. A production can be created for the batch item based on a BOM that correlates batch size with the total weight of one batch. (Ex. 1 batch = 2500 lbs) So now the workflow example:

A need for new finished packaged item is required. The Manufacturing Planner will create a Production Order for a batch of material that gets packaged. Because production is done in separate batches(in small blenders) under the same lot # we would like to place a production order for the total # of batches for one lot#(one production order). So if the Production order was for a qty of 4, that would calculate all raw materials against the total net_weight field in item table of “batch item” used to create the production order. One production order would be created with 4(qty) * 2500 lbs(net_weight) = 10000lbs of total output unit. Each raw material input for the production order would calculate its qty off of the batch weight. So i ask the system for one batch it would calculate all the material needed to make 2500lbs or if I ask for 5 batches it would calculate all the respected BOM items for 12500lbs.

I understand the easy erpnext out-of-the-box way to do this would be to create a stock item with LBS as unit of measure and a BOM that equals 2500 lbs total quantity. The reason we need to modify code is because batch sizes change often and it is not practical to create 100+ stock items with 100+ BOM records for each weight. I would rather create a BOM with raw materials as percentages of the total batch size and then have the pounds consumed in a Production order calculated when the user selects the amount of batches needed to make. I really hope this makes sense for someone to help point me in the right direction. I can try to clarify if unclear.

What kind of help do you need?

I’d like to know where to look in the code for what handles the calculations of consuming the raw materials. Not much documentation on the JS side of code. Are the calculations handled on the client side? And then persisted to the DB on the server side from the data in the forms? Where can I find more technical documentation for the JS client app. I am familiar with JS as dynamic scripting but not as familiar with full scale client apps so I need more docs to understand structure. I can’t even figure out where the entry point is. The documentation says public/js/all-app.js but that doesn’t seem to exist anymore. I am using versions ErpNext 6.6.4 & Frappe 6.11.0

Why not make the BOM to make 1lb of material? Then you can manufacture to different amounts with the same BOM.

@cpurbaugh that is a good suggestion. Thank you. I had already thought of that but it would not represent our actual process workflow. This would digest the materials all at once in the system once I transfer the materials using the stock “transfer to manuf.” movement if I created one large production order. And if I create multiple (one for each batch) we would be creating tons of Production Orders. The batches are run under 1 lot number in batches that each take approx 2.5 hrs to process. If a planned batch does not get produced by the end of the day due to various factors it is moved to the next work day and under a different Lot #. Any planned batches on an order should maintain their record but should carry a “canceled/rescheduled” property of some sort so that it can be referenced in KPI reports later in the quarter. This way we can monitor planning efficiency. So aside from the other information recorded in the database I would like to find the following:

Lot# 1234
Batch 1: 2500lbs; Finished; timestamp
Batch 2: 2500lbs; Finished; timestamp
Batch 3: 2500lbs; UNFINISHED; timestamp (date rescheduled); reference to new production order number

Everything in our real world scenario is measured and sold in pounds but then formulas are calculated for production as a percentage of the whole size of whatever is being processed.

If you were to make a production order for 7,500 lb of material, and transferred 2,500 at a time, and manufactured 2,500 at a time, you should be able to have 3 sets of stock entries on the same production order.

Sure that could work but how would you closed the Production Order in the scenario I mentioned where a certain amount of material was never transferred. The order would never complete. Then a new production order would have been created to fulfill production demand but under another order/lot number. Its more about the tractability of components. What was planned under one lot number, then what was actually used for that lot number, and where the planned materials ended up on a new lot number.

See this for JS scripts:

Developer starting point:

@rmehta @jbmanuf61 This does pose an interesting question, how would a production order be closed if 5,000 of 7,000 parts were created under a production order, then you don’t plan to make the other 2,000 parts? I know it can be stopped, but is that the best way to do it?

Also, when looking into this, I created some test items, Chemical A, Chemical B, and Chemical C. C was to be manufactured using A & B. When I received these items in, I placed them into the WIP warehouse. When I started the Production Order, it would not allow me to transfer items to the same place, i.e. from WIP to WIP. Also, the ‘update finished goods’ button was not displayed in the production order, leaving me stuck, unless I first transferred the stock out of WIP, which won’t really work in a real world scenario, as some parts are sometimes stored in the WIP area.

@cpurbaugh warehouses are virtual place holders, you just have to work around them. Maybe create multiple WIP?