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
48
49
50
51
52
53
54
55
56
Quintiq file version 2.0
#parent: #root
Method EnableDisableComponents (
  Boolean isbatchedit
) id:Method_DialogCreateEditProduct_EnableDisableComponents
{
  #keys: '[124808.0.1285736463]'
  Body:
  [*
    // Enable/disable components
    issystem := guard( Dialog.Data().IsSystem(), false );
    
    if( issystem )
    {
      EditorID.DisableWithUserFeedback( Translations::MP_Designer_DialogCreateEditProduct_DisabledEditorID() );
    }
    
    EditorID.Enabled( not isbatchedit );
    EditorProductName.Enabled( not isbatchedit );
    CheckBoxHasParentProduct.Enabled( not isbatchedit or CheckBoxBatchEditParent.Checked() );
    SelectionUnitOfMeasurement.Enabled( not isbatchedit or CheckBoxBatchEditUnitOfMeasurement.Checked() );
    SelectionParentProduct.Enabled( not isbatchedit
                                    or ( CheckBoxBatchEditParent.Checked() and CheckBoxHasParentProduct.Checked() ) );
    
    CheckBoxIsByProduct.Enabled( not isbatchedit or CheckBoxBatchEditByProduct.Checked() );
    CheckBoxIsPlannedAfterOptimization.Enabled( CheckBoxIsExcludedFromOptimization.Checked() and ( not isbatchedit or CheckBoxBatchEditIsExcludedFromOptimization.Checked() ) );
    CheckBoxIsExcludedFromOptimization.Enabled( not CheckBoxIsPlannedAfterOptimization.Checked() and ( not isbatchedit or CheckBoxBatchEditIsExcludedFromOptimization.Checked() ) );
    
    
    EditorNotes.Enabled( not isbatchedit or this.CheckBoxBatchEditNotes().Checked() );
    
    
    CheckBoxHasShelfLife.Enabled( not isbatchedit or CheckBoxBatchEditHasShelfLife.Checked() );
    EditorShelfLife.Enabled( not isbatchedit 
                             or ( CheckBoxBatchEditHasShelfLife.Checked() and CheckBoxHasShelfLife.Checked() ) );
    
    CheckBoxHasMaturationDays.Enabled( not isbatchedit or CheckBoxBatchEditHasMaturationDays.Checked() );
    EditorMaturationDays.Enabled( not isbatchedit 
                                  or ( CheckBoxBatchEditHasMaturationDays.Checked() and CheckBoxHasMaturationDays.Checked() ) );
                                  
    CheckBoxIsExcludedFromFulfillmentKPI.Enabled( not isbatchedit or CheckBoxBatchEditIsExcludedFromFulfillmentKPI.Checked() );
    
    // Disable CheckBoxIsExcludedFromFulfillmentKPI when parent product is excluded from fulfillment KPI
    if( guard( Dialog.Data().Parent().IsDerivedExcludeFromFulfillmentKPI(), false ) )
    {
      feedback := Translations::MP_Designer_DialogProduct_DisableCheckBoxIsExcludedFromFulfillmentKPI()
      CheckBoxIsExcludedFromFulfillmentKPI.DisableWithUserFeedback( feedback ); 
    }
    
    // Disable cost-editing for
    if( isbatchedit )
    {
      TabPageCost.DisableWithUserFeedback( Translations::MP_Designer_DisableTabCostForBatchEdit() );
    }
  *]
}