Example #1
0
        public IActionResult Index()
        {
            //签约公司
            var companyInfoDtos = _commonDataService.CompanyInfos();
            var selectListItems = companyInfoDtos.Select(s => new SelectListItem(s.CompanyName, s.CompanyCode)).ToList();

            selectListItems.Insert(0, new SelectListItem("缺省", "-99"));
            selectListItems.Insert(0, new SelectListItem("请选择", ""));
            ViewBag.Company = selectListItems;

            //订单来源(采购大类)
            var types         = _commonDataService.GetRelevanceInfos(5).ToList();
            var typesListItem = types.Select(s => new SelectListItem(s.Value, s.Key)).ToList();

            typesListItem.Insert(0, new SelectListItem("请选择", "0"));
            ViewBag.Types = typesListItem;


            //物料分类
            var productCategoryDtos = _commonDataService.GetProductCategorys(level: 1, type: "MaterialClass");
            var productListItem     = productCategoryDtos.Select(s => new SelectListItem(s.Name, s.ProductCatID)).ToList();

            productListItem.Insert(0, new SelectListItem("请选择", ""));
            ViewBag.productCategories = productListItem;

            //支出类型一级
            var payOutTypes        = _commonDataService.GetDicInfos(723).ToList();
            var payOutTypeListItem = payOutTypes.Select(s => new SelectListItem(s.DictName, s.DictId.ToString())).ToList();

            payOutTypeListItem.Insert(0, new SelectListItem("请选择", "0"));
            ViewBag.payOutTypes = payOutTypeListItem;


            return(View());
        }
Example #2
0
        public PagedResultDto <CostAccountConfigOut> GetAccountConfigsByPage(CostAccountConfigInput queryModel)
        {
            #region expression表达式
            var expression = Expression(queryModel);

            #endregion

            //var count = _costAccountConfigRepository.Count(expression);
            var model = _costAccountConfigRepository.PageListSelect(expression, s => new CostAccountConfig()
            {
                Id          = s.Id,
                CompanyCode = s.CompanyCode,
                OrderType   = s.OrderType,
                ContentType = s.ContentType,
                ProductCat1 = s.ProductCat1,
                ProductCat2 = s.ProductCat2,
                PayOutType1 = s.PayOutType1,
                PayOutType2 = s.PayOutType2
            }, queryModel.CurrentPage, queryModel.PageSize, new Tuple <Expression <Func <CostAccountConfig, object> >, SortOrder>(s => s.Id, SortOrder.Descending));

            //签约公司
            var companyInfos = _commonDataService.CompanyInfos();
            //订单类型
            var relevanceInfos = _commonDataService.GetRelevanceInfos(5);
            //采购类型
            var contentTypes = _commonDataService.GetDicInfos(701);
            //物料分类
            var productCat1s = _commonDataService.GetProductCategorys(level: 1, type: "MaterialClass");
            //物料
            var productCat2s = _commonDataService.GetProductCategorys(level: 2, type: "Material");
            //支出类型1
            var payOutType1s = _commonDataService.GetDicInfos(723);
            var payOutType2s = new List <DicInfoDto>();
            payOutType1s.ForEach(s =>
            {
                payOutType2s.AddRange(_commonDataService.GetDicInfos(s.DictId));
            });

            var models = new List <CostAccountConfigOut>();
            foreach (var item in model.Items)
            {
                var tem = new CostAccountConfigOut()
                {
                    Id              = item.Id,
                    CompanyCode     = item.CompanyCode,
                    CompanyName     = item.CompanyCode == "-99" ? "缺省" : companyInfos.Where(s => s.CompanyCode == item.CompanyCode.ToString()).Select(s => s.CompanyName).FirstOrDefault(),
                    OrderType       = item.OrderType,
                    OrderTypeName   = relevanceInfos.Where(s => s.Key == item.OrderType.ToString()).Select(s => s.Value).FirstOrDefault(),
                    ContentType     = item.ContentType,
                    ContentTypeName = item.ContentType == -99 ? "缺省" : contentTypes.Where(s => s.DictId == item.ContentType).Select(s => s.DictName).FirstOrDefault(),
                    ProductCat1     = item.ProductCat1,
                    ProductCat1Name = productCat1s.Where(s => s.ProductCatID == item.ProductCat1.ToString()).Select(s => s.Name).FirstOrDefault(),
                    ProductCat2     = item.ProductCat2,
                    ProductCat2Name = item.ProductCat2 == "-99" ? "缺省" : productCat2s.Where(s => s.ProductCatID == item.ProductCat2.ToString()).Select(s => s.Name).FirstOrDefault(),
                    PayOutType1     = item.PayOutType1,
                    PayOutType1Name = payOutType1s.Where(s => s.DictId == item.PayOutType1).Select(s => s.DictName).FirstOrDefault(),
                    PayOutType2     = item.PayOutType2,
                    PayOutType2Name = item.PayOutType2 == -99 ? "缺省" : payOutType2s.Where(s => s.DictId == item.PayOutType2).Select(s => s.DictName).FirstOrDefault(),
                };
                models.Add(tem);
            }


            return(new PagedResultDto <CostAccountConfigOut>(model.Total, models));
        }