/// <summary>
        /// 根据调拨单号查询调拨单
        /// </summary>
        /// <param name="OrderNum"></param>
        /// <returns></returns>
        public AllocateOrderEntity GetOrderByNum(string OrderNum)
        {
            AllocateOrderEntity entity = new AllocateOrderEntity();

            entity.IncludeAll();

            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            AdminEntity auditeAdmin = new AdminEntity();

            auditeAdmin.Include(a => new { AuditUserName = a.UserName });
            entity.Left <AdminEntity>(auditeAdmin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            entity.Where(a => a.OrderNum == OrderNum)
            .And(a => a.CompanyID == this.CompanyID)
            ;

            entity = this.AllocateOrder.GetSingle(entity);
            return(entity);
        }
Exemple #2
0
        /// <summary>
        /// 根据出库单编号查询出库单
        /// </summary>
        /// <param name="OrderNum"></param>
        /// <returns></returns>
        public OutStorageEntity GetOrderByNum(string OrderNum)
        {
            OutStorageEntity entity = new OutStorageEntity();

            entity.IncludeAll();

            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            AdminEntity auditeAdmin = new AdminEntity();

            auditeAdmin.Include(item => new { AuditeUserName = item.UserName });
            entity.Left <AdminEntity>(auditeAdmin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            entity.Where(a => a.OrderNum == OrderNum)
            .And(a => a.CompanyID == this.CompanyID)
            .And(a => a.IsDelete == (int)EIsDelete.NotDelete)
            ;
            entity = this.OutStorage.GetSingle(entity);
            return(entity);
        }
Exemple #3
0
        /// <summary>
        /// 查询单据分页
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public override List <OutStorageEntity> GetList(OutStorageEntity entity, ref Framework.DataTypes.PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            AdminEntity admin = new AdminEntity();

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

            pageInfo.RowCount = rowCount;
            if (!listResult.IsNullOrEmpty())
            {
                foreach (OutStorageEntity item in listResult)
                {
                    OutStoDetailEntity detail = new OutStoDetailEntity();
                    detail.IncludeAll();
                    detail.Where(a => a.OrderNum == item.OrderNum);
                    List <OutStoDetailEntity> listDetail = this.OutStoDetail.GetList(detail);
                    if (!listDetail.IsNullOrEmpty())
                    {
                        foreach (OutStoDetailEntity detailItem in listDetail)
                        {
                            item.ProductNames += string.Format("[{0}]", detailItem.ProductName);
                        }
                    }
                }
            }
            return(listResult);
        }
Exemple #4
0
        /// <summary>
        /// 查询单据
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override BadReportEntity GetOrder(BadReportEntity entity)
        {
            entity.IncludeAll();

            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            AdminEntity auditeAdmin = new AdminEntity();

            auditeAdmin.Include(a => new { AuditUserName = a.UserName });
            entity.Left <AdminEntity>(auditeAdmin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            entity.Where(a => a.SnNum == entity.SnNum)
            .And(a => a.CompanyID == this.CompanyID)
            ;

            entity = this.BadReport.GetSingle(entity);
            return(entity);
        }
Exemple #5
0
        /// <summary>
        /// 查询单据分页
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public override List <OrdersEntity> GetList(OrdersEntity entity, ref Framework.DataTypes.PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserCode"
            });
            OrderDetailEntity detail = new OrderDetailEntity();

            detail.Include(a => new { BarCode = a.BarCode, ProductNum = a.ProductNum, ProductName = a.ProductName });
            entity.Left <OrderDetailEntity>(detail, new Params <string, string>()
            {
                Item1 = "SnNum", Item2 = "OrderSnNum"
            });
            int rowCount = 0;
            List <OrdersEntity> listResult = this.Orders.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            return(listResult);
        }
Exemple #6
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int UpdatePwd(AdminEntity entity)
        {
            entity.Include(a => a.PassWord);
            entity.Where(a => a.UserCode == entity.UserCode);
            int line = this.Admin.Update(entity);

            return(line);
        }
Exemple #7
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Update(AdminEntity entity)
        {
            entity.Include(a => new { a.Phone, a.Email, a.Mobile, a.RealName, a.RoleNum, a.DepartNum, a.UserName, a.PassWord, a.UpdateTime });
            entity.Where(a => a.UserCode == entity.UserCode);
            int line = this.Admin.Update(entity);

            return(line);
        }
Exemple #8
0
        /// <summary>
        /// 根据用户编号获得用户信息
        /// </summary>
        /// <param name="userCode"></param>
        /// <returns></returns>
        public AdminEntity GetAdmin(string userCode)
        {
            AdminEntity entity = new AdminEntity();

            entity.Include(a => new { a.ID, a.UserCode, a.UserName, a.PassWord, a.Email, a.Phone, a.Mobile, a.RealName, a.RoleNum, a.DepartNum });
            entity.Where(a => a.UserCode == userCode);
            entity = this.Admin.GetSingle(entity);
            return(entity);
        }
Exemple #9
0
        /// <summary>
        /// 查询单据分页
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public override List <InventoryOrderEntity> GetList(InventoryOrderEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID);
            entity.OrderBy(a => a.ID, EOrderBy.DESC);

            if (!entity.OrderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%");
            }
            if (entity.StorageNum.IsNotEmpty())
            {
                entity.And(a => a.StorageNum == entity.StorageNum);
            }
            if (!entity.ContractOrder.IsEmpty())
            {
                entity.And("ContractOrder", ECondition.Like, "%" + entity.ContractOrder + "%");
            }
            if (entity.Status > 0)
            {
                entity.And(a => a.Status == entity.Status);
            }
            if (entity.BeginTime.IsNotEmpty())
            {
                DateTime Begin = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.AddMonths(-10)).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);
            }

            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            AdminEntity auditeUser = new AdminEntity();

            auditeUser.Include(a => new { AuditeUserName = a.UserName });
            entity.Left <AdminEntity>(auditeUser, new Params <string, string>()
            {
                Item1 = "AuditUser", Item2 = "UserNum"
            });

            int rowCount = 0;
            List <InventoryOrderEntity> listResult = this.InventoryOrder.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            return(listResult);
        }
Exemple #10
0
        /// <summary>
        ///     查询单据
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override OrdersEntity GetOrder(OrdersEntity entity)
        {
            entity.IncludeAll();
            var admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left(admin, new Params <string, string> {
                Item1 = "CreateUser", Item2 = "UserCode"
            });
            entity.Where(a => a.OrderNum == entity.OrderNum).And(a => a.IsDelete == (int)EIsDelete.NotDelete);
            entity = Orders.GetSingle(entity);
            return(entity);
        }
Exemple #11
0
        /// <summary>
        /// 检查用户名是否存在
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public bool IsExist(string userName)
        {
            AdminEntity entity = new AdminEntity();

            entity.Include(a => new { a.ID, a.UserCode, a.UserName, a.PassWord, a.Email, a.Phone, a.Mobile, a.RealName, a.RoleNum, a.DepartNum });
            entity.Where(a => a.UserName == userName).And(a => a.IsDelete == (int)EIsDelete.NotDelete);
            entity = this.Admin.GetSingle(entity);
            if (entity.IsNotNull())
            {
                return(true);
            }
            return(false);
        }
Exemple #12
0
        /// <summary>
        /// 查询单据
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override OutStorageEntity GetOrder(OutStorageEntity entity)
        {
            entity.IncludeAll();
            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserCode"
            });
            entity.Where(a => a.OrderNum == entity.OrderNum);
            entity = this.OutStorage.GetSingle(entity);
            return(entity);
        }
Exemple #13
0
        /// <summary>
        /// 查询单据
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override PurchaseEntity GetOrder(PurchaseEntity entity)
        {
            entity.IncludeAll();
            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID)
            .And(a => a.SnNum == entity.SnNum);
            entity = this.Purchase.GetSingle(entity);
            return(entity);
        }
Exemple #14
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);
        }
Exemple #15
0
        /// <summary>
        /// 查询单据分页
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public override List <ReturnOrderEntity> GetList(ReturnOrderEntity entity, ref Framework.DataTypes.PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            AdminEntity admin = new AdminEntity();

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

            pageInfo.RowCount = rowCount;
            return(listResult);
        }
Exemple #16
0
        /// <summary>
        /// 修改用户信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Update(AdminEntity entity)
        {
            entity.Include(a => new
            {
                a.RealName,
                a.Email,
                a.Mobile,
                a.Phone,
                a.DepartNum,
                a.ParentNum,
                a.RoleNum,
                a.Picture,
                a.Remark
            });
            entity.Where(a => a.UserNum == entity.UserNum);
            int line = this.Admin.Update(entity);

            return(line);
        }
        /// <summary>
        /// 查询财务应收应付
        /// </summary>
        /// <param name="SnNum"></param>
        /// <returns></returns>
        public FinanceBillEntity GetSingle(string SnNum)
        {
            FinanceBillEntity entity = new FinanceBillEntity();

            entity.IncludeAll();
            entity.Where(a => a.SnNum == SnNum)
            .And(a => a.CompanyID == this.CompanyID)
            .And(a => a.IsDelete == (int)EIsDelete.NotDelete)
            ;

            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            entity            = this.FinanceBill.GetSingle(entity);
            entity.LeavAmount = entity.Amount - entity.RealPayAmount;
            return(entity);
        }
Exemple #18
0
        /// <summary>
        /// 查询采购退货单分页列表
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public override List <PurchaseReturnEntity> GetList(PurchaseReturnEntity entity, ref Framework.DataTypes.PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID);
            entity.OrderBy(a => a.ID, EOrderBy.DESC);

            if (entity.OrderNum.IsNotEmpty())
            {
                entity.And("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%");
            }
            if (entity.SupNum.IsNotEmpty())
            {
                entity.And("SupNum", ECondition.Like, "%" + entity.SupNum + "%");
            }
            if (entity.SupName.IsNotEmpty())
            {
                entity.And("SupName", ECondition.Like, "%" + entity.SupName + "%");
            }
            if (entity.Contact.IsNotEmpty())
            {
                entity.And("Contact", ECondition.Like, "%" + entity.Contact + "%");
            }
            if (entity.Phone.IsNotEmpty())
            {
                entity.And("Phone", ECondition.Like, "%" + entity.Phone + "%");
            }
            if (entity.PurchaseSnNum.IsNotEmpty())
            {
                entity.And(item => item.PurchaseSnNum == entity.PurchaseSnNum);
            }
            if (entity.PurchaseOrderNum.IsNotEmpty())
            {
                entity.And("PurchaseOrderNum", ECondition.Like, "%" + entity.PurchaseOrderNum + "%");
            }
            if (entity.Status > 0)
            {
                entity.And(item => item.Status == entity.Status);
            }
            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);
            }

            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            int rowCount = 0;
            List <PurchaseReturnEntity> listResult = this.PurchaseReturn.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            return(listResult);
        }
Exemple #19
0
        /// <summary>
        /// 查询单据详细数据分页
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public override List <MoveOrderDetailEntity> GetDetailList(MoveOrderDetailEntity entity, ref Framework.DataTypes.PageInfo pageInfo)
        {
            MoveOrderDetailEntity detail = new MoveOrderDetailEntity();

            detail
            .And(a => a.CompanyID == this.CompanyID);

            if (entity.OrderSnNum.IsNotEmpty())
            {
                detail.And(item => item.OrderSnNum == entity.OrderSnNum);
            }
            if (entity.ProductName.IsNotEmpty())
            {
                detail.And("ProductName", ECondition.Like, "%" + entity.ProductName + "%");
            }
            if (entity.BarCode.IsNotEmpty())
            {
                detail.And("BarCode", ECondition.Like, "%" + entity.BarCode + "%");
            }
            detail.IncludeAll();
            detail.OrderBy(a => a.ID, EOrderBy.DESC);

            MoveOrderEntity moveOrder = new MoveOrderEntity();

            moveOrder.Include(item => new { Status = item.Status, MoveType = item.MoveType, AuditeTime = item.AuditeTime });
            detail.Left <MoveOrderEntity>(moveOrder, new Params <string, string>()
            {
                Item1 = "OrderSnNum", Item2 = "SnNum"
            });
            moveOrder.And(item => item.IsDelete == (int)EIsDelete.NotDelete);
            if (entity.OrderNum.IsNotEmpty())
            {
                moveOrder.And("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%");
            }
            if (entity.Status > 0)
            {
                moveOrder.And(item => item.Status == entity.Status);
            }
            if (entity.BeginTime.IsNotEmpty())
            {
                DateTime begin = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.AddDays(-10)).Date;
                moveOrder.And(item => item.CreateTime >= begin);
            }
            if (entity.EndTime.IsNotEmpty())
            {
                DateTime end = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now).AddDays(1).Date;
                moveOrder.And(item => item.CreateTime < end);
            }
            if (entity.MoveType > 0)
            {
                moveOrder.And(item => item.MoveType == entity.MoveType);
            }
            if (entity.StorageNum.IsNotEmpty())
            {
                moveOrder.And(item => item.StorageNum == entity.StorageNum);
            }

            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            moveOrder.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            AdminEntity auditeAdmin = new AdminEntity();

            auditeAdmin.Include(a => new { AuditUserName = a.UserName });
            moveOrder.Left <AdminEntity>(auditeAdmin, new Params <string, string>()
            {
                Item1 = "AuditUser", Item2 = "UserNum"
            });

            int rowCount = 0;
            List <MoveOrderDetailEntity> listResult = this.MoveOrderDetail.GetList(detail, 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 productProvider = new ProductProvider(this.CompanyID);
                foreach (MoveOrderDetailEntity item in listResult)
                {
                    LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.FromLocalNum);
                    item.FromLocalName = location == null ? "" : location.LocalName;
                    location           = listLocation.FirstOrDefault(a => a.LocalNum == item.ToLocalNum);
                    item.ToLocalName   = location == null ? "" : location.LocalName;
                    item.StorageName   = location == null ? "" : location.StorageName;

                    ProductEntity productEntity = productProvider.GetProduct(item.ProductNum);
                    item.UnitName = productEntity != null ? productEntity.ProductName : string.Empty;
                    item.Size     = productEntity != null ? productEntity.Size : string.Empty;
                }
            }
            return(listResult);
        }
Exemple #20
0
        /// <summary>
        /// 查询单据分页
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public override List <OutStorageEntity> GetList(OutStorageEntity entity, ref Framework.DataTypes.PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID)
            ;
            entity.OrderBy(a => a.ID, EOrderBy.DESC);

            if (!entity.OrderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%");
            }
            if (entity.StorageNum.IsNotEmpty())
            {
                entity.And(a => a.StorageNum == entity.StorageNum);
            }
            if (entity.OutType > 0)
            {
                entity.And(a => a.OutType == entity.OutType);
            }
            if (!entity.CusNum.IsEmpty())
            {
                entity.And("CusNum", ECondition.Like, "%" + entity.CusNum + "%");
            }
            if (!entity.CusName.IsEmpty())
            {
                entity.And("CusName", ECondition.Like, "%" + entity.CusName + "%");
            }
            if (!entity.Phone.IsEmpty())
            {
                entity.And("Phone", ECondition.Like, "%" + entity.Phone + "%");
            }
            if (!entity.ContractOrder.IsEmpty())
            {
                entity.And("ContractOrder", ECondition.Like, "%" + entity.ContractOrder + "%");
            }
            if (entity.Status > 0)
            {
                entity.And(a => a.Status == entity.Status);
            }
            if (entity.BeginTime.IsNotEmpty())
            {
                DateTime Begin = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.Date.AddMonths(-1));
                entity.And(a => a.CreateTime >= Begin);
            }
            if (entity.EndTime.IsNotEmpty())
            {
                DateTime End = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now.Date).AddDays(1);
                entity.And(a => a.CreateTime <= End);
            }
            if (!entity.CarrierNum.IsEmpty())
            {
                entity.And(item => item.CarrierNum == entity.CarrierNum);
            }
            if (!entity.CarrierName.IsEmpty())
            {
                entity.And("CarrierName", ECondition.Like, "%" + entity.CarrierName + "%");
            }
            if (!entity.LogisticsNo.IsEmpty())
            {
                entity.And("LogisticsNo", ECondition.Like, "%" + entity.LogisticsNo + "%");
            }

            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            AdminEntity auditeAdmin = new AdminEntity();

            auditeAdmin.Include(a => new { AuditeUserName = a.UserName });
            entity.Left <AdminEntity>(auditeAdmin, new Params <string, string>()
            {
                Item1 = "AuditUser", Item2 = "UserNum"
            });

            int rowCount = 0;
            List <OutStorageEntity> listResult = this.OutStorage.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            return(listResult);
        }
Exemple #21
0
        /// <summary>
        /// 查询单据分页
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public override List <SaleOrderEntity> GetList(SaleOrderEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID);
            entity.OrderBy(a => a.ID, EOrderBy.DESC);

            if (!entity.OrderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%");
            }
            if (entity.OrderType > 0)
            {
                entity.And(a => a.OrderType == entity.OrderType);
            }
            if (entity.CusNum.IsNotEmpty())
            {
                entity.Where("CusNum", ECondition.Like, "%" + entity.CusNum + "%");
            }
            if (entity.CusName.IsNotEmpty())
            {
                entity.Where("CusName", ECondition.Like, "%" + entity.CusName + "%");
            }
            if (entity.Contact.IsNotEmpty())
            {
                entity.Where("Contact", ECondition.Like, "%" + entity.Contact + "%");
            }
            if (entity.Phone.IsNotEmpty())
            {
                entity.Where("Phone", ECondition.Like, "%" + entity.Phone + "%");
            }
            if (!entity.ContractOrder.IsEmpty())
            {
                entity.And("ContractOrder", ECondition.Like, "%" + entity.ContractOrder + "%");
            }
            if (!entity.ContractSn.IsEmpty())
            {
                entity.And(item => item.ContractSn == entity.ContractSn);
            }
            if (entity.Status > 0)
            {
                entity.And(a => a.Status == entity.Status);
            }
            if (entity.AuditeStatus > -1)
            {
                entity.And(a => a.AuditeStatus == entity.AuditeStatus);
            }
            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);
            }

            if (entity.BeginOrderTime.IsNotEmpty())
            {
                DateTime Begin = ConvertHelper.ToType <DateTime>(entity.BeginOrderTime, DateTime.Now.AddDays(-30)).Date;
                entity.And(a => a.OrderTime >= Begin);
            }
            if (entity.EndOrderTime.IsNotEmpty())
            {
                DateTime End = ConvertHelper.ToType <DateTime>(entity.EndOrderTime, DateTime.Now).AddDays(1).Date;
                entity.And(a => a.OrderTime < End);
            }
            if (entity.BeginSendTime.IsNotEmpty())
            {
                DateTime Begin = ConvertHelper.ToType <DateTime>(entity.BeginSendTime, DateTime.Now.AddDays(-30)).Date;
                entity.And(a => a.SendDate >= Begin);
            }
            if (entity.EndSendTime.IsNotEmpty())
            {
                DateTime End = ConvertHelper.ToType <DateTime>(entity.EndSendTime, DateTime.Now).AddDays(1).Date;
                entity.And(a => a.SendDate < End);
            }
            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            int rowCount = 0;
            List <SaleOrderEntity> listResult = this.SaleOrder.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            return(listResult);
        }
Exemple #22
0
        /// <summary>
        /// 查询单据详细数据分页
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public override List <InStorDetailEntity> GetDetailList(InStorDetailEntity entity, ref PageInfo pageInfo)
        {
            InStorDetailEntity detail = new InStorDetailEntity();

            detail.IncludeAll();
            detail.OrderBy(a => a.ID, EOrderBy.DESC);
            detail.Where(a => a.CompanyID == this.CompanyID);

            if (!entity.BarCode.IsEmpty())
            {
                detail.And("BarCode", ECondition.Like, "%" + entity.BarCode + "%");
            }
            if (!entity.ProductName.IsEmpty())
            {
                detail.And("ProductName", ECondition.Like, "%" + entity.ProductName + "%");
            }
            if (!entity.StorageNum.IsEmpty())
            {
                detail.And(a => a.StorageNum == entity.StorageNum);
            }

            ProductEntity product = new ProductEntity();

            product.Include(item => new { Size = item.Size });
            detail.Left <ProductEntity>(product, new Params <string, string>()
            {
                Item1 = "ProductNum", Item2 = "SnNum"
            });

            InStorageEntity InOrder = new InStorageEntity();

            InOrder.Include(a => new { OrderNum = a.OrderNum, SupNum = a.SupNum, SupName = a.SupName, OrderTime = a.OrderTime, Status = a.Status, InType = a.InType, AuditeTime = a.AuditeTime });
            detail.Left <InStorageEntity>(InOrder, new Params <string, string>()
            {
                Item1 = "OrderSnNum", Item2 = "SnNum"
            });
            InOrder.And(a => a.IsDelete == (int)EIsDelete.NotDelete);
            if (!entity.SupNum.IsEmpty())
            {
                InOrder.AndBegin <InStorageEntity>()
                .And <InStorageEntity>("SupNum", ECondition.Like, "%" + entity.SupNum + "%")
                .Or <InStorageEntity>("SupName", ECondition.Like, "%" + entity.SupNum + "%")
                .End <InStorageEntity>()
                ;
            }
            if (!entity.SupName.IsEmpty())
            {
                InOrder.AndBegin <InStorageEntity>()
                .And <InStorageEntity>("SupNum", ECondition.Like, "%" + entity.SupName + "%")
                .Or <InStorageEntity>("SupName", ECondition.Like, "%" + entity.SupName + "%")
                .End <InStorageEntity>()
                ;
            }
            if (!entity.BeginTime.IsEmpty())
            {
                DateTime time = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.Date.AddDays(-1));
                InOrder.And(a => a.CreateTime >= time);
            }
            if (!entity.EndTime.IsEmpty())
            {
                DateTime time = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now.Date.AddDays(1));
                InOrder.And(a => a.CreateTime < time);
            }
            if (entity.Status > 0)
            {
                InOrder.And(item => item.Status == entity.Status);
            }
            if (entity.CreateUser.IsNotEmpty())
            {
                InOrder.And(item => item.CreateUser == entity.CreateUser);
            }
            if (entity.InType > 0)
            {
                InOrder.And(item => item.InType == entity.InType);
            }
            if (entity.OrderNum.IsNotEmpty())
            {
                InOrder.And("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%");
            }
            if (entity.ContractOrder.IsNotEmpty())
            {
                InOrder.And("ContractOrder", ECondition.Like, "%" + entity.ContractOrder + "%");
            }
            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            InOrder.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            AdminEntity auditeUser = new AdminEntity();

            auditeUser.Include(a => new { AuditeUserName = a.UserName });
            InOrder.Left <AdminEntity>(auditeUser, new Params <string, string>()
            {
                Item1 = "AuditUser", Item2 = "UserNum"
            });

            int rowCount = 0;
            List <InStorDetailEntity> listResult = this.InStorDetail.GetList(detail, 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;
                foreach (InStorDetailEntity item in listResult)
                {
                    LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.LocalNum);
                    item.LocalName   = location == null ? "" : location.LocalName;
                    item.StorageName = location == null ? "" : location.StorageName;
                }
            }
            return(listResult);
        }
        /// <summary>
        /// 查询财务应收应付分页列表
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <FinanceBillEntity> GetList(FinanceBillEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);

            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID)
            ;
            if (entity.BillNum.IsNotEmpty())
            {
                entity.Where("BillNum", ECondition.Like, "%" + entity.BillNum + "%");
            }
            if (entity.BillType > 0)
            {
                entity.And(a => a.BillType == entity.BillType);
            }
            if (entity.CateNum.IsNotEmpty())
            {
                entity.And(a => a.CateNum == entity.CateNum);
            }
            if (entity.Title.IsNotEmpty())
            {
                entity.And("Title", ECondition.Like, "%" + entity.Title + "%");
            }
            if (entity.ContractNum.IsNotEmpty())
            {
                entity.And("ContractNum", ECondition.Like, "%" + entity.ContractNum + "%");
            }
            if (entity.Status > 0)
            {
                entity.And(a => a.Status == entity.Status);
            }
            if (entity.BeginTime.IsNotEmpty())
            {
                DateTime dateTime = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.AddDays(-1));
                entity.And(a => a.CreateTime >= dateTime);
            }
            if (entity.EndTime.IsNotEmpty())
            {
                DateTime dateTime = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now).AddDays(1).Date;
                entity.And(a => a.CreateTime < dateTime);
            }
            if (entity.FromNum.IsNotEmpty())
            {
                entity.And(item => item.FromNum == entity.FromNum);
            }
            if (entity.FromName.IsNotEmpty())
            {
                entity.And("FromName", ECondition.Like, "%" + entity.FromName + "%");
            }
            if (entity.ToNum.IsNotEmpty())
            {
                entity.And(item => item.ToNum == entity.ToNum);
            }
            if (entity.ToName.IsNotEmpty())
            {
                entity.And("ToName", ECondition.Like, "%" + entity.ToName + "%");
            }
            int rowCount = 0;
            List <FinanceBillEntity> listResult = this.FinanceBill.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            if (!listResult.IsNullOrEmpty())
            {
                listResult.ForEach(a =>
                {
                    a.LeavAmount = a.Amount - a.RealPayAmount;
                });
            }
            return(listResult);
        }