示例#1
0
 public IEnumerable <StoreDto> GetStores()
 {
     return(WarehouseService.FindList(o => o.State == 1).Select(o => new StoreDto()
     {
         StoreId = o.StoreId, Title = o.Title
     }));
 }
示例#2
0
        public ActionResult GetRemind(string type)
        {
            List <RemindModel> rmList = new List <RemindModel>();

            switch (type.ToLower())
            {
            case "stockout":    //缺货提醒
                var datas = CommodityService.GetStockout().GroupBy(o => o.Key);
                foreach (var item in datas)
                {
                    rmList.Add(new RemindModel(item.Key + "缺货提醒", item.Key + "以下商品缺货:<br/>" + string.Join(",", item.Select(o => o.Value))));
                }
                break;

            case "activity":    //活动提醒
                Dictionary <short, string> promotionTypeDict = new Dictionary <short, string>();
                //1:单品折扣、 2:捆绑促销、 3:组合促销、4:买赠促销、 5:满元促销
                promotionTypeDict.Add(1, "单品折扣");
                promotionTypeDict.Add(2, "捆绑促销");
                promotionTypeDict.Add(3, "组合促销");
                promotionTypeDict.Add(4, "买赠促销");
                promotionTypeDict.Add(5, "满元促销");
                var promotions = CommodityPromotionService.GetNewestActivity(10);
                foreach (var item in promotions)
                {
                    var storeids = item.StoreId.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    var stores   = WarehouseService.FindList(o => storeids.Contains(o.StoreId)).Select(o => o.Title);
                    rmList.Add(
                        new RemindModel(
                            string.Format(
                                "{1}~{2} {0}",
                                promotionTypeDict[item.PromotionType], (item.StartDate ?? new DateTime()).ToString("yyyy-MM-dd"),
                                (item.EndDate ?? new DateTime()).ToString("yyyy-MM-dd")),
                            item.Id));
                }
                break;

            case "receive":    //收货提醒
                var orderDatas = OrderDistributionService.GetReceivedOrder();
                foreach (var item in orderDatas)
                {
                    rmList.Add(new RemindModel(string.Format("{0}有订单发货,请注意查收!", item.Store), string.Format("<br/>门店:{0}<br/>配送批次号:{1}<br/>订单编号:{2}<br/>", item.Store, item.DistributionBatch, item.IndentOrderId)));
                }
                break;

            case "expiration":    //保质期到期提醒
                var commodities = CommodityService.GetExpiresProduct();
                foreach (var item in commodities)
                {
                    rmList.Add(new RemindModel(string.Format("{0}已过期或将要过期", item.Key), string.Format("{0}将要过期<br/>过期时间:{1}", item.Key, item.Value.ExpirationDate)));
                }
                break;

            case "contract":    //合同提醒
                var contracts = ContractSerivce.GetContractRemind();
                foreach (var item in contracts)
                {
                    rmList.Add(new RemindModel(string.Format("<span style=\"width:120px;display:inline-block;\">{0}</span><span style=\"width:110px;display:inline-block;\">{1}</span><span style=\"width:110px;display:inline-block;\">{2}</span>", item.ContractSN, item.SupplierTitle, item.EndDate),
                                               string.Format("合同编号:{0}<br/>供应商:{1}<br/>结束日期:{2}", item.ContractSN, item.SupplierTitle, item.EndDate)));
                }
                break;
            }

            return(new JsonNetResult(rmList));
        }