WCSCachelineController.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using Microsoft.AspNetCore.Mvc;
  2. using Newtonsoft.Json;
  3. using WMS.BZModels.Dto.FJ.WCSCachelineDtos;
  4. using WMS.BZServices.FJ;
  5. using WMS.Info;
  6. namespace WMS.BZWeb.Areas.FJManager.Controllers
  7. {
  8. [Area("FJManager")]
  9. public class WCSCachelineController : MvcControllerBase
  10. {
  11. private readonly WCSCachelineService _WCSCachelineService;
  12. private readonly WCSCachelinelocService _WCSCachelinelocService;
  13. public WCSCachelineController(WCSCachelineService wCSCachelineService, WCSCachelinelocService wCSCachelinelocService)
  14. {
  15. _WCSCachelineService = wCSCachelineService;
  16. _WCSCachelinelocService = wCSCachelinelocService;
  17. }
  18. #region 视图功能
  19. public IActionResult Index()
  20. {
  21. return View();
  22. }
  23. #endregion
  24. public ActionResult GetPageList(string pagination, string queryJson)
  25. {
  26. Pagination paginationobj = InitPagination(pagination);
  27. var query = new WCSCachelineQueryDto();
  28. if (!string.IsNullOrEmpty(queryJson))
  29. {
  30. query = JsonConvert.DeserializeObject<WCSCachelineQueryDto>(queryJson);
  31. }
  32. var lists = _WCSCachelineService.GetPageList(paginationobj, query ?? new WCSCachelineQueryDto());
  33. var jsonData = new
  34. {
  35. rows = lists.Result,
  36. total = lists.TotalPage,
  37. page = lists.PageIndex,
  38. records = lists.TotalNum
  39. };
  40. return Success(jsonData);
  41. }
  42. public ActionResult GetCachelineItem(string cachelineId)
  43. {
  44. if (string.IsNullOrEmpty(cachelineId))
  45. {
  46. return Fail("缓存id不能为空");
  47. }
  48. var list = _WCSCachelinelocService.GetDtlById(Convert.ToInt32(cachelineId));
  49. return Success(list);
  50. }
  51. [HttpPost]
  52. public ActionResult Delete(string ids)
  53. {
  54. if (string.IsNullOrEmpty(ids))
  55. {
  56. return Fail("没有选择数据!");
  57. }
  58. var lists = JsonConvert.DeserializeObject<List<int>>(ids);
  59. _WCSCachelineService.Delete(lists);
  60. return Success("删除成功。");
  61. }
  62. [HttpPost]
  63. public ActionResult UpdateOvertime(string ids)
  64. {
  65. if (string.IsNullOrEmpty(ids))
  66. {
  67. return Fail("没有选择数据!");
  68. }
  69. var lists = JsonConvert.DeserializeObject<List<int>>(ids);
  70. _WCSCachelineService.UpdateOvertime(lists);
  71. return Success("更新成功。");
  72. }
  73. }
  74. }