limj
2023-10-24 93652435728de839582440eefd5122c281181d35
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
Quintiq file version 2.0
#parent: MatrixEditorProductPlanning
Response OnEndEdit (
  structured[ProductInStockingPointInPeriod] cell,
  structured[internal[MatrixEditorCell]] newvalue
) id:Response_FormProductPlanningMatrix_MatrixEditorProductPlanning_OnEndEdit
{
  #keys: '[132448.0.56969954]'
  Body:
  [*
    //Smart plan with user qty
    pispipPlannings := selectset( cell, Elements.astype( ProductInStockingPointInPeriodPlanning ), pispipPlanning, true )                              
    Form.UpdatePISPIPValues( pispipPlannings, newvalue );
    
    ApplicationLibMacroPlanner.RefreshFormSupplyPlanWebClient();
    this.EndEdit( false );
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_MatrixEditor_OnEndEdit'
  Precondition:
  [*
    //Check 2 conditions:
    //1 - whether the selected attribute can be edited
    //2 - whether the params and profiles are there
    //3 - if editing supply qty, check if optimizer can be executed
    attributes := selectvalues( newvalue, Elements, e, true, e.AttributePath() );
    isSupply_o := false;
    cond := ProductInStockingPointInPeriod::CanEnterSupplyQuantity( feedback, cell, attributes, isSupply_o ); 
    
    // Only check for condition 2 if editing supplyQuantity
    if( cond )
    {
      if( isSupply_o )
      {
        periods := selectset( cell, Elements.Period_MP, period, true );
        cond := Form.CheckExistParamAndProfile( feedback,
                                                cell.Element( 0 ), // pispip
                                                /* User [Real] instead of ApplicationMacroPlanner.FormatStringToReal
                                                   MatrixEdiot will do the format internaly to match the server locale
                                                   and it only allow Real for cell bind to Real attribute */
                                                [Real]newvalue.Element( 0 ).NewValue() )
                and ScenarioManager::CanStartSmartPlan( ScenarioManager,
                                                        DataHolderActiveScenario.Data(),
                                                        true,
                                                        periods,
                                                        feedback );
      }     
    }
    
    return cond;
  *]
}