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

448 lines
19 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
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 flag = '1';
  8. var mark = '';
  9. var Arguments = '';
  10. $(function () {
  11. gridList();
  12. gridList2(flag);
  13. $("#selShow").change(function () {
  14. debugger;
  15. gridList();
  16. });
  17. });
  18. //function gridList() {
  19. // document.getElementById("gridPanel").innerHTML = ' <span><strong>详细信息</strong></span> <table id="gridList"></table> ';//重置grid
  20. // var Type = $("#selShow").val();
  21. // var $gridList = $("#gridList");
  22. // var queryJson = {
  23. // POCode: $("#txt_POCode").val(),
  24. // InvCode: $("#txt_InvCode").val(),
  25. // }
  26. // $gridList.dataGrid({
  27. // url: "/WMS/PickMaterial/GetGridJson?Type=" + Type + "&" + Math.random(),
  28. // postData: { queryJson: JSON.stringify(queryJson) },
  29. // height: 280,
  30. // width: $(window).width() - 500,
  31. // colModel: [
  32. // { label: "主键", name: "ID", hidden: true, key: true },
  33. // { label: '单据号', name: 'Code', width: 120, align: 'left' },
  34. // { label: '单据行号', name: 'Sequence', width: 100, align: 'left' },
  35. // { label: '操作日期', name: 'MTIME', width: 150, align: 'left' },
  36. // { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  37. // { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  38. // { label: '料品描述', name: 'InvDesc', width: 100, align: 'left' },
  39. // { label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
  40. // { label: '数量', name: 'Quantity', width: 100, align: 'left' },
  41. // { label: '单位', name: 'InvUnit', width: 100, align: 'left' },
  42. // { label: '维护人', name: 'MUSER', width: 80, align: 'left' },
  43. // { label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' },
  44. // { label: '仓库编码', name: 'WHCode', width: 80, align: 'left' },
  45. // { label: '仓库名称', name: 'WarehouseName', width: 80, align: 'left' },
  46. // //{ label: '是否合并拣料', name: 'IsNew', width: 80, align: 'left' },
  47. // ],
  48. // shrinkToFit: false,//宽度自适应
  49. // autowidth: true,
  50. // gridComplete: function () {
  51. // },
  52. // rowNum: 10000,
  53. // autoScroll: true,
  54. // sortname: 'Code',
  55. // sortorder: "desc",
  56. // viewrecords: true,
  57. // multiselect: true,
  58. // });
  59. // $("#warehouse a.btn-default").click(function () {
  60. // $("#warehouse a.btn-default").removeClass("active");
  61. // $(this).addClass("active");
  62. // $('#btn_search').trigger("click");
  63. // });
  64. // $("#btn_search").click(function () {
  65. // var warehouse = $("#warehouse a.active").attr('data-value');
  66. // var queryJson = {
  67. // POCode: $("#txt_POCode").val(),
  68. // InvCode: $("#txt_InvCode").val(),
  69. // }
  70. // $gridList.jqGrid('setGridParam', {
  71. // postData: { queryJson: JSON.stringify(queryJson) },
  72. // }).trigger('reloadGrid');
  73. // });
  74. //}
  75. function gridList() {
  76. document.getElementById("gridPanel").innerHTML = ' <span><strong>详细信息</strong></span> <table id="gridList"></table> ';//重置grid
  77. var Type = $("#selShow").val();
  78. var $gridList = $("#gridList");
  79. var queryJson = {
  80. POCode: $("#txt_POCode").val(),
  81. InvCode: $("#txt_InvCode").val(),
  82. }
  83. $gridList.dataGrid({
  84. url: "/WMS/PickMaterial/GetGridJson?Type=" + Type + "&" + Math.random(),
  85. postData: { queryJson: JSON.stringify(queryJson) },
  86. height: 280,
  87. width: $(window).width() - 500,
  88. colModel: [
  89. { label: "主键", name: "ID", hidden: true, key: true },
  90. { label: '单据号', name: 'Code', width: 120, align: 'left' },
  91. { label: '操作日期', name: 'MTIME', width: 150, align: 'left' },
  92. { label: '维护人', name: 'MUSER', width: 80, align: 'left' },
  93. { label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' },
  94. { label: '是否合并拣料', name: 'IsNew', width: 80, align: 'left' },
  95. ],
  96. shrinkToFit: false,//宽度自适应
  97. autowidth: true,
  98. gridComplete: function () {
  99. },
  100. rowNum: 10000,
  101. autoScroll: true,
  102. sortname: 'Code',
  103. sortorder: "desc",
  104. viewrecords: true,
  105. multiselect: true,
  106. subGrid: true, // (1)开启子表格支持
  107. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  108. $("#gridList").jqGrid("setSelection", rowid, false);
  109. bindSubGrid(subgrid_id, rowid)
  110. }
  111. });
  112. function bindSubGrid(subgrid_id, rowid) {
  113. var Type = $("#selShow").val();
  114. $("#gridList").jqGrid("setSelection", rowid, false);
  115. var subgrid_table_id;
  116. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  117. var subgrid_pager_id;
  118. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  119. // (5)动态添加子报表的table和pager
  120. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  121. var Code = $("#gridList").jqGrid('getRowData', rowid).Code;
  122. //var Sequence = $("#gridList").jqGrid('getRowData', rowid).Sequence;
  123. // (6)创建jqGrid对象
  124. $("#" + subgrid_table_id).dataGrid({
  125. cellEdit: true,
  126. url: "/WMS/PickMaterial/GetSubGridJson?Code=" + Code + "&Type=" + Type + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  127. colModel: [
  128. { label: '单据号', name: 'Code', width: 120, align: 'left' },
  129. { label: '单据行号', name: 'Sequence', width: 100, align: 'left' },
  130. { label: '操作日期', name: 'MTIME', width: 150, align: 'left' },
  131. { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  132. { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  133. { label: '料品描述', name: 'InvDesc', width: 100, align: 'left' },
  134. { label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
  135. { label: '数量', name: 'Quantity', width: 100, align: 'left' },
  136. { label: '单位', name: 'InvUnit', width: 100, align: 'left' },
  137. { label: '维护人', name: 'MUSER', width: 80, align: 'left' },
  138. { label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' },
  139. { label: '仓库编码', name: 'WHCode', width: 80, align: 'left' },
  140. { label: '仓库名称', name: 'WarehouseName', width: 80, align: 'left' },
  141. ],
  142. //colModel: ColModelSub,
  143. shrinkToFit: true,//宽度自适应
  144. //multiselect: true,
  145. prmNames: { search: "search" },
  146. viewrecords: true,
  147. height: "100%",
  148. rowNum: 20,
  149. pager: subgrid_pager_id,
  150. });
  151. }
  152. $("#warehouse a.btn-default").click(function () {
  153. $("#warehouse a.btn-default").removeClass("active");
  154. $(this).addClass("active");
  155. $('#btn_search').trigger("click");
  156. });
  157. $("#btn_search").click(function () {
  158. var warehouse = $("#warehouse a.active").attr('data-value');
  159. var queryJson = {
  160. POCode: $("#txt_POCode").val(),
  161. InvCode: $("#txt_InvCode").val(),
  162. }
  163. $gridList.jqGrid('setGridParam', {
  164. postData: { queryJson: JSON.stringify(queryJson) },
  165. }).trigger('reloadGrid');
  166. });
  167. }
  168. function gridList2(flag) {
  169. debugger;
  170. document.getElementById("gridPanel2").innerHTML = ' <span><strong>合并信息</strong></span> <table id="gridList2"></table>';//重置grid
  171. var Type = $("#selShow").val();
  172. var $gridList = $("#gridList2");
  173. var objArr = '';
  174. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  175. for (var i = 0; i < objList.length; i++) {
  176. var rowId = objList[i];
  177. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  178. if (flag=='1') {
  179. objArr += "'" + rowData.Code+ "',";
  180. } else {
  181. objArr += "'" + rowData.Code + "',";
  182. }
  183. }
  184. $gridList.dataGrid({
  185. url: "/WMS/PickMaterial/GetICSMOPickMergeTemp?ID=" + objArr + "&Type=" + Type + "&flag=" + flag + "&" + Math.random(),
  186. height: 500,
  187. width: $(window).width() - 500,
  188. colModel: [
  189. { label: "主键", name: "ID", hidden: true, key: true },
  190. { label: '领料合并ID', name: 'MergeID', width: 120, align: 'left' },
  191. { label: '单据号', name: 'Code', width: 120, align: 'left' },
  192. { label: '料品编码', name: 'InvCode', width: 150, align: 'left' },
  193. { label: '料品名称', name: 'InvName', width: 150, align: 'left' },
  194. { label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
  195. { label: '应发数量', name: 'iQuantity', width: 100, align: 'left' },
  196. { label: '单位', name: 'InvUnit', width: 150, align: 'left' },
  197. { label: '仓库编码', name: 'WarehouseCode', width: 100, align: 'left' },
  198. { label: '库位编码', name: 'LocationCode', width: 100, align: 'left' },
  199. { label: '条码库存', name: 'QTY', width: 100, align: 'left' },
  200. { label: '条码', name: 'LotNO', width: 100, align: 'left' },
  201. ],
  202. shrinkToFit: false,//宽度自适应
  203. autowidth: true,
  204. gridComplete: function () {
  205. },
  206. rowNum: 10000,
  207. sortorder: "desc",
  208. viewrecords: true,
  209. //multiselect: true,
  210. });
  211. $("#warehouse a.btn-default").click(function () {
  212. $("#warehouse a.btn-default").removeClass("active");
  213. $(this).addClass("active");
  214. $('#btn_search').trigger("click");
  215. });
  216. $("#btn_search").click(function () {
  217. var warehouse = $("#warehouse a.active").attr('data-value');
  218. var queryJson = {
  219. POCode: $("#txt_POCode").val(),
  220. }
  221. $gridList.jqGrid('setGridParam', {
  222. postData: { queryJson: JSON.stringify(queryJson) },
  223. }).trigger('reloadGrid');
  224. });
  225. }
  226. function btnMaterial() {
  227. debugger;
  228. var objArr = '';
  229. var arr = [];
  230. mark = '拣料';
  231. flag = '1';
  232. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  233. for (var i = 0; i < objList.length; i++) {
  234. var rowId = objList[i];
  235. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  236. if (rowData.IsNew == "已合并") {
  237. $.modalAlert("该单据已合并拣料,无法重复拣料!");
  238. return;
  239. }
  240. objArr += "'" + rowData.Code + "',";
  241. objArr = objArr.slice(0, objArr.length - 1);
  242. objArr = "" + objArr + "|";
  243. arr.push(objArr);
  244. }
  245. Arguments = arr;
  246. gridList2(flag);
  247. }
  248. function btnMergeMaterial() {
  249. debugger;
  250. mark = '合并拣料';
  251. var sign = '';
  252. flag = '2';
  253. var Type = $("#selShow").val();
  254. var obj = '';
  255. var objArr = '';
  256. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  257. if (objList.length < 2) {
  258. $.modalAlert("请至少选择两条数据进行合并!");
  259. return;
  260. }
  261. for (var i = 0; i < objList.length; i++) {
  262. var rowId = objList[i];
  263. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  264. obj += rowData.Code + ",";
  265. objArr += "'" + rowData.Code + "',";
  266. }
  267. $.ajax({
  268. url: "/WMS/PickMaterial/CheckQty" + "?" + Math.random() + "&objArr=" + objArr,
  269. dataType: "json",
  270. type: "post",
  271. async: false,
  272. success: function (data) {
  273. sign = data.count;
  274. }
  275. });
  276. if (sign == '1') {
  277. $.modalAlert("该单据已合并拣料,无法重复拣料!");
  278. return;
  279. }
  280. $.submitForm({
  281. url: "/WMS/PickMaterial/MergeMaterial?Type=" + Type + "&" + Math.random(),
  282. param: {
  283. keyValue: obj
  284. },
  285. success: function () {
  286. //$.currentWindow().$("#gridList").trigger("reloadGrid");
  287. gridList2(flag);
  288. }
  289. })
  290. }
  291. function btnPrint() {
  292. debugger;
  293. var mold = '';
  294. if (mark == '') {
  295. $.modalAlert("请先拣料再进行打印!");
  296. return;
  297. }
  298. if (mark == '合并拣料') {
  299. var objArr = '';
  300. var arr = [];
  301. var obj_Item1 = $("#gridList2");
  302. var rowIds_Item1 = obj_Item1.getDataIDs();
  303. var arrayData_Item1 = new Array();
  304. var Enables = '';
  305. if (rowIds_Item1.length > 0) {
  306. debugger;
  307. for (var i = 0; i < rowIds_Item1.length; i++) {
  308. var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[0]);
  309. objArr += "'" + RowData_Item1.MergeID + "',";
  310. objArr = objArr.slice(0, objArr.length - 1);
  311. objArr = "" + objArr + "|";
  312. arr.push(objArr);
  313. }
  314. Arguments = arr;
  315. mold = 'HBJL00001';
  316. }
  317. }
  318. if (mark == '拣料') {
  319. mold = 'JL00001';
  320. }
  321. $.modalOpen({
  322. id: "PrintLot",
  323. title: "打印",
  324. url: "/WMS/Print/PrintView?Arguments=" + encodeURI(encodeURI(Arguments)) + "&mold=" + mold + "&" + Math.random(),
  325. width: "550px",
  326. height: "1000px",
  327. callBack: function (iframeId) {
  328. top.frames[iframeId].submitForm();
  329. }
  330. });
  331. }
  332. function fullscreen() {
  333. var docElm = document.documentElement;
  334. if (docElm.requestFullscreen) {
  335. docElm.requestFullscreen();
  336. } else if (docElm.mozRequestFullScreen) {
  337. docElm.mozRequestFullScreen();
  338. } else if (docElm.webkitRequestFullScreen) {
  339. docElm.webkitRequestFullScreen();
  340. } else if (docElm.msRequestFullscreen) {
  341. docElm.msRequestFullscreen();
  342. }
  343. $(window).bind('resize', function () {
  344. $("#gridList").setGridWidth($(window).width());
  345. }).trigger('resize');
  346. $(window).bind('resize', function () {
  347. $("#gridList").setGridHeight($(window).height());
  348. }).trigger('resize');
  349. }
  350. </script>
  351. <div class="topPanel" style="height:60px;">
  352. <div class="toolbar">
  353. <div class="btn-group">
  354. <a id="NF-Material" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnMaterial()"><i class="fa fa-pencil-square-o"></i>拣料</a>
  355. <a id="NF-MergeMaterial" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnMergeMaterial()"><i class="fa fa-pencil-square-o"></i>合并拣料</a>
  356. <a id="NF-Print" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnPrint()"><i class="fa fa-pencil-square-o"></i>打印</a>
  357. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  358. </div>
  359. <script>$('.toolbar').authorizeButton()</script>
  360. </div>
  361. <div class="search">
  362. <table>
  363. <tr>
  364. <td>
  365. <label>&nbsp;&nbsp;&nbsp;类型:</label>
  366. </td>
  367. <td>
  368. <div class="input-group">
  369. <select id="selShow" name="F_Target" class="form-control" style="width: 100px;">
  370. <option value="1" selected="selected">工单备料</option>
  371. <option value="2" selected="selected">工单领料</option>
  372. <option value="3" selected="selected">工单材料出库</option>
  373. <option value="4" selected="selected">委外备料</option>
  374. <option value="5" selected="selected">委外领料</option>
  375. <option value="6" selected="selected">委外材料出库</option>
  376. <option value="7" selected="selected">销售发货</option>
  377. <option value="8" selected="selected">其它出库</option>
  378. <option value="9" selected="selected">借用</option>
  379. <option value="10" selected="selected">物料调拨</option>
  380. <option value="11" selected="selected">两步调出</option>
  381. </select>
  382. </div>
  383. </td>
  384. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">&nbsp;&nbsp;&nbsp;单据号</label>:</td>
  385. <td>
  386. <div class="input-group">
  387. <input id="txt_POCode" type="text" class="form-control" style="width: 150px;">
  388. </div>
  389. </td>
  390. <td style="text-align:right;"><label class="lglabel" for="txt_InvCode">&nbsp;&nbsp;&nbsp;料品编码</label>:</td>
  391. <td>
  392. <div class="input-group">
  393. <input id="txt_InvCode" type="text" class="form-control" style="width: 150px;">
  394. </div>
  395. </td>
  396. <td>
  397. <span class="input-group-btn">
  398. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  399. </span>
  400. </td>
  401. </tr>
  402. </table>
  403. </div>
  404. </div>
  405. <div class="gridPanel" id="gridPanel">
  406. <span><strong>详细信息</strong></span>
  407. <table id="gridList"></table>
  408. </div>
  409. <div class="gridPanel" id="gridPanel2">
  410. <span><strong>合并信息</strong></span>
  411. <table id="gridList2"></table>
  412. </div>