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 PlanWip CreatePlanWip(IWipInfo wip) { try { MicronBEAssyWipInfo wipInfo = wip as MicronBEAssyWipInfo; MicronBEAssyPlanWip planWip = new MicronBEAssyPlanWip(wipInfo); planWip.MapStep = wipInfo.InitialStep; planWip.AvailableTime = FindHelper.GetEngineStartTime(); planWip.Product = wipInfo.Product; planWip.LotID = wipInfo.LotID; planWip.State = wipInfo.CurrentState.ToString(); return(planWip); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(PlanWip)); } }
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); }
internal static Product FindWipProduct(Wip entity, MicronBEAssyProcess process, MicronBEAssyBEStep step, Mozart.SeePlan.Simulation.EntityState state, out string unpegReason) { Product product = null; unpegReason = string.Empty; #if DEBUG if (entity.PRODUCT_ID == "264153") { Console.WriteLine(); } if (entity.PRODUCT_ID == "264157") { Console.WriteLine(); } #endif int daThroughtCnt = step.DaThroughCount; if (step.StepGroup == Constants.DieAttach && state != EntityState.RUN) { daThroughtCnt = daThroughtCnt - 1;//DA 대기중인 재공은 DA를 진행하지 않은 상태로 판단 } Product wipProduct = FindHelper.FindProduct(entity.LINE_ID, entity.PRODUCT_ID); if (wipProduct is MicronBEAssyProduct) { product = wipProduct; } else if (wipProduct != null && wipProduct is AssyMcpProduct && daThroughtCnt >= 1) { AssyMcpProduct mcpProduct = wipProduct as AssyMcpProduct; if (daThroughtCnt == mcpProduct.MaxSequence) { product = mcpProduct; } else { AssyMcpPart midPart = FindHelper.FindProduct(entity.LINE_ID, entity.PRODUCT_ID, true, true, daThroughtCnt) as AssyMcpPart; if (midPart != null) { product = midPart; } #if DEBUG if (midPart == null) { Console.WriteLine(); } #endif } } else { //임시로직 - 로직이 정해지먼 재정의 해야함. //초기화시 CompSeq가 확정된 Part를 찾을 수 없기 때문에 대표로 Part를 하나 찾아서 정의를 해야함. ICollection <AssyMcpPart> products = FindHelper.FindAssyInParts(entity.LINE_ID, entity.PRODUCT_ID); if (products != null && products.Count > 0) { product = products.ElementAt(0); } } if (product == null) { if (step.StepID == Constants.LOTSRECEIVED) { unpegReason = "Cannot find McpBom or ProductRoute"; } else { unpegReason = "Cannot find McpBom"; } } return(product); }
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)); } }
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)); } }