|
|
<#import "../master.ftl" as master><@master.layout><style> #fm label { width: 150px; } #addFm label { width: 150px; } #importDlgFm label { width: 150px; }</style>
<div class="page-header"> <h2>Delivery</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:'/shipment/all',method:'get',pageSize:20,toolbar:'#tb'"> <thead> <tr> <th data-options="field:'shipNo',width:60">Delivery No</th> <th data-options="field:'shippedBy',width:60,align:'left'">Created By</th> <th data-options="field:'shippedDate',width:130,align:'center',formatter:formatDateTime">Create Date</th> <th data-options="field:'customerConfirmedFlag',width:120,align:'center',formatter:formatConfirmedFlag">Customer Confirm Status</th> <th data-options="field:'ftpPath',width:160,editor:'textbox'">FTP Path</th> <th data-options="field:'ifsDeliveryNoteNo',width:120,editor:'text'">IFS Delivery Note No</th> <th data-options="field:'remark',width:60,editor:'textbox'">Remark</th> <th data-options="field:'id',width:200, formatter:formatAction">Actions</th>
</tr> </thead></table>
<div id="tb" style="padding:10px 5px;display: none;"> <div> Create Date: <input class="easyui-datebox" id="shippedDateFrom" style="width:100px"> 到: <input class="easyui-datebox" id="shippedDateTo" style="width:100px"> 客户确认: <select class="easyui-combobox" panelHeight="auto" id="confirmedFlag" style="width:100px"> <option value="">All</option> <option value="0">To be Confirm</option> <option value="1">Confirmed</option> </select> <a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a> <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="addInfo()">New Shipment</a> <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" onclick="doUpdateConfirmedFlag()">CS confirm</a> </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="ifsDeliveryNoteNo" class="easyui-textbox" required="true" label="IFS Delivery Note No:" 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="saveShipInfo()" 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="addDlg" class="easyui-dialog" style="width:500px;display: none;" closed="true" buttons="#addDlg-buttons"> <form id="addFm" method="post" novalidate style="margin:0;padding:20px 20px"> <div style="margin-bottom:10px"> <input name="addIfsDeliveryNoteNo" id="addIfsDeliveryNoteNo" class="easyui-textbox" required="true" label="IFS Delivery Note No:" style="width:100%"> <br/><br> <input id="addRemark" class="easyui-textbox" label="Remark:" style="width:100%"> </div> </form> </div> <div id="addDlg-buttons" style="display: none;"> <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveShipment()" style="width:90px">Save</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#addDlg').dialog('close')" style="width:90px">Cancel</a> </div>
<div id="dlgPlan" class="easyui-dialog" style="width:500px;display: none;" closed="true" buttons="#plan-buttons"> <div style="margin-bottom:10px;padding:20px 20px"> <input id="partNo" class="easyui-textbox" required="true" label="Part no:" style="width:100%"> <br/><br> <input id="toShipQty" class="easyui-textbox" required="true" label="Quantity:" style="width:100%"> </div></div>
<div id="dlgUPlan" class="easyui-dialog" style="width:500px;display: none;" closed="true" buttons="#uplan-buttons"> <div style="margin-bottom:10px;padding:20px 20px"> <input id="planId" type="hidden" value=""> <input id="upartNo" class="easyui-textbox" required="true" label="Part no:" style="width:100%"> <br/><br> <input id="utoShipQty" class="easyui-textbox" required="true" label="Quantity:" style="width:100%"> </div></div>
<!-- 导入数据条件 --><div id="importDlg" class="easyui-dialog" style="width:500px;display: none;" closed="true" buttons="#ImportDelivery-buttons"> <form id="importDlgFm" method="post" novalidate style="margin:0;padding:20px 20px"> <div style="margin-bottom:10px"> <input id="ifsDNoteNo" name="ifsDeliveryNoteNo" class="easyui-textbox" required="true" label="IFS Delivery Note No:" style="width:100%"> </div> </form></div>
<div id="ImportDelivery-buttons" style="display: none;"> <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="ImportDelivery()" style="width:90px">OK</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#importDlg').dialog('close')" style="width:90px">Cancel</a></div>
<div id="plan-buttons" style="display: none;"> <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveDelivery()" style="width:90px">Save</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgPlan').dialog('close')" style="width:90px">Cancel</a></div>
<div id="uplan-buttons" style="display: none;"> <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="updateDelivery()" style="width:90px">Save</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgUPlan').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,toolbar:'#tbDtls'"> <thead> <tr> <th data-options="field:'boxNo',width:60,formatter:formatPrintBoxNo">Box No</th> <th data-options="field:'partNo',width:60,editor:'textbox'">Part No</th> <th data-options="field:'id',width:60,formatter:formatDtlAction">Actions</th> </tr> </thead> </table></div><!-- 发货计划 --><div id="delivery" class="easyui-dialog" style="width:700px;display: none;" closed="true" data-options="modal:true" > <table id="deliverys" class="easyui-datagrid" style="width:100%;height:300px;display: none;" data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:20,toolbar:'#tdDelivery'"> <thead> <tr> <th data-options="field:'partNo',width:60">Part No</th> <th data-options="field:'toShipQty',width:40">Qty to Ship</th> <th data-options="field:'rollActualQty',width:50">实际数量(按卷标)</th> <th data-options="field:'actualQty',width:40">Actual Qty Shipped</th> <th data-options="field:'id',width:120,formatter:planAction">Actions</th> </tr> </thead> </table></div>
<div id="tbDtls" style="padding:10px 5px;display: none;"> <div> <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newBox()">New Box</a> 扫箱出库: <input id="scanBoxNo" name="scanBoxNo" class="easyui-textbox" style="width: 120px;text-transform:uppercase;" placeholder="FG roll no" /> <#-- <a href="javascript:void(0)" id="forceClosed" class="easyui-linkbutton" onclick="shipBox()">出库</a>--> </div></div>
<div id="tdDelivery" style="padding:10px 5px;display: none;"> <div> <a href="javascript:void(0)" id="planAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newDelivery()">Create shipment plan</a> <a href="javascript:void(0)" id="planImport" class="easyui-linkbutton" iconCls="icon-add" onclick="importDlg()">Import Shipment Plan</a> </div></div>
<div id="dlgRollDtls" class="easyui-dialog" style="width:500px;display: none;" closed="true" data-options="modal:true,toolbar:'#dlgRollDtlstb'" > <table id="dgRollDtls" class="easyui-datagrid" style="width:100%;height:400px;display: none;" data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get'"> <thead> <tr> <th data-options="field:'finalRollNo',width:100">FG roll number</th> <th data-options="field:'id',width:40,formatter:formatBoxRollAction">Actions</th> </tr> </thead> </table></div> <div id="dlgRollDtlstb" style="padding:10px 5px;display: none;"> <div> 扫卷出库: <input id="finalRollNo" name="finalRollNo" class="easyui-textbox" style="width: 120px;text-transform:uppercase;" placeholder="FG roll no" /> <#-- <a href="javascript:void(0)" id="forceClosed" class="easyui-linkbutton" onclick="warehouse()">Receive</a>--> <a href="javascript:void(0)" id="boxingButton" class="easyui-linkbutton" onclick="doBoxing(nowBoxNo)">Pack</a> <#-- <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newReceive()">New Box</a>--> </div> </div>
<div id="planList" class="easyui-dialog" style="width:500px;display: none;" closed="true" data-options="modal:true" > <table id="planLists" 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:'date',width:60,formatter:formatDate">日期</th> <th data-options="field:'boxQty',width:60">Count of Boxes</th> <th data-options="field:'snQty',width:60">Qty Counted By Rolls</th> <th data-options="field:'locationNo',width:60">Location No</th> </tr> </thead> </table> </div>
<script> var uploadFlag=false; var rollActualQtyRow $(window).resize(function () { $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20}); });
$(function () { $(window).resize(); }); var nowBoxNo=''; var boxStatus=''; $("#queryLink").click(function(){ var dg = $('#dg').datagrid({ queryParams: { confirmedFlag: $("#confirmedFlag").val(), shippedDateFrom: $("#shippedDateFrom").val(), shippedDateTo: $("#shippedDateTo").val() } }); });
function formatPrintBoxNo(value, row){ if (row.status == "Packed") { return "<a target='forprint' href='/print/"+ "box" + "/" +value+"/'>"+value+"</a>"; }else{ return value; } }
function formatConfirmedFlag(value,row) { return value == 1 ? "<font color='green'>Confirmed</font>" : "To be Confirm"; }
function formatAction(value, row){ var str = "<a href='javascript:editInfo()'>Edit</a>" + " | <a href='javascript:delShip(\""+row.shipNo+"\")'>Delete</a>"; str += " | <a href='javascript:viewBoxes(\""+row.shipNo+"\")'>Box View</a>" + " | <a href='javascript:downloadList(\""+row.shipNo+"\")'>Delivery List</a>" + " | <a href='javascript:uploadFTP(\""+row.shipNo+"\")'>Upload to FTP</a>" + " | <a href='javascript:deliveryPlan(\""+row.shipNo+"\")'>Shipment Plan</a>"; return str; }
function formatDtlAction(value, row){ var action = ""; if (row.status != "Packed"){ // action = "<a href='/shipment/boxes/scan/" + value + "'>Scan and delivery</a>"; // action = "<a href='/shipment/boxes/scan/" + value + "'>扫描合箱出库</a>"; action = "Unpacked"; action += " | <a href='javascript:delBox(\"" + row.boxNo + "\");'>Delete</a>"; } else { action = "Packed"; action += " | <a href='javascript:unPackBox(\"" + row.boxNo + "\");'>UnPack</a>"; } action += " | <a href='javascript:viewBoxRolls(\"" + row.boxNo+"\",\"" + row.status + "\");'>View</a>";
return action; }
//发话计划的操作 function planAction(value, row){ var action = ""; if(row.id==0){ action = " no shipment plan"; }else{ action=" <a href='javascript:shipPlanList(\"" + row.partNo +"\",\"" + currentShipNo + "\");'>Delivery List</a>" +" | <a href='javascript:downPlanList(\"" + row.partNo +"\",\"" + currentShipNo + "\");'>Download</a>" <#if currentUser.isAdmin || (currentUser.authorities?contains("shipPlan_update"))> action += " | <a href='javascript:delPlan(\"" + value +"\",\"" + row.rollActualQty+ "\");'>Delete</a>" </#if> <#if currentUser.isAdmin> action+=" | <a href='javascript:uPlan(\"" + row.id + "\",\"" + row.partNo + "\",\"" + row.toShipQty +"\",\"" + row.rollActualQty + "\");'>Edit</a>"; </#if>
} return action; } //数量不对警告 $('#deliverys').datagrid({ rowStyler:function(index,row){ if (Number(row.rollActualQty)!=Number(row.toShipQty)){ return 'background-color:#ff534d;font-weight:bold;'; } } });
function formatBoxRollAction(value, row){ var action = ""; //获取当前的箱 if('Unpacked' == boxStatus){ action += "<a href='javascript:delBoxRoll(\"" + row.id + "\");'>Delete</a>"; }else{ return ''; }
return action; }
var postUrl = ""; function editInfo(){ var row = $('#dg').datagrid('getSelected'); if (row) { $('#dlg').dialog('open').dialog('center').dialog('setTitle', 'Edit'); $('#fm').form('load', row); postUrl="/shipment/"+row.id+"/update"; } }
function addInfo(){
$('#addDlg').dialog('open').dialog('center').dialog('setTitle', 'New'); $('#addFm').form('clear');
}
function doUpdateConfirmedFlag(){ var row = $('#dg').datagrid('getSelected'); if (row) { $.messager.confirm('Confirm','将发货单 <b>'+row.shipNo+'</b> 标记为已确认?',function(r){ if (r){ $.post('/shipment/'+row.id+'/updateConfirmFlag',{},function(result){ if (result.success){ $('#dg').datagrid('reload'); // reload the user data } else { $.messager.alert('error',result.errorMsg, 'error'); } },'json'); } });
}else{ $.messager.alert("Warning", "Select shipment", "warning"); } }
function saveShipInfo(){ $('#fm').form('submit',{ url: postUrl, onSubmit: function(){ return $(this).form('validate'); }, success: function(result){ var result = eval("("+result+")"); if (result.errorMsg){ $.messager.alert("Info",result.error,"Info",); //$('#dlg').dialog('close'); //$('#dg').datagrid('reload'); } else { $('#dlg').dialog('close'); // close the dialog $('#dg').datagrid('reload'); // reload the user data } } }); }
var currentShipNo = ""; function viewBoxes(shipNo){ currentShipNo = shipNo; $('#dlgDtls').dialog('open').dialog('center').dialog('setTitle',shipNo+' Box List'); $("#dgDtls").datagrid({url: "/shipment/boxes/"+shipNo}); } //发货计划 function deliveryPlan(shipNo){ currentShipNo = shipNo; $('#delivery').dialog('open').dialog('center').dialog('setTitle',shipNo+' Box List'); $("#deliverys").datagrid({url: "/shipment/delPlan/"+shipNo}); } //出货清单 function shipPlanList(partNo,shipNo){ $('#planList').dialog('open').dialog('center').dialog('setTitle','Delivery List'); $("#planLists").datagrid({url: "/shipment/shipPlanList/"+shipNo+"/"+partNo}); } function downPlanList(partNo,shipNo){ $.messager.confirm('Confirm','Are you sure to export the list?',function(r){ if (r){ window.location.href = '/export/laser/downPlanList?shipNo='+shipNo+"&partNo="+partNo; } }); } function viewBoxRolls(boxNo,status){ nowBoxNo=boxNo; boxStatus=status; if(status=='Unpacked'){ $("#finalRollNo").textbox({disabled:false}); // enableEl("#boxingButton",true); $("#boxingButton").linkbutton({"disabled": false}); }else { $("#finalRollNo").textbox({disabled:true}); // enableEl("#boxingButton",false); $("#boxingButton").linkbutton({"disabled": true}); } console.log(nowBoxNo) $('#dlgRollDtls').dialog('open').dialog('center').dialog('setTitle',nowBoxNo+' SFG roll'); $("#dgRollDtls").datagrid({url: "/shipment/box/"+boxNo+"/rolls"}); $("#finalRollNo").focus(); }
function downloadList(shipNo){ $.post("/shipment/downloadList", {shipNo: shipNo}, function(ret){ if(ret.success){ window.location.href="/prepress/download/"+ret.fileName; }else{ $.messager.alert('Error',ret.errorMsg, 'error'); } }); } //上传至FTP function uploadFTP(shipNo){ if(uploadFlag){ $.messager.alert('Error','Please wait till the previous upload finished!', 'error'); return false; } uploadFlag=true $.post("/shipment/downloadListForFTP", {shipNo: shipNo}, function(ret){ if(ret.success){ var fileNameList = ret.fileNameList; if(ret.flag=='Y'){ uploadFlag=false $.messager.alert('Error','File uploaded!', 'error'); }else{ var fileName = ret.fileName; $.ajax({ url : "/prepress/uploadFTP", type : "POST", data : {"fileName" : fileNameList, "shipNo":shipNo }, dataType : "json", success : function(result) { uploadFlag=false console.log(result); if(result.success){ alert("Uploaded!"+result.msg); //saveFTPRecord(result.data,shipNo); $('#dg').datagrid('reload'); }else{ alert("Fail to upload!"); $.messager.alert('Error',result.data, 'error'); } }, error : function() { uploadFlag=false } }); } }else{ uploadFlag=false $.messager.alert('Error',ret.errorMsg, 'error'); } }); } //保存FTP上传的记录 function saveFTPRecord(path,shipNo){ $.ajax({ type: 'GET', url: "/shipment/ftp/addFlag", dataType: "json", data: {"shipNo": shipNo, "ftpPath":path }, success: function(result){ console.log(result); if(result.success){ alert("Uploaded!"); } /* $('#dlgPlan').dialog('close'); $('#deliverys').datagrid('reload'); */ }, error : function() { } }); }
function newShipment(){ $.post("/shipment/add", {} , function(data){ if (data.success){ $('#dg').datagrid('reload'); }else{ } }); } function saveShipment(){ let addNo = $("#addIfsDeliveryNoteNo").val(); let remark=$("#addRemark").val(); if(addNo==null||addNo==''){ $.messager.alert('Error',"Please input IFS Shipment No", 'error'); return false } $.post("/shipment/addShipment", {ifsDNoteNo: addNo,remark:remark} , function(data){ if (data.success){ $('#dg').datagrid('reload'); $('#addDlg').dialog('close') }else{ $.messager.alert('Error',data.errorMsg, 'error'); } }); }
function newBox(){ $.post("/shipment/boxes/add", {shipNo: currentShipNo} , function(data){ if (data.success){ $('#dgDtls').datagrid('reload'); viewBoxRolls(data.boxNo,data.box.status); }else{ } }); } //编辑 function uPlan(id,partNo,toShipQty,rollActualQty){ rollActualQtyRow=rollActualQty; $('#dlgUPlan').dialog('open').dialog('center').dialog('setTitle', 'Modify shipment plan'); $('#dlgUPlan form').form('clear'); $("#planId").val(id); $("#upartNo").textbox('setValue', partNo); $("#utoShipQty").textbox('setValue', toShipQty); } //新增发货计划 function newDelivery(){ $('#dlgPlan').dialog('open').dialog('center').dialog('setTitle', 'Create shipment plan'); $('#dlgPlan form').form('clear'); } //新增 function saveDelivery(){ var partNo = $("#partNo").val(); var toShipQty = $("#toShipQty").val(); $.ajax({ type: 'GET', url: "/shipment/Delivery/add", dataType: "json", data: {"shipNo": currentShipNo, "partNo":partNo, "qty":toShipQty }, success: function(data){ $('#dlgPlan').dialog('close'); $('#deliverys').datagrid('reload'); }, error : function() { } }); } //导入发货计划条件 function importDlg(){ $('#importDlg').dialog('open').dialog('center').dialog('setTitle', 'ifsDeliveryNoteNo'); $('#importDlgFm form').form('clear'); } //导入发货计划 function ImportDelivery(){ var IfsDNoteNo = $("#ifsDNoteNo").val(); console.log(IfsDNoteNo); $.post('/shipment/importDelivery',{ifsDNoteNo:IfsDNoteNo,shipNo: currentShipNo},function(result){ if (result.success){ $('#importDlg').dialog('close'); $('#deliverys').datagrid('reload'); } else { $.messager.alert('Error',result.errorMsg, 'error'); } },'json'); } //修改发货计划 function updateDelivery(){ var planId = $("#planId").val(); var partNo = $("#upartNo").val(); var toShipQty = $("#utoShipQty").val(); if(toShipQty<rollActualQtyRow){ $.messager.alert('Error','The qty to ship can not be less than the qty shipped, if you want to change, you need to cancel the shipment first!!', 'error'); return false } console.log(planId); $.ajax({ type: 'GET', url: "/shipment/Delivery/update", dataType: "json", data: {"pId":planId, "partNo":partNo, "qty":toShipQty }, success: function(data){ $('#dlgUPlan').dialog('close'); $('#deliverys').datagrid('reload'); }, error : function() { } }); }
function delBoxRoll(boxRollId){ $.messager.confirm('Confirm','Are you sure to delete the data ?',function(r){ if (r){ $.post('/shipment/boxroll/'+boxRollId+'/del',{},function(result){ if (result.success){ $('#dgRollDtls').datagrid('reload'); } else { $.messager.alert('Error',result.errorMsg, 'error'); } },'json'); } }); }
//删除出库单号 function delShip(shipNo){ $.messager.confirm('Confirm','Are you sure to delete the data ?',function(status){ if (status){ $.ajax({ url : "/shipment/delShip", type : "POST", data : {shipNo: shipNo}, dataType : "json", success : function(data) { var code = data.code; if(code=='0'){ $('#dg').datagrid('reload'); $.messager.alert("Info",data.msg,"Info"); }else{ $.messager.alert('Error',data.msg, 'error'); } }, error : function(data) { $.messager.alert('Error',data.msg, 'error'); } }); } }); } //删除出库下的箱子 function delBox(boxNo){ $.messager.confirm('Confirm','Are you sure to delete the data ?',function(status){ if (status){ $.ajax({ url : "/shipment/delBox", type : "POST", data : {boxNo: boxNo}, dataType : "json", success : function(data) { var code = data.code; if(code=='0'){ $('#dgDtls').datagrid('reload'); $.messager.alert("Info",data.msg,"Info",); }else{ $.messager.alert('Error',data.msg, 'error'); } }, error : function(data) { $.messager.alert('Error',data.msg, 'error'); } }); } }); }
//拆封 function unPackBox(boxNo){ $.messager.confirm('Confirm','Are you sure unpack the box:'+boxNo+' ?',function(status){ if (status){ $.ajax({ // url : "/shipment/unPackBox", url : "/receive/boxes/unBoxingShip", type : "POST", data : {boxNo: boxNo}, dataType : "json", success : function(data) { if(data.success){ $('#dgDtls').datagrid('reload'); $.messager.alert("Info",data.msg,"Info",); }else{ $.messager.alert('Error',data.msg, 'error'); } }, error : function(data) { $.messager.alert('Error',data.msg, 'error'); } }); } }); }
//删除发货计划 function delPlan(id,rollActualQty){ if(rollActualQty>0){ $.messager.alert('Error','Delete is not allowed because it has been deliveryed already', 'error'); return false; } $.messager.confirm('Confirm','Are you sure to delete the data ?',function(status){ if (status){ $.ajax({ url : "/shipment/delPlan", type : "POST", data : {id: id}, dataType : "json", success : function(data) { var code = data.code; if(code=='0'){ $('#deliverys').datagrid('reload'); $.messager.alert("Info",data.msg,"Info",); }else{ $.messager.alert('Error',data.msg, 'error'); } }, error : function(data) { $.messager.alert('Error',data.msg, 'error'); } }); } }); }
//2023 0528 RQ 新增
// $("#scanBoxNo").on("keydown", function(event){ // console.log("回车拉") // var scanBoxNo = $(this).val(); // if(event.keyCode == 13){ // $.post("/receive/scan/add", {shipNo:currentShipNo, finalRollNo: scanBoxNo} , function(data){ // if (data.success){ // $("#ifmforprint").attr('src', "/print/box/" + scanBoxNo + "/"); // $("#dgDtls").datagrid({url: "/shipment/boxes/"+currentShipNo}); // $.messager.alert("Info","Shipped","Info",); // $("#finalRollNo").textbox('setValue',"").focus(); // }else{ // $.messager.alert('Error',data.errorMsg, 'error'); // $("#finalRollNo").textbox('setValue',"").focus(); // } // // }); // } // }).on("blur", function() { // $(this).textbox('setValue',$(this).val().trim().toUpperCase()); // }) $("#scanBoxNo").textbox({ inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents,{ keyup:function(event){ if(event.keyCode == 13){ console.log("回车"); let scanBoxNo=$("#scanBoxNo").val(); $.post("/shipment/boxes/shipBox", {shipNo:currentShipNo, scanBoxNo: scanBoxNo} , function(data){ if (data.success){ $("#ifmforprint").attr('src', "/print/box/" + scanBoxNo + "/"); $("#dgDtls").datagrid({url: "/shipment/boxes/"+currentShipNo}); $.messager.alert("Info","Shipped","Info",); $("#scanBoxNo").textbox('setValue',"").focus(); }else{ $.messager.alert('Error',data.errorMsg, 'error'); $("#scanBoxNo").textbox('setValue',"").focus(); }
}); } } }) })
function shipBox(){ var scanBoxNo = $("#scanBoxNo").val(); $.post("/shipment/boxes/shipBox", {shipNo:currentShipNo, scanBoxNo: scanBoxNo} , function(data){ if (data.success){ $("#ifmforprint").attr('src', "/print/box/" + scanBoxNo + "/"); $("#dgDtls").datagrid({url: "/shipment/boxes/"+currentShipNo}); $.messager.alert("Info","Shipped","Info",); $("#scanBoxNo").textbox('setValue',"").focus(); }else{ $.messager.alert('Error',data.errorMsg, 'error'); $("#scanBoxNo").textbox('setValue',"").focus(); }
}); }
$("#finalRollNo").textbox({ inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents,{ keyup:function(event){ if(event.keyCode == 13){ var finalRollNo = $("#finalRollNo").val();
$.post("/shipment/boxes/scan/addNew", {boxNo: nowBoxNo, finalRollNo: finalRollNo} , function(data){ console.log(data); if (data.success){ $("#dgRollDtls").datagrid({url: "/shipment/box/"+nowBoxNo+"/rolls"}); $("#finalRollNo").textbox('setValue',"").focus(); }else{ //$("#tblInfo").append("<p>" + finalRollNo + data.errorMsg + "</p>"); $("#finalRollNo").textbox('setValue',""); $.messager.alert('Error',data.errorMsg, 'error');
} }); } } }) })
function doBoxing(boxNo){ if(boxStatus!='Unpacked'){ $.messager.alert("Error", "The box can be packed only when unpacked.", "error"); return false; } $.messager.confirm("Confirm","Submit", function(cr){ if (cr){ $.post("/shipment/boxes/finishByboxNo", {boxNo: boxNo}, function(ret){ if (ret.success){ $("#ifmforprint").attr('src', "/print/box/" + ret.box.boxNo + "/"); $('#dlgRollDtls').dialog('close'); $("#dgDtls").datagrid({url: "/shipment/boxes/"+currentShipNo}); }else{ $.messager.alert("Error", ret.errorMsg, "error"); } }) } }) }
function delPlanList() {
}
</script>
</@master.layout>
|