using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Common.TeachingMaterial; using EMIS.ViewModel.TeachingMaterial; using Bowin.Common.Linq.Entity; using EMIS.ViewModel; namespace EMIS.CommonLogic.TeachingMaterial { public class StockOutDetailServices : BaseServices, IStockOutDetailServices { public StockOutDetailDAL StockOutDetailDAL { get; set; } public IGridResultSet GetStockOutDetailViewGrid(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, DateTime? stockOutTimeStart, DateTime? stockOutTimeEnd, int pageIndex, int pageSize) { var query = StockOutDetailDAL.GetStockOutDetailGridView(x => true); query = query.Where(x => x.RecordStatus == (int)CF_GeneralPurpose.IsYes);//提取提交的统计数据 if (schoolyearID.HasValue) query = query.Where(x => x.SchoolyearID == schoolyearID); if (supplierID.HasValue) query = query.Where(x => x.SupplierID == supplierID); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet(pageIndex, pageSize); return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet(pageIndex, pageSize); } public IList GetStockOutDetailViewList(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, DateTime? stockOutTimeStart, DateTime? stockOutTimeEnd) { var query = StockOutDetailDAL.GetStockOutDetailGridView(x => x.RecordStatus == (int)CF_GeneralPurpose.IsYes); if (schoolyearID.HasValue) query = query.Where(x => x.SchoolyearID == schoolyearID); if (supplierID.HasValue) query = query.Where(x => x.SupplierID == supplierID); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList(); return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList(); } public IGridResultSet GetStockOutStatisticsViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, Guid? teachingMaterialID, int? teachingMaterialType,int? stockOutType, int pageIndex, int pageSize) { var query = StockOutDetailDAL.GetStockOutStatisticsGridView(x => x.RecordStatus == (int)CF_GeneralPurpose.IsYes);//提取提交的统计数据 if (stockOutType>0) query = query.Where(x => x.StockOutTypeID == stockOutType); if (schoolyearID.HasValue) query = query.Where(x => x.SchoolyearID == schoolyearID); if (supplierID.HasValue) query = query.Where(x => x.SupplierID == supplierID); if (teachingMaterialID.HasValue) query = query.Where(x => x.TeachingMaterialPoolID == teachingMaterialID); if (teachingMaterialType.HasValue) query = query.Where(x => x.StockOutTypeID == teachingMaterialType); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue). OrderBy(x => x.SchoolyearName).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet(pageIndex, pageSize); return query.OrderBy(x => x.SchoolyearName). ThenBy(x => x.TeachingMaterialCode).ToGridResultSet(pageIndex, pageSize); } public IList GetStockOutStatisticsViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, Guid? teachingMaterialID, int? teachingMaterialType,int? stockOutType) { var query = StockOutDetailDAL.GetStockOutStatisticsGridView(x => x.RecordStatus == (int)CF_GeneralPurpose.IsYes);//提取提交的统计数据 if (stockOutType > 0) query = query.Where(x => x.StockOutTypeID == stockOutType); if (schoolyearID.HasValue) query = query.Where(x => x.SchoolyearID == schoolyearID); if (supplierID.HasValue) query = query.Where(x => x.SupplierID == supplierID); if (teachingMaterialID.HasValue) query = query.Where(x => x.TeachingMaterialPoolID == teachingMaterialID); if (teachingMaterialType.HasValue) query = query.Where(x => x.StockOutTypeID == teachingMaterialType); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList(); return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList(); } } }