Running an Optimize after Importing data
This guide will step through how the Customization works and how it can be modified to meet different needs. If you are just getting started, you can learn about getting started with customizations.
By default this customization automates an Optimize after data is imported by checking if the transmission is an ImportT. If transmission is an ImportT then it adds an Optimize transmission to the process. This can be modified to check if the transmission is one of many forms, such as JobGenerateT and ManufacturingOrderChangeT. With this information you can automate actions after the transmissions have been processed, ie. ClockAdvance, Optimize, check ERPTransmissions.
protected override void EndOfSimulationCleanup(ScenarioDetail.SimulationType a_simType, ScenarioBaseT a_t, ScenarioDetail a_sd)
//Optimize after all imports
if (a_t is ImportT)
ScenarioDetailOptimizeT optimizeT = new ScenarioDetailOptimizeT(a_sd.Scenario.Id, true, false);
//Example on how to check imported data to determine if an action should be taken
//if (a_t is ImportT importT)
// for (var i = 0; i < importT.Count; i++)
// ERPTransmission erpTransmission = importT[i];
// if (erpTransmission is JobT jobT)
// if (jobT.Count > 0)
// ScenarioDetailOptimizeT optimizeT = new ScenarioDetailOptimizeT(a_sd.Scenario.Id, true, false);
// AddTransmissionsToProcess(0, optimizeT);
Without the customization
Without the customization the user has to manually click the Optimize button after importing the data. The data is imported but is not optimized.
With the customization
With the customization once the import data is completely uploaded an Optimize is ran. After the data is imported it is automatically optimized and scheduled.
Download Visual Studio project
Download customization file for version 11.39.15
Rename the sample scenario file to scenarios.dat when loading in PlanetTogether.
Download sample scenarios.dat for version 11.39