BillBomSetController.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. #endregion
  59. public ActionResult GetPageList(string pagination, string queryJson)
  60. {
  61. Pagination paginationobj = InitPagination(pagination);
  62. var query = new BillBomsetgrpQueryDto();
  63. if (!string.IsNullOrEmpty(queryJson))
  64. {
  65. query = JsonConvert.DeserializeObject<BillBomsetgrpQueryDto>(queryJson);
  66. }
  67. var lists = _billBomSetService.GetPageList(paginationobj, query ?? new BillBomsetgrpQueryDto());
  68. var jsonData = new
  69. {
  70. rows = lists.Result,
  71. total = lists.TotalPage,
  72. page = lists.PageIndex,
  73. records = lists.TotalNum
  74. };
  75. return Success(jsonData);
  76. }
  77. public ActionResult GetPaiKuList(string pagination, string queryJson)
  78. {
  79. Pagination paginationobj = InitPagination(pagination);
  80. var query = new BillPaiKuQueryDto();
  81. if (!string.IsNullOrEmpty(queryJson))
  82. {
  83. query = JsonConvert.DeserializeObject<BillPaiKuQueryDto>(queryJson);
  84. }
  85. var lists = _billBomSetService.GetPaiKuList(paginationobj, query ?? new BillPaiKuQueryDto());
  86. var jsonData = new
  87. {
  88. rows = lists.Result,
  89. total = lists.TotalPage,
  90. page = lists.PageIndex,
  91. records = lists.TotalNum
  92. };
  93. return Success(jsonData);
  94. }
  95. public ActionResult GetBillBomSetInfoItem(string bomSetHdrId)
  96. {
  97. if (string.IsNullOrWhiteSpace(bomSetHdrId))
  98. {
  99. return Fail("跺型Id不能为空");
  100. }
  101. if (!long.TryParse(bomSetHdrId, out var id))
  102. {
  103. return Fail("跺型Id不能为空");
  104. }
  105. var list = _billBomSetService.GetBillBomsetinfoItem(id);
  106. return Success(list);
  107. }
  108. public ActionResult GetBillBomsetinfo(string id)
  109. {
  110. if (string.IsNullOrWhiteSpace(id))
  111. {
  112. return Fail("跺型Id不能为空");
  113. }
  114. if (!long.TryParse(id, out var bomsetid))
  115. {
  116. return Fail("跺型Id不能为空");
  117. }
  118. var dto = _billBomSetService.GetBillBomsetinfo(bomsetid);
  119. return Success(dto);
  120. }
  121. public ActionResult GetSelectCodeListByType(string typenum)
  122. {
  123. var list = _billBomSetService.GetSelectCodeListByType(typenum);
  124. return Success(list);
  125. }
  126. [HttpPost]
  127. public ActionResult Save09Form(string keyValue, BillBomsetDto Data)
  128. {
  129. LoginUserInfo LoginUser = GetLoginUser();
  130. _billBomSetService.Save09(LoginUser, keyValue, Data.Adapt<BillBomsetgrp>(), Data.Bomsetinfos.Adapt<List<BillBomsetinfo>>());
  131. return Success("保存成功。");
  132. }
  133. [HttpPost]
  134. public ActionResult SaveForm(string keyValue, BillBomsetDto Data)
  135. {
  136. LoginUserInfo LoginUser = GetLoginUser();
  137. _billBomSetService.Save(LoginUser, keyValue, Data.Adapt<BillBomsetgrp>(), Data.Bomsetinfos.Adapt<List<BillBomsetinfo>>());
  138. return Success("保存成功。");
  139. }
  140. [HttpPost]
  141. public ActionResult SaveFormPK(string keyValue, BillPaiKu Data)
  142. {
  143. LoginUserInfo LoginUser = GetLoginUser();
  144. _billBomSetService.SavePK(LoginUser,keyValue,Data);
  145. return Success("保存成功");
  146. }
  147. [HttpPost]
  148. public ActionResult DeletePK(long keyValue)
  149. {
  150. _billBomSetService.DeletePK(keyValue);
  151. return Success("删除成功。");
  152. }
  153. [HttpPost]
  154. public ActionResult SaveExceptionForm(string keyValue, BillBomsetDto Data)
  155. {
  156. LoginUserInfo LoginUser = GetLoginUser();
  157. _billBomSetService.SaveException(LoginUser, keyValue, Data.Adapt<BillBomsetgrp>(), Data.Bomsetinfos.Adapt<List<BillBomsetinfo>>());
  158. return Success("保存成功。");
  159. }
  160. [HttpPost]
  161. public ActionResult Delete(string keyValue)
  162. {
  163. if (string.IsNullOrWhiteSpace(keyValue))
  164. {
  165. return Fail("跺型Id不能为空");
  166. }
  167. if (!long.TryParse(keyValue, out var id))
  168. {
  169. return Fail("跺型Id不能为空");
  170. }
  171. _billBomSetService.Delete(id);
  172. return Success("删除成功。");
  173. }
  174. [HttpPost]
  175. public ActionResult Deletes(string[] keyValue)
  176. {
  177. if (keyValue == null || keyValue.Length == 0)
  178. {
  179. return Fail("跺型Id不能为空");
  180. }
  181. var userid = WebUtil.GetItem("userId");
  182. _billBomSetService.Deletes(keyValue, userid?.ToString());
  183. return Success("删除成功。");
  184. }
  185. [HttpPost]
  186. public ActionResult Enables(string ids)
  187. {
  188. if (string.IsNullOrEmpty(ids))
  189. {
  190. return Fail("没有选择跺型!");
  191. }
  192. var lists = JsonConvert.DeserializeObject<List<string>>(ids);
  193. var userid = WebUtil.GetItem("userId");
  194. _billBomSetService.ChangeEnableds(lists, LocationStop.LocationInvoke, userid?.ToString());
  195. return Success("保存成功!");
  196. }
  197. [HttpPost]
  198. public ActionResult Disables(string ids)
  199. {
  200. if (string.IsNullOrEmpty(ids))
  201. {
  202. return Fail("没有选择跺型!");
  203. }
  204. var lists = JsonConvert.DeserializeObject<List<string>>(ids);
  205. var userid = WebUtil.GetItem("userId");
  206. _billBomSetService.ChangeEnableds(lists, LocationStop.LocationStopped, userid?.ToString());
  207. return Success("保存成功!");
  208. }
  209. }
  210. }