yanweiyuan3
2023-10-27 d1d15b61dfcf7fd0f800b32359f082cf580ed556
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
Quintiq file version 2.0
#parent: #root
Method SetWarning () id:Method_DialogRunOptimizer_SetWarning
{
  #keys: '[136682.0.2062013298]'
  Body:
  [*
    //Set warning
    inbound := guard( not DataHolderSelectedStrategy.Data().IsBounded(), false );
    invalidkpiweight := guard( not DataHolderSelectedStrategy.Data().IsValidKPIWeight(), false );
    invalidkpi := guard( not DataHolderSelectedStrategy.Data().IsValidKPIUsed(), false );
    procminqtyissue := exists( DataHolderSelectedStrategy.Data(), KPIWeight, kpiw, true, kpiw.KPIName() = Translations::MP_GlobalParameters_KPIProcessMinimumQuantity() and kpiw.Level() > 1 );      
    isvisible := inbound or invalidkpiweight or invalidkpi or procminqtyissue;
    
    
    text :="";
    if ( inbound )
    {
      text := Translations::MP_Designer_InboundStrategy_Warning();
    }
    else if( invalidkpiweight )
    {
      invalidkpiweightname := guard( select( DataHolderSelectedStrategy.Data(), InvalidKPIWeight, kpiweight, true ).KPIName(), "" )
      text := Translations::Strategy_CanCopy_IsKPIWeightOK( invalidkpiweightname );
    }
    else if( invalidkpi )
    {
      invalidkpiname := guard( select( DataHolderSelectedStrategy.Data(), KPIWeight, kpiweight, true, not kpiweight.IsValidKPIUsedByOptimizer() ).KPIName(), "" )
      text := Translations::SM_KPIWeight_KPINotUsedByOptimizer( invalidkpiname ); 
    }
    else if ( procminqtyissue ) 
    {
      text := Translations::MP_Designer_ProcessMinQtyWarning(); 
    }
    
    ButtonWarning.Tooltip( text );
    ButtonWarning.Visible( isvisible );
  *]
}