Kevin Kok Khah Whey
2023-11-07 5ae534ab606e6f2ba5ea60914224d665b0447d5a
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
101
102
103
Quintiq file version 2.0
#parent: #root
FunctionOverride CalcIsValid
{
  TextBody:
  [*
    // Check if all related objects has valid data
    // Starting with the Account, Actual, Campaign, BaseConversionFactor and -RecipeIngredient, Currency, DependentDemand
    // Feedback, Fulfillment, Globalparameters and Group related data
    value := guard( this.Account_MP().IsValidData(), true )
             and guard( this.ActualProductInStockingPointInPeriod().IsValidData(), true )
             and guard( this.ActualUnitPeriod().IsValidData(), true )
             and guard( this.BaseConversionFactor().IsValidData(), true )
             and guard( this.BaseRecipeIngredient().IsValidData(), true )         
             and guard( this.Currency_MP().IsValidData(), true )
             and guard( this.CurrencyRate_MP().IsValidData(), true )
             and guard( this.DependentDemand().IsValidData(), true )
             and guard( this.FeedbackPeriodTaskOperation().IsValidData(), true )
             and guard( this.FeedbackProductInTrip().IsValidData(), true )
             and guard( this.Fulfillment().IsValidData(), true )
             and guard( this.GlobalParameters_MP().IsValidData(), true )
             and guard( this.Group().IsValidData(), true )
             //Check campaign related data
             and guard( this.Campaign_MP().IsValidData(), true )
             and guard( this.CampaignType_MP().IsValidData(), true )
             and guard( this.TransitionType_MP().IsValidData(), true )
             // also check the Ingredient, Inventory and Lane data
             and guard( this.Ingredient().IsValidData(), true )
             and guard( this.InventoryValueAndCost().IsValidData(), true )
             and guard( this.InventorySpecification().IsValidData(), true )
             and guard( this.SafetyStock().IsValidData(), true )
             and guard( this.InventorySupply().IsValidData(), true )
             and guard( this.InventorySupplyCost().IsValidData(), true )
             and guard( this.Lane().IsValidData(), true )
             and guard( this.LaneLeg().IsValidData(), true )
             and guard( this.LaneCost().IsValidData(), true )
             and guard( this.LaneLegCost().IsValidData(), true )
             // we shouldn't forget MacroPlan itself, nor the Period, PISP, Postponed and Priority data
             and guard( this.MacroPlan().IsValidData(), true )
             and guard( this.PeriodSpecification_MP().IsValidData(), true )
             and guard( this.PeriodTaskOperation().IsValidData(), true )
             and guard( this.PISPAccount().IsValidData(), true )
             and guard( this.PISPSpecification().IsValidData(), true )
             and guard( this.PostponedSalesDemandCost().IsValidData(), true )
             and guard( this.PostponementSpecification().IsValidData(), true )
             and guard( this.Priority().IsValidData(), true )
            // Product related data 
             and guard( this.Product_MP().IsValidData(), true )
             and guard( this.ProductValueAndCost().IsValidData(), true )
             and guard( this.ProductInLane().IsValidData(), true )
             and guard( this.ProductInStockingPoint_MP().IsValidData(), true )
             and guard( this.PISPIPSanityCheckAttribute().ProductInStockingPointInPeriodPlanning().IsValidData(), true )
             and guard( this.ProductInTrip().IsValidData(), true )
             and guard( this.ProductLevel_MP().IsValidData(), true )
            // Also check Recipe, Routing and RoutingStep data
             and guard( this.Recipe().IsValidData(), true )
             and guard( this.RecipeWithEffectiveDate().IsValidData(), true )
             and guard( this.Routing().IsValidData(), true )
             and guard( this.RoutingStep().IsValidData(), true )
            // various operation related data
             and guard( this.Operation().IsValidData(), true )
             and guard( this.OperationCost().IsValidData(), true )
             and guard( this.OperationInCampaignType().IsValidData(), true )
             and guard( this.OperationInput().IsValidData(), true )
             and guard( this.OperationInputGroup().IsValidData(), true )
             and guard( this.OperationInputSet().IsValidData(), true )
             and guard( this.OperationLink().IsValidData(), true )
             and guard( this.OperationOutput().IsValidData(), true )
             // SalesDemand, -Level and -segment. But also ShiftDay and -Pattern
             and guard( this.SalesDemandBase().IsValidData(), true )
             and guard( this.SalesLevel_MP().IsValidData(), true )
             and guard( this.SalesSegment_MP().IsValidData(), true )
             and guard( this.ShiftDay().IsValidData(), true )
             and guard( this.ShiftPattern().IsValidData(), true )
             // A wide variety of StockingPoint data is also checked
             and guard( this.StockingPoint_MP().IsValidData(), true )
             and guard( this.StockingPointInLane().IsValidData(), true )
             and guard( this.StockingPointCost().IsValidData(), true )
             and guard( this.StockingPointAccount().IsValidData(), true )
             and guard( this.StockingPointCapacity().IsValidData(), true )
             and guard( this.StockingPointInPeriod().IsValidData(), true )
             and guard( this.StockingPointUnit().IsValidData(), true )
             // As is SupplySpecification, ServiceLevel, FullFillmentTarget, Transport and trip data
             and guard( this.SupplySpecification().IsValidData(), true )
             and guard( this.ServiceLevel().IsValidData(), true )
             and guard( this.FulfillmentTarget().IsValidData(), true )
             and guard( this.TransportCapacity().IsValidData(), true )
             and guard( this.TransportAvailability().IsValidData(), true )
             and guard( this.Trip().IsValidData(), true )
            // fianlly, the unit data is checked
             and guard( this.Unit().IsValidData(), true )
             and guard( this.UnitCost().IsValidData(), true )
             and guard( this.UnitAccount().IsValidData(), true )
             and guard( this.UnitAvailability().IsValidData(), true )
             and guard( this.UnitCalendarElement().IsValidData(), true )
             and guard( this.UnitCapacity().IsValidData(), true )
             and guard( this.UnitOfMeasure_MP().IsValidData(), true )
             and guard( this.FulfillmentRestriction().IsValidData(), true )
             and guard( this.SubsetInOptimizerPuzzle().IsValidData(), true );
    
    this.IsValid( value );
  *]
}