WcsDeviceInfoController.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using Newtonsoft.Json;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6. using Microsoft.AspNetCore.Mvc;using WMS.BZWeb;
  7. using WMS.Core;
  8. using WMS.Core.ServiceCore;
  9. using WMS.Info;
  10. namespace WMS.BZWeb
  11. {
  12. [Area("WCSManager")]
  13. public class WcsDeviceInfoController : MvcControllerBase
  14. {
  15. WcsDeviceInfoService bll = new WcsDeviceInfoService();
  16. WcsDeviceprotocolService deviceprotocolService = new WcsDeviceprotocolService();
  17. #region 视图功能
  18. // GET: WCSManager/WcsDeviceInfo
  19. public ActionResult Index()
  20. {
  21. return View();
  22. }
  23. /// <summary>
  24. /// 表单页
  25. /// <summary>
  26. /// <returns></returns>
  27. [HttpGet]
  28. public ActionResult Form()
  29. {
  30. return View();
  31. }
  32. public ActionResult GenerateDeviceForm()
  33. {
  34. return View();
  35. }
  36. #endregion
  37. /// <summary>
  38. ///
  39. /// </summary>
  40. /// <returns></returns>
  41. [HttpGet]
  42. ////[AjaxOnly]
  43. public ActionResult GetSelectDeviceNameList()
  44. {
  45. return Success(bll.GetSelectDeviceNameList());
  46. }
  47. #region 获取数据
  48. /// <summary>
  49. /// 获取页面显示列表数据
  50. /// </summary>
  51. /// <param name="pagination">分页参数</param>
  52. /// <param name="queryJson">查询参数</param>
  53. /// <returns></returns>
  54. [HttpGet]
  55. ////[AjaxOnly]
  56. public ActionResult GetPageList(string pagination, string queryJson)
  57. {
  58. Pagination paginationobj = InitPagination(pagination);
  59. var data = bll.GetPageList(paginationobj, queryJson);
  60. var jsonData = new
  61. {
  62. rows = data,
  63. total = paginationobj.total,
  64. page = paginationobj.page,
  65. records = paginationobj.records
  66. };
  67. return Success(jsonData);
  68. }
  69. /// <summary>
  70. /// 获取表单数据
  71. /// </summary>
  72. /// <param name="keyValue">主键</param>
  73. /// <returns></returns>
  74. [HttpGet]
  75. ////[AjaxOnly]
  76. public ActionResult GetFormData(string keyValue)
  77. {
  78. var wcsDeviceEntity = bll.GetEntity(keyValue);
  79. //var WCS_DEVICEPROTOCOLData = wcsdeviceinfoIBLL.GetWCS_DEVICEPROTOCOLList(WCS_DEVICEData.CODE);
  80. var list= deviceprotocolService.GetEntityByDevicecode(keyValue);
  81. var jsonData = new
  82. {
  83. WCS_DEVICE = wcsDeviceEntity,
  84. WCS_DEVICEPROTOCOL = list
  85. //WCS_DEVICEPROTOCOL = WCS_DEVICEPROTOCOLData,
  86. };
  87. return Success(jsonData);
  88. }
  89. #endregion
  90. #region 提交数据
  91. /// <summary>
  92. /// 删除实体数据
  93. /// </summary>
  94. /// <param name="keyValue">主键</param>
  95. /// <returns></returns>
  96. [HttpPost]
  97. ////[AjaxOnly]
  98. public ActionResult DeleteForm(string keyValue)
  99. {
  100. bll.DeleteEntity(keyValue);
  101. return Success("删除成功!");
  102. }
  103. /// <summary>
  104. /// 保存实体数据(新增、修改)
  105. /// </summary>
  106. /// <param name="keyValue">主键</param>
  107. /// <param name="strEntity">实体</param>
  108. /// <returns></returns>
  109. [HttpPost]
  110. [ValidateAntiForgeryToken]
  111. ////[AjaxOnly]
  112. public ActionResult SaveForm(string keyValue, WcsDeviceEntity strEntity, List<WcsDeviceprotocolEntity> strwCS_DEVICEPROTOCOLList)
  113. {
  114. LoginUserInfo LoginUser = LoginBLLCore.GetLoginUser();
  115. bll.SaveEntity(LoginUser, keyValue, strEntity, strwCS_DEVICEPROTOCOLList);
  116. //bll.SaveEntity(LoginUser, keyValue, entity);
  117. return Success("保存成功!");
  118. }
  119. [HttpPost]
  120. [ValidateAntiForgeryToken]
  121. ////[AjaxOnly]
  122. public ActionResult SaveGenerateDevice(GenerateDevice entity)
  123. {
  124. LoginUserInfo LoginUser = LoginBLLCore.GetLoginUser();
  125. bll.SaveGenerateDevice(LoginUser, entity);
  126. //bll.SaveEntity(LoginUser, keyValue, entity);
  127. return Success("保存成功!");
  128. }
  129. #endregion
  130. }
  131. }