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.

710 lines
28 KiB

3 days ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <style>
  4. #fm label {
  5. width: 150px;
  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. 第一个序列号: [<span id="snSpan">${firstReworkSn!}</span>]
  18. </p>
  19. <!-- 左边栏 -->
  20. <div style="width:30%;float: left;">
  21. <table id="roll_dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
  22. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , url:'/scanning/scanpool/getRollNoList',method:'get',pageSize:20,toolbar:'#tb'">
  23. <thead>
  24. <tr>
  25. <th data-options="field:'finalRollNo',width:100">Roll No</th>
  26. </tr>
  27. </thead>
  28. </table>
  29. <div id="tb" style="padding:10px 5px;display: none;">
  30. <div>
  31. <a href="javascript:void(0)" id="tbScanRoll" class="easyui-linkbutton" iconCls="icon-add" onclick="scanRoll()">Scan roll number</a>
  32. </div>
  33. </div>
  34. </div>
  35. <!-- 右边栏 -->
  36. <div style="width:70%;float: right;">
  37. <table id="sn_dg" class="easyui-datagrid" style="width:100%;height:424px;display: none;"
  38. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , url:'/scanning/scanpool/${jobId}/all',method:'get',pageSize:20,toolbar:'#sn_tb'">
  39. <thead>
  40. <tr>
  41. <th data-options="field:'serialNo',width:100">Serials Number</th>
  42. </tr>
  43. </thead>
  44. </table>
  45. <div id="sn_tb" style="padding:10px 5px;display: none;">
  46. <div>
  47. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" onclick="createFristSn()">Scan the first serial number</a>
  48. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" onclick="badInput()">Type defective serial number</a>
  49. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" onclick="createFinalRoll()">Create FG roll</a>
  50. <#if currentUser.isAdmin>
  51. <a href="javascript:void(0)" id="tbClear" class="easyui-linkbutton" iconCls="icon-remove" onclick="clearPool()">Clear scanning list</a>
  52. </#if>
  53. <#-- <a href="javascript:void(0)" id="knotOrder" class="easyui-linkbutton" iconCls="icon-add" onclick="doKnot()">结单报工</a>-->
  54. </div>
  55. </div>
  56. </div>
  57. <!-- 扫描卷号 -->
  58. <div id="dlgRoll" class="easyui-dialog for-scan" style="width:500px;display: none;"
  59. closed="true" buttons="#dlg-buttons-roll">
  60. <form id="fmRoll" method="post" novalidate style="margin:0;padding:20px 20px">
  61. <div style="margin-bottom:10px">
  62. <label name="reworkRollNo" class="easyui-textbox" data-options="labelWidth:100" required="true" label="Roll No:" style="width:100%">
  63. </div>
  64. </form>
  65. </div>
  66. <div id="dlg-buttons-roll" style="display: none;">
  67. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="doScanRollOK()" style="width:90px">OK</a>
  68. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgRoll').dialog('close')" style="width:90px">Cancel</a>
  69. </div>
  70. <!-- 扫描首个序列号 -->
  71. <div id="dlgFirstSn" class="easyui-dialog for-scan" style="width:500px;display: none;"
  72. closed="true" buttons="#dlg-buttons-fristSn">
  73. <form id="fmFristSn" method="post" novalidate style="margin:0;padding:20px 20px">
  74. <div style="margin-bottom:10px">
  75. <label name="firstSn" class="easyui-textbox" data-options="labelWidth:100" required="true" label="The first serial number:" style="width:100%">
  76. </div>
  77. </form>
  78. </div>
  79. <div id="dlg-buttons-fristSn" style="display: none;">
  80. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="doScanFristSnOK()" style="width:90px">OK</a>
  81. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgFirstSn').dialog('close')" style="width:90px">Cancel</a>
  82. </div>
  83. <!-- 创建最终卷 -->
  84. <div id="dlgFinalRoll" class="easyui-dialog for-scan" style="width:500px;display: none;"
  85. closed="true" buttons="#dlg-buttons-finalroll">
  86. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  87. <div style="margin-bottom:10px">
  88. <input id="endSerialNo" name="endSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="本卷结束序列号:" style="width:100%">
  89. </div>
  90. <div style="margin-bottom:10px">
  91. <input id="nextSerialNo" name="nextSerialNo" class="easyui-textbox" data-options="labelWidth:100" label="The end serial number of current roll" style="width:100%">
  92. </div>
  93. </form>
  94. </div>
  95. <div id="dlg-buttons-finalroll" style="display: none;">
  96. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="doFinalRoll" onclick="doFinalRollOK()" style="width:90px">OK</a>
  97. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgFinalRoll').dialog('close')" style="width:90px">Cancel</a>
  98. </div>
  99. <!-- 不良录入页面 -->
  100. <div id="dlgBadSnDtls" class="easyui-dialog" style="width:600px;display: none;"
  101. closed="true" data-options="modal:true" >
  102. <table id="dgBadSnDtls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
  103. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:20,toolbar:'#tbBadSnDtls'">
  104. <thead>
  105. <tr>
  106. <th data-options="field:'serialNo',width:100">Defective serial number</th>
  107. </tr>
  108. </thead>
  109. </table>
  110. <div id="tbBadSnDtls" style="padding:10px 5px;display: none;">
  111. <div>
  112. 录入不良序列号: <input class="easyui-textbox" id="inptBadSn" style="width:250px">
  113. <a href="#nowhere" id="lnkOK" class="easyui-linkbutton" iconCls="icon-add" onclick="addNewBadSn()">Ok</a>
  114. <a id="btnBadRange" onclick="doBadRange()" class="easyui-linkbutton" iconCls="icon-add">Batch defective serial number</a>
  115. </div>
  116. </div>
  117. </div>
  118. <!-- 结束报工页面 -->
  119. <div class="modal fade" id="report_modal" tabindex="-1" role="dialog"
  120. aria-labelledby="myModalLabel" aria-hidden="true" style="font-size:10px;">
  121. <div class="modal-dialog" style="width:430px;height:300px;">
  122. <div class="modal-content" >
  123. <div class="modal-body">
  124. <form id="report_form" class="form-horizontal" action="" method="post">
  125. <fieldset>
  126. <div id="legend" class="">
  127. <input type="hidden" value="0" name="currentScheduleId" id="current_schedule_id">
  128. <legend class="">报告产量</legend>
  129. </div>
  130. <div class="form-group">
  131. <label class="col-sm-2 control-label" style = "width: 20%;">机台</label>
  132. <div class="col-sm-4" style = "width: 30%;">
  133. <select id="report_resource_id" class="form-control" name="resourceId" style="width:100px;font-size:12px;">
  134. </select>
  135. </div>
  136. <label class="col-sm-2 control-label" style = "width: 20%;">人员</label>
  137. <div class="col-sm-4" style = "width: 20%;">
  138. <input id="report_person" type="text" class="form-control" name="person" readonly style="width:100px;font-size:12px;">
  139. </div>
  140. </div>
  141. <div class="form-group">
  142. <label class="col-sm-2 control-label" style = "width: 20%;"><span>Production Date</span></label>
  143. <div class="col-sm-4" style = "width: 30%;">
  144. <input id="produce_date" type="text" class="form-control Selection_time" name="produceDate" style="width:100px;font-size:12px;">
  145. </div>
  146. <label class="col-sm-2 control-label" style = "width: 20%;">班次</label>
  147. <div class="col-sm-4" style = "width: 20%;">
  148. <select id="report_shift_no" class="form-control" name="shiftNo" style="width:100px;font-size:12px;">
  149. </select>
  150. </div>
  151. </div>
  152. <div class="form-group">
  153. <label class="col-sm-2 control-label" style = "width: 20%;">派工数量</label>
  154. <div class="col-sm-4" style = "width: 30%;">
  155. <input id="qty_required" class="form-control" name="qtyRequired" readonly style="width:100px;font-size:12px;">
  156. </div>
  157. <label class="col-sm-2 control-label" style = "width: 20%;">已报告数量</label>
  158. <div class="col-sm-4" style = "width: 20%;">
  159. <input id="qty_reported" type="number" class="form-control" name="qtyReported" readonly style="width:100px;font-size:12px;">
  160. </div>
  161. </div>
  162. <div class="form-group">
  163. <label class="col-sm-2 control-label" style = "width: 20%;">良品数量</label>
  164. <div class="col-sm-4" style = "width: 30%;">
  165. <input id="qty_approved" type="number" class="form-control count_nums" name="qtyApproved" readonly style="width:100px;font-size:12px;">
  166. </div>
  167. <label class="col-sm-2 control-label" style = "width: 20%;">不良品数量</label>
  168. <div class="col-sm-4" style = "width: 20%;">
  169. <input id="qty_scrapped" type="number" class="form-control count_nums" name="qtyScrapped" readonly style="width:100px;font-size:12px;">
  170. </div>
  171. </div>
  172. <div class="form-group">
  173. <label class="col-sm-2 control-label" style = "width: 20%;">报告总数量</label>
  174. <div class="col-sm-4" style = "width: 30%;">
  175. <input id="current_report_qty" type="number" class="form-control" name="currentReportTotalQty" readonly style="width:100px;font-size:12px;">
  176. </div>
  177. <label class="col-sm-2 control-label" style = "width: 20%;">生产时间</label>
  178. <div class="col-sm-4" style = "width: 20%;">
  179. <input id="produce_time" type="number" class="form-control count_nums" name="produceTime" style="width:100px;font-size:12px;">
  180. </div>
  181. </div>
  182. <div class="form-group">
  183. <label class="col-sm-3 control-label">关闭派工单</label>
  184. <div class="col-sm-9" id="close_schedule_flag">
  185. <div class="checkbox checkbox-info checkbox-circle" style="margin-left: 20px;">
  186. <input name="closed" value="0" type="checkbox" checked="" style="margin-top: -0.5px;">
  187. <label for="checkbox1">是</label>
  188. </div>
  189. <div class="checkbox checkbox-info checkbox-circle" style="margin-top: -27px; margin-left: 100px;">
  190. <input name="closed" value="1" type="checkbox" style="margin-top: -0.5px;">
  191. <label for="checkbox2">否</label>
  192. </div>
  193. </div>
  194. </div>
  195. </fieldset>
  196. </form>
  197. </div>
  198. <div class="modal-footer" style="TEXT-ALIGN: center;margin-top:-20px;">
  199. <div class="control-group">
  200. <!-- Button -->
  201. <div class="controls">
  202. <button onclick="reportSchedule()" class="btn btn-success" style="font-size:12px;">Confirm</button>
  203. <button id="report_cancel" data-dismiss="modal" class="btn btn-success" style="font-size:12px;">取消</button>
  204. </div>
  205. </div>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. <!-- 批量录入不良 -->
  211. <div id="dlg" class="easyui-dialog for-scan" style="width:500px;display: none;"
  212. closed="true" buttons="#dlg-buttons">
  213. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  214. <div id="serial_input_1st" style="margin-bottom:10px">
  215. <input id="badFirstSN" name="firstSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The first serial number:" style="width:100%">
  216. </div>
  217. <div id="serial_input_2nd" style="margin-bottom:10px">
  218. <input id="badEndSN" name="endSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The second serial number:" style="width:100%">
  219. </div>
  220. </form>
  221. </div>
  222. <div id="dlg-buttons" style="display: none;">
  223. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="doOK" onclick="doOK()" style="width:90px">OK</a>
  224. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
  225. </div>
  226. <script src="/laydate/laydate.js"></script>
  227. <script type="text/javascript" src="/js/layer/layer.js"></script>
  228. <script>
  229. var reworkOrderNo = "${currentUser.workingOrder!}";
  230. console.log(reworkOrderNo);
  231. //结单报工
  232. function doKnot(){
  233. var subscriber = $("#subscriber").val();
  234. console.log(subscriber);
  235. formatterDate = function(date) {
  236. var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
  237. var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0"
  238. + (date.getMonth() + 1);
  239. return date.getFullYear() + '-' + month + '-' + day;
  240. };
  241. $('#report_person').val(subscriber);
  242. $.ajax({
  243. url: "/rollop/findPNo",
  244. type:"POST",
  245. data:{
  246. 'processNumber':'40',
  247. 'orderNo':reworkOrderNo
  248. },
  249. dataType:"JSON",
  250. success: function (ret) {
  251. console.log(ret);
  252. if(ret.success==false){
  253. $.messager.alert('error',ret.data, 'error');
  254. }else if(ret.success==true){
  255. console.log(ret.data);
  256. temp_row = ret.data;
  257. initWorkCenter(ret.data.workCenterNo,ret.data.resourceId);
  258. initShiftNo();
  259. getday();
  260. $('#report_person').val(subscriber);
  261. $('#qty_required').val(ret.data.qtyRequired);
  262. $('#qty_reported').val(ret.data.qtyReported);
  263. $('#qty_approved').val(ret.QtyOutput);
  264. $('#qty_scrapped').val(ret.bad);
  265. $('#current_report_qty').val(ret.all);
  266. $('#produce_time').val(ret.workTime);
  267. $("#report_modal").modal();
  268. }
  269. }
  270. })
  271. }
  272. //加载加工中心
  273. function initWorkCenter(workCenterNo,resourceId){
  274. $.ajax({
  275. url: "/rollop/workCenterData",
  276. type:"POST",
  277. data:{
  278. "workCenterNo": workCenterNo
  279. },// 你的formid
  280. dataType:"JSON",
  281. success: function (data) {
  282. var resourceIds = data.obj[workCenterNo];
  283. var resource_id_tag = '';
  284. if(resourceIds.length>0){
  285. for(var i = 0; i< resourceIds.length; i++){
  286. if((resourceId) == resourceIds[i]){
  287. resource_id_tag += '<option value="'+resourceIds[i]+'" selected>'+resourceIds[i]+'</option>';
  288. }else{
  289. resource_id_tag += '<option value="'+resourceIds[i]+'">'+resourceIds[i]+'</option>';
  290. }
  291. }
  292. }
  293. $("#report_resource_id").html(resource_id_tag);
  294. }
  295. })
  296. }
  297. //加载班次
  298. function initShiftNo(){
  299. $.ajax({
  300. url: "/rollop/shiftInfo",
  301. type:"POST",
  302. data:{},// 你的formid
  303. dataType:"JSON",
  304. success: function (data) {
  305. shift_no_data = data.rows;
  306. //初始化时间段
  307. var shift_tags = '';
  308. for(var i = 0; i< shift_no_data.length; i++){
  309. shift_tags += '<option value="'+shift_no_data[i].shiftid+'">'+shift_no_data[i].shiftdesc+'</option>';
  310. }
  311. $("#report_shift_no").html(shift_tags);
  312. }
  313. })
  314. }
  315. //保存派工单
  316. function reportSchedule(){
  317. var report_person =$.trim( $("#report_person").val());
  318. var qty = $.trim($("#current_report_qty").val());
  319. var colsedFlag = $("#close_schedule_flag").find('input[name="closed"]:checked').val();
  320. var produceTime = $("#produce_time").val();
  321. //判断空值
  322. if("" == report_person){
  323. layer.msg("操作员不能为空!");
  324. return false;
  325. }
  326. if("" == qty){
  327. layer.msg("报工数量不能为空!");
  328. return false;
  329. }
  330. if(""==produceTime){
  331. layer.msg("生产时间不能为空!");
  332. return false;
  333. }
  334. //判断事件有效性
  335. if(qty<=0){
  336. layer.msg("报工总数量不能小于零!");
  337. return false;
  338. }
  339. if(produceTime<=0){
  340. layer.msg("生产时间必须大于零!");
  341. return false;
  342. }
  343. if("0" == colsedFlag){
  344. layer.confirm('确定要关闭当前派工单!', {
  345. btn: [ 'Ok', '取消'] //按钮
  346. },function(index){
  347. createSfdcOps(colsedFlag);
  348. //findOperator($("#report_person").val(),colsedFlag);
  349. }, function(){
  350. });
  351. }else{
  352. createSfdcOps(colsedFlag);
  353. //findOperator($("#report_person").val(),colsedFlag);
  354. }
  355. }
  356. //创建当前的报工数据
  357. function createSfdcOps(colsedFlag){
  358. var qty_approved = $("#qty_approved").val();
  359. //判断是是否转换int
  360. if(""!=qty_approved){
  361. qty_approved = parseInt(qty_approved);
  362. }else{
  363. qty_approved = 0
  364. }
  365. var qty_scrapped = $("#qty_scrapped").val();
  366. //判断是是否转换int
  367. if(""!=qty_scrapped){
  368. qty_scrapped = parseInt(qty_scrapped);
  369. }else{
  370. qty_scrapped = 0;
  371. }
  372. var totalNums = qty_scrapped+qty_approved;
  373. var in_data = {"scheduleId": temp_row.id, "site": temp_row.site, "orderNo": temp_row.orderNo,
  374. "orderRef1": temp_row.orderRef1, "orderRef2": temp_row.orderRef2, "orderRef3": temp_row.orderRef3,
  375. "itemNo": temp_row.itemNo, "workCenterNo": temp_row.workCenterNo,
  376. "shiftNo": $("#report_shift_no").val(), "operatorId": "", "operatorName": $("#report_person").val(),
  377. "enteredDate": "", "enteredBy": $("#report_person").val(), "qtyApproved": qty_approved,
  378. "closedFlag": colsedFlag, "operatorId": $("#report_person").val(), "resourceId": $("#report_resource_id").val(),
  379. "qtyReported": totalNums, "qtyScrapped": qty_scrapped, "manufTime": $("#produce_time").val()};
  380. //提交数据
  381. $.ajax({
  382. url: "/rollop/createSfdcOps",
  383. type:"POST",
  384. data: JSON.stringify(in_data),// 你的formid
  385. dataType:"JSON",
  386. contentType : 'application/json;charset=utf-8',
  387. success: function (data) {
  388. parent.layer.closeAll();
  389. console.log(data);
  390. if (data.success) {
  391. $.messager.alert('info',data.msg,'info');
  392. $("#report_cancel").click();
  393. }else{
  394. $.messager.alert('Error',data.msg, 'error');
  395. }
  396. }
  397. })
  398. }
  399. $(window).resize(function () {
  400. $("#roll_dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
  401. $("#sn_dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
  402. });
  403. $(function () {
  404. $(window).resize();
  405. });
  406. //给单选事件加事件监听
  407. $("#close_schedule_flag input[name='closed']").bind('change', function(){
  408. $("#close_schedule_flag").find('input[name="closed"]').removeAttr('checked');
  409. $(this).prop('checked', true);
  410. });
  411. function getday(){
  412. lay('.Selection_time').each(function(){
  413. laydate.render({
  414. elem: this
  415. });
  416. });
  417. $('.Selection_time').val(getToday());
  418. }
  419. /*
  420. * 新加功能
  421. */
  422. //扫描卷号页面
  423. function scanRoll(){
  424. if (reworkOrderNo == ""){
  425. $.messager.alert("Error", "Please scan the order no of rework first", "error");
  426. return;
  427. }
  428. $('#roll_dg').datagrid('reload');
  429. $('#dlgRoll').dialog('open').dialog('center').dialog('setTitle', "Scan roll number");
  430. $('#dlgRoll form').form('clear');
  431. }
  432. //确认是否扫描卷号
  433. function doScanRollOK(){
  434. $('#dlgRoll form').form('submit',{
  435. url: "/scanning/scanpool/${jobId}/scanReworkRoll",
  436. onSubmit: function(){
  437. return $(this).form('validate');
  438. },
  439. success: function(result){
  440. console.log(result);
  441. try{
  442. var result = JSON.parse(result);
  443. if (result.errorMsg){
  444. $.messager.alert('Error',result.errorMsg, 'error');
  445. } else {
  446. window.location.reload();
  447. }
  448. }catch(e){
  449. }
  450. }
  451. });
  452. }
  453. //扫描首个序列号
  454. function createFristSn(){
  455. $('#dlgFirstSn').dialog('open').dialog('center').dialog('setTitle', "扫描第一个序列号");
  456. $('#dlgFirstSn form').form('clear');
  457. }
  458. //确认是否提交首个序列号
  459. function doScanFristSnOK(){
  460. $('#dlgFirstSn form').form('submit',{
  461. url: "/scanning/scanpool/${jobId}/scanfirstRSn",
  462. onSubmit: function(){
  463. return $(this).form('validate');
  464. },
  465. success: function(result){
  466. console.log(result);
  467. try{
  468. var result = JSON.parse(result);
  469. if (result.errorMsg){
  470. $.messager.alert('Error',result.errorMsg, 'error');
  471. } else {
  472. window.location.reload();
  473. }
  474. }catch(e){
  475. }
  476. }
  477. });
  478. }
  479. //不良录入
  480. function badInput(){
  481. $("#dgBadSnDtls").datagrid({url: "/scanning/reworkbadsn/"+reworkOrderNo+"/"});
  482. $('#dlgBadSnDtls').dialog('open').dialog('center').dialog('setTitle','Defective serial number');
  483. $("#_easyui_textbox_input4").focus();
  484. }
  485. //2020-09-30 sunny要求加入扫描自动录入功能
  486. $("#inptBadSn").textbox({
  487. inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents,{
  488. keyup:function(event){
  489. if(event.keyCode == 13){
  490. addNewBadSn();
  491. }
  492. }
  493. })
  494. })
  495. //确认不良录入
  496. function addNewBadSn(){
  497. $.post("/scanning/${jobId}/reworkbadsn/add", {reworkOrderNo: reworkOrderNo, serialNo: $("#inptBadSn").val()}, function (ret) {
  498. if (ret.success){
  499. $("#dgBadSnDtls").datagrid("reload");
  500. $('#sn_dg').datagrid('reload');
  501. $("#inptBadSn").textbox("clear");
  502. $("#_easyui_textbox_input4").focus();
  503. }else{
  504. $.messager.alert("Error", ret.errorMsg, "error");
  505. }
  506. })
  507. }
  508. //创建最终卷
  509. function createFinalRoll(){
  510. $("#doFinalRoll").linkbutton({"disabled": false});
  511. $('#dlgFinalRoll').dialog('open').dialog('center').dialog('setTitle', "Create FG roll");
  512. $('#dlgFinalRoll form').form('clear');
  513. }
  514. //扫描最终卷
  515. function doFinalRollOK(){
  516. $("#doFinalRoll").linkbutton({"disabled": true});
  517. $('#dlgFinalRoll form').form('submit',{
  518. url: "/scanning/scanpool/${jobId}/"+reworkOrderNo+"/createReworkFinalRollNew",
  519. onSubmit: function(){
  520. return $(this).form('validate');
  521. },
  522. success: function(result){
  523. $("#doFinalRoll").linkbutton({"disabled": false});
  524. console.log(result);
  525. try{
  526. var result = JSON.parse(result);
  527. if (result.errorMsg){
  528. if(result.falseFlag==1){
  529. $.messager.confirm('Confirm','The roll qty is '+result.nowQty+',are you sure to create the new roll?',function(r) {
  530. if (r){
  531. doFinalRollOKReal();
  532. }else {
  533. }
  534. });
  535. }else {
  536. $.messager.alert('Error',result.errorMsg, 'error');
  537. }
  538. } else {
  539. $('#snSpan').html('<b>'+$("#nextSerialNo").val()+'</b>');
  540. $.ajaxSettings.async = false;
  541. if($("#nextSerialNo").val()!=''&&$("#nextSerialNo").val()!=null){
  542. $.post("/scanning/scanpool/${jobId}/scanfirstRSn", {firstSn: $("#nextSerialNo").val()}, function(result){
  543. try{
  544. if (result.errorMsg){
  545. $.messager.alert('Error',result.errorMsg, 'error');
  546. } else {
  547. $('#nextSerialNo').textbox('setValue',"");
  548. }
  549. }catch(e){
  550. }
  551. })
  552. }
  553. $.ajaxSettings.async = true;
  554. $('#dlgFinalRoll').dialog('close'); // close the dialog
  555. $('#roll_dg').datagrid('reload');
  556. $('#sn_dg').datagrid('reload');
  557. if (result.finalRoll){
  558. $("#ifmforprint").attr('src', "/print/newlabel/" + result.finalRoll.finalRollNo + "/0/");
  559. }
  560. }
  561. }catch(e){
  562. $.messager.alert('Error','序列号重复!', 'error');
  563. }
  564. }
  565. });
  566. }
  567. function doFinalRollOKReal(){
  568. $("#doFinalRoll").linkbutton({"disabled": true});
  569. $('#dlgFinalRoll form').form('submit',{
  570. url: "/scanning/scanpool/${jobId}/"+reworkOrderNo+"/createReworkFinalRoll",
  571. onSubmit: function(){
  572. return $(this).form('validate');
  573. },
  574. success: function(result){
  575. $("#doFinalRoll").linkbutton({"disabled": false});
  576. console.log(result);
  577. try{
  578. var result = JSON.parse(result);
  579. if (result.errorMsg){
  580. $.messager.alert('Error',result.errorMsg, 'error');
  581. } else {
  582. $('#snSpan').html('<b>'+$("#nextSerialNo").val()+'</b>');
  583. $.ajaxSettings.async = false;
  584. if($("#nextSerialNo").val()!=''&&$("#nextSerialNo").val()!=null){
  585. $.post("/scanning/scanpool/${jobId}/scanfirstRSn", {firstSn: $("#nextSerialNo").val()}, function(result){
  586. try{
  587. if (result.errorMsg){
  588. $.messager.alert('Error',result.errorMsg, 'error');
  589. } else {
  590. $('#nextSerialNo').textbox('setValue',"");
  591. }
  592. }catch(e){
  593. }
  594. })
  595. }
  596. $.ajaxSettings.async = true;
  597. $('#dlgFinalRoll').dialog('close'); // close the dialog
  598. $('#roll_dg').datagrid('reload');
  599. $('#sn_dg').datagrid('reload');
  600. if (result.finalRoll){
  601. $("#ifmforprint").attr('src', "/print/newlabel/" + result.finalRoll.finalRollNo + "/0/");
  602. }
  603. }
  604. }catch(e){
  605. $.messager.alert('Error','序列号重复!', 'error');
  606. }
  607. }
  608. });
  609. }
  610. //清空扫描池
  611. function clearPool(){
  612. $.messager.confirm('Confirm','Are you sure to clear current scanning list?',function(r){
  613. if (r){
  614. $.post('/scanning/scanpool/${jobId}/clear',{},function(result){
  615. if (result.success){
  616. $('#roll_dg').datagrid('reload');
  617. $('#sn_dg').datagrid('reload');
  618. $.messager.alert('Success','清空成功', 'info');
  619. } else {
  620. $.messager.alert('Error',result.errorMsg, 'error');
  621. }
  622. },'json');
  623. }
  624. });
  625. }
  626. //批量不良录入
  627. function doBadRange(){
  628. $("#doOK").linkbutton({"disabled": false});
  629. showDialog("Batch defective serial number", 2, "/rework/badRange");
  630. }
  631. var doUrl;
  632. function showDialog(title, serialNum, postUrl){
  633. show2ndBox(serialNum > 1);
  634. $('#dlg').dialog('open').dialog('center').dialog('setTitle',title);
  635. $('#dlg form').form('clear');
  636. doUrl = "/scanning/${jobId}"+postUrl;
  637. }
  638. function show2ndBox(b){
  639. showEl("#dlg #serial_input_1st", true);
  640. showEl("#dlg #serial_input_2nd", true);
  641. showEl("#dlg #serial_input_2nd", b);
  642. $('#dlg #endSerialNo').textbox({disabled:!b});
  643. }
  644. function doOK(){
  645. var badFirstSN = $("#badFirstSN").val();
  646. var badEndSN = $("#badEndSN").val();
  647. console.log(badFirstSN);
  648. console.log(badEndSN);
  649. $("#doOK").linkbutton({"disabled": true});
  650. $.post(doUrl, {reworkOrderNo: reworkOrderNo,firstSerialNo:badFirstSN,endSerialNo:badEndSN}, function(result){
  651. // refreshRollInfo(slittingRollNo);
  652. console.log(result);
  653. $("#doOK").linkbutton({"disabled": false});
  654. if (result.success){
  655. $("#dgBadSnDtls").datagrid("reload");
  656. $('#sn_dg').datagrid('reload');
  657. $('#dlg form').form('clear');
  658. $('#dlg').dialog('close')
  659. }else{
  660. $.messager.alert('Error',result.errorMsg, 'error');
  661. $('#dlg').dialog('close'); // close the dialog
  662. }
  663. });
  664. }
  665. </script>
  666. </#if>
  667. </@master.layout>