/// <summary> /// </summary> /// <param name="entity"/> /// <param name="now"/> /// <param name="target"/> /// <param name="factor"/> /// <param name="ctx"/> /// <returns/> public WeightValue LOT_PRIORITY(Mozart.Simulation.Engine.ISimEntity entity, DateTime now, Mozart.Simulation.Engine.ActiveObject target, Mozart.SeePlan.DataModel.WeightFactor factor, Mozart.SeePlan.Simulation.IDispatchContext ctx) { if (factor.Factor == 0) { return(new WeightValue(0)); } FabAoEquipment eqp = target as FabAoEquipment; FabLot lot = entity as FabLot; if (lot.IsDummy) { return(new WeightValue(0)); } //if (eqp.EqpID == "THOVN300" && eqp.NowDT >= LcdHelper.StringToDateTime("20200113 090018")) // Console.WriteLine("B"); bool isLastPlan = eqp.IsLastPlan(lot); float maxPriority = ctx.Get <int>(Constants.WF_LOT_PRIORITY, SiteConfigHelper.GetDefaultLotPriority()); int lotPriority = lot.Priority; float score = 0f; int workingCnt = lot.DispatchFilterInfo.WorkingEqpCnt; if (isLastPlan == false && workingCnt > 0) { score = 0f; } else { if (maxPriority > 0) { score = 1 - (lotPriority / maxPriority); } //working : score * 2 if (isLastPlan) { score = score * 2; } } string desc = string.Format("[{0}/Max{1}]", lotPriority, maxPriority); return(new WeightValue(score * factor.Factor, desc)); }