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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Quintiq file version 2.0
#parent: #root
Method CreateUnit (
  MacroPlan macroplan,
  String newUnitID,
  Unit parentUnit,
  String capacityType
)
{
  Description: 'Create a stocking point  with default values. (UoM=MT, currency = base currency)'
  TextBody:
  [*
    // Create product with default values
    displayIndex := 1;
    isPlannedInfinite := capacityType = GlobalParameters_MP::GetCapacityTypeInfinite();
    hasUserStart := true;
    hasUserEnd := true;
    start := macroplan.Start().Date();
    end := macroplan.End().Date();
    checkUnique := true;
    isFromDB := false;
    minQty := 0.0;
    maxQty := 0.0;
    lotSize := 0.0;
    hasCapacitySmoothing := false;
    isSmoothCapacityOverAllPeriods := false;
    userCapacitySmoothingLength := 0;
    capacitySmoothingPercentageDelta := 0.0;
    hasMaxQty := maxQty > 0.0;
    
    // Feedback messages
    feedback := '';
    sanityfb := '';
    
    // Ensure unit can be created
    unitOfMeasure := select( macroplan, UnitOfMeasure_MP, uom, uom.Name() = 'MT' );
    currency := select( macroplan, Currency_MP, c, c.IsBase() );
    canCreate := Unit::ValidateInput( feedback,
                                      sanityfb,
                                      macroplan,
                                      newUnitID,
                                      newUnitID,
                                      null( Unit ),
                                      parentUnit,
                                      hasUserStart,
                                      start,
                                      hasUserEnd,
                                      end,
                                      capacityType,
                                      unitOfMeasure,
                                      currency,
                                      minQty,
                                      hasMaxQty,
                                      maxQty,
                                      lotSize,
                                      hasCapacitySmoothing,
                                      isSmoothCapacityOverAllPeriods,
                                      userCapacitySmoothingLength,
                                      capacitySmoothingPercentageDelta,
                                      checkUnique );
    if( this.Run().AssertTrue( canCreate, 'Verify unit can be created: ' + feedback ) )
    {
      Unit::Create( macroplan,
                    newUnitID,
                    guard( parentUnit.ID(), '' ),
                    displayIndex,
                    newUnitID,
                    '', /* qtyToProcess */
                    '', /* userIconName */
                    capacityType,
                    currency.ID(),
                    Date::MinDate(), /* start */
                    Date::MaxDate(), /* end */
                    isPlannedInfinite,
                    unitOfMeasure.Name(),
                    '', /* groupName */
                    minQty,
                    maxQty,
                    lotSize,
                    '', /* GIS country */
                    '', /* GIS city */
                    '', /* GIS postal */
                    hasMaxQty,
                    false, /* hasCapacitySmoothing */
                    0,     /* userCapacitySmoothingLength */
                    0.0,   /* capacitySmoothingPercentageDelta */
                    false, /* is overlap capacity smoothing */
                    false, /* is smooth capacity over all periods */
                    'Unit created for UTF',  /* notes */
                    Duration::MinDuration(), /* campaign type duration */
                    false, /* is included in supply specification */
                    false, /* is supplier */
                    false, /* has user frozen */
                    Duration::MinDuration(), /* user frozen duration */
                    false, /* use shift pattern optimization */
                    isFromDB );/* is from db */ 
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}