Esempio n. 1
0
        private void EQStatusReport(object sender, ValueChangedEventArgs e)
        {
            var function = scApp.getFunBaseObj <EQStatusReport>(eqpt.EQPT_ID) as EQStatusReport;

            try
            {
                //1.建立各個Function物件
                function.Read(bcfApp, eqpt.EqptObjectCate, eqpt.EQPT_ID);
                //2.read log
                function.Timestamp = DateTime.Now;
                LogManager.GetLogger("com.mirle.ibg3k0.sc.Common.LogHelper").Info(function.ToString());
                //LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(EQStatusReport), Device: DEVICE_NAME_MTL,
                //    XID: eqpt.EQPT_ID, Data: function.ToString());

                //3.logical (include db save)
                eqpt.EQ_Ready = function.EQ_READY;
                eqpt.EQ_Error = function.EQ_ERROR;
                bool isDown = !eqpt.EQ_Ready || eqpt.EQ_Error;

                List <APORTSTATION> portStationList = scApp.getEQObjCacheManager().getPortStationByEquipment(eqpt.EQPT_ID);
                if (eqpt.EQ_Down != isDown)
                {
                    eqpt.EQ_Down = isDown;
                    if (isDown)
                    {
                        foreach (APORTSTATION portstation in portStationList)
                        {
                            if (portstation.PORT_SERVICE_STATUS == ProtocolFormat.OHTMessage.PortStationServiceStatus.InService)                                    //如果PortStation有被啟用才需要上報
                            {
                                if (portstation.PORT_STATUS != ProtocolFormat.OHTMessage.PortStationStatus.Down)                                                    //如果PortStation狀態並非Down才需要上報
                                {
                                    mcsMapAction.sendS6F11_PortEventState(portstation.PORT_ID, ((int)ProtocolFormat.OHTMessage.PortStationStatus.Down).ToString()); // 上報MCS down狀態
                                }
                            }
                        }
                    }
                    else
                    {
                        foreach (APORTSTATION portstation in portStationList)
                        {
                            if (portstation.PORT_SERVICE_STATUS == ProtocolFormat.OHTMessage.PortStationServiceStatus.InService)           //如果PortStation有被啟用才需要上報
                            {
                                if (portstation.PORT_STATUS != ProtocolFormat.OHTMessage.PortStationStatus.Down)                           //如果PortStation狀態並非Down才需要上報
                                {
                                    mcsMapAction.sendS6F11_PortEventState(portstation.PORT_ID, ((int)portstation.PORT_STATUS).ToString()); // 上報MCS當前PortStation 狀態
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
            finally
            {
                scApp.putFunBaseObj <EQStatusReport>(function);
            }
        }
Esempio n. 2
0
        private void PortStationDataChange(object sender, ValueChangedEventArgs e)
        {
            var function =
                scApp.getFunBaseObj <PortStationReport>(PortStation.PORT_ID) as PortStationReport;

            try
            {
                //1.建立各個Function物件
                function.Read(bcfApp, SCAppConstants.EQPT_OBJECT_CATE_PORT, PortStation.PORT_ID);
                function.portServiceState = PortStation.PORT_SERVICE_STATUS;
                //2.read log
                function.Timestamp = DateTime.Now;
                LogManager.GetLogger("com.mirle.ibg3k0.sc.Common.LogHelper").Info(function.ToString());
                //LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(PortStationReport), Device: DEVICE_NAME,
                //    XID: PortStation.PORT_ID, Data: function.ToString());

                //3.logical (include db save)
                ProtocolFormat.OHTMessage.PortStationStatus status = default(ProtocolFormat.OHTMessage.PortStationStatus);
                if (function.portStationReady)
                {
                    switch (function.portStationLoadRequest)
                    {
                    case true:
                        //PortStation.PORT_STATUS = ProtocolFormat.OHTMessage.PortStationStatus.LoadRequest;//LoadRequest
                        status = ProtocolFormat.OHTMessage.PortStationStatus.LoadRequest;    //LoadRequest
                        break;

                    case false:
                        //PortStation.PORT_STATUS = ProtocolFormat.OHTMessage.PortStationStatus.UnloadRequest;//UnloadRequest
                        status = ProtocolFormat.OHTMessage.PortStationStatus.UnloadRequest;    //UnloadRequest
                        break;
                    }
                }
                else
                {
                    switch (function.portStationLoadRequest)
                    {
                    case true:
                        PortStation.PORT_STATUS = ProtocolFormat.OHTMessage.PortStationStatus.Down; //Down
                        status = ProtocolFormat.OHTMessage.PortStationStatus.Down;                  //Down
                        break;

                    case false:
                        PortStation.PORT_STATUS = ProtocolFormat.OHTMessage.PortStationStatus.Wait; //Wait
                        status = ProtocolFormat.OHTMessage.PortStationStatus.Wait;                  //Wait
                        break;
                    }
                }
                scApp.PortStationService.doUpdatePortStatus(PortStation.PORT_ID, status);

                AEQPT eqpt = scApp.getEQObjCacheManager().getEquipmentByEQPTID(PortStation.EQPT_ID);
                if (PortStation.PORT_SERVICE_STATUS != ProtocolFormat.OHTMessage.PortStationServiceStatus.OutOfService && !eqpt.EQ_Down)//如果Port沒有disable且所屬EQ並非Down,才需要上報MCS PortEventState
                {
                    mcsMapAction.sendS6F11_PortEventState(PortStation.PORT_ID, ((int)PortStation.PORT_STATUS).ToString());
                }
                else
                {
                    //do nothing
                }
                //如果port Down

                //scApp.getEQObjCacheManager().getPortStation

                //foreach(AUNIT portstation in eqpt.UnitList )
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
            finally
            {
                scApp.putFunBaseObj <PortStationReport>(function);
            }
        }