Quintiq file version 2.0
|
#parent: #root
|
Method DrawNode (
|
UnitPeriod element,
|
internal[WebDrawNodeInfo] drawinfo
|
) id:Method_BaseFormCapacityPlanning_DrawNode
|
{
|
#keys: '[145730.1.1000510444]'
|
Body:
|
[*
|
// Determine colors for unit period gantt chart nodes
|
macroplan := element.MacroPlan();
|
nr := macroplan.GlobalParameters_MP().NumberOfDecimals();
|
below := element.BottleneckThreshold();
|
above := element.OverloadThreshold();
|
textcolour := ColorScheme.CapacityGanttChart_DefaultText();
|
changeoverratio := Duration::Zero();
|
|
if( element.istype( UnitPeriodTimeBase ) )
|
{
|
changeoverratio := element.astype( UnitPeriodTimeBase ).ChangeoverDurationRatio();
|
}
|
|
if ( element.Duration() > Duration::Zero() )
|
{
|
// Quantity aggregated unit without child, show as irrelevant
|
if( element.Unit().CapacityType() = GlobalParameters_MP::GetCapacityTypeQuantityAggregation()
|
and element.ChildOfUnitDimension( relsize ) = 0 )
|
{
|
color := ifexpr( element.HasConstraintViolations(), ColorScheme.CapacityGanttChart_Error(), ColorScheme.CapacityGanttChart_Irrelevant() );
|
drawinfo.AddCompartment( color , element.FreeCapacityRatio() );
|
}
|
//infinte and no child, show purple
|
else if ( not element.Unit().IsPotentialBottleneck() )
|
{
|
color := ifexpr( element.HasConstraintViolations(), ColorScheme.CapacityGanttChart_Error(), ColorScheme.CapacityGanttChart_Infinite() );
|
drawinfo.AddCompartment( color, element.Duration() );
|
}
|
//infinite but with child, show constraint violation if its children is overloaded
|
else if ( element.Unit().HasCapacityTypeInfinite() and element.Unit().IsPotentialBottleneck() )
|
{
|
color := ifexpr( element.HasConstraintViolations(), ColorScheme.CapacityGanttChart_Error(), ColorScheme.CapacityGanttChart_Infinite() );
|
drawinfo.AddCompartment( color, element.UsedCapacityRatio() );
|
drawinfo.AddCompartment( ColorScheme.CapacityGanttChart_Free(), element.FreeCapacityRatio() );
|
}
|
//units which are part of an aggregation
|
else if ( element.Unit().IsForCapacityAggregation() )
|
{
|
color := ifexpr( element.HasConstraintViolations(), ColorScheme.CapacityGanttChart_Error(), ColorScheme.CapacityGanttChart_Aggregation() );
|
drawinfo.AddCompartment( color, element.UsedCapacityRatio() );
|
drawinfo.AddCompartment( ColorScheme.CapacityGanttChart_Changeover(), changeoverratio );
|
drawinfo.AddCompartment( ColorScheme.CapacityGanttChart_Free(), element.FreeCapacityRatio() );
|
textcolour := ColorScheme.CapacityGanttChart_TextGood();
|
}
|
// IsPlannedInfinite, show purple
|
else if ( element.IsPlannedInfinite() )
|
{
|
color := ifexpr( element.HasConstraintViolations(), ColorScheme.CapacityGanttChart_Error(), ColorScheme.CapacityGanttChart_Infinite() );
|
drawinfo.AddCompartment( color, element.Duration() );
|
textcolour := ColorScheme.CapacityGanttChart_Infinite();
|
}
|
else
|
{
|
displayutilizationpercentage := element.DisplayUtilizationPercentageWithMaxLoadRatio();
|
loadpercentage := displayutilizationpercentage.Round( nr );
|
|
color := ColorScheme.CapacityGanttChart_Good();
|
textcolour := ColorScheme.CapacityGanttChart_TextGood();
|
|
if ( element.HasConstraintViolations() )
|
{
|
color := ColorScheme.CapacityGanttChart_Error();
|
}
|
|
else if ( below > 0 and above > 0 )
|
{
|
if ( loadpercentage > below and loadpercentage <= above and element.Period_MP().IsWithinBottleneckWindow() )
|
{
|
color := ColorScheme.CapacityGanttChart_WarningMid();
|
textcolour := ColorScheme.CapacityGanttChart_WarningText();
|
}
|
else if ( loadpercentage > above )
|
{
|
color := ColorScheme.CapacityGanttChart_WarningHigh();
|
textcolour := ColorScheme.CapacityGanttChart_WarningText();
|
}
|
}
|
|
usedCapacityRatio := ifexpr( element.Unit().CapacityType() = GlobalParameters_MP::GetCapacityTypeTransportQuantity()
|
,element.astype( UnitPeriodTransportQuantity).DisplayUsedCapacityRatio()
|
,element.UsedCapacityRatio() );
|
|
freeCapacityRatio := ifexpr( element.Unit().CapacityType() = GlobalParameters_MP::GetCapacityTypeTransportQuantity()
|
,element.astype( UnitPeriodTransportQuantity).DisplayFreeCapacityRatio()
|
,element.FreeCapacityRatio() );
|
|
drawinfo.AddCompartment( color, usedCapacityRatio );
|
drawinfo.AddCompartment( ColorScheme.CapacityGanttChart_Changeover(), changeoverratio );
|
drawinfo.AddCompartment( ColorScheme.CapacityGanttChart_Free(), freeCapacityRatio );
|
}
|
// in case no available duration
|
color := ifexpr( not element.HasOpenUnit(), ColorScheme.CapacityGanttChart_Error(), ColorScheme.CapacityGanttChart_Irrelevant() );
|
drawinfo.AddCompartment( color, element.TotalUnavailableCapacityRatio() );
|
}
|
|
if ( element.HasConstraintViolations() )
|
{
|
textcolour := ColorScheme.CapacityGanttChart_WarningText();
|
}
|
drawinfo.TextColor( textcolour );
|
*]
|
Declarative: true
|
}
|