ProductionEnterStoreApplyMg.cshtml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. @using ShwasherSys.Authorization.Permissions
  2. @using ShwasherSys.Models.Layout
  3. @using ShwasherSys.Models.Modal
  4. @{
  5. ViewBag.Title = "生产完成入库申请";
  6. ViewBag.ActiveMenu = PermissionNames.PagesProductionInfoProductionEnterStoreApplyMg; //The menu item will be active for this page.
  7. List<SelectListItem> applyStatus = ViewBag.ApplyStatus;
  8. List<SelectListItem> storeHouses = ViewBag.StoreHouses;
  9. List<SelectListItem> closeStatus = new List<SelectListItem>()
  10. {
  11. new SelectListItem(){Text = @"未关闭",Value = "false",Selected = true},
  12. new SelectListItem(){Text = @"已关闭",Value = "true"}
  13. };
  14. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  15. {
  16. new SearchItem("productionOrderNo","排产单号"),
  17. new SearchItem("partNo","零件号"),
  18. new SearchItem("semiProductName","产品名称"),
  19. new SearchItem("model","规格"),
  20. new SearchItem("semiProductNo","半成品编码").SetSearchIcon("query_semiProduct_modal"),
  21. new SearchItem("applyStatus","申请状态" )
  22. .SetSearchItem(applyStatus),
  23. new SearchItem("isClose","关闭状态" ,FiledType.Bnull,ExpType.Equal)
  24. .SetSearchItem(closeStatus),
  25. }, false);
  26. }
  27. <style>
  28. .tool-radio {
  29. display: inline-block;
  30. margin-left: 10px;
  31. }
  32. [type="radio"]:not(:checked) + label, [type="radio"]:checked + label {
  33. padding-left: 25px;
  34. font-size: 1.5rem;
  35. color: #dad9db;
  36. }
  37. [type="radio"]:not(:checked) + label::before, [type="radio"]:not(:checked) + label::after {
  38. border: 2px solid #fff;
  39. }
  40. </style>
  41. <section style="display: none">
  42. @Html.DropDownList("hide-ApplyStatus", applyStatus)
  43. @Html.DropDownList("hide-StoreHouses", storeHouses)
  44. </section>
  45. <div class="table-box mr-4 iwb-bootstrap-table">
  46. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu, searchForm })
  47. <table id="table"
  48. data-url="/api/services/app/ProductionOrders/GetSemiEnterStoreApply"
  49. data-striped="true" data-id-field="id" data-unique-id="id"
  50. data-method="post"
  51. data-side-pagination="server"
  52. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  53. data-cache="false"
  54. data-pagination="true" data-page-size="30" data-page-number="1" data-page-list="[30,50,100,200]" data-pagination-detail-h-align="right" data-pagination-h-align="left"
  55. data-query-params="QueryParams"
  56. data-response-handler="ResponseHandler"
  57. data-click-to-select="true"
  58. data-single-select="true">
  59. <thead>
  60. <tr class="row" id="header">
  61. <th data-field="state" data-checkbox="true"></th>
  62. <th data-align="center" data-field="productionOrderNo">排产单号</th>
  63. <th data-align="center" data-field="semiProductNo">半成品编码</th>
  64. <th data-align="center" data-field="quantity">申请入库数量(kg)</th>
  65. <th data-align="center" data-field="actualQuantity" data-formatter="QuantityFormatter">入库数量(kg)</th>
  66. <th data-align="center" data-field="storeHouseId" data-formatter="StoreHouseIdFormatter">仓库</th>
  67. <th data-align="center" data-field="applyStatus" data-formatter="ApplyStatusFormatter">申请状态</th>
  68. <th data-align="center" data-field="applyEnterDate">申请时间</th>
  69. <th data-align="center" data-field="partNo">零件号</th>
  70. <th data-align="center" data-field="semiProductName">产品名称</th>
  71. <th data-align="center" data-field="surfaceColor">表色</th>
  72. <th data-align="center" data-field="model">规格</th>
  73. <th data-align="center" data-field="rigidity">硬度</th>
  74. <th data-align="center" data-field="material">材质</th>
  75. <th data-align="center" data-field="kgWeight">千件重</th>
  76. <th data-align="center" data-formatter="ActionFormatter">操作</th>
  77. </tr>
  78. </thead>
  79. </table>
  80. </div>
  81. @section modal{
  82. <section>
  83. <!--Main Modal-->
  84. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  85. <div class="modal-dialog modal-dialog-centered" role="document">
  86. <div class="modal-content">
  87. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("修改申请数量", ""))
  88. @{
  89. var inputs = new List<InputViewModel>
  90. {
  91. new InputViewModel("id", hide:true),
  92. new InputViewModel("quantity", displayName:"入库数量(kg)",@class:"number",other:"min=0.001"),
  93. /*new InputViewModel("remark",InputTypes.Textarea,displayName:"备注").SetNotRequired(),*/
  94. };
  95. //var specials = new List<SpecialInputModel>();
  96. }
  97. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  98. @Html.Partial("Modals/_SwModalFooter", new ModelFooterModel("modal", "ModifyEnterStoreQuantity()"))
  99. </div>
  100. </div>
  101. </div>
  102. </section>
  103. @Html.Partial("Modals/Query/_SemiProduct", "KeyWords-5")
  104. }
  105. @section scripts
  106. {
  107. <script type="text/javascript">
  108. $(function () {
  109. //show完毕前执行
  110. $("#KeyWords-7").val("false").select2();
  111. LoadTable();
  112. var funs = window.funs || { none: function () { console.log("No type"); } };
  113. funs["btnUpdate"] = function () {
  114. var rows = config.table.bootstrapTable("getSelections");
  115. if (rows.length === 1) {
  116. if (rows[0].applyStatus === "2"||rows[0].applyStatus === "5") {
  117. abp.message.warn("已入库(或审核)的申请不可进行更改!");
  118. return;
  119. }
  120. if (rows[0].applyStatus !== "1") {
  121. abp.message.warn("请恢复申请后进行更改!");
  122. return;
  123. }
  124. $("#modal").modal("show");
  125. $("#id").val(rows[0].id);
  126. $("#quantity").val("");
  127. }
  128. };
  129. $("#Tool1").append(
  130. '<div class="tool-radio"><input name="proType" type="radio" id="allProduction" checked value=""/><label for="allProduction">全部</label></div>' +
  131. '<div class="tool-radio"><input name="proType" type="radio" id="outPurchase" value="2"/><label for="outPurchase">外购</label></div>' +
  132. '<div class="tool-radio"><input name="proType" type="radio" id="machineShop" value="1"/><label for="machineShop">车间加工</label></div>' +
  133. '<div class="tool-radio"><input name="proType" type="radio" id="outProduct" value="6"/><label for="outProduct">外协</label></div>');
  134. $(".tool-radio input[type='radio']").on('click',function(e) {
  135. //var outType = $(this).val();
  136. document.getElementById("SearchForm").reset();
  137. GetSearchList();
  138. RefreshTable();
  139. });
  140. });
  141. function GetSearchList() {
  142. var count = $("#SearchForm").find(".KeyWords").length;
  143. window._searchList = [];
  144. var outType = $('input[name="proType"]:checked').val();
  145. if (outType) {
  146. window._searchList.push({
  147. KeyWords: outType,
  148. KeyField: "ApplySource",
  149. FieldType: "0",
  150. ExpType: "0"
  151. });
  152. }
  153. for (var i = 1; i <= count; i++) {
  154. var keyWords = $("#KeyWords-" + i).val();
  155. if (keyWords) {
  156. var keyField = $("#KeyField-" + i).val();
  157. var fieldType = $("#FieldType-" + i).val();
  158. var expType = $("#ExpType-" + i).val();
  159. _searchList.push({
  160. KeyWords: keyWords,
  161. KeyField: keyField,
  162. FieldType: fieldType,
  163. ExpType: expType
  164. });
  165. }
  166. }
  167. }
  168. </script>
  169. <script>
  170. function ModifyEnterStoreQuantity() {
  171. SaveAjax({
  172. url: window.appUrl + 'ProductionOrders/UpdateEnterStoreApply',
  173. data: {
  174. Id: $("#id").val(),
  175. Quantity: $("#quantity").val()
  176. },
  177. isValidate: true,
  178. dataType: "json",
  179. success: function () {
  180. abp.message.success("修改申请成功!");
  181. $("#modal").modal("hide");
  182. RefreshTable();
  183. }
  184. });
  185. }
  186. function f_cancelApply(id) {
  187. console.log("cancelApply", id);
  188. abp.message.confirm("确认取消申请?",
  189. "取消申请",
  190. function () {
  191. abp.ajax({
  192. url: window.appUrl + 'ProductionOrders/CancelSemiEnterStoreApplyStatus',
  193. data: { Id: id },
  194. async: true,
  195. type: "Post",
  196. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  197. isValidate: false,
  198. dataType: "json",
  199. success: function () {
  200. abp.message.success(abp.localization.localize("OpSuccess"));
  201. RefreshTable();
  202. }
  203. });
  204. });
  205. }
  206. function f_confirmEnterApply(id) {
  207. console.log("cancelApply", id);
  208. abp.message.confirm("确认产品入库数量正确吗?",
  209. "确认入库数量",
  210. function () {
  211. abp.ajax({
  212. url: window.appUrl + 'ProductionOrders/ConfirmSemiEnterStoreQuantity',
  213. data: { Id: id },
  214. async: true,
  215. type: "Post",
  216. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  217. isValidate: false,
  218. dataType: "json",
  219. success: function () {
  220. abp.message.success(abp.localization.localize("OpSuccess"));
  221. RefreshTable();
  222. }
  223. });
  224. });
  225. }
  226. function f_closeApply(id) {
  227. console.log("recoveryApply", id);
  228. abp.message.confirm("入库申请关闭后不可恢复,确认关闭申请?",
  229. "关闭申请",
  230. function () {
  231. abp.ajax({
  232. url: window.appUrl + 'ProductionOrders/CloseEnterStoreApply',
  233. data: { Id: id },
  234. async: true,
  235. type: "Post",
  236. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  237. isValidate: false,
  238. dataType: "json",
  239. success: function () {
  240. abp.message.success(abp.localization.localize("OpSuccess"));
  241. RefreshTable();
  242. }
  243. });
  244. });
  245. }
  246. function f_recoveryApply(id) {
  247. console.log("recoveryApply", id);
  248. abp.message.confirm("确认恢复申请?",
  249. "恢复申请",
  250. function () {
  251. abp.ajax({
  252. url: window.appUrl + 'ProductionOrders/RecoverySemiEnterStoreApplyStatus',
  253. data: { Id: id },
  254. async: true,
  255. type: "Post",
  256. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  257. isValidate: false,
  258. dataType: "json",
  259. success: function () {
  260. abp.message.success(abp.localization.localize("OpSuccess"));
  261. RefreshTable();
  262. }
  263. });
  264. });
  265. }
  266. </script>
  267. <script>
  268. function QuantityFormatter(v, r) {
  269. if (r.actualQuantity === 0) {
  270. return '<span class="label label-default">' + v + '</span>';
  271. }
  272. if (r.actualQuantity > r.quantity) {
  273. return '<span class="label label-success">' + v + '</span>';
  274. } else if (r.actualQuantity === r.quantity) {
  275. return '<span class="label label-info">' + v + '</span>';
  276. } else {
  277. return '<span class="label label-danger">' + v + '</span>';
  278. }
  279. }
  280. function StoreHouseIdFormatter(v) {
  281. var name = $("#hide-StoreHouses option[value='" + v + "']").text();
  282. return '<span class="label label-primary">' + name+'</span>';
  283. }
  284. function ApplyStatusFormatter(v,r) {
  285. if (r.isClose) {
  286. return '<span class="label label-primary">已结束</span>';
  287. }
  288. var name = $("#hide-ApplyStatus option[value='" + v + "']").text();
  289. if (v === "1") {
  290. return '<span class="label label-default">' + name +'</span>';
  291. } else if (v === "2") {
  292. return '<span class="label label-success">' + name +'</span>';
  293. } else if (v === "3") {
  294. return '<span class="label label-warning">' + name +'</span>';
  295. } else if (v === "4") {
  296. return '<span class="label label-danger">' + name +'</span>';
  297. }
  298. return '<span class="label label-info">' + name + '</span>';
  299. }
  300. function ActionFormatter(v, r) {
  301. var str;
  302. if (r.isClose) {
  303. return '<span class="table-action">暂无操作</span>';
  304. }
  305. if (r.applyStatus === "1") {
  306. str = '<span class="table-action" onclick="f_cancelApply(\'' + r.id + '\',3)"><i class="iconfont icon-right"></i>取消申请</span><span class="table-action" onclick="f_closeApply(\'' + r.id +
  307. '\')"><i class="iconfont icon-right"></i>关闭申请</span>';
  308. } else if (r.applyStatus === "2") {
  309. str = '<span class="table-action" onclick="f_confirmEnterApply(\'' + r.id + '\')"><i class="iconfont icon-right"></i>确认入库</span>';
  310. } else if (r.applyStatus === "3" || r.applyStatus === "4") {
  311. str = '<span class="table-action" onclick="f_recoveryApply(\'' +
  312. r.id +
  313. '\')"><i class="iconfont icon-right"></i>恢复申请</span><span class="table-action" onclick="f_closeApply(\'' + r.id +
  314. '\')"><i class="iconfont icon-right"></i>关闭申请</span>';
  315. } else if (r.applyStatus === "5") {
  316. str = '<span class="table-action" onclick="f_closeApply(\'' + r.id +
  317. '\')"><i class="iconfont icon-right"></i>关闭申请</span>';
  318. } else {
  319. str = '<span class="table-action">暂无操作</span>';
  320. }
  321. return str;
  322. }
  323. </script>
  324. }