StockInDetailServices.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Common.TeachingMaterial;
  6. using EMIS.ViewModel.TeachingMaterial;
  7. using Bowin.Common.Linq.Entity;
  8. using EMIS.ViewModel;
  9. namespace EMIS.CommonLogic.TeachingMaterial
  10. {
  11. public class StockInDetailServices : BaseServices, IStockInDetailServices
  12. {
  13. public StockInDetailDAL StockInDetailDAL { get; set; }
  14. /// <summary>
  15. /// 加载列表项数据
  16. /// </summary>
  17. public IGridResultSet<StockInView> GetStockInDetailViewGrid(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, Guid? teachingMaterialID, int pageIndex, int pageSize)
  18. {
  19. var query = StockInDetailDAL.GetStockInDetailGridView(x => true);
  20. if (schoolyearID.HasValue)
  21. query = query.Where(x => x.SchoolyearID == schoolyearID);
  22. if (supplierID.HasValue)
  23. query = query.Where(x => x.SupplierID == supplierID);
  24. if (teachingMaterialID.HasValue)
  25. query = query.Where(x => x.TeachingMaterialPoolID == teachingMaterialID);
  26. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  27. return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet<StockInView>(pageIndex, pageSize);
  28. return query.OrderBy(x => x.TeachingMaterialCode).ToGridResultSet<StockInView>(pageIndex, pageSize);
  29. }
  30. /// <summary>
  31. /// Excel导出
  32. /// </summary>
  33. public IList<StockInView> GetStockInDetailViewList(ViewModel.ConfiguretView configuretView, Guid? stockId)
  34. {
  35. var query = StockInDetailDAL.GetStockInDetailGridView(x => x.StockInID == stockId);
  36. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  37. return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList();
  38. return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList();
  39. }
  40. /// <summary>
  41. /// 删除明细数据
  42. /// </summary>
  43. /// <param name="stockInDetailIDs"></param>
  44. public void Delete(List<Guid> stockInDetailIDs)
  45. {
  46. StockInDetailDAL.Delete(stockInDetailIDs);
  47. }
  48. public IList<StockInView> GetStockInDetailByStockInViewGrid(Guid? stockIn){
  49. return StockInDetailDAL.GetStockInDetailGridView(x => x.StockInID == stockIn).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList();
  50. }
  51. public IGridResultSet<StockInView> GetStockInDetailViewGrid(Guid? stockIn, int pageIndex, int pageSize)
  52. {
  53. var query = StockInDetailDAL.GetStockInDetailGridView(x => x.StockInID == stockIn);
  54. return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x=>x.TeachingMaterialCode).ToGridResultSet<StockInView>(pageIndex, pageSize);
  55. }
  56. public IList<StockInView> GetStockInDetailViewList(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, DateTime? stockInDJTimeStart, DateTime? stockInDJTimeEnd)
  57. {
  58. var query = StockInDetailDAL.GetStockInDetailGridView(x => true);
  59. if (schoolyearID.HasValue)
  60. query = query.Where(x => x.SchoolyearID == schoolyearID);
  61. if (supplierID.HasValue)
  62. query = query.Where(x => x.SupplierID == supplierID);
  63. //if (stockInDJTimeStart.HasValue)
  64. // query = query.Where(x => x.StockInDJTime >= stockInDJTimeStart);
  65. //if (stockInDJTimeEnd.HasValue)
  66. // query = query.Where(x => x.StockInDJTime <= stockInDJTimeEnd);
  67. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  68. return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.StockInTime).ToList();
  69. return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList();
  70. }
  71. public IGridResultSet<StockInView> GetStockInStatisticsViewGrid(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, Guid? teachingMaterialID, int pageIndex, int pageSize)
  72. {
  73. var query = StockInDetailDAL.GetStockInStatisticsGridView(x => x.RecordStatus == (int)CF_GeneralPurpose.IsYes);
  74. if (schoolyearID.HasValue)
  75. query = query.Where(x => x.SchoolyearID == schoolyearID);
  76. if (supplierID.HasValue)
  77. query = query.Where(x => x.SupplierID == supplierID);
  78. if (teachingMaterialID.HasValue)
  79. query = query.Where(x => x.TeachingMaterialPoolID == teachingMaterialID);
  80. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  81. return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode).ToGridResultSet<StockInView>(pageIndex, pageSize);
  82. return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet<StockInView>(pageIndex, pageSize);
  83. }
  84. public IList<StockInView> GetStockInStatisticsVieList(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, Guid? teachingMaterialID)
  85. {
  86. var query = StockInDetailDAL.GetStockInStatisticsGridView(x => x.RecordStatus == (int)CF_GeneralPurpose.IsYes);
  87. if (schoolyearID.HasValue)
  88. query = query.Where(x => x.SchoolyearID == schoolyearID);
  89. if (supplierID.HasValue)
  90. query = query.Where(x => x.SupplierID == supplierID);
  91. if (teachingMaterialID.HasValue)
  92. query = query.Where(x => x.TeachingMaterialPoolID == teachingMaterialID);
  93. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  94. return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode).ToList();
  95. return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList();
  96. }
  97. }
  98. }