Beispiel #1
0
 public override void Exec(JitWork work, DateTime now)
 {
     if (work.Is(TargetWorkClass))
     {
         int nextLinkNo = DbUtil.ToInt(work.ChildVriables.GetValueOrNull(NextLinkVarName.Value.ToString())?.Value, def: -1);
         if (nextLinkNo >= 0)
         {
             var tarProc = GetCheckTargetProcess(work)?.Process;
             var nexts   = work.Current.SubsetCache.GetProcessLinkPathes(tarProc);
             var pathkey = nexts[nextLinkNo];
             work.Next = work.FindStage().FindSubsetProcess(work.Current, pathkey, false);
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// in-command execute
        /// </summary>
        /// <param name="work">target work</param>
        /// <param name="now">simulation time</param>
        public override void Exec(JitWork work, DateTime now)
        {
            var kanbans =
                from kanban in work.Kanbans
                where kanban.Is(TargetKanbanClass)
                where kanban.PullTo.Equals(work.Current)
                select kanban;

            foreach (var kanban in kanbans.ToArray())
            {
                work.Kanbans.Remove(kanban);
                kanban.Work = null;
                work.FindStage().SendKanban(now + Delay, kanban);
            }
        }
Beispiel #3
0
        /// <summary>
        /// check maximum cost constraint to let the work wait at previous process
        /// MAXコストの制約を調べる
        /// </summary>
        /// <param name="work"></param>
        /// <param name="now"></param>
        /// <returns>true=waiting</returns>
        public override bool Check(JitWork work, DateTime now)
        {
            var stage = work.FindStage();
            var wirs  = stage.GetWorksInReserve(work.Next, this);
            var costs =
                from w in wirs //tarloc
                let cost = w.ChildVriables.GetValueOrNull("Cost")
                           where cost != null
                           let varval = cost[ReferenceVarName]
                                        select Convert.ToDouble((varval?.Value as JitVariable)?.Value);

            double totalcost = costs.Sum();

            return(totalcost >= Value);
        }
Beispiel #4
0
        /// <summary>
        /// in-command execute
        /// </summary>
        /// <param name="work">target work</param>
        /// <param name="now">simulation time</param>
        public override void Exec(JitWork work, DateTime now)
        {
            var childworkNames =
                from cw in work.ChildWorks
                where cw.Value.Is(TargetWorkClass)
                select cw.Key;

            foreach (string childWorkName in childworkNames.ToArray())
            {
                var childWork = work.ChildWorks[childWorkName];
                childWork.Next    = work.Current.FindSubsetProcess(DestProcessKey, true); //work.Current.Subset.FindChildProcess(DestProcessKey);
                childWork.Current = work.Current.ToEmptyProcess();                        // 子Workであった事を Process = null とする。
                work.ChildWorks.Remove(childWorkName);                                    // Remove work from child works.  子ワークから外す
                work.FindStage().Events.Enqueue(now + Delay, EventTypes.Out, childWork);  // Reserve destination of push move. 次工程にPUSH予約
            }
        }
Beispiel #5
0
        /// <summary>
        /// exit a work from this process
        /// </summary>
        /// <param name="work"></param>
        /// <param name="now"></param>
        public virtual void Exit(JitWork work)
        {
            var stage = work.FindStage();

            stage.RemoveWorkFromSubsetProcess(work.Current, work);

            var currentcios = work.Current?.Process?.Cios;

            if (currentcios != null)
            {
                foreach (var cio in currentcios)
                {
                    stage.RemoveWorkInReserve(work.Current, cio, work);    // Remove work from JitStage._cioWorkCache
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Put a work into this process
        /// </summary>
        /// <param name="work"></param>
        public virtual void Enter(JitWork work, DateTime now)
        {
            var stage = work.FindStage();

            stage.SaveWorkToSubsetProcess(work.Next, work, now);     // Add work to JitStage._worksInProcess
            work.Previous = work.Current;
            work.Current  = work.Next;

            var nextProcs = stage.GetProcessLinkPathes(work.Current);

            if (nextProcs != null && nextProcs.Count > 0)
            {
                work.Next = nextProcs[0].NextLocation;
            }
            else
            {
                work.Next = null;
            }
            work.EnterTime = now;
            CheckAndAttachKanban(work.Current, now); // かんばんが有れば、NextProcessをかんばんで更新する
        }
Beispiel #7
0
 /// <summary>
 /// check span constraint
 /// </summary>
 /// <param name="work"></param>
 /// <param name="now"></param>
 /// <returns>true=waiting / false=Can Enter</returns>
 public override bool Check(JitWork work, DateTime now)
 {
     return((now - work.FindStage().GetLastInTime(work.Next, this)) < Span);
 }