Esempio n. 1
0
        public static bool IsNeedSetupProfile(WorkEqp weqp, IHandlingBatch hb)
        {
            try
            {
                MicronBEAssyEqp eqp = null;
                if (InputMart.Instance.MicronBEAssyEqp.ContainsKey(weqp.Target.EqpID))
                {
                    eqp = InputMart.Instance.MicronBEAssyEqp[weqp.Target.EqpID];
                }

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

                MicronBEAssyBELot lot = hb as MicronBEAssyBELot;

                BEStep     step = lot.CurrentStep;
                StepMaster sm   = InputMart.Instance.StepMasterView.FindRows(step.StepID).FirstOrDefault();

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

                foreach (var info in InputMart.Instance.SetupInfo.DefaultView)
                {
                    if (info.LINE_ID != eqp.LineID)
                    {
                        continue;
                    }

                    //if (UtilityHelper.StringToEnum(info.STEP_GROUP, StepGroup.NONE) != eqp.StepGroup)
                    //    continue;

                    //if (LikeUtility.Like(eqp.EqpModel, info.EQP_MODEL) == false)
                    //    continue;

                    SetupType type = SimulationHelper.CheckSetupProfile(weqp, hb);

                    if (type != SetupType.NONE)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }

                return(false);
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// </summary>
 /// <param name="wstep"/>
 /// <param name="list"/>
 /// <param name="handled"/>
 public void SORT_PROFILE_LOT0(WorkStep wstep, WorkEqp weqp, List <WorkLot> list, ref bool handled)
 {
     try
     {
         list.Sort(new ComparerHelper.LotCompare());
     }
     catch (Exception e)
     {
         WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
     }
 }
Esempio n. 3
0
        public static Time GetSetupTimeProfile(WorkEqp weqp, IHandlingBatch hb)
        {
            try
            {
                MicronBEAssyEqp eqp = null;
                if (InputMart.Instance.MicronBEAssyEqp.ContainsKey(weqp.Target.EqpID))
                {
                    eqp = InputMart.Instance.MicronBEAssyEqp[weqp.Target.EqpID];
                }

                if (eqp == null)
                {
                    return(default(Time));
                }

                MicronBEAssyBELot lot = hb as MicronBEAssyBELot;

                BEStep     step = lot.CurrentStep;
                StepMaster sm   = InputMart.Instance.StepMasterView.FindRows(step.StepID).FirstOrDefault();

                foreach (var info in InputMart.Instance.SetupInfo.DefaultView)
                {
                    if (info.LINE_ID != sm.LINE_ID)
                    {
                        continue;
                    }

                    //if (UtilityHelper.StringToEnum(info.STEP_GROUP, StepGroup.NONE) != eqp.StepGroup)
                    //    continue;

                    //if (LikeUtility.Like(eqp.EqpModel, info.EQP_MODEL) == false)
                    //    continue;

                    double setupTimeBySec = (double)info.SETUP_TIME;
                    return(Time.FromSeconds(setupTimeBySec));
                }

                return(default(Time));
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
                return(default(Time));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// </summary>
        /// <param name="weqp"/>
        /// <param name="wstep"/>
        /// <param name="list"/>
        /// <param name="handled"/>
        /// <param name="prevReturnValue"/>
        /// <returns/>
        public List <WorkLot> DO_FILTER_LOT0(WorkEqp weqp, WorkStep wstep, List <WorkLot> list, ref bool handled, List <WorkLot> prevReturnValue)
        {
            try
            {
#if DEBUG
                if (weqp.Target.EqpID == "DA03" && wstep.Key.ToString() == "S0100")
                {
                    Console.WriteLine();
                }
#endif
                MicronBEAssyWorkStep ws = wstep as MicronBEAssyWorkStep;

                List <WorkLot> lotList = new List <WorkLot>();
                foreach (MicronBEAssyWorkLot lot in list)
                {
                    AssyMcpPart mcpPart = lot.Product as AssyMcpPart;

                    if (mcpPart != null && mcpPart.IsBase == false)
                    {
                        continue;
                    }

                    MicronBEAssyBELot beLot = lot.Batch as MicronBEAssyBELot;

                    if (lot.ReservationEqp != null && lot.ReservationEqp != weqp.Target)
                    {
                        continue;
                    }

                    lotList.Add(lot);
                }

                if (lotList.IsNullOrEmpty())
                {
                    weqp.Stop = true;
                }

                return(lotList);
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
                return(default(List <WorkLot>));
            }
        }
Esempio n. 5
0
        /// <summary>
        /// </summary>
        /// <param name="wl"/>
        /// <param name="handled"/>
        /// <param name="prevReturnValue"/>
        /// <returns/>
        public WorkEqp SELECT_PROFILE_EQP0(WorkLoader wl, ref bool handled, WorkEqp prevReturnValue)
        {
            try
            {
                WorkEqp selectEqp        = null;
                Time    minAvailableTime = DateTime.MaxValue;

#if DEBUG
                //var a = FindHelper.GetNowDT();

                //if (FindHelper.GetNowDT().Hour == 11 && FindHelper.GetNowDT().Minute == 40)
                //    Console.WriteLine();
#endif

                List <WorkEqp> list = new List <WorkEqp>(wl.EqpList);

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

                foreach (WorkEqp eqp in list)
                {
                    if (eqp.IsDone())
                    {
                        continue;
                    }

                    if (selectEqp == null || minAvailableTime > eqp.AvailableTime)
                    {
                        minAvailableTime = eqp.AvailableTime;
                        selectEqp        = eqp;
                    }
                }

                return(selectEqp);
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
                return(default(WorkEqp));
            }
        }
Esempio n. 6
0
        public static SetupType CheckSetupProfile(WorkEqp weqp, Mozart.SeePlan.Simulation.IHandlingBatch hb)
        {
            try
            {
                MicronBEAssyBELot lot = hb as MicronBEAssyBELot;
                var workLots          = weqp.Step.Profiles[weqp];
                var lastLot           = workLots.Last().Lot as MicronBEAssyBELot;

                if (lastLot.Product.ProductID != lot.Product.ProductID)
                {
                    return(SetupType.PART_CHG);
                }

                return(SetupType.NONE);
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
                return(SetupType.NONE);
            }
        }
Esempio n. 7
0
        public static DateTime CalculateAvailableDownTime(WorkStep wstep, AssignEqp assignEqp, ref double setupTime)
        {
            try
            {
                MicronBEAssyWorkStep ws = wstep as MicronBEAssyWorkStep;

                DateTime nowDt             = FindHelper.GetNowDT();
                DateTime availableDownTime = nowDt.AddSeconds(wstep.NewUpInterval.TotalSeconds);

                var wip = ws.Wips.FirstOrDefault();
                if (wip == null)
                {
                    return(availableDownTime);
                }

                WorkEqp weqp = null;
                foreach (var item in ws.LoadedEqps)
                {
                    if (item.Target == assignEqp.Target)
                    {
                        weqp = item;
                        break;
                    }
                }

                var setupControl   = ServiceLocator.Resolve <SetupControl>();
                var processControl = ServiceLocator.Resolve <ProcessControl>();

                var beLot = wip.Lot as MicronBEAssyBELot;

                bool isNeedSetup = false;
                setupTime = 0d;
                ICollection <WorkLot> lastWorkLots = null;

                if (weqp.Step != null)
                {
                    lastWorkLots = weqp.Step.Profiles[weqp];
                }

                if (lastWorkLots != null && lastWorkLots.Count != 0)
                {
                    isNeedSetup = SimulationHelper.IsNeedSetupProfile(weqp, beLot);
                    if (isNeedSetup)
                    {
                        setupTime = SimulationHelper.GetSetupTimeProfile(weqp, beLot).TotalSeconds;
                    }
                }
                else
                {
                    bool _handled = false;
                    isNeedSetup = processControl.IS_NEED_SETUP0(weqp.Target, beLot, ref _handled, false);
                    if (isNeedSetup)
                    {
                        setupTime = setupControl.GET_SETUP_TIME0(weqp.Target, beLot, ref _handled, default(Mozart.Simulation.Engine.Time)).TotalSeconds;
                    }
                }

                availableDownTime = availableDownTime.AddSeconds(setupTime);
                return(availableDownTime);
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
                return(default(DateTime));
            }
        }
Esempio n. 8
0
 /// <summary>
 /// </summary>
 /// <param name="weqp"/>
 /// <param name="handled"/>
 public void INITIALIZE_WORK_EQP0(WorkEqp weqp, ref bool handled)
 {
     weqp.IncludeBufferForAvailableTime = false;
 }
Esempio n. 9
0
        /// <summary>
        /// </summary>
        /// <param name="weqp"/>
        /// <param name="wlot"/>
        /// <param name="handled"/>
        /// <param name="prevReturnValue"/>
        /// <returns/>
        public TimeSpan GET_TACT_TIME0(WorkEqp weqp, WorkLot wlot, ref bool handled, TimeSpan prevReturnValue)
        {
            try
            {
                MicronBEAssyWorkLot lot = wlot as MicronBEAssyWorkLot;

                double            unitQty = (wlot.Batch as MicronBEAssyBELot).UnitQtyDouble;
                MicronBEAssyBELot beLot   = wlot.Batch as MicronBEAssyBELot;

                var setupControl   = ServiceLocator.Resolve <SetupControl>();
                var processControl = ServiceLocator.Resolve <ProcessControl>();

                MicronBEAssyEqp eqp      = FindHelper.FindEquipment(weqp.Target.EqpID);
                double          tactTime = SimulationHelper.GetTactTime(beLot.LineID, lot.Step.StepID, lot.Product.ProductID, eqp);

                if (beLot.CurrentStepID != weqp.Step.Key.ToString())
                {
                    return(TimeSpan.FromSeconds(tactTime * unitQty));
                }

#if DEBUG
                //if (lot.LotID == "LOT10_3")
                //    Console.WriteLine();

                //if (FindHelper.GetNowDT().Hour == 22 && FindHelper.GetNowDT().Minute == 30)
                //    Console.WriteLine();

                var nowDt = FindHelper.GetNowDT();
                if (lot.LotID == "LOT10_9" && lot.Step.Key.ToString() == "S0300" && weqp.Target.EqpID == "DA01" && nowDt >= new DateTime(2018, 01, 26, 12, 00, 00))
                {
                    Console.WriteLine();
                }
#endif

                bool   isNeedSetup = false;
                double setupTime   = 0d;

                var lastWorkLots = weqp.Step.Profiles[weqp];

                if (lastWorkLots != null && lastWorkLots.Count != 0)
                {
                    isNeedSetup = SimulationHelper.IsNeedSetupProfile(weqp, beLot);
                    if (isNeedSetup)
                    {
                        setupTime = SimulationHelper.GetSetupTimeProfile(weqp, beLot).TotalSeconds;
                    }
                }
                else
                {
                    bool _handled = false;
                    isNeedSetup = processControl.IS_NEED_SETUP0(weqp.Target, beLot, ref _handled, false);
                    if (isNeedSetup)
                    {
                        setupTime = setupControl.GET_SETUP_TIME0(weqp.Target, beLot, ref _handled, default(Mozart.Simulation.Engine.Time)).TotalSeconds;
                    }
                }

                double tactTimeWithSetup = setupTime + (tactTime * unitQty);
                return(TimeSpan.FromSeconds(tactTimeWithSetup));

                //return TimeSpan.FromSeconds(tactTime);
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
                return(default(TimeSpan));
            }
        }