コード例 #1
0
        public async Task <IActionResult> Get()
        {
            IEnumerable <kc_storeinlist> entityDto = null;
            await Task.Run(() =>
            {
                entityDto = _kcStoreinlistRpt.GetAll();
            });

            return(new OkObjectResult(entityDto));
        }
コード例 #2
0
        public async Task <IActionResult> Get()
        {
            IEnumerable <kc_storein>     entityDto       = null;
            IEnumerable <kc_storeinlist> entityDetailDto = null;
            await Task.Run(() =>
            {
                entityDto       = _kcStoreinRpt.FindBy(f => f.IsValid).OrderByDescending(f => f.CreatedAt);
                entityDetailDto = _kcStoreinlistRpt.GetAll();
            });

            var storeinDtoList       = _mapper.Map <IEnumerable <kc_storein>, IEnumerable <StoreInGridDto> >(entityDto).ToList();
            var storeinDetailDtoList = _mapper.Map <IEnumerable <kc_storeinlist>, IEnumerable <StoreInListDto> >(entityDetailDto).ToList();

            var sysUserList    = _sysUserRepository.GetAll();
            var kcSupplierList = _kcSupplierRepository.GetAll();
            var sysDicList     = _sysDicRepository.GetAll();
            var sysOrgList     = _sysOrgRepository.GetAll();
            var kcGoodsList    = _kcGoodsRepository.GetAll();

            var sysDics     = sysDicList as sys_dic[] ?? sysDicList.ToArray();
            var sysUsers    = sysUserList as sys_user[] ?? sysUserList.ToArray();
            var sysOrgs     = sysOrgList as sys_org[] ?? sysOrgList.ToArray();
            var kcSuppliers = kcSupplierList as kc_supplier[] ?? kcSupplierList.ToArray();

            foreach (var store in storeinDtoList)
            {
                store.OperatorTxt   = sysUsers.FirstOrDefault(f => f.Id == store.Operator)?.UserName;
                store.OrgIdTxt      = sysOrgs.FirstOrDefault(f => f.Id == store.OrgId)?.DeptName;
                store.StoreIdTxt    = sysDics.FirstOrDefault(f => f.Id == store.StoreId)?.DicName;
                store.SupplierIdTxt = kcSuppliers.FirstOrDefault(f => f.Id == store.SupplierId)?.Name;
                store.TypeIdTxt     = sysDics.FirstOrDefault(f => f.Id == store.TypeId)?.DicName;
            }
            var kcGoodses = kcGoodsList as kc_goods[] ?? kcGoodsList.ToArray();

            foreach (var strdetail in storeinDetailDtoList)
            {
                strdetail.GoodsIdTxt     = kcGoodses.FirstOrDefault(f => f.Id == strdetail.GoodsId)?.Name;
                strdetail.unit           = kcGoodses.FirstOrDefault(f => f.Id == strdetail.GoodsId)?.Unit;
                strdetail.GoodsBrand     = kcGoodses.FirstOrDefault(f => f.Id == strdetail.GoodsId)?.GoodsBrand;
                strdetail.GoodsTypeIdTxt = sysDics.FirstOrDefault(f => f.Id == strdetail.GoodsTypeId)?.DicName;
            }
            return(new OkObjectResult(new StoreInAllDto()
            {
                StoreInList = storeinDtoList, StoreInDetailList = storeinDetailDtoList
            }));
        }
コード例 #3
0
        public List <StoreDto> GetByStore(int storeId)
        {
            IEnumerable <kc_store> entityDto = _kcStoreRpt.FindBy(f => f.IsValid && f.Number > 0);

            if (storeId > 0)
            {
                entityDto = _kcStoreRpt.FindBy(f => f.IsValid && f.StoreId == storeId && f.Number > 0);
            }
            var storeDtoList = _mapper.Map <IEnumerable <kc_store>, IEnumerable <StoreDto> >(entityDto).ToList();

            var kcGoodsList = _kcGoodsRepository.GetAll();
            var sysDicList  = _sysDicRepository.GetAll();
            var sysOrgList  = _sysOrgRepository.GetAll();
            var storeinList = _kcStoreinlistRepository.GetAll();

            var sysDics   = sysDicList as sys_dic[] ?? sysDicList.ToArray();
            var kcGoodses = kcGoodsList as kc_goods[] ?? kcGoodsList.ToArray();
            var sysOrgs   = sysOrgList as sys_org[] ?? sysOrgList.ToArray();
            var storeins  = storeinList as kc_storeinlist[] ?? storeinList.ToArray();

            foreach (var store in storeDtoList)
            {
                store.GoodsTypeIdTxt = sysDics.FirstOrDefault(f => f.Id == store.GoodsTypeId)?.DicName;
                store.StoreIdTxt     = sysDics.FirstOrDefault(f => f.Id == store.StoreId)?.DicName;

                var gd = kcGoodses.FirstOrDefault(f => f.Id == store.GoodsId);
                store.GoodsIdTxt = gd?.Name;
                store.GoodsCode  = gd?.GoodsCode;
                store.GoodsNo    = gd?.GoodsNo;
                store.Unit       = gd?.Unit;
                store.GoodsBrand = gd?.GoodsBrand;
                store.Price      = storeins.FirstOrDefault(f => f.GoodsId == store.GoodsId && f.batchno == store.BatchNo)?.price;
                if (store.Price == null || store.Price <= 0)
                {
                    store.Price = gd?.Price;
                }
                store.OrgTxt = sysOrgs.FirstOrDefault(f => f.Id == store.OrgId)?.DeptName;
            }
            return(storeDtoList);
        }