public ActionResult SearchFastGoods(string entid, string userId, string searchValue) { try { if (string.IsNullOrEmpty(entid) || string.IsNullOrEmpty(userId)) { return(Json(new { flag = 0, message = "请先登录!" })); } //获取用户信息 UserInfoDal dal = new UserInfoDal(); List <UserInfo> user = new List <UserInfo>(); if (!string.IsNullOrEmpty(userId)) { user = dal.GetUserInfo(userId, entid); } string jgjb = "", clientlimit = "", KhType = ""; bool landing = false; bool staleDated = false; if (user.Count > 0) { entid = user[0].EntId; jgjb = user[0].Pricelevel; clientlimit = user[0].ClientLimit; KhType = user[0].KhType; staleDated = user[0].StaleDated; landing = true; } GoodsInfoDal infoDal = new GoodsInfoDal(); if (searchValue.Trim().Contains(" ")) { int length = searchValue.Length; int index = searchValue.IndexOf(" "); string goodsValue, factoryValue; goodsValue = searchValue.Substring(0, index).Trim(); factoryValue = searchValue.Substring(index, length - index).ToString().Trim(); searchValue = goodsValue + ',' + factoryValue; } List <GoodsList> lists = new List <GoodsList>(); lists = infoDal.SearchFastGoods(entid, searchValue, jgjb, KhType, landing, staleDated); if (lists == null) { return(Json(new { flag = 2, message = "无符合商品!" })); } else { return(Json(new { flag = 2, message = "商品查询成功!", lists })); } } catch (Exception ex) { LogQueue.Write(LogType.Error, "Search/SearchFastGoods", ex.Message.ToString()); return(Json(new { flag = 99, message = "商品获取失败!" })); } }