/// <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, "网店管家同步发货", ""); }
/// <summary> /// 生成退货单 /// </summary> public void torder_save() { int order_id = RequestTool.RequestInt("order_id", 0); string opid = RequestTool.RequestSafeString("opid"); if (opid == "") { Response.Write("{\"msg\":\"" + Tag("未选择任何商品") + "\"}"); return; } int count = 0; Lebi_Order order = B_Lebi_Order.GetModel(order_id); if (order == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (order.User_id != CurrentUser.id) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } List <Lebi_Order_Product> ops = B_Lebi_Order_Product.GetList("id in (lbsql{" + opid + "}) and Order_id=" + order.id + "", ""); foreach (Lebi_Order_Product op in ops) { int rcount = RequestTool.RequestInt("product_" + op.id, 0); if (rcount > (op.Count_Received - op.Count_Return)) { Response.Write("{\"msg\":\"" + Tag("退货数量不能大于收货数量") + "\"}"); return; } if (rcount < 1) { Response.Write("{\"msg\":\"" + Tag("退货数量不能小于1") + "\"}"); return; } count = count + rcount; } if (count == 0) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } //CurrentUser.Count_Order = CurrentUser.Count_Order + 1; //B_Lebi_User.Update(CurrentUser); //foreach (Lebi_Order_Product op in ops) //{ // op.Count_Return = op.Count_Return + RequestTool.RequestInt("product_" + op.id, 0); // B_Lebi_Order_Product.Update(op); //} Lebi_Order model = new Lebi_Order(); model.Order_id = order.id; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.UserName; model.T_Name = order.T_Name; model.T_Address = order.T_Address; model.T_Area_id = order.T_Area_id; model.T_MobilePhone = order.T_MobilePhone; model.T_Phone = order.T_Phone; model.T_Postalcode = order.T_Postalcode; model.Weight = 0; model.Money_Product = 0; model.Type_id_OrderType = 212; model.Code = Shop.Bussiness.Order.CreateOrderCode(); model.Supplier_id = order.Supplier_id; model.Site_id = CurrentSite.id; model.Language_id = CurrentLanguage.id; B_Lebi_Order.Add(model); model.id = B_Lebi_Order.GetMaxId(); foreach (Lebi_Order_Product op in ops) { count = RequestTool.RequestInt("product_" + op.id, 0); op.Count_Return = op.Count_Return + count; B_Lebi_Order_Product.Update(op); op.Count = count; op.Count_Shipped = 0; op.Count_Received = 0; op.Order_Code = model.Code; op.Order_id = model.id; op.Money = op.Price * op.Count; B_Lebi_Order_Product.Add(op); model.Money_Product = model.Money_Product + (op.Price - op.Money_Give_one - op.Money_Card312_one) * count; model.Weight = model.Weight + op.Weight * count; model.Volume = model.Weight + op.Volume * count; model.Point = model.Point + op.Point_Give_one; } model.Money_Product = 0 - model.Money_Product; model.Money_Order = model.Money_Product; model.Money_Pay = model.Money_Product; model.Money_Give = 0 - model.Money_Order; model.Point = 0 - model.Point; B_Lebi_Order.Update(model); //处理留言 Lebi_Comment com = new Lebi_Comment(); com.Content = RequestTool.RequestSafeString("say"); com.Keyid = model.id; com.TableName = "Order"; com.User_id = CurrentUser.id; com.User_UserName = CurrentUser.UserName; B_Lebi_Comment.Add(com); Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id); Lebi_Order ordermodel = B_Lebi_Order.GetModel("Order_id=" + order_id + ""); //发送邮件 if (ShopCache.GetBaseConfig().MailSign.ToLower().Contains("dingdantijiao") || ShopCache.GetBaseConfig().AdminMailSign.ToLower().Contains("ordersubmit")) { Email.SendEmail_ordersubmit(user, ordermodel); } //发送短信 if (ShopCache.GetBaseConfig().SMS_sendmode.Contains("SMSTPL_ordersubmit") || ShopCache.GetBaseConfig().SMS_sendmode.Contains("SMSTPL_Admin_ordersubmit")) { SMS.SendSMS_ordersubmit(user, order); } Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// 发表商品评价 /// </summary> public void Comment_Write() { int id = RequestTool.RequestInt("id", 0); //int Product_id = 0; if (!Comment.CheckSafeWord(RequestTool.RequestSafeString("Content"))) { Response.Write("{\"msg\":\"" + Tag("内容中包含敏感词") + "\"}"); return; } Lebi_Order_Product Order_Product = B_Lebi_Order_Product.GetModel("User_id=" + CurrentUser.id + " and id = " + id); if (Order_Product == null) { Response.Write("{\"msg\":\"" + Tag("该商品已经下架") + "\"}"); return; } else { Lebi_Order order = B_Lebi_Order.GetModel(Order_Product.Order_id); if (order == null) { Response.Write("{\"msg\":\"" + Tag("无效订单") + "\"}"); return; } else { if (order.IsReceived == 0) { Response.Write("{\"msg\":\"" + Tag("已购买商品在已收货之后才可以发表评价") + "\"}"); return; } } Order_Product.IsCommented = 1; B_Lebi_Order_Product.Update(Order_Product); } Lebi_Product checkproduct = B_Lebi_Product.GetModel(Order_Product.Product_id); if (checkproduct == null) { Response.Write("{\"msg\":\"" + Tag("该商品已经下架") + "\"}"); return; } Lebi_Comment model = new Lebi_Comment(); model.TableName = "Product"; model.Keyid = Order_Product.Product_id; model.Admin_UserName = "******"; model.Admin_id = 0; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.NickName; model.Content = RequestTool.RequestSafeString("Content"); model.Star = RequestTool.RequestInt("Star", 5); model.Parentid = 0; model.Status = 280; model.Time_Add = System.DateTime.Now; model.Language_Code = CurrentLanguage.Code; model.Images = RequestTool.RequestSafeString("Images"); model.ImagesSmall = RequestTool.RequestSafeString("ImagesSmall"); model.Product_id = Order_Product.Product_id; model.IsRead = 1; model.Supplier_id = checkproduct.Supplier_id; B_Lebi_Comment.Add(model); //List<Lebi_Order_Product> modelproducts = B_Lebi_Order_Product.GetList("User_id=" + CurrentUser.id + " and id = " + id + "", ""); //foreach (Lebi_Order_Product modelproduct in modelproducts) //{ // modelproduct.IsCommented = 1; // B_Lebi_Order_Product.Update(modelproduct); //} Lebi_Product product = B_Lebi_Product.GetModel(Order_Product.Product_id); if (product != null) { EX_Product.UpdateStar(product); } model.id = B_Lebi_Comment.GetMaxId(); //处理图片 ImageHelper.LebiImagesUsed(model.Images, "comment", model.id); //发送邮件 Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id); Email.SendEmail_comment(user, model); //发送短信 SMS.SendSMS_comment(user, model); Response.Write("{\"msg\":\"OK\"}"); }