Пример #1
0
        /// <summary>
        /// 消息报文处理
        /// </summary>
        private void DealTelegramMessage(object objTelegram)
        {
            try
            {
                if (objTelegram.GetType() != typeof(Int16[]))
                {
                    return;
                }

                //解析报文
                m_telegramParser.UnpackTelegram(out m_struTelegram, (Int16[])objTelegram);
                int            nActionFlag   = 0;
                CRequestAction requestAction = new CRequestAction();
                if (m_dictHallID.ContainsKey(m_struTelegram.nEquipID))
                {
                    requestAction.struHallEquip = m_dictHallID[m_struTelegram.nEquipID];
                }
                requestAction.structTelegram = m_struTelegram;

                m_taskTrigger.Telegram(ref nActionFlag, ref requestAction, m_struTelegram);
                requestAction.PLCServer = m_commModule;
                requestAction.DicSound  = m_dicSound;
                requestAction.RequestAction(nActionFlag, m_sendTelegramAction, m_modifyDBAction, m_soundAction);
            }
            catch (Exception ex)
            {
                //打印日志
                CLOGException.Trace("WorkFlowLib.CWorkFlow.DealTelegramMessage异常", CBaseMethods.MyBase.GetExceptionInfo(ex));
            }
        }
Пример #2
0
        /// <summary>
        /// 设备故障文件和状态内容报文处理
        /// </summary>
        /// <param name="nEquipID"></param>
        private void DealTelegramMessage(object objTelegram, int nEquipID)
        {
            try
            {
                if (objTelegram.GetType() != typeof(Byte[]))
                {
                    return;
                }
                int            nActionFlag   = 0;
                CRequestAction requestAction = new CRequestAction();
                if (m_dictHallID.ContainsKey(nEquipID))
                {
                    requestAction.struHallEquip = m_dictHallID[nEquipID];
                }
                struTelegram struTelegramTemp = m_struTelegram;
                struTelegramTemp.nPLCSendFlag = m_nPLCID;
                struTelegramTemp.nEquipID     = nEquipID;
                requestAction.structTelegram  = struTelegramTemp;

                requestAction.PLCServer = m_commModule;
                requestAction.DicSound  = m_dicSound;

                m_taskTrigger.DeviceTelegram(ref nActionFlag, ref requestAction, m_nPLCID, nEquipID, objTelegram);
                requestAction.RequestAction(nActionFlag, m_sendTelegramAction, m_modifyDBAction, m_soundAction);
            }
            catch (Exception ex)
            {
                CLOGException.Trace("WorkFlowLib.CWorkFlow.DealTelegramMessage1异常", CBaseMethods.MyBase.GetExceptionInfo(ex));
            }
        }
Пример #3
0
        /// <summary>
        /// 读卡器处理
        /// 读卡器有读取到刷卡时触发读取卡号
        /// </summary>
        /// <param name="nHallID"></param>
        /// <param name="strPhysicalCardID"></param>
        private void ICCardMgmt(object sender, CSwiperEventArgs e)
        {
            try
            {
                int    nHallID           = e.HallID;
                string strPhysicalCardID = e.PhysicalCardID;
                CLOGException.Trace(m_nPLCID, "WorkFlowLib.CWorkFlow.ICCardMgmt ", string.Format("strPhysicalCardID:{0}", strPhysicalCardID));

                if (!m_dictHallID.ContainsKey(nHallID) || string.IsNullOrWhiteSpace(strPhysicalCardID))
                {
                    CLOGException.Trace(m_nPLCID, "WorkFlowLib.CWorkFlow.ICCardMgmt ", "nHallID or strPhysicalCardID is invalid");
                    return;//打印日志
                }
                struHallEquips struLocation  = m_dictHallID[nHallID];
                CRequestAction requestAction = new CRequestAction();
                requestAction.struHallEquip = struLocation;
                int nActionFlag = 0;
                m_taskTrigger.SwipeICCard(ref nActionFlag, ref requestAction, strPhysicalCardID, struLocation);
                requestAction.PLCServer = m_commModule;
                requestAction.DicSound  = m_dicSound;
                requestAction.RequestAction(nActionFlag, m_sendTelegramAction, m_modifyDBAction, m_soundAction);
            }
            catch (Exception ex)
            {
                //打印日志
                CLOGException.Trace("WorkFlowLib.CWorkFlow.ICCardMgmt异常", CBaseMethods.MyBase.GetExceptionInfo(ex));
            }
        }
Пример #4
0
        /// <summary>
        /// 处理队列
        /// </summary>
        private void dealTelegramQueue()
        {
            while (isStart)
            {
                try
                {
                    int            nActionFlag   = 0;
                    CRequestAction requestAction = new CRequestAction();
                    requestAction.structTelegram = m_struTelegram;
                    requestAction.PLCServer      = m_commModule;
                    requestAction.DicSound       = m_dicSound;

                    m_taskTrigger.DealTeleQueueInfo(ref nActionFlag, ref requestAction, m_nPLCID);
                    requestAction.RequestAction(nActionFlag, m_sendTelegramAction, m_modifyDBAction, m_soundAction);

                    Thread.Sleep(1000);
                }
                catch (Exception ex)
                {
                    CWException.WriteError("WorkFlowLib.dealTelegramQueue 异常 " + ex.ToString());
                    Thread.Sleep(5000);
                }
            }
        }