OutPutDataController.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using Cksoft.Data;
  2. using Cksoft.Data.Repository;
  3. using DllEapDal.OFILM;
  4. using DllEapEntity.Dtos;
  5. using DllEapEntity.OFILM;
  6. using Microsoft.AspNetCore.Authorization;
  7. using Microsoft.AspNetCore.Mvc;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Text;
  11. namespace DllEapBll.Controllers
  12. {
  13. /// <summary>
  14. /// 产量视图查询
  15. /// </summary>
  16. [Route("eap/api/[controller]/[action]")]
  17. [ApiController]
  18. [Authorize]
  19. public class OutPutDataController : ControllerBase
  20. {
  21. /// <summary>
  22. /// 产量视图查询
  23. /// </summary>
  24. /// <param name="fcode"></param>
  25. /// <param name="start"></param>
  26. /// <param name="end"></param>
  27. /// <param name="recipe"></param>
  28. /// <param name="pageIndex"></param>
  29. /// <param name="pageSize"></param>
  30. /// <returns></returns>
  31. [HttpGet]
  32. public LayuiModel<OutPutData> Get(string fcode, DateTime? start, DateTime? end, string recipe, int pageIndex = 1, int pageSize = 20)
  33. {
  34. if (!end.HasValue)
  35. {
  36. end = DateTime.Now;
  37. }
  38. if (!start.HasValue)
  39. {
  40. start = DateTime.Parse(end.Value.ToString("yyyy-MM-dd 00:00:00"));
  41. }
  42. using (IDatabase db = DbFactory.Base("eap"))
  43. {
  44. var dal = new OutPutDataDal(db);
  45. return dal.Get(fcode, start.Value, end.Value, recipe, pageIndex, pageSize);
  46. }
  47. }
  48. /// <summary>
  49. ///
  50. /// </summary>
  51. /// <param name="fcode"></param>
  52. /// <param name="start"></param>
  53. /// <param name="end"></param>
  54. /// <param name="recipe"></param>
  55. /// <param name="pageIndex"></param>
  56. /// <param name="pageSize"></param>
  57. /// <returns></returns>
  58. [HttpGet]
  59. public LayuiModel<OutPutData> GetCount(string fcode, DateTime? start, DateTime? end, string recipe, int pageIndex = 1, int pageSize = 20)
  60. {
  61. /*var dall = new MacOutPutTimeDal();
  62. dall.SetData();*/
  63. if (!end.HasValue)
  64. {
  65. end = DateTime.Now;
  66. }
  67. if (!start.HasValue)
  68. {
  69. start = DateTime.Parse(end.Value.ToString("yyyy-MM-dd 00:00:00"));
  70. }
  71. using (IDatabase db = DbFactory.Base("eap"))
  72. {
  73. var dal = new OutPutDataDal(db);
  74. return dal.GetCount(fcode, start.Value, end.Value, recipe, pageIndex, pageSize);
  75. }
  76. }
  77. }
  78. }