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.
 
 
 
 
 

342 lines
14 KiB

<#import "../master.ftl" as master>
<@master.layout>
<style>
#fm label {
width: 100px;
}
</style>
<div class="page-header">
<h3>Box Management</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 , url:'/boxManage/getBoxList',method:'get',pageSize:20,toolbar:'#tb'">
<thead>
<tr>
<th data-options="field:'boxNo',width:100,editor:'textbox'">Box No</th>
<th data-options="field:'receiveNo',width:100,editor:'textbox'">Receiving No</th>
<th data-options="field:'status',width:100,editor:'textbox'">Status</th>
<th data-options="field:'partNo',width:100,editor:'textbox'">Part No</th>
<th data-options="field:'locationNo',width:100,editor:'textbox'">Location No</th>
<th data-options="field:'rollQty',width:80,editor:'textbox'">Roll Qty</th>
<th data-options="field:'productDate',width:80,formatter:formatDate">Production Date</th>
<th data-options="field:'createDate',width:80,formatter:formatDate">Receive Date</th>
<th data-options="field:'id',width:150,align:'center',formatter:formatAction">Actions</th>
</tr>
</thead>
</table>
<div id="tb" style="padding:10px 5px;display: none;">
<div>
箱号: <input class="easyui-textbox" id="boxNo" style="width:110px">
入库单号:<input class="easyui-textbox" id="receiveNo" style="width:110px">
Status:<select class="easyui-combobox" panelHeight="auto" id="status" style="width:100px">
<option value="">All</option>
<option value="Received">Received</option>
<option value="Unpacked">Unpacked</option>
<option value="Packed">Packed</option>
<option value="Frozen">Frozen</option>
<option value="Delivered">Delivered</option>
</select>
物料编码:<input class="easyui-textbox" id="partNo" style="width:110px">
库位:<input class="easyui-textbox" id="locationNo" style="width:110px">
<#-- 卷数:<input class="easyui-textbox" id="rollQty" type="number" style="width:110px">-->
类型:<select class="easyui-combobox" panelHeight="auto" id="qtyType" style="width:100px">
<option value="">All</option>
<option value="Standard Box">Standard Box</option>
<option value="Remainder Box">Remainder Box</option>
</select>
<a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a>
&nbsp;&nbsp;&nbsp;<a class="easyui-linkbutton" iconCls="icon-add" onclick="downBoxDataExcel()">Export to Excel</a>
<#-- <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newReceive()">New Box</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>
扫卷入库:&nbsp;&nbsp;&nbsp;<input id="finalRollNo" name="finalRollNo" class="easyui-textbox" style="width: 120px;text-transform:uppercase;" placeholder="FG roll no" />
&nbsp;&nbsp;&nbsp;
<#-- <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>
<script>
var boxStatus='';
var nowBoxNo='';
var boxReceiveNo='';
$(window).resize(function () {
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
});
$(function () {
$(window).resize();
});
// $("#finalRollNo").on("keydown", function(event){
// console.log("回车拉")
// var finalRollNo = $(this).val();
// if(event.keyCode == 13){
// $.post("/receive/scan/add", {receiveId: 0, receiveNo: boxReceiveNo,boxNo: nowBoxNo, finalRollNo: finalRollNo, type: "Passed"} , function(data){
// if (data.success){
// $("#dgRollDtls").datagrid({url: "/receive/box/"+nowBoxNo+"/rolls"});
// $.messager.alert("Info","Received","Info",);
// $("#finalRollNo").textbox('setValue',"").focus();
// }else{
// $.messager.alert('Error',finalRollNo+":"+data.errorMsg, 'error');
// $("#finalRollNo").textbox('setValue',"").focus();
// }
// });
// }
// }).on("blur", function() {
// $(this).textbox('setValue',$(this).val().trim().toUpperCase());
// })
$("#finalRollNo").textbox({
inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents,{
keyup:function(event){
if(event.keyCode == 13){
console.log("回车");
let finalRollNo=$("#finalRollNo").val();
$.post("/receive/scan/add", {receiveId: 0, receiveNo: boxReceiveNo,boxNo: nowBoxNo, finalRollNo: finalRollNo, type: "Passed"} , function(data){
if (data.success){
$("#dgRollDtls").datagrid({url: "/receive/box/"+nowBoxNo+"/rolls"});
// $.messager.alert("Info","Received","Info",);
$("#finalRollNo").textbox('setValue',"").focus();
}else{
$.messager.alert('Error',finalRollNo+":"+data.errorMsg, 'error');
$("#finalRollNo").textbox('setValue',"").focus();
}
});
}
}
})
})
function formatDateTime(value,row){
if (value && value > 0){
var d = new Date(value);
var MM = d.getMonth() <= 9 ? '0'+(d.getMonth()+1) : d.getMonth() + 1;
var hh = d.getHours() <= 9 ? '0'+d.getHours() : d.getHours();
var mm = d.getMinutes() <= 9 ? '0'+d.getMinutes() : d.getMinutes();
var ss = d.getSeconds() <= 9 ? '0'+d.getSeconds() : d.getSeconds();
var dd = d.getDate() <= 9 ? '0'+d.getDate() : d.getDate();
var datestring = d.getFullYear() + "-" + MM + "-" + dd + " " + hh + ":" + mm + ":" + ss;
return datestring;
}
return "";
}
function formatDate(value,row){
if (value && value > 0){
var d = new Date(value);
var MM = d.getMonth() < 9 ? '0'+(d.getMonth()+1) : d.getMonth() + 1;
var dd = d.getDate() <= 9 ? '0'+d.getDate() : d.getDate();
var datestring = d.getFullYear() + "-" + MM + "-" + dd;
return datestring;
}
return "";
}
function warehouse(){
var finalRollNo = $("#finalRollNo").val();
$.post("/receive/scan/add", {receiveId: 0, receiveNo: boxReceiveNo,boxNo: nowBoxNo, finalRollNo: finalRollNo, type: "Passed"} , function(data){
if (data.success){
$("#dgRollDtls").datagrid({url: "/receive/box/"+nowBoxNo+"/rolls"});
$("#finalRollNo").textbox('setValue',"").focus();
$.messager.alert("Info","Received","Info",);
}else{
$("#finalRollNo").textbox('setValue',"").focus();
$.messager.alert('Error',finalRollNo+":"+data.errorMsg, 'error');
}
});
}
function formatAction(value, row){
var action="<a href='javascript:viewBoxRolls(\"" + row.boxNo + "\",\"" + row.status+ "\",\"" + row.receiveNo + "\");'>Received Rolls</a>" ;
if (row.status=='Packed'){
action += "&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript:doUnBoxing(\""+row.boxNo+"\")'>Unfrozen</a>";
}
if (row.status=='Received'){
action += "&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript:freezeBox(\""+row.boxNo+"\")'>Frozen</a>";
}
if (row.status=='Frozen'){
action += "&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript:thawBox(\""+row.boxNo+"\")'>Unblocked</a>";
}
if (row.status == "Unpacked"){
action += "&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript:doBoxing(\""+row.boxNo+"\")'>Pack</a>";
action += "&nbsp;|&nbsp;<a href='javascript:delBox(\"" + row.boxNo + "\");'>Delete</a>";
}
return action;
}
function freezeBox(boxNo){
$.messager.confirm("Confirm","Submit", function(cr){
if (cr){
$.post("/receive/boxes/freezeBox", {boxNo: boxNo}, function(ret){
if (ret.success){
$('#dg').datagrid('reload');
}else{
$.messager.alert("Error", ret.errorMsg, "error");
}
})
}
})
}
function thawBox(boxNo){
$.messager.confirm("Confirm","Submit", function(cr){
if (cr){
$.post("/receive/boxes/thawBox", {boxNo: boxNo}, function(ret){
if (ret.success){
$('#dg').datagrid('reload');
}else{
$.messager.alert("Error", ret.errorMsg, "error");
}
})
}
})
}
function doBoxing(boxNo){
$.messager.confirm("Confirm","Submit", function(cr){
if (cr){
$.post("/receive/boxes/finish", {boxNo: boxNo}, function(ret){
if (ret.success){
$("#ifmforprint").attr('src', "/print/receiveBox/" + ret.box.boxNo + "/");
$('#dg').datagrid('reload');
$('#dlgRollDtls').dialog('close')
}else{
$.messager.alert("Error", ret.errorMsg, "error");
}
})
}
})
}
function doUnBoxing(boxNo){
$.messager.confirm("Confirm","Submit", function(cr){
if (cr){
$.post("/receive/boxes/unBoxing", {boxNo: boxNo}, function(ret){
if (ret.success){
$('#dg').datagrid('reload');
}else{
$.messager.alert("Error", ret.errorMsg, "error");
}
})
}
})
}
//删除出库下的箱子
function delBox(boxNo){
$.messager.confirm('Confirm','Are you sure to delete the data ?',function(status){
if (status){
$.ajax({
url : "/receive/delBox",
type : "POST",
data : {boxNo: boxNo},
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 viewBoxRolls(boxNo,status,receiveNo){
//设置当前的数据
boxStatus=status;
nowBoxNo=boxNo;
boxReceiveNo=receiveNo;
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});
}
$('#dlgRollDtls').dialog('open').dialog('center').dialog('setTitle',boxNo+' SFG roll');
$("#dgRollDtls").datagrid({url: "/receive/box/"+boxNo+"/rolls"});
}
//查看页面
function formatBoxRollAction(value, row){
var action = "";
if(boxStatus=="Unpacked"){
action += "<a href='javascript:delBoxRoll(\"" + row.id + "\");'>Delete</a>";
}
return action;
}
function delBoxRoll(boxRollId){
$.messager.confirm('Confirm','Are you sure to delete the data ?',function(r){
if (r){
$.post('/receive/boxroll/'+boxRollId+'/del',{},function(result){
if (result.success){
$('#dgRollDtls').datagrid('reload');
} else {
$.messager.alert('Error',result.errorMsg, 'error');
}
},'json');
}
});
}
$("#queryLink").click(function(){
var dg = $('#dg').datagrid({
queryParams: {
boxNo: $("#boxNo").val(),
receiveNo: $("#receiveNo").val(),
status: $("#status").val(),
partNo: $("#partNo").val()
,qtyType: $("#qtyType").val()
,locationNo: $("#locationNo").val()
}
});
});
//下载Excel数据
function downBoxDataExcel(){
let boxNo = $("#boxNo").val();
let receiveNo = $("#receiveNo").val();
let status = $("#status").val();
let partNo = $("#partNo").val();
let qtyType = $("#qtyType").val();
let locationNo = $("#locationNo").val();
let print_url = '/export/inventory/downBoxDataExcel?boxNo='+boxNo+'&receiveNo='+receiveNo+'&statusDesc='+status+'&partNo='+partNo+'&qtyType='+qtyType+'&locationNo='+locationNo;
$("#ifmforprint").attr('src', print_url);
}
</script>
</@master.layout>