Esempio n. 1
0
        /// <summary>
        /// 查询库存期初期末数据
        /// </summary>
        /// <param name="SnNum"></param>
        /// <returns></returns>
        public BalanceBookEntity GetSingle(string SnNum)
        {
            BalanceBookEntity entity = new BalanceBookEntity();

            entity.IncludeAll();
            entity.Where(item => item.SnNum == SnNum)
            .And(item => item.CompanyID == this.CompanyID)
            ;
            BalanceBookEntity result = this.BalanceBook.GetSingle(entity);

            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 查询期初期末
        /// </summary>
        /// <returns></returns>
        public ActionResult GetSingle()
        {
            string CompanyID             = WebUtil.GetFormValue <string>("CompanyID");
            string SnNum                 = WebUtil.GetFormValue <string>("SnNum");
            BalanceBookProvider provider = new BalanceBookProvider(CompanyID);
            BalanceBookEntity   result   = provider.GetSingle(SnNum);

            DataResult <BalanceBookEntity> dataResult = new DataResult <BalanceBookEntity>();

            dataResult.Code    = (int)EResponseCode.Success;
            dataResult.Message = "响应成功";
            dataResult.Result  = result;

            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
Esempio n. 3
0
        /// <summary>
        /// 查询期初期末数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetList()
        {
            string CompanyID = WebUtil.GetFormValue <string>("CompanyID");
            int    PageIndex = WebUtil.GetFormValue <int>("PageIndex", 1);
            int    PageSize  = WebUtil.GetFormValue <int>("PageSize", 10);

            string BarCode     = WebUtil.GetFormValue <string>("BarCode");
            string ProductName = WebUtil.GetFormValue <string>("ProductName");
            string BatchNum    = WebUtil.GetFormValue <string>("BatchNum");
            string Day         = WebUtil.GetFormValue <string>("Day");
            string StorageNum  = WebUtil.GetFormValue <string>("StorageNum");
            string BeginTime   = WebUtil.GetFormValue <string>("BeginTime");
            string EndTime     = WebUtil.GetFormValue <string>("EndTime");

            BalanceBookEntity entity = new BalanceBookEntity();

            entity.BarCode     = BarCode;
            entity.ProductName = ProductName;
            entity.BatchNum    = BatchNum;
            entity.Day         = Day;
            entity.BeginTime   = BeginTime;
            entity.EndTime     = EndTime;
            entity.StorageNum  = StorageNum;

            PageInfo pageInfo = new PageInfo()
            {
                PageIndex = PageIndex, PageSize = PageSize
            };
            BalanceBookProvider                provider   = new BalanceBookProvider(CompanyID);
            List <BalanceBookEntity>           listResult = provider.GetList(entity, ref pageInfo);
            DataListResult <BalanceBookEntity> dataResult = new DataListResult <BalanceBookEntity>();

            dataResult.Code     = (int)EResponseCode.Success;
            dataResult.Message  = "响应成功";
            dataResult.Result   = listResult;
            dataResult.PageInfo = pageInfo;

            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
Esempio n. 4
0
        /// <summary>
        /// 查询期初期末数据
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <BalanceBookEntity> GetList(BalanceBookEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.Where(item => item.CompanyID == this.CompanyID);
            entity.OrderBy(item => item.ID, EOrderBy.DESC);

            if (entity.BarCode.IsNotEmpty())
            {
                entity.And("BarCode", ECondition.Like, "%" + entity.BarCode + "%");
            }
            if (entity.ProductName.IsNotEmpty())
            {
                entity.And("ProductName", ECondition.Like, "%" + entity.ProductName + "%");
            }
            if (entity.BatchNum.IsNotEmpty())
            {
                entity.And("BatchNum", ECondition.Like, "%" + entity.BatchNum + "%");
            }
            if (entity.Day.IsNotEmpty())
            {
                entity.And("Day", ECondition.Like, "%" + entity.Day + "%");
            }

            if (entity.BeginTime.IsNotEmpty())
            {
                DateTime begin = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.AddDays(-30)).Date;
                entity.And(item => item.CreateTime >= begin);
            }
            if (entity.EndTime.IsNotEmpty())
            {
                DateTime end = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now).AddDays(1).Date;
                entity.And(item => item.CreateTime < end);
            }
            if (entity.StorageNum.IsNotEmpty())
            {
                entity.And(item => item.StorageNum == entity.StorageNum);
            }
            int rowCount = 0;
            List <BalanceBookEntity> listResult = this.BalanceBook.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;

            if (!listResult.IsNullOrEmpty())
            {
                ProductProvider provider        = new ProductProvider(this.CompanyID);
                StorageProvider storageProvider = new StorageProvider(this.CompanyID);
                foreach (BalanceBookEntity item in listResult)
                {
                    ProductEntity product = provider.GetProduct(item.ProductNum);
                    if (product != null)
                    {
                        item.Size     = product.Size;
                        item.UnitName = product.UnitName;
                    }

                    StorageEntity storage = storageProvider.GetSingleByNum(item.StorageNum);
                    if (storage != null)
                    {
                        item.StorageName = storage.StorageName;
                    }
                }
            }
            return(listResult);
        }