haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
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
Quintiq file version 2.0
#parent: #root
StaticMethod GetCandidates (
  LibOpt_Scope scope
) as owning ProductInStockingPointInPeriodPlannings
{
  TextBody:
  [*
    mp := scope.Run().Optimization().astype( Optimization ).MacroPlan(); 
    periods := scope.GetPeriodInOptimizerRun(); 
    earlieststart := min( periods, Elements, p, true, p.Start() ); 
    lateststart := max(  periods, Elements, p, true, p.Start() ); 
    pispips := selectset(  mp, ProductInStockingPointInPeriodPlanningLeafNonZeroEIS, pispip, true, pispip.Start() >= earlieststart and pispip.Start() <= lateststart ); 
    
    /* for debugging fix an anchor
    pispips := selectset(  mp, StockingPoint_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning.astype(  ProductInStockingPointInPeriodPlanningLeaf ), p, 
                           p.ProductInStockingPoint_MP().Product_MP().Name() = 'FG-2-24-110-4614-12-0' 
                           and p.ProductInStockingPoint_MP().StockingPoint_MP().Name() = '624790'
                           and p.Start().Date() = Date::Construct( 2020, 7, 1 ) ); 
    */
    
    return &pispips;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}