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 ); 
 | 
  *] 
 | 
} 
 |