public object Do_GetGoods(object param) { GetGoodsParam ggp = JsonConvert.DeserializeObject <GetGoodsParam>(param.ToString()); if (ggp == null) { throw new ApiException(CodeMessage.InvalidParam, "InvalidParam"); } GoodsDao gd = new GoodsDao(); DataTable dt = gd.getGoods(ggp.barcode); if (dt.Rows.Count > 0) { Goods goods = new Goods(); goods.id = dt.Rows[0]["id"].ToString(); goods.slt = dt.Rows[0]["thumb"].ToString().Split(','); goods.goodsname = dt.Rows[0]["goodsname"].ToString(); goods.price = dt.Rows[0]["price"].ToString(); goods.stock = dt.Rows[0]["stock"].ToString(); return(goods); } else { throw new ApiException(CodeMessage.GoodsNotFound, "GoodsNotFound"); } }
public AddOrderProxy() { OrderModel = new OrderDao(context); CustomerModel = new CustomerDao(context); GoodsModel = new GoodsDao(context); GoodsRowModel = new GoodsRowDao(context); OrderStatusModel = new OrderStatusDao(context); CommentModel = new CommentDao(context); }
/// <summary> /// 库存管理 /// </summary> /// <param name="param"></param> /// <returns></returns> public PageResult Do_StockStatistics(BaseApi baseApi) { PageResult pageResult = new PageResult(); pageResult.list = new List <object>(); pageResult.item = new object(); StockStatisticsParam stockStatisticsParam = JsonConvert.DeserializeObject <StockStatisticsParam>(baseApi.param.ToString()); if (stockStatisticsParam.current == 0) { stockStatisticsParam.current = 1; } if (stockStatisticsParam.pageSize == 0) { stockStatisticsParam.pageSize = 10; } if (stockStatisticsParam.status == null || stockStatisticsParam.status == "" || stockStatisticsParam.status == "预到店") { stockStatisticsParam.status = " and v.state='1' "; } else if (stockStatisticsParam.status == "已到店") { stockStatisticsParam.status = " and v.state!='1' "; } else { throw new ApiException(CodeMessage.InvalidStatus, "InvalidStatus"); } pageResult.pagination = new Page(stockStatisticsParam.current, stockStatisticsParam.pageSize); StockStatisticsItem stockStatisticsItem = new StockStatisticsItem(); var shopId = Util.GetUserShopId(baseApi.token); GoodsDao giftManageDao = new GoodsDao(); int allGoods = 0; int movinGoods = 0; int arriveGoods = 0; DataTable dt = giftManageDao.StockStatistics(shopId); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { allGoods += Convert.ToInt16(dt.Rows[i]["num"]); if (dt.Rows[i]["state"].ToString() == "1") { movinGoods = Convert.ToInt16(dt.Rows[i]["num"]); } else { arriveGoods += Convert.ToInt16(dt.Rows[i]["num"]); } } } stockStatisticsItem.allGoods = allGoods.ToString() + "个商品"; stockStatisticsItem.movinGoods = movinGoods.ToString() + "个商品"; stockStatisticsItem.arriveGoods = arriveGoods.ToString() + "个商品"; pageResult.item = stockStatisticsItem; dt = giftManageDao.StockStatisticsList(shopId, stockStatisticsParam); if (dt.Rows.Count > 0) { for (int i = (stockStatisticsParam.current - 1) * stockStatisticsParam.pageSize; i < dt.Rows.Count && i < stockStatisticsParam.current * stockStatisticsParam.pageSize; i++) { StockStatisticsList stockStatisticsList = new StockStatisticsList(); stockStatisticsList.key = i + 1; stockStatisticsList.goodsName = dt.Rows[i]["goods_name"].ToString(); stockStatisticsList.goodsnum = dt.Rows[i]["num"].ToString(); stockStatisticsList.goodsImg = dt.Rows[i]["goods_img"].ToString(); stockStatisticsList.proportion = (Math.Round(Convert.ToDouble(dt.Rows[i]["num"]) / allGoods * 100, 2)).ToString(); pageResult.list.Add(stockStatisticsList); } } pageResult.pagination.total = dt.Rows.Count; return(pageResult); }
public DataSet findGoodsById(string goodsId) { return(GoodsDao.GetInstance().findGoodsById(goodsId)); }
public bool modifyGoods(int id, string name, string number, string price, string picture, string remarks) { return(GoodsDao.GetInstance().modifyGoods(id, name, number, price, picture, remarks)); }
public bool createGoods(string name, string number, string price, string picture, string remarks) { return(GoodsDao.GetInstance().createGoods(name, number, price, picture, remarks)); }
public bool deleteGoodsList(string goodsList) { return(GoodsDao.GetInstance().deleteGoodsList(goodsList)); }
public DataSet findGoodsList() { return(GoodsDao.GetInstance().findGoodsList()); }
public GoodsCategoryService() { GoodsDao = new GoodsDao(context); CategoryDao=new ProductCategoryDao(context); }