/// <summary> /// </summary> /// <param name="entity"/> /// <returns/> public bool OnAfterLoad_Equipment(Equipment entity) { try { MicronBEAssyEqp eqp = new MicronBEAssyEqp(); eqp.Init(entity.EQP_ID, FindHelper.GetEngineStartTime(), FindHelper.GetEngineStartTime(), entity.SIM_TYPE); eqp.LineID = entity.LINE_ID; eqp.EqpID = entity.EQP_ID; string stepGroup = string.Empty; //eqp.StepGroup = UtilityHelper.StringToEnum(entity.STEP_GROUP, StepGroup.NONE); eqp.EqpModel = entity.EQP_MODEL; eqp.UtilRate = (double)entity.UTIL_RATE; eqp.DispatchingRule = entity.DISPATCHING_TYPE; if (InputMart.Instance.MicronBEAssyEqp.ContainsKey(eqp.EqpID) == false) { InputMart.Instance.MicronBEAssyEqp.Add(eqp.EqpID, eqp); } return(false); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(false); } }
public static MicronBEAssyEqp FindEquipment(string eqpID) { MicronBEAssyEqp eqp = null; InputMart.Instance.MicronBEAssyEqp.TryGetValue(eqpID, out eqp); return(eqp); }
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 IsNeedSetupProfile(WorkEqp weqp, IHandlingBatch hb) { try { MicronBEAssyEqp eqp = null; if (InputMart.Instance.MicronBEAssyEqp.ContainsKey(weqp.Target.EqpID)) { eqp = InputMart.Instance.MicronBEAssyEqp[weqp.Target.EqpID]; } if (eqp == null) { return(false); } MicronBEAssyBELot lot = hb as MicronBEAssyBELot; BEStep step = lot.CurrentStep; StepMaster sm = InputMart.Instance.StepMasterView.FindRows(step.StepID).FirstOrDefault(); if (sm == null) { return(false); } foreach (var info in InputMart.Instance.SetupInfo.DefaultView) { if (info.LINE_ID != eqp.LineID) { continue; } //if (UtilityHelper.StringToEnum(info.STEP_GROUP, StepGroup.NONE) != eqp.StepGroup) // continue; //if (LikeUtility.Like(eqp.EqpModel, info.EQP_MODEL) == false) // continue; SetupType type = SimulationHelper.CheckSetupProfile(weqp, hb); if (type != SetupType.NONE) { return(true); } else { return(false); } } return(false); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(false); } }
public static Time GetSetupTimeProfile(WorkEqp weqp, IHandlingBatch hb) { try { MicronBEAssyEqp eqp = null; if (InputMart.Instance.MicronBEAssyEqp.ContainsKey(weqp.Target.EqpID)) { eqp = InputMart.Instance.MicronBEAssyEqp[weqp.Target.EqpID]; } if (eqp == null) { return(default(Time)); } MicronBEAssyBELot lot = hb as MicronBEAssyBELot; BEStep step = lot.CurrentStep; StepMaster sm = InputMart.Instance.StepMasterView.FindRows(step.StepID).FirstOrDefault(); foreach (var info in InputMart.Instance.SetupInfo.DefaultView) { if (info.LINE_ID != sm.LINE_ID) { continue; } //if (UtilityHelper.StringToEnum(info.STEP_GROUP, StepGroup.NONE) != eqp.StepGroup) // continue; //if (LikeUtility.Like(eqp.EqpModel, info.EQP_MODEL) == false) // continue; double setupTimeBySec = (double)info.SETUP_TIME; return(Time.FromSeconds(setupTimeBySec)); } return(default(Time)); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(Time)); } }
public static double GetTactTime(string lineID, string stepID, string productID, MicronBEAssyEqp eqp) { try { Tuple <string, string, string> key = Tuple.Create(lineID, stepID, productID); double tactTime = 0d; if (InputMart.Instance.TactTimeCache.TryGetValue(key, out tactTime)) { return(tactTime); } else { foreach (StepTime st in InputMart.Instance.StepTime.DefaultView) { if (st.LINE_ID != lineID) { continue; } if (st.STEP_ID != stepID) { continue; } if (LikeUtility.Like(eqp.EqpID, st.EQP_ID) == false) { continue; } if (LikeUtility.Like(productID, st.PRODUCT_ID) == false) { continue; } tactTime = (double)st.TACT_TIME; break; } InputMart.Instance.TactTimeCache.Add(key, tactTime); return(tactTime); } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(double)); } }
/// <summary> /// </summary> /// <param name="weqp"/> /// <param name="wlot"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public TimeSpan GET_TACT_TIME0(WorkEqp weqp, WorkLot wlot, ref bool handled, TimeSpan prevReturnValue) { try { MicronBEAssyWorkLot lot = wlot as MicronBEAssyWorkLot; double unitQty = (wlot.Batch as MicronBEAssyBELot).UnitQtyDouble; MicronBEAssyBELot beLot = wlot.Batch as MicronBEAssyBELot; var setupControl = ServiceLocator.Resolve <SetupControl>(); var processControl = ServiceLocator.Resolve <ProcessControl>(); MicronBEAssyEqp eqp = FindHelper.FindEquipment(weqp.Target.EqpID); double tactTime = SimulationHelper.GetTactTime(beLot.LineID, lot.Step.StepID, lot.Product.ProductID, eqp); if (beLot.CurrentStepID != weqp.Step.Key.ToString()) { return(TimeSpan.FromSeconds(tactTime * unitQty)); } #if DEBUG //if (lot.LotID == "LOT10_3") // Console.WriteLine(); //if (FindHelper.GetNowDT().Hour == 22 && FindHelper.GetNowDT().Minute == 30) // Console.WriteLine(); var nowDt = FindHelper.GetNowDT(); if (lot.LotID == "LOT10_9" && lot.Step.Key.ToString() == "S0300" && weqp.Target.EqpID == "DA01" && nowDt >= new DateTime(2018, 01, 26, 12, 00, 00)) { Console.WriteLine(); } #endif bool isNeedSetup = false; double setupTime = 0d; var 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; } } double tactTimeWithSetup = setupTime + (tactTime * unitQty); return(TimeSpan.FromSeconds(tactTimeWithSetup)); //return TimeSpan.FromSeconds(tactTime); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(TimeSpan)); } }
/// <summary> /// </summary> /// <param name="wstep"/> /// <param name="wlot"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public WorkLot UPDATE0(WorkStep wstep, WorkLot wlot, ref bool handled, WorkLot prevReturnValue) { try { MicronBEAssyBELot lot = wlot.Batch as MicronBEAssyBELot; bool isRun = JobChangeHelper.IsRun(lot); DateTime availableTime = FindHelper.GetNowDT(); MicronBEAssyEqp eqp = FindHelper.FindEquipment(lot.CurrentPlan.ResID); double tactTime = SimulationHelper.GetTactTime(lot.LineID, lot.CurrentStepID, lot.Product.ProductID, eqp); StepTat stepTat = FindHelper.FindTAT(lot.Product.ProductID, lot.CurrentStepID, lot.LineID); if (isRun) { #if DEBUG //var nowDt = FindHelper.GetNowDT(); if (lot.LotID == "LOT11_1" && lot.CurrentStepID == "S0200") { Console.WriteLine(); } //if (nowDt >= new DateTime(2018, 06, 12, 11, 40, 00)) // Console.WriteLine(); #endif double runTat = stepTat == null ? 0 : (double)stepTat.RUN_TAT; #if DEBUG if (runTat > 0) { Console.WriteLine(); } #endif availableTime = availableTime.AddSeconds(tactTime * lot.UnitQtyDouble + runTat); } else { double waitTat = stepTat == null ? 0 : (double)stepTat.WAIT_TAT; #if DEBUG if (waitTat > 0) { Console.WriteLine(); } #endif availableTime = availableTime.AddSeconds(waitTat); } AoEquipment reservationEqp = isRun ? null : lot.ReservationEqp; MicronBEAssyWorkLot newWorkLot = CreateHelper.CreateWorkLot(wlot.Batch, availableTime, wstep.Key, wstep.Steps[0], reservationEqp); return(newWorkLot); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(WorkLot)); } }