/// <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); }
/// <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); }
/// <summary> /// 查询单据分页 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public override List <MoveOrderEntity> GetList(MoveOrderEntity 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.MoveType > 0) { entity.And(a => a.MoveType == entity.MoveType); } 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.AddDays(-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" }); int rowCount = 0; List <MoveOrderEntity> listResult = this.MoveOrder.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; return(listResult); }
/// <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); }
/// <summary> /// 采购退货单明细分页列表 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public override List <PurchaseReturnDetailEntity> GetDetailList(PurchaseReturnDetailEntity entity, ref Framework.DataTypes.PageInfo pageInfo) { PurchaseReturnDetailEntity detail = new PurchaseReturnDetailEntity(); detail.And(a => a.CompanyID == this.CompanyID) ; if (!entity.OrderSnNum.IsEmpty()) { detail.And(a => a.OrderSnNum == entity.OrderSnNum); } if (!entity.BarCode.IsEmpty()) { detail.And("BarCode", ECondition.Like, "%" + entity.BarCode + "%"); } if (!entity.ProductName.IsEmpty()) { detail.And("ProductName", ECondition.Like, "%" + entity.ProductName + "%"); } PurchaseReturnEntity returnOrder = new PurchaseReturnEntity(); detail.Left <PurchaseReturnEntity>(returnOrder, new Params <string, string>() { Item1 = "OrderSnNum", Item2 = "SnNum" }); returnOrder.Include(a => new { SupNum = a.SupNum, SupName = a.SupName, Phone = a.Phone, Contact = a.Contact, PurchaseSnNum = a.PurchaseSnNum, PurchaseOrderNum = a.PurchaseOrderNum, Status = a.Status }); returnOrder.And(a => a.IsDelete == (int)EIsDelete.NotDelete); if (!entity.SupNum.IsEmpty()) { returnOrder.AndBegin <PurchaseReturnEntity>() .And <PurchaseReturnEntity>("SupNum", ECondition.Like, "%" + entity.SupNum + "%") .Or <PurchaseReturnEntity>("SupName", ECondition.Like, "%" + entity.SupNum + "%") .End <PurchaseReturnEntity>() ; } if (!entity.SupName.IsEmpty()) { returnOrder.AndBegin <PurchaseReturnEntity>() .And <PurchaseReturnEntity>("SupNum", ECondition.Like, "%" + entity.SupName + "%") .Or <PurchaseReturnEntity>("SupName", ECondition.Like, "%" + entity.SupName + "%") .End <PurchaseReturnEntity>() ; } if (!entity.Phone.IsEmpty()) { returnOrder.And("Phone", ECondition.Like, "%" + entity.Phone + "%"); } if (!entity.PurchaseSnNum.IsEmpty()) { returnOrder.And(item => item.PurchaseSnNum == entity.PurchaseSnNum); } if (!entity.PurchaseOrderNum.IsEmpty()) { returnOrder.And("PurchaseOrderNum", ECondition.Like, "%" + entity.PurchaseOrderNum + "%"); } if (!entity.BeginTime.IsEmpty()) { DateTime time = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.Date.AddDays(-1)); returnOrder.And(a => a.CreateTime >= time); } if (!entity.EndTime.IsEmpty()) { DateTime time = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now.Date.AddDays(1)); returnOrder.And(a => a.CreateTime < time); } if (entity.Status > 0) { returnOrder.And(item => item.Status == entity.Status); } detail.IncludeAll(); detail.Exclude(item => new { item.Status }); detail.OrderBy(a => a.ID, EOrderBy.DESC); int rowCount = 0; List <PurchaseReturnDetailEntity> listResult = this.PurchaseReturnDetail.GetList(detail, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; if (!listResult.IsNullOrEmpty()) { ProductProvider productProvider = new ProductProvider(this.CompanyID); foreach (PurchaseReturnDetailEntity item in listResult) { ProductEntity product = productProvider.GetProduct(item.ProductNum); item.UnitName = product != null ? product.UnitName : string.Empty; item.Size = product != null ? product.Size : string.Empty; } } return(listResult); }
/// <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); }
/// <summary> /// 查询单据详细数据分页 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public override List <OutStoDetailEntity> GetDetailList(OutStoDetailEntity entity, ref Framework.DataTypes.PageInfo pageInfo) { OutStoDetailEntity detail = new OutStoDetailEntity(); detail.Where(a => a.OrderNum == entity.OrderNum); detail.IncludeAll(); detail.OrderBy(a => a.ID, EOrderBy.DESC); int rowCount = 0; List <OutStoDetailEntity> listResult = this.OutStoDetail.GetList(detail, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; if (!listResult.IsNullOrEmpty()) { List <LocationEntity> listLocation = new LocationProvider().GetList(); listLocation = listLocation == null ? new List <LocationEntity>() : listLocation; foreach (OutStoDetailEntity item in listResult) { LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.LocalNum); item.LocalName = location == null ? "" : location.LocalName; if (item.Amount == 0) { item.Amount = item.OutPrice * item.Num; } } } return(listResult); }
/// <summary> /// 查询单据详细数据分页 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public override List <OrderDetailEntity> GetDetailList(OrderDetailEntity entity, ref Framework.DataTypes.PageInfo pageInfo) { OrderDetailEntity detail = new OrderDetailEntity(); detail.Where(a => a.OrderNum == entity.OrderNum); detail.IncludeAll(); detail.OrderBy(a => a.ID, EOrderBy.DESC); int rowCount = 0; List <OrderDetailEntity> listResult = this.OrderDetail.GetList(detail, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; return(listResult); }
/// <summary> /// 查询单据详细数据分页 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public override List <OutStoDetailEntity> GetDetailList(OutStoDetailEntity entity, ref Framework.DataTypes.PageInfo pageInfo) { OutStoDetailEntity detail = new OutStoDetailEntity(); detail.IncludeAll(); detail.OrderBy(a => a.ID, EOrderBy.DESC); detail.And(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); } OutStorageEntity OutOrder = new OutStorageEntity(); detail.Left <OutStorageEntity>(OutOrder, new Params <string, string>() { Item1 = "OrderSnNum", Item2 = "SnNum" }); OutOrder.Include(a => new { CusNum = a.CusNum, CusName = a.CusName, SendDate = a.SendDate, Status = a.Status, OutType = a.OutType, AuditeTime = a.AuditeTime, CarrierName = a.CarrierName, LogisticsNo = a.LogisticsNo }); OutOrder.And(a => a.IsDelete == (int)EIsDelete.NotDelete); if (!entity.CusNum.IsEmpty()) { OutOrder.AndBegin <OutStorageEntity>() .And <OutStorageEntity>("CusNum", ECondition.Like, "%" + entity.CusNum + "%") .Or <OutStorageEntity>("CusName", ECondition.Like, "%" + entity.CusNum + "%") .End <OutStorageEntity>() ; } if (!entity.CusName.IsEmpty()) { OutOrder.AndBegin <OutStorageEntity>() .And <OutStorageEntity>("CusNum", ECondition.Like, "%" + entity.CusName + "%") .Or <OutStorageEntity>("CusName", ECondition.Like, "%" + entity.CusName + "%") .End <OutStorageEntity>() ; } if (!entity.BeginTime.IsEmpty()) { DateTime time = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.Date.AddDays(30)).Date; OutOrder.And(a => a.CreateTime >= time); } if (!entity.EndTime.IsEmpty()) { DateTime time = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now).Date.AddDays(1); OutOrder.And(a => a.CreateTime < time); } if (entity.Status > 0) { OutOrder.And(item => item.Status == entity.Status); } if (entity.OutType > 0) { OutOrder.And(item => item.OutType == entity.OutType); } if (entity.OrderNum.IsNotEmpty()) { OutOrder.And("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%"); } if (!entity.CarrierNum.IsEmpty()) { OutOrder.And(item => item.CarrierNum == entity.CarrierNum); } if (!entity.CarrierName.IsEmpty()) { OutOrder.And("CarrierName", ECondition.Like, "%" + entity.CarrierName + "%"); } if (!entity.LogisticsNo.IsEmpty()) { OutOrder.And("LogisticsNo", ECondition.Like, "%" + entity.LogisticsNo + "%"); } ProductEntity product = new ProductEntity(); product.Include(item => new { Size = item.Size }); detail.Left <ProductEntity>(product, new Params <string, string>() { Item1 = "ProductNum", Item2 = "SnNum" }); AdminEntity admin = new AdminEntity(); admin.Include(a => new { CreateUserName = a.UserName }); OutOrder.Left <AdminEntity>(admin, new Params <string, string>() { Item1 = "CreateUser", Item2 = "UserNum" }); AdminEntity auditeAdmin = new AdminEntity(); auditeAdmin.Include(a => new { AuditeUserName = a.UserName }); OutOrder.Left <AdminEntity>(auditeAdmin, new Params <string, string>() { Item1 = "AuditUser", Item2 = "UserNum" }); int rowCount = 0; List <OutStoDetailEntity> listResult = this.OutStoDetail.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 (OutStoDetailEntity 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 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); }