RmStoreOutMg.cshtml 7.2 KB

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