yypsybs
2023-09-09 3cb5a54def670d97301f07170fcaad213bfc54f2
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
Quintiq file version 2.0
#parent: #root
Method SynchronizeOutputPISP (
  Boolean isfromdb
)
{
  Description: 'Synchronize output pisp, create if it is not exist yet.'
  TextBody:
  [*
    // DWE2 Feb-2-2016 (created)
    
    sourceunit := this.AsSourceOperation().Unit();
    macroplan := this.MacroPlan();
    
    // Create WIP stocking point
    // E.g WIP - Unit 1
    step := this.AsSourceOperation().RoutingStep();
    routing := step.Routing();
    
    spid := macroplan.IDHolder().GetWIPStockingPointID( sourceunit.ID() );
    stockingpoint := StockingPoint_MP::FindCreateUpdate( macroplan,
                                                         spid,
                                                         sourceunit,
                                                         routing,
                                                         isfromdb );
    
    // Set stocking point as system created
    stockingpoint.SetAsSystemCreated();
    
    
    // Link SP to Units I/O
    stockingpoint.LinkToUnit( sourceunit, false );
    
    // Crete WIP product
    // E.g Routing - Step 1 - Unit
    productid := this.MacroPlan().IDHolder().GetWIPProductID( routing.ID(),
                                                              step.Name(),
                                                              sourceunit.ID(),
                                                              this.SourceGroupID() );
    
    product := Product_MP::FindCreateUpdate( macroplan,
                                             productid,
                                             sourceunit,
                                             isfromdb );
    
    // Set product as system created
    product.SetAsSystemCreated();
    
    // Assign product to stocking point
    pisp := product.AddToStockingPoint( stockingpoint );
    
    // Update the product & stocking point id to be derrive by operation output
    this.UpdateProductInStockingPoint( pisp.ProductID(), pisp.StockingPointID() );
  *]
}