yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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 DoStartSituation (
  MacroPlan macroplan
)
{
  Description:
  [*
    ADSO-10937 Test case precondition: Add additional parameters for blending test.
    1. Create Product Apple under Flavoring
    2. Create Product Orange under Flavoring
    3. Create Product Apple & Orange 12pk under Greek
    4. Create Routing sourcing Apple
    5. Create Routing sourcing Orange
    6. Create Routing product Apple & Orange 12pk from Apple and Orange.
  *]
  TextBody:
  [*
    // Routing for copying
    routingDEPurchaseBlueberry := select( macroplan, Routing, r, r.ID() = 'DE Purchase Blueberry' );
    // Unit and stocking points involved
    rawMaterialWarehouse := macroplan.FindStockingPoint( 'DE Warehouse Raw Material' );
    finishedGoodsWarehouse := macroplan.FindStockingPoint( 'DE Warehouse' );
    productionUnit := macroplan.FindUnit( 'DE Finishing' );
    routingName := 'Apple & Orange 12pk - UTF'
    this
    // Create Apple under Flavoring
    ->CreateProduct( macroplan, 'Apple', 'Flavoring' )
    // Create Orange under Flavoring
    ->CreateProduct( macroplan, 'Orange', 'Flavoring' )
    // Create Apple & Orange under Finished goods - Greek
    ->CreateProduct( macroplan, 'Apple & Orange 12pk', 'Greek' )
    // Copy DE Purchase Blueberry, edit output sourcing Routing for Apple
    ->CopyThenCreateSourcingRouting( macroplan, routingDEPurchaseBlueberry, 'A DE Purchase Apple', 'Apple', 'DE Warehouse Raw Material' )
    // Copy DE Purchase Blueberry, edit output sourcing Routing for Orange
    ->CopyThenCreateSourcingRouting( macroplan, routingDEPurchaseBlueberry, 'A DE Purchase Orange', 'Orange', 'DE Warehouse Raw Material' )
    // Create routing DE Apple & Orange 12pk
    // Operation: DE Finishing
    ->( this )
    {
      apple := macroplan.FindProduct( 'Apple' );
      orange := macroplan.FindProduct( 'Orange' );
      finishedGood := macroplan.FindProduct( 'Apple & Orange 12pk' );
      rawMaterials := construct( Product_MPs ).Union( apple ).Union( orange );
      this.CreateProductionRoutingWithCost( productionUnit, 
                                            routingName, 
                                            100.0, 
                                            rawMaterials, // Raw materials
                                            rawMaterialWarehouse, 
                                            finishedGood, // Finish goods
                                            finishedGoodsWarehouse )
    }
    ->Exception()
    ->( e )
    {
      this.Run().RegisterFailure( e.Message() )
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}