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

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