public string GetRecvData(DateTime printDate) { StringBuilder sb = new StringBuilder(); //sb.Append("=============================================\r\n"); sb.AppendFormat("{0:yyyy-MM-dd HH:mm:ss.fff} 收到数据\r\n", printDate); sb.Append(PubLib.BytesToString(RecvData.recvData) + Environment.NewLine); sb.AppendFormat("指令类别:{0}\r\n", RecvData.commandType); return(sb.ToString()); }
public string GetSendData() { StringBuilder sb = new StringBuilder(); //sb.Append("=============================================\r\n"); sb.AppendFormat("{0:yyyy-MM-dd HH:mm:ss.fff} 发送数据\r\n", SendDate); sb.Append(PubLib.BytesToString(SendData) + Environment.NewLine); sb.AppendFormat("指令类别:{0}\r\n", RecvData.commandType); sb.AppendFormat("路由器地址:{0}\r\n", RecvData.routeAddress); return(sb.ToString()); }
public string GetSendData() { StringBuilder sb = new StringBuilder(); sb = new StringBuilder(); sb.Append("=============================================\r\n"); sb.AppendFormat("{0:yyyy-MM-dd HH:mm:ss.fff} 发送数据\r\n", SendDataTime); sb.Append(PubLib.BytesToString(SendData) + Environment.NewLine); sb.AppendFormat("机头地址:{0}\r\n", 机头地址); sb.AppendFormat("长地址:{0}\r\n", MCUID); return(sb.ToString()); }
public string GetSendData() { StringBuilder sb = new StringBuilder(); if (SendData != null) { //sb.Append("=============================================\r\n"); sb.AppendFormat("{0:yyyy-MM-dd HH:mm:ss.fff} 发送数据\r\n", SendDataTime); sb.Append(PubLib.BytesToString(SendData) + Environment.NewLine); sb.AppendFormat("指令类别:{0}\r\n", CommandType.机头卡片报警指令应答); sb.AppendFormat("机头地址:{0}\r\n", 机头地址); sb.AppendFormat("流水号:{0}\r\n", 流水号); } return(sb.ToString()); }
public string GetRecvData(DateTime printDate) { StringBuilder sb = new StringBuilder(); //sb.Append("=============================================\r\n"); sb.AppendFormat("{0:yyyy-MM-dd HH:mm:ss.fff} 收到数据\r\n", DateTime.Now); sb.AppendFormat("{0}\r\n", PubLib.BytesToString(RecvData.recvData)); sb.AppendFormat("指令类别:{0}\r\n", RecvData.commandType); sb.AppendFormat("IC卡号码:{0}\r\n", IC卡号码); sb.AppendFormat("卡片类型:{0}\r\n", 卡片类型); sb.AppendFormat("报警类别:{0}\r\n", AlertType); sb.AppendFormat("处理结果:{0}\r\n", 处理结果 == 1 ? "是" : "否"); sb.AppendFormat("流水号:{0}\r\n", 流水号); return(sb.ToString()); }
public string GetRecvData(DateTime printDate) { StringBuilder sb = new StringBuilder(); //sb.Append("=============================================\r\n"); sb.AppendFormat("{0:yyyy-MM-dd HH:mm:ss.fff} 收到数据\r\n", DateTime.Now); sb.AppendFormat("{0}\r\n", PubLib.BytesToString(RecvData.recvData)); sb.AppendFormat("指令类别:{0}\r\n", RecvData.commandType); sb.AppendFormat("IC卡号码:{0}\r\n", IC卡号码); sb.AppendFormat("动态密码:{0}\r\n", 动态密码); sb.AppendFormat("控制类型:{0}\r\n", 控制类型.ToDescription()); sb.AppendFormat("币数:{0}\r\n", 币数); sb.AppendFormat("流水号:{0}\r\n", 流水号); sb.AppendFormat("机头地址:{0}\r\n", 机头地址); return(sb.ToString()); }
public string GetSendData() { StringBuilder sb = new StringBuilder(); sb = new StringBuilder(); if (!IsDevice) { Ask.Ask终端参数申请 AskData = 应答数据 as Ask.Ask终端参数申请; sb.Append("=============================================\r\n"); sb.AppendFormat("{0:yyyy-MM-dd HH:mm:ss.fff} 发送数据\r\n", SendDataTime); sb.Append(PubLib.BytesToString(SendData) + Environment.NewLine); sb.Append("当前是机头在获取参数\r\n"); sb.AppendFormat("机头地址:{0}\r\n", PubLib.Hex2String(AskData.机头地址)); sb.AppendFormat("单次退币限额:{0}\r\n", AskData.单次退币限额); sb.AppendFormat("退币时接收游戏机数币数:{0}\r\n", AskData.退币时给游戏机脉冲数比例因子); sb.AppendFormat("退币时卡上增加币数:{0}\r\n", AskData.退币时卡上增加币数比例因子); sb.AppendFormat("本店卡校验密码:{0}\r\n", AskData.本店卡校验密码); sb.AppendFormat("开关1:{0}\r\n", PubLib.Hex2BitString(AskData.开关1)); sb.AppendFormat("开关2:{0}\r\n", PubLib.Hex2BitString(AskData.开关2)); sb.AppendFormat("首次投币启动间隔:{0}\r\n", AskData.首次投币启动间隔); sb.AppendFormat("退币速度:{0}\r\n", AskData.退币速度); sb.AppendFormat("退币脉宽:{0}\r\n", AskData.退币脉宽); sb.AppendFormat("投币速度:{0}\r\n", AskData.投币速度); sb.AppendFormat("投币脉宽:{0}\r\n", AskData.投币脉宽); sb.AppendFormat("第二路上分线上分脉宽:{0}\r\n", AskData.第二路上分线上分脉宽); sb.AppendFormat("第二路上分线上分启动间隔:{0}\r\n", AskData.第二路上分线首次上分启动间隔); sb.AppendFormat("第二路上分线上分速度:{0}\r\n", AskData.第二路上分线上分速度); } else { Ask.Ask设备参数申请 AskData = 应答数据 as Ask.Ask设备参数申请; sb.Append("=============================================\r\n"); sb.AppendFormat("{0:yyyy-MM-dd HH:mm:ss.fff} 发送数据\r\n", SendDataTime); sb.Append(PubLib.BytesToString(SendData) + Environment.NewLine); sb.Append("当前是存币机在获取参数\r\n"); sb.AppendFormat("机头地址:{0}\r\n", PubLib.Hex2String(AskData.机头地址)); sb.AppendFormat("马达配置:{0}\r\n", PubLib.Hex2BitString(AskData.马达配置)); sb.AppendFormat("马达1比例:{0}\r\n", AskData.马达1比例); sb.AppendFormat("马达2比例:{0}\r\n", AskData.马达2比例); sb.AppendFormat("存币箱最大存币数:{0}\r\n", AskData.存币箱最大存币数); } return(sb.ToString()); }
public Recv卡头进出币数据(FrameData f, DateTime RecvDateTime) { try { RecvData = f; if (f.commandData.Length >= 15) { 机头地址 = PubLib.Hex2String(f.commandData[0]); for (int i = 0; i < 8; i++) { if (f.commandData[i + 1] < 0x30 || f.commandData[i + 1] > 0x39) { f.commandData[i + 1] = 32; } } IC卡号码 = Encoding.ASCII.GetString(f.commandData, 1, 8); IC卡号码 = IC卡号码.Trim(); 动态密码 = f.commandData[9]; 控制类型 = (CoinType)f.commandData[10]; 币数 = (int)BitConverter.ToUInt16(f.commandData, 11); 测试数据 = BitConverter.ToUInt16(f.commandData, 13); 流水号 = BitConverter.ToUInt16(f.commandData, 15); 高速投币标志 = (测试数据 / 256 == 1); 投币目标地址 = PubLib.Hex2String((byte)(测试数据 % 256)); Info.HeadInfo.机头绑定信息 bind = new Info.HeadInfo.机头绑定信息(); bind.控制器令牌 = f.Code; bind.短地址 = 机头地址; Info.HeadInfo.机头信息 head = Info.HeadInfo.GetHeadInfoByShort(bind); if (head != null) { if (IC卡号码 == "") IC卡号码 = head.常规.当前卡片号; if (IC卡号码 == "") IC卡号码 = "0"; if (控制类型 == CoinType.实物投币) IC卡号码 = "0"; //实物投币过滤卡号,有可能是卡头没有清缓存导致 head.临时错误计数 = 测试数据; head.状态.出币机或存币机正在数币 = false; object obj = null; int res = UDPServerHelper.CheckRepeat(f.Code, 机头地址, IC卡号码, CommandType.IC卡模式投币数据, ref obj, 流水号); if (res == 0) { //if (高速投币标志) // Ask.Ask远程投币上分数据 ask = new Ask.Ask远程投币上分数据(投币目标地址, 币数, "刷卡", 流水号); string msg = ""; 应答数据 = new Ask.Ask卡头进出币数据应答(head, IC卡号码, 币数, 控制类型, 动态密码, (UInt16)流水号, f, 高速投币标志, 投币目标地址, ref msg); if (f.commandType == CommandType.IC卡模式投币数据) { UDPServerHelper.InsertRepeat(f.routeAddress, 机头地址, IC卡号码, CommandType.IC卡模式投币数据, CommandType.IC卡模式投币数据应答, 应答数据, 流水号, RecvDateTime); if (应答数据.脉冲数 == 0) { LogHelper.WriteLog("IC卡进出币数据有误\r\n" + msg, f.commandData); } } else UDPServerHelper.InsertRepeat(f.routeAddress, 机头地址, IC卡号码, CommandType.IC卡模式退币数据, CommandType.IC卡模式退币数据应答, 应答数据, 流水号, RecvDateTime); } else if (res == 1) { 应答数据 = (Ask.Ask卡头进出币数据应答)obj; PubLib.当前IC卡进出币指令重复数++; } else { //重复性检查错误 return; } byte[] dataBuf = PubLib.GetBytesByObject(应答数据); if (f.commandType == CommandType.IC卡模式投币数据) SendData = PubLib.GetFrameDataBytes(f, dataBuf, CommandType.IC卡模式投币数据应答); else { SendData = PubLib.GetFrameDataBytes(f, dataBuf, CommandType.IC卡模式退币数据应答); LogHelper.WriteTBLog(PubLib.BytesToString(f.recvData)); } } } } catch { //LogHelper.WriteLog("IC卡进出币数据有误", f.commandData); throw; } }