Beispiel #1
0
        /// <summary>
        /// 专题页的商品管理
        /// </summary>
        /// <returns></returns>
        public ActionResult ManageProduct(string topicNo, int pageindex = 1)
        {
            int    pageSize        = 10;
            string categoryNo      = Request["CategoryNo"];
            string brandNo         = Request["BrandNo"];
            string productNoOrName = Request["ProductNameOrNo"];

            if (!string.IsNullOrEmpty(productNoOrName) && productNoOrName.Equals("商品编号/商品名称"))
            {
                productNoOrName = "";
            }
            /////////////////////////分页保留查询数据用///////////////////////////////
            ViewBag.CategoryNo      = categoryNo ?? "";
            ViewBag.ProductNameOrNo = productNoOrName ?? "";
            ViewBag.BrandName       = Request.QueryString["BrandName"] ?? "";
            ViewBag.BrandNo         = brandNo ?? "";

            ///////////////////////////分页保留查询数据用/////////////////////////////

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("brandNo", brandNo ?? "");
            dic.Add("productNoOrName", productNoOrName ?? "");
            dic.Add("gCategroyNo", categoryNo ?? "");
            dic.Add("topicId", topicNo ?? "");

            SWfsTopicService topicServ        = new SWfsTopicService();
            var productList                   = topicServ.GetProductListByTopicNo(dic, pageindex, pageSize);
            SWfsProductService productService = new SWfsProductService();
            ProductInventory   pin            = new ProductInventory();

            foreach (var product in productList.Items)
            {
                pin = productService.GetInventoryByProductNo(product.ProductNo);
                product.Quantity     = pin.SumQuantity;
                product.LockQuantity = pin.SumLockQuantity;
            }
            //所有的一级分类
            SWfsSubjectService subject = new SWfsSubjectService();

            ViewBag.AllFirstCategory = subject.SelectErpCategoryByParentNo("ROOT");
            ViewBag.TopicNo          = topicNo;

            SWfsTopics topicModel = topicServ.GetSWfsTopics(topicNo);

            ViewBag.TopicName = (null != topicModel) ? topicModel.TopicName : "";
            return(View(productList));
        }
Beispiel #2
0
        public ActionResult UpdateGoods(int pageIndex = 1, int pageSize = 20)
        {
            string id    = Request.QueryString["GoodsId"].ToString();
            int    total = 0;
            IEnumerable <ProductInfo> list = productService.GetUpdateGoods(int.Parse(id));

            SWfsProductService service = new SWfsProductService();

            foreach (var item in list)
            {
                //商品下的Skulist
                var skuList = productService.GetSkuListByProductNo(item.ProductNo);
                if (skuList.Any())
                {
                    //价格,上下架状态
                    item.MarketPriceRegion    = skuList.Select(n => n.MarketPrice).Min().ToString() + "~" + skuList.Select(n => n.MarketPrice).Max().ToString();
                    item.StandardPriceRegion  = skuList.Select(n => n.StandardPrice).Min().ToString() + "~" + skuList.Select(n => n.StandardPrice).Max().ToString();
                    item.GoldPriceRegion      = skuList.Select(n => n.GoldPrice).Min().ToString() + "~" + skuList.Select(n => n.GoldPrice).Max().ToString();
                    item.PlatinumPriceRegion  = skuList.Select(n => n.PlatinumPrice).Min().ToString() + "~" + skuList.Select(n => n.PlatinumPrice).Max().ToString();
                    item.DiamondPriceRegion   = skuList.Select(n => n.DiamondPrice).Min().ToString() + "~" + skuList.Select(n => n.DiamondPrice).Max().ToString();
                    item.OutletPriceRegion    = skuList.Select(n => n.OutletPrice).Min().ToString() + "~" + skuList.Select(n => n.OutletPrice).Max().ToString();
                    item.PromotionPriceRegion = skuList.Select(n => n.PromotionPrice).Min().ToString() + "~" + skuList.Select(n => n.PromotionPrice).Max().ToString();
                    item.IsShelf       = skuList.Select(n => n.IsShelf = 2).FirstOrDefault();
                    item.PcShowState   = skuList.Select(n => n.PcShowState = 1).FirstOrDefault();
                    item.DisabledState = skuList.Select(n => n.DisabledState = 0).FirstOrDefault();
                }
                //库存
                ProductInventory inventory = service.GetInventoryByProductNo(item.ProductNo);
                item.Quantity     = inventory.SumQuantity;
                item.LockQuantity = inventory.SumLockQuantity;
            }

            ViewBag.totalCount = total;
            ViewBag.pageIndex  = pageIndex;
            ViewBag.pageSize   = pageSize;
            var list1 = list.OrderByDescending(e => e.sortvalue);

            return(View(list1));
        }
Beispiel #3
0
        /// <summary>
        /// 商品列表--查询添加
        /// </summary>
        /// <param name="topicNo"></param>
        /// <param name="categoryNo"></param>
        /// <param name="brandNo"></param>
        /// <param name="productNameOrNo"></param>
        /// <param name="pageindex"></param>
        /// <returns></returns>
        public ActionResult AddProduct(string topicNo, int pageindex = 1)
        {
            int    pageSize        = 10;
            string categoryNo1     = Request["CategoryNo1"];
            string categoryNo2     = Request["CategoryNo2"];
            string categoryNo3     = Request["CategoryNo3"];
            string categoryNo4     = Request["CategoryNo4"];
            string brandNo         = Request["BrandNo"];
            string productNoOrName = Request["ProductNameOrNo"];
            string gender          = Request["Gender"];

            if (!string.IsNullOrEmpty(productNoOrName) && productNoOrName.Equals("商品编号/商品名称"))
            {
                productNoOrName = "";
            }
            /////////////////////////分页保留查询数据用///////////////////////////////
            ViewBag.CategoryNo      = categoryNo1 ?? "";
            ViewBag.CategoryNo2     = categoryNo2 ?? "";
            ViewBag.CategoryNo3     = categoryNo3 ?? "";
            ViewBag.CategoryNo4     = categoryNo4 ?? "";
            ViewBag.ProductNameOrNo = productNoOrName ?? "";
            ViewBag.BrandName       = Request.QueryString["BrandName"] ?? "";
            ViewBag.Gender          = gender ?? "";
            ///////////////////////////分页保留查询数据用/////////////////////////////

            string gCategroyNo = categoryNo1;

            if (!string.IsNullOrEmpty(categoryNo2))
            {
                gCategroyNo = categoryNo2;
            }
            if (!string.IsNullOrEmpty(categoryNo3))
            {
                gCategroyNo = categoryNo3;
            }
            if (!string.IsNullOrEmpty(categoryNo4))
            {
                gCategroyNo = categoryNo4;
            }


            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("brandNo", brandNo ?? "");
            dic.Add("productNoOrName", productNoOrName ?? "");
            dic.Add("gender", gender ?? "");
            dic.Add("gCategroyNo", gCategroyNo ?? "");

            SWfsTopicService topicServ = new SWfsTopicService();
            var productList            = topicServ.GetProductList(dic, pageindex, pageSize);

            SWfsProductService productService = new SWfsProductService();
            //ProductInventory pin = new ProductInventory();
            ProductInventoryNew   pin     = new ProductInventoryNew();
            SWfsNewProductService service = new SWfsNewProductService();
            decimal bid = 0;

            foreach (var product in productList.Items)
            {
                //pin = productService.GetInventoryByProductNo(product.ProductNo);
                pin = service.GetInventoryByProductNo(product.ProductNo);
                product.Quantity     = pin.SumQuantity;
                product.LockQuantity = pin.SumLockQuantity;


                bid = productService.GetProductBuyPriceByProductNo(product.ProductNo);

                product.sellBid       = product.SellPrice - bid;
                product.marketBid     = product.MarketPrice - bid;
                product.platinumBid   = product.PlatinumPrice - bid;
                product.diamondBid    = product.DiamondPrice - bid;
                product.limitedBid    = product.LimitedPrice - bid;
                product.limitedVipBid = product.LimitedVipPrice - bid;

                product.selBidRate        = product.SellPrice.Equals(0) ? 100 : Math.Round((product.sellBid / product.SellPrice) * 100, 2);
                product.marketBidRate     = product.MarketPrice.Equals(0) ? 100 : Math.Round((product.marketBid / product.MarketPrice) * 100, 2);             // Convert.ToDecimal(Math.Round((Convert.ToDecimal(marketBid) / Convert.ToDecimal(marketPrice)) * 100, 2)).ToString() + "%";
                product.platinumBidRate   = product.PlatinumPrice.Equals(0) ? 100 : Math.Round((product.platinumBid / product.PlatinumPrice) * 100, 2);       // Convert.ToDecimal(Math.Round((Convert.ToDecimal(platinumBid) / Convert.ToDecimal(platinumPrice)) * 100, 2)).ToString() + "%";
                product.diamondBidRate    = product.DiamondPrice.Equals(0) ? 100 : Math.Round((product.diamondBid / product.DiamondPrice) * 100, 2);          //Convert.ToDecimal(Math.Round((Convert.ToDecimal(diamondBid) / Convert.ToDecimal(diamondPrice)) * 100, 2)).ToString() + "%";
                product.limitedBidRate    = product.LimitedPrice.Equals(0) ? 100 : Math.Round((product.limitedBid / product.LimitedPrice) * 100, 2);          // Convert.ToDecimal(Math.Round((Convert.ToDecimal(limitedBid) / Convert.ToDecimal(limitedPrice)) * 100, 2)).ToString() + "%";
                product.limitedVipBidRate = product.LimitedVipPrice.Equals(0) ? 100 : Math.Round((product.limitedVipBid / product.LimitedVipPrice) * 100, 2); // Convert.ToDecimal(Math.Round((Convert.ToDecimal(limitedVipBid) / Convert.ToDecimal(limitedVipPrice)) * 100, 2)).ToString() + "%";
            }

            //所有的一级分类
            SWfsSubjectService subject = new SWfsSubjectService();

            ViewBag.AllFirstCategory = subject.SelectErpCategoryByParentNo("ROOT");
            //该活动下的一级分类
            //ViewBag.FirstCategory = subject.GetErpCategoryListBySubjectNo(subjectNo);

            ViewBag.Category2 = subject.SelectErpCategoryByParentNo(categoryNo1);
            ViewBag.Category3 = subject.SelectErpCategoryByParentNo(categoryNo2);
            ViewBag.Category4 = subject.SelectErpCategoryByParentNo(categoryNo3);

            ViewBag.TopicNo = topicNo;

            SWfsTopics topicModel = topicServ.GetSWfsTopics(topicNo);

            ViewBag.TopicName = (null != topicModel) ? topicModel.TopicName : "";

            ViewBag.SCategoryNo = gCategroyNo;

            return(View(productList));
        }
Beispiel #4
0
        public ActionResult AddGoods(int pageIndex = 1, int pageSize = 20)
        {
            if (Request.QueryString["GoodsId"] != null)
            {
                ViewBag.GoodsId = Request.QueryString["GoodsId"];
            }

            int total = 0;

            if (Request.QueryString["keyWord"] != null)
            {
                ViewBag.keyWord = Request.QueryString["keyWord"];
            }
            if (Request.QueryString["CategoryNo"] != null)
            {
                ViewBag.category = Request.QueryString["CategoryNo"];
            }
            if (Request.QueryString["Gender"] != null)
            {
                ViewBag.Gender = Request.QueryString["Gender"];
            }
            if (Request.QueryString["brandNO"] != null)
            {
                ViewBag.BrandNO = Request.QueryString["brandNO"];
            }
            if (Request.QueryString["starttime"] != null && Request.QueryString["starttime"] != "")
            {
                ViewBag.StartDateShelf = Request.QueryString["starttime"];
            }
            if (Request.QueryString["endtime"] != null && Request.QueryString["endtime"] != "")
            {
                ViewBag.EndDateShelf = Request.QueryString["endtime"];
            }

            ViewBag.produclist = Request.Cookies["MyCook"] == null ? "" : Request.Cookies["MyCook"].Value + "";

            IEnumerable <ProductInfo> list    = productService.GetSWfsProductList(ViewBag.Gender, ViewBag.BrandNO, ViewBag.category, ViewBag.keyWord, ViewBag.StartDateShelf, ViewBag.EndDateShelf, pageIndex, pageSize, out total);
            SWfsProductService        service = new SWfsProductService();

            foreach (var item in list)
            {
                //商品下的Skulist
                IEnumerable <SpfSkuExtendInfo> skuList = productService.GetSkuListByProductNo(item.ProductNo);
                if (skuList.Any())
                {
                    //价格,上下架状态
                    item.MarketPriceRegion    = skuList.Select(n => n.MarketPrice).Min().ToString() + "~" + skuList.Select(n => n.MarketPrice).Max().ToString();
                    item.StandardPriceRegion  = skuList.Select(n => n.StandardPrice).Min().ToString() + "~" + skuList.Select(n => n.StandardPrice).Max().ToString();
                    item.GoldPriceRegion      = skuList.Select(n => n.GoldPrice).Min().ToString() + "~" + skuList.Select(n => n.GoldPrice).Max().ToString();
                    item.PlatinumPriceRegion  = skuList.Select(n => n.PlatinumPrice).Min().ToString() + "~" + skuList.Select(n => n.PlatinumPrice).Max().ToString();
                    item.DiamondPriceRegion   = skuList.Select(n => n.DiamondPrice).Min().ToString() + "~" + skuList.Select(n => n.DiamondPrice).Max().ToString();
                    item.OutletPriceRegion    = skuList.Select(n => n.OutletPrice).Min().ToString() + "~" + skuList.Select(n => n.OutletPrice).Max().ToString();
                    item.PromotionPriceRegion = skuList.Select(n => n.PromotionPrice).Min().ToString() + "~" + skuList.Select(n => n.PromotionPrice).Max().ToString();
                    item.IsShelf       = skuList.Select(n => n.IsShelf = 2).FirstOrDefault();
                    item.PcShowState   = skuList.Select(n => n.PcShowState = 1).FirstOrDefault();
                    item.DisabledState = skuList.Select(n => n.DisabledState = 0).FirstOrDefault();
                }
                ProductInventory inventory = service.GetInventoryByProductNo(item.ProductNo);
                item.Quantity     = inventory.SumQuantity;
                item.LockQuantity = inventory.SumLockQuantity;
            }

            ViewBag.totalCount = total;
            ViewBag.pageIndex  = pageIndex;
            ViewBag.pageSize   = pageSize;

            return(View(list));
        }