Ejemplo n.º 1
0
        private static int FixedTargetQty(this DcnMaster mst, DcnTarget target)
        {
            if (target == null)
            {
                return(0);
            }

            string key = target.ProductID;

            int prevDiff;

            if (mst.Diffs.TryGetValue(key, out prevDiff))
            {
                int targetQty = target.RemainQty;

                int min      = Math.Min(targetQty, prevDiff);
                int allocQty = min;

                target.AllocQty += allocQty;

                int remainDiff = prevDiff - allocQty;

                if (remainDiff <= 0)
                {
                    mst.Diffs.Remove(key);
                }
                else
                {
                    mst.Diffs[key] = remainDiff;
                }
            }

            return(target.RemainQty);
        }
Ejemplo n.º 2
0
        private static bool IsEquals_Key(this DcnTarget target, string productID)
        {
            if (productID != target.ProductID)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        private static void AddDcnTarget(ShopInTarget inTarget)
        {
            if (inTarget == null)
            {
                return;
            }

            //CELL 제외
            if (BopHelper.IsCellShop(inTarget.ShopID))
            {
                return;
            }

            int qty = (int)inTarget.TargetQty;

            if (qty <= 0)
            {
                return;
            }

            var product = inTarget.Product;

            if (product == null)
            {
                return;
            }

            FabStep inTargetStep = inTarget.TargetStep;

            if (inTargetStep == null)
            {
                return;
            }

            var dcnMst = ReleasePlanMaster.DcnMst;

            string shopID = product.ShopID;

            //ARRAY=A000, CF=C000
            string   stepID     = ReleasePlanMaster.GetShopStep(shopID);
            DateTime targetDate = inTarget.TargetDate;

            DcnTarget target = new DcnTarget()
            {
                InTarget   = inTarget,
                TargetStep = inTargetStep,
                Product    = product,
                StepID     = stepID,
                TargetDate = targetDate,
                TargetQty  = qty
            };

            dcnMst.AllTargets.Add(target);
        }
Ejemplo n.º 4
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.º 5
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.º 6
0
        private static void UpdateDiff(this DcnMaster mst, DcnTarget target, int diffQty)
        {
            if (diffQty == 0)
            {
                return;
            }

            string key = target.ProductID;

            int prev;

            if (mst.Diffs.TryGetValue(key, out prev))
            {
                mst.Diffs[key] = prev + diffQty;
            }
            else
            {
                mst.Diffs.Add(key, diffQty);
            }
        }
Ejemplo n.º 7
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.º 8
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);
        }