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
Quintiq file version 2.0
#parent: GanttChartDemandSupplyGroup
Response OnClick (
  structured[ProductInStockingPointInPeriodPlanningLeaf] selection
) id:Response_GanttChartDemandSupplyGroup_MenuNewTrips_OnClick
{
  #keys: '[110880.9.1056298370]'
  Body:
  [*
    // Create new trip for selected pispip
    legcounter := 0
    
    if( selection.Size() = 1 )    // Skip counter if more than one pispip is selected.
    {
      legcounter := counter( selection, Elements.ProductInStockingPoint_MP.LaneLegOutput.LaneLeg, leg, leg.GetIsEnabled() );
    }
    
    // If only 1 pispip is selected and there is more than one leg, prompt the dialog for user to select a leg.
    if( legcounter > 1 )
    {
      dlg := construct( DialogCreateEditTrip );
      dlg.NewTripWithProduct( this, selection.Element( 0 ) );
    }
    else
    {
      // Create trips with products in trip based on PISPIPs
      Trip::CreateWithProductInTrips( selection, null( LaneLeg ) );
    }
  *]
  CanBindMultiple: false
  DefinitionID => /GanttChartDemandSupplyGroup/Responsedef_GanttChartDemandSupplyGroup_Menu_OnClick
  Initiator: 'MenuNewTrips'
  Precondition:
  [*
    return Trip::CanCreate( selection, feedback );
  *]
}