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.

649 lines
28 KiB

3 days ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <style>
  4. #fm label {
  5. width: 152px;
  6. }
  7. </style>
  8. <#if errorMsg??>
  9. <div class="page-header">
  10. <h3>${errorMsg}</h3>
  11. </div>
  12. <#else>
  13. <div class="page-header">
  14. <h3>Job [${jobId!}]</h3>
  15. </div>
  16. <p>
  17. 卷: [${slittingRollNo!}]
  18. </p>
  19. <p>
  20. 第一个序列号: [<span id="snSpan">${firstSn!}</span>]
  21. </p>
  22. <table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
  23. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , url:'/scanning/scanpool/${jobId}/all',method:'get',pageSize:20,toolbar:'#tb'">
  24. <thead>
  25. <tr>
  26. <th data-options="field:'serialNo',width:100">Serials Number</th>
  27. </tr>
  28. </thead>
  29. </table>
  30. <input type="hidden" id="orderNo" value="">
  31. <div id="tb" style="padding:10px 5px;display: none;">
  32. <div>
  33. <a href="javascript:void(0)" id="tbScanRoll" class="easyui-linkbutton" iconCls="icon-add" onclick="scanRoll()">Scan roll number</a>
  34. <a href="javascript:void(0)" id="tbScanFirstSn" class="easyui-linkbutton" iconCls="icon-add" onclick="scanFirstSn()">Scan the first serial number</a>
  35. &nbsp;&nbsp;&nbsp;
  36. <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="badInput()">Type defective serial number</a>
  37. &nbsp;&nbsp;&nbsp;
  38. <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="createFinalRoll()">Create FG roll</a>
  39. <#if currentUser.isAdmin>
  40. <a href="javascript:void(0)" id="tbClear" class="easyui-linkbutton" iconCls="icon-remove" onclick="clearPool()">Clear scanning list</a>
  41. </#if>
  42. <#-- <a href="javascript:void(0)" id="knotOrder" class="easyui-linkbutton" iconCls="icon-add" onclick="doKnot()">结单报工</a>-->
  43. <#--<a href="/scanning/scanpool/get/${jobId}" class="easyui-linkbutton" target="_blank" >扫描任务池</a>-->
  44. <#--<a href="/scanning/finalrolls" class="easyui-linkbutton" target="_blank" >查看最终卷</a>-->
  45. </div>
  46. </div>
  47. <div id="dlgRoll" class="easyui-dialog for-scan" style="width:500px;display: none;"
  48. closed="true" buttons="#dlg-buttons-roll">
  49. <form id="fmRoll" method="post" novalidate style="margin:0;padding:20px 20px">
  50. <div style="margin-bottom:10px">
  51. <label name="slittingRollNo" class="easyui-textbox" data-options="labelWidth:100" required="true" label="Roll No:" style="width:100%">
  52. </div>
  53. </form>
  54. </div>
  55. <div id="dlg-buttons-roll" style="display: none;">
  56. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="doScanRollOK()" style="width:90px">OK</a>
  57. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgRoll').dialog('close')" style="width:90px">Cancel</a>
  58. </div>
  59. <div id="dlgFirstSn" class="easyui-dialog for-scan" style="width:500px;display: none;"
  60. closed="true" buttons="#dlg-buttons-firstsn">
  61. <form id="fmFirstSn" method="post" novalidate style="margin:0;padding:20px 20px">
  62. <div style="margin-bottom:10px">
  63. <input id="firstSerialNo" name="firstSn" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The first serial number:" style="width:100%">
  64. </div>
  65. </form>
  66. </div>
  67. <div id="dlg-buttons-firstsn" style="display: none;">
  68. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="doFirstSnOK()" style="width:90px">OK</a>
  69. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgFirstSn').dialog('close')" style="width:90px">Cancel</a>
  70. </div>
  71. <div id="dlgFinalRoll" class="easyui-dialog for-scan" style="width:500px;display: none;"
  72. closed="true" buttons="#dlg-buttons-finalroll">
  73. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  74. <#--<div style="margin-bottom:10px">-->
  75. <#--<label name="firstSerialNo" class="easyui-textbox" data-options="labelWidth:100" required="true" label="初始序列号:" style="width:100%">-->
  76. <#--</div>-->
  77. <div style="margin-bottom:10px">
  78. <input id="endSerialNo" name="endSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="本卷结束序列号:" style="width:100%">
  79. </div>
  80. <div style="margin-bottom:10px">
  81. <input id="nextSerialNo" name="nextSerialNo" class="easyui-textbox" data-options="labelWidth:100" label="The end serial number of current roll" style="width:100%">
  82. </div>
  83. </form>
  84. </div>
  85. <div id="dlg-buttons-finalroll" style="display: none;">
  86. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="doFinalRoll" onclick="doFinalRollOK()" style="width:90px">OK</a>
  87. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgFinalRoll').dialog('close')" style="width:90px">Cancel</a>
  88. </div>
  89. <div id="dlgBadSnDtls" class="easyui-dialog" style="width:600px;display: none;"
  90. closed="true" data-options="modal:true" >
  91. <table id="dgBadSnDtls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
  92. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:20,toolbar:'#tbBadSnDtls'">
  93. <thead>
  94. <tr>
  95. <th data-options="field:'serialNo',width:100">Defective serial number</th>
  96. </tr>
  97. </thead>
  98. </table>
  99. <div id="tbBadSnDtls" style="padding:10px 5px;display: none;">
  100. <div>
  101. 录入不良序列号: <input class="easyui-textbox" id="inptBadSn" style="width:250px">
  102. <a href="#nowhere" id="lnkOK" class="easyui-linkbutton" iconCls="icon-add" onclick="addNewBadSn()">Ok</a>
  103. <a id="btnBadRange" onclick="doBadRange()" class="easyui-linkbutton" iconCls="icon-add">Batch defective serial number</a>
  104. </div>
  105. </div>
  106. </div>
  107. <!-- 批量录入不良 -->
  108. <div id="dlg" class="easyui-dialog for-scan" style="width:500px;display: none;"
  109. closed="true" buttons="#dlg-buttons">
  110. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  111. <#--<div style="margin-bottom:10px">
  112. <label id="rollNo_display" class="easyui-textbox" data-options="labelWidth:100,disabled:true" required="true" label="Roll No:" style="width:100%">
  113. </div>-->
  114. <div id="serial_input_1st" style="margin-bottom:10px">
  115. <input id="badFirstSN" name="firstSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The first serial number:" style="width:100%">
  116. </div>
  117. <div id="serial_input_2nd" style="margin-bottom:10px">
  118. <input id="badEndSN" name="endSerialNo" class="easyui-textbox" data-options="labelWidth:100" label="The second serial number:" style="width:100%">
  119. </div>
  120. </form>
  121. </div>
  122. <div id="dlg-buttons" style="display: none;">
  123. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="badOK" onclick="doOK()" style="width:90px">OK</a>
  124. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
  125. </div>
  126. <!-- 结束报工页面 -->
  127. <div class="modal fade" id="report_modal" tabindex="-1" role="dialog"
  128. aria-labelledby="myModalLabel" aria-hidden="true" style="font-size:10px;">
  129. <div class="modal-dialog" style="width:430px;height:300px;">
  130. <div class="modal-content" >
  131. <div class="modal-body">
  132. <form id="report_form" class="form-horizontal" action="" method="post">
  133. <fieldset>
  134. <div id="legend" class="">
  135. <input type="hidden" value="0" name="currentScheduleId" id="current_schedule_id">
  136. <legend class="">报告产量</legend>
  137. </div>
  138. <div class="form-group">
  139. <label class="col-sm-2 control-label" style = "width: 20%;">机台</label>
  140. <div class="col-sm-4" style = "width: 30%;">
  141. <select id="report_resource_id" class="form-control" name="resourceId" style="width:100px;font-size:12px;">
  142. </select>
  143. </div>
  144. <label class="col-sm-2 control-label" style = "width: 20%;">人员</label>
  145. <div class="col-sm-4" style = "width: 20%;">
  146. <input id="report_person" type="text" class="form-control" name="person" readonly style="width:100px;font-size:12px;">
  147. </div>
  148. </div>
  149. <div class="form-group">
  150. <label class="col-sm-2 control-label" style = "width: 20%;"><span>Production Date</span></label>
  151. <div class="col-sm-4" style = "width: 30%;">
  152. <input id="produce_date" type="text" class="form-control Selection_time" name="produceDate" style="width:100px;font-size:12px;">
  153. </div>
  154. <label class="col-sm-2 control-label" style = "width: 20%;">班次</label>
  155. <div class="col-sm-4" style = "width: 20%;">
  156. <select id="report_shift_no" class="form-control" name="shiftNo" style="width:100px;font-size:12px;">
  157. </select>
  158. </div>
  159. </div>
  160. <div class="form-group">
  161. <label class="col-sm-2 control-label" style = "width: 20%;">派工数量</label>
  162. <div class="col-sm-4" style = "width: 30%;">
  163. <input id="qty_required" class="form-control" name="qtyRequired" readonly style="width:100px;font-size:12px;">
  164. </div>
  165. <label class="col-sm-2 control-label" style = "width: 20%;">已报告数量</label>
  166. <div class="col-sm-4" style = "width: 20%;">
  167. <input id="qty_reported" type="number" class="form-control" name="qtyReported" readonly style="width:100px;font-size:12px;">
  168. </div>
  169. </div>
  170. <div class="form-group">
  171. <label class="col-sm-2 control-label" style = "width: 20%;">良品数量</label>
  172. <div class="col-sm-4" style = "width: 30%;">
  173. <input id="qty_approved" type="number" class="form-control count_nums" name="qtyApproved" readonly style="width:100px;font-size:12px;">
  174. </div>
  175. <label class="col-sm-2 control-label" style = "width: 20%;">不良品数量</label>
  176. <div class="col-sm-4" style = "width: 20%;">
  177. <input id="qty_scrapped" type="number" class="form-control count_nums" name="qtyScrapped" readonly style="width:100px;font-size:12px;">
  178. </div>
  179. </div>
  180. <div class="form-group">
  181. <label class="col-sm-2 control-label" style = "width: 20%;">报告总数量</label>
  182. <div class="col-sm-4" style = "width: 30%;">
  183. <input id="current_report_qty" type="number" class="form-control" name="currentReportTotalQty" readonly style="width:100px;font-size:12px;">
  184. </div>
  185. <label class="col-sm-2 control-label" style = "width: 20%;">生产时间</label>
  186. <div class="col-sm-4" style = "width: 20%;">
  187. <input id="produce_time" type="number" class="form-control count_nums" name="produceTime" style="width:100px;font-size:12px;">
  188. </div>
  189. </div>
  190. <div class="form-group">
  191. <label class="col-sm-3 control-label">关闭派工单</label>
  192. <div class="col-sm-9" id="close_schedule_flag">
  193. <div class="checkbox checkbox-info checkbox-circle" style="margin-left: 20px;">
  194. <input name="closed" value="0" type="checkbox" checked="" style="margin-top: -0.5px;">
  195. <label for="checkbox1">是</label>
  196. </div>
  197. <div class="checkbox checkbox-info checkbox-circle" style="margin-top: -27px; margin-left: 100px;">
  198. <input name="closed" value="1" type="checkbox" style="margin-top: -0.5px;">
  199. <label for="checkbox2">否</label>
  200. </div>
  201. </div>
  202. </div>
  203. </fieldset>
  204. </form>
  205. </div>
  206. <div class="modal-footer" style="TEXT-ALIGN: center;margin-top:-20px;">
  207. <div class="control-group">
  208. <!-- Button -->
  209. <div class="controls">
  210. <button onclick="reportSchedule()" class="btn btn-success" style="font-size:12px;">Confirm</button>
  211. <button id="report_cancel" data-dismiss="modal" class="btn btn-success" style="font-size:12px;">取消</button>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. <script src="/laydate/laydate.js"></script>
  219. <script type="text/javascript" src="/js/layer/layer.js"></script>
  220. <script>
  221. var slittingRollNo = "${slittingRollNo!}";
  222. var work_center_data;
  223. var temp_row;
  224. var currentBadSnArray = [];
  225. //查询订单
  226. function findOrder(){
  227. $.post("/rollop/findOrder", {slittingRollNo: slittingRollNo}, function (ret) {
  228. console.log(ret);
  229. $("#orderNo").val(ret);
  230. })
  231. }
  232. function badInput(){
  233. if (slittingRollNo == ""){
  234. $.messager.alert("Error", "请先扫描卷号", "error");
  235. return;
  236. }
  237. //$("#dgBadSnDtls").datagrid({url: "/scanning/badsn/${slittingRollNo!}/"});
  238. //加载缓存中的不良码包数据
  239. reloadTableBadSns();
  240. $('#dlgBadSnDtls').dialog('open').dialog('center').dialog('setTitle','Defective serial number');
  241. $("#_easyui_textbox_input4").focus();
  242. }
  243. //加载缓存中不良数据列表 2026-06-24 LR 不良码包显示优化 只显示当前操作的数据
  244. function reloadTableBadSns(){
  245. var opts = $('#dgBadSnDtls').datagrid('options');
  246. $('#dgBadSnDtls').datagrid('loadData', currentBadSnArray);
  247. }
  248. //单个不良自动点击确认2020-09-29 sunny要求加入
  249. $("#inptBadSn").textbox({
  250. inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents,{
  251. keyup:function(event){
  252. if(event.keyCode == 13){
  253. addNewBadSn();
  254. }
  255. }
  256. })
  257. })
  258. function addNewBadSn(){
  259. $.post("/scanning/${jobId}/badsn/add", {orderNo: workingOrder, serialNo: $("#inptBadSn").val()}, function (ret) {
  260. if (ret.success){
  261. //$("#dgBadSnDtls").datagrid("reload");
  262. //2026-06-24 LR 不查询只显示缓存中的不良数据
  263. let currentSerial = {'serialNo': $("#inptBadSn").val()};
  264. $("#inptBadSn").textbox("clear");
  265. $("#_easyui_textbox_input4").focus();
  266. //添加缓存的数据
  267. currentBadSnArray.unshift(currentSerial);
  268. //加载缓存的数据
  269. reloadTableBadSns();
  270. }else{
  271. $.messager.alert("Error", ret.errorMsg, "error");
  272. }
  273. })
  274. }
  275. function formatEnd(value, row){
  276. if (value) {
  277. return value;
  278. } else {
  279. return "<a class='easyui-linkbutton' href='javascript:scanEndSerial(\""+row.id+"\")'>Please scan the end serial number</a>"+"&nbsp;|&nbsp;<a class='easyui-linkbutton' href='javascript:createFinalRoll(\""+row.id+"\")'>Scanning&FG Rolls</a>";
  280. }
  281. }
  282. function createFinalRoll(){
  283. $("#doFinalRoll").linkbutton({"disabled": false});
  284. $('#dlgFinalRoll').dialog('open').dialog('center').dialog('setTitle', "Create FG roll");
  285. $('#dlgFinalRoll form').form('clear');
  286. }
  287. function scanRoll(){
  288. $('#dg').datagrid('reload');
  289. $('#dlgRoll').dialog('open').dialog('center').dialog('setTitle', "Scan roll number");
  290. $('#dlgRoll form').form('clear');
  291. }
  292. function scanFirstSn(){
  293. $('#dlgFirstSn').dialog('open').dialog('center').dialog('setTitle', "扫描第一个序列号");
  294. $('#dlgFirstSn form').form('clear');
  295. }
  296. $(window).resize(function () {
  297. $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
  298. });
  299. $(function () {
  300. $(window).resize();
  301. findOrder();
  302. });
  303. function doFinalRollOK(){
  304. $("#doFinalRoll").linkbutton({"disabled": true});
  305. $('#dlgFinalRoll form').form('submit',{
  306. url: "/scanning/scanpool/${jobId}/createFinalRollNew",
  307. onSubmit: function(){
  308. return $(this).form('validate');
  309. },
  310. success: function(result){
  311. $("#doFinalRoll").linkbutton({"disabled": false});
  312. console.log(result);
  313. try{
  314. var result = JSON.parse(result);
  315. if (result.errorMsg){
  316. if(result.falseFlag==1){
  317. $.messager.confirm('Confirm','The roll qty is '+result.nowQty+',are you sure to create the new roll?',function(r) {
  318. if (r){
  319. doFinalRollOKReal();
  320. }else {
  321. }
  322. });
  323. }else {
  324. $.messager.alert('Error',result.errorMsg, 'error');
  325. }
  326. } else {
  327. $('#snSpan').html('<b>'+$("#nextSerialNo").val()+'</b>');
  328. $.ajaxSettings.async = false;
  329. if($("#nextSerialNo").val()!=''&&$("#nextSerialNo").val()!=null){
  330. $.post("/scanning/scanpool/${jobId}/firstSn", {firstSn: $("#nextSerialNo").val()}, function(result){
  331. try{
  332. if (result.errorMsg){
  333. $.messager.alert('Error',result.errorMsg, 'error');
  334. } else {
  335. $('#nextSerialNo').textbox('setValue',"");
  336. }
  337. }catch(e){
  338. }
  339. })
  340. }
  341. $.ajaxSettings.async = true;
  342. $('#dlgFinalRoll').dialog('close'); // close the dialog
  343. $('#dg').datagrid('reload');
  344. if (result.finalRoll){
  345. //调用方法 执行缓存打印的信息 然后调用js打印数据
  346. getQcPrintCacheData(result.finalRoll.finalRollNo, 0);
  347. //$("#ifmforprint").attr('src', "/print/newlabel/" + result.finalRoll.finalRollNo + "/0/");
  348. //关闭后 再次打开modal的页面
  349. createFinalRoll();
  350. }
  351. // $.messager.alert('Success','请稍等刷新界面', 'info');
  352. // setTimeout(function(){
  353. // window.location.reload()
  354. // },2000);
  355. }
  356. }catch(e){
  357. $.messager.alert('Error','序列号重复!', 'error');
  358. }
  359. }
  360. });
  361. }
  362. function doFinalRollOKReal(){
  363. $("#doFinalRoll").linkbutton({"disabled": true});
  364. $('#dlgFinalRoll form').form('submit',{
  365. url: "/scanning/scanpool/${jobId}/createFinalRoll",
  366. onSubmit: function(){
  367. return $(this).form('validate');
  368. },
  369. success: function(result){
  370. $("#doFinalRoll").linkbutton({"disabled": false});
  371. console.log(result);
  372. try{
  373. var result = JSON.parse(result);
  374. if (result.errorMsg){
  375. $.messager.alert('Error',result.errorMsg, 'error');
  376. } else {
  377. $('#snSpan').html('<b>'+$("#nextSerialNo").val()+'</b>');
  378. $.ajaxSettings.async = false;
  379. if($("#nextSerialNo").val()!=''&&$("#nextSerialNo").val()!=null){
  380. $.post("/scanning/scanpool/${jobId}/firstSn", {firstSn: $("#nextSerialNo").val()}, function(result){
  381. try{
  382. if (result.errorMsg){
  383. $.messager.alert('Error',result.errorMsg, 'error');
  384. } else {
  385. $('#nextSerialNo').textbox('setValue',"");
  386. }
  387. }catch(e){
  388. }
  389. })
  390. }
  391. $.ajaxSettings.async = true;
  392. $('#dlgFinalRoll').dialog('close'); // close the dialog
  393. $('#dg').datagrid('reload');
  394. if (result.finalRoll){
  395. //调用方法 执行缓存打印的信息 然后调用js打印数据
  396. getQcPrintCacheData(result.finalRoll.finalRollNo, 0);
  397. //关闭后 再次打开modal的页面
  398. createFinalRoll();
  399. //$("#ifmforprint").attr('src', "/print/newlabel/" + result.finalRoll.finalRollNo + "/0/");
  400. }
  401. // $.messager.alert('Success','请稍等刷新界面', 'info');
  402. // setTimeout(function(){
  403. // window.location.reload()
  404. // },2000);
  405. }
  406. }catch(e){
  407. $.messager.alert('Error','序列号重复!', 'error');
  408. }
  409. }
  410. });
  411. }
  412. function doScanRollOK(){
  413. function doScallRollSubmit(){
  414. $('#dlgRoll form').form('submit',{
  415. url: "/scanning/scanpool/${jobId}/scanRoll",
  416. onSubmit: function(){
  417. return $(this).form('validate');
  418. },
  419. success: function(result){
  420. console.log(result);
  421. try{
  422. var result = JSON.parse(result);
  423. if (result.errorMsg){
  424. $.messager.alert('Error',result.errorMsg, 'error');
  425. } else {
  426. window.location.reload();
  427. }
  428. }catch(e){
  429. }
  430. }
  431. });
  432. }
  433. if(!$('#dg').datagrid('getRows')){
  434. $.messager.alert("Error", "扫描机数据库连接失败", "error");
  435. return false;
  436. }
  437. if ($('#dg').datagrid('getRows').length > 0) {
  438. $.messager.confirm('Confirm', 'Still have serial numbers in scanning list, continue?', function (r) {
  439. if (r) {
  440. doScallRollSubmit();
  441. }else{
  442. $("#dlgRoll").dialog('close');
  443. }
  444. });
  445. }else{
  446. doScallRollSubmit();
  447. }
  448. }
  449. function doFirstSnOK(){
  450. $('#dlgFirstSn form').form('submit',{
  451. url: "/scanning/scanpool/${jobId}/firstSn",
  452. onSubmit: function(){
  453. return $(this).form('validate');
  454. },
  455. success: function(result){
  456. console.log(result);
  457. try{
  458. var result = JSON.parse(result);
  459. if (result.errorMsg){
  460. $.messager.alert('Error',result.errorMsg, 'error');
  461. } else {
  462. window.location.reload();
  463. }
  464. }catch(e){
  465. }
  466. }
  467. });
  468. }
  469. function clearPool(){
  470. $.messager.confirm('Confirm','Are you sure to clear current scanning list?',function(r){
  471. if (r){
  472. $.post('/scanning/scanpool/${jobId}/clear',{},function(result){
  473. if (result.success){
  474. $('#dg').datagrid('reload');
  475. $.messager.alert('Success','清空成功', 'info');
  476. } else {
  477. $.messager.alert('Error',result.errorMsg, 'error');
  478. }
  479. },'json');
  480. }
  481. });
  482. }
  483. //批量录入不良
  484. function doBadRange(){
  485. showDialog("Batch defective serial number", 2, "/badBatch/count");
  486. }
  487. var formPostUrl;
  488. var doUrl;
  489. function showDialog(title, serialNum, postUrl){
  490. $("#badOK").linkbutton({"disabled": false});
  491. show2ndBox(serialNum > 1);
  492. $('#dlg').dialog('open').dialog('center').dialog('setTitle',title);
  493. $('#dlg form').form('clear');
  494. formPostUrl = "/scanning/${jobId}" + postUrl + "?orderNo="+workingOrder;
  495. doUrl = "/scanning/${jobId}/badBatch/do?orderNo="+workingOrder;
  496. }
  497. function show2ndBox(b){
  498. showEl("#dlg #serial_input_1st", true);
  499. showEl("#dlg #serial_input_2nd", true);
  500. showEl("#dlg #serial_input_2nd", b);
  501. $('#dlg #endSerialNo').textbox({disabled:!b});
  502. }
  503. function doOK(){
  504. var badFirstSN = $("#badFirstSN").val();
  505. var badEndSN = $("#badEndSN").val();
  506. console.log(badFirstSN);
  507. console.log(badEndSN);
  508. $("#badOK").linkbutton({"disabled": true});
  509. $('#dlg form').form('submit',{
  510. url: formPostUrl,
  511. onSubmit: function(){
  512. return $(this).form('validate');
  513. },
  514. success: function(result){
  515. var result = $.parseJSON(result);
  516. if (result.errorMsg){
  517. $("#badOK").linkbutton({"disabled": false});
  518. $('#dlg').dialog('close');
  519. $.messager.alert('Error',result.errorMsg, 'error');
  520. } else {
  521. if(result.count>1000){
  522. $.messager.confirm('Confirm','Defective quantity greater than 1000, continue??',function(r) {
  523. if (r){
  524. $.post(doUrl, {firstSerialNo:badFirstSN,endSerialNo:badEndSN, username: username}, function(data){
  525. $("#badOK").linkbutton({"disabled": false});
  526. // refreshRollInfo(slittingRollNo);
  527. if (data.success){
  528. $('#dlg form').form('clear');
  529. //2026-06-24 LR 显示缓存中的数据
  530. let badSerials = data.badSerials;
  531. for(let i = 0; i < badSerials.length; i++){
  532. currentBadSnArray.unshift({'serialNo': badSerials[i].serialNo});
  533. };
  534. //加载缓存的数据
  535. reloadTableBadSns();
  536. //2020-09-16 添加不良录入成功提示
  537. $.messager.alert('Success','The defect has been reported successfully, the total qty is '+result.count, 'info');
  538. // $('#dlg #rollNo_display').textbox({"value": slittingRollNo});
  539. }else{
  540. $('#dlg').dialog('close'); // close the dialog
  541. }
  542. });
  543. }else{
  544. $("#badOK").linkbutton({"disabled": false});
  545. $.messager.alert('Error',result.errorMsg, 'error');
  546. $('#dlg').dialog('close');
  547. }
  548. });
  549. }else{
  550. $.post(doUrl, {firstSerialNo:badFirstSN,endSerialNo:badEndSN, username: username}, function(data){
  551. $("#badOK").linkbutton({"disabled": false});
  552. // refreshRollInfo(slittingRollNo);
  553. if (data.success){
  554. $('#dlg form').form('clear');
  555. //2026-06-24 LR 显示缓存中的数据
  556. let badSerials = data.badSerials;
  557. for(let i = 0; i < badSerials.length; i++){
  558. currentBadSnArray.unshift({'serialNo': badSerials[i].serialNo});
  559. };
  560. //加载缓存的数据
  561. reloadTableBadSns();
  562. //2020-09-16 添加不良录入成功提示
  563. $.messager.alert('Success','The defect has been reported successfully, the total qty is '+result.count, 'info');
  564. // $('#dlg #rollNo_display').textbox({"value": slittingRollNo});data.errorMsg,
  565. }else{
  566. $.messager.alert('Error',data.errorMsg, 'error');
  567. //$('#dlg').dialog('close');
  568. // close the dialog
  569. }
  570. });
  571. }
  572. }
  573. }
  574. });
  575. }
  576. //获取当天日期
  577. function getToday(){
  578. var date = new Date();
  579. var seperator1 = "-";
  580. var year = date.getFullYear();
  581. var month = date.getMonth() + 1;
  582. var strDate = date.getDate();
  583. if (month >= 1 && month <= 9) {
  584. month = "0" + month;
  585. }
  586. if (strDate >= 0 && strDate <= 9) {
  587. strDate = "0" + strDate;
  588. }
  589. var currentdate = year + seperator1 + month + seperator1 + strDate;
  590. return currentdate;
  591. }
  592. </script>
  593. </#if>
  594. </@master.layout>