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

327 lines
13 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 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. var _Clos = new Array();
  11. $(function () {
  12. SetCols();
  13. gridList();
  14. })
  15. function SetCols() {
  16. $.ajax({
  17. url: "/Print/SelectColumnName?" + Math.random(),
  18. dataType: "json",
  19. async: false,
  20. success: function (data) {
  21. var cols = new Array();
  22. var collast = { label: "主键", name: "ID", hidden: true, frozen: true };
  23. cols.push(collast);
  24. var collast = {
  25. label: "类型", name: "DABDOCType", width: 60, align: "left",
  26. formatter: function (cellvalue) {
  27. if (cellvalue == "1") {
  28. return "套件";
  29. } else if (cellvalue == "2") {
  30. return "散件";
  31. }
  32. else { return ""; }
  33. }
  34. };
  35. cols.push(collast);
  36. var collast = { label: '拆卸单号', name: 'Code', width: 120, align: 'left' };
  37. cols.push(collast);
  38. var collast = { label: '数量', name: 'Qty', width: 150, align: 'left' };
  39. cols.push(collast);
  40. var collast = { label: '料品编码', name: 'InvCode', width: 150, align: 'left' };
  41. cols.push(collast);
  42. var collast = { label: '料品名称', name: 'InvName', width: 100, align: 'left' };
  43. cols.push(collast);
  44. var collast = { label: '仓库代码', name: 'WHCode', width: 100, align: 'left' };
  45. cols.push(collast);
  46. var collast = { label: '是否选择', name: 'isInput', width: 150, align: 'left' };
  47. cols.push(collast);
  48. var collast = { label: '是否生成', name: 'isCreate', width: 150, align: 'left' };
  49. cols.push(collast);
  50. var collast = { label: '自由项ID', name: 'ExtensionID', hidden: true };
  51. cols.push(collast);
  52. if (data != null && data.length > 0) {
  53. DateList = data;
  54. for (var i = 0; i < data.length; i++) {
  55. var ColName = data[i].ColName;
  56. var ColCode = data[i].ColCode;
  57. var obj = new Array();
  58. obj = {
  59. label: ColName,
  60. name: ColCode,
  61. width: 80,
  62. align: "left"
  63. }
  64. cols.push(obj);
  65. }
  66. }
  67. _Clos = cols;
  68. }
  69. });
  70. }
  71. function gridList() {
  72. var $gridList = $("#gridList");
  73. var queryJson = {
  74. DABDOCCode: $("#txt_DABDOCCode").val(),
  75. }
  76. $gridList.dataGrid({
  77. url: "/WMS/ICSDisassemblyDoc/GetGridJson" + "?" + Math.random(),
  78. postData: { queryJson: JSON.stringify(queryJson) },
  79. height: $(window).height() - 200,
  80. width: $(window).width() - 300,
  81. colModel: _Clos,
  82. //colModel: [
  83. // { label: "主键", name: "ID", hidden: true, key: true },
  84. // {
  85. // label: "类型", name: "DABDOCType", width: 60, align: "left",
  86. // formatter: function (cellvalue) {
  87. // if (cellvalue == "1") {
  88. // return "套件";
  89. // } else if (cellvalue == "2") {
  90. // return "散件";
  91. // }
  92. // else { return ""; }
  93. // }
  94. // },
  95. // { label: '拆卸单号', name: 'Code', width: 120, align: 'left' },
  96. // { label: '数量', name: 'Qty', width: 150, align: 'left' },
  97. // { label: '料品编码', name: 'InvCode', width: 150, align: 'left' },
  98. // { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  99. // { label: '仓库代码', name: 'WHCode', width: 100, align: 'left' },
  100. // { label: '批次', name: 'BatchCode', width: 150, align: 'left' },
  101. // { label: '是否选择', name: 'isInput', width: 150, align: 'left' },
  102. // { label: '是否生成', name: 'isCreate', width: 150, align: 'left' },
  103. //],
  104. width: "100%",
  105. autowidth: true,
  106. gridComplete: function () {
  107. },
  108. pager: "#gridPager",
  109. sortname: 'Code',
  110. sortorder: "desc",
  111. viewrecords: true,
  112. multiselect: true,
  113. beforeSelectRow: function (rowid, e) {
  114. $("#gridList").jqGrid('resetSelection');
  115. return (true);
  116. },
  117. subGrid: true, // (1)开启子表格支持
  118. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  119. $("#gridList").jqGrid("setSelection", rowid, false);
  120. bindSubGrid(subgrid_id, rowid)
  121. }
  122. });
  123. $("#warehouse a.btn-default").click(function () {
  124. $("#warehouse a.btn-default").removeClass("active");
  125. $(this).addClass("active");
  126. $('#btn_search').trigger("click");
  127. });
  128. $("#btn_search").click(function () {
  129. var warehouse = $("#warehouse a.active").attr('data-value');
  130. var queryJson = {
  131. DABDOCCode: $("#txt_DABDOCCode").val(),
  132. }
  133. $gridList.jqGrid('setGridParam', {
  134. postData: { queryJson: JSON.stringify(queryJson) },
  135. }).trigger('reloadGrid');
  136. });
  137. }
  138. function bindSubGrid(subgrid_id, rowid) {
  139. debugger;
  140. $("#gridList").jqGrid("setSelection", rowid, false);
  141. var subgrid_table_id;
  142. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  143. var subgrid_pager_id;
  144. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  145. // (5)动态添加子报表的table和pager
  146. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  147. var Code = $("#gridList").jqGrid('getRowData', rowid).Code;
  148. //var Sequence = $("#gridList").jqGrid('getRowData', rowid).Sequence;
  149. // (6)创建jqGrid对象
  150. $("#" + subgrid_table_id).dataGrid({
  151. cellEdit: true,
  152. url: "/WMS/ICSDisassemblyDoc/GetSubGridJson?Code=" + Code + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  153. colModel: [
  154. { label: '行号', name: 'Sequence', width: 120, align: 'left' },
  155. {
  156. label: "类型", name: "DABDOCType", width: 60, align: "left",
  157. formatter: function (cellvalue) {
  158. if (cellvalue == "1") {
  159. return "套件";
  160. } else if (cellvalue == "2") {
  161. return "散件";
  162. }
  163. else { return ""; }
  164. }
  165. },
  166. { label: '拆卸单号', name: 'Code', width: 120, align: 'left' },
  167. { label: '数量', name: 'Qty', width: 150, align: 'left' },
  168. { label: '料品编码', name: 'InvCode', width: 150, align: 'left' },
  169. { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  170. { label: '仓库代码', name: 'WHCode', width: 100, align: 'left' },
  171. { label: '批次', name: 'BatchCode', width: 150, align: 'left' },
  172. { label: '条码', name: 'LotNo', width: 150, align: 'left' },
  173. ],
  174. //colModel: ColModelSub,
  175. shrinkToFit: true,//宽度自适应
  176. multiselect: true,
  177. prmNames: { search: "search" },
  178. viewrecords: true,
  179. height: "100%",
  180. rowNum: 20,
  181. pager: subgrid_pager_id,
  182. });
  183. }
  184. function btnkit() {
  185. debugger;
  186. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  187. if (ids.length == 0) {
  188. $.modalAlert("请选择数据!");
  189. return;
  190. }
  191. for (var i = 0; i < ids.length; i++) {
  192. var rowData = $("#gridList").jqGrid('getRowData', ids[i]);
  193. var Code = rowData.Code;//单据号
  194. var InvCode = rowData.InvCode;//料品编码
  195. var InvName = rowData.InvName;//料品名称
  196. var WHCode = rowData.WHCode;//仓库代码
  197. var ExtensionID = rowData.ExtensionID;
  198. var Qty = rowData.Qty//数量
  199. var isInput = rowData.isInput//是否选择
  200. if (isInput == "已选") {
  201. $.modalAlert("该套件已选择!");
  202. return;
  203. }
  204. }
  205. $.modalOpen({
  206. id: "ICSDisassemblyDocAdd",
  207. title: "选择套件",
  208. url: "/WMS/ICSDisassemblyDoc/ICSDisassemblyDocAdd?Code=" + Code + "&InvName=" + encodeURI(encodeURI(InvName)) + "&WHCode=" + WHCode + "&ExtensionID=" + ExtensionID + "&InvCode=" + InvCode + "&Qty=" + Qty + "&" + Math.random(),
  209. width: "1200px",
  210. height: "1150px",
  211. callBack: function (iframeId) {
  212. top.frames[iframeId].submitForm();
  213. }
  214. });
  215. }
  216. //批量生成条码
  217. function btnGenerate() {
  218. debugger;
  219. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  220. if (ids.length == 0) {
  221. $.modalAlert("请选择数据!");
  222. return;
  223. }
  224. for (var i = 0; i < ids.length; i++) {
  225. var rowData = $("#gridList").jqGrid('getRowData', ids[i]);
  226. var Code = rowData.Code;
  227. var isInput = rowData.isInput;
  228. var isCreate = rowData.isCreate;
  229. if (isInput == '未选') {
  230. $.modalAlert("请先绑定套件!");
  231. return;
  232. }
  233. if (isCreate == '已生成') {
  234. $.modalAlert("该单据已生成过条码!");
  235. return;
  236. }
  237. }
  238. $.modalConfirm("是否批量生成条码?", function (r) {
  239. if (r) {
  240. $.submitForm({
  241. url: "/WMS/ICSDisassemblyDoc/CreateInventoryLot?Code=" + Code + "&" + Math.random(),
  242. success: function () {
  243. $.currentWindow().$("#gridList").trigger("reloadGrid");
  244. }
  245. })
  246. }
  247. });
  248. }
  249. function btnDeleteLot() {
  250. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  251. if (ids.length == 0) {
  252. $.modalAlert("请选择数据!");
  253. return;
  254. }
  255. for (var i = 0; i < ids.length; i++) {
  256. var rowData = $("#gridList").jqGrid('getRowData', ids[i]);
  257. var Code = rowData.Code;
  258. }
  259. $.modalConfirm("是否批量删除条码?", function (r) {
  260. if (r) {
  261. $.submitForm({
  262. url: "/WMS/ICSDisassemblyDoc/DeleteInventoryLot?Code=" + Code + "&" + Math.random(),
  263. success: function () {
  264. $.currentWindow().$("#gridList").trigger("reloadGrid");
  265. }
  266. })
  267. }
  268. });
  269. }
  270. </script>
  271. <div class="topPanel" style="height:60px;">
  272. <div class="toolbar">
  273. <div class="btn-group">
  274. <a id="NF-kit" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnkit()"><i class="fa fa-pencil-square-o"></i>绑定套件</a>
  275. <a id="NF-Generate" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnGenerate()"><i class="fa fa-pencil-square-o"></i>批量生成条码</a>
  276. <a id="NF-DeleteLot" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnDeleteLot()"><i class="fa fa-pencil-square-o"></i>删除条码</a>
  277. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  278. </div>
  279. <script>$('.toolbar').authorizeButton()</script>
  280. </div>
  281. <div class="search">
  282. <table>
  283. <tr>
  284. <td style="text-align:right;"><label class="lglabel" for="txt_DABDOCCode">单据号</label>:</td>
  285. <td>
  286. <div class="input-group">
  287. <input id="txt_DABDOCCode" type="text" class="form-control" style="width: 100px;">
  288. </div>
  289. </td>
  290. <td>
  291. <span class="input-group-btn">
  292. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  293. </span>
  294. </td>
  295. </tr>
  296. </table>
  297. </div>
  298. </div>
  299. <div class="gridPanel">
  300. <table id="gridList"></table>
  301. <div id="gridPager"></div>
  302. </div>