Quintiq file version 2.0
|
#parent: #root
|
Method MPSyncDetailedSchedule (
|
Boolean isoverwitemanualconfig,
|
IODetailedSchedules iodetailedschedule_mps
|
)
|
{
|
Description: 'Synchronization of Detailed Schedules to Feedback for MPSync'
|
TextBody:
|
[*
|
// Select a set of existing Feedbacks, only get frozen
|
existing := selectset( this, Feedback.astype( FeedbackPeriodTaskOperation ), feedback, feedback.IsLocked() );
|
updates := construct( FeedbackPeriodTaskOperations );
|
|
// The synchronization is as follow
|
// 1. We group scheduled work orders according to operationID and datetime
|
// 2. Then group planning periods by datetime
|
// We then loop through sorted scheduled work orders
|
// for each detailed scheule, we populate all
|
// planning operation period tasks associated to it
|
if( iodetailedschedule_mps.Size() > 0 )
|
{
|
iodetailedschedule_mps.Sort( attribute( IODetailedSchedule, RoutingID ), true /*ascending*/,
|
attribute( IODetailedSchedule, RoutingStepSeqNr ), true /*ascending*/,
|
attribute( IODetailedSchedule, ResourceID ), true /*ascending*/,
|
attribute( IODetailedSchedule, ScheduledStart ), true /*ascending*/,
|
attribute( IODetailedSchedule, ScheduledEnd ), true /*ascending*/ );
|
|
traverse( iodetailedschedule_mps, Elements, ioschwo )
|
{
|
FeedbackPeriodTaskOperation::CreateUpdate( this,
|
ioschwo.ScheduledStart(), ioschwo.ScheduledEnd(), ioschwo.ResourceID(),
|
ioschwo.RoutingID(), ioschwo.RoutingStepSeqNr(), ioschwo.Quantity(),
|
updates /* output structured FeedbackPTO */ );
|
}
|
}
|
|
this.PostProcessDetailScheduleFeedback( true, updates, existing );//set to false if not creating zero feedback
|
// Get the set of old Feedback to be deleted
|
tobedeleteset := existing.Difference( updates );
|
// Traverse the set of Feedback to be deleted
|
// Only delete Feedback that is not manually configured or the imported instance should overwrite manual configuration
|
traverse( tobedeleteset, Elements, ele, not ele.IsManuallyConfigured() or isoverwitemanualconfig)
|
{
|
ele.Delete();
|
}
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|