コード例 #1
0
        public static MicronBEAssyBatch CreateBatch(MicronBEAssyBELot lot)
        {
            try
            {
                AssyMcpProduct aoProd = lot.Product.GetAssyOutProduct();

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

                string aoProdID = aoProd.ProductID;

                Tuple <string, string> key = Tuple.Create(aoProdID, lot.LineID);
                MicronBEAssyBatch      batch;
                if (InputMart.Instance.MicronBEAssyBatch.TryGetValue(key, out batch) == false)
                {
                    batch          = new MicronBEAssyBatch();
                    batch.AoProdID = aoProdID;
                    batch.LineID   = lot.LineID;

                    SimulationHelper.SetSteps(batch, lot.Product);

                    InputMart.Instance.MicronBEAssyBatch.Add(key, batch);
                }

                return(batch);
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
                return(default(MicronBEAssyBatch));
            }
        }
コード例 #2
0
ファイル: SimulationHelper.cs プロジェクト: parkheenam/test
        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);
            }
        }
コード例 #3
0
ファイル: SimulationHelper.cs プロジェクト: parkheenam/test
        public static void UpdateEqpPlanQty(MicronBEAssyBELot lot, string eqpID, string status, double qty)
        {
            try
            {
                string key = SimulationHelper.GetEqpPlanKey(lot, eqpID, status);

                EqpPlan eqpPlan = null;
                if (InputMart.Instance.EqpPlans.TryGetValue(key, out eqpPlan))
                {
                    eqpPlan.QTY = Convert.ToDecimal(qty);
                }
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
            }
        }
コード例 #4
0
ファイル: SimulationHelper.cs プロジェクト: parkheenam/test
        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));
            }
        }
コード例 #5
0
ファイル: SimulationHelper.cs プロジェクト: parkheenam/test
        public static void CollectEqpPlan(Mozart.SeePlan.Simulation.IHandlingBatch hb, AoEquipment equip, string status)
        {
            try
            {
                MicronBEAssyBELot lot = hb as MicronBEAssyBELot;

                string eqpID = string.Empty;
                if (equip != null)
                {
                    eqpID = equip.EqpID;
                }

                string waitPlanKey = SimulationHelper.GetEqpPlanKey(lot, string.Empty, LoadState.WAIT.ToString());
                if (InputMart.Instance.EqpPlans.ContainsKey(waitPlanKey))
                {
                    InputMart.Instance.EqpPlans.Remove(waitPlanKey);
                }

                string waitPlanKeyWithEqp = SimulationHelper.GetEqpPlanKey(lot, eqpID, LoadState.WAIT.ToString());
                if (InputMart.Instance.EqpPlans.ContainsKey(waitPlanKeyWithEqp))
                {
                    InputMart.Instance.EqpPlans.Remove(waitPlanKeyWithEqp);
                }

                string key            = SimulationHelper.GetEqpPlanKey(lot, eqpID, status);
                string arrivalTimeKey = lot.LotID.Split('_')[0] + lot.CurrentStepID;

                EqpPlan plan;
                if (InputMart.Instance.EqpPlans.TryGetValue(key, out plan) == false)
                {
                    MicronBEAssyEqp eqp;
                    InputMart.Instance.MicronBEAssyEqp.TryGetValue(eqpID, out eqp);

                    plan = new EqpPlan();

                    plan.LINE_ID      = lot.LineID;
                    plan.PRODUCT_ID   = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? status : lot.Product.ProductID;
                    plan.LOT_ID       = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? Mozart.SeePlan.StringUtility.IdentityNull : lot.LotID;
                    plan.INIT_STEP    = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? Mozart.SeePlan.StringUtility.IdentityNull : lot.WipInfo.InitialStep.StepID;
                    plan.ARRIVAL_TIME = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? default(DateTime) : FindHelper.GetNowDT();
                    plan.PROCESS_ID   = lot.CurrentStep.Process.ProcessID;
                    plan.STEP_ID      = lot.CurrentStepID;
                    plan.EQP_ID       = eqpID;
                    //plan.STEP_GROUP = eqp == null ? Mozart.SeePlan.StringUtility.IdentityNull : eqp.StepGroup.ToString();
                    plan.QTY        = lot.UnitQty;
                    plan.STATUS     = status;
                    plan.DESIGN_ID  = lot.Product.DesignID();
                    plan.SEQUENCE   = lot.CurrentStep.Sequence;
                    plan.COMP_SEQ   = lot.Product is AssyMcpPart ? (lot.Product as AssyMcpPart).CompSeq : 1;
                    plan.IS_BASE    = UtilityHelper.IsYN(lot.Product.IsBase());
                    plan.STEP_GROUP = (lot.CurrentStep as MicronBEAssyBEStep).StepGroup;

                    if (lot.Product is AssyMcpProduct)
                    {
                        plan.FINAL_PROD_ID = lot.Product.ProductID;
                    }
                    else if (lot.Product is AssyMcpPart)
                    {
                        plan.FINAL_PROD_ID = (lot.Product as AssyMcpPart).FinalProduct.ProductID;
                    }
                    else
                    {
                        plan.FINAL_PROD_ID = lot.Product.ProductID;
                    }

                    InputMart.Instance.EqpPlans.Add(key, plan);

                    if (status == LoadState.WAIT.ToString())
                    {
                        DateTime arTime;
                        if (InputMart.Instance.ArrivalTime.TryGetValue(arrivalTimeKey, out arTime) == false)
                        {
                            InputMart.Instance.ArrivalTime.Add(arrivalTimeKey, plan.ARRIVAL_TIME);
                        }
                    }
                    else
                    {
                        plan.START_TIME = FindHelper.GetNowDT();
                        plan.END_TIME   = FindHelper.GetNowDT();
                    }
                }
                else
                {
                    DateTime arTime;
                    plan.END_TIME = FindHelper.GetNowDT();
                    InputMart.Instance.ArrivalTime.TryGetValue(arrivalTimeKey, out arTime);
                    plan.ARRIVAL_TIME = status == LoadingStates.SETUP.ToString() ? default(DateTime) : arTime;

                    key = SimulationHelper.GetEqpPlanKey(lot, eqpID, LoadingStates.SETUP.ToString());
                    EqpPlan setupPlan;
                    if (InputMart.Instance.EqpPlans.TryGetValue(key, out setupPlan))
                    {
                        setupPlan.PRODUCT_ID = lot.Product.ProductID;
                    }
                }
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
            }
        }