陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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: #root
StaticMethod Create (
  ProductInStockingPoint_MP owner,
  Period_MP period,
  Boolean isleaf
) as ProductInStockingPointInPeriod
{
  Description: 'Create product in stocking point in period'
  TextBody:
  [*
    pispip:= null( ProductInStockingPointInPeriod )
    
    // Create ProductInStockingPointInPeriod depending on whether the period IsPlanning( isleaf or not ) and IsBase
    if( period.IsPlanning() )
    {
      if( isleaf )
      {
        // Create ProductInStockingPointInPeriod as ProductInStockingPointInPeriodPlanningLeaf type
        pispip:= owner.ProductInStockingPointInPeriod( relnew, ProductInStockingPointInPeriodPlanningLeaf );
      }
      else
      {
        // Create ProductInStockingPointInPeriod as ProductInStockingPointInPeriodPlanningNonLeaf type
        pispip:= owner.ProductInStockingPointInPeriod( relnew, ProductInStockingPointInPeriodPlanningNonLeaf );
      }
    }
    else
    {
      if( period.IsBase() )
      {
        // Create ProductInStockingPointInPeriod as ProductInStockingPointInPeriodNonPlanningBase type
        pispip := owner.ProductInStockingPointInPeriod( relnew, ProductInStockingPointInPeriodNonPlanningBase );
      }
      else
      {
        // Create ProductInStockingPointInPeriod as ProductInStockingPointInPeriodNonPlanningNonBase type
        pispip := owner.ProductInStockingPointInPeriod( relnew, ProductInStockingPointInPeriodNonPlanningNonBase );
      }
    }
    
    // Check if PISPIP is created, if it is created, update relations/attributes
    if( not isnull( pispip ) )
    {
      pispip.Period_MP( relset, period );
      pispip.Start( period.Start() );
      pispip.End( period.End() );
    }
    
    return pispip;
  *]
}