BaseMatinfoController.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using Microsoft.AspNetCore.Mvc;
  2. using Newtonsoft.Json;
  3. using wms.sqlsugar.model.pt;
  4. using WMS.BZModels.Dto.PT.BaseMatinfoDtos;
  5. using WMS.BZServices.PT;
  6. using WMS.Core;
  7. using WMS.Info;
  8. namespace WMS.BZWeb.Areas.PTManager.Controllers
  9. {
  10. [Area("PTManager")]
  11. public class BaseMatinfoController : MvcControllerBase
  12. {
  13. private readonly BaseMatinfoService _matinfo;
  14. public BaseMatinfoController(BaseMatinfoService matinfo)
  15. {
  16. _matinfo = matinfo;
  17. }
  18. public IActionResult Index()
  19. {
  20. return View();
  21. }
  22. [HttpGet]
  23. public ActionResult Form()
  24. {
  25. return View();
  26. }
  27. public ActionResult GetPageList(string pagination, string queryJson)
  28. {
  29. Pagination paginationobj = InitPagination(pagination);
  30. var query = new BaseMatinfoQueryDto();
  31. if (!string.IsNullOrEmpty(queryJson))
  32. {
  33. query = JsonConvert.DeserializeObject<BaseMatinfoQueryDto>(queryJson);
  34. }
  35. var lists = _matinfo.GetPageList(paginationobj, query ?? new BaseMatinfoQueryDto());
  36. var jsonData = new
  37. {
  38. rows = lists.Result,
  39. total = lists.TotalPage,
  40. page = lists.PageIndex,
  41. records = lists.TotalNum
  42. };
  43. return Success(jsonData);
  44. }
  45. [HttpPost]
  46. public ActionResult SaveForm(string keyValue, BaseMatinfo Data)
  47. {
  48. LoginUserInfo LoginUser = GetLoginUser();
  49. _matinfo.Save(LoginUser, keyValue, Data);
  50. return Success("保存成功。");
  51. }
  52. [HttpPost]
  53. public ActionResult Delete(string keyValue)
  54. {
  55. _matinfo.Delete(keyValue);
  56. return Success("删除成功。");
  57. }
  58. }
  59. }