Exemple #1
0
        public override void CloneFrom(NCasObject obj)
        {
            OrderBizData newObject = obj as OrderBizData;

            this.almProtocol               = newObject.almProtocol;
            this.allDestinationFlag        = newObject.allDestinationFlag;
            this.orderGroupFlag            = newObject.orderGroupFlag;
            this.orderDistFlag             = newObject.orderDistFlag;
            this.orderTermFlag             = newObject.orderTermFlag;
            this.selectedDisasterBroadKind = newObject.selectedDisasterBroadKind;
            this.lastOrderKind             = newObject.lastOrderKind;
            this.isLocal                  = newObject.isLocal;
            this.isEnd                    = newObject.isEnd;
            this.ttsOrderFlag             = newObject.ttsOrderFlag;
            this.selectedStoredMessage    = newObject.selectedStoredMessage;
            this.storedMessageRepeatCount = newObject.storedMessageRepeatCount;
            this.selectedTtsMessage       = newObject.selectedTtsMessage;
            this.groupName                = newObject.groupName;
            this.sendBuff                 = newObject.sendBuff;
        }
Exemple #2
0
        public override NCasObject CloneTo()
        {
            OrderBizData newObject = new OrderBizData();

            newObject.almProtocol               = this.almProtocol;
            newObject.allDestinationFlag        = this.allDestinationFlag;
            newObject.orderGroupFlag            = this.orderGroupFlag;
            newObject.orderDistFlag             = this.orderDistFlag;
            newObject.orderTermFlag             = this.orderTermFlag;
            newObject.selectedDisasterBroadKind = this.selectedDisasterBroadKind;
            newObject.lastOrderKind             = this.lastOrderKind;
            newObject.isLocal                  = this.isLocal;
            newObject.isEnd                    = this.isEnd;
            newObject.ttsOrderFlag             = this.ttsOrderFlag;
            newObject.selectedStoredMessage    = this.selectedStoredMessage;
            newObject.storedMessageRepeatCount = this.storedMessageRepeatCount;
            newObject.selectedTtsMessage       = this.selectedTtsMessage;
            newObject.groupName                = this.groupName;
            newObject.sendBuff                 = this.sendBuff;
            return(newObject);
        }
        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);
                }
            }
        }
        /// <summary>
        /// 시도전체 발령 명령을 처리하는 메소드
        /// </summary>
        /// <param name="orderBizData"></param>
        private void OrderProvAll(OrderBizData orderBizData)
        {
            int udpSendCount = 4;

            byte[]        sendBuff              = orderBizData.SendBuff;
            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));
            }

            udpSoc.SendTo(teleServerIpAddr, (int)NCasPortID.PortIdExtCallPgServer, sendBuff);
            udpSoc.SendTo(NCasUtilityMng.INCasEtcUtility.GetIPv4(), (int)NCasPortID.PortIdExtCallPgMan, sendBuff);

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

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

            if (orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaAll || orderBizData.AlmProtocol.Media == NCasDefineOrderMedia.MediaLine)
            {
                udpSoc.SendTo(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, (int)NCasPortID.PortIdAlarm, sendBuff);
                udpSoc.SendTo(this.ProvBroadIP, (int)NCasPortID.PortIdAlarm, 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)
            {
                for (int i = 0; i < udpSendCount; i++)
                {
                    udpSoc.SendTo(orderBizData.AlmProtocol.AlarmNetIdOrIpByString, (int)NCasPortID.PortIdAlarm, sendBuff);
                    udpSoc.SendTo(this.ProvBroadIP, (int)NCasPortID.PortIdAlarm, sendBuff);
                }
            }

            if (orderBizData.AlmProtocol.AlarmKind == NCasDefineOrderKind.DisasterBroadcast && orderBizData.SelectedDisasterBroadKind == PAlmScreenUIController.DisasterBroadKind.Tts)
            {
                byte[] 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"));
            }
        }
Exemple #5
0
 /// <summary>
 /// 발령 데이터 처리 메소드
 /// </summary>
 /// <param name="orderBizData"></param>
 public void SetOrderBizData(OrderBizData orderBizData)
 {
     this.pAlmScreenBiz.AddBizData(orderBizData);
 }
Exemple #6
0
        /// <summary>
        /// 재발령 버튼 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnReOrder_Click(object sender, EventArgs e)
        {
            if (this.reOrderListView.Items.Count == 0)
            {
                return;
            }

            if (MessageBox.Show(string.Format("현재 보이는 경보단말을 대상으로 '{0}' 발령을 진행하겠습니까?",
                                              NCasUtilityMng.INCasCommUtility.NCasDefineOrderKind2String((this.mainForm.MmfMng.GetTermInfoByIp(this.reOrderListView.Items[0].Name)).AlarmOrderInfo.Kind)),
                                "재발령", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                this.lastAlarmOrderInfo = this.provInfo.AlarmOrderInfo;
                this.lastAlarmOrderInfo.AlarmOrderFlag          = this.provInfo.AlarmOrderInfo.AlarmOrderFlag;
                this.lastAlarmOrderInfo.CtrlKind                = this.provInfo.AlarmOrderInfo.CtrlKind;
                this.lastAlarmOrderInfo.IpAddrAlarmArea         = this.provInfo.AlarmOrderInfo.IpAddrAlarmArea;
                this.lastAlarmOrderInfo.IpAddrAlarmAreaToString = this.provInfo.AlarmOrderInfo.IpAddrAlarmAreaToString;
                this.lastAlarmOrderInfo.IpAddrBraodAreaToString = this.provInfo.AlarmOrderInfo.IpAddrBraodAreaToString;
                this.lastAlarmOrderInfo.IpAddrBroadArea         = this.provInfo.AlarmOrderInfo.IpAddrBroadArea;
                this.lastAlarmOrderInfo.Kind                = this.provInfo.AlarmOrderInfo.Kind;
                this.lastAlarmOrderInfo.Media               = this.provInfo.AlarmOrderInfo.Media;
                this.lastAlarmOrderInfo.Mode                = this.provInfo.AlarmOrderInfo.Mode;
                this.lastAlarmOrderInfo.OccurTime           = this.provInfo.AlarmOrderInfo.OccurTime;
                this.lastAlarmOrderInfo.OccurTimeToDateTime = this.provInfo.AlarmOrderInfo.OccurTimeToDateTime;
                this.lastAlarmOrderInfo.RespReq             = this.provInfo.AlarmOrderInfo.RespReq;
                this.lastAlarmOrderInfo.Section             = this.provInfo.AlarmOrderInfo.Section;
                this.lastAlarmOrderInfo.Source              = this.provInfo.AlarmOrderInfo.Source;

                List <OrderBizData> tmpOrderBuff  = new List <OrderBizData>();
                DateTime            orderDateTime = DateTime.Now;

                for (int i = 0; i < this.reOrderListView.Items.Count; i++)
                {
                    NCasProtocolBase protoBase = NCasProtocolFactory.CreateCasProtocol(NCasDefineTcCode.TcAlarmOrder);
                    NCasProtocolTc1  protoTc1  = protoBase as NCasProtocolTc1;

                    protoTc1.AlarmNetIdOrIpByString = this.reOrderListView.Items[i].Name;
                    protoTc1.OrderTimeByDateTime    = orderDateTime;
                    protoTc1.CtrlKind    = NCasDefineControlKind.ControlAlarm;
                    protoTc1.Source      = NCasDefineOrderSource.ProvCtrlRoom;
                    protoTc1.AlarmKind   = this.lastAlarmOrderInfo.Kind;
                    protoTc1.Mode        = this.lastAlarmOrderInfo.Mode;
                    protoTc1.Media       = this.lastAlarmOrderInfo.Media;
                    protoTc1.RespReqFlag = NCasDefineRespReq.ResponseReq;
                    protoTc1.AuthenFlag  = NCasDefineAuthenticationFlag.EncodeUsed;
                    protoTc1.Sector      = NCasDefineSectionCode.SectionTerm;

                    byte[]       tmpBuff      = NCasProtocolFactory.MakeUdpFrame(protoTc1);
                    OrderBizData orderBizData = new OrderBizData();
                    orderBizData.AllDestinationFlag        = false;
                    orderBizData.AlmProtocol               = protoTc1;
                    orderBizData.IsLocal                   = true;
                    orderBizData.LastOrderKind             = this.lastAlarmOrderInfo.Kind;
                    orderBizData.OrderDistFlag             = false;
                    orderBizData.OrderGroupFlag            = false;
                    orderBizData.OrderTermFlag             = true;
                    orderBizData.SendBuff                  = tmpBuff;
                    orderBizData.SelectedDisasterBroadKind = PAlmScreenUIController.DisasterBroadKind.None;
                    orderBizData.SelectedStoredMessage     = new StoredMessageText();
                    orderBizData.StoredMessageRepeatCount  = 1;
                    orderBizData.SelectedTtsMessage        = new TtsMessageText();
                    orderBizData.GroupName                 = new List <string>();
                    orderBizData.TtsOrderFlag              = false;

                    if (i == 0)
                    {
                        orderBizData.IsEnd = PAlmScreenUIController.OrderDataSendStatus.First;
                    }
                    else if (i == (this.reOrderListView.Items.Count - 1))
                    {
                        orderBizData.IsEnd = PAlmScreenUIController.OrderDataSendStatus.End;
                    }
                    else
                    {
                        orderBizData.IsEnd = PAlmScreenUIController.OrderDataSendStatus.None;
                    }

                    if (this.reOrderListView.Items.Count == 1)
                    {
                        orderBizData.IsEnd = PAlmScreenUIController.OrderDataSendStatus.FirstEnd;
                    }

                    tmpOrderBuff.Add(orderBizData);
                }

                foreach (OrderBizData orderBizData in tmpOrderBuff)
                {
                    this.mainForm.SetOrderBizData(orderBizData);
                }
            }
        }