Controlling the product quantity leaving multiple warehouses

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
vassilis94s
Posts: 19
Joined: Monday 05 December, 2016 - 15:16

Controlling the product quantity leaving multiple warehouses

Post by vassilis94s »

Hello,
I face the following problem:
We have 4 products. We produce 100 from the first one , 90 from the second, 60 from the third one and 30 from the fourth. The products are strored in the warehouse. We want to control how many products will leave each warehouse and will be led to the sink.

I have writen this 4d script code in the TriggeronExit field of each warehouse:
Do(
var[(valRow), vbValue],
valRow := Label ([SourceNrContainer]),
loopUntil(
Cell(valRow,11,refProductionDetails) = Cell(valRow,1,refProductionDetails),
Cell(ValRow,11,refProductionDetails :=Cell(valRow,11, refProductionDetails)+1)
)

I have a table named ProductionDetails. 11th column is a counter on the exit of each warehouse. The quantity that we want to leave each warehouse is shown in the first column of the table. We want when the desired quantity is reached by the counter the forklift to move to the next warehouse and do the same.

I attach you a very very simpler model in order to show you what i have in my mind.

Thank you a lot.

With respect,
Vassilis
Attachments
model1.mod
(75.83 KiB) Downloaded 234 times
User avatar
Markus Holzner
Posts: 21
Joined: Thursday 20 January, 2011 - 13:31

Re: Controlling the product quantity leaving multiple warehouses

Post by Markus Holzner »

Hi Vassilis,

I have seen that the atom "ProductionDetails" was missing in your model.
Therefore I created a new one based on the idea that I got from your explanation. I hope that works for you.

I have a table (atom "ProductionDetails") with 3 rows for each warehouse one row and 5 columns with the upper content, the current content, the content to be outsourced, the content still to be outsourced and the status. The upper content fields and the content to be outsourced a static fields filled with initial values; the other fields are filled dynamically.

At initializing/resetting the model first all outputs of the warehouse atoms are closed and also the dynamic fields of the atom "ProductionDetails" are set to "0" (see Initialize atom).
Then basically all the functionality is stored in the entry and exit triggers of the warehouse atoms. With every entering container the current content is updated until the upper content is reached. Then the outsourcing process should be started with the quantity of containers to be outsourced. When the outsourcing process has been finished it will be checked if there is a pending outsourcing process at some other warehosue.
The status field indicates if there is an ongoing outsourcing process or not or if an outsourcing process has to wait.

Please, have a look at the code yourself (especially the entry nd exit triggers of the warehouse atoms) and see the comments there as well.
I hope that will help and met your requirements.

There are of course still some improvements to make like using functions (instead of having 3 times the same code in the triggers of the warehouse atoms) or using constants for table columns or the status and quite some more.

Nevertheless, I hope that will help you in first place. Let me know, if you need some more information/explanation.
Success.

Regards,
Markus
Attachments
model1_mho.mod
(98.02 KiB) Downloaded 238 times
Post Reply