chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
53
54
Quintiq file version 2.0
#parent: #root
StaticMethod UpdateFirstLastPISPIP (
  ProductInStockingPoint_MP pisp,
  Period_MP firstperiod,
  Period_MP lastperiod
)
{
  TextBody:
  [*
    /*
    firstpispip := select(  pisp, ProductInStockingPointInPeriodPlanning, pispip, true, pispip.Period_MP() = firstperiod ).astype( ProductInStockingPointInPeriodPlanningLeaf ); 
    lastpispip := select(  pisp, ProductInStockingPointInPeriodPlanning, pispip, true, pispip.Period_MP() = lastperiod ).astype( ProductInStockingPointInPeriodPlanningLeaf ); 
    
    
    pisp.FirstPISPIPRectangleMeta( relset, firstpispip ); 
    pisp.LastPISPIPRectangleMeta( relset, lastpispip ); 
    if ( isnull( firstpispip ) or isnull( lastpispip ) ) 
    {
      debuginfo(  firstperiod.Start(), firstperiod.End(), firstperiod.IsPlanning() ); 
      debuginfo(  lastperiod.Start(), lastperiod.End(), lastperiod.IsPlanning() ); 
      debuginfo(  pisp.Name() ); 
    
      debuginfo(  guard( [String]firstpispip.Key(), 'null key' ), guard( [String]lastpispip.Key(), 'null key' ) ); 
    }
    
    */
    
    firstpispip := pisp.FirstPlanningPISPIP(); 
    first := firstperiod.Start(); 
    while(  not isnull( firstpispip ) and firstpispip.Start() < first ) 
    {
      firstpispip := firstpispip.NextPlanningPISPIP(); 
    }
    firstp := firstpispip.astype( ProductInStockingPointInPeriodPlanningLeaf ); 
    
    lastpispip := pisp.LastPlanningPISPIP(); 
    last := lastperiod.Start(); 
    while(  not isnull( lastpispip ) and lastpispip.Start() > last ) 
    {
      lastpispip := lastpispip.PreviousPlanningPISPIP(); 
    }
    lastp := lastpispip.astype(  ProductInStockingPointInPeriodPlanningLeaf ); 
    
    pisp.FirstPISPIPRectangleMeta( relset, firstp ); 
    pisp.LastPISPIPRectangleMeta( relset, lastp );
    if ( isnull( firstp) or isnull( lastp ) ) 
    {
      debuginfo(  guard( [String]firstpispip.Key(), 'null key' ), guard( [String]lastpispip.Key(), 'null key' ) ); 
      debuginfo( 'firstp null=', isnull( firstp), 'lastp null=', isnull( lastp ) ); 
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}