Modifying Setup in a Customization

Guide to calculate setup in a customization with a sample code

This guide will step through the process of coding a Required Capacity customization. If you are just getting started, please take a look at the following guides to getting started with customizations and the required capacity customization point basics

Calculating the setup


This example will modify the setup by adding time based on the MO's primary product item UDF.

protected override RequiredSpanPlusSetup AdjustSetupTime(InternalActivity a_act, InternalResource a_res, long a_startTicks, RequiredSpanPlusSetup a_setupSpan, LeftNeighborSetupValues a_leftNeighborSetupValues)
{
//Find the MO Product
if (a_act.Operation.ManufacturingOrder.GetPrimaryProduct() is Product product)
{
//Find the UDF of interest on the Product Item
UserFieldList userDefinedFields = product.Item.UserFields;
if(userDefinedFields != null && userDefinedFields.Find("Item Attribute") is UserField itemUdf)
{
//Check if the UDF exists and is the correct type
if (itemUdf.DataValue is int itemInt)
{
if (itemInt != 0)
{
//Increase the setup time based on the UDF
long totalSetup = a_setupSpan.GrossSetupTicks.TimeSpanTicks + TimeSpan.FromMinutes(itemInt).Ticks;
return new RequiredSpanPlusSetup(totalSetup, false, totalSetup); //Return a new setup class with the modified setup
}
}
}
}

return a_setupSpan;
}

Next Steps

To expand your customization, meet other types of scheduling requirements or to learn how to better navigate the PlanetTogether data objects explore the following articles:

Advanced topics

Coming Soon...