yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Quintiq file version 2.0
#parent: GanttChartDemandSupplyGroup
Response OnDrawNode (
  ProductInStockingPointInPeriod element
) id:Response_GanttChartDemandSupplyGroup_OnDrawNode_1
{
  #keys: '[11660.0.112571207]'
  Body:
  [*
    // Determine colors for gantt chart pispip nodes
    if( not element.HasConstraintViolations() )
    {
      // Allow negative
      if( element.ProductInStockingPoint_MP().IsNegativeInventoryAllowed() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Custom1(), element.Period_MP().Duration() );
      }
      // Is in-active
      else if( element.IsInactive() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Free(), element.Period_MP().Duration() );
      }
      // Has unfulfilled all dependentdemand and salesdemand
      else if( not element.HasFulfilledDependentDemand() or not element.HasFulfilledSalesDemand() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Warning1(), element.Period_MP().Duration() );
      }
      // Has unfulfilled target inventory level
      else if( not element.HasFulfilledInventoryDemand() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Warning2(), element.Period_MP().Duration() );
      }
      // Has fulfilled demand or it within tolerance
      else if( element.HasFulfilledAllDemand() )
      {
        drawinfo.AddCompartment( ColorScheme.GanttChart_Good(), element.Period_MP().Duration() );
      }
    }
    
    // Check if background is dark
    if( drawinfo.BackgroundColor().IsDark() )
    {
      drawinfo.TextColor( Color::White() );
    }
  *]
  DefinitionID: 'Responsedef_GanttChart_OnDrawNode'
}