admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
55
56
57
58
59
60
Quintiq file version 2.0
#parent: #root
Method InitializeProductInStockingPoint
{
  Description: 'Create product in stocking point from sales demand, inventory supply, inventory specification, lane, disaggregation factors'
  TextBody:
  [*
    // Create product in stocking point from sales demand, inventory supply, inventory specification, lane, disaggregation factors
    // Get all related PISP combination strings
    salesdemandpisps := this.GetSalesDemandPISP();
    disaggregationfactorpisps := this.GetDisaggregationFactorPISP();
    inventoryvaluepisps := this.GetInventoryValueAndCostPISP();
    inventoryspecificationpisps := this.GetInventorySpecificationPISP();
    inventorysupplypisps := this.GetInventorySupplyPISP();
    lanepisps := this.GetLanePISP();
    specificationpisps := this.GetSpecificationPISP();
    dsdippisps := this.GetDisaggregratedSDIPPISP();
    actualpisps := this.GetActualPISP();
    safetystockpisps := this.GetSafetyStockPISP();
    
    // Union all previously selected PISP combination strings into one set
    pisp := salesdemandpisps.Union( disaggregationfactorpisps );
    pisp := pisp.Union( inventoryvaluepisps );
    pisp := pisp.Union( inventoryspecificationpisps );
    pisp := pisp.Union( inventorysupplypisps );
    pisp := pisp.Union( lanepisps );
    pisp := pisp.Union( specificationpisps );
    pisp := pisp.Union( dsdippisps );
    pisp := pisp.Union( actualpisps );
    pisp := pisp.Union( safetystockpisps );
    
    // Remove duplicated elements in the set
    pisp := pisp.Unique();
    
    // Traverse the set of selected PISP combination strings
    traverse( pisp, Elements, p )
    {
      // Tokenize the string
      pispStrs := p.Tokenize( ";" );
    
      // Check if the string is tokenize into 2 elements
      if( pispStrs.Size() = 2 )
      {
        // Get ProductID and StockingPointID from the tokenize string
        productId := pispStrs.Element( 0 );
        stockingpointId := pispStrs.Element( 1 );
    
        // Find Product_MP
        product := Product_MP::FindProductTypeIndex( productId );
    
        // Check if Product_MP is found, if it is found, add it to StockingPoint_MP
        // to create ProductInStockingPoint_MP
        if( not isnull( product ) )
        {
          product.AddToStockingPoint( stockingpointId );
        }
      }
    }
  *]
}