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

945 lines
48 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 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
2 years ago
3 years ago
2 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: '操作', width: 120, align: 'left', formatter: btnLook };
  60. cols.push(collast);
  61. var collast = { label: '到货单号', name: 'DNCode', width: 120, align: 'left' };
  62. cols.push(collast);
  63. var collast = { label: '送货单号', name: 'ASNCode', width: 120, align: 'left' };
  64. cols.push(collast);
  65. var collast = { label: '采购订单号', name: 'POCode', width: 120, align: 'left' };
  66. cols.push(collast);
  67. var collast = { label: '条码', name: 'LotNo', width: 120, align: 'left' };
  68. cols.push(collast);
  69. var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
  70. cols.push(collast);
  71. var collast = { label: '物料描述', name: 'InvName', width: 100, align: 'left' };
  72. cols.push(collast);
  73. var collast = { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' };
  74. cols.push(collast);
  75. //var collast = { label: '批次', name: 'BatchCode', width: 100, align: 'left' };
  76. //cols.push(collast);
  77. var collast = { label: '箱号', name: 'ContainerID', width: 100, align: 'left' };
  78. cols.push(collast);
  79. var collast = { label: '到货时间', name: 'CreateDateTime', width: 150, align: 'left' };
  80. cols.push(collast);
  81. var collast = { label: '供应商代码', name: 'VenCode', width: 150, align: 'left' };
  82. cols.push(collast);
  83. var collast = { label: '供应商名称', name: 'VenName', width: 150, align: 'left' };
  84. cols.push(collast);
  85. var collast = { label: '总数量', name: 'AllNumber', width: 100, align: 'left' };
  86. cols.push(collast);
  87. var collast = { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  88. cols.push(collast);
  89. var collast = { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  90. cols.push(collast);
  91. var collast = { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  92. cols.push(collast);
  93. var collast = { label: '不良代码值', name: 'BCCodeValue', hidden: true };
  94. cols.push(collast);
  95. var collast = {
  96. label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false,
  97. formatter: function (cellvalue, options, rowObject) {
  98. debugger;
  99. var html = "";
  100. html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  101. html += ' </select>';
  102. return cellvalue = html;
  103. }
  104. };
  105. cols.push(collast);
  106. var collast = { label: '不良原因值', name: 'BRCodeValue', hidden: true };
  107. cols.push(collast);
  108. var collast = {
  109. label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false,
  110. formatter: function (cellvalue, options, rowObject) {
  111. var html = "";
  112. html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  113. html += ' </select>';
  114. return cellvalue = html;
  115. }
  116. };
  117. cols.push(collast);
  118. var collast = { label: '检验状态', name: 'TestState', width: 150, align: 'left' };
  119. cols.push(collast);
  120. var collast = { label: '检验人', name: 'Surveyor', width: 150, align: 'left' };
  121. cols.push(collast);
  122. var collast = { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' };
  123. cols.push(collast);
  124. }
  125. //委外来料检验
  126. if (Type == '3') {
  127. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  128. cols.push(collast);
  129. var collast = { label: 'ID', name: 'ID', hidden: true };
  130. cols.push(collast);
  131. var collast = { label: '到货ID', name: 'DHID', hidden: true };
  132. cols.push(collast);
  133. var collast = { label: '检验ID', name: 'JYID', hidden: true };
  134. cols.push(collast);
  135. var collast = { label: '操作', width: 120, align: 'left', formatter: btnLook };
  136. cols.push(collast);
  137. var collast = { label: '委外到货单号', name: 'DNCode', width: 120, align: 'left' };
  138. cols.push(collast);
  139. var collast = { label: '委外送货单号', name: 'OASNCode', width: 120, align: 'left' };
  140. cols.push(collast);
  141. var collast = { label: '委外采购订单号', name: 'OOCode', width: 120, align: 'left' };
  142. cols.push(collast);
  143. var collast = { label: '条码', name: 'LotNo', width: 120, align: 'left' };
  144. cols.push(collast);
  145. var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
  146. cols.push(collast);
  147. var collast = { label: '物料描述', name: 'InvName', width: 100, align: 'left' };
  148. cols.push(collast);
  149. var collast = { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' };
  150. cols.push(collast);
  151. //var collast = { label: '批次', name: 'BatchCode', width: 100, align: 'left' };
  152. //cols.push(collast);
  153. var collast = { label: '箱号', name: 'ContainerID', width: 100, align: 'left' };
  154. cols.push(collast);
  155. var collast = { label: '到货时间', name: 'CreateDateTime', width: 150, align: 'left' };
  156. cols.push(collast);
  157. var collast = { label: '供应商代码', name: 'VenCode', width: 150, align: 'left' };
  158. cols.push(collast);
  159. var collast = { label: '供应商名称', name: 'VenName', width: 150, align: 'left' };
  160. cols.push(collast);
  161. var collast = { label: '总数量', name: 'AllNumber', width: 100, align: 'left' };
  162. cols.push(collast);
  163. var collast = { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  164. cols.push(collast);
  165. var collast = { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  166. cols.push(collast);
  167. var collast = { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  168. cols.push(collast);
  169. var collast = { label: '不良代码值', name: 'BCCodeValue', hidden: true };
  170. cols.push(collast);
  171. var collast = {
  172. label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false,
  173. formatter: function (cellvalue, options, rowObject) {
  174. debugger;
  175. var html = "";
  176. html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  177. html += ' </select>';
  178. return cellvalue = html;
  179. }
  180. };
  181. cols.push(collast);
  182. var collast = { label: '不良原因值', name: 'BRCodeValue', hidden: true };
  183. cols.push(collast);
  184. var collast = {
  185. label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false,
  186. formatter: function (cellvalue, options, rowObject) {
  187. var html = "";
  188. html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  189. html += ' </select>';
  190. return cellvalue = html;
  191. }
  192. };
  193. cols.push(collast);
  194. var collast = { label: '检验状态', name: 'TestState', width: 150, align: 'left' };
  195. cols.push(collast);
  196. var collast = { label: '检验人', name: 'Surveyor', width: 150, align: 'left' };
  197. cols.push(collast);
  198. var collast = { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' };
  199. cols.push(collast);
  200. }
  201. //产成品检验
  202. if (Type == '2') {
  203. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  204. cols.push(collast);
  205. var collast = { label: 'ID', name: 'ID', hidden: true };
  206. cols.push(collast);
  207. var collast = { label: '工单ID', name: 'GDID', hidden: true };
  208. cols.push(collast);
  209. var collast = { label: '检验ID', name: 'JYID', hidden: true };
  210. cols.push(collast);
  211. var collast = { label: '操作', width: 120, align: 'left', formatter: btnLook };
  212. cols.push(collast);
  213. var collast = { label: '工单单号', name: 'DNCode', width: 120, align: 'left' };
  214. cols.push(collast);
  215. var collast = { label: '条码', name: 'LotNo', width: 120, align: 'left' };
  216. cols.push(collast);
  217. var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
  218. cols.push(collast);
  219. var collast = { label: '物料描述', name: 'InvName', width: 100, align: 'left' };
  220. cols.push(collast);
  221. var collast = { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' };
  222. cols.push(collast);
  223. //var collast = { label: '批次', name: 'BatchCode', width: 100, align: 'left' };
  224. //cols.push(collast);
  225. var collast = { label: '箱号', name: 'ContainerID', width: 100, align: 'left' };
  226. cols.push(collast);
  227. var collast = { label: '生产时间', name: 'ProductTime', width: 150, align: 'left' };
  228. cols.push(collast);
  229. var collast = { label: '总数量', name: 'AllNumber', width: 100, align: 'left' };
  230. cols.push(collast);
  231. var collast = { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  232. cols.push(collast);
  233. var collast = { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  234. cols.push(collast);
  235. var collast = { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } };
  236. cols.push(collast);
  237. var collast = { label: '不良代码值', name: 'BCCodeValue', hidden: true };
  238. cols.push(collast);
  239. var collast = {
  240. label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false,
  241. formatter: function (cellvalue, options, rowObject) {
  242. debugger;
  243. var html = "";
  244. html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  245. html += ' </select>';
  246. return cellvalue = html;
  247. }
  248. };
  249. cols.push(collast);
  250. var collast = { label: '不良原因值', name: 'BRCodeValue', hidden: true };
  251. cols.push(collast);
  252. var collast = {
  253. label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false,
  254. formatter: function (cellvalue, options, rowObject) {
  255. var html = "";
  256. html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  257. html += ' </select>';
  258. return cellvalue = html;
  259. }
  260. };
  261. cols.push(collast);
  262. var collast = { label: '检验状态', name: 'TestState', width: 150, align: 'left' };
  263. cols.push(collast);
  264. var collast = { label: '检验人', name: 'Surveyor', width: 150, align: 'left' };
  265. cols.push(collast);
  266. var collast = { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' };
  267. cols.push(collast);
  268. }
  269. if (data != null && data.length > 0) {
  270. DateList = data;
  271. for (var i = 0; i < data.length; i++) {
  272. var ColName = data[i].ColName;
  273. var ColCode = data[i].ColCode;
  274. var obj = new Array();
  275. obj = {
  276. label: ColName,
  277. name: ColCode,
  278. width: 80,
  279. align: "left"
  280. }
  281. cols.push(obj);
  282. }
  283. }
  284. _Clos = cols;
  285. }
  286. });
  287. }
  288. function gridList() {
  289. var $gridList = $("#gridList");
  290. var queryJson = {
  291. POCode: $("#txt_POCode").val(),
  292. ASNCode: $("#txt_ASNCode").val(),
  293. CaiGouCode: $("#txt_CaiGouCode").val(),
  294. VenCode: $("#txt_VenCode").val(),
  295. VenName: $("#txt_VenName").val(),
  296. InvCode: $("#txt_InvCode").val(),
  297. InvName: $("#txt_InvName").val(),
  298. BatchCode: $("#txt_BatchCode").val(),
  299. ReleaseState: $("#selShow").val(),
  300. }
  301. $gridList.dataGrid({
  302. url: "/WMS/ICSRCVIQCs/GetICSInspection" + "?" + Math.random(),
  303. postData: { queryJson: JSON.stringify(queryJson) },
  304. height: $(window).height() - 200,
  305. width: $(window).width() - 300,
  306. cellEdit: true,
  307. colModel: _Clos,
  308. //colModel: [
  309. // { label: "主键", name: "ID", hidden: true, key: true },
  310. // { label: 'ID', name: 'ID', hidden: true },
  311. // { label: '到货ID', name: 'DHID', hidden: true },
  312. // { label: '检验ID', name: 'JYID', hidden: true },
  313. // { label: '到货单号', name: 'DNCode', width: 120, align: 'left' },
  314. // { label: '送货单号', name: 'ASNCode', width: 120, align: 'left' },
  315. // { label: '采购订单号', name: 'POCode', width: 120, align: 'left' },
  316. // { label: '条码', name: 'LotNo', width: 120, align: 'left' },
  317. // { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  318. // { label: '物料描述', name: 'InvName', width: 100, align: 'left' },
  319. // { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' },
  320. // { label: '批次', name: 'BatchCode', width: 100, align: 'left' },
  321. // { label: '箱号', name: 'ContainerID', width: 100, align: 'left' },
  322. // { label: '到货时间', name: 'CreateDateTime', width: 150, align: 'left' },
  323. // { label: '供应商代码', name: 'VenCode', width: 150, align: 'left' },
  324. // { label: '供应商名称', name: 'VenName', width: 150, align: 'left' },
  325. // { label: '总数量', name: 'AllNumber', width: 100, align: 'left' },
  326. // { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  327. // { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  328. // { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  329. // { label: '不良代码值', name: 'BCCodeValue', hidden: true },
  330. // {
  331. // label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false,
  332. // formatter: function (cellvalue, options, rowObject) {
  333. // debugger;
  334. // var html = "";
  335. // html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  336. // html += ' </select>';
  337. // return cellvalue = html;
  338. // }
  339. // },
  340. // { label: '不良原因值', name: 'BRCodeValue', hidden: true },
  341. // {
  342. // label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false,
  343. // formatter: function (cellvalue, options, rowObject) {
  344. // var html = "";
  345. // html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  346. // html += ' </select>';
  347. // return cellvalue = html;
  348. // }
  349. // },
  350. // { label: '检验状态', name: 'TestState', width: 150, align: 'left' },
  351. // { label: '检验人', name: 'Surveyor', width: 150, align: 'left' },
  352. // { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' },
  353. //],
  354. cellsubmit: "clientArray",
  355. shrinkToFit: false,//宽度自适应
  356. autoWidth: true,
  357. gridComplete: function () {
  358. debugger;
  359. //设置select
  360. var RowDatas = $("#gridList").jqGrid('getDataIDs');
  361. for (var j = 0; j < RowDatas.length; j++) {
  362. var InvCode = $("#gridList").jqGrid("getCell", RowDatas[j], "InvCode");
  363. var ID = $("#gridList").jqGrid("getCell", RowDatas[j], "ID");
  364. var BCCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BCCodeValue");
  365. var BRCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BRCodeValue");
  366. GetSelectICSBadCode(InvCode, ID, BCCodeValue);
  367. GetSelectPerson(InvCode, ID, BRCodeValue);
  368. }
  369. },
  370. pager: "#gridPager",
  371. sortorder: "desc",
  372. sortname: 'DNCode ',
  373. viewrecords: true,
  374. multiselect: true,
  375. subGrid: false, // (1)开启子表格支持
  376. afterSaveCell: function (rowid, cellname, value) {
  377. debugger;
  378. //总扣分数加其他扣分数
  379. if (cellname === 'YLOTQTY') {
  380. var YLOTQTY = value;
  381. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  382. var str = Math.round((parseFloat(AllNumber) - parseFloat(YLOTQTY)) * 10) / 10;
  383. $gridList.jqGrid("setCell", rowid, 'NLOTQTY', str);
  384. }
  385. if (cellname === 'NLOTQTY') {
  386. var NLOTQTY = value;
  387. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  388. var str = Math.round((parseFloat(AllNumber) - parseFloat(NLOTQTY)) * 10) / 10;
  389. $gridList.jqGrid("setCell", rowid, 'YLOTQTY', str);
  390. }
  391. },
  392. });
  393. $("#btn_search").click(function () {
  394. var warehouse = $("#warehouse a.active").attr('data-value');
  395. var queryJson = {
  396. POCode: $("#txt_POCode").val(),
  397. ASNCode: $("#txt_ASNCode").val(),
  398. CaiGouCode: $("#txt_CaiGouCode").val(),
  399. VenCode: $("#txt_VenCode").val(),
  400. VenName: $("#txt_VenName").val(),
  401. InvCode: $("#txt_InvCode").val(),
  402. InvName: $("#txt_InvName").val(),
  403. BatchCode: $("#txt_BatchCode").val(),
  404. ReleaseState: $("#selShow").val(),
  405. }
  406. $gridList.jqGrid('setGridParam', {
  407. postData: { queryJson: JSON.stringify(queryJson) },
  408. }).trigger('reloadGrid');
  409. });
  410. }
  411. function gridList2() {
  412. var $gridList = $("#gridList");
  413. var queryJson = {
  414. POCode: $("#txt_POCode").val(),
  415. ASNCode: $("#txt_ASNCode").val(),
  416. CaiGouCode: $("#txt_CaiGouCode").val(),
  417. VenCode: $("#txt_VenCode").val(),
  418. VenName: $("#txt_VenName").val(),
  419. InvCode: $("#txt_InvCode").val(),
  420. InvName: $("#txt_InvName").val(),
  421. BatchCode: $("#txt_BatchCode").val(),
  422. ReleaseState: $("#selShow").val(),
  423. }
  424. $gridList.dataGrid({
  425. url: "/WMS/ICSRCVIQCs/GetICSInspection2" + "?" + Math.random(),
  426. postData: { queryJson: JSON.stringify(queryJson) },
  427. height: $(window).height() - 200,
  428. width: $(window).width() - 300,
  429. cellEdit: true,
  430. colModel: _Clos,
  431. //colModel: [
  432. // { label: "主键", name: "ID", hidden: true, key: true },
  433. // { label: 'ID', name: 'ID', hidden: true },
  434. // { label: '到货ID', name: 'DHID', hidden: true },
  435. // { label: '检验ID', name: 'JYID', hidden: true },
  436. // { label: '委外到货单号', name: 'DNCode', width: 120, align: 'left' },
  437. // { label: '委外送货单号', name: 'OASNCode', width: 120, align: 'left' },
  438. // { label: '委外采购订单号', name: 'OOCode', width: 120, align: 'left' },
  439. // { label: '条码', name: 'LotNo', width: 120, align: 'left' },
  440. // { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  441. // { label: '物料描述', name: 'InvName', width: 100, align: 'left' },
  442. // { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' },
  443. // { label: '批次', name: 'BatchCode', width: 100, align: 'left' },
  444. // { label: '箱号', name: 'ContainerID', width: 100, align: 'left' },
  445. // { label: '到货时间', name: 'CreateDateTime', width: 150, align: 'left' },
  446. // { label: '供应商代码', name: 'VenCode', width: 150, align: 'left' },
  447. // { label: '供应商名称', name: 'VenName', width: 150, align: 'left' },
  448. // { label: '总数量', name: 'AllNumber', width: 100, align: 'left' },
  449. // { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  450. // { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  451. // { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  452. // { label: '不良代码值', name: 'BCCodeValue', hidden: true },
  453. // {
  454. // label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false,
  455. // formatter: function (cellvalue, options, rowObject) {
  456. // debugger;
  457. // var html = "";
  458. // html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  459. // html += ' </select>';
  460. // return cellvalue = html;
  461. // }
  462. // },
  463. // { label: '不良原因值', name: 'BRCodeValue', hidden: true },
  464. // {
  465. // label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false,
  466. // formatter: function (cellvalue, options, rowObject) {
  467. // var html = "";
  468. // html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  469. // html += ' </select>';
  470. // return cellvalue = html;
  471. // }
  472. // },
  473. // { label: '检验状态', name: 'TestState', width: 150, align: 'left' },
  474. // { label: '检验人', name: 'Surveyor', width: 150, align: 'left' },
  475. // { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' },
  476. //],
  477. cellsubmit: "clientArray",
  478. shrinkToFit: false,//宽度自适应
  479. autoWidth: true,
  480. gridComplete: function () {
  481. debugger;
  482. //设置select
  483. var RowDatas = $("#gridList").jqGrid('getDataIDs');
  484. for (var j = 0; j < RowDatas.length; j++) {
  485. var InvCode = $("#gridList").jqGrid("getCell", RowDatas[j], "InvCode");
  486. var ID = $("#gridList").jqGrid("getCell", RowDatas[j], "ID");
  487. var BCCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BCCodeValue");
  488. var BRCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BRCodeValue");
  489. GetSelectICSBadCode(InvCode, ID, BCCodeValue);
  490. GetSelectPerson(InvCode, ID, BRCodeValue);
  491. }
  492. },
  493. pager: "#gridPager",
  494. sortorder: "desc",
  495. sortname: 'DNCode ',
  496. viewrecords: true,
  497. multiselect: true,
  498. subGrid: false, // (1)开启子表格支持
  499. afterSaveCell: function (rowid, cellname, value) {
  500. debugger;
  501. //总扣分数加其他扣分数
  502. if (cellname === 'YLOTQTY') {
  503. var YLOTQTY = value;
  504. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  505. var str = Math.round((parseFloat(AllNumber) - parseFloat(YLOTQTY)) * 10) / 10;
  506. $gridList.jqGrid("setCell", rowid, 'NLOTQTY', str);
  507. }
  508. if (cellname === 'NLOTQTY') {
  509. var NLOTQTY = value;
  510. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  511. var str = Math.round((parseFloat(AllNumber) - parseFloat(NLOTQTY)) * 10) / 10;
  512. $gridList.jqGrid("setCell", rowid, 'YLOTQTY', str);
  513. }
  514. if (cellname === 'BadReasonDesc') {
  515. $gridList.jqGrid("setCell", rowid, 'BRCodeValue', value);
  516. }
  517. if (cellname === 'BadDesc') {
  518. $gridList.jqGrid("setCell", rowid, 'BCCodeValue', value);
  519. }
  520. },
  521. });
  522. $("#btn_search").click(function () {
  523. var warehouse = $("#warehouse a.active").attr('data-value');
  524. var queryJson = {
  525. POCode: $("#txt_POCode").val(),
  526. ASNCode: $("#txt_ASNCode").val(),
  527. CaiGouCode: $("#txt_CaiGouCode").val(),
  528. VenCode: $("#txt_VenCode").val(),
  529. VenName: $("#txt_VenName").val(),
  530. InvCode: $("#txt_InvCode").val(),
  531. InvName: $("#txt_InvName").val(),
  532. BatchCode: $("#txt_BatchCode").val(),
  533. ReleaseState: $("#selShow").val(),
  534. }
  535. $gridList.jqGrid('setGridParam', {
  536. postData: { queryJson: JSON.stringify(queryJson) },
  537. }).trigger('reloadGrid');
  538. });
  539. }
  540. function gridList3() {
  541. var $gridList = $("#gridList");
  542. var queryJson = {
  543. POCode: $("#txt_POCode").val(),
  544. InvCode: $("#txt_InvCode").val(),
  545. InvName: $("#txt_InvName").val(),
  546. BatchCode: $("#txt_BatchCode").val(),
  547. ReleaseState: $("#selShow").val(),
  548. }
  549. $gridList.dataGrid({
  550. url: "/WMS/ICSRCVIQCs/GetICSInspection3" + "?" + Math.random(),
  551. postData: { queryJson: JSON.stringify(queryJson) },
  552. height: $(window).height() - 200,
  553. width: $(window).width() - 300,
  554. cellEdit: true,
  555. colModel: _Clos,
  556. //colModel: [
  557. // { label: "主键", name: "ID", hidden: true, key: true },
  558. // { label: 'ID', name: 'ID', hidden: true },
  559. // { label: '工单ID', name: 'GDID', hidden: true },
  560. // { label: '检验ID', name: 'JYID', hidden: true },
  561. // { label: '工单单号', name: 'DNCode', width: 120, align: 'left' },
  562. // { label: '条码', name: 'LotNo', width: 120, align: 'left' },
  563. // { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  564. // { label: '物料描述', name: 'InvName', width: 100, align: 'left' },
  565. // { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' },
  566. // { label: '批次', name: 'BatchCode', width: 100, align: 'left' },
  567. // { label: '箱号', name: 'ContainerID', width: 100, align: 'left' },
  568. // { label: '生产时间', name: 'ProductTime', width: 150, align: 'left' },
  569. // { label: '总数量', name: 'AllNumber', width: 100, align: 'left' },
  570. // { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  571. // { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  572. // { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } },
  573. // { label: '不良代码值', name: 'BCCodeValue', hidden: true },
  574. // {
  575. // label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false,
  576. // formatter: function (cellvalue, options, rowObject) {
  577. // debugger;
  578. // var html = "";
  579. // html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  580. // html += ' </select>';
  581. // return cellvalue = html;
  582. // }
  583. // },
  584. // { label: '不良原因值', name: 'BRCodeValue', hidden: true },
  585. // {
  586. // label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false,
  587. // formatter: function (cellvalue, options, rowObject) {
  588. // var html = "";
  589. // html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">';
  590. // html += ' </select>';
  591. // return cellvalue = html;
  592. // }
  593. // },
  594. // { label: '检验状态', name: 'TestState', width: 150, align: 'left' },
  595. // { label: '检验人', name: 'Surveyor', width: 150, align: 'left' },
  596. // { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' },
  597. //],
  598. cellsubmit: "clientArray",
  599. shrinkToFit: false,//宽度自适应
  600. autoWidth: true,
  601. gridComplete: function () {
  602. debugger;
  603. //设置select
  604. var RowDatas = $("#gridList").jqGrid('getDataIDs');
  605. for (var j = 0; j < RowDatas.length; j++) {
  606. var InvCode = $("#gridList").jqGrid("getCell", RowDatas[j], "InvCode");
  607. var ID = $("#gridList").jqGrid("getCell", RowDatas[j], "ID");
  608. var BCCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BCCodeValue");
  609. var BRCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BRCodeValue");
  610. GetSelectICSBadCode(InvCode, ID, BCCodeValue);
  611. GetSelectPerson(InvCode, ID, BRCodeValue);
  612. }
  613. },
  614. pager: "#gridPager",
  615. sortorder: "desc",
  616. sortname: 'DNCode ',
  617. viewrecords: true,
  618. multiselect: true,
  619. afterSaveCell: function (rowid, cellname, value) {
  620. debugger;
  621. //总扣分数加其他扣分数
  622. if (cellname === 'YLOTQTY') {
  623. var YLOTQTY = value;
  624. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  625. var str = Math.round((parseFloat(AllNumber) - parseFloat(YLOTQTY)) * 10) / 10;
  626. $gridList.jqGrid("setCell", rowid, 'NLOTQTY', str);
  627. }
  628. if (cellname === 'NLOTQTY') {
  629. var NLOTQTY = value;
  630. var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber');
  631. var str = Math.round((parseFloat(AllNumber) - parseFloat(NLOTQTY)) * 10) / 10;
  632. $gridList.jqGrid("setCell", rowid, 'YLOTQTY', str);
  633. }
  634. if (cellname === 'BadReasonDesc') {
  635. $gridList.jqGrid("setCell", rowid, 'BRCodeValue', value);
  636. }
  637. if (cellname === 'BadDesc') {
  638. $gridList.jqGrid("setCell", rowid, 'BCCodeValue', value);
  639. }
  640. },
  641. });
  642. $("#btn_search").click(function () {
  643. var warehouse = $("#warehouse a.active").attr('data-value');
  644. var queryJson = {
  645. POCode: $("#txt_POCode").val(),
  646. InvCode: $("#txt_InvCode").val(),
  647. InvName: $("#txt_InvName").val(),
  648. BatchCode: $("#txt_BatchCode").val(),
  649. ReleaseState: $("#selShow").val(),
  650. }
  651. $gridList.jqGrid('setGridParam', {
  652. postData: { queryJson: JSON.stringify(queryJson) },
  653. }).trigger('reloadGrid');
  654. });
  655. }
  656. //获取不良原因
  657. function GetSelectPerson(InvCode, ID, BRCodeValue) {
  658. var str = "";
  659. $.ajax({
  660. url: "/WMS/ICSRCVIQCs/Select_ICSBadReason?InvCode=" + InvCode + "&" + Math.random(),
  661. dataType: "json",
  662. async: false,
  663. async: false,
  664. success: function (data) {
  665. if (data != null && data.length > 0) {
  666. $("#SelBR_" + ID + "").find("option").remove();
  667. for (var i = 0; i < data.length; i++) {
  668. $("#SelBR_" + ID + "").append("<option value='" + data[i].BadReasonCode + "'>" + data[i].BadReasonDesc + "</option>");
  669. }
  670. }
  671. }
  672. });
  673. $("#SelBR_" + ID + "").selectpicker('refresh');
  674. $("#SelBR_" + ID + "").selectpicker('val', BRCodeValue);
  675. }
  676. //获取不良代码
  677. function GetSelectICSBadCode(InvCode, ID, BCCodeValue) {
  678. var str = "";
  679. $.ajax({
  680. url: "/WMS/ICSRCVIQCs/GetSelectICSBadCode?InvCode=" + InvCode + "&" + Math.random(),
  681. dataType: "json",
  682. async: false,
  683. async: false,
  684. success: function (data) {
  685. if (data != null && data.length > 0) {
  686. $("#SelBC_" + ID + "").find("option").remove();
  687. for (var i = 0; i < data.length; i++) {
  688. $("#SelBC_" + ID + "").append("<option value='" + data[i].BadCode + "'>" + data[i].BadDesc + "</option>");
  689. }
  690. }
  691. }
  692. });
  693. $("#SelBC_" + ID + "").selectpicker('refresh');
  694. $("#SelBC_" + ID + "").selectpicker('val', BCCodeValue);
  695. }
  696. function btnSave() {
  697. debugger;
  698. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  699. if (ids.length == 0) {
  700. $.modalAlertNew("WMS00004");
  701. return;
  702. }
  703. var IDlist = "";
  704. var ICSInspection = [];
  705. var flag = '';
  706. for (var i = 0; i < ids.length; i++) {
  707. var rowData = $("#gridList").jqGrid('getRowData', ids[i]);
  708. IDlist += "'" + rowData.ID + "',";
  709. if (rowData.NLOTQTY > 0) {
  710. if (rowData.BadDesc == '' || rowData.BadReasonDesc == '') {
  711. $.modalAlertNew("WMS00081");
  712. return;
  713. }
  714. }
  715. if (rowData.YLOTQTY < 0 || rowData.NLOTQTY < 0) {
  716. $.modalAlertNew("WMS00082");
  717. return;
  718. }
  719. if (rowData.SpecialQTY > rowData.NLOTQTY) {
  720. $.modalAlertNew("WMS00083");
  721. return;
  722. }
  723. var obj = {
  724. AllNumber: rowData.AllNumber,//总数量
  725. YLOTQTY: rowData.YLOTQTY,//合格数量
  726. NLOTQTY: rowData.NLOTQTY,//不合格数量
  727. SpecialQTY: rowData.SpecialQTY,//特采数量
  728. LotNo: rowData.LotNo,//条码
  729. InvCode: rowData.InvCode,//物料编码
  730. BCCode: $("#SelBC_" + rowData.ID + "").val(),//不良代码
  731. BRCode: $("#SelBR_" + rowData.ID + "").val(),//不良原因
  732. Type: Type,
  733. TestState: rowData.TestState,
  734. JYID: rowData.JYID
  735. }
  736. ICSInspection.push(obj);
  737. }
  738. $.modalConfirm("确定保存吗?", function (r) {
  739. if (r) {
  740. $.submitForm({
  741. url: "/WMS/ICSRCVIQCs/CreateICSInspection" + "?" + Math.random(),
  742. param: { keyValue: IDlist, ICSInspections: JSON.stringify(ICSInspection) },
  743. success: function () {
  744. $.currentWindow().$("#gridList").trigger("reloadGrid");
  745. }
  746. })
  747. }
  748. });
  749. }
  750. function btnLook(cellvalue, options, rowObject) {
  751. return cellvalue = "<a class=\"btn btn-info dropdown-text\" onclick=\"UpLoadClick('" + rowObject.InvCode + "','" + rowObject.JYID + "')\">查看</ a>";
  752. }
  753. function UpLoadClick(InvCode, JYID) {
  754. debugger;
  755. if (JYID=='') {
  756. $.modalAlertNew("WMS00104");
  757. return;
  758. }
  759. $.modalOpen({
  760. id: "CheckInfo",
  761. title: "查看信息",
  762. url: "/WMS/ICSRCVIQCs/ICSInspectionDetail?InvCode=" + encodeURI(encodeURI(InvCode)) + "&JYID=" + encodeURI(encodeURI(JYID)) + "&" + Math.random(),
  763. width: "1000px",
  764. height: "400px",
  765. callBack: function (iframeId) {
  766. top.frames[iframeId].submitForm();
  767. }
  768. });
  769. }
  770. //退回
  771. function btnSendBack() {
  772. debugger;
  773. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  774. if (ids.length == 0) {
  775. $.modalAlertNew("WMS00004");
  776. return;
  777. }
  778. var IDlist = "";
  779. var selShow = $("#selShow").val();
  780. if (selShow != '1') {
  781. $.modalAlertNew("WMS00084");
  782. return;
  783. }
  784. for (var i = 0; i < ids.length; i++) {
  785. var rowData = $("#gridList").jqGrid('getRowData', ids[i]);
  786. if (rowData.AllNumber == rowData.YLOTQTY) {
  787. $.modalAlertNew("WMS00085", rowData.LotNo);
  788. return;
  789. }
  790. IDlist += "'" + rowData.LotNo + "',";
  791. }
  792. $.modalConfirm("确定退回吗?", function (r) {
  793. if (r) {
  794. $.submitForm({
  795. url: "/WMS/ICSRCVIQCs/CreateRejection?Type=" + Type + "&" + Math.random(),
  796. param: { keyValue: IDlist },
  797. success: function () {
  798. $.currentWindow().$("#gridList").trigger("reloadGrid");
  799. }
  800. })
  801. }
  802. });
  803. }
  804. </script>
  805. <div class="topPanel" style="height:100px">
  806. <div class="toolbar">
  807. <div class="btn-group">
  808. <a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnSave()"><i class="fa fa-pencil-square-o"></i>保存检验结果</a>
  809. <a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btnSendBack()"><i class="fa fa-pencil-square-o"></i>生成拒收单</a>
  810. @*<a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>*@
  811. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  812. </div>
  813. </div>
  814. <div class="search">
  815. <table>
  816. <tr>
  817. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单据号</label>:</td>
  818. <td>
  819. <div class="input-group">
  820. <input id="txt_POCode" type="text" class="form-control" style="width: 105px;">
  821. </div>
  822. </td>
  823. <td class="HideTxt" style="text-align:right;"><label class="lglabel HideTxt" for="txt_ASNCode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送货单号</label>:</td>
  824. <td>
  825. <div class="input-group HideTxt">
  826. <input id="txt_ASNCode" type="text" class="form-control HideTxt" style="width: 105px;">
  827. </div>
  828. </td>
  829. <td class="HideTxt" style="text-align:right;"><label class="lglabel HideTxt" for="txt_CaiGouCode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;采购订单号</label>:</td>
  830. <td>
  831. <div class="input-group">
  832. <input id="txt_CaiGouCode" type="text" class="form-control HideTxt" style="width: 105px;">
  833. </div>
  834. </td>
  835. <td class="HideTxt" style="text-align:right;"><label class="lglabel" for="txt_VenCode HideTxt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;供应商代码</label>:</td>
  836. <td>
  837. <div class="input-group HideTxt">
  838. <input id="txt_VenCode" type="text" class="form-control HideTxt" style="width: 105px;">
  839. </div>
  840. </td>
  841. <td class="HideTxt" style="text-align:right;"><label class="lglabel HideTxt" for="txt_VenName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;供应商名称</label>:</td>
  842. <td>
  843. <div class="input-group HideTxt">
  844. <input id="txt_VenName" type="text" class="form-control HideTxt" style="width: 105px;">
  845. </div>
  846. </td>
  847. </tr>
  848. <tr>
  849. <td style="text-align:right;"><label class="lglabel" for="txt_InvCode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;料品编码</label>:</td>
  850. <td>
  851. <div class="input-group">
  852. <input id="txt_InvCode" type="text" class="form-control" style="width: 105px;">
  853. </div>
  854. </td>
  855. <td style="text-align:right;"><label class="lglabel" for="txt_InvName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;物料描述</label>:</td>
  856. <td>
  857. <div class="input-group">
  858. <input id="txt_InvName" type="text" class="form-control" style="width: 105px;">
  859. </div>
  860. </td>
  861. <td style="text-align:right;"><label class="lglabel" for="txt_BatchCode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;批次号</label>:</td>
  862. <td>
  863. <div class="input-group">
  864. <input id="txt_BatchCode" type="text" class="form-control" style="width: 105px;">
  865. </div>
  866. </td>
  867. <td>
  868. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单据状态:</label>
  869. </td>
  870. <td>
  871. <div class="input-group">
  872. <select id="selShow" name="F_Target" class="form-control" style="width: 105px;">
  873. <option value="1">已检验</option>
  874. <option value="0" selected="selected">未检验</option>
  875. </select>
  876. </div>
  877. </td>
  878. <td>
  879. <span class="input-group-btn">
  880. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  881. </span>
  882. </td>
  883. </tr>
  884. </table>
  885. </div>
  886. </div>
  887. <div class="gridPanel">
  888. <table id="gridList"></table>
  889. <div id="gridPager"></div>
  890. </div>