RmCurrentStoreMg.cshtml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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.PagesRawMaterialStoreRmCurrentStoreMg; //The menu item will be active for this page.
  14. ViewBag.ActiveMenu = activeMenu;
  15. //List<SelectListItem> applyStatus = ViewBag.ApplyStatus;
  16. string AddEnterAuth = PermissionNames.PagesRawMaterialStoreRmCurrentStoreMgAddEnter;
  17. string AddOutAuth = PermissionNames.PagesRawMaterialStoreRmCurrentStoreMgAddOut;
  18. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  19. {
  20. new SearchItem("rmProductNo","原材料编码"),
  21. new SearchItem("productName","名称"),
  22. new SearchItem("model","规格")
  23. });
  24. var table = new TableViewModel("/api/services/app/CurrentRmStoreHouse/GetAllView", activeMenu, searchForm)
  25. .SetFields(new List<FieldItem>()
  26. {
  27. new FieldItem("rmProductNo", "原材料编码"),
  28. new FieldItem("productName", "名称"),
  29. new FieldItem("productBatchNum", "批次号"),
  30. new FieldItem("material", "材质"),
  31. new FieldItem("model", "规格"),
  32. new FieldItem("quantity","数量"),
  33. new FieldItem("freezeQuantity","冻结数量"),
  34. new FieldItem("storeLocationNo","库区"),
  35. new FieldItem("actionFormatter","","ActionFormatter"),
  36. });
  37. }
  38. @section css{
  39. }
  40. @Html.Partial("New/Table/_Table", table)
  41. @section modal{
  42. <!--Main Modal-->
  43. @{
  44. var modal = new ModalViewModel("原材料入库平衡", new ModalBodyViewModel(new List<Input>()
  45. {
  46. new Input("id",hide:true),
  47. new Input("applyStatus",hide:true),
  48. new Input("storeHouseId",hide:true),
  49. new Input("productBatchNum","批次号"),
  50. new Input("rmProductNo", "原材料编号"),
  51. new Input("model", "规格"),
  52. new Input("material", "材质"),
  53. new Input("storeLocationNo", "库区"),
  54. new Input("quantity", "申请数量",@class:"number",other:"min=0.001"),
  55. }));
  56. var modal2 = new ModalViewModel("原材料出库平衡", new ModalBodyViewModel(new List<Input>()
  57. {
  58. //new Input("id",hide:true),
  59. new Input("currentRmStoreHouseNo",hide:true),
  60. new Input("productBatchNum","批次号"),
  61. new Input("rmProductNo", "原材料编号"),
  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. }
  69. @section scripts
  70. {
  71. <script type="text/javascript">
  72. var $table = $('#table');
  73. $(function () {
  74. LoadTable();
  75. var funs = window.funs || { none: function () { console.log("No type"); } };
  76. //funs["AddEnter"] = function (url) {
  77. // //BtnCreate({ data: { storeHouseId: 5, applyStatus: 1 }, readonly: "rmProductNo,model,material" });
  78. // var rows = $table.bootstrapTable("getSelections");
  79. // if (rows.length === 1) {
  80. // var row = rows[0];
  81. // var data = $.extend({}, row, { applyStatus: 1 });
  82. // OpenModal(url,
  83. // { data: data, readonly: "rmProductNo,quantity,productBatchNum" });
  84. // } else
  85. // abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  86. //}
  87. //funs["AddOut"] = function (url) {
  88. // var rows = $table.bootstrapTable("getSelections");
  89. // if (rows.length === 1) {
  90. // var row = rows[0];
  91. // OpenModal(url,
  92. // { data: row, readonly: "rmProductNo,quantity,productBatchNum",modal:$("#modal2") });
  93. // } else
  94. // abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  95. //};
  96. });
  97. function BtnAddEnter(productBatchNum, rmProductNo, storeHouseId, storeLocationNo, model, material) {
  98. var data = {
  99. productBatchNum: productBatchNum,
  100. rmProductNo: rmProductNo,
  101. storeHouseId: storeHouseId,
  102. storeLocationNo: storeLocationNo,
  103. model: model,
  104. material: material,
  105. applyStatus: 1,
  106. }
  107. OpenModal(window.appUrl+"CurrentRmStoreHouse/AddEnter",
  108. {
  109. data: data, readonly: "rmProductNo,productBatchNum,model,material,storeLocationNo" ,
  110. save: function() {
  111. var q = Number($("#modal #quantity").val());
  112. if (q <= 0) {
  113. abp.message.warn("入库数量必须大于0!");
  114. return;
  115. }
  116. SaveAjax({
  117. url: window.appUrl+"CurrentRmStoreHouse/AddEnter",
  118. modal: $("#modal"),
  119. form: $('#modal #form')
  120. });
  121. }
  122. });
  123. }
  124. function BtnAddOut(currentRmStoreHouseNo,productBatchNum,rmProductNo) {
  125. var data = {
  126. productBatchNum: productBatchNum,
  127. rmProductNo: rmProductNo,
  128. currentRmStoreHouseNo: currentRmStoreHouseNo
  129. }
  130. OpenModal(window.appUrl+"CurrentRmStoreHouse/AddOut",
  131. { data: data, readonly: "rmProductNo,productBatchNum",modal:$("#modal2") ,
  132. save: function() {
  133. var q = Number($("#modal2 #quantity").val());
  134. if (q <= 0) {
  135. abp.message.warn("出库数量必须大于0!");
  136. return;
  137. }
  138. SaveAjax({
  139. url: window.appUrl+"CurrentRmStoreHouse/AddOut",
  140. modal: $("#modal2"),
  141. form: $('#modal2 #form')
  142. });
  143. }});
  144. }
  145. </script>
  146. <!--格式化-->
  147. <script id="formatter-script" type="text/javascript">
  148. function ApplyStatusFormatter(v, r) {
  149. var name = $("#hid-applyStatus option[value='" + v + "']").text();
  150. if (v === 1) {
  151. return '<span class="label label-info">' + name + '</span>';
  152. } else if (v === 2) {
  153. return '<span class="label label-success">' + name + '</span>';
  154. } else if (v === 3) {
  155. return '<span class="label label-warning">' + name + '</span>';
  156. }
  157. return '<span class="label label-info">' + name + '</span>';
  158. }
  159. function ActionFormatter(v, r) {
  160. var str = '';
  161. if (abp.auth.isGranted('@AddEnterAuth')) {
  162. str = '<span class="table-action" onclick="BtnAddEnter(\'' +
  163. r.productBatchNum +
  164. '\',\'' +
  165. r.rmProductNo +
  166. '\',\'' +
  167. r.storeHouseId +
  168. '\',\'' +
  169. r.storeLocationNo +
  170. '\',\'' +
  171. r.model +
  172. '\',\'' +
  173. r.material +
  174. '\')"><i class="iconfont icon-right"></i>入库平衡</span>';
  175. }
  176. if (abp.auth.isGranted('@AddOutAuth')) {
  177. str += '<span class="table-action" onclick="BtnAddOut(\'' +
  178. r.id +
  179. '\',\'' +
  180. r.productBatchNum +
  181. '\',\'' +
  182. r.rmProductNo +
  183. '\')"><i class="iconfont icon-right"></i>出库平衡</span>';
  184. }
  185. return str;
  186. }
  187. </script>
  188. }
  189. <section style="display: none">
  190. <select id="hid-type">
  191. <option value=""></option>
  192. </select>
  193. @*@Html.DropDownList("hid-applyStatus", applyStatus)*@
  194. @*@Html.DropDownList("hid-du", duty)
  195. @Html.DropDownList("hid-de", depart)
  196. @Html.DropDownList("hid-gender", gender)*@
  197. </section>