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.

335 lines
14 KiB

3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
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>Query SO</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 , onSelect:onTableRowSelect, onLoadSuccess:onTableRowSelect, url:'/prepress/all',method:'get',pageSize:20,toolbar:'#tb'">
  13. <thead>
  14. <tr>
  15. <th data-options="field:'orderNo',width:90,editor:'textbox'">Order No</th>
  16. <th data-options="field:'partNo',width:100,editor:'textbox'">Part No</th>
  17. <th data-options="field:'partDesc',width:200,editor:'textbox'">Part Description</th>
  18. <th data-options="field:'apn',width:80">APN</th>
  19. <th data-options="field:'customerPartNo',width:80">Customer Part No</th>
  20. <th data-options="field:'project',width:80">Project</th>
  21. <th data-options="field:'revNo',width:80">Rev No</th>
  22. <th data-options="field:'lotSize',width:90,editor:'textbox'">Lot Size</th>
  23. <th data-options="field:'inputLotSize',width:120,editor:'textbox'">Input Lot Size</th>
  24. <th data-options="field:'statement',width:110,editor:'textbox',formatter:getStatement">Close Status</th>
  25. <th data-options="field:'statementBy',width:80,editor:'textbox'">Close By</th>
  26. <th data-options="field:'statementDate',width:120,align:'left',formatter:formatDate">Close Date</th>
  27. <th data-options="field:'serialsDate',width:120,align:'left',formatter:formatDate">Serials Date</th>
  28. <th data-options="field:'needDate',width:150">Earliest Start Date</th>
  29. <th data-options="field:'noOfCross',width:60">No of Cross</th>
  30. <th data-options="field:'standardRollQty',width:40,editor:'textbox'">Std. Roll Qty</th>
  31. <th data-options="field:'createdBy',width:100,align:'left'">Created By</th>
  32. <th data-options="field:'createdDate',width:150,align:'center',formatter:formatDateTime">Created Date</th>
  33. <th data-options="field:'status',width:100,editor:'textbox'">Status</th>
  34. <!-- <th data-options="field:'serialsGenBy',width:150,align:'left',editor:'textbox'">Serials Generated By</th>
  35. <th data-options="field:'serialsGenDate',width:150,align:'center',editor:'textbox',formatter:formatDateTime">Serials Generated Date</th> -->
  36. <th data-options="field:'id', width:360,formatter:formatDownload">Actions</th>
  37. </tr>
  38. </thead>
  39. </table>
  40. <div id="tb" style="padding:10px 5px;display: none;">
  41. <div>
  42. Order No: <input class="easyui-textbox" id="orderNo" style="width:110px">
  43. Created Date: <input class="easyui-datebox" id="createdDateFrom" style="width:100px">
  44. to: <input class="easyui-datebox" id="createdDateTo" style="width:100px">
  45. 结单状态: <select id="statement" class="easyui-combobox" style="width:110px;" data-options="required:true">
  46. <option value="">All</option>
  47. <option value="N">Open</option>
  48. <option value="Y">Closed</option>
  49. <option value="W">To be closed</option>
  50. </select>
  51. <a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a>
  52. <#if currentUser.isAdmin>
  53. <a href="javascript:void(0)" id="closedAllOrder" class="easyui-linkbutton" iconCls="icon-edit" onclick="closedAllOrder()">Batch close</a>
  54. </#if>
  55. <#if currentUser.isAdmin || currentUser.authorities?contains("closeorder")>
  56. <a href="javascript:void(0)" id="forceClosed" class="easyui-linkbutton" iconCls="icon-remove" onclick="forceClosed()">Force close</a>
  57. </#if>
  58. </div>
  59. </div>
  60. <div id="dlg" class="easyui-dialog" style="width:500px;display: none;"
  61. closed="true" buttons="#dlg-buttons">
  62. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
  63. <div style="margin-bottom:10px">
  64. <input name="orderNo" class="easyui-textbox" required="true" label="Order No:" style="width:100%">
  65. </div>
  66. <div style="margin-bottom:10px">
  67. <input name="partNo" class="easyui-textbox" required="true" label="Part No:" style="width:100%">
  68. </div>
  69. <div style="margin-bottom:10px">
  70. <input name="partDesc" class="easyui-textbox" required="true" data-options="onChange:onPartDescChange" label="Part Description:" style="width:100%">
  71. </div>
  72. <div style="margin-bottom:10px">
  73. <input name="apn" class="easyui-textbox" required="true" label="APN:" style="width:100%">
  74. </div>
  75. <div style="margin-bottom:10px">
  76. <input name="customerPartNo" class="easyui-textbox" required="true" label="Customer Part No:" style="width:100%">
  77. </div>
  78. <div style="margin-bottom:10px">
  79. <input name="project" class="easyui-textbox" required="true" label="Project:" style="width:100%">
  80. </div>
  81. <div style="margin-bottom:10px">
  82. <input name="revNo" id="revNo" class="easyui-textbox" required="true" label="Rev No:" style="width:100%">
  83. </div>
  84. <div style="margin-bottom:10px">
  85. <input name="lotSize" class="easyui-numberbox" required="true" label="Lot Size:" style="width:100%">
  86. </div>
  87. <div style="margin-bottom:10px">
  88. <input name="inputLotSize" class="easyui-numberbox" validtype="valueRange[1,1336335]" required="true" label="Input Lot Size:" style="width:100%">
  89. </div>
  90. <div style="margin-bottom:10px">
  91. <input name="serialsDate" class="easyui-datebox" validtype="validDate" required="true" data-options="parser:myparser" label="Serials Date:" style="width:100%">
  92. </div>
  93. <div style="margin-bottom:10px">
  94. <input name="needDate" class="easyui-datebox" validtype="validDate" required="true" label="Earliest Start Date:" style="width:100%">
  95. </div>
  96. <div style="margin-bottom:10px">
  97. <input name="noOfCross" class="easyui-numberbox" required="true" label="No of Cross:" style="width:100%">
  98. </div>
  99. <div style="margin-bottom:10px">
  100. <input name="standardRollQty" class="easyui-numberbox" required="true" label="Standard Roll Qty:" style="width:100%">
  101. </div>
  102. </form>
  103. </div>
  104. <div id="dlg-buttons" style="display: none;">
  105. <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveSoInfo()" style="width:90px">Save</a>
  106. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
  107. </div>
  108. <div id="dlgDtls" class="easyui-dialog" style="width:600px;display: none;"
  109. closed="true" data-options="modal:true" >
  110. <table id="dgDtls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
  111. data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:20">
  112. <thead>
  113. <tr>
  114. <th data-options="field:'rollNo',width:100">Roll No</th>
  115. <th data-options="field:'createdBy',width:80">Created By</th>
  116. <th data-options="field:'createdDate',width:150,align:'center',formatter:formatDateTime">Created Time</th>
  117. <th data-options="field:'status',width:80">Status</th>
  118. <th data-options="field:'id', width:150,formatter:formatRollAction"></th>
  119. </tr>
  120. </thead>
  121. </table>
  122. </div>
  123. <script>
  124. $(window).resize(function () {
  125. $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
  126. });
  127. $(function () {
  128. $(window).resize();
  129. });
  130. function onPartDescChange(n,o){
  131. if ($("#revNo").textbox("getValue") == "") {
  132. var p = /Label,([0-9A-Za-z\-]+)-(\S{1})/.exec(n);
  133. if (p && p.length >= 3){
  134. $("#revNo").textbox("setValue", p[2]);
  135. }
  136. }
  137. }
  138. //获取结单状态
  139. function getStatement(value, row){
  140. if(value==""||value==null||value=="N"){
  141. return "Open";
  142. }else if(value=="Y"){
  143. return "Closed";
  144. }else if(value=="W"){
  145. return "To be closed";
  146. }
  147. }
  148. $.extend($.fn.validatebox.defaults.rules, {
  149. notRequired: function(value){
  150. return true;
  151. },
  152. validDate: {
  153. validator: function(value){
  154. var date = $.fn.datebox.defaults.parser(value);
  155. var s = $.fn.datebox.defaults.formatter(date);
  156. return s==value;
  157. },
  158. message: 'Please enter a valid date.'
  159. },
  160. valueRange: {
  161. validator: function(value,param){
  162. return value >= param[0] && value <= param[1];
  163. },
  164. message: 'Field do not match.'
  165. }
  166. });
  167. function myparser(s){
  168. if(s) return new Date(s);
  169. }
  170. function onTableRowSelect(index, row) {
  171. var noRowSelect = !!!row;
  172. var generated = row && row.serialsGenDate;
  173. $("#tbEdit").linkbutton({"disabled": noRowSelect || generated});
  174. $("#tbRemove").linkbutton({"disabled": noRowSelect || generated});
  175. $("#tbSnGen").linkbutton({"disabled": noRowSelect || generated});
  176. $("#tbSnRemove").linkbutton({"disabled": noRowSelect || !generated});
  177. }
  178. $("#queryLink").click(function(){
  179. var dg = $('#dg').datagrid({
  180. queryParams: {
  181. orderNo: $("#orderNo").val(),
  182. createdDateFrom: $("#createdDateFrom").val(),
  183. createdDateTo: $("#createdDateTo").val(),
  184. statement: $("#statement").val()
  185. }
  186. });
  187. });
  188. function formatDownload(value,row){
  189. if(row.serialsGenDate){
  190. var a = "<a href='javascript:downloadTrace(\""+row.orderNo+"\")'>Trace</a>&nbsp;|&nbsp;";
  191. a += "<a href='javascript:downloadSingleTrace(\""+row.orderNo+"\")'>Trace by Single Across</a>&nbsp;|&nbsp;";
  192. a += "<a href='javascript:viewRolls(\""+row.orderNo+"\")'>Rolls</a>";
  193. a += " | <a href='javascript:notScanTrace(\""+row.orderNo+"\")'>View To-be Scanned</a>";
  194. if(row.statement=="Y"){
  195. a += " | Closed";
  196. }else{
  197. a += " | <a onclick='closedRoll(\""+row.orderNo+ "\",\""+row.serialRowStart+"\",\""+row.serialRowEnd+"\",\""+row.rollNo+"\")'>Close</a>";
  198. }
  199. return a;
  200. }
  201. return "";
  202. }
  203. //结单
  204. function closedRoll(orderNo,serialRowStart,serialRowEnd,rollNo){
  205. $.messager.confirm('Confirm','Close confirm ?',function(r){
  206. if (r){
  207. $.post('/scanning/closedSoInfo',{orderNo: orderNo,serialRowStart: serialRowStart,serialRowEnd: serialRowEnd,rollNo: rollNo},function(result){
  208. console.log(result);
  209. if (result.success){
  210. $('#dg').datagrid('reload');
  211. } else {
  212. $.messager.alert('Error',result.errorMsg, 'error');
  213. }
  214. },'json');
  215. }
  216. });
  217. }
  218. function formatRollAction(value, row){
  219. return "<a href='/qrcode/"+row.rollNo+"/' target='_blank'>2D Barcode</a>";
  220. }
  221. function viewRolls(orderNo){
  222. $('#dlgDtls').dialog('open').dialog('center').dialog('setTitle',orderNo+' SFG roll');
  223. $("#dgDtls").datagrid({url: "/prepress/orderrolls/"+orderNo});
  224. }
  225. function downloadTrace(orderNo){
  226. $.post("/prepress/downloadTrace", {orderNo: orderNo}, function(ret){
  227. console.log(ret);
  228. if(ret.success){
  229. window.location.href="/prepress/downloadFileZip/"+ret.fileName;
  230. }else{
  231. $.messager.alert('Error',ret.errorMsg, 'error');
  232. }
  233. });
  234. }
  235. //单排下载
  236. function downloadSingleTrace(orderNo){
  237. $.post("/prepress/downloadSingleTrace", {orderNo: orderNo}, function(ret){
  238. console.log(ret);
  239. if(ret.success){
  240. window.location.href="/prepress/downloadFileZip/"+ret.fileName;
  241. }else{
  242. $.messager.alert('Error',ret.errorMsg, 'error');
  243. }
  244. });
  245. }
  246. //仅导出未扫描Trace
  247. function notScanTrace(orderNo){
  248. $.post("/prepress/notScanTrace", {orderNo: orderNo}, function(ret){
  249. console.log(ret);
  250. if(ret.success){
  251. window.location.href="/prepress/downloadFileZip/"+ret.fileName;
  252. }else{
  253. $.messager.alert('Error',ret.errorMsg, 'error');
  254. }
  255. });
  256. }
  257. //强制结单
  258. function forceClosed(){
  259. var row = $('#dg').datagrid('getSelected');
  260. if (row){
  261. var orderNo = row.orderNo;
  262. console.log(orderNo);
  263. $.messager.confirm('Confirm','Are you sure to force close the roll?',function(r){
  264. if (r){
  265. $.post('/scanning/forceClosedOrder/',{orderNo: orderNo},function(result){
  266. if (result.success){
  267. $('#dg').datagrid('reload');
  268. } else {
  269. $.messager.alert('Error',result.errorMsg, 'error');
  270. }
  271. },'json');
  272. }
  273. });
  274. }else{
  275. $.messager.alert('Warning','Please select a row.', 'warning');
  276. }
  277. }
  278. //批量结单
  279. function closedAllOrder(){
  280. $.messager.confirm('Confirm','Are you sure to close the SO existing empty roll ?',function(r){
  281. if (r){
  282. $.messager.progress({
  283. title: 'Point',
  284. msg: 'Please Wait……',
  285. text: '',
  286. interval: 300
  287. });
  288. $.post('/scanning/closedAllOrder',{},function(result){
  289. console.log(result);
  290. $.messager.progress('close');//进度条关闭
  291. if (result.success){
  292. $('#dg').datagrid('reload');
  293. } else {
  294. $.messager.alert('Error',result.errorMsg, 'error');
  295. }
  296. },'json');
  297. }
  298. });
  299. }
  300. </script>
  301. </@master.layout>