private void MyBind() { M_Shop_PrintMessage msgMod = msgBll.SelReturnModel(Mid); M_Shop_PrintDevice devMod = devBll.SelReturnModel(msgMod.DevID); ReqTime_L.Text = msgMod.ReqTime.ToString(); Alias_L.Text = devMod.Alias; ShopName_L.Text = devMod.ShopName; ReqStatus_L.Text = msgBll.DealReqStatus(msgMod.ReqStatus); Detail_T.Text = msgMod.Detail; }
protected void EGV_RowCommand(object sender, GridViewCommandEventArgs e) { int id = DataConverter.CLng(e.CommandArgument); switch (e.CommandName) { case "reprint": M_Shop_PrintMessage msgMod = msgBll.SelReturnModel(id); M_Shop_PrintDevice devMod = devBll.SelReturnModel(msgMod.DevID); msgMod.ReqStatus = printBll.SendFreeMessage(msgMod, devMod.DeviceNo); msgBll.Insert(msgMod); function.WriteSuccessMsg("已重新发送"); break; } MyBind(); }
/// <summary> /// /// </summary> /// <param name="ids">设备编码</param> /// <param name="message">要打印的消息</param> /// <returns></returns> public int Print(string ids, string message) { int successNum = 0; //SafeSC.CheckIDSEx(ids); string[] nos = ids.Split(','); foreach (string no in nos) { M_Shop_PrintMessage MsgMod = new M_Shop_PrintMessage(); MsgMod.Mode = 2; MsgMod.Detail = message; MsgMod.ReqTime = DateTime.Now; MsgMod.ReqStatus = SendFreeMessage(MsgMod, no); if (MsgMod.ReqStatus.Equals("0")) { successNum += 1; } //将MsgMod存入数据库 } return(successNum); }
/// <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)); }