Ejemplo n.º 1
0
        /// <summary>
        /// 台帐报表
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <InventoryBookEntity> GetList(InventoryBookEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.OrderBy(a => a.ProductNum, EOrderBy.ASC);
            AdminEntity adminEntity = new AdminEntity();

            adminEntity.Include(a => new { UserName = a.UserName });
            entity.Left <AdminEntity>(adminEntity, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserCode"
            });
            int rowCount = 0;
            List <InventoryBookEntity> listResult = this.InventoryBook.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            return(listResult);
        }
Ejemplo n.º 2
0
        public static InventoryBook_CE ToCE(InventoryBookEntity item)
        {
            InventoryBook_CE target = new InventoryBook_CE();

            target.ID           = item.ID;
            target.ProductNum   = item.ProductNum;
            target.BarCode      = item.BarCode;
            target.ProductName  = item.ProductName;
            target.Num          = item.Num;
            target.Type         = item.Type;
            target.ContactOrder = item.ContactOrder;
            target.FromLocalNum = item.FromLocalNum;
            target.ToLocalNum   = item.ToLocalNum;
            target.StoreNum     = item.StoreNum;
            target.CreateTime   = item.CreateTime;
            target.CreateUser   = item.CreateUser;
            return(target);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 查询台账记录分页
        /// </summary>
        /// <returns></returns>
        public ActionResult GetList()
        {
            string CompanyID      = WebUtil.GetFormValue <string>("CompanyID", string.Empty);
            string BarCode        = WebUtil.GetFormValue <string>("BarCode", string.Empty);
            string ProductName    = WebUtil.GetFormValue <string>("ProductName", string.Empty);
            string BatchNum       = WebUtil.GetFormValue <string>("BatchNum", string.Empty);
            int    Type           = WebUtil.GetFormValue <int>("Type", 0);
            string FromStorageNum = WebUtil.GetFormValue <string>("FromStorageNum");
            string OrderNum       = WebUtil.GetFormValue <string>("OrderNum");
            string ContactOrder   = WebUtil.GetFormValue <string>("ContactOrder");
            string BeginTime      = WebUtil.GetFormValue <string>("BeginTime");
            string EndTime        = WebUtil.GetFormValue <string>("EndTime");
            int    PageIndex      = WebUtil.GetFormValue <int>("PageIndex", 0);
            int    PageSize       = WebUtil.GetFormValue <int>("PageSize", 0);

            InventoryBookEntity entity = new InventoryBookEntity();

            entity.CompanyID      = CompanyID;
            entity.BarCode        = BarCode;
            entity.ProductName    = ProductName;
            entity.BatchNum       = BatchNum;
            entity.Type           = Type;
            entity.FromStorageNum = FromStorageNum;
            entity.OrderNum       = OrderNum;
            entity.ContactOrder   = ContactOrder;
            entity.BeginTime      = BeginTime;
            entity.EndTime        = EndTime;

            PageInfo pageInfo = new PageInfo()
            {
                PageIndex = PageIndex, PageSize = PageSize
            };
            InventoryBookProvider      provider   = new InventoryBookProvider(CompanyID);
            List <InventoryBookEntity> listResult = provider.GetList(entity, ref pageInfo);

            DataListResult <InventoryBookEntity> dataResult = new DataListResult <InventoryBookEntity>();

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

            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 查询台账记录
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <InventoryBookEntity> GetList(InventoryBookEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            entity.Where(a => a.CompanyID == this.CompanyID);

            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.Type > 0)
            {
                entity.And(a => a.Type == entity.Type);
            }
            if (entity.OrderNum.IsNotEmpty())
            {
                entity.And("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%");
            }
            if (entity.ContactOrder.IsNotEmpty())
            {
                entity.And(item => item.ContactOrder == entity.ContactOrder);
            }
            if (entity.FromStorageNum.IsNotEmpty())
            {
                entity.And(item => item.FromStorageNum == entity.FromStorageNum);
            }
            if (entity.BeginTime.IsNotEmpty())
            {
                DateTime begin = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.AddDays(-30)).Date;
                entity.And(a => a.CreateTime >= begin);
            }
            if (entity.EndTime.IsNotEmpty())
            {
                DateTime end = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now).AddDays(1).Date;
                entity.And(a => a.CreateTime < end);
            }
            int rowCount = 0;
            List <InventoryBookEntity> listResult = this.InventoryBook.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;

            if (!listResult.IsNullOrEmpty())
            {
                List <LocationEntity> listLocation = new LocationProvider(this.CompanyID).GetList();
                listLocation = listLocation == null ? new List <LocationEntity>() : listLocation;

                ProductProvider provider = new ProductProvider(this.CompanyID);
                foreach (InventoryBookEntity item in listResult)
                {
                    if (item.FromLocalNum.IsNotEmpty())
                    {
                        LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.FromLocalNum);
                        item.FromLocalName   = location != null ? location.LocalName : string.Empty;
                        item.FromStorageName = location != null ? location.StorageName : string.Empty;
                    }

                    if (item.ToLocalNum.IsNotEmpty())
                    {
                        LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.ToLocalNum);
                        item.ToLocalName   = location != null ? location.LocalName : string.Empty;
                        item.ToStorageName = location != null ? location.StorageName : string.Empty;
                    }

                    ProductEntity product = provider.GetProduct(item.ProductNum);
                    if (product != null)
                    {
                        item.Size     = product.Size;
                        item.UnitName = product.UnitName;
                    }
                }
            }
            return(listResult);
        }