private bool IsMatchedEqpPlan(EqpPlan info, DateTime fromTime, DateTime toTime, IList <string> eqpGroupList, string targetEqpPattern) { if (info == null) { return(false); } if (info.START_TIME >= toTime) { return(false); } if (info.END_TIME <= fromTime) { return(false); } if (eqpGroupList != null) { if (eqpGroupList.Contains(info.EQP_GROUP_ID) == false) { return(false); } } if (string.IsNullOrEmpty(targetEqpPattern) == false) { if (StringHelper.Like(info.EQP_ID, targetEqpPattern) == false) { return(false); } } return(true); }
public EqpPlanItem(EqpPlan row) { this.LineID = row.LINE_ID; this.ProductID = row.PRODUCT_ID; this.ProcessID = row.PROCESS_ID; this.StepID = row.STEP_ID; this.STEP_GROUP = row.STEP_GROUP; this.EqpID = row.EQP_ID; this.LotID = row.LOT_ID; this.StartTime = row.START_TIME; this.EndTime = row.END_TIME; this.Qty = Convert.ToDouble(row.QTY); this.Status = this.Status; }
private bool IsMatched_Plan(EqpPlan item, EqpState state, bool isFilterIDLE) { var fromTime = this.FromTime; var toTime = this.ToTime; //상태시작시간 DateTime startTime = item.START_TIME.GetValueOrDefault(toTime); if (startTime >= toTime) { return(false); } //상태종료시간 DateTime endTime = item.END_TIME.GetValueOrDefault(toTime); if (endTime <= fromTime) { return(false); } //PlanStartTime보다 EqpPlanStart가 작을 경우 (초기Run재공) if (startTime < fromTime) { startTime = fromTime; } //PlanEndTime보다 Lot의 EndTime이 작을 경우 if (endTime > toTime) { endTime = toTime; } //ProcessedTime is zero if (startTime >= endTime) { return(false); } if (isFilterIDLE) { //IDLE, IDLERUN if ((state == EqpState.IDLE || state == EqpState.IDLERUN)) { return(false); } } return(true); }
public static void UpdateEqpPlanQty(MicronBEAssyBELot lot, string eqpID, string status, double qty) { try { string key = SimulationHelper.GetEqpPlanKey(lot, eqpID, status); EqpPlan eqpPlan = null; if (InputMart.Instance.EqpPlans.TryGetValue(key, out eqpPlan)) { eqpPlan.QTY = Convert.ToDecimal(qty); } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
private List <ResultItem> GetResultItemList(DateTime startTime, DateTime endTime, Dictionary <IComparable, EqpPlan> eqpPlanMappings, Dictionary <IComparable, StepTarget> stepTargetMappings) { var result = this._expDataContext.Result(this._result.Name); var list = new List <ResultItem>(); var keys = eqpPlanMappings.Keys.Union(stepTargetMappings.Keys).Distinct(); foreach (var key in keys) { Tuple <string, string, string, string, DateTime> tuple = key as Tuple <string, string, string, string, DateTime>; ResultItem item = new ResultItem(); StepTarget stepTarget = null; EqpPlan eqpPlan = null; DateTime date = tuple.Item5; if (stepTargetMappings.TryGetValue(tuple, out stepTarget)) { item.TargetQty = Convert.ToDouble(stepTarget.OUT_QTY); } if (eqpPlanMappings.TryGetValue(tuple, out eqpPlan)) { item.PlanQty = Convert.ToDouble(eqpPlan.QTY); } var prodMaster = this.FindProductMaster(tuple.Item1, tuple.Item2); var procStep = this.FindProcessStep(tuple.Item1, tuple.Item3, tuple.Item4); item.LineID = prodMaster.LINE_ID; item.DesignID = prodMaster.DESIGN_ID; item.ProductID = prodMaster.PRODUCT_ID; item.ProcessID = prodMaster.PROCESS_ID; item.StepID = procStep.STEP_ID; item.Sequence = procStep.SEQUENCE; item.Date = date.DbToString().Substring(0, 11); item.MaterialGroup = prodMaster.MATERIAL_GROUP; item.PkgFamily = prodMaster.PKG_FAMILY; item.PkgType = prodMaster.PKG_TYPE; list.Add(item); } return(list); }
public static int ComparerEqpPlan(EqpPlan x, EqpPlan y) { if (object.ReferenceEquals(x, y)) { return(0); } int cmp = string.Compare(x.EQP_ID, y.EQP_ID); if (cmp == 0) { DateTime x_START_TIME = x.START_TIME.GetValueOrDefault(); DateTime y_START_TIME = y.START_TIME.GetValueOrDefault(); cmp = DateTime.Compare(x_START_TIME, y_START_TIME); } return(cmp); }
private bool IsMatchedEqpPlan(EqpPlan info, DateTime fromTime, DateTime toTime, HashSet <string> prodList, HashSet <string> stepList, IList <string> toolList) { if (info == null) { return(false); } if (info.START_TIME >= toTime) { return(false); } if (info.END_TIME <= fromTime) { return(false); } if (prodList != null) { if (prodList.Contains(info.PRODUCT_ID) == false) { return(false); } } if (stepList != null) { if (stepList.Contains(info.STEP_ID) == false) { return(false); } } if (toolList != null) { if (toolList.Contains(info.TOOL_ID) == false) { return(false); } } return(true); }
private Dictionary <IComparable, EqpPlan> GetEqpPlanMappings(DateTime startTime, DateTime endTime, string timeUnit) { var result = this._expDataContext.Result(this._result.Name); var eqpPlans = result.EqpPlan; Dictionary <IComparable, EqpPlan> eqpPlanMappings = new Dictionary <IComparable, EqpPlan>(); foreach (var item in eqpPlans) { if (startTime > item.START_TIME) { continue; } if (endTime < item.END_TIME) { continue; } if (item.STATUS != Constants.BUSY) { continue; } if (this._selectedLineIDSet.Contains(item.LINE_ID) == false) { continue; } //if (this._selectedDesignIDSet.Contains(item.DESIGN_ID) == false) // continue; if (this._selectedProdIDSet.Contains(item.PRODUCT_ID) == false) { continue; } EqpPlan plan = null; DateTime date = DateTime.MinValue; if (timeUnit == Constants.DAY) { date = item.END_TIME.StartTimeOfDayT(); } if (timeUnit == Constants.SHIFT) { date = item.END_TIME.ShiftStartTimeOfDayT(); } if (timeUnit == Constants.HOUR) { date = new DateTime(item.END_TIME.Year, item.END_TIME.Month, item.END_TIME.Day, item.END_TIME.Hour, 00, 00); } var key = Tuple.Create(item.LINE_ID, item.PRODUCT_ID, item.PROCESS_ID, item.STEP_ID, date); if (eqpPlanMappings.TryGetValue(key, out plan)) { plan.QTY += item.QTY; } else { eqpPlanMappings[key] = item; } } for (DateTime dateTime = startTime.StartTimeOfDayT(); dateTime <= endTime;) { foreach (var item in eqpPlans) { if (startTime > item.START_TIME) { continue; } if (endTime < item.END_TIME) { continue; } if (item.STATUS != Constants.BUSY) { continue; } if (this._selectedLineIDSet.Contains(item.LINE_ID) == false) { continue; } //if (this._selectedDesignIDSet.Contains(item.DESIGN_ID) == false) // continue; if (this._selectedProdIDSet.Contains(item.PRODUCT_ID) == false) { continue; } var key = Tuple.Create(item.LINE_ID, item.PRODUCT_ID, item.PROCESS_ID, item.STEP_ID, dateTime); EqpPlan find = null; if (eqpPlanMappings.TryGetValue(key, out find) == false) { EqpPlan dummyPlan = new EqpPlan(); dummyPlan.LINE_ID = item.LINE_ID; dummyPlan.PRODUCT_ID = item.PRODUCT_ID; dummyPlan.PROCESS_ID = item.PROCESS_ID; dummyPlan.STEP_ID = item.STEP_ID; dummyPlan.QTY = 0; eqpPlanMappings[key] = dummyPlan; } } if (timeUnit == Constants.DAY) { dateTime = dateTime.AddDays(1); } if (timeUnit == Constants.SHIFT) { dateTime = dateTime.AddHours(8); } if (timeUnit == Constants.HOUR) { dateTime = dateTime.AddHours(1); } } return(eqpPlanMappings); }
public static void CollectEqpPlan(Mozart.SeePlan.Simulation.IHandlingBatch hb, AoEquipment equip, string status) { try { MicronBEAssyBELot lot = hb as MicronBEAssyBELot; string eqpID = string.Empty; if (equip != null) { eqpID = equip.EqpID; } string waitPlanKey = SimulationHelper.GetEqpPlanKey(lot, string.Empty, LoadState.WAIT.ToString()); if (InputMart.Instance.EqpPlans.ContainsKey(waitPlanKey)) { InputMart.Instance.EqpPlans.Remove(waitPlanKey); } string waitPlanKeyWithEqp = SimulationHelper.GetEqpPlanKey(lot, eqpID, LoadState.WAIT.ToString()); if (InputMart.Instance.EqpPlans.ContainsKey(waitPlanKeyWithEqp)) { InputMart.Instance.EqpPlans.Remove(waitPlanKeyWithEqp); } string key = SimulationHelper.GetEqpPlanKey(lot, eqpID, status); string arrivalTimeKey = lot.LotID.Split('_')[0] + lot.CurrentStepID; EqpPlan plan; if (InputMart.Instance.EqpPlans.TryGetValue(key, out plan) == false) { MicronBEAssyEqp eqp; InputMart.Instance.MicronBEAssyEqp.TryGetValue(eqpID, out eqp); plan = new EqpPlan(); plan.LINE_ID = lot.LineID; plan.PRODUCT_ID = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? status : lot.Product.ProductID; plan.LOT_ID = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? Mozart.SeePlan.StringUtility.IdentityNull : lot.LotID; plan.INIT_STEP = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? Mozart.SeePlan.StringUtility.IdentityNull : lot.WipInfo.InitialStep.StepID; plan.ARRIVAL_TIME = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? default(DateTime) : FindHelper.GetNowDT(); plan.PROCESS_ID = lot.CurrentStep.Process.ProcessID; plan.STEP_ID = lot.CurrentStepID; plan.EQP_ID = eqpID; //plan.STEP_GROUP = eqp == null ? Mozart.SeePlan.StringUtility.IdentityNull : eqp.StepGroup.ToString(); plan.QTY = lot.UnitQty; plan.STATUS = status; plan.DESIGN_ID = lot.Product.DesignID(); plan.SEQUENCE = lot.CurrentStep.Sequence; plan.COMP_SEQ = lot.Product is AssyMcpPart ? (lot.Product as AssyMcpPart).CompSeq : 1; plan.IS_BASE = UtilityHelper.IsYN(lot.Product.IsBase()); plan.STEP_GROUP = (lot.CurrentStep as MicronBEAssyBEStep).StepGroup; if (lot.Product is AssyMcpProduct) { plan.FINAL_PROD_ID = lot.Product.ProductID; } else if (lot.Product is AssyMcpPart) { plan.FINAL_PROD_ID = (lot.Product as AssyMcpPart).FinalProduct.ProductID; } else { plan.FINAL_PROD_ID = lot.Product.ProductID; } InputMart.Instance.EqpPlans.Add(key, plan); if (status == LoadState.WAIT.ToString()) { DateTime arTime; if (InputMart.Instance.ArrivalTime.TryGetValue(arrivalTimeKey, out arTime) == false) { InputMart.Instance.ArrivalTime.Add(arrivalTimeKey, plan.ARRIVAL_TIME); } } else { plan.START_TIME = FindHelper.GetNowDT(); plan.END_TIME = FindHelper.GetNowDT(); } } else { DateTime arTime; plan.END_TIME = FindHelper.GetNowDT(); InputMart.Instance.ArrivalTime.TryGetValue(arrivalTimeKey, out arTime); plan.ARRIVAL_TIME = status == LoadingStates.SETUP.ToString() ? default(DateTime) : arTime; key = SimulationHelper.GetEqpPlanKey(lot, eqpID, LoadingStates.SETUP.ToString()); EqpPlan setupPlan; if (InputMart.Instance.EqpPlans.TryGetValue(key, out setupPlan)) { setupPlan.PRODUCT_ID = lot.Product.ProductID; } } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }