纽威
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.

214 lines
8.6 KiB

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