/// <summary> /// 退货单发货 /// </summary> public void torder_shipping() { int order_id = RequestTool.RequestInt("order_id", 0); Lebi_Order model = B_Lebi_Order.GetModel("User_id=" + CurrentUser.id + " and id = " + order_id); if (model == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (model.IsVerified != 1) { Response.Write("{\"msg\":\"" + Tag("请等待客服人员确认") + "\"}"); return; } Lebi_Transport_Order torder = B_Lebi_Transport_Order.GetModel("Order_id=" + model.id + ""); if (torder != null) { torder.Code = RequestTool.RequestSafeString("Code"); torder.Transport_Name = RequestTool.RequestSafeString("Transport_Name"); B_Lebi_Transport_Order.Update(torder); } else { Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(model.Supplier_id); if (supplier == null) { supplier = new Lebi_Supplier(); } torder = new Lebi_Transport_Order(); torder.Code = RequestTool.RequestSafeString("Code"); torder.Order_id = model.id; torder.T_Address = model.T_Address; torder.T_Email = model.T_Email; torder.T_MobilePhone = model.T_MobilePhone; torder.T_Name = model.T_Name; torder.T_Phone = model.T_Phone; //torder.Transport_Code = model.Transport_Code; //torder.Transport_id = model.Transport_id; torder.Transport_Name = RequestTool.RequestSafeString("Transport_Name"); torder.User_id = model.User_id; torder.Supplier_id = supplier.id; torder.Supplier_SubName = supplier.SubName; List <TransportProduct> tps = new List <TransportProduct>(); TransportProduct tp; List <Lebi_Order_Product> pros = B_Lebi_Order_Product.GetList("Order_id=" + model.id + "", ""); foreach (Lebi_Order_Product pro in pros) { tp = new TransportProduct(); tp.Count = pro.Count; tp.ImageBig = pro.ImageBig; tp.ImageMedium = pro.ImageMedium; tp.ImageOriginal = pro.ImageOriginal; tp.ImageSmall = pro.ImageSmall; tp.Product_Number = pro.Product_Number; tp.Product_id = pro.Product_id; tp.Product_Name = pro.Product_Name; tps.Add(tp); pro.Count_Shipped = pro.Count; B_Lebi_Order_Product.Update(pro); } JavaScriptSerializer jss = new JavaScriptSerializer(); torder.Product = jss.Serialize(tps); torder.Type_id_TransportOrderStatus = 220;//默认状态:在途 B_Lebi_Transport_Order.Add(torder); model.IsShipped = 1; model.IsShipped_All = 1; B_Lebi_Order.Update(model); } Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// 订单发货通知-不更新库存 /// </summary> public void mSndGoods() { //OrderID 订单编号 //OrderNO 原始订单编号 //CustomerID 客户网名 //SndStyle 发货方式 //BillID 货运单号 //SndDate 发货时间 string OrderID = RequestTool.RequestString("OrderID"); string OrderNO = RequestTool.RequestString("OrderNO"); string CustomerID = RequestTool.RequestString("CustomerID"); string SndStyle = RequestTool.RequestString("SndStyle"); string BillID = RequestTool.RequestString("BillID"); string SndDate = RequestTool.RequestString("SndDate"); Lebi_Order model = B_Lebi_Order.GetModel("Code=lbsql{'" + OrderNO + "'}"); Lebi_Language_Code lang = Language.DefaultLanguage(); string res = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; if (model == null) { res += "<rsp><result>0</result><cause>无此单号</cause></rsp>"; Response.Write(res); return; } Lebi_Transport tran = B_Lebi_Transport.GetModel("[Name]=lbsql{'" + SndStyle + "'}"); if (tran == null) { tran = new Lebi_Transport(); } Lebi_Transport_Order torder = new Lebi_Transport_Order(); torder.Code = BillID; torder.Order_id = model.id; torder.T_Address = model.T_Address; torder.T_Email = model.T_Email; torder.T_MobilePhone = model.T_MobilePhone; torder.T_Name = model.T_Name; torder.T_Phone = model.T_Phone; torder.Transport_Code = tran == null ? model.Transport_Code : tran.Code; torder.Transport_id = tran == null ? model.Transport_id : tran.id; torder.Transport_Name = tran == null ? model.Transport_Name : tran.Name; torder.User_id = model.User_id; List <TransportProduct> tps = new List <TransportProduct>(); TransportProduct tp; List <Lebi_Order_Product> pros = B_Lebi_Order_Product.GetList("Order_id=" + model.id + "", ""); bool isfahuo_all = true; foreach (Lebi_Order_Product pro in pros) { tp = new TransportProduct(); tp.Count = pro.Count; tp.ImageBig = pro.ImageBig; tp.ImageMedium = pro.ImageMedium; tp.ImageOriginal = pro.ImageOriginal; tp.ImageSmall = pro.ImageSmall; tp.Product_Number = pro.Product_Number; tp.Product_id = pro.Product_id; tp.Product_Name = pro.Product_Name; tps.Add(tp); pro.Count_Shipped = pro.Count; B_Lebi_Order_Product.Update(pro); //更新库存 Lebi_Product product = B_Lebi_Product.GetModel(pro.Product_id); EX_Product.ProductStock_Change(product, (0 - pro.Count), 302, model); } JavaScriptSerializer jss = new JavaScriptSerializer(); torder.Product = jss.Serialize(tps); torder.Type_id_TransportOrderStatus = 220;//默认状态:在途 B_Lebi_Transport_Order.Add(torder); model.IsShipped = 1; model.IsShipped_All = isfahuo_all ? 1 : 0; model.Time_Shipped = System.DateTime.Now;; B_Lebi_Order.Update(model); Log.Add("订单发货-网站管家", "Order", model.id.ToString()); //发送邮件 if (ShopCache.GetBaseConfig().MailSign.ToLower().Contains("dingdanfahuo")) { Lebi_User user = B_Lebi_User.GetModel(model.User_id); Email.SendEmail_ordershipping(user, model, torder); } res += "<rsp><result>1</result></rsp>"; Response.Write(res); Log.Add("订单编号:" + OrderNO + "--" + res, "网店管家同步发货", ""); }