public ActionResult AddContract(string id)
        {
            ViewBag.Classify = ListToSelect(SysDataDictService.GetContractClassify().Select(o => new SelectListItem()
            {
                Value = o.DicSN.ToString(), Text = o.Title
            }), emptyTitle: "请选择");
            //ViewBag.Suppliers = ListToSelect(SupplierService.GetList().Where(o => o.BusinessType == 1 && o.MasterState == 1).Select(o => new SelectListItem() { Value = o.Id, Text = o.FullTitle }));

            var obj = new Logic.Entity.Contract();

            obj.ContractBoths = new List <Logic.Entity.ContractBoth>()
            {
                new Logic.Entity.ContractBoth(), new Logic.Entity.ContractBoth()
            };
            var curr = DateTime.Now;

            obj.SigningDate = curr.ToString("yyyy-MM-dd");
            //obj.ContractSN = ContractBLL.CreateContractSN();
            ViewBag.Version = (obj.Version == 1) ? ("新增 v" + obj.Version + ".0") : ("续签 v" + obj.Version + ".0");

            if (!id.IsNullOrEmpty())
            {
                obj             = ContractSerivce.FindById(id);
                ViewBag.Version = (obj.Version == 1) ? ("新增 v" + obj.Version + ".0") : ("续签 v" + obj.Version + ".0");
                if (obj == null)
                {
                    throw new ArgumentException("传入参数不正确!");
                }
            }
            return(View(obj));
        }
Beispiel #2
0
        public ActionResult LoadContractList(string sId)
        {
            int count = 0;
            var list  = ContractSerivce.LoadContractList(Request.Params, out count);

            return(ToDataGrid(list, count));
        }
        //查看合同(合同状态为已审核、已中止、已结束状态)
        public ActionResult ContractDetail(string id)
        {
            var obj = ContractSerivce.FindById(id);

            obj.IsNullThrow();
            ViewBag.Version = (obj.Version == 1) ? ("新增 v" + obj.Version + ".0") : ("续签 v" + obj.Version + ".0");

            var supp = SupplierService.Find(o => o.Id == obj.SupplierId);

            if (supp != null)
            {
                obj.SupplierTitle = supp.Title;
            }

            var classify = SysDataDictService.Find(o => o.DicSN == obj.ClassifyId);

            if (classify != null)
            {
                ViewData["Classify"] = classify.Title;
            }
            return(View(obj));
        }
        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));
        }