Exemple #1
0
        public override void Update(string sJSon)
        {
            c_Cell Cell = JsonConvert.DeserializeObject <c_Cell>(sJSon);
            bool   b    = false;
            int    i    = 0;

            if (m_ListOfCells != null)
            {
                foreach (c_Cell ListCell in m_ListOfCells)
                {
                    if (ListCell.Name == Cell.Name)
                    {
                        b = true;
                        break;
                    }
                    i++;
                }
                if (b)
                {
                    m_ListOfCells[i] = Cell;
                }
                else
                {
                    m_ListOfCells.Add(Cell);
                }
            }
            else
            {
                m_ListOfCells.Add(Cell);
            }
            //m_cMainView.Invoke((MethodInvoker)delegate { UpdateChart(); });

            m_cFabric.update();
        }
Exemple #2
0
 public bool GetCellOfName(String sCellName, ref c_Cell cCell)
 {
     foreach (var Cell in m_ListOfCells)
     {
         if (Cell.Name == sCellName)
         {
             cCell = Cell;
             return(true);
         }
     }
     return(false);
 }
Exemple #3
0
 public bool SearchWPInCells(int sWPID, ref c_Cell cCell)
 {
     foreach (var Cell in m_ListOfCells)
     {
         if (Cell.Workpiece == sWPID)
         {
             cCell = Cell;
             return(true);
         }
     }
     return(false);
 }
Exemple #4
0
        private bool AutoActionUpdate()
        {
            c_WorkingStep         cNextStep             = new c_WorkingStep();
            Queue <c_WorkingStep> QueueOfNextSteps      = new Queue <c_WorkingStep>();
            Stack <c_Action>      ReverseStackOfActions = new Stack <c_Action>();

            if (m_cWorkingScheduleHandler.IsEmpty())
            {
                if (m_cWorkingSchedule.NextSteps(ref QueueOfNextSteps))
                {
                    c_Cell cCell = new c_Cell();
                    foreach (c_WorkingStep Step in QueueOfNextSteps)
                    {
                        if (Step.m_sAction == "pickup")
                        {
                            if (!m_cCellArea.SearchWPInCells(Step.m_iWorkpiece, ref cCell))
                            {
                                m_cWorkingSchedule.SetStepCountBack();
                                m_cWorkingScheduleHandler.ClearStackOfActions();
                                return(false);
                            }
                            if (!cCell.Idle)
                            {
                                m_cWorkingSchedule.SetStepCountBack();
                                m_cWorkingScheduleHandler.ClearStackOfActions();
                                return(false);
                            }
                            c_Action cNewAction = new c_Action();
                            cNewAction.m_sWPID       = m_cMHS.GetStorage().GetStorageIDOfPlace(Step.m_iWorkpiece);
                            cNewAction.m_iWPPlace    = Step.m_iWorkpiece;
                            cNewAction.m_sCell       = Step.m_sCell;
                            cNewAction.m_eActionType = eAction.GetFromCell;
                            // Aktion in den Stack zur Abarbeitung pushen
                            ReverseStackOfActions.Push(cNewAction);
                            //m_cWorkingScheduleHandler.PushAction(cNewAction);
                        }
                        if (Step.m_sAction == "put")
                        {
                            if (!m_cCellArea.GetCellOfName(Step.m_sCell, ref cCell))
                            {
                                m_cWorkingSchedule.SetStepCountBack();
                                m_cWorkingScheduleHandler.ClearStackOfActions();
                                return(false);
                            }
                            if (!cCell.Idle)
                            {
                                m_cWorkingSchedule.SetStepCountBack();
                                m_cWorkingScheduleHandler.ClearStackOfActions();
                                return(false);
                            }


                            c_Action cNewAction = new c_Action();
                            cNewAction.m_sWPID       = m_cMHS.GetStorage().GetStorageIDOfPlace(Step.m_iWorkpiece);
                            cNewAction.m_iWPPlace    = Step.m_iWorkpiece;
                            cNewAction.m_sCell       = Step.m_sCell;
                            cNewAction.m_eActionType = eAction.PutToCell;
                            // Aktion in den Stack zur Abarbeitung pushen
                            ReverseStackOfActions.Push(cNewAction);

                            // m_cWorkingScheduleHandler.PushAction(cNewAction);
                        }
                    }
                }
            }


            foreach (c_Action Action in ReverseStackOfActions)
            {
                m_cWorkingScheduleHandler.PushAction(Action);
            }

            return(true);
        }