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.

148 lines
5.3 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. <div class="page-header">
  9. <h3>Scrap defective/QC</h3>
  10. </div>
  11. <table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
  12. data-options="pagination: true, showFooter: true, singleSelect:true, fitColumns:true , url:'/discard/all',method:'get',pageSize:20,toolbar:'#tb'">
  13. <thead>
  14. <tr>
  15. <#--<th data-options="field:'orderNo',width:100,editor:'textbox'">SO No</th>-->
  16. <th data-options="field:'discardNo',width:100,editor:'textbox'">Scrap No</th>
  17. <th data-options="field:'discardedBy',width:80,align:'left'">Created By</th>
  18. <th data-options="field:'discardedDate',width:150,align:'center',formatter:formatDateTime">Create Date</th>
  19. <th data-options="field:'id',width:150,align:'center',formatter:formatAction">Actions</th>
  20. </tr>
  21. </thead>
  22. </table>
  23. <div id="tb" style="padding:10px 5px;display: none;">
  24. <div>
  25. <#--生产订单单号: <input class="easyui-textbox" id="orderNo" style="width:110px">-->
  26. Create Date: <input class="easyui-datebox" id="discardedDateFrom" style="width:100px">
  27. 到: <input class="easyui-datebox" id="discardedDateTo" style="width:100px">
  28. <a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a>
  29. &nbsp;&nbsp;&nbsp;
  30. <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newdiscard()">Create Scrap Form</a>
  31. </div>
  32. </div>
  33. <div id="dlg" class="easyui-dialog" style="width:500px;display: none;"
  34. closed="true" buttons="#dlg-buttons">
  35. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  36. <div style="margin-bottom:10px">
  37. <input name="orderNo" class="easyui-textbox" required="true" label="SO No:" style="width:100%">
  38. </div>
  39. </form>
  40. </div>
  41. <div id="dlg-buttons" style="display: none;">
  42. <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="savediscard()" style="width:90px">Save</a>
  43. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
  44. </div>
  45. <div id="dlgDtls" class="easyui-dialog" style="width:600px;display: none;"
  46. closed="true" data-options="modal:true" >
  47. <table id="dgDtls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
  48. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:50">
  49. <thead>
  50. <tr>
  51. <th data-options="field:'finalRollNo',width:100">FG roll number</th>
  52. </tr>
  53. </thead>
  54. </table>
  55. </div>
  56. <script>
  57. $(window).resize(function () {
  58. $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
  59. });
  60. $(function () {
  61. $(window).resize();
  62. });
  63. $.extend($.fn.validatebox.defaults.rules, {
  64. validDate: {
  65. validator: function(value){
  66. var date = $.fn.datebox.defaults.parser(value);
  67. var s = $.fn.datebox.defaults.formatter(date);
  68. return s==value;
  69. },
  70. message: 'Please enter a valid date.'
  71. },
  72. valueRange: {
  73. validator: function(value,param){
  74. return value >= param[0] && value <= param[1];
  75. },
  76. message: 'Field do not match.'
  77. }
  78. });
  79. $("#queryLink").click(function(){
  80. var dg = $('#dg').datagrid({
  81. queryParams: {
  82. orderNo: $("#orderNo").val(),
  83. discardedDateFrom: $("#discardedDateFrom").val(),
  84. discardedDateTo: $("#discardedDateTo").val()
  85. }
  86. });
  87. });
  88. function formatAction(value, row){
  89. return "<a href='/discard/scan/" + value + "'>Scan</a>" + "&nbsp;|&nbsp;<a href='javascript:viewRolls(\"" + row.discardNo + "\")'>Scrapped Rolls</a>";
  90. }
  91. function viewRolls(discardNo){
  92. $('#dlgDtls').dialog('open').dialog('center').dialog('setTitle',discardNo+'中已报废的卷');
  93. $("#dgDtls").datagrid({url: "/discard/finalrolls/"+discardNo});
  94. }
  95. function newdiscard(){
  96. // $('#dlg').dialog('open').dialog('center').dialog('setTitle','Create Scrap Form');
  97. // $('#fm').form('clear');
  98. $.post("/discard/add", {orderNo: "-"}, function(result){
  99. if (result.errorMsg){
  100. $.messager.alert('error',result.errorMsg, 'error');
  101. } else {
  102. $('#dlg').dialog('close'); // close the dialog
  103. $('#dg').datagrid('reload'); // reload the user data
  104. }
  105. });
  106. }
  107. function savediscard(){
  108. $('#fm').form('submit',{
  109. url: "/discard/add",
  110. onSubmit: function(){
  111. return $(this).form('validate');
  112. },
  113. success: function(result){
  114. var result = eval("("+result+")");
  115. if (result.errorMsg){
  116. $.messager.alert('error',result.errorMsg, 'error');
  117. } else {
  118. $('#dlg').dialog('close'); // close the dialog
  119. $('#dg').datagrid('reload'); // reload the user data
  120. }
  121. }
  122. });
  123. }
  124. </script>
  125. </@master.layout>