陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: #root
Method EditTransportCapacityFromListUnitPeriodTransportQuantity (
  internal[GUIComponent] parent,
  structured[UnitPeriodTransportQuantity] selection
) id:Method_DialogCreateEditTransportCapacity_EditTransportCapacityFromListUnitPeriodTransportQuantity
{
  #keys: '[121458.0.773757783]'
  Body:
  [*
    // Edit the capacity of the selection unit period times from periods list 
    
    isbatchedit := selection.Size() > 1;
    Dialog.ShowHideComponentForBatchEdit ( isbatchedit, false, true );
    
    // Need this for excluding itself in pre-condition primary keys checking.
    data := shadow( selection.Element( 0 ).TransportCapacity() );
    
    // In case selection.Element( 0 ) doesn't bind to any unit availability, calling SetDefaultValue method will return null error.
    if( isnull( data ) )
    {
      data := selection.Element( 0 ).Unit().TransportCapacity( relshadow, UnitID := selection.Element( 0 ).Unit().ID(), Start := MacroPlan.StartOfPlanning() );
    }
    
    Dialog.Data( data );
    
    // Need this so that when the upt doesn't not have a unit availability, the fields in this Dialog will not be blank.
    Dialog.SetDefaultValue( selection.Element( 0 ) );
    
    result := this.DoModal( parent );
    
    if( result > 0 )
    {
      TransportCapacity::CreateOrUpdateForUnitPeriodTransports( selection,
                                                                data.TimeUnit(),
                                                                not isbatchedit or CheckBoxBatchEditLotSize.Checked(),
                                                                data.LotSize(),
                                                                not isbatchedit or CheckBoxBatchEditCapacity.Checked(),
                                                                data.MinimumCapacity(),
                                                                data.MaximumCapacity(),
                                                                not isbatchedit or CheckBoxBatchEditSecondaryCapacity.Checked(),
                                                                data.HasSecondaryCapacity(),
                                                                data.SecondaryLotSize(),
                                                                data.SecondaryMaximumCapacity(),
                                                                data.SecondaryMinimumCapacity(),
                                                                data.SecondaryUnitOfMeasureName(),
                                                                CheckBoxThisPeriodOnwards.Checked()
                                                              );
    }
  *]
}