Exemplo n.º 1
0
        public bool makeAndRequestAction(c_Action cRequestAction, bool bFirstActionInAutoMode)
        {
            bool bret = false;

            if (IsActionFree() || bFirstActionInAutoMode)
            {
                {
                    cRequestAction.m_sActionID = RandomString(6);
                } while (cRequestAction.m_sActionID == m_cCurrentAction.m_sActionID) // Falls zufällig eine gleiche ID erstellt wurde erneut durchführen

                {
                    m_cLastAction = m_cCurrentAction;
                }


                m_cCurrentAction = cRequestAction;
            }
            else
            {
                return(false);
            }


            // Senden der Aktion an PLC
            string sJSon;

            sJSon = JsonConvert.SerializeObject(m_cCurrentAction);
            bret  = m_cAdsWriteInterface.writeToPLCString("MAIN.sJsonDocAction", sJSon);
            m_cCurrentAction.m_iActionState = 1;
            m_cFabric.updateActionString(); // Message
            return(bret);
        }
Exemplo n.º 2
0
        public void CreateAction()
        {
            if (m_cFabric.m_cAktionHandler.IsActionFree())
            {
                switch (m_cGuiAction.m_eActionType)
                {
                case eAction.GetFromCell:
                    m_cGuiAction.m_iWPPlace = m_cFabric.m_cMHS.GetStorage().GetPlaceOfID(m_cGuiAction.m_sWPID);
                    break;

                case eAction.PutToCell:
                    m_cGuiAction.m_iWPPlace = m_cFabric.m_cMHS.GetStorage().GetPlaceOfID(m_cGuiAction.m_sWPID);
                    break;

                default:
                    return;
                }

                m_cFabric.m_cAktionHandler.makeAndRequestAction(m_cGuiAction, true);
                m_cFabric.updateActionString();
            }
        }