Ejemplo n.º 1
0
        /// <summary>
        /// 初始化设备列表
        /// </summary>
        public static void InitDeviceInfo()
        {
            HeadListMCUID.Clear();
            HeadListAddress.Clear();

            string sql = string.Format("select * from Base_DeviceInfo");
            //DataAccess ac = new DataAccess();
            //DataTable dt = ac.ExecuteQueryReturnTable(sql);
            DataTable dt = XCCloudRS232BLL.ExecuterSqlToTable(sql);

            if (dt.Rows.Count == 0)
            {
                return;
            }

            foreach (DataRow row in dt.Rows)
            {
                string MCUID = row["SN"].ToString();
                机头信息   head  = CreateHeadByFull(MCUID);
                if (head != null)
                {
                    HeadListMCUID.Add(MCUID, head);

                    机头绑定信息 bind = new 机头绑定信息();
                    bind.控制器令牌 = head.常规.路由器编号;
                    bind.短地址   = head.常规.机头地址;
                    bind.长地址   = MCUID;
                    HeadListAddress.Add(bind);
                }
            }
        }
Ejemplo n.º 2
0
        public Ask设备参数申请(Info.HeadInfo.机头绑定信息 Bind)
        {
            try
            {
                Info.HeadInfo.机头信息 机头 = Info.HeadInfo.GetHeadInfoByShort(Bind);
                //DataAccess ac = new DataAccess();

                //DataTable dt = ac.ExecuteQueryReturnTable(string.Format("select * from Base_DeviceInfo where SN='{0}'", 机头.常规.机头长地址));
                DataTable dt = XCCloudRS232BLL.ExecuterSqlToTable(string.Format("select * from Base_DeviceInfo where SN='{0}'", 机头.常规.机头长地址));
                if (dt.Rows.Count > 0)
                {
                    DataRow row = dt.Rows[0];
                    机头地址 = Convert.ToByte(Bind.短地址, 16);

                    switch (row["type"].ToString())
                    {
                    case "售币机":
                        设备类型 = 0x01;
                        break;

                    case "存币机":
                        设备类型 = 0x02;
                        break;

                    case "提币机":
                    case "自助提币机":
                        设备类型 = 0x03;
                        break;

                    case "碎票机":
                        设备类型 = 0x04;
                        break;

                    case "投币机":
                        设备类型 = 0x05;
                        break;
                    }
                    string v = "000000";
                    v       += row["motor2"].ToString();
                    v       += row["motor1"].ToString();
                    马达配置     = Convert.ToByte(v, 2);
                    数码管类型    = Convert.ToByte(row["nixie_tube_type"].ToString());
                    马达1比例    = Convert.ToByte(row["motor1_coin"].ToString());
                    马达2比例    = Convert.ToByte(row["motor2_coin"].ToString());
                    存币箱最大存币数 = Convert.ToUInt16(row["alert_value"].ToString());
                    本店卡校验密码  = 机头.店密码;
                    是否允许打印   = Convert.ToByte(row["AllowPrint"].ToString());
                    try
                    {
                        SSR电平 = Convert.ToByte(row["SSR"].ToString());
                    }
                    catch
                    {
                        SSR电平 = 0x00;
                    }
                    isSuccess = true;
                }
            }
            catch { throw; }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 根据长地址创建机头信息
        /// 终端设备在申请短地址时才允许调用
        /// </summary>
        /// <param name="MCUID"></param>
        /// <returns></returns>
        static 机头信息 CreateHeadByFull(string MCUID)
        {
            string sql = string.Format("select * from Base_DeviceInfo where SN='{0}'", MCUID);
            //DataAccess ac = new DataAccess();
            //DataTable dt = ac.ExecuteQueryReturnTable(sql);
            DataTable dt = XCCloudRS232BLL.ExecuterSqlToTable(sql);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            DataRow row = dt.Rows[0];

            机头信息 head = new 机头信息();

            head.类型  = (设备类型)Convert.ToInt32(row["DeviceType"]);
            head.令牌  = row["token"].ToString();
            head.二维码 = row["qrurl"].ToString();
            if (head.类型 == 设备类型.出票器 || head.类型 == 设备类型.卡头)
            {
                sql = string.Format("select m.HeadAddress,m.GroupID,d.Token,d.ID,d.SN,d.MerchID from Data_MerchSegment m,Base_DeviceInfo d where m.ParentID=d.ID and m.DeviceID='{0}'", row["ID"].ToString());
            }
            else
            {
                sql = string.Format("select m.HeadAddress,d.Token,d.ID,d.SN,d.MerchID from Data_MerchDevice m,Base_DeviceInfo d where m.ParentID=d.ID and m.DeviceID='{0}'", row["ID"].ToString());
            }
            //DataTable tp = ac.ExecuteQueryReturnTable(sql);
            DataTable tp = XCCloudRS232BLL.ExecuterSqlToTable(sql);

            if (tp.Rows.Count == 0)
            {
                return(null);
            }
            DataRow rp = tp.Rows[0];

            head.常规.路由器编号 = rp["Token"].ToString();
            head.常规.机头长地址 = MCUID;
            head.常规.机头地址  = rp["HeadAddress"].ToString();
            head.常规.机头编号  = rp["ID"].ToString();
            head.商户号      = rp["MerchID"].ToString();
            if (head.类型 == 设备类型.出票器 || head.类型 == 设备类型.卡头)
            {
                head.常规.游戏机编号 = rp["GroupID"].ToString();
            }
            机头绑定信息 bind = new 机头绑定信息();

            bind.控制器令牌 = head.常规.路由器编号;
            bind.短地址   = head.常规.机头地址;
            bind.长地址   = MCUID;
            HeadListAddress.Add(bind);

            sql = string.Format("select m.StorePassword from Base_DeviceInfo d,Base_MerchInfo m where d.MerchID=m.ID and d.SN='{0}'", MCUID);
            //dt = ac.ExecuteQueryReturnTable(sql);
            dt = XCCloudRS232BLL.ExecuterSqlToTable(sql);
            if (dt.Rows.Count > 0)
            {
                head.店密码 = dt.Rows[0]["StorePassword"].ToString();
            }
            return(head);
        }
Ejemplo n.º 4
0
        public static void InitRule()
        {
            try
            {
                //DataAccess ac = new DataAccess();
                游戏机投币规则列表 = new List <游戏机投币规则>();
                //DataTable dt = ac.ExecuteQueryReturnTable("select * from t_push_rule");
                DataTable dt = XCCloudRS232BLL.ExecuterSqlToTable("select * from t_push_rule");
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow r in dt.Rows)
                    {
                        游戏机投币规则 rule = new 游戏机投币规则();
                        rule.游戏机编号 = r["game_id"].ToString();
                        rule.会员级别  = Convert.ToInt32(r["member_level_id"]);
                        rule.结束时间  = Convert.ToDateTime(DateTime.Now.ToLongDateString() + " " + Convert.ToDateTime(r["end_time"]).ToString("HH:mm:ss"));
                        rule.开始时间  = Convert.ToDateTime(DateTime.Now.ToLongDateString() + " " + Convert.ToDateTime(r["begin_time"]).ToString("HH:mm:ss"));
                        rule.扣币数量  = Convert.ToInt32(r["coin"]);
                        rule.优先级   = Convert.ToInt32(r["level"]);
                        rule.允许退币  = (r["allow_out"].ToString() == "是");
                        rule.允许投币  = (r["allow_in"].ToString() == "是");
                        rule.周     = Convert.ToInt32(r["week"]);

                        游戏机投币规则列表.Add(rule);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
            }
        }
Ejemplo n.º 5
0
        public 会员卡信息 GetMemberInfo(string ICCardID, string Code)
        {
            //DataAccess ac = new DataAccess();
            string sql = "select m.* from t_member m,Base_DeviceInfo d where m.MerchID=d.MerchID and d.Token='" + Code + "' and m.ICCardID='" + ICCardID + "'";
            //DataTable dt = ac.ExecuteQueryReturnTable(sql);
            DataTable dt = XCCloudRS232BLL.ExecuterSqlToTable(sql);

            if (dt.Rows.Count > 0)
            {
                DataRow row  = dt.Rows[0];
                会员卡信息   card = new 会员卡信息();
                card.备注            = row["Note"].ToString();
                card.币余额           = Convert.ToInt32(row["Balance"].ToString());
                card.动态密码          = Convert.ToInt32(row["RepeatCode"].ToString());
                card.会员卡号          = row["ICCardID"].ToString();
                card.机头上下分         = true;
                card.级别规则是否允许退币到卡里 = true;
                card.票余额           = Convert.ToInt32(row["Lottery"].ToString());
                card.商户号           = row["MerchID"].ToString();
                card.锁会员           = (row["Lock"].ToString() == "1");
                card.锁机头           = false;
                card.微信号           = row["OpenID"].ToString();
                return(card);
            }
            return(null);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 判断机头地址是否合法
        /// </summary>
        /// <param name="Code">路由器令牌</param>
        /// <param name="HeadAddress">机头地址</param>
        /// <returns></returns>
        public bool ExistsHeadInfo(string Code, string HeadAddress)
        {
            //DataAccess ac = new DataAccess();
            //DataTable dt = ac.ExecuteQueryReturnTable("select d.ID from Base_DeviceInfo d,Data_MerchSegment m where d.ID=m.ParentID and m.HeadAddress='" + HeadAddress + "' and d.Token='" + Code + "'");
            DataTable dt = XCCloudRS232BLL.ExecuterSqlToTable("select d.ID from Base_DeviceInfo d,Data_MerchSegment m where d.ID=m.ParentID and m.HeadAddress='" + HeadAddress + "' and d.Token='" + Code + "'");

            return(dt.Rows.Count > 0);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取终端设备集合
        /// </summary>
        /// <returns></returns>
        public static DataTable GetTerminalDeviceList()
        {
            #region Sql语句
            string strSql = @"
                            SELECT c.Token AS RouterToken, a.ID AS DeviceId, a.Token AS DeviceToken, a.DeviceName, a.DeviceType, a.Status AS [State], a.SN, b.HeadAddress, b.GroupID
                            FROM Base_DeviceInfo a
                            INNER JOIN Data_MerchSegment b ON b.DeviceID = a.ID
                            INNER JOIN Base_DeviceInfo c ON c.ID = b.ParentID
                            ";
            #endregion

            DataTable table = XCCloudRS232BLL.ExecuterSqlToTable(strSql);
            return(table);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 控制器详细信息
        /// </summary>
        /// <returns></returns>
        public static DataTable GetRouterDetail()
        {
            #region Sql语句
            string strSql = @"
                            SELECT a.ID, a.Token AS DeviceToken, a.DeviceName, a.DeviceType, a.SN, a.Status, b.MerchName, b.Mobile, b.State
                            FROM Base_DeviceInfo a
                            INNER JOIN Base_MerchInfo b ON a.MerchID = b.ID
                            WHERE a.DeviceType = 0
                            ";
            #endregion

            DataTable table = XCCloudRS232BLL.ExecuterSqlToTable(strSql);
            return(table);
        }
Ejemplo n.º 9
0
        public static void RefreshFreeRule()
        {
            try
            {
                //DataAccess ac = new DataAccess();
                当前送分规则 = new List <送分规则>();
                //DataTable dt = ac.ExecuteQueryReturnTable("select * from t_game_free_rule where GETDATE() BETWEEN StartTime and EndTime and State='启用'");
                DataTable dt = XCCloudRS232BLL.ExecuterSqlToTable("select * from t_game_free_rule where GETDATE() BETWEEN StartTime and EndTime and State='启用'");
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        送分规则 gz = new 送分规则();
                        gz.规则编号  = row["ID"].ToString();
                        gz.会员级别  = row["MemberLevelID"].ToString();
                        gz.结束时间  = Convert.ToDateTime(row["EndTime"]);
                        gz.开始时间  = Convert.ToDateTime(row["StartTime"]);
                        gz.扣币数   = Convert.ToInt32(row["NeedCoin"]);
                        gz.启用状态  = row["State"].ToString();
                        gz.送币数   = Convert.ToInt32(row["FreeCoin"]);
                        gz.游戏机编号 = row["GameID"].ToString();
                        gz.最小退币数 = Convert.ToInt32(row["ExitCoin"]);

                        var r = 当前送分规则.Where(p => p.规则编号 == row["ID"].ToString());
                        if (r.Count() > 0)
                        {
                            送分规则 gz1        = new 送分规则();
                            r.First().会员级别  = gz.会员级别;
                            r.First().结束时间  = gz.结束时间;
                            r.First().开始时间  = gz.开始时间;
                            r.First().扣币数   = gz.扣币数;
                            r.First().启用状态  = gz.启用状态;
                            r.First().送币数   = gz.送币数;
                            r.First().游戏机编号 = gz.游戏机编号;
                            r.First().最小退币数 = gz.最小退币数;
                        }
                        else
                        {
                            当前送分规则.Add(gz);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 会员详细信息
        /// </summary>
        /// <returns></returns>
        public static DataTable GetMemberDetail(string memberId)
        {
            string strWhere = string.Empty;

            if (!string.IsNullOrWhiteSpace(memberId))
            {
                strWhere = string.Format("WHERE MemberID = {0}", memberId);
            }

            #region Sql语句
            string strSql = @"
                            SELECT ICCardID, MemberName, Mobile, Birthday, CertificalID, Balance, Lottery, Point, [Type], JoinTime, EndDate, MemberPassword, Note, Lock, LockDate
                            FROM t_member
                            {0}
                            ";
            #endregion

            strSql = string.Format(strSql, strWhere);

            DataTable table = XCCloudRS232BLL.ExecuterSqlToTable(strSql);
            return(table);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 数据接收处理线程
        /// </summary>
        /// <param name="o"></param>
        void ProcessCommad(object o)
        {
            RecvObject recv = o as RecvObject;

            if (recv != null)
            {
                Console.WriteLine("收到:" + PubLib.Hex2String(recv.Data));
                DateTime time = DateTime.Now;
                if (PubLib.RecvDataLength >= 1000000000)
                {
                    //重置 防止溢出
                    PubLib.RecvDataLength = 0;
                }
                PubLib.RecvDataLength += recv.Data.Length;

                FrameData f = new FrameData(recv.Data);
                SetRouteInfo(recv.Code, f.routeAddress, recv.RemotePoint);
                f.Code = recv.Code;
                //DataAccess ac = new DataAccess();
                //DataTable dt = ac.ExecuteQueryReturnTable("select * from Base_DeviceInfo where DeviceType='0' and Status<>2 and Token='" + f.Code + "'");  //绑定所有空闲或正常的控制设备
                DataTable dt = XCCloudRS232BLL.ExecuterSqlToTable("select * from Base_DeviceInfo where DeviceType='0' and Status<>2 and Token='" + f.Code + "'");  //绑定所有空闲或正常的控制设备
                if (dt.Rows.Count > 0)
                {
                    PubLib.当前总指令数++;
                    //控制器合法
                    switch (f.commandType)
                    {
                    case CommandType.机头网络状态报告:
                    {
                        Recv机头网络状态报告 cmd = new Recv机头网络状态报告(f);

                        if (ListenRouterToken == f.Code && CommandTypeList.Exists((CommandType type) => type == CommandType.机头网络状态报告))
                        {
                            ShowMsg(cmd.GetRecvData(DateTime.Now));
                            ShowMsg(cmd.GetSendData());
                        }

                        SendData(cmd.SendData, recv.RemotePoint);
                        状态更新         handler = new 状态更新(ChangeState);
                        IAsyncResult result  = handler.BeginInvoke(cmd, null, null);
                        //ChangeState(cmd);
                    }
                    break;

                    case CommandType.机头地址动态分配:
                    {
                        Recv机头地址动态分配 cmd = new Recv机头地址动态分配(f);
                        if (ListenRouterToken == f.Code && ListenDeviceAddress == cmd.机头地址 && CommandTypeList.Exists((CommandType type) => type == CommandType.机头地址动态分配))
                        {
                            ShowMsg(cmd.GetRecvData(DateTime.Now));
                            ShowMsg(cmd.GetSendData());
                        }

                        SendData(cmd.SendData, recv.RemotePoint);
                    }
                    break;

                    case CommandType.游戏机参数申请:
                    {
                        Recv游戏机参数申请 cmd = new Recv游戏机参数申请(f);
                        if (ListenRouterToken == f.Code && ListenDeviceAddress == cmd.机头地址 && CommandTypeList.Exists((CommandType type) => type == CommandType.游戏机参数申请))
                        {
                            ShowMsg(cmd.GetRecvData(DateTime.Now));
                            ShowMsg(cmd.GetSendData());
                        }

                        SendData(cmd.SendData, recv.RemotePoint);
                    }
                    break;

                    case CommandType.远程投币上分指令应答:
                    {
                        //if (CommandTypeList.Exists((CommandType type) => type == CommandType.电子币模式投币数据))
                        //{
                        //    ShowMsg(cmd.GetRecvData(DateTime.Now));
                        //}

                        PubLib.当前币业务指令数++;
                        int SN = BitConverter.ToUInt16(f.recvData, 6);          //用于清除重发队列
                    }
                    break;

                    case CommandType.远程被动退分解锁指令应答:
                    {
                        PubLib.当前币业务指令数++;
                        //远程退分指令应答
                    }
                    break;

                    case CommandType.机头卡片报警指令:
                    {
                        Recv机头卡片报警指令 cmd = new Recv机头卡片报警指令(f, DateTime.Now);
                        if (ListenRouterToken == f.Code && ListenDeviceAddress == cmd.机头地址 && CommandTypeList.Exists((CommandType type) => type == CommandType.机头卡片报警指令))
                        {
                            ShowMsg(cmd.GetRecvData(DateTime.Now));
                            ShowMsg(cmd.GetSendData());
                        }
                        SendData(cmd.SendData, recv.RemotePoint);
                    }
                    break;

                    case CommandType.IC卡模式退币数据:
                    case CommandType.IC卡模式投币数据:
                    {
                        Recv卡头进出币数据 cmd = new Recv卡头进出币数据(f, DateTime.Now);
                        if (ListenRouterToken == f.Code && ListenDeviceAddress == cmd.机头地址 && CommandTypeList.Exists((CommandType type) => type == CommandType.IC卡模式投币数据))
                        {
                            ShowMsg(cmd.GetRecvData(DateTime.Now));
                            ShowMsg(cmd.GetSendData());
                        }

                        SendData(cmd.SendData, recv.RemotePoint);
                    }
                    break;
                    }
                }
            }
        }
Ejemplo n.º 12
0
        public Ask终端参数申请(Info.HeadInfo.机头绑定信息 Bind)
        {
            try
            {
                游戏机机头编号 = "0000A";

                Info.HeadInfo.机头信息 机头 = Info.HeadInfo.GetHeadInfoByShort(Bind);
                机头地址 = Convert.ToByte(Bind.短地址, 16);
                //DataAccess ac = new DataAccess();
                //DataTable dt = ac.ExecuteQueryReturnTable(string.Format("select g.* from Data_MerchSegment s,Base_DeviceInfo d,Data_GameInfo g where d.ID=s.DeviceID and g.GroupID=s.GroupID and d.SN='{0}'", 机头.常规.机头长地址));
                DataTable dt = XCCloudRS232BLL.ExecuterSqlToTable(string.Format("select g.* from Data_MerchSegment s,Base_DeviceInfo d,Data_GameInfo g where d.ID=s.DeviceID and g.GroupID=s.GroupID and d.SN='{0}'", 机头.常规.机头长地址));
                if (dt.Rows.Count > 0)
                {
                    DataRow row = dt.Rows[0];

                    效期天数           = (byte)机头.打印小票有效天数;
                    机头.彩票模式        = (row["LotteryMode"].ToString() == "1");
                    单次退币限额         = Convert.ToUInt16(row["OnceOutLimit"]);
                    机头.参数.单次退币限额   = 单次退币限额;
                    机头.参数.投币时扣卡上币数 = Convert.ToByte(row["PushReduceFromCard"]);
                    //扣卡里币基数 = (byte)机头.参数.投币时扣卡上币数;
                    机头.参数.投币时给游戏机信号数       = Convert.ToUInt16(row["PushAddToGame"]);
                    机头.参数.第二路上分线投币时扣卡上币数   = Convert.ToInt32(row["SecondReduceFromCard"]);
                    机头.参数.第二路上分线投币时给游戏机信号数 = Convert.ToInt32(row["SecondAddToGame"]);
                    退币时给游戏机脉冲数比例因子         = Convert.ToByte(row["OutReduceFromGame"]);
                    机头.参数.退币时给游戏机脉冲数比例因子   = 退币时给游戏机脉冲数比例因子;
                    退币时卡上增加币数比例因子          = Convert.ToByte(row["OutAddToCard"]);
                    机头.参数.退币时卡上增加币数比例因子    = 退币时卡上增加币数比例因子;
                    退币按钮脉宽       = Convert.ToUInt16(row["BOPulse"]);
                    机头.参数.退币按钮脉宽 = 退币按钮脉宽;
                    游戏机维修开关信号1 开关信号1 = new 游戏机维修开关信号1();
                    开关信号1.bit0允许电子退币或允许打票 = Convert.ToBoolean(row["AllowElecOut"]);
                    机头.开关.允许电子退币或允许打票     = 开关信号1.bit0允许电子退币或允许打票;
                    开关信号1.bit1允许电子投币      = Convert.ToBoolean(row["AllowElecPush"]);
                    机头.开关.允许电子投币          = 开关信号1.bit1允许电子投币;
                    开关信号1.bit2允许十倍投币      = Convert.ToBoolean(row["AllowDecuplePush"]);
                    机头.开关.允许十倍投币          = 开关信号1.bit2允许十倍投币;
                    开关信号1.bit3允许实物退币      = Convert.ToBoolean(row["AllowRealOut"]);
                    机头.开关.允许实物退币          = 开关信号1.bit3允许实物退币;
                    开关信号1.bit4转发实物投币      = Convert.ToBoolean(row["AllowRealPush"]);
                    机头.开关.转发实物投币          = 开关信号1.bit4转发实物投币;
                    //开关信号1.bit5硬件投币控制 = Convert.ToBoolean(row["PushControl"]);
                    //机头.开关.硬件投币控制 = 开关信号1.bit5硬件投币控制;
                    开关信号1.bit6投币脉冲电平      = Convert.ToBoolean(row["PushLevel"]);
                    机头.开关.投币脉冲电平          = 开关信号1.bit6投币脉冲电平;
                    开关信号1.bit7第二路上分线上分电平  = Convert.ToBoolean(row["SecondLevel"]);
                    机头.开关.第二路上分线上分电平      = 开关信号1.bit7第二路上分线上分电平;
                    开关信号1.bit8SSR退币驱动脉冲电平 = Convert.ToBoolean(row["OutLevel"]);
                    机头.开关.SSR退币驱动脉冲电平     = 开关信号1.bit8SSR退币驱动脉冲电平;
                    开关信号1.bit9数币脉冲电平      = Convert.ToBoolean(row["CountLevel"]);
                    机头.开关.数币脉冲电平          = 开关信号1.bit9数币脉冲电平;
                    开关信号1.bit10启用第二路上分信号  = Convert.ToBoolean(row["UseSecondPush"]);
                    机头.开关.启用第二路上分信号       = 开关信号1.bit10启用第二路上分信号;
                    开关1 = PubLib.GetBit16ByObject(开关信号1);
                    游戏机维修开关信号2 开关信号2 = new 游戏机维修开关信号2();
                    开关信号2.bit0退币超限标志     = ((机头.投币.盈利数 > 机头.投币.每天净退币上限) && !机头.状态.是否忽略超分报警);
                    机头.开关.退币超限标志         = 开关信号2.bit0退币超限标志;
                    开关信号2.bit1启用专卡专用     = Convert.ToBoolean(row["GuardConvertCard"]);
                    机头.开关.启用专卡专用         = 开关信号2.bit1启用专卡专用;
                    开关信号2.bit2BO按钮是否维持   = Convert.ToBoolean(row["BOKeep"]);
                    机头.开关.BO按钮是否维持       = 开关信号2.bit2BO按钮是否维持;
                    开关信号2.bit3退分锁定标志     = Convert.ToBoolean(row["BOLock"]);
                    机头.开关.退分锁定标志         = 开关信号2.bit3退分锁定标志;
                    开关信号2.bit4启用异常退币检测   = Convert.ToBoolean(row["ExceptOutTest"]);
                    机头.开关.启用异常退币检测       = 开关信号2.bit4启用异常退币检测;
                    开关信号2.bit5启用即中即退模式   = Convert.ToBoolean(row["NowExit"]);
                    机头.开关.启用即中即退模式       = 开关信号2.bit5启用即中即退模式;
                    开关信号2.bit6启用外部报警检测   = Convert.ToBoolean(row["OutsideAlertCheck"]);
                    机头.开关.启用外部报警检测       = 开关信号2.bit6启用外部报警检测;
                    开关信号2.bit7启用回路报警检测   = Convert.ToBoolean(row["ReturnCheck"]);
                    机头.开关.启用回路报警检测       = 开关信号2.bit7启用回路报警检测;
                    开关信号2.bit8启用增强防止转卡   = Convert.ToBoolean(row["StrongGuardConvertCard"]);
                    机头.开关.增强防止转卡         = 开关信号2.bit8启用增强防止转卡;
                    开关信号2.bit9启用刷卡即扣     = Convert.ToBoolean(row["ReadCat"]);
                    机头.开关.启动刷卡即扣         = 开关信号2.bit9启用刷卡即扣;
                    开关信号2.bit10启用刷卡版彩票功能 = Convert.ToBoolean(row["ICTicketOperation"]);
                    机头.开关.启用刷卡版彩票        = 开关信号2.bit10启用刷卡版彩票功能;
                    开关信号2.bit11启用防霸位功能   = Convert.ToBoolean(row["BanOccupy"]);
                    机头.开关.启用防霸位功能        = 开关信号2.bit11启用防霸位功能;
                    开关信号2.bit12只退实物彩票    = Convert.ToBoolean(row["OnlyExitLottery"]);
                    机头.开关.只退实物彩票         = 开关信号2.bit12只退实物彩票;
                    开关信号2.bit13启用彩票模式    = 机头.彩票模式;
                    开关信号2.bit14小票是否打印二维码 = 机头.开关.小票是否打印二维码;
                    开关2                  = PubLib.GetBit16ByObject(开关信号2);
                    首次投币启动间隔             = Convert.ToByte(row["PushStartInterval"]);
                    机头.参数.首次投币启动间隔       = 首次投币启动间隔;
                    投币速度                 = Convert.ToUInt16(row["PushSpeed"]);
                    机头.参数.投币速度           = 投币速度;
                    投币脉宽                 = Convert.ToByte(row["PushPulse"]);
                    机头.参数.投币脉宽           = 投币脉宽;
                    第二路上分线首次上分启动间隔       = Convert.ToByte(row["SecondStartInterval"]);
                    机头.参数.第二路上分线首次上分启动间隔 = 第二路上分线首次上分启动间隔;
                    第二路上分线上分速度           = Convert.ToUInt16(row["SecondSpeed"]);
                    机头.参数.第二路上分线上分速度     = 第二路上分线上分速度;
                    第二路上分线上分脉宽           = Convert.ToByte(row["SecondPulse"]);
                    机头.参数.第二路上分线上分脉宽     = 第二路上分线上分脉宽;
                    退币速度                 = Convert.ToUInt16(row["OutSpeed"]);
                    机头.参数.退币速度           = 退币速度;
                    退币脉宽                 = Convert.ToByte(row["OutPulse"]);
                    机头.参数.退币脉宽           = 退币脉宽;
                    机头.投币.单次退币上限         = 单次退币限额;
                    机头.投币.每天净退币上限        = Convert.ToInt32(row["OneDayPureOutLimit"]);
                    //游戏机机头编号 = 机头.常规.机头编号;
                    异常检测时间            = Convert.ToByte(row["ExceptOutSpeed"]);
                    机头.参数.异常SSR退币检测速度 = 异常检测时间;
                    异常检测次数            = Convert.ToByte(row["Frequency"]);
                    机头.参数.异常SSR退币检测次数 = 异常检测次数;
                    if (机头.开关.启用第二路上分信号)
                    {
                        扣卡里币基数 = (byte)机头.参数.第二路上分线投币时扣卡上币数;
                    }
                    else
                    {
                        扣卡里币基数 = (byte)机头.参数.投币时扣卡上币数;
                    }
                    本店卡校验密码 = 机头.店密码;
                }
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 套餐销售流水详情分页
        /// </summary>
        /// <param name="merchId">商户ID</param>
        /// <param name="routerId">控制器ID</param>
        /// <param name="pageIndex">当前页索引</param>
        /// <param name="pageSize">每页条数</param>
        /// <returns></returns>
        public static DataTable GetMemberExpenseDetail(int merchId, string icCardId, string flowType = "0", string sDate = null, string eDate = null, int pageIndex = 1, int pageSize = 10)
        {
            string strWhere = string.Empty;

            if (!string.IsNullOrWhiteSpace(sDate) && string.IsNullOrWhiteSpace(eDate))
            {
                strWhere = string.Format(" AND RealTime >= '{0}'", sDate);
            }
            else if (string.IsNullOrWhiteSpace(sDate) && !string.IsNullOrWhiteSpace(eDate))
            {
                strWhere = string.Format(" AND RealTime <= '{0}'", eDate);
            }
            else if (!string.IsNullOrWhiteSpace(sDate) && !string.IsNullOrWhiteSpace(eDate))
            {
                strWhere = string.Format(" AND RealTime BETWEEN '{0}' AND '{1}'", sDate, eDate);
            }
            else
            {
                sDate    = DateTime.Now.ToString("yyyy-MM-dd");
                eDate    = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
                strWhere = string.Format(" AND RealTime BETWEEN '{0}' AND '{1}'", sDate, eDate);
            }

            string strFlow = string.Empty;

            if (!string.IsNullOrWhiteSpace(flowType) && flowType != "0")
            {
                strFlow = string.Format("AND a.FlowType = {0}", flowType);
            }

            #region Sql语句
            string strSql = @"
                            WITH MemberExpenseList AS
                            (
	                            SELECT f.ICCardID, m.MemberName, m.Mobile, '提币' AS Flow, 1 AS FlowType, '0' AS Amount, f.Coins, f.Balance, f.RealTime
                                FROM flw_coin_sale f
	                            INNER JOIN t_member m ON m.ICCardID = f.ICCardID
	                            WHERE f.MerchID = {0} AND f.ICCardID = {1} {2}
	                            UNION ALL
	                            SELECT f.ICCardID,m.MemberName,m.Mobile, '存币' AS Flow, 2 AS FlowType, '0' AS Amount, f.Coins, f.Balance, f.RealTime
	                            FROM flw_485_savecoin f
	                            INNER JOIN t_member m ON m.ICCardID = f.ICCardID
	                            WHERE f.MerchID = {0} AND f.ICCardID = {1} {2}
	                            UNION ALL 
	                            SELECT f.ICCardID,m.MemberName, m.Mobile, 
	                            CASE f.FlowType WHEN 0 THEN '充值' WHEN 1 THEN '购币' END AS Flow,
	                            CASE f.FlowType WHEN 0 THEN 3 WHEN 1 THEN 4 END AS FlowType,
	                            f.TotalMoney AS Amount, f.CoinQuantity, f.Balance, f.RealTime
	                            FROM flw_food_sale f
	                            INNER JOIN t_member m ON m.ICCardID = f.ICCardID
	                            WHERE f.PayState = 1 AND f.MerchID = {0} AND f.ICCardID = {1} {2}
                            )
                            SELECT ICCardID, MemberName, Mobile, Flow, Amount, Coins, Balance, CONVERT(varchar(100), RealTime, 120) AS RealTime  
                            FROM 
                            (
                                SELECT  ROW_NUMBER() OVER (ORDER BY RealTime DESC) rownumber , ICCardID, MemberName, Mobile, Flow, FlowType, Amount, Coins, Balance, RealTime
                                FROM MemberExpenseList
                            ) AS a
                            WHERE rownumber BETWEEN {4} AND {5} {3}
                              ";
            #endregion

            strSql = string.Format(strSql, merchId, icCardId, strWhere, strFlow, (pageIndex - 1) * pageSize + 1, pageIndex * pageSize);

            DataTable table = XCCloudRS232BLL.ExecuterSqlToTable(strSql);
            return(table);
        }
        bool 电子退币SQL(Info.HeadInfo.机头信息 head, UInt16 SN, int Coins, string ICCard, int RepeadCode, CoinType cType, ref Info.HeadInfo.IC卡模式进出币应答结构 投币应答, ref string msg)
        {
            bool res = false;
            int  pCoin = 0, bValue = 0;
            bool isAllowOut = true, isAllowIn = true, isAllowZKZY = false;
            bool 是否超分报警 = false;

            Info.CoinInfo       coin   = new Info.CoinInfo();
            Info.CoinInfo.会员卡信息 member = coin.GetMemberInfo(ICCard, head.常规.路由器编号);
            if (member == null)
            {
                return(res);
            }
            member.退币时间 = DateTime.Now;

            //DataAccess ac = new DataAccess();

            string sqlString = "";

            if (head.彩票模式 && cType == CoinType.电子退币)
            {
                cType = CoinType.IC退彩票;
            }

            Info.PushRule.GetCurRule(head.常规.游戏机编号, out pCoin, out isAllowOut, out isAllowIn, out isAllowZKZY);

            //启用退币保护,并且退币数误差在设定值正负1个范围内则触发事件
            if (head.常规.退币保护启用标志 && head.常规.退币信号超时退币个数 - 1 <= Coins && head.常规.退币信号超时退币个数 + 1 >= Coins)
            {
                msg += "触发退币保护功能\r\n";
                if (Info.GameInfo.TBProtect(head.常规.游戏机编号))
                {
                    member.机头上下分 = false;
                    退币报警锁机头      = true;
                    //Command.Ask.Ask机头锁定解锁指令 a = new Command.Ask.Ask机头锁定解锁指令(head.常规.机头地址, true);
                    sqlString = string.Format("exec TBProc '{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}'",
                                              head.常规,
                                              head.常规.机头地址,
                                              SN,
                                              Coins,
                                              ICCard,
                                              (int)cType,
                                              1,  //锁用户
                                              1,  //退币保护
                                              0,  //超分
                                              0,  //是否添加流水
                                              0); //彩票模式
                    //ac.Execute(sqlString);
                    XCCloudRS232BLL.ExecuteSql(sqlString);
                    return(false);
                }
            }
            else
            {
                Info.GameInfo.ClearTimeoutCount(head.常规.游戏机编号, head.常规.退币保护启用标志);
            }

            if (!head.状态.是否正在使用限时送分优惠)  //正常退币
            {
                head.常规.当前卡片号   = "";
                head.常规.是否为首次投币 = true;
                bValue         += Coins;
                投币应答.锁机头        = false;
                投币应答.机头能上分      = isAllowIn;
                投币应答.机头能打票      = isAllowOut;
                msg            += "正常退币数据\r\n";
                if ((0 - head.投币.盈利数 > head.投币.每天净退币上限 || Coins > head.投币.单次退币上限) && !head.状态.是否忽略超分报警 && !head.彩票模式)
                {
                    投币应答.锁机头           = true;
                    投币应答.超出当日机头最大净退币上线 = true;
                    msg   += "触发超额报警\r\n";
                    是否超分报警 = true;
                }
                else
                {
                    投币应答.锁机头           = false;
                    投币应答.超出当日机头最大净退币上线 = false;
                }
                投币应答.币余额 = bValue;
                res      = true;
            }
            else   //当前机头正在使用限时送分,则要判断最小退币数
            {
                if (head.投币.最小退币数 > Coins)
                {
                    //不满足退币条件
                    投币应答.币余额   = member.币余额;
                    投币应答.机头能上分 = isAllowIn;
                    投币应答.机头能打票 = isAllowOut;
                    int 数 = Coins / pCoin;
                    投币应答.发脉冲数          = (head.开关.启用第二路上分信号) ?  数 * head.参数.第二路上分线投币时给游戏机信号数 :  数 * head.参数.投币时给游戏机信号数;
                    投币应答.是否将退币上回游戏机    = true;
                    投币应答.是否正在使用限时送分优惠券 = true;
                    msg += "限时送分中不满足退币条件\r\n";
                    return(false);
                }
                else
                {
                    //满足退币条件
                    head.常规.当前卡片号        = "";
                    head.常规.是否为首次投币      = true;
                    head.投币.退币数         += Coins;
                    head.状态.是否正在使用限时送分优惠 = false;
                    bValue            += Coins;
                    投币应答.是否正在使用限时送分优惠券 = false;
                    投币应答.币余额           = bValue;
                    res  = true;
                    msg += "限时送分中满足退币条件\r\n";
                }
            }


            sqlString = string.Format("exec TBProc '{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}'",
                                      head.常规.路由器编号,
                                      head.常规.机头地址,
                                      SN,
                                      Coins,
                                      ICCard,
                                      (int)cType,
                                      ((bValue > PubLib.会员余额上限 || member.退币数 - member.投币数 > PubLib.会员净退币数上限) && head.彩票模式) ? 1 : 0,
                                      0,
                                      是否超分报警 ? 1 : 0,
                                      res ? 1 : 0,
                                      head.彩票模式 ? 1 : 0);

            //DataTable dt = ac.ExecuteQueryReturnTable(sqlString);
            DataTable dt  = XCCloudRS232BLL.ExecuterSqlToTable(sqlString);
            DataRow   row = dt.Rows[0];

            //有效电子投币
            if (head.彩票模式)
            {
                bValue = Convert.ToInt32(row["lottery"].ToString());
            }
            else
            {
                bValue = Convert.ToInt32(row["balance"].ToString());
            }
            投币应答.币余额           = bValue;
            投币应答.是否启用卡片专卡专用    = (row["LockHead"].ToString() == "1");
            投币应答.是否正在使用限时送分优惠券 = head.状态.是否正在使用限时送分优惠;
            msg += "找到会员信息\r\n";

            if (head.彩票模式)
            {
                member.锁会员 = false;
                member.票余额 = bValue;
            }
            else
            {
                member.币余额 = bValue;
                if (bValue > PubLib.会员余额上限 || member.退币数 - member.投币数 > PubLib.会员净退币数上限)
                {
                    member.锁会员 = true;
                    msg       += "写入新余额并锁定会员\r\n";
                }
                else
                {
                    member.锁会员 = false;
                    msg       += "写入新余额\r\n";
                }
            }

            member.Update();

            return(res);
        }
Ejemplo n.º 15
0
        public static void RefreshRule(DateTime d)
        {
            try
            {
                //InitRule();

                //RefreshFreeRule();
                //DataAccess ac = new DataAccess(); //****
                //DataTable mind = ac.ExecuteQueryReturnTable("select r.ExitCoin,f.HeadID from flw_game_free f,t_game_free_rule r where f.RuleID=r.ID ORDER BY RealTime DESC");
                //foreach (HeadInfo.机头信息 head in HeadInfo.GetAllHead())
                //{
                //    DataRow r = mind.Select("HeadID='" + head.常规.机头编号 + "'").FirstOrDefault() as DataRow;
                //    if (r != null)
                //    {
                //        head.投币.最小退币数 = Convert.ToInt32(mind.Rows[0][0].ToString());
                //    }
                //}

                //DataTable dtLevel = ac.ExecuteQueryReturnTable("select * from t_memberlevel");
                //DataTable dtGame = ac.ExecuteQueryReturnTable("select * from Data_GameInfo");
                DataTable dtGame = XCCloudRS232BLL.ExecuterSqlToTable("select * from Data_GameInfo");
                int       week   = (int)d.DayOfWeek;
                foreach (DataRow grow in dtGame.Rows)
                {
                    string gameID = grow["GroupID"].ToString();
                    bool   gIn, gOut, lIn, lOut, gz, lz;

                    gIn  = (grow["AllowElecPush"].ToString() == "1");
                    gOut = (grow["AllowElecOut"].ToString() == "1");
                    lIn  = true;
                    lOut = (grow["AllowElecOut"].ToString() == "1");
                    gz   = (grow["GuardConvertCard"].ToString() == "1");
                    lz   = false;

                    if (游戏机投币规则列表.Where(p => p.游戏机编号 == gameID).Count() > 0)
                    {
                        var rlist = 游戏机投币规则列表.Where(p => p.游戏机编号 == gameID && p.周 == week && Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + p.开始时间.ToString("HH:mm:ss")) <= d && Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + p.结束时间.ToString("HH:mm:ss")) >= d).OrderByDescending(p => p.优先级);
                        if (rlist.Count() > 0)
                        {
                            游戏机投币规则 rule = rlist.First();
                            SetCurRule(gameID, rule.扣币数量, (gOut && lOut && rule.允许退币), (gIn && lIn && rule.允许投币), (gz || lz));
                        }
                        else
                        {
                            //当前游戏机没有投币规则则默认继承游戏机参数
                            if (grow["UseSecondPush"].ToString() == "1")
                            {
                                //启用第二路上分信号
                                SetCurRule(gameID, Convert.ToInt32(grow["SecondReduceFromCard"]), Convert.ToInt32(grow["AllowElecOut"]) == 1, grow["AllowElecPush"].ToString() == "1", (gz || lz));
                            }
                            else
                            {
                                SetCurRule(gameID, Convert.ToInt32(grow["PushReduceFromCard"]), Convert.ToInt32(grow["AllowElecOut"]) == 1, grow["AllowElecPush"].ToString() == "1", (gz || lz));
                            }
                        }
                    }
                    else
                    {
                        //当前游戏机没有投币规则则默认继承游戏机参数
                        if (grow["UseSecondPush"].ToString() == "1")
                        {
                            //启用第二路上分信号
                            SetCurRule(gameID, Convert.ToInt32(grow["SecondReduceFromCard"]), lOut, lIn, (gz || lz));
                        }
                        else
                        {
                            SetCurRule(gameID, Convert.ToInt32(grow["PushReduceFromCard"]), lOut, lIn, (gz || lz));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 查询控制器报警日志
        /// </summary>
        /// <param name="routerToken">控制器ID</param>
        /// <param name="sDate">开始时间</param>
        /// <param name="eDate">结束时间</param>
        /// <param name="pageIndex">当前页索引</param>
        /// <param name="pageSize">每页条数</param>
        /// <returns></returns>
        public static DataTable GetRouterWarnLog(string routerToken, string deviceSN, string headAddress, string alertType, string sDate = null, string eDate = null, int pageIndex = 1, int pageSize = 10)
        {
            string strWhere = string.Empty;

            if (!string.IsNullOrWhiteSpace(deviceSN))
            {
                strWhere = string.Format(" AND r.SN LIKE '%{0}%'", deviceSN);
            }

            if (!string.IsNullOrWhiteSpace(headAddress))
            {
                strWhere += string.Format(" AND r.HeadAddress = '{0}'", headAddress);
            }

            if (!string.IsNullOrWhiteSpace(alertType))
            {
                strWhere += string.Format(" AND f.AlertType = '{0}'", alertType);
            }

            if (!string.IsNullOrWhiteSpace(sDate) && string.IsNullOrWhiteSpace(eDate))
            {
                strWhere += string.Format(" AND HappenTime >= '{0}'", sDate);
            }
            else if (string.IsNullOrWhiteSpace(sDate) && !string.IsNullOrWhiteSpace(eDate))
            {
                strWhere += string.Format(" AND HappenTime <= '{0}'", eDate);
            }
            else if (!string.IsNullOrWhiteSpace(sDate) && !string.IsNullOrWhiteSpace(eDate))
            {
                strWhere += string.Format(" AND HappenTime BETWEEN '{0}' AND '{1}'", sDate, eDate);
            }
            else
            {
                sDate     = DateTime.Now.ToString("yyyy-MM-dd");
                eDate     = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
                strWhere += string.Format(" AND HappenTime BETWEEN '{0}' AND '{1}'", sDate, eDate);
            }

            #region Sql语句
            #region 分页

            //            string strSql = @"
            //                WITH Device AS
            //                            (
            //                            SELECT ID, DeviceName, Token, DeviceType, SN FROM Base_DeviceInfo
            //                            ),
            //                            RouterDevice
            //                            AS
            //                            (
            //                            SELECT a.DeviceID, c.DeviceName, c.DeviceType, c.SN, a.HeadAddress, b.Token AS RouterToken FROM Data_MerchDevice a
            //                            INNER JOIN Device b ON b.ID = a.ParentID
            //                            INNER JOIN Device c ON c.ID = a.DeviceID
            //                            WHERE b.Token = '{0}'
            //                            UNION
            //                            SELECT a.DeviceID, c.DeviceName, c.DeviceType, c.SN, a.HeadAddress, b.Token FROM Data_MerchSegment a
            //                            INNER JOIN Device b ON b.ID = a.ParentID
            //                            INNER JOIN Device c ON c.ID = a.DeviceID
            //                            UNION
            //                            SELECT id, DeviceName, DeviceType, SN, '', Token FROM Device
            //                            WHERE DeviceType = 0 AND Token = '{0}'
            //                            ),
            //                            Alarm AS
            //                            (
            //                            SELECT ID, ICCardID, MerchID, f.DeviceID, r.DeviceName, r.DeviceType, r.SN, AlertType, HappenTime, EndTime, [State], LockGame, LockMember, AlertContent, r.HeadAddress, r.RouterToken FROM flw_game_alarm f
            //                            INNER JOIN RouterDevice r ON r.DeviceID = f.DeviceID
            //                            WHERE r.RouterToken = '{0}' {1}
            //                            )
            //                            SELECT ID, ICCardID, MerchID, DeviceID, DeviceName, SN,
            //                            (CASE DeviceType WHEN 0 THEN '控制器' WHEN 1 THEN '提(售)币机' WHEN 2 THEN '存币机' WHEN 3 THEN '出票器' WHEN 4 THEN '卡头' END) AS DeviceType,
            //                            AlertType, CONVERT(varchar(100), HappenTime, 120) AS HappenTime,
            //                            CONVERT(varchar(100), EndTime, 120) AS EndTime, [State], LockGame, LockMember, AlertContent, HeadAddress, RouterToken
            //                            FROM
            //                            (
            //                                SELECT  ROW_NUMBER() OVER (ORDER BY HappenTime DESC) rownumber , ID, ICCardID, MerchID, DeviceID, DeviceName, DeviceType, SN, AlertType, HappenTime, EndTime, [State], LockGame, LockMember, AlertContent, HeadAddress, RouterToken
            //                                FROM Alarm
            //                            ) AS a
            //                            WHERE rownumber BETWEEN {2} AND {3}";
            #endregion

            string strSql = @"
                            WITH Device AS
                            (
                            SELECT ID, DeviceName, Token, DeviceType, SN FROM Base_DeviceInfo
                            ),
                            RouterDevice
                            AS
                            (
                            SELECT a.DeviceID, c.DeviceName, c.DeviceType, c.SN, a.HeadAddress, b.Token AS RouterToken FROM Data_MerchDevice a
                            INNER JOIN Device b ON b.ID = a.ParentID
                            INNER JOIN Device c ON c.ID = a.DeviceID
                            WHERE b.Token = '{0}'
                            UNION
                            SELECT a.DeviceID, c.DeviceName, c.DeviceType, c.SN, a.HeadAddress, b.Token FROM Data_MerchSegment a
                            INNER JOIN Device b ON b.ID = a.ParentID
                            INNER JOIN Device c ON c.ID = a.DeviceID
                            UNION
                            SELECT id, DeviceName, DeviceType, SN, '', Token FROM Device
                            WHERE DeviceType = 0 AND Token = '{0}'
                            ),
                            Alarm AS 
                            (
                            SELECT ID, ICCardID, MerchID, f.DeviceID, r.DeviceName, r.DeviceType, r.SN, AlertType, HappenTime, EndTime, [State], LockGame, LockMember, AlertContent, r.HeadAddress, r.RouterToken FROM flw_game_alarm f
                            INNER JOIN RouterDevice r ON r.DeviceID = f.DeviceID
                            WHERE r.RouterToken LIKE '%{0}%' {1}
                            )
                            SELECT ID, ICCardID, MerchID, DeviceID, DeviceName, SN,
                            (CASE DeviceType WHEN 0 THEN '控制器' WHEN 1 THEN '提(售)币机' WHEN 2 THEN '存币机' WHEN 3 THEN '出票器' WHEN 4 THEN '卡头' END) AS DeviceType,
                            AlertType, CONVERT(varchar(100), HappenTime, 120) AS HappenTime, 
                            CONVERT(varchar(100), EndTime, 120) AS EndTime, [State], LockGame, LockMember, AlertContent, HeadAddress, RouterToken
                            FROM Alarm
                            ORDER BY HappenTime DESC
                            ";
            #endregion

            strSql = string.Format(strSql, routerToken, strWhere, (pageIndex - 1) * pageSize + 1, pageIndex * pageSize);

            DataTable table = XCCloudRS232BLL.ExecuterSqlToTable(strSql);
            return(table);
        }