예제 #1
0
        private static void Allocate_State(this DcnBucket bck, EqpStatusInfo info, DateTime startTime, DateTime endTime, DateTime now)
        {
            if (info == null)
            {
                return;
            }

            if (info.Duration <= 0)
            {
                return;
            }

            DateTime st = LcdHelper.Max(info.StartTime, startTime);
            DateTime et = LcdHelper.Min(info.EndTime, endTime);

            if (st < et)
            {
                DcnPlan plan = new DcnPlan()
                {
                    Product      = null,
                    Target       = null,
                    AllocQty     = 0,
                    TactTime     = 0,
                    EqpStartTime = st,
                    EqpEndTime   = et,
                    AllocTime    = now,
                    EqpID        = bck.EqpID,
                    EqpState     = info.MesStatus.ToString()
                };

                bck.LastEqpEndTime = et;
                bck.Plans.Add(plan);
            }

            if (info.EndTime > et)
            {
                info.StartTime = et;
            }
            else
            {
                //clear
                info.StartTime = DateTime.MinValue;
                info.EndTime   = DateTime.MinValue;
            }
        }
예제 #2
0
        private static DcnPlan Allocate(this DcnBucket bck, FabProduct prod, int allocQty, DcnTarget target, DateTime now)
        {
            if (prod == null)
            {
                return(null);
            }

            if (allocQty <= 0)
            {
                return(null);
            }

            double tactTime = bck.TactTime;

            DcnPlan plan = new DcnPlan()
            {
                Product      = prod,
                Target       = target,
                AllocQty     = allocQty,
                TactTime     = tactTime,
                EqpStartTime = bck.LastEqpEndTime,
                AllocTime    = now,
                EqpID        = bck.EqpID
            };

            plan.EqpEndTime = plan.EqpStartTime.AddSeconds(plan.EqpRunTime.TotalSeconds);

            if (target != null)
            {
                target.AllocQty += allocQty;
            }

            bck.Usage         += allocQty * tactTime;
            bck.LastEqpEndTime = plan.EqpEndTime;

            bck.Plans.Add(plan);

            return(plan);
        }