RmStoreEnterMg.cshtml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. @using ShwasherSys.Authorization.Permissions
  2. @using ShwasherSys.Models.Layout
  3. @using ShwasherSys.Views.Shared.New.Modals
  4. @using ShwasherSys.Views.Shared.New.Table
  5. @using ModalBodyViewModel = ShwasherSys.Views.Shared.New.Modals.ModalBodyViewModel
  6. @{
  7. ViewBag.Title = "原材料入库信息维护";
  8. string activeMenu = PermissionNames.PagesRawMaterialStoreRmStoreEnterMg; //The menu item will be active for this page.
  9. ViewBag.ActiveMenu = activeMenu;
  10. List<SelectListItem> applyStatus = ViewBag.ApplyStatus;
  11. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  12. {
  13. new SearchItem("rmProductNo","原材料编码"),
  14. new SearchItem("productName","名称"),
  15. new SearchItem("model","规格"),
  16. new SearchItem("applyEnterDate","申请时间",FiledType.Dnull,ExpType.GreaterOrEqual),
  17. new SearchItem("applyEnterDate","至",FiledType.Dnull,ExpType.LessOrEqual),
  18. new SearchItem("applyStatus","申请状态",FiledType.I,ExpType.Equal).SetSearchItem(applyStatus)
  19. });
  20. var table = new TableViewModel("/api/services/app/RmEnterStore/GetAllView", activeMenu, searchForm)
  21. .SetFields(new List<FieldItem>()
  22. {
  23. new FieldItem("rmProductNo", "原材料编码"),
  24. new FieldItem("productName", "名称"),
  25. new FieldItem("productBatchNum", "批次号"),
  26. new FieldItem("material", "材质"),
  27. new FieldItem("model", "规格"),
  28. new FieldItem("applyQuantity","申请数量"),
  29. new FieldItem("applyEnterDate","申请入库时间","DateFormatter"),
  30. new FieldItem("quantity","入库数量"),
  31. new FieldItem("storeLocationNo", "库区"),
  32. new FieldItem("auditDate","审核时间","DateFormatter"),
  33. new FieldItem("applyStatus","状态","ApplyStatusFormatter"),
  34. });
  35. }
  36. @section css{
  37. }
  38. @Html.Partial("New/Table/_Table", table)
  39. @section modal{
  40. <!--Main Modal-->
  41. @{
  42. var modal = new ModalViewModel("原材料申请", new ModalBodyViewModel(new List<Input>()
  43. {
  44. new Input("id",hide:true),
  45. new Input("storeHouseId",hide:true),
  46. new Input("applyStatus",hide:true),
  47. //new Input("productBatchNum","批次号").SetNotRequired(),
  48. new Input("rmProductNo", "原材料编号").SetSearchIcon("query_rmProduct_modal","modal"),
  49. new Input("applyQuantity", "申请数量",@class:"number",other:"min=0.001"),
  50. new Input("model", "规格"),
  51. new Input("material", "材质"),
  52. new Input("storeLocationNo", "库区").SetSearchIcon("query_storeHouseLocation_modal","modal"),
  53. }));
  54. var modal2 = new ModalViewModel("入库确认","", new ModalBodyViewModel(new List<Input>()
  55. {
  56. new Input("id",hide:true),
  57. new Input("storeHouseId",hide:true),
  58. new Input("applyStatus",hide:true),
  59. new Input("productBatchNum","批次号"),
  60. new Input("rmProductNo", "原材料编号"),
  61. new Input("applyQuantity", "申请数量",@class:"number"),
  62. new Input("quantity", "入库数量",@class:"number",other:"min=0.001"),
  63. }), "modal2");
  64. }
  65. @Html.Partial("New/Modals/_Modal", modal)
  66. @Html.Partial("New/Modals/_Modal", modal2)
  67. @Html.Partial("Modals/Query/_RmProduct", "rmProductNo,model,material")
  68. @Html.Partial("Modals/Query/_StoreHouseLocation", "storeHouseId,storeLocationNo")
  69. }
  70. @section scripts
  71. {
  72. <script type="text/javascript">
  73. var $table = $('#table');
  74. $(function() {
  75. LoadTable();
  76. var funs = window.funs || { none: function() { console.log("No type"); } };
  77. funs["btnCreate"] = function (url) {
  78. queryParams.storeHouseId = 5;
  79. BtnCreate({ data: {storeHouseId:5,applyStatus:1}, readonly: "rmProductNo,model,material,productBatchNum",
  80. save: function() {
  81. var q = Number($("#applyQuantity").val());
  82. if (q <= 0) {
  83. abp.message.warn("申请入库数量必须大于0!");
  84. return;
  85. }
  86. SaveAjax({
  87. url: url,
  88. modal: $("#modal"),
  89. form: $('#modal #form')
  90. });
  91. }
  92. });
  93. }
  94. funs["btnUpdate"] = function(url) {
  95. var rows = $table.bootstrapTable("getSelections");
  96. console.log(rows[0].applyStatus);
  97. if (rows.length === 1) {
  98. if (rows[0].applyStatus === 1) {
  99. var row = rows[0];
  100. var data = $.extend({}, row, { applyStatus: 2, quantity:row.applyQuantity });
  101. OpenModal(url,
  102. {
  103. data: data,
  104. readonly: "rmProductNo,applyQuantity,productBatchNum",
  105. modal: $("#modal2"),
  106. save: function() {
  107. var q = Number($("#quantity").val());
  108. if (q <= 0) {
  109. abp.message.warn("审核数量必须大于0!");
  110. return;
  111. }
  112. SaveAjax({
  113. url: url,
  114. modal: $("#modal2"),
  115. form: $('#modal2 #form')
  116. });
  117. }
  118. });
  119. } else {
  120. abp.message.warn("只有申请中的入库记录可审核!");
  121. }
  122. } else
  123. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  124. };
  125. funs["btnDelete"] = function(url) {
  126. var rows = $table.bootstrapTable("getSelections");
  127. if (rows.length === 1) {
  128. if (rows[0].applyStatus === 1) {
  129. abp.message.confirm("取消入库",
  130. "确认取消入库?",
  131. function() {
  132. SaveAjax({
  133. url: url,
  134. data: { Id: rows[0].id, ApplyStatus: 3 },
  135. isValidate: false,
  136. table: $table
  137. });
  138. });
  139. } else {
  140. abp.message.warn("只有申请中的入库记录可审核!");
  141. }
  142. } else
  143. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  144. };
  145. });
  146. </script>
  147. <!--格式化-->
  148. <script id="formatter-script" type="text/javascript">
  149. function ApplyStatusFormatter(v, r) {
  150. var name = $("#hid-applyStatus option[value='" + v + "']").text();
  151. if (v === 1) {
  152. return '<span class="label label-info">' + name + '</span>';
  153. } else if (v === 2) {
  154. return '<span class="label label-success">' + name + '</span>';
  155. } else if (v === 3) {
  156. return '<span class="label label-warning">' + name + '</span>';
  157. }
  158. return '<span class="label label-info">' + name + '</span>';
  159. }
  160. </script>
  161. }
  162. <section style="display: none">
  163. <select id="hid-type">
  164. <option value=""></option>
  165. </select>
  166. @Html.DropDownList("hid-applyStatus", applyStatus)
  167. @*@Html.DropDownList("hid-du", duty)
  168. @Html.DropDownList("hid-de", depart)
  169. @Html.DropDownList("hid-gender", gender)*@
  170. </section>