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
26
27
28
29
30
31
32
33
34
35
36
37
Quintiq file version 2.0
#parent: #root
Method SetSupply (
  String supplyInfo,
  MacroPlan macroplan
)
{
  TextBody:
  [*
    // Find pisp, plan inventory supply
    i := 1;
    traverse( supplyInfo.Tokenize( String::NewLine() ), Elements, supply_info )
    {
      // For each line, create inventory supply with same start and manufactured date
      infos := supply_info.Tokenize( ',' );
      p     := infos.Element( 0 ).TrimBoth();
      sp    := infos.Element( 1 ).TrimBoth();
      start := this.ConvertToDateTime( infos.Element( 2 ), macroplan );
      qty   := this.ConvertToReal( infos.Element( 3 ) );
    
      // Find exact product in stocking point in planning period
      pisp  := select( macroplan, Product_MP.ProductInStockingPoint_MP, e, e.ProductID() = p, e.StockingPointID() = sp );
      
      // Plan inventory supply
      InventorySupply::Create( macroplan.IDHolder().GetInventorySupplyID(),
                               pisp.Product_MP(),
                               pisp.StockingPoint_MP(),
                               start.Date(),
                               start.Date(),
                               qty,
                               "UTF - Test supply - " + [String]i,
                               false );
      i++;
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}