renhao
2023-09-21 1aa9f2bb83dd9e4b7517f1cbf06b0db53979bb31
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
48
49
50
51
52
53
54
Quintiq file version 2.0
#parent: GanttChartUnitCalendar
Response OnClick (
  structured[UnitPeriod] selection
) id:Response_GanttChartUnitCalendar_MenuEditCapacityInPeriodInGanttChartUnitCalendar_OnClick
{
  #keys: '[112884.1.974878982]'
  Body:
  [*
    //Edit unit availabilities/capacities/transport capacity
    //One of these sets should be empty
    upt := selectset( selection, Elements.astype( UnitPeriodTime ), up, true );
    upq := selectset( selection, Elements.astype( UnitPeriodQuantity ), up, true );
    uptransport := selectset( selection, Elements.astype( UnitPeriodTransportBase ), up, true );
    if ( upq.Size() = 0 and uptransport.Size() = 0 )
    {
      //Edit unit availabilities of the unit period times.
      dlg := construct( DialogCreateEditUnitAvailability );
      dlg.EditUnitAvailabilityFromListUnitPeriodTime( this, upt );
    }
    else if ( upt.Size() = 0 and uptransport.Size() = 0 )
    {
      //Edit unit capacities of the unit period quantities.
      dlg := construct( DialogCreateEditUnitCapacity );
      dlg.EditUnitCapacityFromListUnitPeriodQuantity( this, upq );
    }
    else if ( upq.Size() = 0 and upt.Size() = 0 )
    {
    
      uptTime := selectset( uptransport, Elements.astype( UnitPeriodTransportTime ), up, true );
      uptQty  := selectset( uptransport, Elements.astype( UnitPeriodTransportQuantity ), up, true ); 
    
      if( uptTime.Size() > 0 )
      {
        //Edit transport availabilities of the unit period transport time
        dlg := construct( DialogCreateEditTransportAvailability );
        dlg.EditTransportAvailabilityFromListUnitPeriodTransportTime( this, uptTime );
      }
      else if( uptQty.Size() > 0 )
      {
          //Edit transport capacities of the unit period transport qty
        dlg := construct( DialogCreateEditTransportCapacity );
        dlg.EditTransportCapacityFromListUnitPeriodTransportQuantity( this, uptQty );
      }
    }
  *]
  CanBindMultiple: false
  DefinitionID => /GanttChartUnitCalendar/Responsedef_GanttChartUnitCalendar_Menu_OnClick
  Initiator: 'MenuEditCapacityInPeriodInGanttChartUnitCalendar'
  Precondition:
  [*
    return UnitPeriod::CanEditCapacities( selection, feedback );
  *]
}