Ejemplo n.º 1
0
        internal static List <FabLot> WaitForPrevStepWip_Dummy(IDispatchContext ctx, FabAoEquipment eqp)
        {
            List <JobFilterInfo> jobList = ctx.Get <List <JobFilterInfo> >(Constants.JobGroup, null);

            if (jobList == null)
            {
                return(null);
            }

            FabPlanInfo last = eqp.GetLastPlan();             //eqp.LastPlan as FabPlanInfo;

            if (last == null)
            {
                return(null);
            }

            //if (eqp.EqpID == "THWEM200" && LcdHelper.StringToDateTime("20191021235617") <= eqp.NowDT)
            //	Console.WriteLine();

            JobState state = InFlowMaster.GetJobState(last.ProductID, last.OwnerType);

            if (state == null)
            {
                return(null);
            }

            var holdWips   = state.GetHoldWipList(last.FabStep, last.ProductVersion);
            var prvRunWips = state.GetPrevStepRunWipList(last.FabStep, last.ProductVersion);

            JobFilterInfo        minSetupJobFilter     = null;
            List <JobFilterInfo> filteredList          = new List <JobFilterInfo>();
            Dictionary <string, JobFilterInfo> current = new Dictionary <string, JobFilterInfo>();

            foreach (var info in jobList)
            {
                if (info.IsEmpty)
                {
                    continue;
                }

                string key = FilterHelper.GetJobFilterKey(info);
                current.Add(key, info);

                if (FilterHelper.CheckIsRunning(eqp, info))
                {
                    filteredList.Add(info);
                    continue;
                }

                if (info.FilterType != DispatchFilter.None)
                {
                    filteredList.Add(info);
                    continue;
                }

                if (info.SetupTime == 0)
                {
                    continue;
                }

                if (minSetupJobFilter == null)
                {
                    minSetupJobFilter = info;
                }

                if (minSetupJobFilter.SetupTime > info.SetupTime)
                {
                    minSetupJobFilter = info;
                }
            }

            if (minSetupJobFilter == null)
            {
                return(null);
            }

            Dictionary <string, FabLot> avableLots = new Dictionary <string, FabLot>();

            foreach (var lot in holdWips)
            {
                if (eqp.IsLastPlan(lot.CurrentShopID, last.StepID, lot.CurrentProductID, lot.CurrentProductVersion, lot.OwnerType, lot.OwnerID))
                {
                    continue;
                }

                string key = FilterHelper.GetJobFilterKey(lot.CurrentShopID, last.StepID, lot.CurrentProductID, lot.CurrentProductVersion, lot.OwnerType);
                if (current.ContainsKey(key))
                {
                    continue;
                }

                Time  remainHold = lot.HoldTime - (eqp.NowDT - lot.HoldStartTime);
                float setupTime  = SetupMaster.GetSetupTime(eqp, lot);

                if (remainHold.TotalMinutes + setupTime < minSetupJobFilter.SetupTime)
                {
                    if (avableLots.ContainsKey(key) == false)
                    {
                        avableLots.Add(key, lot);
                    }
                }
            }

            foreach (var lot in prvRunWips)
            {
                string lastShopID         = last.ShopID;
                string lastStepID         = last.StepID;
                string currProductID      = lot.CurrentProductID;
                string origProductVersion = lot.OrigProductVersion;
                string ownerType          = lot.OwnerType;
                string ownerID            = lot.OwnerID;

                //TODO : bong - product version ??
                if (eqp.IsLastPlan(lastShopID, lastStepID, currProductID, origProductVersion, ownerType, ownerID))
                {
                    continue;
                }

                string key = FilterHelper.GetJobFilterKey(lastShopID, lastStepID, currProductID, origProductVersion, ownerType);
                if (current.ContainsKey(key))
                {
                    continue;
                }

                Time tranferTime = TransferMaster.GetTransferTime(lot, eqp);
                Time setupTime   = SetupMaster.GetSetupTime(eqp, lastShopID, lastStepID, currProductID, origProductVersion, ownerType, ownerID);

                if (tranferTime + setupTime < minSetupJobFilter.SetupTime)
                {
                    if (avableLots.ContainsKey(key) == false)
                    {
                        avableLots.Add(key, lot);
                    }
                }
            }

            Dictionary <string, List <FabAoEquipment> > workingEqps = ResHelper.GetWorkingEqpInfos(eqp, true);

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

            foreach (var lot in avableLots.Values)
            {
                FabPlanInfo plan  = EntityControl.Instance.CreateLoadInfo(lot, last.Step) as FabPlanInfo;
                FabLot      dummy = CreateHelper.CreateDispatchDummyLot(last.FabStep, plan);
                dummy.LotID = "DUMMY_PREVSTEP";

                JobFilterInfo jobfilter = CreateHelper.CreateDispatchFilterInfo(last.Step as FabStep, lot.CurrentProductID, lot.OrigProductVersion, lot.OwnerType, lot.OwnerID);
                jobfilter.InitJobFilterInfo(eqp, workingEqps);
                jobfilter.LotList.Add(dummy);
                dummy.DispatchFilterInfo = jobfilter;

                list.Add(dummy);
            }

            return(list);
        }
Ejemplo n.º 2
0
        public static List <JobFilterInfo> CreateJobList(AoEquipment aeqp, IList <IHandlingBatch> list)
        {
            Dictionary <string, JobFilterInfo> joblist
                = new Dictionary <string, JobFilterInfo>();

            FabAoEquipment eqp  = aeqp as FabAoEquipment;
            var            last = eqp.GetLastPlan();

            if (last != null)
            {
                FabPlanInfo plan = last;

                string shopID    = plan.Step.StepID;
                string stepID    = plan.StepID;
                string productID = plan.ProductID;
                string prodVer   = plan.ProductVersion;
                string ownerType = plan.OwnerType;
                string ownerID   = plan.OwnerID;

                string key = GetJobFilterKey(shopID, stepID, productID, prodVer, ownerType);

                JobFilterInfo info = CreateHelper.CreateDispatchFilterInfo(plan.FabStep, productID, prodVer, ownerType, ownerID);
                info.IsEmpty = true;

                joblist.Add(key, info);
                eqp.LastPlanFilterInfo = info;
            }

            foreach (IHandlingBatch hb in list)
            {
                FabLot lot = hb.ToFabLot();

                lot.DispatchFilterInfo = null;

                string productID = lot.CurrentProductID;
                string prodVer   = lot.CurrentProductVersion;
                string ownerType = lot.CurrentFabPlan.OwnerType;
                string ownerID   = lot.OwnerID;

                FabStep step = lot.CurrentFabStep;

                string key = GetJobFilterKey(step.ShopID, step.StepID, productID, prodVer, ownerType);

                JobFilterInfo info;
                if (joblist.TryGetValue(key, out info) == false)
                {
                    joblist.Add(key, info = CreateHelper.CreateDispatchFilterInfo(step, productID, prodVer, ownerType, ownerID));
                }

                if (hb.HasContents)
                {
                    foreach (FabLot item in hb.Contents)
                    {
                        info.LotList.Add(item);
                        info.WaitSum += item.UnitQty;

                        item.DispatchFilterInfo = info;
                        item.CurrentFabPlan.LotFilterInfo.Clear();
                    }
                }
                else
                {
                    info.LotList.Add(lot);
                    info.WaitSum += lot.UnitQty;

                    lot.DispatchFilterInfo = info;
                    lot.CurrentFabPlan.LotFilterInfo.Clear();
                }

                info.IsEmpty = false;
            }

            foreach (var info in joblist.Values)
            {
                info.WorkingEqpCnt = info.Step.StdStep.GetWorkingEqpCount(info, true, false);

                info.ExistInflowWip = info.WaitSum > 0;
                if (info.ExistInflowWip == false)
                {
                    if (ExistInflowWip(eqp, info))
                    {
                        info.ExistInflowWip = true;
                    }
                }
            }

            return(joblist.Values.ToList());
        }