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.

776 lines
32 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="doSetup()" class="btn btn-default">Scan/setup</button></p>
  24. <p><button id="btnFai" onclick="doFai()" class="btn btn-default">Scan/first off</button></p>
  25. <p><button id="btnEai" onclick="doEai()" class="btn btn-default">Scan/last off</button></p>
  26. <#if func?is_string && func == "indigo">
  27. <p><button id="btnCreateRoll" onclick="doCreateRoll()" class="btn btn-default">Create new roll</button></p>
  28. </#if>
  29. <#if func?is_string && func == "aoi">
  30. <p><button id="btnSlitting" onclick="showSlittingRolls()" class="btn btn-default">Slit roll</button></p>
  31. </#if>
  32. <#if func?is_string && func != "indigo">
  33. <p><button id="btnBad" onclick="doBad()" class="btn btn-default">Type defective serial number</button></p>
  34. <p><button id="btnBadRange" onclick="doBadRange()" class="btn btn-default">Batch defective serial number</button></p>
  35. </#if>
  36. <#if func?is_string && func == "abg">
  37. <p><button id="printSlitting" onclick="slittingPrint()" class="btn btn-default">Print Label</button></p>
  38. </#if>
  39. </div>
  40. </div>
  41. <div class="row" >
  42. <div class="col-md-12" id="tblRollOpInfo">
  43. </div>
  44. </div>
  45. <div id="dlg" class="easyui-dialog for-scan" style="width:500px;display: none;"
  46. closed="true" buttons="#dlg-buttons">
  47. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  48. <div style="margin-bottom:10px">
  49. <label id="rollNo_display" class="easyui-textbox" data-options="labelWidth:100,disabled:true" required="true" label="Roll No:" style="width:100%"></label>
  50. </div>
  51. <div id="serial_input_1st" style="margin-bottom:10px">
  52. <input id="firstSerialNo" name="firstSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The first serial number:" style="width:100%">
  53. </div>
  54. <div id="serial_input_2nd" style="margin-bottom:10px">
  55. <input id="endSerialNo" name="endSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The second serial number:" style="width:100%">
  56. </div>
  57. </form>
  58. </div>
  59. <!-- 结束报工页面 -->
  60. <div class="modal fade" id="report_modal" tabindex="-1" role="dialog"
  61. aria-labelledby="myModalLabel" aria-hidden="true" style="font-size:10px;">
  62. <div class="modal-dialog" style="width:430px;height:300px;">
  63. <div class="modal-content" >
  64. <div class="modal-body">
  65. <form id="report_form" class="form-horizontal" action="" method="post">
  66. <fieldset>
  67. <div id="legend" class="">
  68. <input type="hidden" value="0" name="currentScheduleId" id="current_schedule_id">
  69. <legend class="">报告产量</legend>
  70. </div>
  71. <div class="form-group">
  72. <label class="col-sm-2 control-label" style = "width: 20%;">机台</label>
  73. <div class="col-sm-4" style = "width: 30%;">
  74. <select id="report_resource_id" class="form-control" name="resourceId" style="width:100px;font-size:12px;">
  75. </select>
  76. </div>
  77. <label class="col-sm-2 control-label" style = "width: 20%;">人员</label>
  78. <div class="col-sm-4" style = "width: 20%;">
  79. <input id="report_person" type="text" class="form-control" name="person" readonly style="width:100px;font-size:12px;">
  80. </div>
  81. </div>
  82. <div class="form-group">
  83. <label class="col-sm-2 control-label" style = "width: 20%;"><span>Production Date</span></label>
  84. <div class="col-sm-4" style = "width: 30%;">
  85. <input id="produce_date" type="text" class="form-control Selection_time" name="produceDate" style="width:100px;font-size:12px;">
  86. </div>
  87. <label class="col-sm-2 control-label" style = "width: 20%;">班次</label>
  88. <div class="col-sm-4" style = "width: 20%;">
  89. <select id="report_shift_no" class="form-control" name="shiftNo" style="width:100px;font-size:12px;">
  90. </select>
  91. </div>
  92. </div>
  93. <div class="form-group">
  94. <label class="col-sm-2 control-label" style = "width: 20%;">派工数量</label>
  95. <div class="col-sm-4" style = "width: 30%;">
  96. <input id="qty_required" class="form-control" name="qtyRequired" readonly style="width:100px;font-size:12px;">
  97. </div>
  98. <label class="col-sm-2 control-label" style = "width: 20%;">已报告数量</label>
  99. <div class="col-sm-4" style = "width: 20%;">
  100. <input id="qty_reported" type="number" class="form-control" name="qtyReported" readonly style="width:100px;font-size:12px;">
  101. </div>
  102. </div>
  103. <div class="form-group">
  104. <label class="col-sm-2 control-label" style = "width: 20%;">良品数量</label>
  105. <div class="col-sm-4" style = "width: 30%;">
  106. <input id="qty_approved" type="number" class="form-control count_nums" name="qtyApproved" readonly style="width:100px;font-size:12px;">
  107. </div>
  108. <label class="col-sm-2 control-label" style = "width: 20%;">不良品数量</label>
  109. <div class="col-sm-4" style = "width: 20%;">
  110. <input id="qty_scrapped" type="number" class="form-control count_nums" name="qtyScrapped" readonly style="width:100px;font-size:12px;">
  111. </div>
  112. </div>
  113. <div class="form-group">
  114. <label class="col-sm-2 control-label" style = "width: 20%;">报告总数量</label>
  115. <div class="col-sm-4" style = "width: 30%;">
  116. <input id="current_report_qty" type="number" class="form-control" name="currentReportTotalQty" readonly style="width:100px;font-size:12px;">
  117. </div>
  118. <label class="col-sm-2 control-label" style = "width: 20%;">生产时间</label>
  119. <div class="col-sm-4" style = "width: 20%;">
  120. <input id="produce_time" type="number" class="form-control count_nums" name="produceTime" style="width:100px;font-size:12px;">
  121. </div>
  122. </div>
  123. <div class="form-group">
  124. <label class="col-sm-3 control-label">关闭派工单</label>
  125. <div class="col-sm-9" id="close_schedule_flag">
  126. <div class="checkbox checkbox-info checkbox-circle" style="margin-left: 20px;">
  127. <input name="closed" value="0" type="checkbox" checked="" style="margin-top: -0.5px;">
  128. <label for="checkbox1">是</label>
  129. </div>
  130. <div class="checkbox checkbox-info checkbox-circle" style="margin-top: -27px; margin-left: 100px;">
  131. <input name="closed" value="1" type="checkbox" style="margin-top: -0.5px;">
  132. <label for="checkbox2">否</label>
  133. </div>
  134. </div>
  135. </div>
  136. </fieldset>
  137. </form>
  138. </div>
  139. <div class="modal-footer" style="TEXT-ALIGN: center;margin-top:-20px;">
  140. <div class="control-group">
  141. <!-- Button -->
  142. <div class="controls">
  143. <button onclick="reportSchedule()" class="btn btn-success" style="font-size:12px;">Confirm</button>
  144. <button id="report_cancel" data-dismiss="modal" class="btn btn-success" style="font-size:12px;">取消</button>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <div id="endWork-buttons" style="display: none;">
  152. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="doOK()" style="width:90px">OK</a>
  153. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#endWork').dialog('close')" style="width:90px">Cancel</a>
  154. </div>
  155. <div id="dlg-buttons" style="display: none;">
  156. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="badOK" onclick="doOK()" style="width:90px">OK</a>
  157. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
  158. </div>
  159. <div id="dlgConfirm" class="easyui-dialog for-scan" style="width:500px;display: none;"
  160. closed="true" buttons="#dlg-buttons-confirm">
  161. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  162. <div style="margin-bottom:10px">
  163. <input name="workNo" class="easyui-textbox" data-options="labelWidth:100" required="true" label="Emoloyee ID:" style="width:100%">
  164. </div>
  165. </form>
  166. </div>
  167. <div id="dlg-buttons-confirm" style="display: none;">
  168. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="doConfirmOK()" style="width:90px">OK</a>
  169. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgConfirm').dialog('close')" style="width:90px">Cancel</a>
  170. </div>
  171. <div id="dlgSlitting" class="easyui-dialog for-scan" style="width:500px;display: none;"
  172. closed="true" buttons="#dlg-buttons-slitting" data-options="modal:true">
  173. <form method="post" novalidate style="margin:0;padding:20px 20px">
  174. <div style="margin-bottom:10px">
  175. <input id="noOfCross" class="easyui-textbox" data-options="labelWidth:100,disabled:true" required="true" label="Roll Qty:" style="width:100%">
  176. </div>
  177. <div style="margin-bottom:10px">
  178. <input name="endSerialNo" class="easyui-textbox" data-options="labelWidth:100" required="true" label="结束序列号:" style="width:100%">
  179. </div>
  180. </form>
  181. </div>
  182. <div id="dlg-buttons-slitting" style="display: none;">
  183. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="doSlittingOK()" style="width:90px">OK</a>
  184. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgSlitting').dialog('close')" style="width:90px">Cancel</a>
  185. </div>
  186. <!-- 卷分切-->
  187. <div id="dlgSlittingRolls" class="easyui-dialog" style="width:800px;display: none;"
  188. closed="true" data-options="modal:true" >
  189. <table id="dgSlittingRolls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
  190. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:500,toolbar:'#tbSlittingRolls'">
  191. <thead>
  192. <tr>
  193. <th data-options="field:'slittingNo',width:80,formatter:formatLodopPrint('slittingNo')">Slitting Roll No</th>
  194. <th data-options="field:'serialScope',width:300">序列号范围</th>
  195. <th data-options="field:'status',width:60">Status</th>
  196. <th data-options="field:'col',width:30">No. of Cross</th>
  197. <th data-options="field:'rewindFlag',width:50">需要倒卷</th>
  198. <th data-options="field:'combineFlag',width:50">倒卷完成</th>
  199. </tr>
  200. </thead>
  201. </table>
  202. </div>
  203. <div id="tbSlittingRolls" style="padding:10px 5px;display: none;">
  204. <div>
  205. <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="doSlitting()">新增卷</a>
  206. <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="doSlittingTure()">Correct Data</a>
  207. </div>
  208. </div>
  209. <!-- 扫描材料modal -->
  210. <div id="scan_material_dlg" class="easyui-dialog" style="width: 405px; display: none;" closed="true" data-options="modal: true, onClose: function(){
  211. $('#scan_material_table').datagrid('reload')}, buttons:'#tb_scan_material'">
  212. <form id="scan_material_fm" method="post" novalidate style="margin:0; padding: 20px 20px">
  213. <div style="margin-bottom:10px">
  214. <label style="width: 60px;">码包:</label>
  215. <input id="scan_serial_no" name="serialNo" style="width: 75%; margin-left: 10px;">
  216. </div>
  217. <div style="margin-bottom:10px">
  218. <label style="width: 60px;">Qr Code:</label>
  219. <input id="scan_qr_code" name="qrCode" style="width: 75%; margin-left: 10px;">
  220. </div>
  221. </form>
  222. <table id="scan_materials" class="easyui-datagrid" style="width:100%;height: 300px;">
  223. <thead>
  224. <tr>
  225. <th data-options="field:'sortNo',width:60, formatter:formatSnSort">序号</th>
  226. <th data-options="field:'serialNo',width:230,editor:'textbox'">SN号</th>
  227. <th data-options="field:'id',width:98, formatter:formatSnFunction">Actions</th>
  228. </tr>
  229. </thead>
  230. </table>
  231. </div>
  232. <div id="tb_scan_material" style="padding:10px 5px; display: none; text-align: center;">
  233. <div>
  234. <a href="javascript:void(0)" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-ok" onclick="finishScanSerialNo('', 'scan_serial')">Save</a>
  235. <a href="javascript:void(0)" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#scan_material_dlg').dialog('close')">Cancel</a>
  236. </div>
  237. </div>
  238. <style>
  239. table.roll-op-serials {
  240. border: 1px solid gray;
  241. }
  242. table.roll-op-serials td{
  243. border: 1px dotted gray;
  244. padding: 3px;
  245. text-align: center;
  246. text-align: center;
  247. font-family: Arial,monospace;
  248. font-size: 11px;
  249. background-color: aliceblue;
  250. }
  251. table.roll-op-serials td .serial-no{
  252. font-size: 11px;
  253. }
  254. </style>
  255. <script src="/laydate/laydate.js"></script>
  256. <script type="text/javascript" src="/js/layer/layer.js"></script>
  257. <script>
  258. var formPostUrl="";
  259. var currentRoll="";
  260. var currentRollOp = {};
  261. var currentOrder={};
  262. var urlPath="/rollop/${func}";
  263. var work_center_data;
  264. var temp_row;
  265. var doUrl = "";
  266. var flag = "N";
  267. var showSnFlag = false;
  268. var scanMaterialUrl = "/material/scanMaterialRollWithLoading";
  269. function show2ndBox(b){
  270. showEl("#dlg #serial_input_1st", true);
  271. showEl("#dlg #serial_input_2nd", true);
  272. showEl("#dlg #serial_input_2nd", b);
  273. $('#dlg #endSerialNo').textbox({disabled:!b});
  274. }
  275. function showDialog(title, serialNum, postUrl){
  276. show2ndBox(serialNum > 1);
  277. $('#dlg').dialog('open').dialog('center').dialog('setTitle',title);
  278. $('#dlg form').form('clear');
  279. $('#dlg #rollNo_display').textbox({"value": currentRoll});
  280. formPostUrl = urlPath + postUrl + "?rollNo="+currentRoll;
  281. doUrl = urlPath + "/badRange/do?rollNo="+currentRoll;
  282. }
  283. function doConfirm(){
  284. $('#dlgConfirm').dialog('open').dialog('center').dialog('setTitle',"Confirm quantity");
  285. $('#dlgConfirm form').form('clear');
  286. }
  287. function doConfirmOK(){
  288. console.log(urlPath + "/confirm/do?rollNo=" + currentRoll)
  289. $('#dlgConfirm form').form('submit',{
  290. url: urlPath + "/confirm/do?rollNo=" + currentRoll,
  291. onSubmit: function(){
  292. return $(this).form('validate');
  293. },
  294. success: function(result){
  295. var result = $.parseJSON(result);
  296. if (result.success){
  297. refreshRollInfo(currentRoll);
  298. $('#dlgConfirm').dialog('close'); // close the dialog
  299. } else {
  300. $.messager.alert('error',result.errorMsg, 'error');
  301. }
  302. }
  303. });
  304. }
  305. //修正so_roll状态
  306. function updateStatus(){
  307. let func = '${func}';
  308. $.ajax({
  309. url: "/aoi/slitting/updateStatus",
  310. type:"POST",
  311. data:{
  312. 'rollNo': currentRoll,
  313. 'func': func,
  314. },
  315. dataType:"JSON",
  316. success: function (ret) {
  317. console.log(ret);
  318. if(ret.success == false){
  319. $.messager.alert('error',ret.errorMsg, 'error');
  320. }else if(ret.success==true){
  321. refreshRollInfo(currentRoll)
  322. $.messager.alert('info',"Successfully",'info');
  323. }
  324. }
  325. })
  326. }
  327. function doSlitting(){
  328. $('#dlgSlitting').dialog('open').dialog('center').dialog('setTitle',"Slit roll");
  329. $('#dlgSlitting form').form('clear');
  330. $('#dlgSlitting #noOfCross').textbox({"value": 1});
  331. }
  332. function showSlittingRolls(){
  333. $('#dlgSlittingRolls').dialog('open').dialog('center').dialog('setTitle',"Slit roll");
  334. $("#dgSlittingRolls").datagrid({url: "/aoi/slittingrolls/"+currentRoll});
  335. }
  336. function doSlittingOK(){
  337. $('#dlgSlitting form').form('submit',{
  338. url: "/aoi/slitting/do?rollNo=" + currentRoll,
  339. onSubmit: function(){
  340. return $(this).form('validate');
  341. },
  342. success: function(result){
  343. console.log(result);
  344. var result = $.parseJSON(result);
  345. if (result.success){
  346. refreshRollInfo(currentRoll);
  347. $('#dgSlittingRolls').datagrid('reload');
  348. $('#dlgSlitting').dialog('close'); // close the dialog
  349. } else {
  350. $.messager.alert('error',result.errorMsg, 'error');
  351. }
  352. }
  353. });
  354. }
  355. function doSlittingTure(){
  356. $.ajax({
  357. url: "/aoi/slitting/doTure",
  358. type:"POST",
  359. data:{
  360. 'rollNo':currentRoll,
  361. },
  362. dataType:"JSON",
  363. success: function (ret) {
  364. console.log(ret);
  365. if(ret.success==false){
  366. $.messager.alert('error',ret.data, 'error');
  367. }else if(ret.success==true){
  368. $.messager.alert('info',"Successfully",'info');
  369. }
  370. }
  371. })
  372. }
  373. function doStart(){
  374. flag = "N";
  375. $("#dlg #firstSerialNo").textbox({disabled:false});
  376. showDialog("Scan", 1, "/start/do");
  377. }
  378. function doSetup(){
  379. flag = "N";
  380. $("#dlg #firstSerialNo").textbox({disabled:true});
  381. showDialog("Scan/setup", 2, "/setup/do");
  382. $("#dlg #firstSerialNo").textbox({value: currentRollOp.toSetupSerialNo || ""});
  383. }
  384. function doFai(){
  385. flag = "N";
  386. $("#dlg #firstSerialNo").textbox({disabled:false});
  387. showDialog("Scan/first off", 2, "/fai/do");
  388. }
  389. function doEai(){
  390. flag = "N";
  391. $("#dlg #firstSerialNo").textbox({disabled:false});
  392. showDialog("Scan/last off", 2, "/eai/do");
  393. }
  394. function doBad(){
  395. flag = "N";
  396. showDialog("Type defective serial number", 1, "/bad/do");
  397. }
  398. // function doIpqc(){
  399. // flag = "N";
  400. // showDialog("IPQC抽样", 1, "/ipqc/do");
  401. // }
  402. function doBadRange(){
  403. $("#badOK").linkbutton({"disabled": false});
  404. flag = "Y";
  405. //showDialog("Batch defective serial number", 2, "/badRange/do");
  406. showDialog("Batch defective serial number", 2, "/badRange/count");
  407. }
  408. <#if func == "aoi">
  409. function doEai(){
  410. showEl("#dlg #serial_input_1st", false);
  411. showEl("#dlg #serial_input_2nd", false);
  412. $('#dlg').dialog('open').dialog('center').dialog('setTitle',"Scan/last off");
  413. $('#dlg form').form('clear');
  414. $('#dlg #rollNo_display').textbox({"value": currentRoll});
  415. $('#dlg #firstSerialNo').textbox({"value": "-"});
  416. $('#dlg #endSerialNo').textbox({"value": "-"});
  417. formPostUrl = urlPath + "/eai/do" + "?rollNo="+currentRoll;
  418. }
  419. </#if>
  420. function doOK(){
  421. var badFirstSN = $("#firstSerialNo").val();
  422. var badEndSN = $("#endSerialNo").val();
  423. $("#badOK").linkbutton({"disabled": true});
  424. $('#dlg form').form('submit',{
  425. url: formPostUrl,
  426. onSubmit: function(){
  427. return $(this).form('validate');
  428. },
  429. success: function(result){
  430. if(flag=="Y"){
  431. var result = $.parseJSON(result);
  432. if (result.errorMsg){
  433. $("#badOK").linkbutton({"disabled": false});
  434. $('#dlg').dialog('close');
  435. $.messager.alert('Error',result.errorMsg, 'error');
  436. } else {
  437. if(result.count>1000){
  438. $.messager.confirm('Confirm','Defective quantity greater than 1000, continue??',function(r) {
  439. if (r){
  440. console.log("首个序列号:"+badFirstSN);
  441. console.log("最后一个序列号:"+badEndSN);
  442. console.log("请求地址:"+doUrl);
  443. $.post(doUrl, {firstSerialNo:badFirstSN,endSerialNo:badEndSN}, function(data){
  444. $("#badOK").linkbutton({"disabled": false});
  445. console.log(data);
  446. refreshRollInfo(currentRoll);
  447. if (data.success){
  448. $('#dlg form').form('clear');
  449. $('#dlg #rollNo_display').textbox({"value": currentRoll});
  450. //2020-09-16 添加不良录入成功提示
  451. $.messager.alert('Success','The defect has been reported successfully, the total qty is '+result.count, 'info');
  452. }else{
  453. $('#dlg').dialog('close'); // close the dialog
  454. }
  455. });
  456. }else{
  457. $("#badOK").linkbutton({"disabled": false});
  458. $('#dlg').dialog('close');
  459. }
  460. });
  461. }else{
  462. $.post(doUrl, {firstSerialNo:badFirstSN,endSerialNo:badEndSN}, function(data){
  463. $("#badOK").linkbutton({"disabled": false});
  464. refreshRollInfo(currentRoll);
  465. if (data.success){
  466. $('#dlg form').form('clear');
  467. $('#dlg #rollNo_display').textbox({"value": currentRoll});
  468. //2020-09-16 添加不良录入成功提示
  469. $.messager.alert('Success','The defect has been reported successfully, the total qty is '+result.count, 'info');
  470. }else{
  471. $('#dlg').dialog('close'); // close the dialog
  472. }
  473. });
  474. }
  475. }
  476. }else{
  477. var result = $.parseJSON(result);
  478. $("#badOK").linkbutton({"disabled": false});
  479. if (result.errorMsg){
  480. $.messager.alert('Error',result.errorMsg, 'error');
  481. } else {
  482. refreshRollInfo(currentRoll);
  483. if (formPostUrl.indexOf("/bad/") >= 0 || formPostUrl.indexOf("/ipqc/") >= 0){
  484. $('#dlg form').form('clear');
  485. $('#dlg #rollNo_display').textbox({"value": currentRoll});
  486. }else{
  487. $('#dlg').dialog('close'); // close the dialog
  488. }
  489. }
  490. }
  491. }
  492. });
  493. }
  494. $("#rollNo").on("keydown", function(){
  495. if(event.keyCode == 13){
  496. refreshRollInfo($.trim($(this).val()));
  497. }
  498. });
  499. <#if RequestParameters.rollNo ??>
  500. $(function(){
  501. $("#rollNo").val("${RequestParameters.rollNo}");
  502. refreshRollInfo("${RequestParameters.rollNo}");
  503. });
  504. </#if>
  505. function doCreateRoll(){
  506. if (currentOrder){
  507. $.messager.confirm('Confirm','Are you sure to create new roll for the shop order <b>'+currentOrder.orderNo+'</b>? ',function(r) {
  508. if (r){
  509. $.post("/indigo/create_roll/do", {orderNo: currentOrder.orderNo}, function(data){
  510. if (data.success && data.newRollNo){
  511. $("#rollNo").val(data.newRollNo);
  512. refreshRollInfo(data.newRollNo);
  513. }
  514. });
  515. }
  516. });
  517. }
  518. }
  519. function slittingPrint() {
  520. $.messager.confirm('Confirm','Is Printed ?',function(r){
  521. if (r){
  522. $("#ifmforprint").attr('src', "/print/rollnoSlitting/" + currentRollOp.operationNo + "/" + currentRoll + "/");
  523. console.log("/print/rollnoSlitting/" + currentRollOp.operationNo + "/" + currentRoll + "/")
  524. }
  525. });
  526. }
  527. function refreshRollStatus(){
  528. $.messager.confirm('Confirm','Are you sure to reverse all scanning data ?',function(r){
  529. if (r){
  530. $.post(urlPath+"/refreshRollStatus", {rollNo: currentRoll}, function(data){
  531. if (data.success ){
  532. refreshRollInfo($("#rollNo").val());
  533. $.messager.alert('info',"Successfully",'info');
  534. }else{
  535. $.messager.alert('error',data.errorMsg,'error');
  536. }
  537. })
  538. }
  539. });
  540. }
  541. //回车触发事件
  542. function refreshRollInfo(rollNo){
  543. <#if func == "indigo">
  544. $("#processNumber").val("10");
  545. </#if>
  546. <#if func == "abg">
  547. $("#processNumber").val("20");
  548. </#if>
  549. <#if func == "aoi">
  550. $("#processNumber").val("30");
  551. </#if>
  552. var $tblInfo = $("#tblInfo");
  553. var $tblRollOpInfo = $("#tblRollOpInfo");
  554. $tblInfo.html("");
  555. $tblRollOpInfo.html("");
  556. $.post(urlPath+"/getRoll", {rollNo: rollNo}, function(data){
  557. if (data.success && data.roll){
  558. showEl("#actions", data.showAction);
  559. enableEl("#btnConfirm", data.enableConfirm);
  560. enableEl("#btnStatus", data.enableStatus);
  561. enableEl("#btnStart", data.enableStart);
  562. enableEl("#btnSetup", data.enableSetup);
  563. enableEl("#btnFai", data.enableFai);
  564. enableEl("#btnEai", data.enableEai);
  565. enableEl("#scanMaterial", data.enableScanMaterial);
  566. <#if func == "scanning">
  567. showEl("#btnStart");
  568. showEl("#btnSetup");
  569. showEl("#btnFai");
  570. showEl("#btnEai");
  571. showEl("#btnBad");
  572. </#if>
  573. <#if currentUser.isAdmin || currentUser.authorities?contains("refreshRollStatus")>
  574. enableEl("#refreshRollStatus", true);
  575. </#if>
  576. <#if func != "indigo">
  577. enableEl("#btnBad",!data.scanStatus);
  578. enableEl("#btnBadRange", !data.scanStatus);
  579. enableEl("#printSlitting", data.rollOp && data.rollOp.remainSnCount);
  580. </#if>
  581. currentRoll = data.roll.rollNo;
  582. currentRollOp = data.rollOp;
  583. currentOrder=data.roll.order;
  584. var rollNoDisplay = data.roll.rollNo;
  585. //判断特殊材料上机
  586. if (currentOrder && currentOrder.firstRollFlag === 'Y'){
  587. showSnFlag = true;
  588. scanMaterialUrl = "/material/scanMaterialRollWithReplace";
  589. }else if (currentOrder && (currentOrder.firstRollFlag === 'N' || currentOrder.firstRollFlag === '')){
  590. showSnFlag = false;
  591. scanMaterialUrl = "/material/scanMaterialRollWithLoading";
  592. }
  593. if (data.rollOp && data.rollOp.remainSnCount){
  594. rollNoDisplay = "<a target='forprint' href='/print/rollno/"+data.rollOp.operationNo+"/"+rollNoDisplay+"/'>"+rollNoDisplay+"</a>";
  595. }
  596. $tblInfo.append("<tr><td>SO No:</td><td>"+data.roll.orderNo+"</td></tr>");
  597. $tblInfo.append("<tr><td>Roll No:</td><td>"+rollNoDisplay+"</td></tr>");
  598. $tblInfo.append("<tr><td>Status</td><td>"+(data.roll.status || "-")+"</td></tr>");
  599. $("#orderNo").val(data.roll.orderNo);
  600. if (data.rollOpHtml){
  601. $tblRollOpInfo.append(data.rollOpHtml);
  602. }
  603. if (data.prevCount){
  604. $tblInfo.append("<tr><td>Serials Qty:</td><td>"+(data.prevCount)+"</td></tr>");
  605. }
  606. $tblInfo.append("<tr><td>Good Products Qty:</td><td>"+(data.qtyBad)+"</td></tr>");
  607. $tblInfo.append("<tr><td>Defect Product Qty:</td><td>"+(data.qtyApprove)+"</td></tr>");
  608. $tblInfo.append("<tr><td>Total Qty:</td><td>"+(data.qtyAll)+"</td></tr>");
  609. if (data.prevCount){
  610. $tblInfo.append("<tr><td>Different Qty:</td><td>"+(data.prevDifferent)+"</td></tr>");
  611. }
  612. if (data.badSns){
  613. $tblInfo.append("<tr><td>Defective serial number:</td><td>"+(data.badSns.split(",").join("<br />") || "-")+"</td></tr>");
  614. }
  615. if (data.slittingRolls){
  616. $tblInfo.append("<tr><td>Slitting Roll No:</td><td>"+(data.slittingRolls.split(",").join("<br />") || "-")+"</td></tr>");
  617. }
  618. checkWithWorkingOrder(data.roll.order.orderNo);
  619. }else{
  620. $tblInfo.append("<tr><td>"+data.errorMsg+"</td></tr>");
  621. }
  622. })
  623. }
  624. function checkWithWorkingOrder(orderNo) {
  625. var workingOrder = $("#hdnWorkingOrder").val();
  626. if (workingOrder != orderNo){
  627. var msg = 'Are you sure to swith to the order <b>'+orderNo+'</b>?';
  628. if (workingOrder != "") {
  629. msg = 'The order of this roll does not match with the current order '+workingOrder+'.';
  630. }
  631. $("#tblInfo").html("");
  632. $("#tblRollOpInfo").html("");
  633. $("#actions").hide();
  634. $.messager.alert("Error", msg, "error", function(){
  635. $("#rollNo").val("").focus();
  636. });
  637. }
  638. }
  639. function getday(){
  640. lay('.Selection_time').each(function(){
  641. laydate.render({
  642. elem: this
  643. });
  644. });
  645. $('.Selection_time').val(getToday());
  646. }
  647. //获取当天日期
  648. function getToday(){
  649. var date = new Date();
  650. var seperator1 = "-";
  651. var year = date.getFullYear();
  652. var month = date.getMonth() + 1;
  653. var strDate = date.getDate();
  654. if (month >= 1 && month <= 9) {
  655. month = "0" + month;
  656. }
  657. if (strDate >= 0 && strDate <= 9) {
  658. strDate = "0" + strDate;
  659. }
  660. var currentdate = year + seperator1 + month + seperator1 + strDate;
  661. return currentdate;
  662. }
  663. $(function () {
  664. $("#rollNo").focus();
  665. })
  666. //扫描材料上级
  667. function scanMaterialModal(){
  668. $.messager.alert('info', scanMaterialUrl,'info');
  669. //判断是否在扫描的时候创建中包
  670. if(showSnFlag){
  671. //当前的码包可以修改
  672. $("#scan_serial_no").prop('readonly', false);
  673. }else {
  674. $("#scan_serial_no").prop('readonly', true);
  675. }
  676. //显示form
  677. //设置当前的行
  678. $('#scan_material_dlg').dialog('open').dialog('center').dialog('setTitle', "扫描上机");
  679. $('#scan_serial_no').focus();
  680. //加sn的数据
  681. var opts = $('#scan_materials').datagrid('options');
  682. opts.queryParams = {'orderNo': currentOrder.orderNo, "itemNo": 10};
  683. $("#scan_materials").datagrid({url: "/fqc/getSoFinalRollDtls",
  684. onLoadSuccess: function(data) {
  685. }
  686. });
  687. }
  688. //sn表格序号
  689. function formatSnSort(value, row, index){
  690. let rows = $("#scan_materials").datagrid("getData").rows;
  691. let total = rows.length;
  692. return total - index;
  693. }
  694. //sn列表的功能
  695. function formatSnFunction(value, row){
  696. let packStatus = row.status;
  697. let tags = '';
  698. //没有封包的时候才可以删除
  699. if('Created' == packStatus){
  700. tags += '<a style="text-decoration:none;" onclick="cancelSerialNo('+value+'\,\''+row.serialNo+'\')">Delete</a>';
  701. }
  702. return tags;
  703. }
  704. </script>
  705. </@master.layout>