예제 #1
0
        public RealSnapshot GetWIPSnapshot(DateTime time, int waferQtyThreshold)
        {
            if (time < StartDate || time > EndDate)
            {
                throw new Exception($"WIP snapshot cannot be generated for time {time}, it is is out of bounds of these LotTraces");
            }
            else
            {
                List <RealLot> lots = new List <RealLot>();

                foreach (LotTrace trace in All)
                {
                    // Make sure that lot activities are ordered on track-in
                    //trace.LotActivitiesRaw = trace.LotActivitiesRaw.OrderBy(x => x.TrackIn).ToList();

                    if (trace.LotActivities.Any() && time >= trace.StartDate && time < trace.EndDate)
                    {
                        // Find current LotActivity and RawActivity
                        LotActivity activity = trace.GetLotActivityAt(time);

                        LotActivityRaw raw = trace.GetLotActivityRawAt(time);

                        if (activity != null && raw != null)
                        {
                            RealLot newLot;

                            if (trace.HasStart && trace.HasEnd)
                            {
                                newLot = new RealLot(activity, raw, trace.StartDate, trace.EndDate, time);
                            }
                            else if (trace.HasStart && !trace.HasEnd)
                            {
                                newLot = new RealLot(activity, raw, trace.StartDate, null, time);
                            }
                            else if (!trace.HasStart && trace.HasEnd)
                            {
                                newLot = new RealLot(activity, raw, null, trace.EndDate, time);
                            }
                            else
                            {
                                newLot = new RealLot(activity, raw, null, null, time);
                            }


                            lots.Add(newLot);
                        }
                    }
                }

                RealSnapshot snapshot = new RealSnapshot(time, lots, waferQtyThreshold);

                return(snapshot);
            }
        }
예제 #2
0
        public List <Tuple <DateTime, RealLot> > GetRealLotStarts()
        {
            List <Tuple <DateTime, RealLot> > lotStarts = new List <Tuple <DateTime, RealLot> >();

            foreach (LotTrace trace in All.Where(x => x.HasStart && x.LotActivities.Any() && x.LotActivitiesRaw.Any()))
            {
                LotActivity activity = trace.LotActivities.First();

                LotActivityRaw raw = trace.LotActivitiesRaw.First();

                RealLot newLot = new RealLot(activity, raw, trace.StartDate, trace.EndDate);

                lotStarts.Add(new Tuple <DateTime, RealLot>(trace.StartDate, newLot));
            }

            return(lotStarts);
        }