hongji.li
2023-11-11 df5a7e1ad6835e78b2f9eb7428817b0c23b116bc
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: #root
Method ClearSelectedNodes () id:Method_FormSupplyChainVisualization_ClearSelectedNodes
{
  #keys: '[134266.0.2007250899]'
  Body:
  [*
    /*// Clear selected nodes when the user single clicks on other node
    // or clicks on the background
    
    // We have to obtain the products and stocking points to be removed from nav panel
    // we can't just flush nav panel selection because the ones the user selected at
    // the nav panel have to remain intact, we only remove the ones that are selected in SCV
    toBeDeletedProducts := selectset( DataHolderSelectedNodes.Data(),  
                                      Elements.ProductInStockingPointInPeriod.ProductInStockingPoint_MP.Product_MP,
                                      p, true )
    toBeDeletedSPs := selectset( DataHolderSelectedNodes.Data(), 
                                 Elements.ProductInStockingPointInPeriod.ProductInStockingPoint_MP.StockingPoint_MP,
                                 sp, true )
                                 
    products := DataHolderProducts.Data().Difference( toBeDeletedProducts );
    sps := DataHolderStockingPoints.Data().Difference( toBeDeletedSPs );
    
    
    DataHolderProducts.Data( products.Copy() );
    DataHolderStockingPoints.Data( sps.Copy() );
    
    DataHolderSelectedNodes.Data().Flush();
    
    // Make sure the display node is still selected in nav panel even after we clear the selection
    if( DataHolderDisplayPISPIP.Data().Size() > 0 )
    {                   
      DataHolderProducts.Data().Add( DataHolderDisplayPISPIP.Data().Element( 0 ).ProductInStockingPoint_MP().Product_MP() );
      DataHolderStockingPoints.Data().Add( DataHolderDisplayPISPIP.Data().Element( 0 ).ProductInStockingPoint_MP().StockingPoint_MP() );
    }
  *]
}