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.
433 lines
16 KiB
433 lines
16 KiB
<#import "../master.ftl" as master>
|
|
<@master.layout>
|
|
|
|
<style>
|
|
#fm label {
|
|
width: 100px;
|
|
}
|
|
</style>
|
|
|
|
<div class="page-header">
|
|
<h3>Receipt</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 ,
|
|
queryParams:{'receivedType': 'R'},
|
|
url:'/receive/all',method:'get',pageSize:20,toolbar:'#tb'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'orderNo',width:100,editor:'textbox'">SO No</th>
|
|
<th data-options="field:'receiveNo',width:100,editor:'textbox'">Receiving No</th>
|
|
<th data-options="field:'receivedBy',width:80,align:'left'">Created By</th>
|
|
<th data-options="field:'receivedDate',width:150,align:'center',formatter:formatDateTime">Create 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>
|
|
SO No: <input class="easyui-textbox" id="orderNo" style="width:110px">
|
|
Create Date: <input class="easyui-datebox" id="receivedDateFrom" style="width:100px">
|
|
到: <input class="easyui-datebox" id="receivedDateTo" style="width:100px">
|
|
<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="newReceive()">Create receipt form</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" style="display: none;">
|
|
<input id="received_type" name="receivedType" type="hidden" value="R">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="order_no" name="orderNo" class="easyui-textbox" required="true" data-options="buttonText: 'query',onClickButton:getOrderNo" label="SO 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="saveReceive()" 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:50, toolbar:'#tbDtls', onLoadSuccess: onDtlsLoadSuccess">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'finalRollNo',width:100, formatter:formatPrintRoll">FG roll number</th>
|
|
<th data-options="field:'boxNo',width:100, formatter:formatPrintRoll">Box No</th>
|
|
<th data-options="field:'boxtype',width:100, formatter:formatFindType">Box Type</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
|
|
<div id="tbDtl" 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>
|
|
<a href="javascript:void(0)" id="downBoxExcel" class="easyui-linkbutton" iconCls="icon-add" onclick="downBoxExcel()">Export to Excel</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="tbDtls" style="padding:10px 5px;display: none;">
|
|
<div id="btn_Excel">
|
|
<a href="javascript:void(0)" id="downExcel" class="easyui-linkbutton" iconCls="icon-add" onclick="downExcel()">Export to Excel</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="dlgDtl" class="easyui-dialog" style="width:600px;display: none;"
|
|
closed="true" data-options="modal:true" >
|
|
<table id="dgDtl" 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:'#tbDtl'">
|
|
<thead>
|
|
<input type="hidden" id="Rid" value=""/>
|
|
<input type="hidden" id="ReceiveNo" value=""/>
|
|
<input type="hidden" id="boxType" value=""/>
|
|
<tr>
|
|
<th data-options="field:'boxNo',width:40,formatter:formatPrintBoxNo">Box No</th>
|
|
<th data-options="field:'boxType',width:30">Type</th>
|
|
<th data-options="field:'status',width:30">Status</th>
|
|
<th data-options="field:'rollQty',width:30">Roll Qty</th>
|
|
<th data-options="field:'id',width:80,formatter:formatDtlAction">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
|
|
<div id="dlgRollDtls" class="easyui-dialog" style="width:500px;display: none;"
|
|
closed="true" data-options="modal:true" >
|
|
<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>
|
|
|
|
<script>
|
|
|
|
function getOrderNo(){
|
|
var orderNo = $("#order_no").val();
|
|
if (orderNo != ""){
|
|
$.post("/receive/getOrderNo", {finalRollNo: orderNo}, function (data) {
|
|
if(data.success){
|
|
$("#order_no").textbox("setValue", data.orderNo);
|
|
}
|
|
})
|
|
}
|
|
}
|
|
var currentOrder='';
|
|
var currentShipNo='';
|
|
$(window).resize(function () {
|
|
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
|
|
});
|
|
|
|
$(function () {
|
|
$(window).resize();
|
|
});
|
|
|
|
$.extend($.fn.validatebox.defaults.rules, {
|
|
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) {
|
|
|
|
}
|
|
|
|
function formatPrintRoll(value, row){
|
|
if (value.indexOf("-Q") > 0 || value.indexOf("-S") > 0) {
|
|
return "<a href='/print/finalroll/"+value+"/' target='forprint'>"+value+"</a>"
|
|
}
|
|
return value;
|
|
}
|
|
//获取箱子的类型
|
|
function formatFindType(value,row){
|
|
var boxNo = row.boxNo;
|
|
console.log(boxNo);
|
|
var boxtype;
|
|
$.ajax({
|
|
url : "/receive/findBoxType",
|
|
type : "POST",
|
|
async : false,
|
|
data : {boxNo: boxNo},
|
|
dataType : "json",
|
|
success : function(data) {
|
|
boxtype= data.boxType;
|
|
}
|
|
});
|
|
return boxtype;
|
|
}
|
|
|
|
$("#queryLink").click(function(){
|
|
var dg = $('#dg').datagrid({
|
|
queryParams: {
|
|
orderNo: $("#orderNo").val(),
|
|
receivedType: 'R',
|
|
receivedDateFrom: $("#receivedDateFrom").val(),
|
|
receivedDateTo: $("#receivedDateTo").val()
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
function formatAction(value, row){
|
|
let action= "<a href='javascript:viewBoxes(\""+row.receiveNo+"\",\""+'Passed'+"\",\""+row.id+"\",\""+row.orderNo+"\")'>Good Box List</a>"
|
|
if(row.orderNo!='*'){
|
|
action=action+ " | " + "<a href='javascript:viewBoxes(\""+row.receiveNo+"\",\""+'Defective'+"\",\""+row.id+"\",\""+row.orderNo+"\")'>Defect Box List</a>"
|
|
}
|
|
|
|
|
|
|
|
action=action + " | <a href='javascript:viewRolls(\"" + row.receiveNo + "\")'>Received Rolls</a>"
|
|
+ " | <a href='javascript:delReceive(\"" + row.receiveNo + "\",\""+row.orderNo+"\")'>Delete</a>"
|
|
|
|
return action;
|
|
}
|
|
//箱子
|
|
function viewBoxes(receiveNo,type,rid,orderNo){
|
|
currentOrder=orderNo;
|
|
currentShipNo = receiveNo;
|
|
boxType = type;
|
|
$("#Rid").val(rid);
|
|
$("#boxType").val(type);
|
|
$("#ReceiveNo").val(receiveNo)
|
|
$('#dlgDtl').dialog('open').dialog('center').dialog('setTitle',receiveNo+' Box List');
|
|
$("#dgDtl").datagrid({url: "/receive/boxes/"+receiveNo+"/"+type,
|
|
onLoadSuccess: function(data) {
|
|
var rolls = data.rows;
|
|
if(rolls==null ||rolls==""){
|
|
$("#downBoxExcel").hide();
|
|
}else{
|
|
$("#downBoxExcel").show();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
var currentTitle = "";
|
|
function viewRolls(receiveNo){
|
|
$("#ReceiveNo").val(receiveNo);
|
|
$("#dgDtls").datagrid({url: "/receive/finalrolls/"+receiveNo,
|
|
onLoadSuccess: function(data) {
|
|
currentTitle = receiveNo+'中已入库的卷'+" 共计"+data.total+"";
|
|
$('#dlgDtls').dialog('open').dialog('center').dialog('setTitle',currentTitle);
|
|
var rolls = data.rows;
|
|
if(rolls==null ||rolls==""){
|
|
$("#btn_Excel").hide();
|
|
}else{
|
|
$("#btn_Excel").show();
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function onDtlsLoadSuccess(){
|
|
$('#dlgDtls').dialog('setTitle',currentTitle + ': 共计' + $('#dgDtls').datagrid('getRows').length + "");
|
|
}
|
|
|
|
var url;
|
|
function newReceive(){
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','Create receipt form');
|
|
$('#fm').form('clear');
|
|
$("#received_type").val("R");
|
|
url = '/prepress/soinfo/add';
|
|
}
|
|
|
|
function saveReceive(){
|
|
$('#fm').form('submit',{
|
|
url: "/receive/add",
|
|
onSubmit: function(){
|
|
return $(this).form('validate');
|
|
},
|
|
success: function(result){
|
|
var result = eval("("+result+")");
|
|
if (result.errorMsg){
|
|
$.messager.alert('error',result.errorMsg, 'error');
|
|
} else {
|
|
$('#dlg').dialog('close'); // close the dialog
|
|
$('#dg').datagrid('reload'); // reload the user data
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function formatPrintBoxNo(value, row){
|
|
if (row.status == "Packed"||row.status == "Received") {
|
|
//return "<a target='forprint' href='/print/"+ "receiveBox" + "/" +value+"/'>"+value+"</a>";
|
|
return "<a onclick='getInnerBoxPrintCacheData(\""+value+"\")'>"+value+"</a>";
|
|
}else{
|
|
return value;
|
|
}
|
|
}
|
|
|
|
function formatDtlAction(value, row){
|
|
var action = "";
|
|
var id = $("#Rid").val();
|
|
if (row.status == "Unpacked"&¤tOrder!="*"){
|
|
action = "<a href='/receive/scan/" + id + "?type="+row.boxType+"&boxNo="+row.boxNo+"'>扫描入库</a> | ";
|
|
}
|
|
if (row.status == "Unpacked"&¤tOrder=="*"){
|
|
action = "<a href='/receive/scanPlus/" + id + "?type="+row.boxType+"&boxNo="+row.boxNo+"'>合箱入库</a> | ";
|
|
}
|
|
if (row.status == "Packed"||row.status == "Received"){
|
|
action = "<a href='javascript:doUnBoxing(\""+row.boxNo+"\")'>Unfrozen</a> | ";
|
|
}
|
|
action += "<a href='javascript:delBox(\"" + row.boxNo + "\");'>Delete</a>";
|
|
action += " | <a href='javascript:viewBoxRolls(\"" + row.boxNo + "\");'>Received Rolls</a>";
|
|
|
|
return action;
|
|
}
|
|
|
|
function newBox(){
|
|
$.post("/receive/boxes/add", {receiveNo: currentShipNo,type:boxType, receivedType: 'R'} , function(data){
|
|
console.log(data);
|
|
if (data.success){
|
|
$('#dgDtl').datagrid('reload');
|
|
}else{
|
|
}
|
|
});
|
|
}
|
|
|
|
//删除出库下的箱子
|
|
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'){
|
|
$('#dgDtl').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 doUnBoxing(boxNo){
|
|
$.messager.confirm("Confirm","Submit", function(cr){
|
|
if (cr){
|
|
$.post("/receive/boxes/unBoxing", {boxNo: boxNo}, function(ret){
|
|
if (ret.success){
|
|
$('#dgDtl').datagrid('reload');
|
|
}else{
|
|
$.messager.alert("Error", ret.errorMsg, "error");
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
//查看
|
|
function viewBoxRolls(boxNo){
|
|
$('#dlgRollDtls').dialog('open').dialog('center').dialog('setTitle',boxNo+' SFG roll');
|
|
$("#dgRollDtls").datagrid({url: "/receive/box/"+boxNo+"/rolls"});
|
|
}
|
|
//查看页面
|
|
function formatBoxRollAction(value, row){
|
|
var action = "";
|
|
<#if currentUser.isAdmin || (currentUser.authorities?contains("switch_order") && currentUser.authorities?contains("dispatch"))>
|
|
action += "<a href='javascript:delBoxRoll(\"" + row.id + "\");'>Delete</a>";
|
|
</#if>
|
|
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');
|
|
}
|
|
});
|
|
}
|
|
|
|
//删除出库单号
|
|
function delReceive(receiveNo,orderNo){
|
|
$.messager.confirm('Confirm','Are you sure to delete the data ?',function(status){
|
|
if (status){
|
|
console.log("-=-");
|
|
console.log(status);
|
|
$.ajax({
|
|
url : "/receive/delReceive",
|
|
type : "POST",
|
|
data : {receiveNo: receiveNo,orderNo:orderNo},
|
|
dataType : "json",
|
|
success : function(data) {
|
|
console.log(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) {
|
|
console.log(data);
|
|
$.messager.alert('Error',data.msg, 'error');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
//导出EXCEl
|
|
function downExcel() {
|
|
//拼接url
|
|
var url = "/scanning/down/SoReceiveBoxRollsList?ReceiveNo="+$("#ReceiveNo").val();
|
|
//设置href
|
|
$("#downExcel").attr("href", url);
|
|
}
|
|
//导出
|
|
function downBoxExcel(){
|
|
//拼接url
|
|
var url = "/scanning/down/SoReceiveBoxList?ReceiveNo="+$("#ReceiveNo").val()+"&type="+$("#boxType").val();
|
|
//设置href
|
|
$("#downBoxExcel").attr("href", url);
|
|
}
|
|
</script>
|
|
|
|
|
|
</@master.layout>
|
|
|