Пример #1
0
        /// <summary>
        /// </summary>
        /// <param name="entity"/>
        /// <param name="now"/>
        /// <param name="target"/>
        /// <param name="factor"/>
        /// <param name="ctx"/>
        /// <returns/>
        public WeightValue SETUP_PRIORITY(Mozart.Simulation.Engine.ISimEntity entity, DateTime now, Mozart.Simulation.Engine.ActiveObject target, Mozart.SeePlan.DataModel.WeightFactor factor, Mozart.SeePlan.Simulation.IDispatchContext ctx)
        {
            if (factor.Factor == 0)
            {
                return(new WeightValue(0));
            }

            float score = 1f;

            FabAoEquipment aeqp = target as FabAoEquipment;
            FabLot         lot  = entity as FabLot;

            float setupTime = SetupMaster.GetSetupTime(aeqp, lot);

            if (setupTime > 0)
            {
                score = 0;
            }

            return(new WeightValue(score * factor.Factor));
        }
Пример #2
0
        /// <summary>
        /// </summary>
        /// <param name="entity"/>
        /// <param name="now"/>
        /// <param name="target"/>
        /// <param name="factor"/>
        /// <param name="ctx"/>
        /// <returns/>
        public WeightValue SETUP_TIME_PRIORITY(Mozart.Simulation.Engine.ISimEntity entity, DateTime now, Mozart.Simulation.Engine.ActiveObject target, Mozart.SeePlan.DataModel.WeightFactor factor, Mozart.SeePlan.Simulation.IDispatchContext ctx)
        {
            if (factor.Factor == 0)
            {
                return(new WeightValue(0));
            }

            float score     = 1;
            int   criteria0 = 1;

            if (factor.Criteria != null && factor.Criteria.Length > 0)
            {
                criteria0 = Math.Max((int)factor.Criteria[0], 1);
            }

            int cutMinutes = (int)Time.FromMinutes(criteria0).TotalMinutes;

            FabAoEquipment aeqp = target as FabAoEquipment;
            FabLot         lot  = entity as FabLot;

            //if (aeqp.EqpID == "THCVD300" && aeqp.NowDT >= LcdHelper.StringToDateTime("20200108 123433"))
            //	Console.WriteLine("B");

            float setupTime    = SetupMaster.GetSetupTime(aeqp, lot);
            float maxSetupTime = WeightHelper.GetMaxVaule_WF(ctx, Constants.WF_SETUP_TIME_PRIORITY, 0f);

            if (setupTime > 0 && maxSetupTime > 0)
            {
                float s = (int)(setupTime / cutMinutes);
                float m = (int)(maxSetupTime / cutMinutes);
                float r = m == 0 ? 0 : (float)Math.Round(s / m, 3);

                score = 1 - r;
            }

            string desc = string.Format("[{0} = SETUP:{1}m/MAX:{2}m]", score, setupTime, maxSetupTime);

            return(new WeightValue(score * factor.Factor, desc));
        }
Пример #3
0
        public IHandlingBatch[] SELECT1(DispatcherBase db, AoEquipment aeqp, IList <IHandlingBatch> wips, ref bool handled, IHandlingBatch[] prevReturnValue)
        {
            if (InputMart.Instance.GlobalParameters.ApplyFlexialePMSchedule == false)
            {
                return(prevReturnValue);
            }

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

            var list = aeqp.DownManager.GetStartScheduleItems(Time.MaxValue);

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

            FabLot lot = prevReturnValue[0] as FabLot;

            var eqp     = aeqp.ToFabAoEquipment();
            var proc    = eqp.Processes[0];
            var outTime = proc.GetUnloadingTime(lot);

            bool isLast      = eqp.IsLastPlan(lot);
            bool isNeedSetup = ResHelper.IsNeedSetup(eqp, lot);

            foreach (var item in list)
            {
                var schedule = item.Tag as PeriodSection;
                var isPM     = schedule is PMSchedule;

                if (isPM == false)
                {
                    continue;
                }

                var pm = schedule as FabPMSchedule;
                var reaminNextPMStart = pm.StartTime - eqp.NowDT;

                //하루 이내만 조정
                if (reaminNextPMStart.TotalDays > 1)
                {
                    continue;
                }

                bool          isAdjust = false;
                FabPMSchedule adjust   = pm.Clone() as FabPMSchedule;

                if (isLast)
                {
                    if ((DateTime)outTime < pm.LimitDelayTime && outTime > pm.StartTime)
                    {
                        adjust.StartTime      = (DateTime)outTime;
                        adjust.EndTime        = adjust.StartTime.AddMinutes(pm.InputDuration.TotalMinutes);
                        adjust.Description    = "DELAY";
                        adjust.AllowAheadTime = (float)(outTime - eqp.Now).TotalMinutes;
                        adjust.ScheduleType   = DownScheduleType.ShiftBackward;

                        aeqp.DownManager.AdjustEvent(item, adjust);
                        isAdjust = true;
                    }
                }
                else
                {
                    if (reaminNextPMStart.TotalMinutes < pm.AllowAheadTime)
                    {
                        prevReturnValue  = null;
                        adjust.StartTime = aeqp.NowDT;
                        adjust.EndTime   = adjust.StartTime.AddMinutes(pm.InputDuration.TotalMinutes);

                        if (adjust.Description != "DELAY")
                        {
                            adjust.Description = "AHEAD";
                        }

                        adjust.IsNeedAdjust = false;

                        aeqp.DownManager.AdjustEvent(item, adjust);
                        isAdjust = true;
                    }
                }

                if (isAdjust == false && pm.StartTime < outTime)
                {
                    float setupTime = 0f;
                    if (isNeedSetup)
                    {
                        setupTime = SetupMaster.GetSetupTime(aeqp, lot);
                    }

                    adjust.StartTime = (DateTime)(outTime + Time.FromMinutes(setupTime));
                    adjust.EndTime   = adjust.StartTime.AddMinutes(pm.InputDuration.TotalMinutes);

                    aeqp.DownManager.AdjustEvent(item, adjust);
                }
            }

            //var data = aeqp.DownManager.GetStartScheduleItems(Time.MaxValue);
            return(prevReturnValue);
        }