protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request["CompID"] + "")) { CompID = (Request["CompID"] + "").ToInt(0); } logisticsbind(); if (!string.IsNullOrEmpty(Request["str"])) { var str = Request["str"]; string[] s = str.Split(':'); if (s.Length > 0) { this.txtLogistics.Value = s[0]; this.txtLogisticsNo.Value = s[1]; this.txtCarUser.Value = s[2]; this.txtCarNo.Value = s[3]; this.txtCar.Value = s[4]; } } else if (!string.IsNullOrEmpty(Request["KeyID"])) { KeyID = Common.DesDecrypt((Request["KeyID"] + ""), Common.EncryptKey).ToInt(0); List <Hi.Model.DIS_Logistics> logist = new Hi.BLL.DIS_Logistics().GetList("*", " Isnull(dr,0)=0 and OrderOutID=" + KeyID, ""); if (logist != null && logist.Count > 0) { this.txtLogistics.Value = logist[0].ComPName; this.txtLogisticsNo.Value = logist[0].LogisticsNo; this.txtCarUser.Value = logist[0].CarUser; this.txtCarNo.Value = logist[0].CarNo; this.txtCar.Value = logist[0].Car; } } } }
/// <summary> /// 删除物流 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { List <Hi.Model.DIS_Logistics> l = new Hi.BLL.DIS_Logistics().GetList("", "isnull(dr,0)=0 and orderId=" + ViewState["OrderId"].ToString(), ""); if (l.Count > 0) { Hi.Model.DIS_OrderOut model2 = new Hi.BLL.DIS_OrderOut().GetModel(Convert.ToInt32(KeyID)); SqlTransaction Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); try { foreach (Hi.Model.DIS_Logistics item in l) { Hi.Model.DIS_Logistics model = new Hi.BLL.DIS_Logistics().GetModel(item.Id); model.dr = 1; model.ts = DateTime.Now; model.modifyuser = this.UserID; //model2.ExpressNo = ""; model2.ts = DateTime.Now; model2.modifyuser = this.UserID; //model2.Express = ""; bool bol = new Hi.BLL.DIS_Logistics().Update(model, Tran); new Hi.BLL.DIS_OrderOut().Update(model2, Tran); } Tran.Commit(); this.ClientScript.RegisterStartupScript(this.GetType(), "msg", "<script> location.replace(location.href);</script>"); return; } catch (Exception ex) { if (Tran != null) { if (Tran.Connection != null) { Tran.Rollback(); } } JScript.ShowParentRefresh(this.Page, "删除物流失败"); JScript.AlertMsgParentRefresh(this.Page, "删除物流失败", 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); }
public static string Edit(string KeyID, string logistics, string logisticsNo, string carUser, string carNo, string car) { logistics = Common.NoHTML(logistics); logisticsNo = Common.NoHTML(logisticsNo); carUser = Common.NoHTML(carUser); carNo = Common.NoHTML(carNo); car = Common.NoHTML(car); Common.ResultMessage Msg = new Common.ResultMessage(); Hi.BLL.DIS_Logistics OrderBllLogistics = new Hi.BLL.DIS_Logistics(); KeyID = Common.DesDecrypt(KeyID, Common.EncryptKey); List <Hi.Model.DIS_Logistics> logist = new Hi.BLL.DIS_Logistics().GetList("*", " Isnull(dr,0)=0 and OrderOutID=" + KeyID, ""); //Hi.Model.DIS_Logistics OrderModelLogistics = logist; if (KeyID != null) { if (logist != null) { logist[0].ComPName = logistics; logist[0].LogisticsNo = logisticsNo; if (logistics != "" && logisticsNo != "") { string ApiKey = "4088ed72ed034b61b4b5adf05870aeba"; string typeCom = logistics; typeCom = Information.TypeCom(typeCom); string nu = logisticsNo; string apiurl = "http://www.aikuaidi.cn/rest/?key=" + ApiKey + "&order=" + nu + "&id=" + typeCom + "&ord=asc&show=json"; WebRequest request = WebRequest.Create(@apiurl); WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream(); Encoding encode = Encoding.UTF8; StreamReader reader = new StreamReader(stream, encode); string detail = reader.ReadToEnd(); Logistics logis = JsonConvert.DeserializeObject <Logistics>(detail); if (logis.errCode == "0") { List <Information> information = logis.data; logist[0].Context = JsonConvert.SerializeObject(information); } else { logist[0].Context = ""; } } logist[0].CarUser = carUser; logist[0].CarNo = carNo; logist[0].Car = car; logist[0].ts = DateTime.Now; if (OrderBllLogistics.Update(logist[0])) { Msg.result = true; } } } else { Msg.code = "未查找到数据"; } return(new JavaScriptSerializer().Serialize(Msg)); }
/// <summary> /// 应收应付账款订单列表 /// </summary> /// <param name="JSon"></param> /// <returns></returns> public DIS_Order.ResultOrderList GetDisAccountInfo(string JSon) { try { string strWhere = " and Ostate in (2,4,5) and PayState in (0,1)"; #region JSon取值 string userID = string.Empty; string disID = string.Empty; string criticalOrderID = string.Empty; //当前列表最临界点产品ID:初始-1 string getType = string.Empty; //方向 string rows = string.Empty; string sortType = string.Empty; string sort = string.Empty; string orderType = string.Empty;//单据类型 1:订单 2:账单 JsonData JInfo = JsonMapper.ToObject(JSon); if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "" && JInfo["CriticalOrderID"].ToString() != "" && JInfo["GetType"].ToString() != "" && JInfo["Rows"].ToString() != "" && JInfo["SortType"].ToString() != "" && JInfo["Sort"].ToString() != "" && JInfo["orderType"].ToString() != "") { userID = JInfo["UserID"].ToString(); disID = JInfo["ResellerID"].ToString(); strWhere += " and DisID='" + disID + "' and ISNULL(dr,0)=0"; criticalOrderID = JInfo["CriticalOrderID"].ToString(); getType = JInfo["GetType"].ToString(); rows = JInfo["Rows"].ToString(); sortType = JInfo["SortType"].ToString(); sort = JInfo["Sort"].ToString(); orderType = JInfo["orderType"].ToString(); } else { return(new DIS_Order.ResultOrderList() { Result = "F", Description = "参数异常" }); } if (orderType == "1")//订单 { strWhere += " and ISNULL(dr,0)=0 and OState != 0 and Otype!=9"; } else//账单 { strWhere += " and ISNULL(dr,0)=0 and OState != 0 and Otype=9"; } JsonData JMsg = JInfo["Search"]; if (JMsg.Count > 0) { if (JMsg["OrderID"].ToString() != "") { strWhere += " and ReceiptNo like '" + JMsg["OrderID"].ToString() + "%'"; } if (JMsg["BeginDate"].ToString() != "") { strWhere += " and CreateDate >= '" + Convert.ToDateTime(JMsg["BeginDate"].ToString()) + "'"; } if (JMsg["EndDate"].ToString() != "") { strWhere += " and CreateDate < " + Convert.ToDateTime(JInfo["EndDate"].ToString()).AddDays(1) + "'"; } //根据出库单编号 锁定 订单ID if (JMsg["ExpressNo"].ToString() != "") { //strWhere += " and ReceiptNo like '" + JMsg["ExpressNo"].ToString() + "%'"; List <Hi.Model.DIS_OrderOut> orderOut = new Hi.BLL.DIS_OrderOut().GetList("", " ExpressNo like '%" + JMsg["ExpressNo"].ToString() + "%'", ""); if (orderOut.Count == 0) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "参数异常" } } ; strWhere += " and ID in ( 0"; strWhere = orderOut.Aggregate(strWhere, (current, aout) => current + ("," + aout.OrderID)); strWhere += " )"; } } #endregion #region 模拟分页 string tabName = " [dbo].[DIS_Order]"; //表名 string strsql = string.Empty; //搜索sql sortType = "ID"; strsql = new Common().PageSqlString(criticalOrderID, "ID", tabName, sortType, sort, strWhere, getType, rows); if (strsql == "") { return new DIS_Order.ResultOrderList() { Result = "F", Description = "基础数据异常" } } ; #endregion #region 赋值 string SKUName = string.Empty; List <DIS_Order.Order> OrderList = new List <DIS_Order.Order>(); DataSet ds = SqlHelper.Query(SqlHelper.LocalSqlServer, strsql); if (ds.Tables.Count == 0) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "没有更多数据" } } ; DataTable orderList = ds.Tables[0]; if (orderList != null) { if (orderList.Rows.Count == 0) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "没有更多数据" } } ; foreach (DataRow row in orderList.Rows) { DIS_Order.Order order = new DIS_Order.Order(); Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(int.Parse(row["ID"].ToString())); order.OrderID = orderModel.ID.ToString(); order.CompID = orderModel.CompID.ToString(); Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(orderModel.CompID); if (comp == null || comp.IsEnabled == 0 || comp.dr == 1) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "企业异常" } } ; order.CompName = comp.CompName; order.State = Common.GetDisOrderType(orderModel.OState, orderModel.PayState, orderModel.Otype, orderModel.ReturnState); order.OState = orderModel.OState.ToString(); order.AddType = orderModel.AddType.ToString(); order.Otype = orderModel.Otype.ToString(); order.PayState = orderModel.PayState.ToString(); order.ReturnState = orderModel.ReturnState.ToString(); order.DisID = orderModel.DisID.ToString(); Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(orderModel.DisID); if (dis == null || dis.IsEnabled == 0 || dis.dr == 1) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "经销信息商异常" } } ; order.DisName = dis.DisName; order.DisUserID = orderModel.DisUserID.ToString(); Hi.Model.SYS_Users user = new Hi.BLL.SYS_Users().GetModel(int.Parse(userID)); if (user == null || user.IsEnabled == 0 || user.dr == 1) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "经销商用户信息异常" } } ; order.DisUserName = user.TrueName; order.AddrID = orderModel.AddrID.ToString(); order.ReceiptNo = orderModel.ReceiptNo; order.ArriveDate = orderModel.ArriveDate.ToString(); if (!string.IsNullOrEmpty(orderModel.AddrID.ToString())) { Hi.Model.BD_DisAddr addr = new Hi.BLL.BD_DisAddr().GetModel(orderModel.AddrID); if (addr != null) { order.Zip = addr.Zip; } } order.Address = orderModel.Address; order.Contact = orderModel.Principal; order.Phone = orderModel.Phone; order.TotalAmount = orderModel.TotalAmount.ToString("0.00"); order.AuditTotalAmount = orderModel.AuditAmount.ToString("0.00"); order.PayedAmount = orderModel.PayedAmount.ToString("0.00"); order.CreateUserID = orderModel.CreateUserID.ToString(); order.CreateDate = orderModel.CreateDate.ToString(); order.ReturnMoneyDate = orderModel.ReturnMoneyDate.ToString(); order.ReturnMoneyUser = orderModel.ReturnMoneyUser.ToString(); order.ReturnMoneyUserId = orderModel.ReturnMoneyUserId.ToString(); List <Hi.Model.DIS_OrderOut> outList = new Hi.BLL.DIS_OrderOut().GetList("", " OrderID='" + orderModel.ID + "' and CompID='" + orderModel.CompID + "' and DisID='" + orderModel.DisID + "' and ISNULL(dr,0)=0", ""); if (outList.Count != 0) { Hi.Model.DIS_OrderOut orderOut = new Hi.Model.DIS_OrderOut(); foreach (Hi.Model.DIS_OrderOut Out in outList) { orderOut = Out; } order.SendID = orderOut.ID.ToString(); order.SendDate = orderOut.SendDate.ToString(); //根据发货单取对应的物流信息 List <Hi.Model.DIS_Logistics> list_log = new Hi.BLL.DIS_Logistics().GetList("", "OrderOutID = " + orderOut.ID + " and isnull(dr,0) = 0", ""); //一个发货单只有一条物流信息,所以list_log里也只有一条数据 Hi.Model.DIS_Logistics model_log = list_log[0]; order.Express = Convert.ToString(model_log.ComPName); order.ExpressNo = Convert.ToString(model_log.LogisticsNo); //order.ExpressPerson = Convert.ToString(orderOut.ExpressPerson); //order.ExpressTel = Convert.ToString(orderOut.ExpressTel); //order.ExpressBao =Convert.ToString(orderOut.ExpressBao); order.PostFee = orderModel.PostFee.ToString("0.00"); order.ActionUser = Convert.ToString(orderOut.ActionUser); order.SendRemark = Convert.ToString(orderOut.Remark); order.IsAudit = Convert.ToString(orderOut.IsAudit); order.AuditUserID = Convert.ToString(orderOut.AuditUserID); order.AuditDate = Convert.ToString(orderOut.AuditDate); order.AuditRemark = orderOut.AuditRemark == null ? "" : orderOut.AuditRemark.ToString(); order.SignDate = Convert.ToString(orderOut.SignDate); order.IsSign = Convert.ToString(orderOut.IsSign); order.SignUserId = Convert.ToString(orderOut.SignUserId); order.SignUser = Convert.ToString(orderOut.SignUser); order.SignRemark = Convert.ToString(orderOut.SignRemark); } order.SendRemark = Convert.ToString(orderModel.Remark); //todo:不知道的排序 //order.SortIndex = orderModel.SortIndex.ToString(); order.IsDel = Convert.ToString(orderModel.dr); //明细 List <DIS_Order.OrderDetail> orderDetail = new List <DIS_Order.OrderDetail>(); List <Hi.Model.DIS_OrderDetail> detailList = new Hi.BLL.DIS_OrderDetail().GetList("", " OrderID='" + orderModel.ID + "' and DisID='" + orderModel.DisID + "' and ISNULL(dr,0)=0", ""); if (detailList == null) //|| detailList.Count==0 没有明细的单 PC可以新建 { return new DIS_Order.ResultOrderList() { Result = "F", Description = "订单明细异常" } } ; List <Hi.Model.BD_GoodsAttrs> list_attrs = null; foreach (Hi.Model.DIS_OrderDetail detail in detailList) { DIS_Order.OrderDetail ordetail = new DIS_Order.OrderDetail(); ordetail.SKUID = detail.GoodsinfoID.ToString(); //通过GoodsInfoID找到GoodsID Hi.Model.BD_GoodsInfo goodsInfo = new Hi.BLL.BD_GoodsInfo().GetModel(detail.GoodsinfoID); if (goodsInfo == null) { //if (goodsInfo == null || goodsInfo.IsEnabled == false || goodsInfo.dr == 1) return new DIS_Order.ResultOrderList() { Result = "F", Description = "SKU信息异常" } } ; ordetail.ProductID = goodsInfo.GoodsID.ToString(); //通过GoodsID找到GoodsName Hi.Model.BD_Goods goods = new Hi.BLL.BD_Goods().GetModel(goodsInfo.GoodsID); if (goods == null) { //if (goods == null || goods.IsEnabled == 0 || goods.dr == 1) return new DIS_Order.ResultOrderList() { Result = "F", Description = "商品异常" } } ; ordetail.ProductName = goods.GoodsName; SKUName += goods.GoodsName; list_attrs = new Hi.BLL.BD_GoodsAttrs().GetList("AttrsName", "GoodsID = " + goodsInfo.GoodsID + " and CompID = " + comp.ID + " and ISNULL(dr,0) = 0", ""); if (list_attrs != null && list_attrs.Count != 0) { foreach (Hi.Model.BD_GoodsAttrs attr in list_attrs) { SKUName += attr.AttrsName; } } ordetail.SKUName = SKUName; //todo:描述是什么 ordetail.ValueInfo = goodsInfo.ValueInfo; ordetail.SalePrice = detail.Price.ToString("0.00"); ordetail.TinkerPrice = detail.AuditAmount.ToString("0.00"); ordetail.Num = detail.GoodsNum.ToString("0.00"); ordetail.Remark = detail.Remark; List <DIS_Order.Pic> Pic = new List <DIS_Order.Pic>(); if (goods.Pic.ToString() != "" && goods.Pic.ToString() != "X") { DIS_Order.Pic pic = new DIS_Order.Pic(); pic.ProductID = goodsInfo.GoodsID.ToString(); pic.IsDeafult = "1"; pic.PicUrl = ConfigurationManager.AppSettings["ImgViewPath"].ToString().Trim() + "GoodsImg/" + goods.Pic; Pic.Add(pic); } ordetail.ProductPicUrlList = Pic; orderDetail.Add(ordetail); } order.OrderDetailList = orderDetail; OrderList.Add(order); } } else { return(new DIS_Order.ResultOrderList() { Result = "F", Description = "没有更多数据" }); } #endregion return(new DIS_Order.ResultOrderList() { Result = "T", Description = "获取成功", OrderList = OrderList }); } catch (Exception ex) { Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetDisAccountInfo:" + JSon); return(new DIS_Order.ResultOrderList() { Result = "F", Description = "参数异常" }); } }
/// <summary> /// 物流信息绑定 /// </summary> public void ExpressBind() { List <Hi.Model.DIS_Order> lll = new Hi.BLL.DIS_Order().GetList("", "isnull(dr,0)=0 and ostate>=5 and id=" + OrderId, ""); if (lll.Count == 0) { this.delLogistics.Visible = true; //显示 this.editLogistics.Visible = true; //显示 } else { this.li_Express.Visible = false; this.delLogistics.Visible = false; //隐藏 this.editLogistics.Visible = false; //隐藏 } List <Hi.Model.DIS_Logistics> l = new Hi.BLL.DIS_Logistics().GetList("", "isnull(dr,0)=0 and orderId=" + OrderId + " and orderoutId=" + KeyID, ""); if (l.Count == 0) { this.li_Express.Visible = true; this.delLogistics.Visible = false; this.editLogistics.Visible = false;//隐藏 this.divInfomation.InnerHtml = "暂无物流信息"; } else { this.li_Express.Visible = false; this.delLogistics.Visible = false; this.editLogistics.Visible = true;//隐藏 List <Hi.Model.DIS_Logistics> ll = new Hi.BLL.DIS_Logistics().GetList("", "isnull(dr,0)=0 and orderId=" + OrderId + " and orderOutId=" + KeyID, ""); if (ll.Count > 0) { foreach (Hi.Model.DIS_Logistics item in ll) { Hi.Model.DIS_Logistics model = new Hi.BLL.DIS_Logistics().GetModel(item.Id); this.lblCompName.InnerText = model.ComPName; this.lblLogisticsNo.InnerText = model.LogisticsNo; types = model.Type; if (model.Type == 1) { this.lblLogisticsInfo.InnerHtml = "以下跟踪信息由<a href=\"http://www.aikuaidi.cn/\" style=\"color: Blue\" target=\"_blank\">爱快递提供</a>,如有疑问请到物流公司官网查询</label>"; this.lblwul.Text = "编辑物流"; // string ApiKey = "ebb4e2088d483b00";////请把XXXXXX修改成您在快递100网站申请的APIKey string ApiKey = "4088ed72ed034b61b4b5adf05870aeba"; string typeCom = model.ComPName; typeCom = Information.TypeCom(typeCom); string nu = model.LogisticsNo; // string apiurl = "http://api.kuaidi100.com/api?id=" + ApiKey + "&com=" + typeCom + "&nu=" + nu + "&show=0&muti=1&order=asc"; string apiurl = "http://www.aikuaidi.cn/rest/?key=" + ApiKey + "&order=" + nu + "&id=" + typeCom + "&ord=asc&show=json"; WebRequest request = WebRequest.Create(@apiurl); WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream(); Encoding encode = Encoding.UTF8; StreamReader reader = new StreamReader(stream, encode); string detail = reader.ReadToEnd(); Logistics logistics = JsonConvert.DeserializeObject <Logistics>(detail); //if (logistics.message == "ok") //{ if (logistics.errCode == "0") { List <Information> information = logistics.data; this.rptLogistics.DataSource = information; this.rptLogistics.DataBind(); model.Context = JsonConvert.SerializeObject(information); new Hi.BLL.DIS_Logistics().Update(model); } // } } else { this.lblLogisticsInfo.InnerHtml = "请点击<a href=\"JavaScript:;\" style=\"color: Blue\" class=\"aLogisticsEdit\" >编辑物流信息</a>进行新增或者修改物流信息"; this.lblwul.Text = "编辑物流信息"; JavaScriptSerializer Serializer = new JavaScriptSerializer(); List <Information> objs = Serializer.Deserialize <List <Information> >(model.Context); this.rptLogistics.DataSource = objs; this.rptLogistics.DataBind(); } } } } }
public void databind() { if (!string.IsNullOrEmpty(Request["KeyID"])) { KeyID = Common.DesDecrypt((Request["KeyID"] + ""), Common.EncryptKey).ToInt(0); } StringBuilder str = new StringBuilder(); List <Hi.Model.DIS_Logistics> logisticsl = new Hi.BLL.DIS_Logistics().GetList("", " OrderOutID=" + KeyID + " and isnull(dr,0)=0", ""); if (logisticsl != null && logisticsl.Count > 0) { if (logisticsl[0].ComPName != "" && logisticsl[0].LogisticsNo != "") { string ApiKey = "4088ed72ed034b61b4b5adf05870aeba"; string typeCom = logisticsl[0].ComPName; typeCom = Information.TypeCom(typeCom); string nu = logisticsl[0].LogisticsNo; string apiurl = "http://www.aikuaidi.cn/rest/?key=" + ApiKey + "&order=" + nu + "&id=" + typeCom + "&ord=asc&show=json"; WebRequest request = WebRequest.Create(@apiurl); WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream(); Encoding encode = Encoding.UTF8; StreamReader reader = new StreamReader(stream, encode); string detail = reader.ReadToEnd(); Logistics logistics = JsonConvert.DeserializeObject <Logistics>(detail); if (logistics.errCode == "0") { List <Information> information = logistics.data; logisticsl[0].Context = JsonConvert.SerializeObject(information); new Hi.BLL.DIS_Logistics().Update(logisticsl[0]); } else { logisticsl[0].Context = ""; new Hi.BLL.DIS_Logistics().Update(logisticsl[0]); } if (!string.IsNullOrEmpty(logisticsl[0].Context)) { //DataTable dt = JsonToDataTable(logisticsl[0].Context); JavaScriptSerializer Serializer = new JavaScriptSerializer(); List <Information> objs = Serializer.Deserialize <List <Information> >(logisticsl[0].Context); if (objs != null && objs.Count > 0) { //排序 List <Information> obj = objs.OrderByDescending(a => a.time).ToList(); string ts = ""; foreach (Information item in obj) { if (ts != item.time.ToDateTime().ToString("yyyy-MM-dd")) { ts = item.time.ToDateTime().ToString("yyyy-MM-dd"); str.AppendFormat(" <li><i class=\"day\">{0}</i><i class=\"time\">{1}</i>{2}<i class=\"circle\"></i></li>", item.time.ToString().ToDateTime().ToString("yyyy-MM-dd"), item.time.ToString().ToDateTime().ToString("HH:mm:ss"), item.content == null ? "" : item.content); } else { str.AppendFormat(" <li><i class=\"time\">{0}</i>{1}<i class=\"circle\"></i></li>", item.time.ToString().ToDateTime().ToString("HH:mm:ss"), item.content == null ? "" : item.content); } } } } else { str.AppendFormat(" <li style=\"border-left:0px;\">{0}</li>", "还没有流物信息"); } } else { if (logisticsl[0].CarUser == "" && logisticsl[0].CarNo == "" && logisticsl[0].Car == "") { str.AppendFormat(" <li style=\"border-left:0px;\">{0}</li>", "还没有流物信息"); } else { str.AppendFormat("<li style=\"border-left:0px;\"><i class=\"time\">司机姓名</i>{0} </li>", logisticsl[0].CarUser); str.AppendFormat("<li style=\"border-left:0px;\"><i class=\"time\">司机手机</i>{0} </li>", logisticsl[0].CarNo); str.AppendFormat("<li style=\"border-left:0px;\"><i class=\"time\">车牌号</i>{0} </li>", logisticsl[0].Car); } } } else { str.AppendFormat(" <li style=\"border-left:0px;\">{0}</li>", "还没有流物信息"); } this.logislist.InnerHtml = str.ToString(); }