public static int CalculateProperEqpCount(AssignEqp assignEqp) { WorkStep workStep = assignEqp.WorkStep; int loadedEqpCount = workStep.LoadedEqpCount; DoubleDictionary <Step, object, StepPlan> stepPlans = StepPlanManager.Current.RunPlans; DateTime nowDt = FindHelper.GetNowDT(); foreach (var stepPlan in stepPlans) { if (stepPlan.Step.StepID != workStep.Key.ToString()) { continue; } if (stepPlan.StepTargetList.Count == 0) { continue; } Mozart.SeePlan.DataModel.StepTarget target = stepPlan.StepTargetList.First(); Tuple <string, string, string> key = target.Key as Tuple <string, string, string>; string lineID = key.Item1; string stepID = key.Item2; string prodID = key.Item3; double remainTargetQty = target.CurrentQty; #if DEBUG if (stepID == "S0100" && prodID == "ASSY_A01") { Console.WriteLine(); } #endif TimeSpan remainTime = target.DueDate - nowDt; double remainSec = remainTime.TotalSeconds; int eqpCount = 0; double currAvailableQty = 0d; var loadedEqps = workStep.LoadedEqps; foreach (var loadedEqp in loadedEqps) { if (currAvailableQty >= remainTargetQty) { break; } MicronBEAssyEqp eqp = FindHelper.FindEquipment(loadedEqp.Target.EqpID); double tactTime = GetTactTime(lineID, stepID, prodID, eqp); currAvailableQty += remainSec / tactTime; eqpCount++; } return(eqpCount); } return(0); }
public static bool CanFilterAssignEqp(AssignEqp assignEqp) { MicronBEAssyWorkStep wstep = assignEqp.WorkStep as MicronBEAssyWorkStep; DateTime availableDownTime = wstep.AvailableDownTime; DateTime nowDt = FindHelper.GetNowDT(); if (nowDt < availableDownTime) { return(false); } foreach (var wip in wstep.Wips) { var lot = wip.Lot as MicronBEAssyBELot; if (lot.ReservationEqp != null && lot.ReservationEqp == assignEqp.Target) { return(false); } } return(true); }
/// <summary> /// </summary> /// <param name="x"/> /// <param name="y"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public int COMPARE_ASSIGN_EQP0(AssignEqp x, AssignEqp y, ref bool handled, int prevReturnValue) { try { //int cmp = SimulationHelper.GetNextInTime(x.Target).CompareTo(SimulationHelper.GetNextInTime(y.Target)); var xInTime = x.Target.GetNextInTime(true); var yInTime = y.Target.GetNextInTime(true); int cmp = x.Target.GetNextInTime(true).CompareTo(y.Target.GetNextInTime(true)); if (cmp == 0) { cmp = x.Target.EqpID.CompareTo(y.Target.EqpID); } return(cmp); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(int)); } }
public static DateTime CalculateAvailableDownTime(WorkStep wstep, AssignEqp assignEqp, ref double setupTime) { try { MicronBEAssyWorkStep ws = wstep as MicronBEAssyWorkStep; DateTime nowDt = FindHelper.GetNowDT(); DateTime availableDownTime = nowDt.AddSeconds(wstep.NewUpInterval.TotalSeconds); var wip = ws.Wips.FirstOrDefault(); if (wip == null) { return(availableDownTime); } WorkEqp weqp = null; foreach (var item in ws.LoadedEqps) { if (item.Target == assignEqp.Target) { weqp = item; break; } } var setupControl = ServiceLocator.Resolve <SetupControl>(); var processControl = ServiceLocator.Resolve <ProcessControl>(); var beLot = wip.Lot as MicronBEAssyBELot; bool isNeedSetup = false; setupTime = 0d; ICollection <WorkLot> lastWorkLots = null; if (weqp.Step != null) { lastWorkLots = weqp.Step.Profiles[weqp]; } if (lastWorkLots != null && lastWorkLots.Count != 0) { isNeedSetup = SimulationHelper.IsNeedSetupProfile(weqp, beLot); if (isNeedSetup) { setupTime = SimulationHelper.GetSetupTimeProfile(weqp, beLot).TotalSeconds; } } else { bool _handled = false; isNeedSetup = processControl.IS_NEED_SETUP0(weqp.Target, beLot, ref _handled, false); if (isNeedSetup) { setupTime = setupControl.GET_SETUP_TIME0(weqp.Target, beLot, ref _handled, default(Mozart.Simulation.Engine.Time)).TotalSeconds; } } availableDownTime = availableDownTime.AddSeconds(setupTime); return(availableDownTime); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(DateTime)); } }