示例#1
0
        /// <summary>
        /// 그룹 발령 명령을 처리하는 메소드
        /// </summary>
        /// <param name="orderBizData"></param>
        private void OrderGroup()
        {
            byte[]        tmpBuff               = TtsControlDataMng.GetTeleStartData();
            string        teleServerIpAddr      = NCasUtilityMng.INCasCommUtility.AddIpAddr(NCasUtilityMng.INCasCommUtility.MakeNetIdByAnyIp(this.provInfo.NetIdToString), 0, 0, 1, 111);
            List <string> reptAlarmServerIpAddr = new List <string>();

            for (int i = 0; i < this.provInfo.LstRepts.Count; i++)
            {
                reptAlarmServerIpAddr.Add(NCasUtilityMng.INCasCommUtility.AddIpAddr(this.provInfo.LstRepts[i].NetIdToString, 0, 0, 1, 1));
            }

            foreach (OrderBizData orderBizData in this.lstOrderBizData)
            {
                udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, orderBizData.SendBuff);
                udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, orderBizData.SendBuff);

                for (int i = 0; i < reptAlarmServerIpAddr.Count; i++)
                {
                    udpSoc.SendTo(reptAlarmServerIpAddr[i], (int)NCasPortID.PortIdIntTeleRAlarm, orderBizData.SendBuff);
                }
            }

            tmpBuff = TtsControlDataMng.GetTeleStopData();

            if (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.AlarmBiochemist ||
                (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && this.lstOrderBizData[0].SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Mic) ||
                (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && this.lstOrderBizData[0].SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Tts))
            {
                Thread.Sleep(this.SendDelay);
            }

            //그룹발령 정보 전송 (TC 77)
            for (int i = 0; i < lstOrderBizData[0].GroupName.Count; i++)
            {
                NCasProtocolBase protoBase77 = NCasProtocolFactory.CreateCasProtocol(NCasDefineTcCode.TcGroupOrder);
                NCasProtocolTc77 protoTc77   = protoBase77 as NCasProtocolTc77;
                protoTc77.AlarmKind = this.lstOrderBizData[0].AlmProtocol.AlarmKind;
                protoTc77.AlarmNetIdOrIpByString = this.lstOrderBizData[0].AlmProtocol.AlarmNetIdOrIpByString;
                protoTc77.CtrlKind            = this.lstOrderBizData[0].AlmProtocol.CtrlKind;
                protoTc77.GroupName           = lstOrderBizData[0].GroupName[i];
                protoTc77.GroupNum            = (byte)lstOrderBizData[0].GroupName.Count;
                protoTc77.Media               = this.lstOrderBizData[0].AlmProtocol.Media;
                protoTc77.Mode                = this.lstOrderBizData[0].AlmProtocol.Mode;
                protoTc77.OrderTimeByDateTime = this.lstOrderBizData[0].AlmProtocol.OrderTimeByDateTime;
                protoTc77.Sector              = this.lstOrderBizData[0].AlmProtocol.Sector;
                protoTc77.Source              = this.lstOrderBizData[0].AlmProtocol.Source;

                byte[] tc77Buff = NCasProtocolFactory.MakeUdpFrame(protoTc77);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvMain, tc77Buff);

                string tmpLog = string.Format("GroupName - {0}, GroupNum - {1}, OrderTime - {2}", protoTc77.GroupName, protoTc77.GroupNum.ToString(), protoTc77.OrderTimeByDateTime.ToString());
                NCasLoggingMng.ILogging.WriteLog("PAlmScreenBiz", "그룹발령 정보(TC 77)를 NCasPipes.PipePcaProvMain로 전송 완료 - " + tmpLog);
                System.Diagnostics.Debug.WriteLine("### 그룹발령 정보(TC 77) - " + tmpLog);
            }

            foreach (OrderBizData orderBizData in this.lstOrderBizData)
            {
                byte[] sendBuff = orderBizData.SendBuff;
                this.mainForm.MmfMng.WriteOrder(orderBizData.AlmProtocol);

                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentCAlm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvMain, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnRAlm, sendBuff);

                if ((orderBizData.AlmProtocol.AlarmNetIdOrIp & 0x0000ff00) == 0x0000fd00) //x.x.253.x
                {
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermDept, sendBuff);
                }

                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermTerm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvDual, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnDAlm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvPDAlm, sendBuff);

                if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaSate)
                {
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentSate, sendBuff);

                    if (orderBizData.AlmProtocol.Sector == NCasDefineSectionCode.SectionDist)
                    {
                        DistInfo distInfo = this.mainForm.MmfMng.GetDistInfoByNetId(NCasUtilityMng.INCasCommUtility.SubtractIpAddr(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, 0, 0, 0, 255));

                        if (distInfo.IsDisasterDist)
                        {
                            NCasProtocolBase baseProto = NCasProtocolFactory.ParseFrame(sendBuff);
                            NCasProtocolTc1  tc1       = baseProto as NCasProtocolTc1;
                            tc1.AlarmNetIdOrIpByString = NCasUtilityMng.INCasCommUtility.AddIpAddr(tc1.AlarmNetIdOrIpByString, 0, 2, 0, 0);
                            byte[] disasterBuff = NCasProtocolFactory.MakeUdpFrame(tc1);
                            this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentSate, disasterBuff);
                        }
                    }
                }

                udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdExtCasMonitor, sendBuff);

                if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaLine)
                {
                    if (orderBizData.AlmProtocol.Sector == NCasDefineSectionCode.SectionTerm)
                    {
                        udpSoc.SendTo(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, (int)NCasPortID.PortIdAlarm, sendBuff);
                    }
                    else if (orderBizData.AlmProtocol.Sector == NCasDefineSectionCode.SectionDist)
                    {
                        DistInfo distInfo = this.mainForm.MmfMng.GetDistInfoByNetId(NCasUtilityMng.INCasCommUtility.SubtractIpAddr(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, 0, 0, 0, 255));

                        foreach (TermInfo termInfo in distInfo.LstTerms)
                        {
                            if (termInfo.UseFlag == NCasDefineUseStatus.Use)
                            {
                                udpSoc.SendTo(termInfo.IpAddrToSring, (int)NCasPortID.PortIdAlarm, sendBuff);
                            }
                        }
                    }
                }

                //지진해일 시군
                if (orderBizData.AlmProtocol.Sector == NCasDefineSectionCode.SectionDist)
                {
                    DistInfo distInfo = this.mainForm.MmfMng.GetDistInfoByNetId(NCasUtilityMng.INCasCommUtility.SubtractIpAddr(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, 0, 0, 0, 255));

                    if (distInfo.IsDisasterDist)
                    {
                        orderBizData.AlmProtocol.AlarmNetIdOrIpByString = NCasUtilityMng.INCasCommUtility.AddIpAddr(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, 0, 2, 0, 0);
                        byte[] sendDisasterBuff = NCasProtocolFactory.MakeUdpFrame(orderBizData.AlmProtocol);
                        this.mainForm.MmfMng.WriteOrder(orderBizData.AlmProtocol);

                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentCAlm, sendDisasterBuff);
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvMain, sendDisasterBuff);
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnRAlm, sendDisasterBuff);

                        if ((orderBizData.AlmProtocol.AlarmNetIdOrIp & 0x0000ff00) == 0x0000fd00) //x.x.253.x
                        {
                            this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermDept, sendDisasterBuff);
                        }

                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermTerm, sendDisasterBuff);
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvDual, sendDisasterBuff);
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnDAlm, sendDisasterBuff);
                        this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvPDAlm, sendDisasterBuff);

                        if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaSate)
                        {
                            this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentSate, sendDisasterBuff);
                        }

                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdExtCasMonitor, sendDisasterBuff);

                        if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaLine)
                        {
                            foreach (TermInfo termInfo in distInfo.LstTerms)
                            {
                                if (termInfo.UseFlag == NCasDefineUseStatus.Use)
                                {
                                    udpSoc.SendTo(termInfo.IpAddrToSring, (int)NCasPortID.PortIdAlarm, sendDisasterBuff);
                                }
                            }
                        }
                    }
                }

                if (orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.First || orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.FirstEnd)
                {
                    if (orderBizData.AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && orderBizData.SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Tts)
                    {
                        tmpBuff = TtsControlDataMng.GetTtsPlayData();
                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsControl, Encoding.Default.GetBytes("RES"));
                        udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, tmpBuff);
                        udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, tmpBuff);
                        Thread.Sleep(this.TtsDelay);

                        string ttsData = "TTS" + NCasContentsMng.ttsOption.SpeechSpeed.ToString().PadLeft(3, '0') +
                                         NCasContentsMng.ttsOption.RepeatCount.ToString().PadLeft(2, '0') +
                                         NCasContentsMng.ttsOption.SentenceInterval.ToString().PadLeft(4, '0') +
                                         NCasContentsMng.ttsOption.RestInterval.ToString().PadLeft(4, '0') +
                                         orderBizData.SelectedTtsMessage.Text;

                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsMessage, Encoding.Default.GetBytes(ttsData));
                    }
                    else if (orderBizData.AlmProtocol.AlarmKind != NCasDefineOrderKind.DisasterBroadcast)
                    {
                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsControl, Encoding.Default.GetBytes("RES"));
                    }
                }
            }
        }
示例#2
0
        protected override void OnAsyncExternProcessing(NCASBIZ.NCasType.NCasObject param)
        {
            if (param is OrderBizData)
            {
                try
                {
                    OrderBizData orderBizData = param as OrderBizData;

                    if (orderBizData.IsLocal == false)
                    {
                        return;
                    }

                    if (orderBizData.AlmProtocol.GetDatas() == null)
                    {
                        NCasLoggingMng.ILogging.WriteLog("PAlmScreenBiz", "발령이 정상적으로 처리되지 않았습니다.",
                                                         "TC " + orderBizData.AlmProtocol.TcCode.ToString());
                        return;
                    }

                    if (orderBizData.TtsOrderFlag) //마지막 발령이 TTS발령이면..
                    {
                        byte[] tmpBuff          = TtsControlDataMng.GetTtsStopData();
                        string teleServerIpAddr = NCasUtilityMng.INCasCommUtility.AddIpAddr(NCasUtilityMng.INCasCommUtility.MakeNetIdByAnyIp(this.provInfo.NetIdToString), 0, 0, 1, 111);
                        udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, tmpBuff);
                        udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, tmpBuff);
                    }

                    if (orderBizData.AllDestinationFlag) //시도전체 발령(무조건 1개 패킷 전송)
                    {
                        this.OrderProvAll(orderBizData);
                    }
                    else //하나의 발령에 의해 여러개의 패킷을 전송해야 하는 경우..
                    {
                        if (orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.First || orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.None)
                        {
                            this.lstOrderBizData.Add(orderBizData);
                        }
                        else if (orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.End || orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.FirstEnd)
                        {
                            this.lstOrderBizData.Add(orderBizData);

                            if (orderBizData.OrderDistFlag) //시군 전체/개별 발령
                            {
                                this.OrderDistAll();
                            }
                            else if (orderBizData.OrderTermFlag) //개별단말 발령
                            {
                                this.OrderTerm();
                            }
                            else if (orderBizData.OrderGroupFlag) //그룹 발령
                            {
                                this.OrderGroup();
                            }

                            this.lstOrderBizData.Clear();
                        }
                    }
                }
                catch (Exception ex)
                {
                    NCasLoggingMng.ILoggingException.WriteException("PAlmScreenBiz", "PAlmScreenBiz.OnAsyncExternProcessing Method - OrderBizData", ex);
                }
            }
            else if (param is KeyBizData)
            {
                try
                {
                    KeyBizData keyBizData = param as KeyBizData;

                    if (keyBizData.IsLocal == false)
                    {
                        return;
                    }

                    this.mainForm.SendKeyDataToDual(keyBizData.KeyData);
                }
                catch (Exception ex)
                {
                    NCasLoggingMng.ILoggingException.WriteException("PAlmScreenBiz", "PAlmScreenBiz.OnAsyncExternProcessing Method - KeyBizData", ex);
                }
            }
            else if (param is NCasPlcProtocolBase)
            {
                try
                {
                    NCasPlcProtocolBase nCasPlcProtocolBase = param as NCasPlcProtocolBase;
                    byte[] buff = NCasPlcProtocolFactory.MakeFrame(nCasPlcProtocolBase);

                    if (nCasPlcProtocolBase.GetDatas() == null)
                    {
                        NCasLoggingMng.ILogging.WriteLog("PAlmScreenBiz", "NCasPlcProtocolFactory.MakeFrame is null");
                        return;
                    }

                    if (buff == null)
                    {
                        NCasLoggingMng.ILogging.WriteLog("PAlmScreenBiz", "buff is null");
                        return;
                    }

                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipeNccDevCcd, buff);
                }
                catch (Exception ex)
                {
                    NCasLoggingMng.ILoggingException.WriteException("PAlmScreenBiz", "PAlmScreenBiz.OnAsyncExternProcessing Method - NCasPlcProtocolBase", ex);
                }
            }
        }
示例#3
0
        /// <summary>
        /// 단말개별 발령 명령을 처리하는 메소드
        /// </summary>
        /// <param name="orderBizData"></param>
        private void OrderTerm()
        {
            byte[]        tmpBuff               = TtsControlDataMng.GetTeleStartData();
            string        teleServerIpAddr      = NCasUtilityMng.INCasCommUtility.AddIpAddr(NCasUtilityMng.INCasCommUtility.MakeNetIdByAnyIp(this.provInfo.NetIdToString), 0, 0, 1, 111);
            List <string> reptAlarmServerIpAddr = new List <string>();

            for (int i = 0; i < this.provInfo.LstRepts.Count; i++)
            {
                reptAlarmServerIpAddr.Add(NCasUtilityMng.INCasCommUtility.AddIpAddr(this.provInfo.LstRepts[i].NetIdToString, 0, 0, 1, 1));
            }

            foreach (OrderBizData orderBizData in this.lstOrderBizData)
            {
                udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, orderBizData.SendBuff);
                udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, orderBizData.SendBuff);

                for (int i = 0; i < reptAlarmServerIpAddr.Count; i++)
                {
                    udpSoc.SendTo(reptAlarmServerIpAddr[i], (int)NCasPortID.PortIdIntTeleRAlarm, orderBizData.SendBuff);
                }
            }

            tmpBuff = TtsControlDataMng.GetTeleStopData();

            if (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.AlarmBiochemist ||
                (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && this.lstOrderBizData[0].SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Mic) ||
                (this.lstOrderBizData[0].AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && this.lstOrderBizData[0].SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Tts))
            {
                Thread.Sleep(this.SendDelay);
            }

            foreach (OrderBizData orderBizData in this.lstOrderBizData)
            {
                byte[] sendBuff = orderBizData.SendBuff;
                this.mainForm.MmfMng.WriteOrder(orderBizData.AlmProtocol);

                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentCAlm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvMain, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnRAlm, sendBuff);

                if ((orderBizData.AlmProtocol.AlarmNetIdOrIp & 0x0000ff00) == 0x0000fd00) //x.x.253.x
                {
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermDept, sendBuff);
                }

                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaTermTerm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvDual, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaRgnDAlm, sendBuff);
                this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaProvPDAlm, sendBuff);

                if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaSate)
                {
                    this.udpSoc.SendTo(this.LoopBackIP, (int)NCasPipes.PipePcaCentSate, sendBuff);
                }

                udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdExtCasMonitor, sendBuff);

                if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaLine)
                {
                    udpSoc.SendTo(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, (int)NCasPortID.PortIdAlarm, sendBuff);
                }

                if (orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.First || orderBizData.IsEnd == PAlmScreenUIController.OrderDataSendStatus.FirstEnd)
                {
                    if (orderBizData.AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && orderBizData.SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Tts)
                    {
                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsControl, Encoding.Default.GetBytes("RES"));
                        tmpBuff = TtsControlDataMng.GetTtsPlayData();
                        udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, tmpBuff);
                        udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, tmpBuff);
                        Thread.Sleep(this.TtsDelay);

                        string ttsData = "TTS" + NCasContentsMng.ttsOption.SpeechSpeed.ToString().PadLeft(3, '0') +
                                         NCasContentsMng.ttsOption.RepeatCount.ToString().PadLeft(2, '0') +
                                         NCasContentsMng.ttsOption.SentenceInterval.ToString().PadLeft(4, '0') +
                                         NCasContentsMng.ttsOption.RestInterval.ToString().PadLeft(4, '0') +
                                         orderBizData.SelectedTtsMessage.Text;

                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsMessage, Encoding.Default.GetBytes(ttsData));
                    }
                    else if (orderBizData.AlmProtocol.AlarmKind != NCasDefineOrderKind.DisasterBroadcast)
                    {
                        udpSoc.SendTo(this.LoopBackIP, (int)NCasPortID.PortIdTtsControl, Encoding.Default.GetBytes("RES"));
                    }
                }
            }
        }