예제 #1
0
        private static Time GetAfterTat(this StayHour info, FabLot lot, FabStep currStep)
        {
            if (currStep == null)
            {
                return(Time.Zero);
            }

            string key       = currStep.StepKey;
            string productID = lot.CurrentProductID;

            Time t;

            if (info.AfterTats.TryGetValue(key, out t) == false)
            {
                bool flag = false;
                foreach (var step in info.StepList)
                {
                    if (flag)
                    {
                        var tat = step.GetTat(productID, true);
                        if (tat != null)
                        {
                            t += Time.FromMinutes(tat.TAT);
                        }
                    }

                    if (step.StepID == currStep.StepID)
                    {
                        flag = true;
                    }
                }
            }

            return(t);
        }
예제 #2
0
        private static bool Reset(this StayHour info)
        {
            info.FromStepOutTime = DateTime.MinValue;
            info.CurrStepInTime  = DateTime.MinValue;

            return(false);
        }
예제 #3
0
        private static void StepChange_Curr(this StayHour info, FabStep currStep, DateTime now)
        {
            if (currStep != null)
            {
                //FromStepOutTime 미설정된 상태로 중간 Step에 진입한 경우(예외처리)
                if (info.FromStep.IsMainStep && info.FromStepOutTime == DateTime.MinValue)
                {
                    if (info.IsMatchedStep(currStep))
                    {
                        DateTime planStartTime = ModelContext.Current.StartTime;
                        info.FromStepOutTime = planStartTime;

                        #region WriteErrorHistory.
                        string key = string.Format("Qtime{0}/{1}", info.Lot.LotID, currStep.StepKey);
                        ErrHist.WriteIf(key,
                                        ErrCategory.SIMULATION,
                                        ErrLevel.INFO,
                                        currStep.FactoryID,
                                        currStep.ShopID,
                                        info.Lot.LineID,
                                        info.Product.ProductID,
                                        info.Lot.CurrentProductVersion,
                                        info.Lot.CurrentProcessID,
                                        Constants.NULL_ID,
                                        currStep.StepID,
                                        "NOT FOUND FROM_STEP_OUT_TIME",
                                        "Qtime:StepChange_Current");
                        #endregion
                    }
                }

                info.CurrStepInTime = now;
            }
        }
예제 #4
0
        public static Time RemainMinHoldTime(this StayHour info, FabLot lot, FabStep step, DateTime now)
        {
            Time stayTime = now - info.FromStepOutTime;

            Time remainTime = info.QTime - stayTime;

            return(remainTime);
        }
예제 #5
0
        private static StayHour Clone(this StayHour info)
        {
            var clone = info.ShallowCopy();

            clone.Reset();

            return(clone);
        }
예제 #6
0
        private static Time GetToStepRunTat(this StayHour info, string productID)
        {
            var stepList = info.StepList;

            if (stepList == null || stepList.Count == 0)
            {
                return(Time.Zero);
            }

            var last = stepList.LastOrDefault();

            return(GetRunTat(last, productID));
        }
예제 #7
0
        private static bool IsMatched(this StayHour info, FabStep step, QTimeType qtype)
        {
            if (step == null)
            {
                return(false);
            }

            if (info.QType != qtype)
            {
                return(false);
            }


            return(info.IsMatchedStep(step));
        }
예제 #8
0
        private static void StepChange_Prev(this StayHour info, FabStep prevStep, DateTime now)
        {
            if (prevStep != null)
            {
                if (prevStep.StepID == info.FromStep.StepID)
                {
                    info.FromStepOutTime = now;
                }

                if (prevStep.StepID == info.ToStep.StepID)
                {
                    info.ToStepInTime = now;
                }
            }
        }
예제 #9
0
        private static bool IsTraverseStep(StayHour item, FabLot lot)
        {
            bool isInclude = false;

            foreach (var step in item.StepList)
            {
                if (lot.PlanSteps.Contains(step.StepKey))
                {
                    isInclude = true;
                    break;
                }
            }

            return(isInclude);
        }
예제 #10
0
        private static bool IsMatchedStep(this StayHour info, FabStep step)
        {
            if (step == null)
            {
                return(false);
            }

            var find = info.StepList.Find(t => t.StepID == step.StepID);

            if (find != null)
            {
                return(true);
            }

            return(false);
        }
예제 #11
0
        internal static Time GetMinimumRemainTime(this FabLot lot, DateTime now)
        {
            if (lot.QtimeInfo == null)
            {
                return(Time.MinValue);
            }

            StayHour sh = lot.QtimeInfo.FindMinimumRemainTime(now);

            if (sh == null)
            {
                return(Time.MaxValue);
            }

            return(sh.RemainTime(lot, lot.CurrentFabStep, now));
        }
예제 #12
0
        internal static void Add(StayHour sh)
        {
            if (dic == null)
            {
                dic = new Dictionary <FabProduct, List <StayHour> >();
            }

            List <StayHour> list;

            if (dic.TryGetValue(sh.Product, out list) == false)
            {
                list = new List <StayHour>();
                dic.Add(sh.Product, list);
            }

            list.Add(sh);
        }
예제 #13
0
        public static Time RemainTime(this StayHour info, FabLot lot, FabStep step, DateTime now)
        {
            //제약 발생 전
            if (info.FromStepOutTime == DateTime.MinValue || info.FromStepOutTime == DateTime.MaxValue)
            {
                return(Time.MaxValue);
            }

            string productID        = lot.CurrentProductID;
            Time   currStepRunTat   = GetRunTat(step, productID);
            Time   afterTat         = info.GetAfterTat(lot, step);
            Time   toStepRunTat     = info.GetToStepRunTat(productID);
            Time   afterStepNeedTat = currStepRunTat + afterTat - toStepRunTat;

            Time stayTime   = (now - info.FromStepOutTime);
            Time remainTime = info.QTime - stayTime - afterStepNeedTat;

            return(remainTime);
        }
예제 #14
0
        public static int RemainStepCount(this StayHour info, FabStep currStep)
        {
            //제약 발생 전
            if (info.FromStepOutTime == DateTime.MinValue || info.FromStepOutTime == DateTime.MaxValue)
            {
                return(0);
            }

            if (currStep == null)
            {
                return(0);
            }

            string key = currStep.StepKey;

            int count = 0;

            if (info.AtfterStepCount.TryGetValue(key, out count) == false)
            {
                bool flag = false;
                foreach (var step in info.StepList)
                {
                    if (flag)
                    {
                        count++;
                    }

                    if (step.StepID == currStep.StepID)
                    {
                        flag = true;
                    }
                }
            }

            return(count);
        }