/// <summary> /// </summary> /// <param name="pegPart"/> /// <param name="isRun"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public TimeSpan GET_TAT0(Mozart.SeePlan.Pegging.PegPart pegPart, bool isRun, ref bool handled, TimeSpan prevReturnValue) { try { MicronBEAssyBEPegPart pp = pegPart as MicronBEAssyBEPegPart; StepTat stepTat = FindHelper.FindTAT(pp.Product.ProductID, pp.CurrentStep.StepID, pp.Product.LineID); if (stepTat == null) { return(TimeSpan.FromSeconds(0)); } double tat = 0; if (isRun) { tat = (double)stepTat.RUN_TAT; } else { tat = (double)stepTat.WAIT_TAT; } return(TimeSpan.FromSeconds(tat)); } 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="entity"/> /// <returns/> public bool OnAfterLoad_StepTat(StepTat entity) { entity.RUN_TAT = (decimal)UtilityHelper.GetTimeBySeconds((double)entity.RUN_TAT, entity.TIME_UOM); entity.WAIT_TAT = (decimal)UtilityHelper.GetTimeBySeconds((double)entity.WAIT_TAT, entity.TIME_UOM); entity.TAT = (decimal)UtilityHelper.GetTimeBySeconds((double)entity.TAT, entity.TIME_UOM); return(true); }
public static void AddStepTat(this FabStep step, StepTat tat) { string key = GetTatKey(tat.ProductID, tat.IsMain); if (step.StepTats.ContainsKey(key) == false) { step.StepTats.Add(key, tat); } }
public static StepTat GetDefaultTAT(this FabStep step) { if (step.DefaultTAT == null) { StepTat tat = new StepTat(); tat.WaitTat = (float)SiteConfigHelper.GetDefaultWaitTAT().TotalMinutes; tat.RunTat = (float)SiteConfigHelper.GetDefaultRunTAT().TotalMinutes; tat.TAT = tat.WaitTat + tat.RunTat; step.DefaultTAT = tat; } return(step.DefaultTAT); }
public static decimal GetAvgProcTime(FabStep step, FabProduct prod, string productVersion) { if (step.AvgFlowTime < 0) { List <string> list = EqpArrangeMaster.GetLoadableEqpList(step.StdStep, prod.ProductID, productVersion); if (list == null) { StepTat tat = step.GetTat(prod.ProductID, true); if (tat != null) { step.AvgFlowTime = Convert.ToDecimal(tat.TAT * 60); } return(step.AvgFlowTime); } decimal n = list.Count; decimal s = 0; foreach (string eqpID in list) { StepTime st = step.GetStepTime(eqpID, prod.ProductID); if (st == null || st.ProcTime <= 0) { continue; } s = s + Convert.ToDecimal(1d / st.ProcTime); } if (s > 0m) { step.AvgFlowTime = Math.Round(n / (decimal)s, 2); } else { step.AvgFlowTime = (decimal)SiteConfigHelper.GetDefaultFlowTime().TotalSeconds; } } return(step.AvgFlowTime); }
/// <summary> /// </summary> /// <param name="pegTarget"/> /// <param name="stage"/> /// <param name="isRun"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public TimeSpan GET_TARGET_TAT0(Mozart.SeePlan.Pegging.PegTarget pegTarget, Mozart.SeePlan.Pegging.PegStage stage, bool isRun, ref bool handled, TimeSpan prevReturnValue) { FabPegTarget target = pegTarget as FabPegTarget; FabStep step = pegTarget.PegPart.CurrentStep as FabStep; float waitTat = (float)SiteConfigHelper.GetDefaultWaitTAT().TotalMinutes; float runTat = (float)SiteConfigHelper.GetDefaultRunTAT().TotalMinutes; StepTat tat = step.GetTat(target.ProductID, target.IsMainLint); if (tat != null) { waitTat = tat.WaitTat; runTat = tat.RunTat; } float time = isRun ? runTat : waitTat; return(TimeSpan.FromMinutes(time)); }
/// <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)); } }
/// <summary> /// </summary> /// <param name="entity"/> /// <param name="now"/> /// <param name="target"/> /// <param name="factor"/> /// <param name="ctx"/> /// <returns/> public WeightValue SMALL_BATCH_MERGE_PRIORITY(Mozart.Simulation.Engine.ISimEntity entity, DateTime now, Mozart.Simulation.Engine.ActiveObject target, Mozart.SeePlan.DataModel.WeightFactor factor, Mozart.SeePlan.Simulation.IDispatchContext ctx) { if (factor.Factor == 0) { return(new WeightValue(0)); } int baseQty = (int)factor.Criteria[0]; int checkStepCount = (int)factor.Criteria[1]; FabAoEquipment eqp = target as FabAoEquipment; FabLot lot = entity as FabLot; //if (eqp.IsLastPlan(lot.CurrentShopID, lot.CurrentStepID, lot.CurrentProductID, Constants.NULL_ID, lot.OwnerType, lot.OwnerID)) // return new WeightValue(1 * factor.Factor, string.Format("[IsLast:Y]")); FabStep currentStep = lot.CurrentFabStep; var currentProd = lot.FabProduct; FabStep prevStep = currentStep.GetPrevMainStep(lot.FabProduct, true); StepTat tat = null; if (prevStep != null) { tat = prevStep.GetTat(lot.CurrentProductID, true); } if (tat == null) { tat = currentStep.GetDefaultTAT(); } var job = InFlowMaster.GetJobState(lot); if (job == null) { return(new WeightValue(0)); } int waitQty = job.GetCurrenStepWaitWipQty(eqp, currentStep, Constants.NULL_ID, (decimal)TimeSpan.FromMinutes(tat.RunTat).TotalHours); if (waitQty > baseQty) { return(new WeightValue(0, string.Format("[Wait:{0}>{1}:Base]", waitQty, baseQty))); } int prevWipQty = job.GetPrevStepRunWipQty(eqp, currentStep, Constants.NULL_ID, now.AddMinutes(tat.TAT)); if (prevWipQty > 0) { return(new WeightValue(0, string.Format("[PrevRunWip:{0}>0", prevWipQty))); } int nextWipQty = 0; var nextStepList = currentStep.GetNextStepList(currentProd, checkStepCount); foreach (FabStep next in nextStepList) { nextWipQty += job.GetStepWips(next, WipType.Total); } int runQty = job.GetStepWips(currentStep, WipType.Run); if (runQty + nextWipQty == 0) { return(new WeightValue(0, string.Format("[Run:{0} + NextQty:{1} = 0]", runQty, nextWipQty))); } return(new WeightValue(1 * factor.Factor, string.Format("[Run:{0} + NextQty:{1}>0]", runQty, nextWipQty))); }
public WipProfile CreateWipProfile( FabStep step, string productVersion, int exCludeStepCnt, FabWeightPreset wp, AoEquipment inputEqp, decimal allowRundonwTime, bool excludePreRun = false ) { decimal percent = 1; List <JobState> jobList = new List <JobState>(1); jobList.Add(this); string prodVer = GetProductVersion(step, productVersion); int loadedEqpCount = GetLoadedEqpCount(step, prodVer, false); WipProfile profile = new WipProfile(this.ProductID, step, loadedEqpCount, wp); AddTargetWaitWip(profile, jobList, step, prodVer, exCludeStepCnt, inputEqp, allowRundonwTime); int stepCount = 1; FabStep firstStep = step; foreach (FabStep rStep in GetPrevSteps(step)) { //if (step.IsCFShop) // prodVer = Constants.NULL_ID; //else // prodVer = GetProductVersion(rStep, prodVer); decimal qtyRun = 0, qtyWait = 0, tatRun = 0, tatWait = 0, tact = 0; bool isExclude = stepCount <= exCludeStepCnt; if (isExclude == false) { if (stepCount == 1 && excludePreRun) { qtyRun = 0; } else { qtyRun = GetStepWips(jobList, rStep, WipType.Run, prodVer); } qtyWait = GetStepWips(jobList, rStep, WipType.Wait, prodVer); } tatRun = GetAverageFlowTime(jobList, rStep, prodVer); tatWait = GetAverageWaitTAT(jobList, rStep, prodVer); tact = GetAverageTactTime(jobList, rStep, prodVer); int eqpCount = GetLoadedEqpCount(jobList, rStep, prodVer, false); if (eqpCount > 1) { tact /= eqpCount; } if (rStep.HasStepTime == false) { StepTat tat = rStep.GetTat(this.ProductID, true); if (tat != null) { tatRun = (decimal)tat.RunTat * 60; tatWait = (decimal)tat.WaitTat * 60; tact = (decimal)(tat.TAT * 60) / SeeplanConfiguration.Instance.LotUnitSize; } } decimal stayTime = 0; if (qtyWait > 0) { stayTime = GetStayWaitTime(jobList, rStep, prodVer); } WipStep wipStep = new WipStep(rStep, tact, tatRun, tatWait, percent * qtyRun, percent * qtyWait, stayTime); profile.AddWipStep(wipStep); firstStep = step; stepCount++; } WipStep inPlanWipStep = new WipStep(); inPlanWipStep.AddReleaePlan(this, firstStep, inputEqp); if (inPlanWipStep.Pts.Count > 0) { profile.AddWipStep(inPlanWipStep); } return(profile); }