/// <summary> /// </summary> /// <param name="da"/> /// <param name="hb"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public bool IS_BUCKET_PROCESSING0(Mozart.SeePlan.Simulation.DispatchingAgent da, IHandlingBatch hb, ref bool handled, bool prevReturnValue) { try { MicronBEAssyBELot lot = hb as MicronBEAssyBELot; MicronBEAssyBEStep step = hb.CurrentStep as MicronBEAssyBEStep; foreach (EqpArrange eqpArrange in InputMart.Instance.EqpArrange.DefaultView) { if (lot.Product.LineID != eqpArrange.LINE_ID) { continue; } if (step.StepID != eqpArrange.STEP_ID) { continue; } return(false); } return(true); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(false); } }
public static SetupType CheckSetup(Mozart.SeePlan.Simulation.AoEquipment aeqp, Mozart.SeePlan.Simulation.IHandlingBatch hb) { try { MicronBEAssyBELot lot = hb as MicronBEAssyBELot; MicronBEAssyPlanInfo plan = aeqp.LastPlan as MicronBEAssyPlanInfo; if (plan == null) { return(SetupType.NONE); } if (plan.ProductID != lot.Product.ProductID) { return(SetupType.PART_CHG); } return(SetupType.NONE); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(SetupType.NONE); } }
/// <summary> /// </summary> /// <param name="hb"/> /// <param name="ao"/> /// <param name="now"/> /// <param name="handled"/> public void ON_END_TASK0(IHandlingBatch hb, ActiveObject ao, DateTime now, ref bool handled) { try { AoEquipment equip = ao as AoEquipment; MicronBEAssyBELot lot = hb as MicronBEAssyBELot; if (equip == null) { SimulationHelper.CollectEqpPlan(hb, equip, LoadState.BUSY.ToString()); } MicronBEAssyBEStep step = lot.CurrentStep as MicronBEAssyBEStep; //if (step.StepAction != null && step.StepAction.FWTractIn == StepActionInfo.MCP) // lot.ChildLots.Clear(); if (lot.ReservationEqp == equip) { lot.ReservationEqp = null; } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
public static MicronBEAssyBatch CreateBatch(MicronBEAssyBELot lot) { try { AssyMcpProduct aoProd = lot.Product.GetAssyOutProduct(); if (aoProd == null) { return(null); } string aoProdID = aoProd.ProductID; Tuple <string, string> key = Tuple.Create(aoProdID, lot.LineID); MicronBEAssyBatch batch; if (InputMart.Instance.MicronBEAssyBatch.TryGetValue(key, out batch) == false) { batch = new MicronBEAssyBatch(); batch.AoProdID = aoProdID; batch.LineID = lot.LineID; SimulationHelper.SetSteps(batch, lot.Product); InputMart.Instance.MicronBEAssyBatch.Add(key, batch); } return(batch); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(MicronBEAssyBatch)); } }
public static string GenerateSplitNo(MicronBEAssyBELot lot, int i) { try { string splitLotID; if (i <= 9) { splitLotID = lot.LotID + "_" + i.ToString(); } else if (i > 9 && i <= 35) { splitLotID = lot.LotID + "_" + (char)(i + 55); } else if (i > 35 && i <= 61) { splitLotID = lot.LotID + "_" + (char)(i + 61); } else { splitLotID = lot.LotID + "_" + (i + 61).ToString(); } return(splitLotID); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(string)); } }
/// <summary> /// </summary> /// <param name="hb"/> /// <param name="wagent"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public object GET_WORK_GROUP_KEY0(IHandlingBatch hb, WorkAgent wagent, ref bool handled, object prevReturnValue) { try { MicronBEAssyBELot lot = hb.Sample as MicronBEAssyBELot; string productID = lot.Product.ProductID; Product prod = null; InputMart.Instance.MicronBEProducts.TryGetValue(productID, out prod); AssyMcpProduct aoProd = null; if (prod is AssyMcpPart) { AssyMcpPart part = prod as AssyMcpPart; aoProd = part.FinalProduct as AssyMcpProduct; } if (prod is AssyMcpProduct) { aoProd = prod as AssyMcpProduct; } if (aoProd != null) { return(aoProd.ProductID); } return(null); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(object)); } }
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); } }
/// <summary> /// </summary> /// <param name="hb"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public WorkStep ADD_WORK_LOT0(IHandlingBatch hb, ref bool handled, WorkStep prevReturnValue) { try { MicronBEAssyBELot lot = hb as MicronBEAssyBELot; AssyMcpPart mcpPart = lot.Product as AssyMcpPart; if (mcpPart != null && mcpPart.IsBase == false) { return(null); } var agentInitControl = ServiceLocator.Resolve <JobChangeInit>(); var wagentName = agentInitControl.GetWorkAgentName(hb); if (string.IsNullOrEmpty(wagentName)) { return(null); } var wmanager = AoFactory.Current.JobChangeManger; var wagent = wmanager.GetAgent(wagentName); if (wagent == null) { return(null); } var wgroupKey = agentInitControl.GetWorkGroupKey(hb, wagent); if (wgroupKey == null) { return(null); } var wgroup = wagent.GetGroup(wgroupKey); var wstepKey = agentInitControl.GetWorkStepKey(hb, wgroup); if (wstepKey == null) { return(null); } var targetStep = agentInitControl.GetTargetStep(hb, wgroup, wstepKey); if (targetStep == null) { return(null); } var wstep = wgroup.GetStep(wstepKey, targetStep); var availableTime = agentInitControl.GetAvailableTime(hb, wstep, targetStep); MicronBEAssyWorkLot wlot = CreateHelper.CreateWorkLot(hb, availableTime, wstepKey, targetStep, lot.ReservationEqp); wstep.AddWip(wlot); return(wstep); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(WorkStep)); } }
/// <summary> /// </summary> /// <param name="da"/> /// <param name="hb"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public bool INTERCEPT_IN0(DispatchingAgent da, IHandlingBatch hb, ref bool handled, bool prevReturnValue) { try { MicronBEAssyBEStep currentStep = hb.CurrentStep as MicronBEAssyBEStep; MicronBEAssyBELot lot = hb as MicronBEAssyBELot; if (lot.Product is AssyMcpPart) { AssyMcpPart mcpPart = lot.Product as AssyMcpPart; AssyMcpProduct mcpProduct = mcpPart.FinalProduct as AssyMcpProduct; if (mcpPart.PartChangeStep == lot.CurrentStepID) { Tuple <AssyMcpProduct, AssyMcpPart> baseKey = null; Tuple <AssyMcpProduct, AssyMcpPart> sourceKey = null; AssyMcpPart mergeMcpPart = McpHelper.GetMergeMcpPart(mcpPart); if (mcpPart.IsBase) { baseKey = Tuple.Create(mcpProduct, mcpPart); sourceKey = Tuple.Create(mcpProduct, mergeMcpPart); InputMart.Instance.MatchingLotList.Add(baseKey, lot); } else { baseKey = Tuple.Create(mcpProduct, mergeMcpPart); sourceKey = Tuple.Create(mcpProduct, mcpPart); InputMart.Instance.MatchingLotList.Add(sourceKey, lot); } List <MicronBEAssyBELot> matchLotList = SimulationHelper.MatchingMcpLot(da, baseKey, sourceKey); foreach (MicronBEAssyBELot matchLot in matchLotList) { da.ReEnter(matchLot); } return(true); } } return(false); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(bool)); } }
public static string GetEqpPlanKey(MicronBEAssyBELot lot, string eqpID, string status) { try { return(string.Concat(lot.LotID, lot.CurrentStepID, eqpID, status)); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(string)); } }
public static MicronBEAssyPlanInfo CreatePlanInfo(ILot lot, Mozart.SeePlan.DataModel.Step task) { MicronBEAssyPlanInfo plan = new MicronBEAssyPlanInfo(); MicronBEAssyBELot beLot = lot as MicronBEAssyBELot; plan.Init(task); plan.LotID = lot.LotID; plan.UnitQty = lot.UnitQty; plan.ProductID = beLot.Product.ProductID; plan.ProcessID = beLot.Process.ProcessID; return(plan); }
/// <summary> /// </summary> /// <param name="aeqp"/> /// <param name="hb"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public ProcTimeInfo GET_PROCESS_TIME0(Mozart.SeePlan.Simulation.AoEquipment aeqp, IHandlingBatch hb, ref bool handled, ProcTimeInfo prevReturnValue) { try { ProcTimeInfo info = new ProcTimeInfo(); MicronBEAssyBELot lot = hb as MicronBEAssyBELot; MicronBEAssyBEStep step = hb.CurrentStep as MicronBEAssyBEStep; foreach (StepTime time in InputMart.Instance.StepTime.DefaultView) { if (step.StepID != time.STEP_ID) { continue; } if (lot.Product.LineID != time.LINE_ID) { continue; } if (LikeUtility.Like(lot.Product.ProductID, time.PRODUCT_ID) == false) { continue; } //if (LikeUtility.Like(lot.Product.Process.ProcessID, time.PROCESS_ID) == false) // continue; if (LikeUtility.Like(aeqp.EqpID, time.EQP_ID) == false) { continue; } double tactTimeBySec = (double)time.TACT_TIME; info.TactTime = TimeSpan.FromSeconds(tactTimeBySec); break; } return(info); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(ProcTimeInfo)); } }
public static bool IsRun(MicronBEAssyBELot lot) { try { if (lot.CurrentPlan.LoadedResource != null && lot.IsStarted && lot.IsFinished == false) { return(true); } return(false); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(bool)); } }
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)); } }
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)); } }
/// <summary> /// </summary> /// <param name="weqp"/> /// <param name="wstep"/> /// <param name="list"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public List <WorkLot> DO_FILTER_LOT0(WorkEqp weqp, WorkStep wstep, List <WorkLot> list, ref bool handled, List <WorkLot> prevReturnValue) { try { #if DEBUG if (weqp.Target.EqpID == "DA03" && wstep.Key.ToString() == "S0100") { Console.WriteLine(); } #endif MicronBEAssyWorkStep ws = wstep as MicronBEAssyWorkStep; List <WorkLot> lotList = new List <WorkLot>(); foreach (MicronBEAssyWorkLot lot in list) { AssyMcpPart mcpPart = lot.Product as AssyMcpPart; if (mcpPart != null && mcpPart.IsBase == false) { continue; } MicronBEAssyBELot beLot = lot.Batch as MicronBEAssyBELot; if (lot.ReservationEqp != null && lot.ReservationEqp != weqp.Target) { continue; } lotList.Add(lot); } if (lotList.IsNullOrEmpty()) { weqp.Stop = true; } return(lotList); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(List <WorkLot>)); } }
/// <summary> /// </summary> /// <param name="hb"/> /// <param name="ao"/> /// <param name="now"/> /// <param name="handled"/> public void ON_START_TASK0(IHandlingBatch hb, ActiveObject ao, DateTime now, ref bool handled) { try { AoEquipment equip = ao as AoEquipment; MicronBEAssyBELot lot = hb as MicronBEAssyBELot; if (equip == null) { SimulationHelper.CollectEqpPlan(hb, equip, LoadState.BUSY.ToString()); } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
public static List <MicronBEAssyBELot> GetSplitLots(MicronBEAssyBELot lot, double stdLotSize) { try { List <MicronBEAssyBELot> splitLots = new List <MicronBEAssyBELot>(); int splitQty = (int)Math.Ceiling(lot.UnitQtyDouble / stdLotSize); double unitQty = lot.UnitQtyDouble; for (int i = 1; i <= splitQty; i++) { string splitLotID = GenerateSplitNo(lot, i); double splitLotQty = stdLotSize < unitQty ? stdLotSize : unitQty; MicronBEAssyBELot splitLot = lot.Clone() as MicronBEAssyBELot; splitLot.LotID = splitLotID; splitLot.UnitQtyDouble = splitLotQty; MicronBEAssyPlanInfo plan = new MicronBEAssyPlanInfo(); plan.Init(splitLot.CurrentStep); plan.LotID = splitLot.LotID; plan.UnitQty = splitLot.UnitQtyDouble; plan.ProductID = splitLot.Product.ProductID; plan.ProcessID = splitLot.Process.ProcessID; splitLot.SetCurrentPlan(plan); unitQty -= splitLotQty; splitLots.Add(splitLot); } return(splitLots); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(null); } }
public int Compare(object x, object y) { try { MicronBEAssyBELot lotx = null; MicronBEAssyBELot loty = null; int cmp = 0; if (x is WorkLot && y is WorkLot) { WorkLot workLotx = x as WorkLot; WorkLot workLoty = y as WorkLot; if (cmp == 0) { cmp = workLotx.AvailableTime.CompareTo(workLoty.AvailableTime); } lotx = workLotx.Lot as MicronBEAssyBELot; loty = workLoty.Lot as MicronBEAssyBELot; } if (x is MicronBEAssyBELot && y is MicronBEAssyBELot) { lotx = x as MicronBEAssyBELot; loty = y as MicronBEAssyBELot; } if (cmp == 0) { cmp = lotx.LotID.CompareTo(loty.LotID); } return(cmp); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(0); } }
/// <summary> /// </summary> /// <param name="hb"/> /// <param name="bucketer"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public Time GET_BUCKET_TIME0(Mozart.SeePlan.Simulation.IHandlingBatch hb, AoBucketer bucketer, ref bool handled, Time prevReturnValue) { try { Time tm = new Time(); MicronBEAssyBELot lot = hb as MicronBEAssyBELot; MicronBEAssyBEStep step = hb.CurrentStep as MicronBEAssyBEStep; foreach (StepTat time in InputMart.Instance.StepTat.DefaultView) { if (step.StepID != time.STEP_ID) { continue; } if (lot.Product.LineID != time.LINE_ID) { continue; } if (lot.Product.ProductID != time.PRODUCT_ID) { continue; } double runTatBySec = (double)time.RUN_TAT; tm = TimeSpan.FromSeconds(runTatBySec); break; } return(tm); } 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 MicronBEAssyWorkLot CreateWorkLot(IHandlingBatch hb, Mozart.Simulation.Engine.Time availableTime, object wstepKey, Mozart.SeePlan.DataModel.Step targetStep, AoEquipment reservationEqp) { try { MicronBEAssyBELot lot = hb as MicronBEAssyBELot; MicronBEAssyWorkLot wLot = new MicronBEAssyWorkLot(hb, availableTime, wstepKey, targetStep); wLot.LotID = lot.LotID; wLot.Product = lot.Product; wLot.UnitQty = lot.UnitQtyDouble; wLot.ReservationEqp = reservationEqp; return(wLot); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(MicronBEAssyWorkLot)); } }
/// <summary> /// </summary> /// <param name="hb"/> /// <param name="wgroup"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public object GET_WORK_STEP_KEY0(IHandlingBatch hb, WorkGroup wgroup, ref bool handled, object prevReturnValue) { try { MicronBEAssyBELot lot = hb as MicronBEAssyBELot; #if DEBUG //if(lot.LotID == "LOT05") // Console.WriteLine(); #endif string stepKey = JobChangeHelper.GetStepKey(lot.Product, lot.CurrentStep as MicronBEAssyBEStep, JobChangeHelper.IsRun(lot)); //Tuple<string, int> stepKey = JobChangeHelper.GetStepKey(lot.Product, lot.CurrentStep as CA_PlanningBEStep, false); return(stepKey); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(object)); } }
public static SetupType CheckSetupProfile(WorkEqp weqp, Mozart.SeePlan.Simulation.IHandlingBatch hb) { try { MicronBEAssyBELot lot = hb as MicronBEAssyBELot; var workLots = weqp.Step.Profiles[weqp]; var lastLot = workLots.Last().Lot as MicronBEAssyBELot; if (lastLot.Product.ProductID != lot.Product.ProductID) { return(SetupType.PART_CHG); } return(SetupType.NONE); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(SetupType.NONE); } }
/// <summary> /// </summary> /// <param name="list"/> /// <param name="step"/> /// <param name="lot"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public WorkStep UPDATE_FIND_STEP0(IList <WorkStep> list, WorkStep step, WorkLot lot, ref bool handled, WorkStep prevReturnValue) { try { MicronBEAssyBELot beLot = lot.Batch.Sample as MicronBEAssyBELot; bool isRun = JobChangeHelper.IsRun(lot.Batch as MicronBEAssyBELot); string stepKey = JobChangeHelper.GetStepKey(beLot.Product, beLot.CurrentStep as MicronBEAssyBEStep, isRun); if (stepKey == null) { return(null); } WorkStep ws = null; if (step.Group.Steps != null) { try { ws = step.Group.TryGetStep(stepKey); } catch { Console.WriteLine(); } } else { Console.WriteLine(); } return(ws); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(WorkStep)); } }
/// <summary> /// </summary> /// <param name="lot"/> /// <param name="task"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public LoadInfo CREATE_LOAD_INFO0(ILot lot, Step task, ref bool handled, LoadInfo prevReturnValue) { try { MicronBEAssyPlanInfo plan = new MicronBEAssyPlanInfo(); MicronBEAssyBELot beLot = lot as MicronBEAssyBELot; plan.Init(task); plan.LotID = lot.LotID; plan.UnitQty = lot.UnitQty; plan.ProductID = beLot.Product.ProductID; plan.ProcessID = beLot.Process.ProcessID; return(plan); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(LoadInfo)); } }
/// <summary> /// </summary> /// <param name="aeqp"/> /// <param name="hb"/> /// <param name="handled"/> public void ON_CUSTOM_LOAD0(AoEquipment aeqp, IHandlingBatch hb, ref bool handled) { try { MicronBEAssyBELot lot = hb as MicronBEAssyBELot; string stepID = hb.CurrentStep.StepID; double stdLotSize = SimulationHelper.GetStdLotSize(stepID, lot.Product.LineID, lot.Product.ProductID); if (stdLotSize > 0 && stdLotSize < lot.UnitQtyDouble) { List <MicronBEAssyBELot> splitLots = SimulationHelper.GetSplitLots(lot, stdLotSize); foreach (MicronBEAssyBELot splitLot in splitLots) { splitLot.ReservationEqp = aeqp; AoFactory.Current.In(splitLot); aeqp.AddInBuffer(splitLot); SimulationHelper.CollectEqpPlan(splitLot, aeqp, LoadState.WAIT.ToString()); } string waitPlanKey = SimulationHelper.GetEqpPlanKey(lot, string.Empty, LoadState.WAIT.ToString()); if (InputMart.Instance.EqpPlans.ContainsKey(waitPlanKey)) { InputMart.Instance.EqpPlans.Remove(waitPlanKey); } } else { AoFactory.Current.In(lot); aeqp.AddInBuffer(lot); } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
/// <summary> /// </summary> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public IList <Mozart.SeePlan.Simulation.IHandlingBatch> GET_WIPS0(ref bool handled, IList <Mozart.SeePlan.Simulation.IHandlingBatch> prevReturnValue) { try { List <IHandlingBatch> wipList = new List <IHandlingBatch>(); foreach (MicronBEAssyPlanWip planWip in InputMart.Instance.MicronBEAssyPlanWip.Values) { if (planWip.PegCount > 0) { MicronBEAssyBELot lot = new MicronBEAssyBELot(); lot.Init(planWip.LotID, planWip.Product, planWip.GetWipInfo().LineID); lot.LineID = planWip.GetWipInfo().LineID; lot.Route = lot.Product.Process; lot.WipInfo = planWip.GetWipInfo(); lot.AssyBatch = CreateHelper.CreateBatch(lot); if (lot.AssyBatch == null) { continue; } lot.UnitQtyDouble = planWip.GetWipInfo().UnitQty; wipList.Add(lot); } } return(wipList); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(IList <Mozart.SeePlan.Simulation.IHandlingBatch>)); } }
/// <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)); } }
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)); } }
/// <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)); } }