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.

222 lines
7.4 KiB

3 days ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <div class="page-header">
  4. <h3>倒卷</h3>
  5. </div>
  6. <div class="row" id="app">
  7. <div class="col-md-4">
  8. <p><input id="fSerialNo" name="rollNo" type="text" class="form-control" placeholder="First SN" /></p>
  9. <p><input id="eSerialNo" name="serialNo" type="text" class="form-control" placeholder="Last SN" /></p>
  10. <p><td>Current rewind:</td></p>
  11. <table id="tblInfo" class="table">
  12. </table>
  13. <p><td>The order has created roll:</td></p>
  14. <table id="tbInfo" class="table">
  15. </table>
  16. </div>
  17. <div class="col-md-1" id="actions" style="">
  18. <#-- <p><button id="btnConfirm" onclick="rewind()" class="btn btn-default">倒卷</button></p>-->
  19. <p><button id="btnConfirm" onclick="combineRolls()" class="btn btn-default">Create roll</button></p>
  20. </div>
  21. <!-- 卷分切-->
  22. <div id="dlgSlittingRolls" class="easyui-dialog" style="width:500px;display: none;"
  23. closed="true" data-options="modal:true" >
  24. <table id="dgSlittingRolls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
  25. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:20">
  26. <thead>
  27. <tr>
  28. <th data-options="field:'slittingNo',width:60">Slitting Roll No</th>
  29. <th data-options="field:'col',width:20">No. of Cross</th>
  30. </tr>
  31. </thead>
  32. </table>
  33. </div>
  34. </div>
  35. <style>
  36. table.roll-op-serials {
  37. border: 1px solid gray;
  38. }
  39. table.roll-op-serials td{
  40. border: 1px dotted gray;
  41. padding: 3px;
  42. text-align: center;
  43. text-align: center;
  44. font-family: Arial,monospace;
  45. font-size: 11px;
  46. background-color: aliceblue;
  47. }
  48. table.roll-op-serials td .serial-no{
  49. font-size: 11px;
  50. }
  51. </style>
  52. <script src="/laydate/laydate.js"></script>
  53. <script type="text/javascript" src="/js/layer/layer.js"></script>
  54. <script>
  55. $(function () {
  56. $.ajax({
  57. url: "/rewind/getRewindLogForTypeOne",
  58. type:"POST",
  59. data:{
  60. },// 你的formid
  61. dataType:"JSON",
  62. success: function (data) {
  63. if(data.code=="200"){
  64. var $tblInfo = $("#tblInfo");
  65. for (let i = 0; i <data.obj.length ; i++) {
  66. $tblInfo.append("<tr><td>"+data.obj[i].slittingNo+" "+data.obj[i].scanSerialNo+"</td></tr>");
  67. }
  68. }else{
  69. layer.msg(data.msg);
  70. }
  71. $("#fSerialNo").focus();
  72. }
  73. })
  74. refreshTbInfo();
  75. $("#fSerialNo").focus();
  76. })
  77. function rewind(){
  78. let fSerialNo=$("#fSerialNo").val();
  79. let eSerialNo=$("#eSerialNo").val();
  80. if("" == fSerialNo||null==fSerialNo){
  81. layer.msg("Please scan one of the top 10 serial number!");
  82. return false;
  83. }
  84. if("" == eSerialNo||null==eSerialNo){
  85. layer.msg("Please scan one of the last 10 serial number!");
  86. return false;
  87. }
  88. $.ajax({
  89. url: "/rewind/scanSlittingNoForRewindOneToCombine",
  90. type:"POST",
  91. data:{
  92. "fSerialNo": fSerialNo,
  93. "eSerialNo": eSerialNo,
  94. },// 你的formid
  95. dataType:"JSON",
  96. success: function (data) {
  97. $("#fSerialNo").val("")
  98. $("#eSerialNo").val("")
  99. if(data.code=="200"){
  100. var $tblInfo = $("#tblInfo");
  101. $tblInfo.append("<tr><td>"+data.obj+" "+fSerialNo+"</td></tr>");
  102. layer.msg("Saved!");
  103. $("#fSerialNo").focus();
  104. }else{
  105. $.messager.alert("Error", data.msg, "error");
  106. }
  107. $("#fSerialNo").focus();
  108. }
  109. })
  110. }
  111. //测试用
  112. function rewindTest() {
  113. $("#ifmforprint").attr('src', "/print/combineSlittingNo/1940937-99L01/");
  114. }
  115. function combineRolls() {
  116. var tableData = [];
  117. $('#tblInfo tbody tr').each(function(row, tr){
  118. tableData[row] = {
  119. "slittingNo": $(tr).find('td:eq(0)').text(),
  120. // 根据表格实际列数添加其他属性
  121. }
  122. });
  123. if(tableData.length==0){
  124. layer.msg("No data, please rewind first");
  125. return false;
  126. }
  127. $.messager.confirm("Confirm","Confirm complete below rewind?", function(cr){
  128. if (cr){
  129. $.ajax({
  130. url: "/rewind/combineRolls",
  131. type: "POST",
  132. data: {},
  133. dataType: "JSON",
  134. success: function (data) {
  135. if (data.success) {
  136. $("#tblInfo").empty();
  137. $("#ifmforprint").attr('src', "/print/combineSlittingNo/"+data.obj+"/");
  138. refreshTbInfo();
  139. layer.msg("Sucessful!new roll no is:"+data.obj);
  140. } else {
  141. layer.msg(data.msg);
  142. }
  143. }
  144. })
  145. }
  146. });
  147. }
  148. $("#fSerialNo").on("keydown", function(event){
  149. if(event.keyCode==13) {
  150. $.ajax({
  151. url: "/rewind/checkFSerialNo",
  152. type:"POST",
  153. data:{
  154. "fSerialNo": $("#fSerialNo").val(),
  155. },// 你的formid
  156. dataType:"JSON",
  157. success: function (data) {
  158. if(data.code=="200"){
  159. $("#eSerialNo").focus();
  160. }else{
  161. $("#fSerialNo").val("")
  162. $.messager.alert("Error", data.msg, "error");
  163. }
  164. }
  165. })
  166. }
  167. });
  168. $("#eSerialNo").on("keydown", function(event){
  169. if(event.keyCode==13) {
  170. rewind();
  171. }
  172. });
  173. function refreshTbInfo() {
  174. $.ajax({
  175. url: "/rewind/refreshTbInfo",
  176. type: "POST",
  177. data: {},
  178. dataType: "JSON",
  179. success: function (data) {
  180. if (data.success) {
  181. $("#tbInfo").empty();
  182. for (let i = 0; i < data.obj.length; i++) {
  183. // $("#tbInfo").append("<tr><td><a target='forprint' href='/print/combineSlittingNo/"+data.obj[i].slittingNo+"/'>"+data.obj[i].slittingNo+"</a></td> <td><button onclick=\"viewOldRolls(\""+data.obj[i].slittingNo+"\")\" class=\"easyui-linkbutton\">查看原卷</button></td></tr>");
  184. $("#tbInfo").append("<tr><td><a target='forprint' href='/print/combineSlittingNo/"+data.obj[i].slittingNo+"/'>"+data.obj[i].slittingNo+"</a></td> <td><a href='javascript:viewOldRolls(\""+data.obj[i].slittingNo+"\")'>查看原卷</a></td></tr>");
  185. }
  186. } else {
  187. layer.msg(data.msg);
  188. }
  189. }
  190. })
  191. }
  192. function viewOldRolls(slittingNo) {
  193. $('#dlgSlittingRolls').dialog('open').dialog('center').dialog('setTitle',"Old roll");
  194. $("#dgSlittingRolls").datagrid({url: "/rewind/oldRolls/"+slittingNo});
  195. }
  196. </script>
  197. </@master.layout>