Ejemplo n.º 1
0
        private static List <DcnTarget> GetLoadableTargetList(this DcnMaster mst, DcnBucket bck, List <DcnTarget> targetList)
        {
            if (targetList == null || targetList.Count == 0)
            {
                return(null);
            }

            targetList.RemoveAll(t => t.RemainQty <= 0);
            if (targetList == null || targetList.Count == 0)
            {
                return(null);
            }

            DateTime startTime = mst.StartTime;
            DateTime endTime   = mst.EndTime;

            List <DcnTarget> list = new List <DcnTarget>();

            foreach (var target in targetList)
            {
                bool hasMainShopTarget = mst.HasRemainTarget(bck.MainRunShopID);

                if (bck.CanAllocate(startTime, endTime, target, hasMainShopTarget) == false)
                {
                    continue;
                }

                list.Add(target);
            }

            return(list);
        }
Ejemplo n.º 2
0
        private static void ClearAllocPlan(this DcnBucket bck)
        {
            if (bck.Plans == null || bck.Plans.Count == 0)
            {
                return;
            }

            bck.Plans.Clear();
        }
Ejemplo n.º 3
0
        private static bool HasAllocPlan(this DcnBucket bck)
        {
            if (bck.Plans == null || bck.Plans.Count == 0)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
            private bool IsLastPlan(DcnBucket bck, DcnTarget target)
            {
                if (bck == null)
                {
                    return(false);
                }

                if (target.IsEquals_Key(bck.LastProductID))
                {
                    return(true);
                }

                return(false);
            }
Ejemplo n.º 5
0
        public static void AddDcnBucket(EqpDcn entity)
        {
            if (entity == null)
            {
                return;
            }

            var dcnMst = ReleasePlanMaster.DcnMst;

            string eqpID = entity.EQP_ID;

            if (string.IsNullOrEmpty(eqpID))
            {
                return;
            }

            if (dcnMst.Buckets.Find(t => t.EqpID == eqpID) != null)
            {
                return;
            }

            int dailyCapa = entity.DAILY_CAPA;

            if (dailyCapa <= 0)
            {
                return;
            }

            DateTime planStartTime = ModelContext.Current.StartTime;

            double capacity = 60 * 60 * 24; //24 Hours
            double tactTime = capacity / dailyCapa;

            DcnBucket bucket = new DcnBucket()
            {
                FactoryID      = entity.FACTORY_ID,
                EqpGroupID     = entity.EQP_GROUP_ID,
                EqpID          = eqpID,
                MainRunShopID  = entity.MAIN_RUN_SHOP,
                DailyCapa      = dailyCapa,
                Capacity       = capacity,
                TactTime       = tactTime,
                LastEqpEndTime = planStartTime
            };

            dcnMst.Buckets.Add(bucket);
        }
Ejemplo n.º 6
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;
            }
        }
Ejemplo n.º 7
0
        private static bool Allocate(this DcnMaster mst, DcnBucket bck, DcnTarget target, int lotSize, DateTime now, out int diff)
        {
            diff = 0;

            int targetQty = target.RemainQty;

            if (lotSize <= 0)
            {
                lotSize = targetQty;
            }

            //lotSize 단위로 Alloc
            int remain = targetQty;

            int allocQty = lotSize;
            var plan     = bck.Allocate(target.Product, allocQty, target, now);

            //전체 Alloc Plan 기록
            if (plan != null)
            {
                plan.AllocSeq = mst.AllPlans.Count + 1;

                mst.AllPlans.Add(plan);
                mst.Current.Add(plan);
            }

            remain = remain - allocQty;

            if (remain < 0)
            {
                diff = Math.Abs(remain);
            }

            bool isNoAlloc = remain == targetQty;

            if (isNoAlloc)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 8
0
        private static bool Allocate_FixPlan(this DcnMaster mst, DcnBucket bck, DcnTarget target, FixPlanDCN fixPlan, DateTime now)
        {
            int allocQty = fixPlan.PLAN_QTY;

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

            FabProduct prod = target == null ? null : target.Product;

            if (prod == null)
            {
                prod = BopHelper.FindProduct(fixPlan.SHOP_ID, fixPlan.PRODUCT_ID);
            }

            if (prod == null)
            {
                return(false);
            }

            var plan = bck.Allocate(prod, allocQty, target, now);

            //전체 Alloc Plan 기록
            if (plan != null)
            {
                plan.FixPlan  = fixPlan;
                plan.AllocSeq = mst.AllPlans.Count + 1;

                mst.AllPlans.Add(plan);
                mst.Current.Add(plan);
            }

            bool isNoAlloc = plan == null;

            if (isNoAlloc)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 9
0
        private static DcnTarget SelectTarget(this DcnMaster mst, DcnBucket bck, List <DcnTarget> targetList)
        {
            if (bck == null)
            {
                return(null);
            }

            var list = mst.GetLoadableTargetList(bck, targetList);

            if (list == null || list.Count == 0)
            {
                return(null);
            }

            if (list.Count > 1)
            {
                list.Sort(new DcnTargetComparer(bck, mst.SupportSteps, mst.SupportEqps));
            }

            return(list[0]);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
        private static bool CanAllocate(this DcnBucket bck, DateTime startTime, DateTime endTime, DcnTarget target, bool checkMainShopTarget)
        {
            //MainShopTarget이 남은 경우에만 체크
            if (checkMainShopTarget && bck.HasMainRunShop())
            {
                if (target != null && bck.MainRunShopID != target.ShopID)
                {
                    return(false);
                }
            }

            if (bck.Remain <= 0)
            {
                return(false);
            }

            if (bck.LastEqpEndTime >= endTime)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 12
0
 public DcnTargetComparer(DcnBucket bck, List <FabStdStep> supportSteps, List <FabAoEquipment> supportEqps)
 {
     this.Bucket       = bck;
     this.SupportSteps = supportSteps;
     this.SupportEqps  = supportEqps;
 }
Ejemplo n.º 13
0
 private static void OnDayChanged(this DcnBucket bck, DateTime now)
 {
     bck.Usage          = 0;
     bck.LastEqpEndTime = now;
 }
Ejemplo n.º 14
0
 private static void Allocate_Init(this DcnBucket bck, DateTime now)
 {
     bck.LastEqpEndTime = now;
 }
Ejemplo n.º 15
0
 private static bool HasMainRunShop(this DcnBucket bck)
 {
     return(string.IsNullOrEmpty(bck.MainRunShopID) == false);
 }