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
Quintiq file version 2.0
#parent: #root
Method GetIncludedRoutings (
  Units includedunits,
  ProductInStockingPoint_MPs includedPISP
) as owning Routings
{
  Description: 'Get Operations that are in the scope of the optimizer puzzle ( product and sp included )'
  TextBody:
  [*
    // Get Process in optimizer puzzle scope
    routings := construct( Routings );
    
    if( this.IsWorld() )
    {
      routings := this.MacroPlan().Routing( relget );
    }
    else
    {                      
      // Include Routing IF AND ONLY IF
      // ALL UNIT and PISP Output of the Routing are included
      // WIP should be followed  
    
      routings := selectset( this.MacroPlan(), Routing, routing,
                             forall( routing, OperationOutput, oo,                             // Using for all at OO level to check both condition all together
                                     includedunits.Find( oo.Operation().Unit() ) > -1          // Check if units is in
                                     and ( oo.ProductInStockingPoint_MP().IsSystem()           // If units is in and is WIP, skip pisp check
                                           or ( not oo.ProductInStockingPoint_MP().IsSystem()  // If is output bom, chcek PISP
                                                and includedPISP.Find( oo.ProductInStockingPoint_MP() ) > -1 ) ) ) );     
                
    }
    
    return &routings;
  *]
}