/// <summary> /// 发货、退单编号 /// </summary> /// <param name="strName">单据</param> /// <param name="OrderId">订单ID</param> /// <returns></returns> public static string GetCode(string strName, string OrderId) { string returnstr = ""; try { int sort = 0; returnstr += "-"; if (strName == "发货单") { List <Hi.Model.DIS_OrderOut> outl = new Hi.BLL.DIS_OrderOut().GetList("", " OrderID=" + OrderId + " and dr=0", ""); sort = outl.Count; returnstr += "F"; } else if (strName == "退单") { List <Hi.Model.DIS_OrderReturn> rl = new Hi.BLL.DIS_OrderReturn().GetList("", " OrderID=" + OrderId + " and dr=0", ""); sort = rl.Count; returnstr += "T"; } sort++; if (sort < 10) { returnstr += "0" + sort; } else { returnstr += sort; } } catch (Exception) {} return(returnstr); }
public string GetReceiptNo(string orderid) { Hi.Model.DIS_OrderReturn rorder = new Hi.BLL.DIS_OrderReturn().GetModel(orderid); if (rorder == null) { return(""); } return(rorder.ReceiptNo); }
public string GetROrder(string orderid) { Hi.Model.DIS_OrderReturn rorder = new Hi.BLL.DIS_OrderReturn().GetModel(orderid); if (rorder == null) { return(""); } string str = ""; switch (rorder.ReturnState) { case -1: str = "已拒绝"; break; case 0: str = "未提交"; break; case 1: str = "待审核"; break; case 2: str = "已退货"; break; case 4: str = "已退货款"; break; } return(str); }
//public void BindGoods() //{ // SelectGoods.Clear(this.CompID); // SelectGoods.OrderDetail(KeyID, DisID, this.CompID); // DataTable dt = Session["GoodsInfo"] as DataTable; // if (dt != null) // { // this.rpDtl.DataSource = dt; // this.rpDtl.DataBind(); // } // else // { // this.rpDtl.DataSource = ""; // this.rpDtl.DataBind(); // } // SelectGoods.Clear(DisID, this.CompID); //} //protected void A_AddOrderReturn(object sender, EventArgs e) //{ // if (order != null) // { // if (!string.IsNullOrEmpty(txtremark.Value.Trim())) // { // if (string.IsNullOrEmpty(Request.QueryString["type"])) // { // Hi.Model.DIS_OrderReturn orderreturn = new Hi.Model.DIS_OrderReturn(); // Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetDisID(user.UserName); // orderreturn.CompID = dis.CompID; // orderreturn.DisID = dis.ID; // orderreturn.OrderID = order.ID; // orderreturn.CreateDate = DateTime.Now; // orderreturn.CreateUserID = user.ID; // orderreturn.ReturnContent = txtremark.Value; // orderreturn.ReturnState = (int)Enums.AuditState.未提交; // orderreturn.ts = DateTime.Now; // orderreturn.modifyuser = user.ID; // int orderreturnid = OrderInfoType.ReturnOrderAdd(orderreturn, order.ID); // if (orderreturnid > 0) // { // Utils.AddSysBusinessLog(this.CompID, "Order", order.ID.ToString(), "申请退货", ""); // Response.Redirect("returnorderinfo.aspx?KeyID=" + order.ID); // } // else // { // JScript.AlertMsg(this, "退货失败,请稍候再试"); // } // } // else if (Request.QueryString["type"].ToString() == "update") // { // Hi.Model.DIS_OrderReturn orderreturn = new Hi.BLL.DIS_OrderReturn().GetModel(KeyID.ToString()); // Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetDisID(user.UserName); // orderreturn.CompID = dis.CompID; // orderreturn.DisID = dis.ID; // orderreturn.OrderID = order.ID; // orderreturn.CreateDate = DateTime.Now; // orderreturn.CreateUserID = user.ID; // orderreturn.ReturnContent = txtremark.Value; // orderreturn.ReturnState = (int)Enums.AuditState.未提交; // orderreturn.ts = DateTime.Now; // orderreturn.modifyuser = user.ID; // if (new Hi.BLL.DIS_OrderReturn().Update(orderreturn)) // { // Response.Redirect("returnorderinfo.aspx?KeyID=" + order.ID); // } // } // } // else // { // JScript.AlertMsg(this, "请注明退货原因"); // } // } //} //public int GetGoodsID(string goodsinfoid) //{ // Hi.Model.BD_GoodsInfo goodsinfo = new Hi.BLL.BD_GoodsInfo().GetModel(int.Parse(goodsinfoid)); // return goodsinfo.GoodsID; //} protected void A_AddOrderReturn(object sender, EventArgs e) { Hi.Model.DIS_Order order = OrderBll.GetModel(KeyID); if (order != null) { if (order.OState == (int)Enums.OrderState.已到货 && (order.ReturnState == (int)Enums.ReturnState.未退货 || order.ReturnState == (int)Enums.ReturnState.拒绝退货)) { if (string.IsNullOrEmpty(Request.QueryString["type"])) { Hi.Model.DIS_OrderReturn orderreturn = new Hi.Model.DIS_OrderReturn(); //Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(this.DisID); orderreturn.ReceiptNo = order.ReceiptNo + SysCode.GetCode("退单", order.ID.ToString()); orderreturn.CompID = this.CompID; orderreturn.DisID = this.DisID; orderreturn.OrderID = order.ID; orderreturn.ReturnDate = DateTime.Now; orderreturn.CreateDate = DateTime.Now; orderreturn.CreateUserID = this.UserID; orderreturn.ReturnContent = Common.NoHTML(txtremark.Value); orderreturn.ReturnState = (int)Enums.AuditState.提交; orderreturn.ts = DateTime.Now; orderreturn.modifyuser = this.UserID; int orderreturnid = OrderInfoType.ReturnOrderAdd(orderreturn, order.ID); if (orderreturnid > 0) { order.ts = DateTime.Now; order.ReturnState = (int)Enums.ReturnState.申请退货; order.ReturnMoneyDate = DateTime.Now; order.ReturnMoneyUser = this.UserName; order.ReturnMoneyUserId = this.UserID; if (new Hi.BLL.DIS_Order().Update(order)) { //Utils.AddSysBusinessLog(this.CompID, "Order", KeyID.ToString(), "订单修改", orderreturn.ReturnContent); ClientScript.RegisterStartupScript(GetType(), "msg", "<script>window.parent.ResurnOrder();</script>"); } } else { JScript.AlertMsgOne(this, "退货失败,请稍候再试!", JScript.IconOption.哭脸); } } else if (Request.QueryString["type"].ToString() == "update") { Hi.Model.DIS_OrderReturn orderreturn = new Hi.BLL.DIS_OrderReturn().GetModel(KeyID.ToString()); Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(DisID); orderreturn.CompID = dis.CompID; orderreturn.DisID = dis.ID; orderreturn.OrderID = order.ID; orderreturn.CreateDate = DateTime.Now; orderreturn.CreateUserID = this.UserID; orderreturn.ReturnContent = Common.NoHTML(txtremark.Value); orderreturn.ReturnState = (int)Enums.AuditState.未提交; orderreturn.ts = DateTime.Now; orderreturn.modifyuser = this.UserID; if (new Hi.BLL.DIS_OrderReturn().Update(orderreturn)) { Response.Redirect("returnorderinfo.aspx?KeyID=" + Common.DesEncrypt(order.ID.ToString(), Common.EncryptKey)); } } } else { JScript.AlertMsgOne(this, "订单处理中,不能申请退货!", JScript.IconOption.哭脸); } } }
/// <summary> /// 获取推送类型 /// </summary> /// <returns></returns> public static string GetWXType(string sendType, string userID, string orderID) { string res = string.Empty; decimal num = 0; string orderInfo = string.Empty; string orderOut = String.Empty; Hi.Model.DIS_OrderOut outModel = null; Hi.Model.DIS_OrderReturn returnModel = null; List <Hi.Model.DIS_Logistics> list_log = null; Hi.Model.DIS_Logistics log = null; Hi.BLL.DIS_Logistics bll_log = new Hi.BLL.DIS_Logistics(); Hi.Model.SYS_Users user = new Hi.BLL.SYS_Users().GetModel(int.Parse(userID)); if (user == null || string.IsNullOrEmpty(user.OpenID)) { return(""); } Hi.Model.DIS_Order order = new Hi.BLL.DIS_Order().GetModel(int.Parse(orderID)); if (order == null) { return(""); } List <Hi.Model.DIS_OrderDetail> orderList = new Hi.BLL.DIS_OrderDetail().GetList("", " orderID=" + int.Parse(orderID), ""); if (orderList == null || orderList.Count == 0) { return(""); } foreach (Hi.Model.DIS_OrderDetail detail in orderList) { Hi.Model.BD_GoodsInfo goodsInfo = new Hi.BLL.BD_GoodsInfo().GetModel(detail.GoodsinfoID); if (goodsInfo != null) { Hi.Model.BD_Goods goods = new Hi.BLL.BD_Goods().GetModel(goodsInfo.GoodsID); orderInfo += " " + goods.GoodsName + "*" + detail.GoodsNum; } num += detail.GoodsNum; } Hi.Model.BD_DisAddr addr = new Hi.BLL.BD_DisAddr().GetModel(order.AddrID); if (addr != null) { if (addr.Phone != "") { orderOut += addr.Principal + ":" + addr.Phone + " "; } else { orderOut += addr.Principal + ":" + addr.Tel + " "; } } List <Hi.Model.DIS_OrderOut> orderout = new Hi.BLL.DIS_OrderOut().GetList("", " orderID=" + int.Parse(orderID), ""); if (orderout != null && orderout.Count != 0) { foreach (Hi.Model.DIS_OrderOut detail in orderout) { list_log = bll_log.GetList("", "OrderOutID = " + detail.ID + " and isnull(dr,0) == 0", ""); if (list_log != null && list_log.Count >= 0) { log = list_log[0]; //orderOut += log.ExpressPerson + ":" + log.ExpressTel + " "; } outModel = detail; } } List <Hi.Model.DIS_OrderReturn> returnlist = new Hi.BLL.DIS_OrderReturn().GetList("", " orderID=" + int.Parse(orderID), ""); if (returnlist != null && returnlist.Count != 0) { foreach (Hi.Model.DIS_OrderReturn detail in returnlist) { returnModel = detail; } } //string sqlstr = string.Format("select * from dis_order where receiptno like ('%{0}%') and dr=0", ReceiptNo); switch (sendType) { case "1": //下单通知 StringBuilder strSql = new StringBuilder(); strSql.Append("{\"type\":\"ORDERADD\",\"openid\":\""); strSql.Append(user.OpenID); strSql.Append("\",\"msg\":[{\"title\":\"尊敬的"); strSql.Append(user.TrueName); strSql.Append(",您好\",\"orderno\":\""); strSql.Append(order.ReceiptNo); strSql.Append("\",\"orderamount\":\""); strSql.Append(order.TotalAmount.ToString("N")); strSql.Append("元\",\"extra1\":\"状态:待付款\",\"extra2\":\"数量:"); strSql.Append(num.ToString("0.00")); strSql.Append("\",\"remark\":\""); strSql.Append(order.Remark); strSql.Append("\"}]}"); res = strSql.ToString(); break; case "2": //订单支付通知 StringBuilder str = new StringBuilder(); str.Append("{\"type\":\"ORDERPAY\",\"openid\":\""); str.Append(user.OpenID); str.Append("\",\"msg\":[{\"title\":\"尊敬的"); str.Append(user.TrueName); str.Append(",您好\",\"orderpay\":\""); str.Append(order.TotalAmount.ToString("N")); str.Append("元\",\"orderinfo\":\""); str.Append(orderInfo); str.Append("\",\"receiveinfo\":\""); str.Append(orderOut); str.Append("\",\"orderno\":\""); str.Append(order.ReceiptNo); str.Append("\",\"remark\":\""); str.Append("\"}]}"); res = str.ToString(); break; case "3": //42、签收提醒 StringBuilder SIGN = new StringBuilder(); SIGN.Append("{\"type\":\"SIGN\",\"openid\":\""); SIGN.Append(user.OpenID); SIGN.Append("\",\"msg\":[{\"title\":\"您好,您的订单"); SIGN.Append(order.ReceiptNo); SIGN.Append("已签收\",\"orderno\":\""); SIGN.Append(order.ReceiptNo); SIGN.Append("\",\"qianshouren\":\""); SIGN.Append(outModel.SignUser); SIGN.Append("\",\"qianshoushijian\":\""); SIGN.Append(outModel.SignDate); SIGN.Append("\",\"remark\":\""); SIGN.Append(order.Remark); SIGN.Append("\"}]}"); res = SIGN.ToString(); break; case "4": //退货申请 StringBuilder RETGOODS = new StringBuilder(); RETGOODS.Append("{\"type\":\"RETGOODS\",\"openid\":\""); RETGOODS.Append(user.OpenID); RETGOODS.Append("\",\"msg\":[{\"title\":\"买家申请退货"); RETGOODS.Append("\",\"orderno\":\""); RETGOODS.Append(order.ReceiptNo); RETGOODS.Append("\",\"shangpinxinxi\":\""); RETGOODS.Append(orderInfo); RETGOODS.Append("\",\"orderjine\":\""); RETGOODS.Append(order.TotalAmount.ToString("N")); RETGOODS.Append("元\",\"remark\":\""); RETGOODS.Append(order.Remark); RETGOODS.Append("\"}]}"); res = RETGOODS.ToString(); break; case "41": //代人下单通知 StringBuilder ORDERADD = new StringBuilder(); ORDERADD.Append("{\"type\":\"ORDERADD\",\"openid\":\""); ORDERADD.Append(user.OpenID); ORDERADD.Append("\",\"msg\":[{\"title\":\"尊敬的"); ORDERADD.Append(user.TrueName); ORDERADD.Append(",您好\",\"orderno\":\""); ORDERADD.Append(order.ReceiptNo); ORDERADD.Append("\",\"orderamount\":\""); ORDERADD.Append(order.TotalAmount.ToString("N")); ORDERADD.Append("元\",\"extra1\":\"状态:待付款\",\"extra2\":\"数量:"); ORDERADD.Append(num.ToString()); ORDERADD.Append("\",\"remark\":\""); ORDERADD.Append(order.Remark); ORDERADD.Append("\"}]}"); res = ORDERADD.ToString(); break; case "42": //订单审批 StringBuilder sql = new StringBuilder(); sql.Append("{\"type\":\"ORDERSTATUS\",\"openid\":\""); sql.Append(user.OpenID); sql.Append("\",\"msg\":[{\"title\":\"尊敬的"); sql.Append(user.TrueName); sql.Append(",您好\",\"orderno\":\""); sql.Append(order.ReceiptNo); if (order.OState.ToString() == "-1") { sql.Append("\",\"orderstatus\":\"订单退回\",\"remark\":\""); } else { sql.Append("\",\"orderstatus\":\"待发货、审批通过\",\"remark\":\""); } sql.Append(order.Remark); sql.Append("\"}]}"); res = sql.ToString(); break; case "43": //订单发货 StringBuilder sqlSend = new StringBuilder(); sqlSend.Append("{\"type\":\"ORDERSEND\",\"openid\":\""); sqlSend.Append(user.OpenID); sqlSend.Append("\",\"msg\":[{\"title\":\"尊敬的"); sqlSend.Append(user.TrueName); sqlSend.Append(",您好\",\"orderno\":\""); sqlSend.Append(order.ReceiptNo); sqlSend.Append("\",\"wuliuname\":\""); sqlSend.Append(log.ComPName); sqlSend.Append("\",\"wuliucode\":\""); sqlSend.Append(log.LogisticsNo); sqlSend.Append("\",\"remark\":\""); sqlSend.Append(outModel.Remark); sqlSend.Append("\"}]}"); res = sqlSend.ToString(); break; case "44": //6、退货审核 StringBuilder RETAUDIT = new StringBuilder(); RETAUDIT.Append("{\"type\":\"RETAUDIT\",\"openid\":\""); RETAUDIT.Append(user.OpenID); RETAUDIT.Append("\",\"msg\":[{\"title\":\"您好,您的退货审核"); if (returnModel.ReturnState == -1) { RETAUDIT.Append("已退回"); } else { RETAUDIT.Append("已审核"); } RETAUDIT.Append("\",\"shenhejieguo\":\""); if (returnModel.ReturnState == -1) { RETAUDIT.Append("已退回"); } else { RETAUDIT.Append("已审核"); } RETAUDIT.Append("\",\"shangpinxinxi\":\""); RETAUDIT.Append(orderInfo); RETAUDIT.Append("\",\"tuihuojine\":\""); RETAUDIT.Append(order.PayedAmount.ToString("N")); RETAUDIT.Append("元\",\"shenheshuoming\":\""); RETAUDIT.Append(returnModel.AuditRemark); RETAUDIT.Append("\",\"shenheshijian\":\""); RETAUDIT.Append(returnModel.AuditDate); RETAUDIT.Append("\",\"orderno\":\""); RETAUDIT.Append(order.ReceiptNo); RETAUDIT.Append("\",\"remark\":\""); RETAUDIT.Append("\"}]}"); res = RETAUDIT.ToString(); break; case "45": //5、退款 StringBuilder REFUND = new StringBuilder(); REFUND.Append("{\"type\":\"REFUND\",\"openid\":\""); REFUND.Append(user.OpenID); REFUND.Append("\",\"msg\":[{\"title\":\"您好,您的订单"); REFUND.Append(order.ReceiptNo); REFUND.Append(",已退款。\",\"reason\":\""); REFUND.Append(returnModel.ReturnContent); REFUND.Append("\",\"refund\":\""); REFUND.Append(order.PayedAmount.ToString("N")); REFUND.Append("元\",\"orderno\":\""); REFUND.Append(order.ReceiptNo); REFUND.Append("\",\"remark\":\""); REFUND.Append("\"}]}"); res = REFUND.ToString(); break; } return(res); }