|
|
<#import "../master.ftl" as master><@master.layout><style> #fm label { width: 150px; }</style>
<div class="page-header"> <h3>Query SO</h3></div>
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;" data-options="pagination: true, showFooter: true, singleSelect:true, fitColumns:true , onSelect:onTableRowSelect, onLoadSuccess:onTableRowSelect, url:'/prepress/all',method:'get',pageSize:20,toolbar:'#tb'"> <thead> <tr> <th data-options="field:'orderNo',width:90,editor:'textbox'">Order No</th> <th data-options="field:'partNo',width:100,editor:'textbox'">Part No</th> <th data-options="field:'partDesc',width:200,editor:'textbox'">Part Description</th> <th data-options="field:'apn',width:80">APN</th> <th data-options="field:'customerPartNo',width:80">Customer Part No</th> <th data-options="field:'project',width:80">Project</th> <th data-options="field:'revNo',width:80">Rev No</th> <th data-options="field:'lotSize',width:90,editor:'textbox'">Lot Size</th> <th data-options="field:'inputLotSize',width:120,editor:'textbox'">Input Lot Size</th> <th data-options="field:'statement',width:110,editor:'textbox',formatter:getStatement">Close Status</th> <th data-options="field:'statementBy',width:80,editor:'textbox'">Close By</th> <th data-options="field:'statementDate',width:120,align:'left',formatter:formatDate">Close Date</th> <th data-options="field:'serialsDate',width:120,align:'left',formatter:formatDate">Serials Date</th> <th data-options="field:'needDate',width:150">Earliest Start Date</th> <th data-options="field:'noOfCross',width:60">No of Cross</th> <th data-options="field:'standardRollQty',width:40,editor:'textbox'">Std. Roll Qty</th> <th data-options="field:'createdBy',width:100,align:'left'">Created By</th> <th data-options="field:'createdDate',width:150,align:'center',formatter:formatDateTime">Created Date</th> <th data-options="field:'status',width:100,editor:'textbox'">Status</th> <!-- <th data-options="field:'serialsGenBy',width:150,align:'left',editor:'textbox'">Serials Generated By</th> <th data-options="field:'serialsGenDate',width:150,align:'center',editor:'textbox',formatter:formatDateTime">Serials Generated Date</th> --> <th data-options="field:'id', width:360,formatter:formatDownload">Actions</th> </tr> </thead></table>
<div id="tb" style="padding:10px 5px;display: none;"> <div> Order No: <input class="easyui-textbox" id="orderNo" style="width:110px"> Created Date: <input class="easyui-datebox" id="createdDateFrom" style="width:100px"> to: <input class="easyui-datebox" id="createdDateTo" style="width:100px"> 结单状态: <select id="statement" class="easyui-combobox" style="width:110px;" data-options="required:true"> <option value="">All</option> <option value="N">Open</option> <option value="Y">Closed</option> <option value="W">To be closed</option> </select> <a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a> <#if currentUser.isAdmin> <a href="javascript:void(0)" id="closedAllOrder" class="easyui-linkbutton" iconCls="icon-edit" onclick="closedAllOrder()">Batch close</a> </#if> <#if currentUser.isAdmin || currentUser.authorities?contains("closeorder")> <a href="javascript:void(0)" id="forceClosed" class="easyui-linkbutton" iconCls="icon-remove" onclick="forceClosed()">Force close</a> </#if> </div></div>
<div id="dlg" class="easyui-dialog" style="width:500px;display: none;" closed="true" buttons="#dlg-buttons"> <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px"> <div style="margin-bottom:10px"> <input name="orderNo" class="easyui-textbox" required="true" label="Order No:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input name="partNo" class="easyui-textbox" required="true" label="Part No:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input name="partDesc" class="easyui-textbox" required="true" data-options="onChange:onPartDescChange" label="Part Description:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input name="apn" class="easyui-textbox" required="true" label="APN:" style="width:100%"> </div>
<div style="margin-bottom:10px"> <input name="customerPartNo" class="easyui-textbox" required="true" label="Customer Part No:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input name="project" class="easyui-textbox" required="true" label="Project:" style="width:100%"> </div>
<div style="margin-bottom:10px"> <input name="revNo" id="revNo" class="easyui-textbox" required="true" label="Rev No:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input name="lotSize" class="easyui-numberbox" required="true" label="Lot Size:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input name="inputLotSize" class="easyui-numberbox" validtype="valueRange[1,1336335]" required="true" label="Input Lot Size:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input name="serialsDate" class="easyui-datebox" validtype="validDate" required="true" data-options="parser:myparser" label="Serials Date:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input name="needDate" class="easyui-datebox" validtype="validDate" required="true" label="Earliest Start Date:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input name="noOfCross" class="easyui-numberbox" required="true" label="No of Cross:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input name="standardRollQty" class="easyui-numberbox" required="true" label="Standard Roll Qty:" style="width:100%"> </div> </form></div><div id="dlg-buttons" style="display: none;"> <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveSoInfo()" style="width:90px">Save</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a></div>
<div id="dlgDtls" class="easyui-dialog" style="width:600px;display: none;" closed="true" data-options="modal:true" > <table id="dgDtls" class="easyui-datagrid" style="width:100%;height:300px;display: none;" data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:20"> <thead> <tr> <th data-options="field:'rollNo',width:100">Roll No</th> <th data-options="field:'createdBy',width:80">Created By</th> <th data-options="field:'createdDate',width:150,align:'center',formatter:formatDateTime">Created Time</th> <th data-options="field:'status',width:80">Status</th> <th data-options="field:'id', width:150,formatter:formatRollAction"></th> </tr> </thead> </table></div>
<script>
$(window).resize(function () { $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20}); });
$(function () { $(window).resize(); });
function onPartDescChange(n,o){ if ($("#revNo").textbox("getValue") == "") { var p = /Label,([0-9A-Za-z\-]+)-(\S{1})/.exec(n); if (p && p.length >= 3){ $("#revNo").textbox("setValue", p[2]); } } }
//获取结单状态 function getStatement(value, row){ if(value==""||value==null||value=="N"){ return "Open"; }else if(value=="Y"){ return "Closed"; }else if(value=="W"){ return "To be closed"; } }
$.extend($.fn.validatebox.defaults.rules, { notRequired: function(value){ return true; }, validDate: { validator: function(value){ var date = $.fn.datebox.defaults.parser(value); var s = $.fn.datebox.defaults.formatter(date); return s==value; }, message: 'Please enter a valid date.' }, valueRange: { validator: function(value,param){ return value >= param[0] && value <= param[1]; }, message: 'Field do not match.' } });
function myparser(s){ if(s) return new Date(s); }
function onTableRowSelect(index, row) { var noRowSelect = !!!row; var generated = row && row.serialsGenDate; $("#tbEdit").linkbutton({"disabled": noRowSelect || generated}); $("#tbRemove").linkbutton({"disabled": noRowSelect || generated}); $("#tbSnGen").linkbutton({"disabled": noRowSelect || generated}); $("#tbSnRemove").linkbutton({"disabled": noRowSelect || !generated}); }
$("#queryLink").click(function(){ var dg = $('#dg').datagrid({ queryParams: { orderNo: $("#orderNo").val(), createdDateFrom: $("#createdDateFrom").val(), createdDateTo: $("#createdDateTo").val(), statement: $("#statement").val() } }); });
function formatDownload(value,row){ if(row.serialsGenDate){ var a = "<a href='javascript:downloadTrace(\""+row.orderNo+"\")'>Trace</a> | "; a += "<a href='javascript:downloadSingleTrace(\""+row.orderNo+"\")'>Trace by Single Across</a> | "; a += "<a href='javascript:viewRolls(\""+row.orderNo+"\")'>Rolls</a>"; a += " | <a href='javascript:notScanTrace(\""+row.orderNo+"\")'>View To-be Scanned</a>"; if(row.statement=="Y"){ a += " | Closed"; }else{ a += " | <a onclick='closedRoll(\""+row.orderNo+ "\",\""+row.serialRowStart+"\",\""+row.serialRowEnd+"\",\""+row.rollNo+"\")'>Close</a>"; } return a; } return ""; }
//结单 function closedRoll(orderNo,serialRowStart,serialRowEnd,rollNo){ $.messager.confirm('Confirm','Close confirm ?',function(r){ if (r){ $.post('/scanning/closedSoInfo',{orderNo: orderNo,serialRowStart: serialRowStart,serialRowEnd: serialRowEnd,rollNo: rollNo},function(result){ console.log(result); if (result.success){ $('#dg').datagrid('reload'); } else { $.messager.alert('Error',result.errorMsg, 'error'); } },'json'); } }); }
function formatRollAction(value, row){ return "<a href='/qrcode/"+row.rollNo+"/' target='_blank'>2D Barcode</a>"; } function viewRolls(orderNo){ $('#dlgDtls').dialog('open').dialog('center').dialog('setTitle',orderNo+' SFG roll'); $("#dgDtls").datagrid({url: "/prepress/orderrolls/"+orderNo}); }
function downloadTrace(orderNo){ $.post("/prepress/downloadTrace", {orderNo: orderNo}, function(ret){ console.log(ret); if(ret.success){ window.location.href="/prepress/downloadFileZip/"+ret.fileName; }else{ $.messager.alert('Error',ret.errorMsg, 'error'); } }); }
//单排下载 function downloadSingleTrace(orderNo){ $.post("/prepress/downloadSingleTrace", {orderNo: orderNo}, function(ret){ console.log(ret); if(ret.success){ window.location.href="/prepress/downloadFileZip/"+ret.fileName; }else{ $.messager.alert('Error',ret.errorMsg, 'error'); } }); } //仅导出未扫描Trace function notScanTrace(orderNo){ $.post("/prepress/notScanTrace", {orderNo: orderNo}, function(ret){ console.log(ret); if(ret.success){ window.location.href="/prepress/downloadFileZip/"+ret.fileName; }else{ $.messager.alert('Error',ret.errorMsg, 'error'); } }); }
//强制结单 function forceClosed(){ var row = $('#dg').datagrid('getSelected'); if (row){ var orderNo = row.orderNo; console.log(orderNo); $.messager.confirm('Confirm','Are you sure to force close the roll?',function(r){ if (r){ $.post('/scanning/forceClosedOrder/',{orderNo: orderNo},function(result){ if (result.success){ $('#dg').datagrid('reload'); } else { $.messager.alert('Error',result.errorMsg, 'error'); } },'json'); } }); }else{ $.messager.alert('Warning','Please select a row.', 'warning'); } }
//批量结单 function closedAllOrder(){ $.messager.confirm('Confirm','Are you sure to close the SO existing empty roll ?',function(r){ if (r){ $.messager.progress({ title: 'Point', msg: 'Please Wait……', text: '', interval: 300 }); $.post('/scanning/closedAllOrder',{},function(result){ console.log(result); $.messager.progress('close');//进度条关闭 if (result.success){ $('#dg').datagrid('reload'); } else { $.messager.alert('Error',result.errorMsg, 'error'); } },'json'); } }); }
</script>
</@master.layout>
|