|
|
<#import "../master.ftl" as master><@master.layout>
<style> #fm label { width: 150px; }</style>
<div class="page-header"> <h2>Master roll confirm</h2></div>
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;" data-options="pagination: true, showFooter: true, singleSelect:true, fitColumns:true , url:'/scanning/getRollCheckData',method:'get',pageSize:20,toolbar:'#tb'"> <thead> <tr> <th data-options="field:'orderNo',width:100">Order No</th> <th data-options="field:'rollNo',width:100">Roll No</th> <th data-options="field:'status',width:80,align:'left'">Status</th> <!-- <th data-options="field:'serialRowEnd',width:80,align:'left', formatter:getRollQty">单排卷标签数量</th> --> <th data-options="field:'statement',width:80,align:'left', formatter:getStatement">Close status</th> <!-- <th data-options="field:'noScanQty',width:50,align:'left'">Scanned Qty</th> <th data-options="field:'scanQty',width:80,align:'left'">未扫描数量</th> --> <th data-options="field:'statementBy',width:100">Close By</th> <th data-options="field:'statementDate',width:100,formatter:formatDateTime">Close Date</th> <th data-options="field:'id',width:100,editor:'textbox', formatter:formatAction">Actions</th> </tr> </thead></table>
<div id="tb" style="padding:10px 5px;display: none;"> <div> 订单号: <input class="easyui-textbox" id="orderNo" style="width:110px"> Roll No: <input class="easyui-textbox" id="rollNo" style="width:110px"> 卷状态: <select id="status" class="easyui-combobox" style="width:110px;" data-options="required:true"> <option value="">All</option> <option value="Created">Created</option> <option value="Printed">Printed</option> <option value="Diecuted">Diecuted</option> <option value="Inspected">Inspected</option> <option value="Scanned">Scanned</option> </select> 结单状态: <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="closedAllRoll" class="easyui-linkbutton" iconCls="icon-edit" onclick="closedAllRoll()">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="dlgDtls" class="easyui-dialog" style="width:300px;display: none;" closed="true"> <div novalidate style="margin:0;padding:20px 20px"> <div style="margin-bottom:10px"> <input id = "order_No" name="orderNo" class="easyui-textbox" label="订单号:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input id = "roll_No" name="rollNo" class="easyui-textbox" label="Roll No:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input id = "roll_Qty"name="rollQty" class="easyui-textbox" label="卷标签数量:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input id = "state_ment"name="statement" class="easyui-textbox" label="结单状态:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input id = "scan_Qty" name="scanQty" class="easyui-textbox" label="已扫描数量:" style="width:100%"> </div> <div style="margin-bottom:10px"> <input id = "noScan_Qty" name="noScanQty" class="easyui-textbox" label="未扫描数量:" style="width:100%"> </div> </div></div>
<script>
$(window).resize(function () { $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20}); });
$(function () { $(window).resize(); });
$("#queryLink").click(function(){ var dg = $('#dg').datagrid({ queryParams: { orderNo: $("#orderNo").val(), rollNo: $("#rollNo").val(), status: $("#status").val(), statement: $("#statement").val() } }); });
function formatAction(value, row){ var action = "<a href='javascript:viewSerials(\""+row.orderNo+ "\",\""+row.serialRowStart+"\",\""+row.serialRowEnd+"\",\""+row.rollNo+"\",\""+row.statement+"\")'>Query</a>"; action += " | <a onclick='downRollSerial(\""+row.rollNo+ "\")'>Trace</a>"; //action += " | <a onclick='unscannedReport(\""+row.rollNo+ "\")'>未扫描报告</a>"; if(row.statement=="Y"){ action += " | Closed"; }else{ action += " | <a onclick='closedRoll(\""+row.orderNo+ "\",\""+row.serialRowStart+"\",\""+row.serialRowEnd+"\",\""+row.rollNo+"\")'>Close</a>"; } return action; } //获取卷标签数量 function getRollQty(value, row){ if(row.serialRowEnd==null||row.serialRowEnd=="" ||row.serialRowStart==null||row.serialRowStart==""){ return 0; } var qty = row.serialRowEnd-row.serialRowStart+1; return qty; } //获取结单状态 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"; } } /* function formatLodopPrint(value, row){ var action = "<a target='forprint' href='/print/finalrollScan/"+row.finalRollNo+"/'>"+value+"</a>"; return action; } */ function lodopPrint(rollNo){ var url = "/print/finalrollScan/"+rollNo+"/"; //设置href $("#lodopPrint"+rollNo).attr("href", url); }
function formatDtlAction(value, row){ return "<a href='/shipment/boxes/scan/" + value + "'>Scan and delivery</a>"; }
function viewSerials(orderNo,serialRowStart,serialRowEnd,rollNo,statement){ if(serialRowEnd == null || serialRowEnd == "" || serialRowEnd == 'null' ||serialRowStart == null || serialRowStart == "" || serialRowStart == 'null'){ $.messager.alert('Error', '当前卷未开工!', 'error'); return 0; } var qty = serialRowEnd-serialRowStart+1; console.log(qty); var state; if(statement=="Y"){ state = "Closed"; }else { state = "Open"; } $("#order_No").textbox('setValue',orderNo); $('#order_No').textbox('textbox').attr('readonly',true); $("#roll_No").textbox('setValue',rollNo); $('#roll_No').textbox('textbox').attr('readonly',true); $("#state_ment").textbox('setValue',state); $('#state_ment').textbox('textbox').attr('readonly',true); $.post("/scanning/getRollSerial", {orderNo: orderNo,serialRowStart: serialRowStart,serialRowEnd: serialRowEnd}, function(ret){ console.log(ret); if(ret.success){ console.log(qty); qty = qty * ret.ret.noOfCross; console.log(qty); $("#roll_Qty").textbox('setValue',qty); $('#roll_Qty').textbox('textbox').attr('readonly',true); $("#scan_Qty").textbox('setValue',ret.ret.scanQty); $('#scan_Qty').textbox('textbox').attr('readonly',true); $("#noScan_Qty").textbox('setValue',ret.ret.noScanQty); $('#noScan_Qty').textbox('textbox').attr('readonly',true); $('#dlgDtls').dialog('open').dialog('center').dialog('setTitle',orderNo+':Detail'); }else{ $.messager.alert('Error',ret.errorMsg, 'error'); } }); }
function deleteBadRoll(finalRollNo){ $.messager.confirm('Confirm','Do you want to delete the defective roll <b>'+finalRollNo+'</b> ?',function(r){ if (r){ $.post('/scanning/deleteQcRoll/do',{finalRollNo: finalRollNo},function(result){ if (result.success){ $('#dg').datagrid('reload'); // reload the user data } else { $.messager.alert('error',result.errorMsg, 'error'); } },'json'); } }); }
function downExcel() { //拼接url $("#query_rollNo").val($("#finalRollNo").val()); $("#query_jobId").val($("#jobId").val()); $("#query_dateFrom").val($("#createdDateFrom").val()); $("#query_dateTo").val($("#createdDateTo").val()); var url = "/scanning/down/currentRollList?query_rollNo="+$("#query_rollNo").val()+"&query_jobId="+$("#query_jobId").val()+ "&query_dateFrom="+$("#query_dateFrom").val()+"&query_dateTo="+$("#query_dateTo").val()+"&query_openNo=40"; //设置href $("#downExcel").attr("href", url); } //trace function downRollSerial(rollNo){ $.post("/scanning/downRollSerial", {rollNo: rollNo}, function(ret){ console.log(ret); if(ret.success){ window.location.href="/prepress/downloadFileZip/"+ret.fileName; }else{ $.messager.alert('Error',ret.errorMsg, 'error'); } }); } //未扫描报告 function unscannedReport(rollNo){ $.post("/scanning/unscannedReport", {rollNo: rollNo}, function(ret){ console.log(ret); if(ret.success){ window.location.href="/prepress/downloadFileZip/"+ret.fileName; }else{ $.messager.alert('Error',ret.errorMsg, 'error'); } }); } //结单 function closedRoll(orderNo,serialRowStart,serialRowEnd,rollNo){ $.messager.confirm('Confirm','Close confirm ?',function(r){ if (r){ $.post('/scanning/closedRoll',{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 closedAllRoll(){ $.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/closedAllRoll',{},function(result){ console.log(result); $.messager.progress('close');//进度条关闭 if (result.success){ $('#dg').datagrid('reload'); } else { $.messager.alert('Error',result.errorMsg, 'error'); } },'json'); } }); } //强制结单 function forceClosed(){ var row = $('#dg').datagrid('getSelected'); if (row){ var rollNo = row.rollNo; console.log(rollNo); $.messager.confirm('Confirm','Force Close?',function(r){ if (r){ $.post('/scanning/forceClosed/',{rollNo: rollNo},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'); } }
</script>
</@master.layout>
|