/// <summary> /// 获取用户所有打印设备的编码 /// </summary> /// <returns></returns> //public string GetAllDeviceNo() //{ // string ids = string.Empty; // List<M_Shop_PrintDevice> Devices = ListDevice(); // foreach (M_Shop_PrintDevice device in Devices) // { // ids += device.DeviceNo + ","; // } // if (!string.IsNullOrEmpty(ids)) { ids.TrimEnd(','); } // return ids; //} /// <summary> /// 打印自定义格式消息 /// </summary> /// <param name="Message">要打印的消息对象</param> /// <returns></returns> public string SendFreeMessage(M_Shop_PrintMessage msgMod, string DeviceNo) { B_Shop_PrintDevice printBll = new B_Shop_PrintDevice(); M_Shop_PrintDevice printMod = printBll.SelModeByDevice(DeviceNo); if (string.IsNullOrEmpty(DeviceNo)) { throw new Exception("设备编号不能为空"); } if (string.IsNullOrEmpty(msgMod.Detail)) { throw new Exception("内容不能为空"); } long reqTime = GetCurrentMilli(); string qstr = "memberCode=" + HttpUtility.UrlEncode(printMod.MemberCode, Encoding.UTF8); qstr += "&deviceNo=" + HttpUtility.UrlEncode(DeviceNo, Encoding.UTF8); qstr += "&msgNo=" + HttpUtility.UrlEncode(msgMod.MsgNo, Encoding.UTF8); qstr += "&msgDetail=" + HttpUtility.UrlEncode(msgMod.Detail, Encoding.UTF8); qstr += "&mode=" + HttpUtility.UrlEncode(msgMod.Mode.ToString(), Encoding.UTF8);; qstr += "&reqTime=" + reqTime; qstr += "&securityCode=" + StringHelper.MD5(printMod.MemberCode + msgMod.Detail + DeviceNo + msgMod.MsgNo + reqTime + printMod.SecurityKey); return(SendMessage(qstr)); }