public JsonResult Approve(T_InterceptLogistics model)//审批 { try { var mod = db.T_InterceptLogistics.Find(model.ID); if (model.FinanceApproveStatus == 1 || model.FinanceApproveStatus == 2) { mod.FinanceApproveStatus = model.FinanceApproveStatus; mod.FinanceApproveTime = DateTime.Now; mod.FinanceReason = model.FinanceReason; mod.FinanceApproveUser = Convert.ToInt32(Server.UrlDecode(Request.Cookies["UserId"].Value)); } if (model.ExpressApproveStatus == 1 || model.ExpressApproveStatus == 2) { mod.ExpressApproveStatus = model.ExpressApproveStatus; mod.ExpressApproveTime = DateTime.Now; mod.ExpressReason = model.FinanceReason; mod.ExpressApproveUser = Convert.ToInt32(Server.UrlDecode(Request.Cookies["UserId"].Value)); } if (model.WarehouseApproveStatus == 1 || model.WarehouseApproveStatus == 2) { mod.WarehouseApproveStatus = model.WarehouseApproveStatus; mod.WarehouseApproveTime = DateTime.Now; mod.WarehouseReason = model.WarehouseReason; mod.WarehouseApproveUser = Convert.ToInt32(Server.UrlDecode(Request.Cookies["UserId"].Value)); } db.SaveChanges(); return(Json(new { State = "Success", Msg = "审批成功" })); } catch (Exception ex) { return(Json(new { State = "Fail", Msg = "审批失败," + ex.Message })); } }
public JsonResult InterceptLogisticsSave(T_InterceptLogistics model)//创建物流订单拦截 { try { var Order = db.T_InterceptLogistics.SingleOrDefault(a => a.OrderNumber == model.OrderNumber && a.Del == 0); if (Order == null) { model.FinanceApproveStatus = -1; model.ExpressApproveStatus = -1; model.WarehouseApproveStatus = -1; model.Creator = Convert.ToInt32(Server.UrlDecode(Request.Cookies["UserId"].Value)); model.CreateTime = DateTime.Now; db.T_InterceptLogistics.Add(model); db.SaveChanges(); return(Json(new { State = "Success", Msg = "创建成功" })); } else { return(Json(new { State = "Fail", Msg = "创建失败,该订单拦截审批已存在!" })); } } catch (Exception ex) { return(Json(new { State = "Fail", Msg = "创建失败," + ex.Message })); } }
/// <summary> /// 获取旺店通 /// </summary> /// <param name="code"></param> /// <returns></returns> public JsonResult QuyerOrderBYcode(string code) { Dictionary <string, string> dic = new Dictionary <string, string>(); if (code == "" || code == null) { return(Json("", JsonRequestBehavior.AllowGet)); } App_Code.GY gy = new App_Code.GY(); string repeat = ""; List <T_InterceptLogistics> modelList = db.T_InterceptLogistics.Where(a => a.OrderNumber.Equals(code.Trim()) && a.Del == 0).ToList(); if (modelList.Count > 0) { repeat += "物流拦截记录已存在此订单号"; } #region ////查询旺店通 //List<T_Retreat> modelList = db.T_Retreat.Where(a => a.Retreat_OrderNumber.Equals(code.Trim()) && a.Isdelete == "0").ToList(); //if (modelList.Count > 0) //{ // repeat += "退货退款记录重复,"; //} ////查是否有返现记录 //List<T_CashBack> cash = db.T_CashBack.Where(a => a.OrderNum.Equals(code.Trim()) && a.For_Delete == 0 && a.Status != 2).ToList(); //if (cash.Count > 0) //{ // repeat += "有返现记录重复,"; //} //List<T_Reissue> Reissue = db.T_Reissue.Where(a => a.OrderCode.Equals(code.Trim()) && a.IsDelete == 0 && a.Status != 2).ToList(); //if (Reissue.Count > 0) //{ // repeat += "有补发记录重复,"; //} //List<T_ExchangeCenter> ExchangeCenter = db.T_ExchangeCenter.Where(a => a.OrderCode.Equals(code.Trim()) && a.IsDelete == 0 && a.Status != 2).ToList(); //if (ExchangeCenter.Count > 0) //{ // repeat += "有换货记录重复,"; //} //List<T_Intercept> Intercept = db.T_Intercept.Where(a => a.OrderNumber.Equals(code.Trim()) && a.IsDelete == 0 && a.Status != 2).ToList(); //if (Intercept.Count > 0) //{ // repeat += "拦截模块有记录,"; //} #endregion dic.Clear(); dic.Add("src_tid", code); //dic.Add("trade_no", code); dic.Add("sid", "hhs2"); dic.Add("appkey", "hhs2-ot"); dic.Add("timestamp", GetTimeStamp()); string cmd = CreateParam(dic, true); string ret = gy.DoPostnew("http://api.wangdian.cn/openapi2/trade_query.php", cmd, Encoding.UTF8); string ssx = Regex.Unescape(ret); JsonData jsonData = null; jsonData = JsonMapper.ToObject(ret); string iscode = jsonData["total_count"].ToString(); if (iscode != "0") { JsonData jsontrades = jsonData["trades"]; if (jsontrades.Count != 0) { JsonData trades = jsontrades[0]; //店铺名称 string shop_name = trades["shop_name"].ToString(); //仓库编码 string warehouse_no = trades["warehouse_no"].ToString(); //原始订单编号 string src_tids = trades["src_tids"].ToString(); //下单时间 string trade_time = trades["trade_time"].ToString(); //付款时间 string pay_time = trades["pay_time"].ToString(); //旺旺号 string customer_name = trades["buyer_nick"].ToString(); //订单状态 string trade_status = trades["trade_status"].ToString(); //收件人姓名 string receiver_name = trades["receiver_name"].ToString(); //省 string receiver_province = trades["receiver_province"].ToString(); //市 string receiver_city = trades["receiver_city"].ToString(); //区 string receiver_district = trades["receiver_district"].ToString(); //详细地址 string receiver_address = trades["receiver_address"].ToString(); //电话号码 string receiver_mobile = trades["receiver_mobile"].ToString(); //邮政编码 string receiver_zip = trades["receiver_zip"].ToString(); //省市县 string receiver_area = trades["receiver_area"].ToString(); //快递公司编号 string logistics_code = trades["logistics_code"].ToString(); //快递公司名称 string logistics_name = trades["logistics_name"].ToString(); //快递单号 string logistics_no = trades["logistics_no"].ToString(); //买家留言 string buyer_message = trades["buyer_message"].ToString(); //客服备注 string cs_remark = trades["cs_remark"].ToString(); //实付金额 // string paid = trades["paid"].ToString(); //商品详情 List <T_RetreatDetails> DetailsList = new List <T_RetreatDetails>(); double paid = 0.00; for (int c = 0; c < jsontrades.Count; c++) { paid += double.Parse(jsontrades[c]["paid"].ToString()); //JsonData goods_list = jsontrades[c]["goods_list"]; //for (int i = 0; i < goods_list.Count; i++) //{ // T_RetreatDetails DetailsModel = new T_RetreatDetails(); // string ss = goods_list[i]["goods_no"] == null ? "" : goods_list[i]["goods_no"].ToString(); // DetailsModel.item_code = ss; // DetailsModel.item_name = goods_list[i]["goods_name"] == null ? "" : goods_list[i]["goods_name"].ToString(); // // double ssds=double.Parse(goods_list[i]["paid"].ToString()) / double.Parse(goods_list[i]["actual_num"].ToString()); // decimal dec = Convert.ToDecimal(Math.Round(double.Parse(goods_list[i]["share_amount"].ToString()), 2)); // DetailsModel.amount = (double)dec;//分摊邮费 // int qyt = Convert.ToInt32(Convert.ToDecimal(goods_list[i]["actual_num"].ToString())); // if (qyt != 0) // { // DetailsModel.qty = qyt; // DetailsModel.price = (double)dec / DetailsModel.qty; // } // else // { // DetailsModel.qty = 0; // DetailsModel.price = (double)dec; // } // if (qyt > 0) // { // DetailsList.Add(DetailsModel); // } //} } T_InterceptLogistics model = new T_InterceptLogistics(); model.OrderNumber = code; model.ExpressName = logistics_name; model.ExpressNumber = logistics_no; model.OrderMoney = Convert.ToDecimal(paid); //var json = new //{ // rows = (from r in DetailsList // select new T_RetreatDetails // { // item_code = r.item_code, // item_name = r.item_name, // price = r.price, // amount = r.amount, // qty = r.qty, // Simplename = r.Simplename, // }).ToArray() //}; return(Json(new { ModelList = model, Repeat = repeat }, JsonRequestBehavior.AllowGet)); } } return(Json("-1", JsonRequestBehavior.AllowGet)); }