예제 #1
0
        private void OnCLEMInitialiseActivity(object sender, EventArgs e)
        {
            this.InitialiseHerd(false, false);

            // get herd to add to
            herdToUse = Resources.GetResourceItem(this, typeof(RuminantHerd), this.PredictedHerdName, OnMissingResourceActionTypes.ReportErrorAndStop, OnMissingResourceActionTypes.ReportErrorAndStop) as RuminantType;

            if (!herdToUse.PricingAvailable())
            {
                Summary.WriteWarning(this, "No pricing is supplied for herd [" + PredictedHerdName + "] and so no pricing will be included with [" + this.Name + "]");
            }
        }
예제 #2
0
        private void OnCLEMInitialiseActivity(object sender, EventArgs e)
        {
            this.InitialiseHerd(false, false);

            // check if labour and warn it is not used for this activity
            labour = Apsim.Children(this, typeof(LabourFilterGroupSpecified)).Cast <LabourFilterGroupSpecified>().ToList(); //  this.Children.Where(a => a.GetType() == typeof(LabourFilterGroupSpecified)).Cast<LabourFilterGroupSpecified>().ToList();
            if (labour != null)
            {
                Summary.WriteWarning(this, "Warning: Labour was supplied for activity [" + this.Name + "] but is not used for Trade activities. Please add labour requirements to the Buy/Sell Activity associated with this trade herd.");
            }

            // get herd to add to
            herdToUse = Resources.GetResourceItem(this, typeof(RuminantHerd), this.PredictedHerdName, OnMissingResourceActionTypes.ReportErrorAndStop, OnMissingResourceActionTypes.ReportErrorAndStop) as RuminantType;

            if (!herdToUse.PricingAvailable())
            {
                Summary.WriteWarning(this, "Warning: No pricing is supplied for herd [" + PredictedHerdName + "] and so no pricing will be included with [" + this.Name + "]");
            }
        }
예제 #3
0
        private void OnCLEMInitialiseActivity(object sender, EventArgs e)
        {
            this.InitialiseHerd(false, false);

            // get herd to add to
            herdToUse = Resources.FindResourceType <RuminantHerd, RuminantType>(this, this.PredictedHerdName, OnMissingResourceActionTypes.ReportErrorAndStop, OnMissingResourceActionTypes.ReportErrorAndStop);

            if (!herdToUse.PricingAvailable())
            {
                Summary.WriteMessage(this, "No pricing is supplied for herd [" + PredictedHerdName + "] and so no pricing will be included with [" + this.Name + "]", MessageType.Warning);
            }

            // check GrazeFoodStoreExists
            grazeStore = "";
            if (GrazeFoodStoreName != null && !GrazeFoodStoreName.StartsWith("Not specified"))
            {
                grazeStore = GrazeFoodStoreName.Split('.').Last();
            }

            // check for managed paddocks and warn if animals placed in yards.
            if (grazeStore == "")
            {
                var ah = this.FindInScope <ActivitiesHolder>();
                if (ah.FindAllDescendants <PastureActivityManage>().Count() != 0)
                {
                    Summary.WriteMessage(this, String.Format("Trade animals purchased by [a={0}] are currently placed in [Not specified - general yards] while a managed pasture is available. These animals will not graze until moved and will require feeding while in yards.\r\nSolution: Set the [GrazeFoodStore to place purchase in] located in the properties [General].[PastureDetails]", this.Name), MessageType.Warning);
                }
            }

            numberToStock = this.FindAllChildren <Relationship>().FirstOrDefault() as Relationship;
            if (numberToStock != null)
            {
                if (grazeStore != "")
                {
                    foodStore = Resources.FindResourceType <GrazeFoodStore, GrazeFoodStoreType>(this, GrazeFoodStoreName, OnMissingResourceActionTypes.ReportErrorAndStop, OnMissingResourceActionTypes.ReportErrorAndStop);
                }
            }
        }