WCSPalletizingController.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using Microsoft.AspNetCore.Mvc;
  2. using Newtonsoft.Json;
  3. using WMS.BZModels;
  4. using WMS.BZModels.Dto.FJ.WCSCachelineDtos;
  5. using WMS.BZModels.Dto.FJ.WCSPalletizingDtos;
  6. using WMS.BZServices.FJ;
  7. using WMS.Info;
  8. using WMS.Util;
  9. namespace WMS.BZWeb.Areas.FJManager.Controllers
  10. {
  11. [Area("FJManager")]
  12. public class WCSPalletizingController : MvcControllerBase
  13. {
  14. private readonly WCSPalletizingService _WCSPalletizingServiceService;
  15. private readonly WCSPalletizingDtlService _WCSPalletizingDtlService;
  16. public WCSPalletizingController(WCSPalletizingService wCSPalletizingServiceService, WCSPalletizingDtlService wCSPalletizingDtlService)
  17. {
  18. _WCSPalletizingServiceService = wCSPalletizingServiceService;
  19. _WCSPalletizingDtlService = wCSPalletizingDtlService;
  20. }
  21. #region 视图功能
  22. public IActionResult Index()
  23. {
  24. return View();
  25. }
  26. public IActionResult Form()
  27. {
  28. return View();
  29. }
  30. public IActionResult PalleCodeForm()
  31. {
  32. return View();
  33. }
  34. #endregion
  35. public ActionResult GetPageList(string pagination, string queryJson)
  36. {
  37. Pagination paginationobj = InitPagination(pagination);
  38. var query = new WCSPalletizingQueryDto();
  39. if (!string.IsNullOrEmpty(queryJson))
  40. {
  41. query = JsonConvert.DeserializeObject<WCSPalletizingQueryDto>(queryJson);
  42. }
  43. var lists = _WCSPalletizingServiceService.GetPageList(paginationobj, query ?? new WCSPalletizingQueryDto());
  44. var jsonData = new
  45. {
  46. rows = lists.Result,
  47. total = lists.TotalPage,
  48. page = lists.PageIndex,
  49. records = lists.TotalNum
  50. };
  51. return Success(jsonData);
  52. }
  53. public ActionResult GetPalletizingItem(string palletizingId)
  54. {
  55. if (string.IsNullOrEmpty(palletizingId))
  56. {
  57. return Fail("码垛id不能为空");
  58. }
  59. var list = _WCSPalletizingDtlService.GetDtlById(Convert.ToInt32(palletizingId));
  60. return Success(list);
  61. }
  62. [HttpPost]
  63. public ActionResult UpdateFinish(string ids, int state)
  64. {
  65. if (string.IsNullOrEmpty(ids))
  66. {
  67. return Fail("没有选择任务!");
  68. }
  69. var lists = JsonConvert.DeserializeObject<List<string>>(ids);
  70. var userid = WebUtil.GetItem("userId");
  71. _WCSPalletizingServiceService.UpdateFinish(lists, userid?.ToString(), state);
  72. return Success("修改成功!");
  73. }
  74. [HttpPost]
  75. public ActionResult UpdatePalleCode(string ids, string palleCode)
  76. {
  77. if (string.IsNullOrEmpty(ids))
  78. {
  79. return Fail("没有选择任务!");
  80. }
  81. if (string.IsNullOrEmpty(palleCode))
  82. {
  83. return Fail("托盘条码不能为空!");
  84. }
  85. var lists = JsonConvert.DeserializeObject<List<string>>(ids);
  86. var userid = WebUtil.GetItem("userId");
  87. _WCSPalletizingServiceService.UpdatePalleCode(lists, userid?.ToString(), palleCode);
  88. return Success("修改成功!");
  89. }
  90. [HttpPost]
  91. public ActionResult PalletizingStation(string ids)
  92. {
  93. if (string.IsNullOrEmpty(ids))
  94. {
  95. return Fail("没有选择跺型!");
  96. }
  97. var lists = JsonConvert.DeserializeObject<List<string>>(ids);
  98. var userid = WebUtil.GetItem("userId");
  99. _WCSPalletizingServiceService.PalletizingStation(lists, userid?.ToString());
  100. return Success("保存成功!");
  101. }
  102. }
  103. }