BillBomInfoController.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using Microsoft.AspNetCore.Mvc;
  2. using Newtonsoft.Json;
  3. using WMS.BZModels.Dto.FJ.BillBom;
  4. using WMS.BZServices.FJ;
  5. using WMS.Info;
  6. namespace WMS.BZWeb.Areas.FJManager.Controllers
  7. {
  8. [Area("FJManager")]
  9. public class BillBomInfoController : MvcControllerBase
  10. {
  11. private readonly BillBomInfoService _billBomInfoService;
  12. public BillBomInfoController(BillBomInfoService billBomInfoService)
  13. {
  14. _billBomInfoService = billBomInfoService;
  15. }
  16. #region 视图功能
  17. public IActionResult Index()
  18. {
  19. return View();
  20. }
  21. public IActionResult Form()
  22. {
  23. return View();
  24. }
  25. public IActionResult SelectForm()
  26. {
  27. return View();
  28. }
  29. #endregion
  30. public ActionResult GetPageList(string pagination, string queryJson)
  31. {
  32. Pagination paginationobj = InitPagination(pagination);
  33. var query = new BillBominfoQueryDto();
  34. if (!string.IsNullOrEmpty(queryJson))
  35. {
  36. query = JsonConvert.DeserializeObject<BillBominfoQueryDto>(queryJson);
  37. }
  38. var lists = _billBomInfoService.GetPageList(paginationobj, query ?? new BillBominfoQueryDto());
  39. var jsonData = new
  40. {
  41. rows = lists.Result,
  42. total = lists.TotalPage,
  43. page = lists.PageIndex,
  44. records = lists.TotalNum
  45. };
  46. return Success(jsonData);
  47. }
  48. public ActionResult GetList(string queryJson)
  49. {
  50. var query = new BillBominfoQueryDto();
  51. if (!string.IsNullOrEmpty(queryJson))
  52. {
  53. query = JsonConvert.DeserializeObject<BillBominfoQueryDto>(queryJson);
  54. }
  55. var lists = _billBomInfoService.GetList(query ?? new BillBominfoQueryDto());
  56. if (lists != null && lists.Any())
  57. {
  58. var listresult= lists.Where(o => o.Code == query?.Code).ToList();
  59. return Success(listresult);
  60. }
  61. return Success(lists);
  62. }
  63. }
  64. }