BillBomSetController.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. using Mapster;
  2. using Microsoft.AspNetCore.Mvc;
  3. using Newtonsoft.Json;
  4. using wms.sqlsugar.model.fj;
  5. using WMS.BZModels;
  6. using WMS.BZModels.Dto.FJ.BillBom;
  7. using WMS.BZModels.Models.FJ;
  8. using WMS.BZServices.FJ;
  9. using WMS.Info;
  10. using WMS.Util;
  11. namespace WMS.BZWeb.Areas.FJManager.Controllers
  12. {
  13. [Area("FJManager")]
  14. public class BillBomSetController : MvcControllerBase
  15. {
  16. private readonly BillBomSetService _billBomSetService;
  17. public BillBomSetController(BillBomSetService billBomSetService)
  18. {
  19. _billBomSetService = billBomSetService;
  20. }
  21. #region 视图功能
  22. public IActionResult Index()
  23. {
  24. return View();
  25. }
  26. public IActionResult DFM09()
  27. {
  28. return View();
  29. }
  30. public IActionResult DFM1509()
  31. {
  32. return View();
  33. }
  34. public IActionResult DOF2()
  35. {
  36. return View();
  37. }
  38. public IActionResult DOF4()
  39. {
  40. return View();
  41. }
  42. public IActionResult DFM6()
  43. {
  44. return View();
  45. }
  46. public IActionResult Exception()
  47. {
  48. return View();
  49. }
  50. public IActionResult DFMAll()
  51. {
  52. return View();
  53. }
  54. public IActionResult PaiKu()
  55. {
  56. return View();
  57. }
  58. public IActionResult Form()
  59. {
  60. return View();
  61. }
  62. #endregion 视图功能
  63. public ActionResult GetPageList(string pagination, string queryJson)
  64. {
  65. Pagination paginationobj = InitPagination(pagination);
  66. var query = new BillBomsetgrpQueryDto();
  67. if (!string.IsNullOrEmpty(queryJson))
  68. {
  69. query = JsonConvert.DeserializeObject<BillBomsetgrpQueryDto>(queryJson);
  70. }
  71. var lists = _billBomSetService.GetPageList(paginationobj, query ?? new BillBomsetgrpQueryDto());
  72. var jsonData = new
  73. {
  74. rows = lists.Result,
  75. total = lists.TotalPage,
  76. page = lists.PageIndex,
  77. records = lists.TotalNum
  78. };
  79. return Success(jsonData);
  80. }
  81. public ActionResult PaiKuGetList()
  82. {
  83. var lists = _billBomSetService.PaiKuGetList();
  84. return Success(lists);
  85. }
  86. public ActionResult GetPaiKuList(string pagination, string queryJson)
  87. {
  88. Pagination paginationobj = InitPagination(pagination);
  89. var query = new BillPaiKuQueryDto();
  90. if (!string.IsNullOrEmpty(queryJson))
  91. {
  92. query = JsonConvert.DeserializeObject<BillPaiKuQueryDto>(queryJson);
  93. }
  94. var lists = _billBomSetService.GetPaiKuList(paginationobj, query ?? new BillPaiKuQueryDto());
  95. var jsonData = new
  96. {
  97. rows = lists.Result,
  98. total = lists.TotalPage,
  99. page = lists.PageIndex,
  100. records = lists.TotalNum
  101. };
  102. return Success(jsonData);
  103. }
  104. public ActionResult GetBillBomSetInfoItem(string bomSetHdrId)
  105. {
  106. if (string.IsNullOrWhiteSpace(bomSetHdrId))
  107. {
  108. return Fail("跺型Id不能为空");
  109. }
  110. if (!long.TryParse(bomSetHdrId, out var id))
  111. {
  112. return Fail("跺型Id不能为空");
  113. }
  114. var list = _billBomSetService.GetBillBomsetinfoItem(id);
  115. return Success(list);
  116. }
  117. public ActionResult GetBillBomsetinfo(string id)
  118. {
  119. if (string.IsNullOrWhiteSpace(id))
  120. {
  121. return Fail("跺型Id不能为空");
  122. }
  123. if (!long.TryParse(id, out var bomsetid))
  124. {
  125. return Fail("跺型Id不能为空");
  126. }
  127. var dto = _billBomSetService.GetBillBomsetinfo(bomsetid);
  128. return Success(dto);
  129. }
  130. public ActionResult GetSelectCodeListByType(string typenum)
  131. {
  132. var list = _billBomSetService.GetSelectCodeListByType(typenum);
  133. return Success(list);
  134. }
  135. [HttpPost]
  136. public ActionResult Save09Form(string keyValue, BillBomsetDto Data)
  137. {
  138. LoginUserInfo LoginUser = GetLoginUser();
  139. _billBomSetService.Save09(LoginUser, keyValue, Data.Adapt<BillBomsetgrp>(), Data.Bomsetinfos.Adapt<List<BillBomsetinfo>>());
  140. return Success("保存成功。");
  141. }
  142. [HttpPost]
  143. public ActionResult SaveForm(string keyValue, BillBomsetDto Data)
  144. {
  145. LoginUserInfo LoginUser = GetLoginUser();
  146. _billBomSetService.Save(LoginUser, keyValue, Data.Adapt<BillBomsetgrp>(), Data.Bomsetinfos.Adapt<List<BillBomsetinfo>>());
  147. return Success("保存成功。");
  148. }
  149. [HttpPost]
  150. public ActionResult SaveFormPK(string keyValue, BillPaiKu Data)
  151. {
  152. LoginUserInfo LoginUser = GetLoginUser();
  153. _billBomSetService.SavePK(LoginUser, keyValue, Data);
  154. return Success("保存成功");
  155. }
  156. [HttpPost]
  157. public ActionResult DeletePK(long keyValue)
  158. {
  159. _billBomSetService.DeletePK(keyValue);
  160. return Success("删除成功。");
  161. }
  162. [HttpPost]
  163. public ActionResult SaveExceptionForm(string keyValue, BillBomsetDto Data)
  164. {
  165. LoginUserInfo LoginUser = GetLoginUser();
  166. _billBomSetService.SaveException(LoginUser, keyValue, Data.Adapt<BillBomsetgrp>(), Data.Bomsetinfos.Adapt<List<BillBomsetinfo>>());
  167. return Success("保存成功。");
  168. }
  169. [HttpPost]
  170. public ActionResult Delete(string keyValue)
  171. {
  172. if (string.IsNullOrWhiteSpace(keyValue))
  173. {
  174. return Fail("跺型Id不能为空");
  175. }
  176. if (!long.TryParse(keyValue, out var id))
  177. {
  178. return Fail("跺型Id不能为空");
  179. }
  180. _billBomSetService.Delete(id);
  181. return Success("删除成功。");
  182. }
  183. [HttpPost]
  184. public ActionResult Deletes(string[] keyValue)
  185. {
  186. if (keyValue == null || keyValue.Length == 0)
  187. {
  188. return Fail("跺型Id不能为空");
  189. }
  190. var userid = WebUtil.GetItem("userId");
  191. _billBomSetService.Deletes(keyValue, userid?.ToString());
  192. return Success("删除成功。");
  193. }
  194. [HttpPost]
  195. public ActionResult Enables(string ids)
  196. {
  197. if (string.IsNullOrEmpty(ids))
  198. {
  199. return Fail("没有选择跺型!");
  200. }
  201. var lists = JsonConvert.DeserializeObject<List<string>>(ids);
  202. var userid = WebUtil.GetItem("userId");
  203. _billBomSetService.ChangeEnableds(lists, LocationStop.LocationInvoke, userid?.ToString());
  204. return Success("保存成功!");
  205. }
  206. [HttpPost]
  207. public ActionResult Disables(string ids)
  208. {
  209. if (string.IsNullOrEmpty(ids))
  210. {
  211. return Fail("没有选择跺型!");
  212. }
  213. var lists = JsonConvert.DeserializeObject<List<string>>(ids);
  214. var userid = WebUtil.GetItem("userId");
  215. _billBomSetService.ChangeEnableds(lists, LocationStop.LocationStopped, userid?.ToString());
  216. return Success("保存成功!");
  217. }
  218. }
  219. }