纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
8.4 KiB

3 years ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script>
  6. debugger;
  7. //var Type = $.request("Type");
  8. var ColModelMain = [];
  9. var ColModelSub = [];
  10. $(function () {
  11. gridList();
  12. })
  13. function gridList() {
  14. var $gridList = $("#gridList");
  15. var queryJson = {
  16. POCode: $("#txt_POCode").val(),
  17. }
  18. $gridList.dataGrid({
  19. url: "/WMS/Blitem/GetGridJson" + "?" + Math.random(),
  20. postData: { queryJson: JSON.stringify(queryJson) },
  21. height: $(window).height() - 200,
  22. width: $(window).width() - 300,
  23. colModel: [
  24. { label: "主键", name: "ID", hidden: true, key: true },
  25. { label: '盘点单号', name: 'CheckCode', width: 120, align: 'left' },
  26. { label: '盘点日期', name: 'MTIME', width: 150, align: 'left' },
  27. { label: '料品编码', name: 'InvCode', width: 150, align: 'left' },
  28. { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  29. { label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
  30. { label: '库存数量', name: 'Quantity', width: 150, align: 'left' },
  31. { label: '实盘数量', name: 'ActualQuantity', width: 100, align: 'left' },
  32. { label: '单位', name: 'InvUnit', width: 60, align: 'left', },
  33. { label: '维护人', name: 'MuserName', width: 60, align: 'left', },
  34. // { label: '维护时间', name: 'MTTR', width: 100, align: 'left' },
  35. { label: '仓库代码', name: 'WHCode', width: 100, align: 'left' },
  36. ],
  37. //colModel: ColModelMain,
  38. width: "100%",
  39. autowidth: true,
  40. //shrinkToFit: true,
  41. gridComplete: function () {
  42. },
  43. pager: "#gridPager",
  44. sortname: 'CheckCode',
  45. sortorder: "desc",
  46. viewrecords: true,
  47. multiselect: true,
  48. beforeSelectRow: function (rowid, e) {
  49. $("#gridList").jqGrid('resetSelection');
  50. return (true);
  51. },
  52. subGrid: true, // (1)开启子表格支持
  53. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  54. $("#gridList").jqGrid("setSelection", rowid, false);
  55. bindSubGrid(subgrid_id, rowid)
  56. }
  57. });
  58. $("#warehouse a.btn-default").click(function () {
  59. $("#warehouse a.btn-default").removeClass("active");
  60. $(this).addClass("active");
  61. $('#btn_search').trigger("click");
  62. });
  63. $("#btn_search").click(function () {
  64. var warehouse = $("#warehouse a.active").attr('data-value');
  65. var queryJson = {
  66. POCode: $("#txt_POCode").val(),
  67. }
  68. $gridList.jqGrid('setGridParam', {
  69. postData: { queryJson: JSON.stringify(queryJson) },
  70. }).trigger('reloadGrid');
  71. });
  72. }
  73. function bindSubGrid(subgrid_id, rowid) {
  74. $("#gridList").jqGrid("setSelection", rowid, false);
  75. var subgrid_table_id;
  76. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  77. var subgrid_pager_id;
  78. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  79. // (5)动态添加子报表的table和pager
  80. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  81. var CheckCode = $("#gridList").jqGrid('getRowData', rowid).CheckCode;
  82. //var Sequence = $("#gridList").jqGrid('getRowData', rowid).Sequence;
  83. // (6)创建jqGrid对象
  84. $("#" + subgrid_table_id).dataGrid({
  85. cellEdit: true,
  86. url: "/WMS/Blitem/GetSubGridJson?CheckCode=" + CheckCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  87. colModel: [
  88. { label: "主键", name: "ID", hidden: true, key: true },
  89. { label: "料品编码", name: "InvCode", width: 200, align: 'left' },
  90. { label: '料品名称', name: 'InvName', width: 200, align: 'left' },
  91. { label: '条码', name: 'LotNo', width: 200, align: 'left' },
  92. { label: '规格型号', name: 'InvStd', width: 200, align: 'left' },
  93. { label: '库存数量', name: 'Quantity', width: 100, align: 'left' },
  94. { label: '实际数量', name: 'ActualQuantity', width: 100, align: 'left' },
  95. { label: '仓库编码', name: 'WarehouseCode', width: 100, align: 'left' },
  96. { label: '库位编码', name: 'LocationCode', width: 150, align: 'left' },
  97. {
  98. label: '删除', width: 100, align: 'left',
  99. formatter: btnLook
  100. },
  101. ],
  102. //colModel: ColModelSub,
  103. shrinkToFit: true,//宽度自适应
  104. multiselect: true,
  105. prmNames: { search: "search" },
  106. viewrecords: true,
  107. height: "100%",
  108. rowNum: 20,
  109. pager: subgrid_pager_id,
  110. });
  111. }
  112. function btnLook(cellvalue, options, rowObject) {
  113. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"DeleteClick('" + rowObject.ID + "')\">删除</a>";
  114. }
  115. function DeleteClick(ID) {
  116. $.deleteForm({
  117. url: "/WMS/Blitem/DeleteICSCheckDetail?ID=" + ID + "&" + Math.random(),
  118. //param: { keyValue: JSON.stringify(objArr) },
  119. success: function () {
  120. $.currentWindow().$("#gridList").trigger("reloadGrid");
  121. }
  122. })
  123. }
  124. function btnDelete() {
  125. var objArr = '';
  126. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  127. for (var i = 0; i < objList.length; i++) {
  128. var rowId = objList[i];
  129. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  130. objArr += "'" + rowData.CheckCode + "',";
  131. }
  132. if (objArr == '') {
  133. $.modalAlert("请选择一项进行删除!");
  134. return;
  135. }
  136. $.deleteForm({
  137. url: "/WMS/Blitem/DeleteICSCheck" + "?" + Math.random(),
  138. param: { keyValue: JSON.stringify(objArr) },
  139. success: function () {
  140. $.currentWindow().$("#gridList").trigger("reloadGrid");
  141. }
  142. })
  143. }
  144. function btnCreate() {
  145. debugger;
  146. $.modalOpen({
  147. id: "ICSCheckAdd",
  148. title: "生成盘点计划",
  149. url: "/WMS/Blitem/ICSCheckAdd",
  150. width: "400px",
  151. height: "350px",
  152. callBack: function (iframeId) {
  153. top.frames[iframeId].submitForm();
  154. }
  155. });
  156. }
  157. </script>
  158. <div class="topPanel" style="height:60px;">
  159. <div class="toolbar">
  160. <div class="btn-group">
  161. <a id="NF-Create" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>创建盘点计划</a>
  162. <a id="NF-Delete" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnDelete()"><i class="fa fa-pencil-square-o"></i>删除盘点计划</a>
  163. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  164. </div>
  165. <script>$('.toolbar').authorizeButton()</script>
  166. </div>
  167. <div class="search">
  168. <table>
  169. <tr>
  170. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">单据号</label>:</td>
  171. <td>
  172. <div class="input-group">
  173. <input id="txt_POCode" type="text" class="form-control" style="width: 100px;">
  174. </div>
  175. </td>
  176. <td>
  177. <span class="input-group-btn">
  178. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  179. </span>
  180. </td>
  181. </tr>
  182. </table>
  183. </div>
  184. </div>
  185. <div class="gridPanel">
  186. <table id="gridList"></table>
  187. <div id="gridPager"></div>
  188. </div>