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

787 lines
38 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
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <style>
  6. .ui-jqgrid .ui-jqgrid-btable tbody tr.jqgrow td {
  7. overflow: inherit;
  8. word-wrap: break-word;
  9. }
  10. .ui-jqgrid tr.jqgrow td {
  11. white-space: normal !important;
  12. height: auto;
  13. }
  14. </style>
  15. <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
  16. <link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" />
  17. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  18. <script src="~/Content/js/bootstrap/bootstrap-select.js"></script>
  19. <script src="~/Content/js/select2/select2.min.js"></script>
  20. <script src="~/Content/js/layer/layer.js"></script>
  21. <script>
  22. debugger;
  23. var Type = $.request("Type");
  24. var _Clos = new Array();
  25. $(function () {
  26. SetCols(Type);
  27. //来料检验
  28. if (Type == '1') {
  29. gridList();
  30. }
  31. //委外来料检验
  32. if (Type == '3') {
  33. gridList2();
  34. }
  35. //产成品检验
  36. if (Type == '2') {
  37. $(".HideTxt").css('display', 'none');
  38. $("#NF-update").css('display', 'none');
  39. gridList3();
  40. }
  41. })
  42. function SetCols(Type) {
  43. $.ajax({
  44. url: "/Print/SelectColumnName?" + Math.random(),
  45. dataType: "json",
  46. async: false,
  47. success: function (data) {
  48. var cols = new Array();
  49. //来料检验
  50. if (Type == '1') {
  51. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  52. cols.push(collast);
  53. var collast = { label: 'ID', name: 'ID', hidden: true };
  54. cols.push(collast);
  55. var collast = { label: '到货ID', name: 'DHID', hidden: true };
  56. cols.push(collast);
  57. var collast = { label: '检验ID', name: 'JYID', hidden: true };
  58. cols.push(collast);
  59. var collast = { label: '到货单号', name: 'DNCode', width: 120, align: 'left' };
  60. cols.push(collast);
  61. var collast = { label: '送货单号', name: 'ASNCode', width: 120, align: 'left' };
  62. cols.push(collast);
  63. var collast = { label: '采购订单号', name: 'POCode', width: 120, align: 'left' };
  64. cols.push(collast);
  65. var collast = { label: '条码', name: 'LotNo', width: 120, align: 'left' };
  66. cols.push(collast);
  67. var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
  68. cols.push(collast);
  69. var collast = { label: '料品名称', name: 'InvName', width: 100, align: 'left' };
  70. cols.push(collast);
  71. var collast = { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' };
  72. cols.push(collast);
  73. var collast = { label: '批次', name: 'BatchCode', width: 100, align: 'left' };
  74. cols.push(collast);
  75. var collast = { label: '箱号', name: 'ContainerID', width: 100, align: 'left' };
  76. cols.push(collast);
  77. var collast = { label: '到货时间', name: 'CreateDateTime', width: 150, align: 'left' };
  78. cols.push(collast);
  79. var collast = { label: '供应商代码', name: 'VenCode', width: 150, align: 'left' };
  80. cols.push(collast);
  81. var collast = { label: '供应商名称', name: 'VenName', width: 150, align: 'left' };
  82. cols.push(collast);
  83. var collast = { label: '总数量', name: 'AllNumber', width: 100, align: 'left' };
  84. cols.push(collast);
  85. var collast = { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  86. cols.push(collast);
  87. var collast = { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  88. cols.push(collast);
  89. var collast = { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  90. cols.push(collast);
  91. var collast = { label: '不良代码值', name: 'BCCodeValue', hidden: true };
  92. cols.push(collast);
  93. var collast = {
  94. label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false,
  95. formatter: function (cellvalue, options, rowObject) {
  96. debugger;
  97. var html = "";
  98. html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  99. html += ' </select>';
  100. return cellvalue = html;
  101. }
  102. };
  103. cols.push(collast);
  104. var collast = { label: '不良原因值', name: 'BRCodeValue', hidden: true };
  105. cols.push(collast);
  106. var collast = {
  107. label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false,
  108. formatter: function (cellvalue, options, rowObject) {
  109. var html = "";
  110. html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  111. html += ' </select>';
  112. return cellvalue = html;
  113. }
  114. };
  115. cols.push(collast);
  116. var collast = { label: '检验状态', name: 'TestState', width: 150, align: 'left' };
  117. cols.push(collast);
  118. var collast = { label: '检验人', name: 'Surveyor', width: 150, align: 'left' };
  119. cols.push(collast);
  120. var collast = { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' };
  121. cols.push(collast);
  122. }
  123. //委外来料检验
  124. if (Type == '3') {
  125. gridList2();
  126. }
  127. //产成品检验
  128. if (Type == '2') {
  129. $(".HideTxt").css('display', 'none');
  130. $("#NF-update").css('display', 'none');
  131. gridList3();
  132. }
  133. if (data != null && data.length > 0) {
  134. DateList = data;
  135. for (var i = 0; i < data.length; i++) {
  136. var ColName = data[i].ColName;
  137. var ColCode = data[i].ColCode;
  138. var obj = new Array();
  139. obj = {
  140. label: ColName,
  141. name: ColCode,
  142. width: 80,
  143. align: "left"
  144. }
  145. cols.push(obj);
  146. }
  147. }
  148. _Clos = cols;
  149. }
  150. });
  151. }
  152. function gridList() {
  153. var $gridList = $("#gridList");
  154. var queryJson = {
  155. POCode: $("#txt_POCode").val(),
  156. ASNCode: $("#txt_ASNCode").val(),
  157. CaiGouCode: $("#txt_CaiGouCode").val(),
  158. VenCode: $("#txt_VenCode").val(),
  159. VenName: $("#txt_VenName").val(),
  160. InvCode: $("#txt_InvCode").val(),
  161. InvName: $("#txt_InvName").val(),
  162. BatchCode: $("#txt_BatchCode").val(),
  163. ReleaseState: $("#selShow").val(),
  164. }
  165. $gridList.dataGrid({
  166. url: "/WMS/ICSRCVIQCs/GetICSInspection" + "?" + Math.random(),
  167. postData: { queryJson: JSON.stringify(queryJson) },
  168. height: $(window).height() - 200,
  169. width: $(window).width() - 300,
  170. cellEdit: true,
  171. colModel: _Clos,
  172. //colModel: [
  173. // { label: "主键", name: "ID", hidden: true, key: true },
  174. // { label: 'ID', name: 'ID', hidden: true },
  175. // { label: '到货ID', name: 'DHID', hidden: true },
  176. // { label: '检验ID', name: 'JYID', hidden: true },
  177. // { label: '到货单号', name: 'DNCode', width: 120, align: 'left' },
  178. // { label: '送货单号', name: 'ASNCode', width: 120, align: 'left' },
  179. // { label: '采购订单号', name: 'POCode', width: 120, align: 'left' },
  180. // { label: '条码', name: 'LotNo', width: 120, align: 'left' },
  181. // { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  182. // { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  183. // { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' },
  184. // { label: '批次', name: 'BatchCode', width: 100, align: 'left' },
  185. // { label: '箱号', name: 'ContainerID', width: 100, align: 'left' },
  186. // { label: '到货时间', name: 'CreateDateTime', width: 150, align: 'left' },
  187. // { label: '供应商代码', name: 'VenCode', width: 150, align: 'left' },
  188. // { label: '供应商名称', name: 'VenName', width: 150, align: 'left' },
  189. // { label: '总数量', name: 'AllNumber', width: 100, align: 'left' },
  190. // { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  191. // { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  192. // { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  193. // { label: '不良代码值', name: 'BCCodeValue', hidden: true },
  194. // {
  195. // label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false,
  196. // formatter: function (cellvalue, options, rowObject) {
  197. // debugger;
  198. // var html = "";
  199. // html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  200. // html += ' </select>';
  201. // return cellvalue = html;
  202. // }
  203. // },
  204. // { label: '不良原因值', name: 'BRCodeValue', hidden: true },
  205. // {
  206. // label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false,
  207. // formatter: function (cellvalue, options, rowObject) {
  208. // var html = "";
  209. // html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  210. // html += ' </select>';
  211. // return cellvalue = html;
  212. // }
  213. // },
  214. // { label: '检验状态', name: 'TestState', width: 150, align: 'left' },
  215. // { label: '检验人', name: 'Surveyor', width: 150, align: 'left' },
  216. // { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' },
  217. //],
  218. cellsubmit: "clientArray",
  219. shrinkToFit: false,//宽度自适应
  220. autoWidth: true,
  221. gridComplete: function () {
  222. debugger;
  223. //设置select
  224. var RowDatas = $("#gridList").jqGrid('getDataIDs');
  225. for (var j = 0; j < RowDatas.length; j++) {
  226. var InvCode = $("#gridList").jqGrid("getCell", RowDatas[j], "InvCode");
  227. var ID = $("#gridList").jqGrid("getCell", RowDatas[j], "ID");
  228. var BCCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BCCodeValue");
  229. var BRCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BRCodeValue");
  230. GetSelectICSBadCode(InvCode, ID, BCCodeValue);
  231. GetSelectPerson(InvCode, ID, BRCodeValue);
  232. }
  233. },
  234. pager: "#gridPager",
  235. sortorder: "desc",
  236. sortname: 'DNCode ',
  237. viewrecords: true,
  238. multiselect: true,
  239. subGrid: false, // (1)开启子表格支持
  240. afterSaveCell: function (rowid, cellname, value) {
  241. debugger;
  242. //总扣分数加其他扣分数
  243. if (cellname === 'YLOTQTY') {
  244. var YLOTQTY = value;
  245. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  246. var str = Math.round((parseFloat(AllNumber) - parseFloat(YLOTQTY)) * 10) / 10;
  247. $gridList.jqGrid("setCell", rowid, 'NLOTQTY', str);
  248. }
  249. if (cellname === 'NLOTQTY') {
  250. var NLOTQTY = value;
  251. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  252. var str = Math.round((parseFloat(AllNumber) - parseFloat(NLOTQTY)) * 10) / 10;
  253. $gridList.jqGrid("setCell", rowid, 'YLOTQTY', str);
  254. }
  255. },
  256. });
  257. $("#btn_search").click(function () {
  258. var warehouse = $("#warehouse a.active").attr('data-value');
  259. var queryJson = {
  260. POCode: $("#txt_POCode").val(),
  261. ASNCode: $("#txt_ASNCode").val(),
  262. CaiGouCode: $("#txt_CaiGouCode").val(),
  263. VenCode: $("#txt_VenCode").val(),
  264. VenName: $("#txt_VenName").val(),
  265. InvCode: $("#txt_InvCode").val(),
  266. InvName: $("#txt_InvName").val(),
  267. BatchCode: $("#txt_BatchCode").val(),
  268. ReleaseState: $("#selShow").val(),
  269. }
  270. $gridList.jqGrid('setGridParam', {
  271. postData: { queryJson: JSON.stringify(queryJson) },
  272. }).trigger('reloadGrid');
  273. });
  274. }
  275. function gridList2() {
  276. var $gridList = $("#gridList");
  277. var queryJson = {
  278. POCode: $("#txt_POCode").val(),
  279. ASNCode: $("#txt_ASNCode").val(),
  280. CaiGouCode: $("#txt_CaiGouCode").val(),
  281. VenCode: $("#txt_VenCode").val(),
  282. VenName: $("#txt_VenName").val(),
  283. InvCode: $("#txt_InvCode").val(),
  284. InvName: $("#txt_InvName").val(),
  285. BatchCode: $("#txt_BatchCode").val(),
  286. ReleaseState: $("#selShow").val(),
  287. }
  288. $gridList.dataGrid({
  289. url: "/WMS/ICSRCVIQCs/GetICSInspection2" + "?" + Math.random(),
  290. postData: { queryJson: JSON.stringify(queryJson) },
  291. height: $(window).height() - 200,
  292. width: $(window).width() - 300,
  293. cellEdit: true,
  294. colModel: [
  295. { label: "主键", name: "ID", hidden: true, key: true },
  296. { label: 'ID', name: 'ID', hidden: true },
  297. { label: '到货ID', name: 'DHID', hidden: true },
  298. { label: '检验ID', name: 'JYID', hidden: true },
  299. { label: '委外到货单号', name: 'DNCode', width: 120, align: 'left' },
  300. { label: '委外送货单号', name: 'OASNCode', width: 120, align: 'left' },
  301. { label: '委外采购订单号', name: 'OOCode', width: 120, align: 'left' },
  302. { label: '条码', name: 'LotNo', width: 120, align: 'left' },
  303. { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  304. { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  305. { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' },
  306. { label: '批次', name: 'BatchCode', width: 100, align: 'left' },
  307. { label: '箱号', name: 'ContainerID', width: 100, align: 'left' },
  308. { label: '到货时间', name: 'CreateDateTime', width: 150, align: 'left' },
  309. { label: '供应商代码', name: 'VenCode', width: 150, align: 'left' },
  310. { label: '供应商名称', name: 'VenName', width: 150, align: 'left' },
  311. { label: '总数量', name: 'AllNumber', width: 100, align: 'left' },
  312. { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  313. { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  314. { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  315. { label: '不良代码值', name: 'BCCodeValue', hidden: true },
  316. {
  317. label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false,
  318. formatter: function (cellvalue, options, rowObject) {
  319. debugger;
  320. var html = "";
  321. html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  322. html += ' </select>';
  323. return cellvalue = html;
  324. }
  325. },
  326. { label: '不良原因值', name: 'BRCodeValue', hidden: true },
  327. {
  328. label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false,
  329. formatter: function (cellvalue, options, rowObject) {
  330. var html = "";
  331. html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  332. html += ' </select>';
  333. return cellvalue = html;
  334. }
  335. },
  336. { label: '检验状态', name: 'TestState', width: 150, align: 'left' },
  337. { label: '检验人', name: 'Surveyor', width: 150, align: 'left' },
  338. { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' },
  339. ],
  340. cellsubmit: "clientArray",
  341. shrinkToFit: false,//宽度自适应
  342. autoWidth: true,
  343. gridComplete: function () {
  344. debugger;
  345. //设置select
  346. var RowDatas = $("#gridList").jqGrid('getDataIDs');
  347. for (var j = 0; j < RowDatas.length; j++) {
  348. var InvCode = $("#gridList").jqGrid("getCell", RowDatas[j], "InvCode");
  349. var ID = $("#gridList").jqGrid("getCell", RowDatas[j], "ID");
  350. var BCCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BCCodeValue");
  351. var BRCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BRCodeValue");
  352. GetSelectICSBadCode(InvCode, ID, BCCodeValue);
  353. GetSelectPerson(InvCode, ID, BRCodeValue);
  354. }
  355. },
  356. pager: "#gridPager",
  357. sortorder: "desc",
  358. sortname: 'DNCode ',
  359. viewrecords: true,
  360. multiselect: true,
  361. subGrid: false, // (1)开启子表格支持
  362. afterSaveCell: function (rowid, cellname, value) {
  363. debugger;
  364. //总扣分数加其他扣分数
  365. if (cellname === 'YLOTQTY') {
  366. var YLOTQTY = value;
  367. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  368. var str = Math.round((parseFloat(AllNumber) - parseFloat(YLOTQTY)) * 10) / 10;
  369. $gridList.jqGrid("setCell", rowid, 'NLOTQTY', str);
  370. }
  371. if (cellname === 'NLOTQTY') {
  372. var NLOTQTY = value;
  373. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  374. var str = Math.round((parseFloat(AllNumber) - parseFloat(NLOTQTY)) * 10) / 10;
  375. $gridList.jqGrid("setCell", rowid, 'YLOTQTY', str);
  376. }
  377. if (cellname === 'BadReasonDesc') {
  378. $gridList.jqGrid("setCell", rowid, 'BRCodeValue', value);
  379. }
  380. if (cellname === 'BadDesc') {
  381. $gridList.jqGrid("setCell", rowid, 'BCCodeValue', value);
  382. }
  383. },
  384. });
  385. $("#btn_search").click(function () {
  386. var warehouse = $("#warehouse a.active").attr('data-value');
  387. var queryJson = {
  388. POCode: $("#txt_POCode").val(),
  389. ASNCode: $("#txt_ASNCode").val(),
  390. CaiGouCode: $("#txt_CaiGouCode").val(),
  391. VenCode: $("#txt_VenCode").val(),
  392. VenName: $("#txt_VenName").val(),
  393. InvCode: $("#txt_InvCode").val(),
  394. InvName: $("#txt_InvName").val(),
  395. BatchCode: $("#txt_BatchCode").val(),
  396. ReleaseState: $("#selShow").val(),
  397. }
  398. $gridList.jqGrid('setGridParam', {
  399. postData: { queryJson: JSON.stringify(queryJson) },
  400. }).trigger('reloadGrid');
  401. });
  402. }
  403. function gridList3() {
  404. var $gridList = $("#gridList");
  405. var queryJson = {
  406. POCode: $("#txt_POCode").val(),
  407. InvCode: $("#txt_InvCode").val(),
  408. InvName: $("#txt_InvName").val(),
  409. BatchCode: $("#txt_BatchCode").val(),
  410. ReleaseState: $("#selShow").val(),
  411. }
  412. $gridList.dataGrid({
  413. url: "/WMS/ICSRCVIQCs/GetICSInspection3" + "?" + Math.random(),
  414. postData: { queryJson: JSON.stringify(queryJson) },
  415. height: $(window).height() - 200,
  416. width: $(window).width() - 300,
  417. cellEdit: true,
  418. colModel: [
  419. { label: "主键", name: "ID", hidden: true, key: true },
  420. { label: 'ID', name: 'ID', hidden: true },
  421. { label: '工单ID', name: 'GDID', hidden: true },
  422. { label: '检验ID', name: 'JYID', hidden: true },
  423. { label: '工单单号', name: 'DNCode', width: 120, align: 'left' },
  424. { label: '条码', name: 'LotNo', width: 120, align: 'left' },
  425. { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  426. { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  427. { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' },
  428. { label: '批次', name: 'BatchCode', width: 100, align: 'left' },
  429. { label: '箱号', name: 'ContainerID', width: 100, align: 'left' },
  430. { label: '生产时间', name: 'ProductTime', width: 150, align: 'left' },
  431. { label: '总数量', name: 'AllNumber', width: 100, align: 'left' },
  432. { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  433. { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  434. { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  435. { label: '不良代码值', name: 'BCCodeValue', hidden: true },
  436. {
  437. label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false,
  438. formatter: function (cellvalue, options, rowObject) {
  439. debugger;
  440. var html = "";
  441. html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  442. html += ' </select>';
  443. return cellvalue = html;
  444. }
  445. },
  446. { label: '不良原因值', name: 'BRCodeValue', hidden: true },
  447. {
  448. label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false,
  449. formatter: function (cellvalue, options, rowObject) {
  450. var html = "";
  451. html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  452. html += ' </select>';
  453. return cellvalue = html;
  454. }
  455. },
  456. { label: '检验状态', name: 'TestState', width: 150, align: 'left' },
  457. { label: '检验人', name: 'Surveyor', width: 150, align: 'left' },
  458. { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' },
  459. ],
  460. cellsubmit: "clientArray",
  461. shrinkToFit: false,//宽度自适应
  462. autoWidth: true,
  463. gridComplete: function () {
  464. debugger;
  465. //设置select
  466. var RowDatas = $("#gridList").jqGrid('getDataIDs');
  467. for (var j = 0; j < RowDatas.length; j++) {
  468. var InvCode = $("#gridList").jqGrid("getCell", RowDatas[j], "InvCode");
  469. var ID = $("#gridList").jqGrid("getCell", RowDatas[j], "ID");
  470. var BCCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BCCodeValue");
  471. var BRCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BRCodeValue");
  472. GetSelectICSBadCode(InvCode, ID, BCCodeValue);
  473. GetSelectPerson(InvCode, ID, BRCodeValue);
  474. }
  475. },
  476. pager: "#gridPager",
  477. sortorder: "desc",
  478. sortname: 'DNCode ',
  479. viewrecords: true,
  480. multiselect: true,
  481. afterSaveCell: function (rowid, cellname, value) {
  482. debugger;
  483. //总扣分数加其他扣分数
  484. if (cellname === 'YLOTQTY') {
  485. var YLOTQTY = value;
  486. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  487. var str = Math.round((parseFloat(AllNumber) - parseFloat(YLOTQTY)) * 10) / 10;
  488. $gridList.jqGrid("setCell", rowid, 'NLOTQTY', str);
  489. }
  490. if (cellname === 'NLOTQTY') {
  491. var NLOTQTY = value;
  492. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  493. var str = Math.round((parseFloat(AllNumber) - parseFloat(NLOTQTY)) * 10) / 10;
  494. $gridList.jqGrid("setCell", rowid, 'YLOTQTY', str);
  495. }
  496. if (cellname === 'BadReasonDesc') {
  497. $gridList.jqGrid("setCell", rowid, 'BRCodeValue', value);
  498. }
  499. if (cellname === 'BadDesc') {
  500. $gridList.jqGrid("setCell", rowid, 'BCCodeValue', value);
  501. }
  502. },
  503. });
  504. $("#btn_search").click(function () {
  505. var warehouse = $("#warehouse a.active").attr('data-value');
  506. var queryJson = {
  507. POCode: $("#txt_POCode").val(),
  508. InvCode: $("#txt_InvCode").val(),
  509. InvName: $("#txt_InvName").val(),
  510. BatchCode: $("#txt_BatchCode").val(),
  511. ReleaseState: $("#selShow").val(),
  512. }
  513. $gridList.jqGrid('setGridParam', {
  514. postData: { queryJson: JSON.stringify(queryJson) },
  515. }).trigger('reloadGrid');
  516. });
  517. }
  518. //获取不良原因
  519. function GetSelectPerson(InvCode, ID, BRCodeValue) {
  520. var str = "";
  521. $.ajax({
  522. url: "/WMS/ICSRCVIQCs/Select_ICSBadReason?InvCode=" + InvCode + "&" + Math.random(),
  523. dataType: "json",
  524. async: false,
  525. async: false,
  526. success: function (data) {
  527. if (data != null && data.length > 0) {
  528. $("#SelBR_" + ID + "").find("option").remove();
  529. for (var i = 0; i < data.length; i++) {
  530. $("#SelBR_" + ID + "").append("<option value='" + data[i].BadReasonCode + "'>" + data[i].BadReasonDesc + "</option>");
  531. }
  532. }
  533. }
  534. });
  535. $("#SelBR_" + ID + "").selectpicker('refresh');
  536. $("#SelBR_" + ID + "").selectpicker('val', BRCodeValue);
  537. }
  538. //获取不良代码
  539. function GetSelectICSBadCode(InvCode, ID, BCCodeValue) {
  540. var str = "";
  541. $.ajax({
  542. url: "/WMS/ICSRCVIQCs/GetSelectICSBadCode?InvCode=" + InvCode + "&" + Math.random(),
  543. dataType: "json",
  544. async: false,
  545. async: false,
  546. success: function (data) {
  547. if (data != null && data.length > 0) {
  548. $("#SelBC_" + ID + "").find("option").remove();
  549. for (var i = 0; i < data.length; i++) {
  550. $("#SelBC_" + ID + "").append("<option value='" + data[i].BadCode + "'>" + data[i].BadDesc + "</option>");
  551. }
  552. }
  553. }
  554. });
  555. $("#SelBC_" + ID + "").selectpicker('refresh');
  556. $("#SelBC_" + ID + "").selectpicker('val', BCCodeValue);
  557. }
  558. function btnSave() {
  559. debugger;
  560. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  561. if (ids.length == 0) {
  562. $.modalAlert("请选择数据!");
  563. return;
  564. }
  565. var IDlist = "";
  566. var ICSInspection = [];
  567. var flag = '';
  568. for (var i = 0; i < ids.length; i++) {
  569. var rowData = $("#gridList").jqGrid('getRowData', ids[i]);
  570. IDlist += "'" + rowData.ID + "',";
  571. if (rowData.NLOTQTY > 0) {
  572. if (rowData.BadDesc == '' || rowData.BadReasonDesc == '') {
  573. $.modalAlert("请选择不良原因及不良代码!");
  574. return;
  575. }
  576. }
  577. if (rowData.YLOTQTY < 0 || rowData.NLOTQTY < 0) {
  578. $.modalAlert("数量异常,请重新输入合格数量或不合格数量!");
  579. return;
  580. }
  581. if (rowData.SpecialQTY > rowData.NLOTQTY) {
  582. $.modalAlert("特采数量不得大于不合格数量!");
  583. return;
  584. }
  585. var obj = {
  586. AllNumber: rowData.AllNumber,//总数量
  587. YLOTQTY: rowData.YLOTQTY,//合格数量
  588. NLOTQTY: rowData.NLOTQTY,//不合格数量
  589. SpecialQTY: rowData.SpecialQTY,//特采数量
  590. LotNo: rowData.LotNo,//条码
  591. InvCode: rowData.InvCode,//物料编码
  592. BCCode: $("#SelBC_" + rowData.ID + "").val(),//不良代码
  593. BRCode: $("#SelBR_" + rowData.ID + "").val(),//不良原因
  594. Type: Type,
  595. TestState: rowData.TestState,
  596. JYID: rowData.JYID
  597. }
  598. ICSInspection.push(obj);
  599. }
  600. $.modalConfirm("确定保存吗?", function (r) {
  601. if (r) {
  602. $.submitForm({
  603. url: "/WMS/ICSRCVIQCs/CreateICSInspection" + "?" + Math.random(),
  604. param: { keyValue: IDlist, ICSInspections: JSON.stringify(ICSInspection) },
  605. success: function () {
  606. $.currentWindow().$("#gridList").trigger("reloadGrid");
  607. }
  608. })
  609. }
  610. });
  611. }
  612. //退回
  613. function btnSendBack() {
  614. debugger;
  615. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  616. if (ids.length == 0) {
  617. $.modalAlert("请选择数据!");
  618. return;
  619. }
  620. var IDlist = "";
  621. var selShow = $("#selShow").val();
  622. if (selShow != '1') {
  623. $.modalAlert("未经检验的单据,无法退回!");
  624. return;
  625. }
  626. for (var i = 0; i < ids.length; i++) {
  627. var rowData = $("#gridList").jqGrid('getRowData', ids[i]);
  628. if (rowData.AllNumber == rowData.YLOTQTY) {
  629. $.modalAlert("所选条码" + rowData.LotNo + ",全部合格无法退回!");
  630. return;
  631. }
  632. IDlist += "'" + rowData.LotNo + "',";
  633. }
  634. $.modalConfirm("确定退回吗?", function (r) {
  635. if (r) {
  636. $.submitForm({
  637. url: "/WMS/ICSRCVIQCs/CreateRejection?Type=" + Type + "&" + Math.random(),
  638. param: { keyValue: IDlist },
  639. success: function () {
  640. $.currentWindow().$("#gridList").trigger("reloadGrid");
  641. }
  642. })
  643. }
  644. });
  645. }
  646. </script>
  647. <div class="topPanel" style="height:100px">
  648. <div class="toolbar">
  649. <div class="btn-group">
  650. <a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnSave()"><i class="fa fa-pencil-square-o"></i>保存检验结果</a>
  651. <a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btnSendBack()"><i class="fa fa-pencil-square-o"></i>生成拒收单</a>
  652. @*<a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>*@
  653. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  654. </div>
  655. </div>
  656. <div class="search">
  657. <table>
  658. <tr>
  659. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单据号</label>:</td>
  660. <td>
  661. <div class="input-group">
  662. <input id="txt_POCode" type="text" class="form-control" style="width: 105px;">
  663. </div>
  664. </td>
  665. <td class="HideTxt" style="text-align:right;"><label class="lglabel HideTxt" for="txt_ASNCode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送货单号</label>:</td>
  666. <td>
  667. <div class="input-group HideTxt">
  668. <input id="txt_ASNCode" type="text" class="form-control HideTxt" style="width: 105px;">
  669. </div>
  670. </td>
  671. <td class="HideTxt" style="text-align:right;"><label class="lglabel HideTxt" for="txt_CaiGouCode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;采购订单号</label>:</td>
  672. <td>
  673. <div class="input-group">
  674. <input id="txt_CaiGouCode" type="text" class="form-control HideTxt" style="width: 105px;">
  675. </div>
  676. </td>
  677. <td class="HideTxt" style="text-align:right;"><label class="lglabel" for="txt_VenCode HideTxt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;供应商代码</label>:</td>
  678. <td>
  679. <div class="input-group HideTxt">
  680. <input id="txt_VenCode" type="text" class="form-control HideTxt" style="width: 105px;">
  681. </div>
  682. </td>
  683. <td class="HideTxt" style="text-align:right;"><label class="lglabel HideTxt" for="txt_VenName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;供应商名称</label>:</td>
  684. <td>
  685. <div class="input-group HideTxt">
  686. <input id="txt_VenName" type="text" class="form-control HideTxt" style="width: 105px;">
  687. </div>
  688. </td>
  689. </tr>
  690. <tr>
  691. <td style="text-align:right;"><label class="lglabel" for="txt_InvCode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;料品编码</label>:</td>
  692. <td>
  693. <div class="input-group">
  694. <input id="txt_InvCode" type="text" class="form-control" style="width: 105px;">
  695. </div>
  696. </td>
  697. <td style="text-align:right;"><label class="lglabel" for="txt_InvName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;料品名称</label>:</td>
  698. <td>
  699. <div class="input-group">
  700. <input id="txt_InvName" type="text" class="form-control" style="width: 105px;">
  701. </div>
  702. </td>
  703. <td style="text-align:right;"><label class="lglabel" for="txt_BatchCode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;批次号</label>:</td>
  704. <td>
  705. <div class="input-group">
  706. <input id="txt_BatchCode" type="text" class="form-control" style="width: 105px;">
  707. </div>
  708. </td>
  709. <td>
  710. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单据状态:</label>
  711. </td>
  712. <td>
  713. <div class="input-group">
  714. <select id="selShow" name="F_Target" class="form-control" style="width: 105px;">
  715. <option value="1">已检验</option>
  716. <option value="0" selected="selected">未检验</option>
  717. </select>
  718. </div>
  719. </td>
  720. <td>
  721. <span class="input-group-btn">
  722. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  723. </span>
  724. </td>
  725. </tr>
  726. </table>
  727. </div>
  728. </div>
  729. <div class="gridPanel">
  730. <table id="gridList"></table>
  731. <div id="gridPager"></div>
  732. </div>