Example #1
0
        /// <summary>
        /// </summary>
        /// <param name="db"/>
        /// <param name="wips"/>
        /// <param name="ctx"/>
        /// <param name="handled"/>
        /// <param name="prevReturnValue"/>
        /// <returns/>
        public IList <IHandlingBatch> EVALUATE0(Mozart.SeePlan.Simulation.DispatcherBase db, IList <Mozart.SeePlan.Simulation.IHandlingBatch> wips, Mozart.SeePlan.Simulation.IDispatchContext ctx, ref bool handled, IList <Mozart.SeePlan.Simulation.IHandlingBatch> prevReturnValue)
        {
            if (db is FifoDispatcher)
            {
                return(wips);
            }

            if (db.Comparer == null)
            {
                return(wips);
            }

            var stepDic = new Dictionary <string, WeightInfo>();

            var list = new List <IHandlingBatch>(wips.Count);

            var eqp = db.Eqp.ToFabAoEquipment();

            if (eqp.Dispatcher is WeightSumDispatcher)
            {
                db.Comparer = new CompareHelper.WeightSumComparer(eqp);
            }

            foreach (IHandlingBatch hb in wips)
            {
                if (hb.Sample == null)
                {
                    continue;
                }

                var lot = hb.Sample;

                lot.WeightInfo = new WeightInfo();
                WeightInfo lotInfo = lot.WeightInfo;
                WeightInfo stepInfo;
                if (!stepDic.TryGetValue(lot.CurrentStep.StepID, out stepInfo))
                {
                    stepDic.Add(lot.CurrentStep.StepID, stepInfo = new WeightInfo());
                }


                bool hasMinusValue = false;

                if (db.FactorList != null)
                {
                    //Logger.Info(string.Format("<< {0} EVALUATE {1} >>");
                    foreach (var info in db.FactorList)
                    {
                        WeightValue     wval   = null;
                        FabWeightFactor factor = info.Factor as FabWeightFactor;

                        if (factor.Type == FactorType.FIXED)
                        {
                            wval = lotInfo.GetValueData(factor);
                            if (wval.IsMinValue)
                            {
                                wval = db.WeightEval.GetWeight(factor, info.Method, lot, ctx);
                            }
                        }
                        else if (factor.Type == FactorType.STEPTYPE)
                        {
                            wval = stepInfo.GetValueData(factor);
                            if (wval.IsMinValue)
                            {
                                wval = db.WeightEval.GetWeight(factor, info.Method, lot, ctx);
                            }

                            stepInfo.SetValueData(factor, wval);
                        }
                        else                         //LOTTYPE
                        {
                            wval = db.WeightEval.GetWeight(factor, info.Method, lot, ctx);

                            //Factor가 하나라도 음수를 가질 경우 해당 재공은 제외 (필터를 허용할 경우)
                            if (wval.Value < 0)
                            {
                                wval = new WeightValue(factor, 0, wval.Description);

                                if (factor.IsAllowFilter)
                                {
                                    lotInfo.SetValueData(factor, wval);
                                    hasMinusValue = true;

                                    db.Eqp.EqpDispatchInfo.AddFilteredWipInfo(hb, string.Format("Minus_Value:{0}, Desc:{1}", factor.Name, wval.Description));
                                }
                            }
                        }

                        lotInfo.SetValueData(factor, wval);
                    }
                }

                if (hasMinusValue == false)
                {
                    list.AddSort(hb, db.Comparer);
                }
            }

            return(list);
        }