I am currently doing research for a project on transportation of orders that are produced in batches, and in my model the departure and amount of adv. transporters is dependent on the size of a batch that is released earlier in the system. See the model included.
Problem situation:
In this situation a set of orders is released at certain points in time for production. After all products are produced the orders are released for loading (to mimic LIFO loading in the truck) and loaded. The orders are then shipped to specific destinations. Order have the labels ‘dest’ (destination) and ‘Quantity ‘(loading capacity needed).
So in summary the process is:
Order creation >> order release >> production >> release for loading >> loading >> transportation
Two interrelated problems arise:
1. Since the capacity(sum of quantity) differs per batch, I need to force a transporter to depart when the loading sequence is completed. For this problem the load capacity of the transporter needs to be relative instead of fixed and linked to the sum of label[Quantity], How do I realize that with 4d code?
order release >> sum of quantity >> load capacity of truck.
2. On top of problem 1, my transporters have a maximum loading capacity of 27 'quantity' units. For this reason, when the batchsize exceeds the loading capacity of a truck, a second truck needs to be assigned aswell. The products are divided by drop-off locations over the trucks: transporter 1 takes dest 1, transporter 2 takes dest 2 and 3. How do I realise this in 4D?
I think I have a solution on how to realize this in terms of code structure (see below), but cannot get it realized in 4Dscript .
For ease of use, I now store the sum of a batched order in a table, later on I want this to be the variable [Batchquantity].
In terms of code, I think it should be a condition control atom with a code something like:
Code: Select all
Do(
If( Batchquantity <= 27,
Do(
{assign one transporter},
{load capacity of transporter is 27 based on the sum of label [quantity]}
),
Do(
{assign two transporters} ,
{assign orders with label[Dest] = 1 to transporter1},
{assign orders with label[Dest] = 2 and 3 to transporter2},
{Batchquantity of truck 1 is sum of label [Quantity] for all orders with label [Dest] = 1},
{Batchquantity of truck 2 is sum of label [Quantity] for all orders with label [dest] = 2 and 3}
)
),
Label([Batchquantity] ,??) := 0 {reset for next batch}
)
Thank you in Advance,
René