/// <summary>
        /// 将信息发给客户端
        /// </summary>
        /// <param name="shopAppId">门店AppId</param>
        /// <param name="message"></param>
        public void SendMessageToService(MessageMod mod)
        {
            mod.ShopAppId = CertificateMod.ShopAppId;
            mod.Type      = CertificateMod.Type;
            ///给服务器发送信息指令,通知服务器进行操作。
            string message = JsonUtil.ToJson2(mod);

            websocket.Send(message);
        }
        /// <summary>
        /// 初始化socket
        /// </summary>
        /// <param name="listenIp">推送服务ip</param>
        /// <param name="port">推送服务端口</param>
        /// <param name="_Certificate">身份凭证的信息</param>
        /// <remarks>2016-8-2 杨云奕 创建</remarks>
        public void InitSuperWebSocket(string listenIp, int port, MessageMod _Certificate)
        {
            if (websocket == null || websocket.State == WebSocketState.Closed)
            {
                CertificateMod = _Certificate;

                _listenIp = listenIp;
                _port     = port;

                HistoryList.Add("正在连接服务器...");
                websocket                  = new WebSocket("ws://" + listenIp + ":" + port + "");
                websocket.Opened          += websocket_Opened;
                websocket.Closed          += websocket_Closed;
                websocket.MessageReceived += websocket_MessageReceived;


                InitDisconnectionOrder();
                websocket.Open();
            }
        }
        /// <summary>
        /// 获取两天内离线的订单的数据集合
        /// </summary>
        /// <returns></returns>
        List <MessageMod> GetDisCountOrderList()
        {
            List <MessageMod> DiscountList = new List <MessageMod>();

            List <Hyt.Model.SoOrder> orderList = Hyt.BLL.Pos.SyWSOrderToClientJobBo.Instance.GetNotPosthOrderDataToClientList(1);

            foreach (Hyt.Model.SoOrder order in orderList)
            {
                List <int> posManageSysNo = new List <int>();
                //SoOrder order = Hyt.BLL.Order.SoOrderBo.Instance.GetEntity(OrderSysNo);
                Hyt.Model.SoReceiveAddress    address    = Hyt.BLL.Order.SoOrderBo.Instance.GetOrderReceiveAddress(order.ReceiveAddressSysNo);
                IList <Hyt.Model.SoOrderItem> orderItems = Hyt.BLL.Order.SoOrderBo.Instance.GetOrderItemsByOrderId(order.SysNo);
                //CBDsDealer dealerMod = DsDealerBo.Instance.GetDsDealer(order.DealerSysNo);
                List <Hyt.Model.Pos.CBDsPosManage> posManageList = Hyt.BLL.Pos.DsPosManageBo.Instance.GetEntityListByDsSysNo(order.DealerSysNo);
                List <Hyt.Model.BsPaymentType>     payTypeList   = Hyt.BLL.Order.SoOrderBo.Instance.LoadAllPayType().Where(b => b.Status == 1).ToList();
                Hyt.Model.BsPaymentType            pTypeMod      = payTypeList.Find(p => p.SysNo == order.PayTypeSysNo);
                if (pTypeMod == null)
                {
                    pTypeMod = new Hyt.Model.BsPaymentType()
                    {
                        PaymentName = "未知类型"
                    };
                }
                foreach (Hyt.Model.Pos.CBDsPosManage mod in posManageList)
                {
                    posManageSysNo.Add(mod.SysNo);
                }
                List <Hyt.Model.Pos.DsPosWebSocketManage> manageList = Hyt.BLL.Pos.DsPosWebSocketManageBo.Instance.GetSocketManage(posManageSysNo.ToArray());
                string Message = "";
                foreach (Hyt.Model.Pos.DsPosWebSocketManage mod in manageList)
                {
                    Message += "订单编号:" + order.SysNo + " 接收机器:" + mod.WS_PosName;
                    if (mod.WS_Status == 1 && !string.IsNullOrEmpty(mod.WS_PosNumber))
                    {
                        MessageMod msgMod = new MessageMod();
                        msgMod.ComeType        = "订单";
                        msgMod.Function        = "SendUser";
                        msgMod.ReceiveId       = mod.WS_PosNumber;
                        msgMod.Message         = "";
                        msgMod.OrderSysNo      = order.SysNo;
                        msgMod.Receiver        = address.Name;
                        msgMod.ReceiverAddress = address.StreetAddress;
                        msgMod.ReceiverTele    = address.PhoneNumber + "、" + address.MobilePhoneNumber;
                        msgMod.CreateTime      = order.CreateDate.ToString("yyyy-MM-dd HH:mm:ss");
                        msgMod.PayType         = pTypeMod.PaymentName;
                        int totalNumber = 0;
                        foreach (Hyt.Model.SoOrderItem item in orderItems)
                        {
                            totalNumber += item.Quantity;
                        }
                        msgMod.TotalNumber = totalNumber;
                        msgMod.TotalValue  = order.OrderAmount;

                        //msgMod.OrderItems = Hyt.Util.Serialization.JsonUtil.ToJson2(orderItems);
                        msgMod.OrderItems = "[]";
                        if (!string.IsNullOrEmpty(Message))
                        {
                            Message += " , ";
                        }
                        DiscountList.Add(msgMod);
                        //try
                        //{
                        //    AgentPushServiceSingleton.Instance.SendMessageToService(msgMod);
                        //    Message += "  发送成功!";
                        //}
                        //catch (Exception e)
                        //{
                        //    Message += "  发送失败!-" + e.Message;
                        //}
                    }
                }
            }

            return(DiscountList);
        }