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.

1036 lines
39 KiB

3 days ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <div class="page-header">
  4. <h3>${title}</h3>
  5. </div>
  6. <div class="row" id="app">
  7. <div class="col-md-4">
  8. <p><input id="rollNo" name="rollNo" type="text" class="form-control" placeholder="Roll No" /></p>
  9. <table id="tblInfo" class="table">
  10. </table>
  11. </div>
  12. <input type="hidden" id="processNumber" value="">
  13. <input type="hidden" id="orderNo" value="">
  14. <p><button id="btnStatus" onclick="updateStatus()" class="btn btn-default" style="margin-left: 15px;">Refresh Status</button></p>
  15. <div class="col-md-1" id="actions" style="display: none">
  16. <#if currentUser.isAdmin || currentUser.authorities?contains("refreshRollStatus")>
  17. <p><button id="refreshRollStatus" onclick="refreshRollStatus()" class="btn btn-default">Reverse All Scanning Data</button></p>
  18. </#if>
  19. <#if func?is_string && func != "indigo">
  20. <p><button id="btnConfirm" onclick="doConfirm()" class="btn btn-default">Confirm quantity</button></p>
  21. </#if>
  22. <p><button id="btnStart" onclick="doStart()" class="btn btn-default">Scan</button></p>
  23. <p><button id="btnSetup" onclick="doSetupModal()" class="btn btn-default">Scan/setup</button></p>
  24. <p><button id="btnFai" onclick="doFaiModal()" class="btn btn-default">Scan/first off</button></p>
  25. <p><button id="btnCut" onclick="showCutRolls()" class="btn btn-default">Slit roll</button></p>
  26. <p><button id="btnEai" onclick="doEaiConfirm()" class="btn btn-default">Scan/last off</button></p>
  27. <#if func?is_string && func == "indigo">
  28. <p><button id="btnCreateRoll" onclick="doCreateRoll()" class="btn btn-default">Create new roll</button></p>
  29. </#if>
  30. <#if func?is_string && func != "indigo">
  31. <p><button id="btnBad" onclick="doBadModal()" class="btn btn-default">Type defective serial number</button></p>
  32. <!-- <p><button id="btnBadRange" onclick="doBadRange()" class="btn btn-default">Batch defective serial number</button></p> -->
  33. <p><button id="btnBadRange" onclick="newDoBadRange()" class="btn btn-default">Batch defective serial number</button></p>
  34. </#if>
  35. <#if func?is_string && func == "abg">
  36. <p><button id="printSlitting" onclick="slittingPrint()" class="btn btn-default">Print Label</button></p>
  37. </#if>
  38. </div>
  39. </div>
  40. <div class="row" >
  41. <div class="col-md-12" id="tblRollOpInfo">
  42. </div>
  43. </div>
  44. <div id="dlg" class="easyui-dialog for-scan" style="width:500px;display: none;"
  45. closed="true" buttons="#dlg-buttons">
  46. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  47. <div style="margin-bottom:10px">
  48. <label id="rollNo_display" class="easyui-textbox" data-options="labelWidth:100,disabled:true" required="true" label="Roll No:" style="width:100%">
  49. </div>
  50. <div id="serial_input_1st" style="margin-bottom:10px">
  51. <input id="firstSerialNo" name="firstSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The first serial number:" style="width:100%">
  52. </div>
  53. <div id="serial_input_2nd" style="margin-bottom:10px">
  54. <input id="endSerialNo" name="endSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The second serial number:" style="width:100%">
  55. </div>
  56. </form>
  57. </div>
  58. <div id="dlg-buttons" style="display: none;">
  59. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="badOK" onclick="doOK()" style="width:90px">OK</a>
  60. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
  61. </div>
  62. <div id="dlg-bad" class="easyui-dialog for-scan" style="width:500px;display: none;" closed="true" buttons="#dlg-bad-buttons">
  63. <form id="fm" method="post" novalidate style="margin:0; padding: 20px 20px;">
  64. <div style="margin-bottom:10px">
  65. <label id="show_roll_no" class="easyui-textbox" data-options="labelWidth:100, disabled:true" required="true" label="Roll No:" style="width:100%">
  66. </div>
  67. <div style="margin-bottom:10px">
  68. <input id="start_bad_serial" name="firstSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="开始序列号:" style="width:100%">
  69. </div>
  70. <div style="margin-bottom:10px">
  71. <input id="end_bad_serial" name="endSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="结束序列号:" style="width:100%">
  72. </div>
  73. </form>
  74. </div>
  75. <div id="dlg-bad-buttons" style="display: none;">
  76. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="badOK" onclick="countBadSerials()" style="width:90px">OK</a>
  77. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg-bad').dialog('close')" style="width:90px">Cancel</a>
  78. </div>
  79. <div id="dlgConfirm" class="easyui-dialog for-scan" style="width:500px;display: none;"
  80. closed="true" buttons="#dlg-buttons-confirm">
  81. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  82. <div style="margin-bottom:10px">
  83. <input name="workNo" class="easyui-textbox" data-options="labelWidth:100" required="true" label="Emoloyee ID:" style="width:100%">
  84. </div>
  85. </form>
  86. </div>
  87. <div id="dlg-buttons-confirm" style="display: none;">
  88. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="doConfirmOK()" style="width:90px">OK</a>
  89. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgConfirm').dialog('close')" style="width:90px">Cancel</a>
  90. </div>
  91. <div id="dlgSlitting" class="easyui-dialog for-scan" style="width:500px;display: none;"
  92. closed="true" buttons="#dlg-buttons-slitting" data-options="modal:true">
  93. <form method="post" novalidate style="margin:0;padding:20px 20px">
  94. <div style="margin-bottom:10px">
  95. <input id="noOfCross" class="easyui-textbox" data-options="labelWidth:100,disabled:true" required="true" label="Roll Qty:" style="width:100%">
  96. </div>
  97. <div style="margin-bottom:10px">
  98. <input name="endSerialNo" class="easyui-textbox" data-options="labelWidth:100" required="true" label="结束序列号:" style="width:100%">
  99. </div>
  100. </form>
  101. </div>
  102. <div id="dlg-buttons-slitting" style="display: none;">
  103. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="doSlittingOK()" style="width:90px">OK</a>
  104. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgSlitting').dialog('close')" style="width:90px">Cancel</a>
  105. </div>
  106. <!-- 卷分切-->
  107. <div id="dlg-cut" class="easyui-dialog" style="width:800px;display: none;" closed="true" data-options="modal:true, " >
  108. <div style="margin-bottom:10px; margin-left: 20px; margin-top: 10px;">
  109. <input id="end_serial_no" name="endSerialNo" class="easyui-textbox" required="true" label="结束序列号:" style="width:60%">
  110. <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="doCutting()">Create Slitting Roll</a>
  111. </div>
  112. <table id="dlg-cut-rolls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
  113. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'post', pageSize:500,">
  114. <thead>
  115. <tr>
  116. <th data-options="field:'cutRollNo',width:80,">Slitting Roll No</th>
  117. <th data-options="field:'rollNo',width:80,">Roll No</th>
  118. <th data-options="field:'startRow',width:60">From Row No</th>
  119. <th data-options="field:'endRow',width:60">To Row No</th>
  120. <th data-options="field:'columnSortIndex',width:80">No. of Cross</th>
  121. <th data-options="field:'id',width:30, formatter: formatCutRollButton">Actions</th>
  122. </tr>
  123. </thead>
  124. </table>
  125. </div>
  126. <!-- 单个不良 -->
  127. <div id="dlg-single-bad" class="easyui-dialog for-scan" style="width:500px;display: none;" closed="true" buttons="#dlg-single-bad-buttons">
  128. <form id="fm-bad" method="post" novalidate style="margin:0;padding:20px 20px">
  129. <div style="margin-bottom:10px">
  130. <input id="bad_serialNo" name="serialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="Defective serial number:" style="width:100%">
  131. </div>
  132. </form>
  133. </div>
  134. <div id="dlg-single-bad-buttons" style="display: none;">
  135. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="badOK" onclick="doSingleBad()" style="width:90px">OK</a>
  136. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg-single-bad').dialog('close')" style="width:90px">Cancel</a>
  137. </div>
  138. <!-- 调机扫号 -->
  139. <div id="dlg-setup" class="easyui-dialog for-scan" style="width:500px;display: none;" closed="true" buttons="#dlg-setup-buttons">
  140. <form id="fm-setup" method="post" novalidate style="margin:0;padding:20px 20px">
  141. <div style="margin-bottom:10px">
  142. <input id="setup_firstSerialNo" name="firstSerialNo" class="easyui-textbox" disabled="disabled" data-options="labelWidth:100" label="The first serial number:" style="width:100%">
  143. </div>
  144. <div style="margin-bottom:10px">
  145. <input id="setup_endSerialNo" name="endSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The second serial number:" style="width:100%">
  146. </div>
  147. </form>
  148. </div>
  149. <div id="dlg-setup-buttons" style="display: none;">
  150. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="badOK" onclick="doSetup()" style="width:90px">OK</a>
  151. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg-setup').dialog('close')" style="width:90px">Cancel</a>
  152. </div>
  153. <!-- 首件扫号 -->
  154. <div id="dlg-fai" class="easyui-dialog for-scan" style="width:500px;display: none;" closed="true" buttons="#dlg-fai-buttons">
  155. <form id="fm-fai" method="post" novalidate style="margin:0;padding:20px 20px">
  156. <div style="margin-bottom:10px">
  157. <input id="fai_firstSerialNo" name="firstSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The first serial number:" style="width:100%">
  158. </div>
  159. <div style="margin-bottom:10px">
  160. <input id="fai_endSerialNo" name="endSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The second serial number:" style="width:100%">
  161. </div>
  162. </form>
  163. </div>
  164. <div id="dlg-fai-buttons" style="display: none;">
  165. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="badOK" onclick="doFai()" style="width:90px">OK</a>
  166. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg-fai').dialog('close')" style="width:90px">Cancel</a>
  167. </div>
  168. <style>
  169. table.roll-op-serials {
  170. border: 1px solid gray;
  171. }
  172. table.roll-op-serials td{
  173. border: 1px dotted gray;
  174. padding: 3px;
  175. text-align: center;
  176. text-align: center;
  177. font-family: Arial,monospace;
  178. font-size: 11px;
  179. background-color: aliceblue;
  180. }
  181. table.roll-op-serials td .serial-no{
  182. font-size: 11px;
  183. }
  184. </style>
  185. <script src="/laydate/laydate.js"></script>
  186. <script type="text/javascript" src="/js/layer/layer.js"></script>
  187. <script src='http://127.0.0.1:8000/CLodopfuncs.js'></script>
  188. <script type="text/javascript" src="/js/print/print_label.js"></script>
  189. <script>
  190. var formPostUrl="";
  191. var currentRoll="";
  192. var currentRollOp = {};
  193. var currentOrder={};
  194. var urlPath="/rollop/${func}";
  195. var work_center_data;
  196. var temp_row;
  197. var doUrl = "";
  198. var flag = "N";
  199. let currentPrinter = ${currentPrinter};
  200. let clodoplisence = '${clodoplisence}';
  201. function show2ndBox(b){
  202. showEl("#dlg #serial_input_1st", true);
  203. showEl("#dlg #serial_input_2nd", true);
  204. showEl("#dlg #serial_input_2nd", b);
  205. $('#dlg #endSerialNo').textbox({disabled:!b});
  206. }
  207. function showDialog(title, serialNum, postUrl){
  208. show2ndBox(serialNum > 1);
  209. $('#dlg').dialog('open').dialog('center').dialog('setTitle',title);
  210. $('#dlg form').form('clear');
  211. $('#dlg #rollNo_display').textbox({"value": currentRoll});
  212. formPostUrl = urlPath + postUrl + "?rollNo="+currentRoll;
  213. doUrl = urlPath + "/badRange/do?rollNo="+currentRoll;
  214. }
  215. /* 打开批量不良的数据 */
  216. function showBadDialog(title){
  217. $('#dlg-bad').dialog('open').dialog('center').dialog('setTitle',title);
  218. $('#dlg-bad form').form('clear');
  219. $('#dlg-bad #show_roll_no').textbox({"value": currentRoll});
  220. }
  221. function doConfirm(){
  222. $('#dlgConfirm').dialog('open').dialog('center').dialog('setTitle',"Confirm quantity");
  223. $('#dlgConfirm form').form('clear');
  224. }
  225. function doConfirmOK(){
  226. console.log(urlPath + "/confirm/do?rollNo=" + currentRoll)
  227. $('#dlgConfirm form').form('submit',{
  228. url: urlPath + "/confirm/do?rollNo=" + currentRoll,
  229. onSubmit: function(){
  230. return $(this).form('validate');
  231. },
  232. success: function(result){
  233. var result = $.parseJSON(result);
  234. if (result.success){
  235. refreshRollInfo(currentRoll);
  236. $('#dlgConfirm').dialog('close'); // close the dialog
  237. } else {
  238. $.messager.alert('error',result.errorMsg, 'error');
  239. }
  240. }
  241. });
  242. }
  243. //修正so_roll状态
  244. function updateStatus(){
  245. $.ajax({
  246. url: "/aoi/slitting/updateStatus",
  247. type:"POST",
  248. data:{
  249. 'rollNo':currentRoll,
  250. },
  251. dataType:"JSON",
  252. success: function (ret) {
  253. console.log(ret);
  254. if(ret.success==false){
  255. $.messager.alert('error',ret.data, 'error');
  256. }else if(ret.success==true){
  257. refreshRollInfo(currentRoll)
  258. $.messager.alert('info',"Successfully",'info');
  259. }
  260. }
  261. })
  262. }
  263. function doSlitting(){
  264. $('#dlgSlitting').dialog('open').dialog('center').dialog('setTitle',"Slit roll");
  265. $('#dlgSlitting form').form('clear');
  266. $('#dlgSlitting #noOfCross').textbox({"value": 1});
  267. }
  268. //打开分切卷的数据 LR 2024-06-25
  269. function showCutRolls(){
  270. //各种参数
  271. let rollNo = $("#rollNo").val();
  272. $('#dlg-cut').dialog('open').dialog('center').dialog('setTitle',"Slit roll");
  273. $("#dlg-cut-rolls").datagrid({
  274. url: "/cut/getCutRolls",
  275. queryParams: {
  276. rollNo: rollNo,
  277. }
  278. });
  279. }
  280. //modal打开关闭选中的箱
  281. $("#dlg-cut").dialog({
  282. onOpen: function(){
  283. //获取焦点
  284. //showEl("#dlg #input_roll", true);
  285. $('#end_serial_no').textbox('setValue', '');
  286. $('#end_serial_no').textbox('textbox').focus();
  287. }
  288. });
  289. function doSlittingOK(){
  290. $('#dlgSlitting form').form('submit',{
  291. url: "/aoi/slitting/do?rollNo=" + currentRoll,
  292. onSubmit: function(){
  293. return $(this).form('validate');
  294. },
  295. success: function(result){
  296. console.log(result);
  297. var result = $.parseJSON(result);
  298. if (result.success){
  299. refreshRollInfo(currentRoll);
  300. $('#dgSlittingRolls').datagrid('reload');
  301. $('#dlgSlitting').dialog('close'); // close the dialog
  302. } else {
  303. $.messager.alert('error',result.errorMsg, 'error');
  304. }
  305. }
  306. });
  307. }
  308. function doSlittingTure(){
  309. // $('#dlgSlitting form').form('submit',{
  310. // url: "/aoi/slitting/doTure?rollNo=" + currentRoll,
  311. // onSubmit: function(){
  312. // return $(this).form('validate');
  313. // },
  314. // success: function(result){
  315. // var result = $.parseJSON(result);
  316. // if (result.success){
  317. // $.messager.alert('info',"Successfully",'info');
  318. // } else {
  319. // $.messager.alert('error',result.errorMsg, 'error');
  320. // }
  321. // }
  322. // });
  323. $.ajax({
  324. url: "/aoi/slitting/doTure",
  325. type:"POST",
  326. data:{
  327. 'rollNo':currentRoll,
  328. },
  329. dataType:"JSON",
  330. success: function (ret) {
  331. console.log(ret);
  332. if(ret.success==false){
  333. $.messager.alert('error',ret.data, 'error');
  334. }else if(ret.success==true){
  335. $.messager.alert('info',"Successfully",'info');
  336. }
  337. }
  338. })
  339. }
  340. function doStart(){
  341. flag = "N";
  342. showDialog("Scan", 1, "/start/do");
  343. }
  344. /* 调机扫号 */
  345. function doSetupModal(){
  346. $('#dlg-setup').dialog('open').dialog('center').dialog('setTitle', 'Scan/setup');
  347. $('#dlg-setup form').form('clear');
  348. //设置数据
  349. $("#setup_firstSerialNo").textbox({value: currentRollOp.toSetupSerialNo || ""});
  350. $("#setup_firstSerialNo").textbox({disabled:true});
  351. }
  352. //modal打开关闭选中的箱
  353. $("#dlg-setup").dialog({
  354. onOpen: function(){
  355. //获取焦点
  356. //showEl("#dlg #input_roll", true);
  357. $('#setup_endSerialNo').textbox('textbox').focus();
  358. }
  359. });
  360. //首件扫号的modal
  361. function doFaiModal(){
  362. $('#dlg-fai').dialog('open').dialog('center').dialog('setTitle', 'Scan/first off');
  363. $('#dlg-fai form').form('clear');
  364. //设置数据
  365. }
  366. //modal打开关闭选中的箱
  367. $("#dlg-fai").dialog({
  368. onOpen: function(){
  369. //获取焦点
  370. //showEl("#dlg #input_roll", true);
  371. $('#fai_firstSerialNo').textbox('textbox').focus();
  372. }
  373. });
  374. function doBad(){
  375. flag = "N";
  376. showDialog("Type defective serial number", 1, "/bad/do");
  377. }
  378. // function doIpqc(){
  379. // flag = "N";
  380. // showDialog("IPQC抽样", 1, "/ipqc/do");
  381. // }
  382. function doBadRange(){
  383. $("#badOK").linkbutton({"disabled": false});
  384. flag = "Y";
  385. //showDialog("Batch defective serial number", 2, "/badRange/do");
  386. showDialog("Batch defective serial number", 2, "/badRange/count");
  387. }
  388. /* 新增不良批量 2024-06-25 LR */
  389. function newDoBadRange(){
  390. showBadDialog("Batch defective serial number");
  391. }
  392. function doOK(){
  393. var badFirstSN = $("#firstSerialNo").val();
  394. var badEndSN = $("#endSerialNo").val();
  395. $("#badOK").linkbutton({"disabled": true});
  396. $('#dlg form').form('submit',{
  397. url: formPostUrl,
  398. onSubmit: function(){
  399. return $(this).form('validate');
  400. },
  401. success: function(result){
  402. if(flag=="Y"){
  403. var result = $.parseJSON(result);
  404. if (result.errorMsg){
  405. $("#badOK").linkbutton({"disabled": false});
  406. $('#dlg').dialog('close');
  407. $.messager.alert('Error',result.errorMsg, 'error');
  408. } else {
  409. if(result.count>1000){
  410. $.messager.confirm('Confirm','Defective quantity greater than 1000, continue??',function(r) {
  411. if (r){
  412. console.log("首个序列号:"+badFirstSN);
  413. console.log("最后一个序列号:"+badEndSN);
  414. console.log("请求地址:"+doUrl);
  415. $.post(doUrl, {firstSerialNo:badFirstSN,endSerialNo:badEndSN}, function(data){
  416. $("#badOK").linkbutton({"disabled": false});
  417. console.log(data);
  418. refreshRollInfo(currentRoll);
  419. if (data.success){
  420. $('#dlg form').form('clear');
  421. $('#dlg #rollNo_display').textbox({"value": currentRoll});
  422. //2020-09-16 添加不良录入成功提示
  423. $.messager.alert('Success','The defect has been reported successfully, the total qty is '+result.count, 'info');
  424. }else{
  425. $('#dlg').dialog('close'); // close the dialog
  426. }
  427. });
  428. }else{
  429. $("#badOK").linkbutton({"disabled": false});
  430. $('#dlg').dialog('close');
  431. }
  432. });
  433. }else{
  434. $.post(doUrl, {firstSerialNo:badFirstSN,endSerialNo:badEndSN}, function(data){
  435. $("#badOK").linkbutton({"disabled": false});
  436. refreshRollInfo(currentRoll);
  437. if (data.success){
  438. $('#dlg form').form('clear');
  439. $('#dlg #rollNo_display').textbox({"value": currentRoll});
  440. //2020-09-16 添加不良录入成功提示
  441. $.messager.alert('Success','The defect has been reported successfully, the total qty is '+result.count, 'info');
  442. }else{
  443. $('#dlg').dialog('close'); // close the dialog
  444. }
  445. });
  446. }
  447. }
  448. }else{
  449. var result = $.parseJSON(result);
  450. $("#badOK").linkbutton({"disabled": false});
  451. if (result.errorMsg){
  452. $.messager.alert('Error',result.errorMsg, 'error');
  453. } else {
  454. refreshRollInfo(currentRoll);
  455. if (formPostUrl.indexOf("/bad/") >= 0 || formPostUrl.indexOf("/ipqc/") >= 0){
  456. $('#dlg form').form('clear');
  457. $('#dlg #rollNo_display').textbox({"value": currentRoll});
  458. }else{
  459. $('#dlg').dialog('close'); // close the dialog
  460. }
  461. }
  462. }
  463. }
  464. });
  465. }
  466. $("#rollNo").on("keydown", function(){
  467. if(event.keyCode == 13){
  468. refreshRollInfo($.trim($(this).val()));
  469. }
  470. });
  471. <#if RequestParameters.rollNo ??>
  472. $(function(){
  473. $("#rollNo").val("${RequestParameters.rollNo}");
  474. refreshRollInfo("${RequestParameters.rollNo}");
  475. });
  476. </#if>
  477. function doCreateRoll(){
  478. if (currentOrder){
  479. $.messager.confirm('Confirm','Are you sure to create new roll for the shop order <b>'+currentOrder.orderNo+'</b>? ',function(r) {
  480. if (r){
  481. $.post("/indigo/create_roll/do", {orderNo: currentOrder.orderNo}, function(data){
  482. if (data.success && data.newRollNo){
  483. $("#rollNo").val(data.newRollNo);
  484. refreshRollInfo(data.newRollNo);
  485. }
  486. });
  487. }
  488. });
  489. }
  490. }
  491. function slittingPrint() {
  492. $.messager.confirm('Confirm','Is Printed ?',function(r){
  493. if (r){
  494. $("#ifmforprint").attr('src', "/print/rollnoSlitting/" + currentRollOp.operationNo + "/" + currentRoll + "/");
  495. console.log("/print/rollnoSlitting/" + currentRollOp.operationNo + "/" + currentRoll + "/")
  496. }
  497. });
  498. }
  499. function refreshRollStatus(){
  500. $.messager.confirm('Confirm','Are you sure to reverse all scanning data ?',function(r){
  501. if (r){
  502. $.post(urlPath+"/refreshRollStatus", {rollNo: currentRoll}, function(data){
  503. if (data.success ){
  504. refreshRollInfo($("#rollNo").val());
  505. $.messager.alert('info',"Successfully",'info');
  506. }else{
  507. $.messager.alert('error',data.errorMsg,'error');
  508. }
  509. })
  510. }
  511. });
  512. }
  513. //回车触发事件
  514. function refreshRollInfo(rollNo){
  515. <#if func == "indigo">
  516. $("#processNumber").val("10");
  517. </#if>
  518. <#if func == "thermal">
  519. $("#processNumber").val("15");
  520. </#if>
  521. <#if func == "cut">
  522. $("#processNumber").val("18");
  523. </#if>
  524. <#if func == "abg">
  525. $("#processNumber").val("20");
  526. </#if>
  527. <#if func == "aoi">
  528. $("#processNumber").val("30");
  529. </#if>
  530. var $tblInfo = $("#tblInfo");
  531. var $tblRollOpInfo = $("#tblRollOpInfo");
  532. $tblInfo.html("");
  533. $tblRollOpInfo.html("");
  534. let requestParam = {'orderNo': workingOrder, 'rollNo': rollNo, 'func': 'cut'};
  535. $.post("/rollop/newGetRoll", requestParam, function(data){
  536. if (data.success && data.roll){
  537. showEl("#actions", data.showAction);
  538. enableEl("#btnConfirm", data.enableConfirm);
  539. enableEl("#btnStatus", data.enableStatus);
  540. enableEl("#btnStart", data.enableStart);
  541. enableEl("#btnSetup", data.enableSetup);
  542. enableEl("#btnFai", data.enableFai);
  543. enableEl("#btnEai", data.enableEai);
  544. enableEl("#btnBad", data.enableBad);
  545. //判断是否打开当前的卷
  546. <#if func == "cut">
  547. enableEl("#btnCut", data.enableCut);//2024-07-05 LR添加分卷
  548. </#if>
  549. <#if currentUser.isAdmin || currentUser.authorities?contains("refreshRollStatus")>
  550. enableEl("#refreshRollStatus", true);
  551. </#if>
  552. <#if func != "indigo">
  553. enableEl("#btnBad",!data.scanStatus);
  554. enableEl("#btnBadRange", !data.scanStatus);
  555. enableEl("#printSlitting", data.rollOp && data.rollOp.remainSnCount);
  556. </#if>
  557. currentRoll = data.roll.rollNo;
  558. currentRollOp = data.rollOp;
  559. currentOrder=data.roll.order;
  560. var rollNoDisplay = data.roll.rollNo;
  561. if (data.rollOp && data.rollOp.remainSnCount){
  562. rollNoDisplay = "<a target='forprint' href='/print/rollno/"+data.rollOp.operationNo+"/"+rollNoDisplay+"/'>"+rollNoDisplay+"</a>";
  563. }
  564. $tblInfo.append("<tr><td>SO No:</td><td>"+data.roll.orderNo+"</td></tr>");
  565. $tblInfo.append("<tr><td>Roll No:</td><td>"+rollNoDisplay+"</td></tr>");
  566. $tblInfo.append("<tr><td>Status</td><td>"+(data.roll.status || "-")+"</td></tr>");
  567. $("#orderNo").val(data.roll.orderNo);
  568. if (data.rollOpHtml){
  569. $tblRollOpInfo.append(data.rollOpHtml);
  570. }
  571. if (data.prevCount){
  572. $tblInfo.append("<tr><td>Serials Qty:</td><td>"+(data.prevCount)+"</td></tr>");
  573. }
  574. $tblInfo.append("<tr><td>Good Products Qty:</td><td>"+(data.qtyBad)+"</td></tr>");
  575. $tblInfo.append("<tr><td>Defect Product Qty:</td><td>"+(data.qtyApprove)+"</td></tr>");
  576. $tblInfo.append("<tr><td>Total Qty:</td><td>"+(data.qtyAll)+"</td></tr>");
  577. if (data.prevCount){
  578. $tblInfo.append("<tr><td>Different Qty:</td><td>"+(data.prevDifferent)+"</td></tr>");
  579. }
  580. if (data.badSns){
  581. $tblInfo.append("<tr><td>Defective serial number:</td><td>"+(data.badSns.split(",").join("<br />") || "-")+"</td></tr>");
  582. }
  583. if (data.slittingRolls){
  584. $tblInfo.append("<tr><td>Slitting Roll No:</td><td>"+(data.slittingRolls.split(",").join("<br />") || "-")+"</td></tr>");
  585. }
  586. checkWithWorkingOrder(data.roll.order.orderNo);
  587. }else{
  588. $tblInfo.append("<tr><td>"+data.msg+"</td></tr>");
  589. }
  590. })
  591. }
  592. function checkWithWorkingOrder(orderNo) {
  593. var workingOrder = $("#hdnWorkingOrder").val();
  594. if (workingOrder != orderNo){
  595. var msg = 'Are you sure to swith to the order <b>'+orderNo+'</b>?';
  596. if (workingOrder != "") {
  597. msg = 'The order of this roll does not match with the current order '+workingOrder+'.';
  598. }
  599. $("#tblInfo").html("");
  600. $("#tblRollOpInfo").html("");
  601. $("#actions").hide();
  602. $.messager.alert("Error", msg, "error", function(){
  603. $("#rollNo").val("").focus();
  604. });
  605. }
  606. }
  607. function getday(){
  608. lay('.Selection_time').each(function(){
  609. laydate.render({
  610. elem: this
  611. });
  612. });
  613. $('.Selection_time').val(getToday());
  614. }
  615. //获取当天日期
  616. function getToday(){
  617. var date = new Date();
  618. var seperator1 = "-";
  619. var year = date.getFullYear();
  620. var month = date.getMonth() + 1;
  621. var strDate = date.getDate();
  622. if (month >= 1 && month <= 9) {
  623. month = "0" + month;
  624. }
  625. if (strDate >= 0 && strDate <= 9) {
  626. strDate = "0" + strDate;
  627. }
  628. var currentdate = year + seperator1 + month + seperator1 + strDate;
  629. return currentdate;
  630. }
  631. //给单选事件加事件监听
  632. $("#close_schedule_flag input[name='closed']").bind('change', function(){
  633. $("#close_schedule_flag").find('input[name="closed"]').removeAttr('checked');
  634. $(this).prop('checked', true);
  635. });
  636. //查询operator是否存在
  637. /* function findOperator(operatorId,colsedFlag){
  638. $.ajax({
  639. url: "/rollop/findOperator",
  640. type:"POST",
  641. data: {"operatorId":operatorId},// 你的formid
  642. dataType:"JSON",
  643. success: function (data) {
  644. parent.layer.closeAll();
  645. if(data==false){
  646. layer.msg("用户不存在!");
  647. return false;
  648. }else{
  649. }
  650. }
  651. })
  652. } */
  653. $(function () {
  654. $("#rollNo").focus();
  655. })
  656. //2024-06-25 LR 后续增加的代码
  657. function countBadSerials(){
  658. //各种参数
  659. let rollNo = $("#rollNo").val();
  660. let firstSerialNo = $("#start_bad_serial").textbox('getValue');
  661. let endSerialNo = $("#end_bad_serial").textbox('getValue');
  662. //组装参数
  663. let countParam = {'orderNo': workingOrder, 'rollNo': rollNo, 'firstSerialNo': firstSerialNo, 'endSerialNo': endSerialNo, 'username': username};
  664. //请求参数
  665. $.ajax({
  666. url: "/cut/countBadRange",
  667. //contentType: 'application/json',
  668. type:"POST",
  669. //data:JSON.stringify(inData),
  670. data: countParam,
  671. dataType:"JSON",
  672. success: function (data) {
  673. if(data.success){
  674. //判断数量的限制
  675. if(data.count > 1000){
  676. $.messager.confirm('Confirm', 'Defective quantity greater than 1000, continue??', function(r) {
  677. if (r){
  678. //调用提交方法
  679. createBadRange();
  680. }
  681. });
  682. }else{
  683. //调用提交方法
  684. createBadRange();
  685. }
  686. }else{
  687. $.messager.alert("Error",data.msg,"Error",);
  688. }
  689. }
  690. })
  691. }
  692. //批量创建不良
  693. function createBadRange(){
  694. //各种参数
  695. let rollNo = $("#rollNo").val();
  696. let firstSerialNo = $("#start_bad_serial").textbox('getValue');
  697. let endSerialNo = $("#end_bad_serial").textbox('getValue');
  698. //组装参数
  699. let badParam = {'orderNo': workingOrder, 'rollNo': rollNo, 'firstSerialNo': firstSerialNo, 'endSerialNo': endSerialNo, 'username': username};
  700. //请求参数
  701. $.ajax({
  702. url: "/cut/createBadRange",
  703. //contentType: 'application/json',
  704. type:"POST",
  705. //data:JSON.stringify(inData),
  706. data: badParam,
  707. dataType:"JSON",
  708. success: function (data) {
  709. if(data.success){
  710. //$('#dlg-bad').dialog('close');
  711. $('#dlg-bad form').form('clear');
  712. $('#dlg-bad #show_roll_no').textbox({"value": currentRoll});
  713. //刷新当前的页面
  714. refreshRollInfo(rollNo);
  715. }else{
  716. $.messager.alert("Error",data.msg,"Error",);
  717. }
  718. }
  719. })
  720. }
  721. //分切卷的功能
  722. function formatCutRollButton(value, row){
  723. let tags = '';
  724. tags += '<a style="text-decoration:none;" onclick="cacheCutRollPrintData(\''+row.cutRollNo+'\')">补打标签</a>';
  725. return tags;
  726. }
  727. //调用方法打印标签
  728. function cacheCutRollPrintData(cutRollNo){
  729. let printParam = {'rollNo': cutRollNo}
  730. //请求参数
  731. $.ajax({
  732. url: "/cut/cacheCutRollPrintData",
  733. //contentType: 'application/json',
  734. type:"POST",
  735. //data:JSON.stringify(inData),
  736. data: printParam,
  737. dataType: "JSON",
  738. success: function (data) {
  739. if(data.success){
  740. currentPrinter.clodoplisence = clodoplisence;
  741. printCutRollLabel(JSON.parse(data.printData), currentPrinter);
  742. }else{
  743. $.messager.alert("Error",data.msg,"Error",);
  744. }
  745. }
  746. })
  747. }
  748. //创建分切卷
  749. function doCutting(){
  750. //各种参数
  751. let rollNo = $("#rollNo").val();
  752. let endSerialNo = $("#end_serial_no").textbox('getValue');
  753. //组装参数
  754. let cutParam = {'orderNo': workingOrder, 'rollNo': rollNo, 'endSerialNo': endSerialNo, 'username': username};
  755. //请求参数
  756. $.ajax({
  757. url: "/cut/createCutRoll",
  758. //contentType: 'application/json',
  759. type:"POST",
  760. //data:JSON.stringify(inData),
  761. data: cutParam,
  762. dataType:"JSON",
  763. success: function (data) {
  764. if(data.success){
  765. currentPrinter.clodoplisence = clodoplisence;
  766. printCutRollLabel(JSON.parse(data.printData), currentPrinter);
  767. //刷新表格
  768. $('#dlg-cut-rolls').datagrid('reload');
  769. $('#end_serial_no').textbox('setValue', '');
  770. $('#end_serial_no').textbox('textbox').focus();
  771. }else{
  772. $.messager.alert("Error",data.msg,"Error",);
  773. }
  774. }
  775. })
  776. }
  777. //确认是否末件扫号
  778. function doEaiConfirm(){
  779. $.messager.confirm('Confirm', '确认所有分卷已创建完成?', function(r) {
  780. if (r){
  781. //调用提交方法
  782. doEai();
  783. }
  784. });
  785. }
  786. //提交的方法
  787. function doEai(){
  788. //各种参数
  789. let rollNo = $("#rollNo").val();
  790. //组装参数
  791. let eaiParam = {'orderNo': workingOrder, 'rollNo': rollNo, 'username': username};
  792. //请求参数
  793. $.ajax({
  794. url: "/cut/doEai",
  795. //contentType: 'application/json',
  796. type:"POST",
  797. //data:JSON.stringify(inData),
  798. data: eaiParam,
  799. dataType:"JSON",
  800. success: function (data) {
  801. if(data.success){
  802. //$.messager.alert("info",data.msg,"info",);
  803. //刷新当前的页面
  804. refreshRollInfo(rollNo);
  805. }else{
  806. $.messager.alert("Error",data.msg,"Error",);
  807. }
  808. }
  809. })
  810. }
  811. //单个不良方法
  812. function doSingleBad(){
  813. //各种参数
  814. let rollNo = $("#rollNo").val();
  815. let serialNo = $('#bad_serialNo').textbox('getValue');
  816. //组装参数
  817. let badParam = {'orderNo': workingOrder, 'rollNo': rollNo, 'username': username, 'serialNo': serialNo};
  818. //请求参数
  819. $.ajax({
  820. url: "/cut/doSingleBad",
  821. type:"POST",
  822. data: badParam,
  823. dataType:"JSON",
  824. success: function (data) {
  825. if(data.success){
  826. //刷新当前的页面
  827. refreshRollInfo(rollNo);
  828. //关闭弹窗
  829. //$('#dlg-single-bad').dialog('close');
  830. $('#dlg-single-bad form').form('clear');
  831. //$.messager.alert("info",data.msg,"info",);
  832. }else{
  833. $.messager.alert("Error",data.msg,"Error",);
  834. }
  835. }
  836. })
  837. }
  838. //首件扫号的modal
  839. function doBadModal(){
  840. $('#dlg-single-bad').dialog('open').dialog('center').dialog('setTitle', 'Type defective serial number');
  841. $('#dlg-single-bad form').form('clear');
  842. }
  843. //modal打开关闭选中的箱
  844. $("#dlg-single-bad").dialog({
  845. onOpen: function(){
  846. //获取焦点
  847. //showEl("#dlg #input_roll", true);
  848. $('#bad_serialNo').textbox('textbox').focus();
  849. }
  850. });
  851. //开工扫号的方法
  852. function doSetup(){
  853. //各种参数
  854. let rollNo = $("#rollNo").val();
  855. let firstSerialNo = $('#setup_firstSerialNo').textbox('getValue');
  856. let endSerialNo = $('#setup_endSerialNo').textbox('getValue');
  857. //组装参数
  858. let setupParam = {'orderNo': workingOrder, 'rollNo': rollNo, 'username': username, 'firstSerialNo': firstSerialNo, 'endSerialNo': endSerialNo};
  859. //请求参数
  860. $.ajax({
  861. url: "/cut/doSetup",
  862. //contentType: 'application/json',
  863. type:"POST",
  864. //data:JSON.stringify(inData),
  865. data: setupParam,
  866. dataType:"JSON",
  867. success: function (data) {
  868. if(data.success){
  869. //刷新当前的页面
  870. refreshRollInfo(rollNo);
  871. //关闭弹窗
  872. $('#dlg-setup').dialog('close');
  873. //$.messager.alert("info",data.msg,"info",);
  874. }else{
  875. $.messager.alert("Error",data.msg,"Error",);
  876. }
  877. }
  878. })
  879. }
  880. //开工扫号的方法
  881. function doFai(){
  882. //各种参数
  883. let rollNo = $("#rollNo").val();
  884. let firstSerialNo = $('#fai_firstSerialNo').textbox('getValue');
  885. let endSerialNo = $('#fai_endSerialNo').textbox('getValue');
  886. //组装参数
  887. let setupParam = {'orderNo': workingOrder, 'rollNo': rollNo, 'username': username, 'firstSerialNo': firstSerialNo, 'endSerialNo': endSerialNo};
  888. //请求参数
  889. $.ajax({
  890. url: "/cut/doFai",
  891. //contentType: 'application/json',
  892. type:"POST",
  893. //data:JSON.stringify(inData),
  894. data: setupParam,
  895. dataType:"JSON",
  896. success: function (data) {
  897. if(data.success){
  898. //刷新当前的页面
  899. refreshRollInfo(rollNo);
  900. //关闭弹窗
  901. $('#dlg-fai').dialog('close');
  902. //$.messager.alert("info",data.msg,"info",);
  903. }else{
  904. $.messager.alert("Error",data.msg,"Error",);
  905. }
  906. }
  907. })
  908. }
  909. //修正so_roll状态
  910. function updateStatus(){
  911. let func = '${func}';
  912. $.ajax({
  913. url: "/aoi/slitting/updateStatus",
  914. type:"POST",
  915. data:{
  916. 'rollNo': currentRoll,
  917. 'func': func,
  918. },
  919. dataType:"JSON",
  920. success: function (ret) {
  921. console.log(ret);
  922. if(ret.success == false){
  923. $.messager.alert('error',ret.errorMsg, 'error');
  924. }else if(ret.success==true){
  925. refreshRollInfo(currentRoll)
  926. $.messager.alert('info',"Successfully",'info');
  927. }
  928. }
  929. })
  930. }
  931. </script>
  932. </@master.layout>