<!DOCTYPE html>
|
<html>
|
<head>
|
<meta charset="UTF-8" />
|
<meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" />
|
<!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=2.0, user-scalable=no" /> -->
|
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
<title>Boxline PDA</title>
|
|
<link rel="stylesheet" href="layui/css/layui.css" />
|
<link rel="stylesheet" href="css/style.css" />
|
<script src="js/adaptive.js"></script>
|
|
<link rel="stylesheet" href="css/my.css" />
|
<style type="text/css">
|
.layout-bill-info {
|
height: 255px;
|
}
|
.layout-tbl-submit {
|
margin-top: 10px;
|
}
|
</style>
|
<link rel="stylesheet" href="css/adapter.css" />
|
</head>
|
<body>
|
<div id="" class="main-content">
|
<div id="" class="layout-title" style="">
|
<table border="" cellspacing="" cellpadding="">
|
<tr>
|
<td class="img-back"><a href="index.html"><img src="assets/back.jpg" ></a></td>
|
<td class="title-text">退货入库</td>
|
<td class="title-menu-icon"><img id="menuImg" src="assets/menu.jpg" ></td>
|
</tr>
|
</table>
|
</div>
|
<div id="" class="layout-sub-content" >
|
<div id="menuList" class="menu">
|
<ul class="" style="text-align: center;">
|
<li><a href="index.html">主页</a></li>
|
<li><a href="login.html">重新登录</a></li>
|
</ul>
|
</div>
|
|
<div id="" class="layout-bill-info" >
|
<form class="layui-form" action="">
|
<div id="layout-bill" class="layui-form-item layout-dropdownlist" >
|
<label class="layui-form-label">入库单:</label>
|
<div class="layui-input-block" id="selectDiv">
|
<select id="bar" lay-filter="getbar" lay-search>
|
<option value=""></option>
|
</select>
|
<img src="assets/down_arraw.png" >
|
</div>
|
</div>
|
<div id="" class="layui-form-item layout-input">
|
<label class="layui-form-label">托盘条码:</label>
|
<div class="layui-input-block">
|
<input id="STOCKCODE" type="text" lay-verify="stock" placeholder="请扫描托盘条码"
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
<div id="layout-boxcode" class="layui-form-item layout-input">
|
<label class="layui-form-label">外箱条码:</label>
|
<div class="layui-input-block">
|
<input id="BOXCODE" type="text" placeholder="请扫描外箱条码"
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
<table class="layout-tbl-input" border="" cellspacing="" cellpadding="" style="">
|
<tr>
|
<td>
|
<div id="" class="layui-form-item layout-boxinfo">
|
<label class="layui-form-label">计划数量:</label>
|
<div class="layui-input-block">
|
<input id="ImportQuantity" type="text" disabled placeholder=""
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
</td>
|
<td>
|
<div id="" class="layui-form-item layout-boxinfo">
|
<label class="layui-form-label">已组数量:</label>
|
<div class="layui-input-block">
|
<input id="ImportFactQuantity" type="text" disabled placeholder=""
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
</td>
|
</tr>
|
<tr>
|
<td>
|
<div class="layui-form-item layout-boxinfo">
|
<label class="layui-form-label">物料编号:</label>
|
<div class="layui-input-block">
|
<input id="GoodsCode" type="text" lay-verify="" disabled placeholder=""
|
class="layui-input">
|
</div>
|
</div>
|
</td>
|
<td>
|
<div class="layui-form-item layout-boxinfo">
|
<label class="layui-form-label">物料名称:</label>
|
<div class="layui-input-block">
|
<input id="GoodsName" type="text" lay-verify="" disabled placeholder=""
|
class="layui-input">
|
</div>
|
</div>
|
</td>
|
</tr>
|
<tr>
|
<td>
|
<div class="layui-form-item layout-boxinfo">
|
<label class="layui-form-label">物料批次:</label>
|
<div class="layui-input-block">
|
<input id="LotNo" type="text" lay-verify="" disabled placeholder="" class="layui-input">
|
</div>
|
</div>
|
</td>
|
<td>
|
<div class="layui-form-item layout-boxinfo">
|
<label class="layui-form-label">箱内数量:</label>
|
<div class="layui-input-block">
|
<input id="qty" type="text" lay-verify="" disabled placeholder="" class="layui-input">
|
</div>
|
</div>
|
</td>
|
</tr>
|
<tr style="width: 100%;">
|
<td class="" colspan="2" style="">
|
<div class="layout-radio">
|
<label class="layui-form-label">箱类型:</label>
|
<table border="" cellspacing="" cellpadding="">
|
<tr>
|
<td><input id="radioWhole" checked="true" style="" type="radio" name="boxType" lay-filter="boxTypeSel" value="whole">整箱</td>
|
<td><input id="radioScatter" type="radio" name="boxType" lay-filter="boxTypeSel" value="scatter">零头箱</td>
|
</tr>
|
</table>
|
</div>
|
</td>
|
</tr>
|
</table>
|
|
<table class="layout-tbl-submit" border="" cellspacing="" cellpadding="">
|
<tr>
|
<td>
|
<button class="layout-btn layout-btn-red" style="" type="button" lay-submit lay-filter="formBind">绑定到托盘</button>
|
</td>
|
<td>
|
<button id="btnScanBox" class="layout-btn layout-btn-blue" style="" type="button">扫描箱码</button>
|
</td>
|
</tr>
|
</table>
|
</form>
|
</div>
|
|
<div id="" class="cut-line" >
|
<img src="assets/fengexian.png" >
|
</div>
|
|
<div class="layout-tbl-paging" id="" >
|
<div id="" class="tbl-title">
|
<table class="layout-tbl-input" border="0" cellspacing="" cellpadding="" >
|
<tr>
|
<td>
|
<div class="layout-boxinfo">
|
<label class="layui-form-label" style="width: 35%;">托盘号:</label>
|
<div class="layui-input-block" style="width: 700%;">
|
<input id="palletCode" type="text" disabled placeholder=""
|
autocomplete="off" class="layui-input" style="margin-left: -30px;">
|
</div>
|
</div>
|
</td>
|
<td>
|
<div class="layout-boxinfo">
|
<label class="layui-form-label" style="color: #FF0000">箱子数量:</label>
|
<div class="layui-input-block">
|
<input id="boxNum" type="text" disabled placeholder=""
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
</td>
|
</tr>
|
</table>
|
</div>
|
<table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding="">
|
<tr><th>箱码</th><th>名称</th><th>数量</th><th>操作</th></tr>
|
<tr id="boxCell" style="display: none">
|
<td name="boxcode">AG000001</td>
|
<td name="name">疫苗名称名称名称</td>
|
<td name="num">30</td>
|
<td name="del">
|
<!-- <div id="" style="position: relative;" >
|
<img style="width: 60px;height: 28px;margin-bottom: 2px;" src="assets/del.png" >
|
<span style="position: absolute;top: 1px;left: 28px;color: #FFFFFF;;">删除</span>
|
</div> -->
|
<div id="" class="tbl-btn-del">
|
删除
|
</div>
|
</td>
|
</tr>
|
</table>
|
|
<!-- 分页 -->
|
<table id="tableBoxPages" class="tbl-box-pages" border="" cellspacing="" cellpadding="">
|
<tr style="display: ;">
|
<td class="page-prev">上一页</td>
|
<td class="page-num page-num-select">1</td>
|
<td class="page-num">2</td>
|
<td class="page-num">3</td>
|
<td class="page-num">4</td>
|
<td class="page-num">5</td>
|
<td class="page-next">下一页</td>
|
</tr>
|
</table>
|
</div>
|
</div>
|
</div>
|
|
|
<script src="js/jquery-3.5.1.min.js"></script>
|
<script src="layui/layui.js"></script>
|
<script src="js/public.js"></script>
|
<script src="js/jquery.cookie.js"></script>
|
<script>
|
layui.use(['form', 'jquery'], function() {
|
var form = layui.form
|
|
//当前分页
|
var curPageIndex = 1
|
|
//所选入库单的详细信息
|
//console.log($.cookie('userId'));
|
// if (!$.cookie('userId')) {
|
// layer.msg('登陆失效,请重新登陆', {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// }, function() {
|
// location.href = "login.html";
|
// //回调
|
// });
|
// }
|
|
function setBoxTypeSelect(value) {
|
if(value == 'whole'){
|
$('#radioWhole').prop('checked', true)
|
}else if (value == 'scatter'){
|
$('#radioScatter').prop('checked', true)
|
}
|
form.render('radio');
|
let v = $('input[name="boxType"]:checked').val();
|
//console.log("v is "+v)
|
}
|
|
function clear(){
|
$("#ImportQuantity").val("");
|
$("#ImportFactQuantity").val("");
|
// $("#STOCKCODE").val("");
|
// $("#BOXCODE").val("");
|
$("#GoodsCode").val("");
|
$("#GoodsName").val("");
|
$("#LotNo").val("");
|
$("#ImportQty").val("");
|
$("#qty").val("");
|
}
|
|
//是否存在某个入库单
|
function hasBill(list, billcode){
|
//console.log("hasBill list is "+list)
|
//console.log("hasBill billcode is "+billcode)
|
for (var i = 0; i < list.length; i++) {
|
//console.log("list["+i+"].ImportBillCode "+list[i].ImportBillCode)
|
if(list[i].ImportBillCode == billcode){
|
return true
|
}
|
}
|
return false
|
}
|
|
function getBar(selectedvalue) {
|
//console.log("here`````````````````````````")
|
|
// $("#ImportQuantity").val("");
|
// $("#ImportFactQuantity").val("");
|
// $("#STOCKCODE").val("");
|
// $("#BOXCODE").val("");
|
// $("#GoodsCode").val("");
|
// $("#GoodsName").val("");
|
// $("#LotNo").val("");
|
// $("#ImportQty").val("");
|
// $("#qty").val("");
|
|
if (selectedvalue) {
|
var param = {
|
ImportId: selectedvalue,
|
};
|
// sendData(IP + "/PdaInterface/GetImportNotify", param, 'post', function(res) {
|
// //console.log(res);
|
// $("#ImportQuantity").val(res.data.ImportQuantity);
|
// $("#ImportFactQuantity").val(res.data.ImportFactQuantity);
|
// $("#STOCKCODE").val('');
|
// $("#STOCKCODE").focus();
|
// });
|
|
//获取入库单详情
|
var param = {
|
"ImportBillCode": selectedvalue
|
}
|
//console.log("555555555555555 param is "+param)
|
// sendData(IP + "/PdaInterface/GetOrdDetailInfo", param, 'post', function(res) {
|
// //console.log("入库单详情:"+res.length)
|
// if (res.length > 0) { //成功
|
// var info = deepCopy(res)
|
// if($("#GoodsCode").val()){
|
// //如何物料编号不为空,则显示计划数量和已扫数量
|
// setOrderGoods(info, $("#GoodsCode").val())
|
// }else{
|
// $("#ImportQuantity").val('');
|
// $("#ImportFactQuantity").val('');
|
// }
|
// } else { //不成功
|
// layer.msg("未查询到该入库单信息", {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// }, function() {});
|
// }
|
// });
|
|
} else {
|
}
|
}
|
|
//根据箱码,从入库单中查询这个类型的产品的信息并赋值显示
|
function setOrderGoods(billInfo, goodsCode){
|
//console.log("setOrderGoods goodsCode: "+goodsCode)
|
$("#ImportQuantity").val('');
|
$("#ImportFactQuantity").val('');
|
for (var i = 0; i < billInfo.length; i++) {
|
//console.log("billInfo["+i+"].GoodsCode "+billInfo[i].GoodsCode)
|
if(billInfo[i].GoodsCode == goodsCode){
|
$("#ImportQuantity").val(billInfo[i].ImportQuantity);
|
$("#ImportFactQuantity").val(billInfo[i].ImportCompleteQuantity);
|
}
|
}
|
}
|
|
form.on('select(getbar)', function(data) {
|
//console.log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~select 被点击")
|
// alert(data.value)
|
// $("#barMask").show()
|
getBar(data.value);
|
});
|
|
form.on('radio(boxTypeSel)', function(data) {
|
//console.log(data.elem); //得到radio原始DOM对象
|
//console.log(data.value); //被点击的radio的value值
|
let t = data.value;//被点击的radio的value值
|
//console.log("radio 单选选中了:"+t)
|
let v = $('input[name="boxType"]:checked').val();
|
//console.log("v is "+v)
|
})
|
|
$("#menuImg").click(function(e){
|
//console.log("menuImg")
|
e.stopPropagation()
|
|
if($("#menuList").is(":hidden")){
|
$("#menuList").show()
|
}else{
|
$("#menuList").hide()
|
}
|
})
|
$('body').click(function(){
|
// //console.log("body")
|
$("#menuList").hide()
|
})
|
|
$('#btnScanBox').click(function(){
|
// $("#ImportQuantity").val('');
|
// $("#ImportFactQuantity").val('');
|
// $("#GoodsCode").val("");
|
// $("#GoodsName").val("");
|
// $("#LotNo").val("");
|
// $("#ImportQty").val("");
|
// $("#qty").val("");
|
// $("#BOXCODE").val("");
|
// document.activeElement.blur();
|
//$("#BOXCODE").focus();
|
if($("#BOXCODE").val()==""|| $("#BOXCODE").val()==null || $("#BOXCODE").val()==undefined){
|
layer.msg("请输入箱码!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
return;
|
}
|
checkBoxInfo();
|
})
|
|
$("#selectDiv").click(function(){
|
var input = $('select[id="bar"]').next().find('.layui-select-title input')
|
var val = input.val()
|
//console.log("---------------val is "+val)
|
//先更新一下入库单
|
updateBillList(function(data){
|
//console.log("selectDiv 2222222222222222222222222222")
|
// $('select[id="bar"]').next().find('.layui-select-title input').click()
|
$('select[id="bar"]').next().addClass('layui-form-selected')
|
|
$('select[id="bar"]').next().find('.layui-select-title input').val(val)
|
// $("#bar").val(val)
|
// input.focus()
|
// $('.layui-select-title').next().find("lay-value=["+val+"]").addClass("layui-this")
|
// if(val){
|
// $('dd[lay-value='+val+']').addClass("layui-this")
|
// }else{
|
// $('.layui-select-tips').addClass("layui-this")
|
// }
|
})
|
})
|
|
//更新入库单
|
function updateBillList(callback){
|
var input = $('select[id="bar"]').next().find('.layui-select-title input')
|
var val = input.val()
|
// var val = $("#bar").val()
|
//console.log("88888888888888888888888 val is "+val)
|
$("#bar").empty()
|
$("#bar").append('<option value =>' + '</option>');
|
form.render('select');
|
|
var param = {
|
OrdType: '009',
|
};
|
sendData(IP + "/PdaInterface/GetImportGoodsBar", param, 'post', function(res) {
|
//console.log("生产入库,入库单:"+res)
|
if (res.code == 1) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
// $("#bar").append('<option value =' + res.data[i].ImportId + '>' + res.data[i]
|
// .ImportBar +
|
// '</option>');
|
// if(res.data[i].ImportBillCode == val)
|
$("#bar").append('<option value =' + res.data[i].ImportBillCode + '>' + res.data[i]
|
.ImportBillCode +
|
'</option>');
|
}
|
form.render('select');
|
|
if(!val){
|
$('#bar').siblings("div.layui-form-select").find('dl').find('.layui-select-tips').addClass('layui-this')
|
}else{
|
var sel = 'dd[lay-value=' + val + ']';
|
$('#bar').siblings("div.layui-form-select").find('dl').find(sel).addClass('layui-this')
|
// $("#bar").val(val)
|
}
|
|
// billList = res.data
|
// $('select[id="bar"]').next().find('.layui-select-title input').click()
|
// $("#barMask").show()
|
callback(res.data)
|
} else { //不成功
|
// layer.msg(res.msg, {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// }, function() {});
|
}
|
});
|
}
|
|
var tmpBoxs = [
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
{
|
"BoxCode":"AG000001",
|
"GoodsName":"疫苗名称名称1号",
|
"Num":30
|
},
|
]
|
|
/*<tr id="boxCell" style="display: ">
|
<td>AG000001</td>
|
<td>疫苗名称名称名称</td>
|
<td>30</td>
|
<td>
|
<div id="" style="position: relative;" >
|
<img style="width: 60px;height: 28px;margin-bottom: 2px;" src="assets/del.png" >
|
<span style="position: absolute;top: 1px;left: 28px;color: #FFFFFF;;">删除</span>
|
</div>
|
</td>
|
</tr>*/
|
function refreshTable() {
|
//先清空一下箱子列表
|
let trs = $("#tableBoxList tr")
|
let len = trs.length
|
//console.log("tr 数量 + " + trs.length)
|
for(i=len - 1; i >=2; i--){
|
trs[i].remove();
|
}
|
|
//设置托盘号
|
$("#palletCode").val($.cookie('stockCode'))
|
|
var param = {
|
// stockCode: $.cookie('stockCode')
|
palno: $.cookie('stockCode')
|
};
|
sendData(IP + "/PdaInterface/GetPalnoDetailInfo", param, 'post', function(res) {
|
//console.log("3333333333 "+JSON.stringify(res));
|
if (res.length > 0) { //成功
|
$("#boxNum").val(res.length)
|
var list = res
|
var arrTrs = new Array()
|
let idx = 0
|
for(var i in list) {
|
// list[i].BoxCode
|
var tr = $("#boxCell").eq(0).clone();
|
tr.appendTo("#tableBoxList");
|
tr.attr('id', list[i].BoxCode)
|
idx++;
|
tr.attr('index', idx)
|
tr.find("td[name='boxcode']").html(list[i].BoxCode);
|
tr.find("td[name='name']").html(list[i].GoodsName);
|
tr.find("td[name='num']").html(list[i].Qty);
|
var code = list[i].BoxCode
|
//console.log("code is "+code)
|
tr.find("td[name='del']").click(function(){
|
//console.log("ddddddddddddddd+" + $(this).attr('name'))
|
var elem = $(this).parent()
|
var boxcode = elem.attr('id')
|
//console.log("删除箱子按钮被点击 " + boxcode)
|
layer.alert("确定要从托盘上删除这个箱子吗?<br>" + boxcode, {
|
icon: 2,
|
time: 0, //2秒关闭(如果不配置,默认是3秒)
|
btn:['删除','取消'],
|
yes:function(index){
|
// //console.log("index is "+index)
|
layer.close(index)
|
|
// $("#tableBoxList tr:not(:first)").html("");
|
var param = {
|
palno: $.cookie('stockCode'),
|
boxno: boxcode
|
};
|
sendData(IP + "/PdaInterface/RemoveBoxHolds", param, 'post', function(res) {
|
//console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
// elem.remove()
|
// refreshTable();
|
});
|
|
elem.remove()
|
refreshTable();
|
//console.log("删除成功 elem is "+elem)
|
|
var param2 = {
|
"BoxCode": boxcode,
|
"OrderNo": ""
|
}
|
sendData(IP + "/PdaInterface/GetImportInfoByBoxCode", param2, 'post', function(res) {
|
//console.log("箱子信息 "+JSON.stringify(res));
|
if (res.code == 1) { //成功
|
$("#ImportQuantity").val(res.data.ImportQuantity)
|
$("#ImportFactQuantity").val(res.data.ImportFactQuantity)
|
//console.log("ImportFactQuantity is "+res.data.ImportFactQuantity)
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
$("#ImportQuantity").val("")
|
$("#ImportFactQuantity").val("")
|
$("#BOXCODE").focus();
|
});
|
}
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
// $("#tableBoxList").find("tr[id="+boxcode+"]").remove()
|
}
|
})
|
})
|
// //console.log("boxcode is "+tr.find("td[name='boxcode']").html())
|
tr.show();
|
arrTrs[i] = tr
|
}
|
|
//设置分页
|
setPages(1, list.length)
|
} else { //不成功
|
layer.msg("无数据", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
$("#boxNum").val(0)
|
setPages(1, 0)
|
}
|
// $("#boxCnt").html("当前托盘上的箱子数量:"+res.length)
|
});
|
}
|
|
//设置分页
|
function setPages(pageIndex, boxNum){
|
if(boxNum <= 0){
|
//列表为空,隐藏分页页码
|
$("#tableBoxPages").hide()
|
return
|
}
|
|
let pageNum = Math.floor(boxNum / 10);
|
if(boxNum % 10 > 0){
|
pageNum += 1;
|
}
|
//console.log("pageNum is " + pageNum)
|
|
$("#tableBoxPages").find("tr").remove()
|
let table = $("#tableBoxPages")
|
$("<tr></tr>").appendTo("#tableBoxPages")
|
|
// let newTr = table.append("<tr></tr>")
|
// newTr.append("<td class='page-prev'>上一页</td>")
|
$("<td id='prevPage' class='page-prev'>上一页</td>").appendTo("#tableBoxPages tr")
|
$("#tableBoxPages tr").eq(0).find("td[id^='prevPage']").click(function(){
|
onClickPrevPage()
|
})
|
for(i=1; i < pageNum + 1; i++){
|
// newTr.append("<td class='page-num'>"+ i +"</td>")
|
$("<td class='page-num'>"+ i +"</td>").appendTo("#tableBoxPages tr")
|
}
|
// newTr.append("<td class='page-next'>下一页</td>")
|
$("<td id='nextPage' class='page-next'>下一页</td>").appendTo("#tableBoxPages tr")
|
$("#tableBoxPages tr").eq(0).find("td[id^='nextPage']").click(function(){
|
onClickNextPage()
|
})
|
// pages.show()
|
$("#tableBoxPages").show()
|
|
setCurPage(1)
|
}
|
|
//设置当前分页
|
function setCurPage(pageIndex){
|
// var list = tmpBoxs
|
// var arrTrs = new Array()
|
// let idx = 0
|
// for(var i in list) {
|
// // list[i].BoxCode
|
// var tr = $("#boxCell").eq(0).clone();
|
// tr.appendTo("#tableBoxList");
|
// tr.attr('id', list[i].BoxCode)
|
// idx++
|
// //console.log("idx is "+idx)
|
// tr.attr('index', idx)
|
// tr.find("td[name='boxcode']").html(list[i].BoxCode);
|
// tr.find("td[name='name']").html(list[i].GoodsName);
|
// tr.find("td[name='num']").html(list[i].Num);
|
// var code = list[i].BoxCode
|
// //console.log("code is "+code)
|
|
// // //console.log("boxcode is "+tr.find("td[name='boxcode']").html())
|
// tr.show();
|
// arrTrs[i] = tr
|
// }
|
|
// setPages(1, list.length)
|
|
let totalTrNum = $("#tableBoxList tr").length
|
if(totalTrNum <= 2 ){
|
//console.log("tableBoxList 为空 totalTrNum: " + totalTrNum)
|
//curPageIndex = 1
|
return
|
}
|
|
let pageNum = getBoxPageNum()
|
if(pageIndex > pageNum){
|
//console.log("设置的页码超出页数, pageIndex : " + pageIndex)
|
//curPageIndex = 1
|
return
|
}
|
|
let startIndex = (pageIndex - 1) * 10 + 1
|
let n = totalTrNum - startIndex
|
let endIndex = 0
|
if(n > 9){
|
endIndex = startIndex + 9
|
}else{
|
endIndex = startIndex + n
|
}
|
//console.log("startIndex is "+startIndex)
|
//console.log("endIndex is "+endIndex)
|
//startIndex =2
|
//endIndex = 2
|
let trs = $("#tableBoxList tr")
|
//console.log("行数 "+trs.length)
|
let d = 0
|
for(let i = 2; i < trs.length; i++){
|
//console.log("行索引 " + trs.eq(i).attr('index'))
|
let t = trs.eq(i)
|
d = t.attr('index')
|
if(d >= startIndex && d <= endIndex){
|
//console.log("需要显示")
|
//显示行
|
t.show()
|
}else{
|
//隐藏行
|
t.hide()
|
}
|
}
|
|
curPageIndex = pageIndex
|
|
let ptr = $("#tableBoxPages tr")
|
for(let i = 1; i < pageNum+1; i++){
|
ptr.eq(0).find("td").eq(i).removeClass("page-num-select")
|
if(i == curPageIndex){
|
ptr.eq(0).find("td").eq(i).addClass("page-num-select")
|
}
|
}
|
//console.log("totalTrNum is " + totalTrNum)
|
}
|
|
function onClickPrevPage(){
|
//console.log("上一页按钮被点击")
|
if(curPageIndex == 1){
|
return
|
}
|
setCurPage(curPageIndex - 1)
|
}
|
|
function onClickNextPage(){
|
//console.log("下一页按钮被点击")
|
let n = getBoxPageNum()
|
if(curPageIndex == n){
|
return
|
}
|
setCurPage(curPageIndex + 1)
|
}
|
|
function getBoxPageNum()
|
{
|
let num = $("#tableBoxList tr").length
|
if(num <= 2 ){
|
return 0
|
}
|
|
let pageNum = Math.floor(num / 10);
|
if(num % 10 > 0){
|
pageNum += 1;
|
}
|
|
return pageNum
|
}
|
|
//检查托盘状态
|
function checkPalletStat(){
|
var list = tmpBoxs
|
|
// //console.log("box num is "+$("#tableBoxList tr").length)
|
// return;
|
var param = {
|
"palno": $("#STOCKCODE").val()
|
}
|
sendData(IP + "/PdaInterface/GetPalnoStatus", param, 'post', function(res) {
|
//console.log("托盘状态:"+res.msg)
|
if (res.msg == "有效托盘") { //成功
|
// $("#BOXCODE").val("");
|
$.cookie('stockCode', $("#STOCKCODE").val());
|
refreshTable()
|
// $("#BOXCODE").focus();
|
} else { //不成功
|
layer.msg("无效托盘", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
}
|
|
//当托盘条码输入框失去焦点时,检查一下托盘状态
|
$("#STOCKCODE").blur(function(){
|
// setPages(1,8)
|
// setCurPage(1)
|
// return
|
//console.log("0000000000000")
|
if($("#STOCKCODE").val() == ""){
|
return
|
}
|
checkPalletStat()
|
})
|
|
// $("#bar").focus();
|
$("#STOCKCODE").keydown(function(e) {
|
//console.log("e.keyCode is "+e.keyCode)
|
//console.log("bar val is "+$('select[id="bar"]').next().find('.layui-select-title input').val())
|
if (e.keyCode === 13) {
|
// if($("#bar").val() == "")
|
// {
|
// //console.log("bar val is "+$("#bar").val())
|
// layer.msg("请先选择入库单", {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// })
|
// $("#STOCKCODE").val("");
|
// return;
|
// }
|
|
if($("#STOCKCODE").val() == ""){
|
return
|
}
|
|
//检查托盘状态
|
checkPalletStat();
|
}
|
});
|
|
//检查箱子信息
|
function checkBoxInfo(){
|
// if (!$.cookie('userId')) {
|
// layer.msg('登陆失效,请重新登陆', {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// }, function() {
|
// location.href = "login.html";
|
// //回调
|
// });
|
// }
|
|
// if($("#bar").val() == "")
|
// {
|
// //console.log("2222222222222bar val is "+$("#bar").val())
|
// layer.msg("请先选择入库单", {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// })
|
// $("#BOXCODE").val("");
|
// return;
|
// }
|
|
if($("#BOXCODE").val() == ""){
|
return
|
}
|
|
let input = $('select[id="bar"]').next().find('.layui-select-title input')
|
let val = input.val()
|
if(val == ""){
|
layer.msg("请先选择入库单", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
})
|
return
|
}
|
|
var param = {
|
"boxNo": $("#BOXCODE").val(),
|
// "ImportId": $("#bar").val()
|
"orderNo": val
|
}
|
sendData(IP + "/PdaInterface/GetBoxNoInfo", param, 'post', function(res) {
|
//console.log("res is "+JSON.stringify(res));
|
if (res.code == 1) { //成功
|
// if(!hasBill(res.data.ImportBillCode)){
|
// layer.msg("未找到箱码对应的入库单",{
|
// icon:2,
|
// time:3000
|
// })
|
// // clear()
|
// return
|
// }
|
// if(res.data.ImportBillCode != $("#bar").val())
|
// {
|
// //箱码与所选入库单不匹配
|
// layer.alert("箱码与所选入库单不匹配,箱码所属入库单为<br>"+res.data.ImportBillCode+"<br>是否切换为该入库单", {
|
// icon: 2,
|
// time: 0, //2秒关闭(如果不配置,默认是3秒)
|
// btn:['切换','取消'],
|
// yes:function(index){
|
// //console.log("index is "+index)
|
// layer.close(index)
|
// // $("select[name='bar']").val(res.data.ImportBillCode)
|
// // $('select[name="bar"]').val("CPSCRK2022021314080345")
|
// $("#bar").val(res.data.ImportBillCode)
|
// form.render('select');
|
// getBar(res.data.ImportBillCode);
|
// }
|
// }, function() {
|
// //回调
|
// boxId = 0;
|
// $("#GoodsCode").val("");
|
// $("#GoodsName").val("");
|
// $("#LotNo").val("");
|
// $("#ImportQty").val("");
|
// $("#qty").val("");
|
// // $("#BOXCODE").val("");
|
// // document.activeElement.blur();
|
// })
|
// clear()
|
// return;
|
// }
|
|
boxId = res.data.Id;
|
$("#GoodsCode").val(res.data.GoodsCode);
|
$("#GoodsName").val(res.data.GoodsName);
|
$("#LotNo").val(res.data.LotNo);
|
// $("#ImportQty").val(res.data.ImportQty);
|
$("#qty").val(res.data.Qty);
|
$("#ImportQuantity").val(res.data.ImportQuantity)
|
$("#ImportFactQuantity").val(res.data.ImportFactQuantity)
|
//console.log("ImportFactQuantity is "+res.data.ImportFactQuantity)
|
|
//先更新一下入库单
|
updateBillList(function(list){
|
//console.log("selectDiv 2222222222222222222222222222")
|
if(hasBill(list, res.data.ImportBillCode)){
|
|
$('select[id="bar"]').next().find('.layui-select-title input').val(res.data.ImportBillCode)
|
getBar(res.data.ImportBillCode);
|
}else{
|
$('select[id="bar"]').next().find('.layui-select-title input').val('')
|
// $("#ImportQuantity").val('');
|
// $("#ImportFactQuantity").val('');
|
//未找到该入库单
|
layer.msg("未找到箱码对应的入库单",{
|
icon:2,
|
time:3000
|
})
|
}
|
})
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
boxId = 0;
|
$("#GoodsCode").val("");
|
$("#GoodsName").val("");
|
$("#LotNo").val("");
|
$("#ImportQty").val("");
|
$("#qty").val("");
|
// $("#BOXCODE").val("");
|
// document.activeElement.blur();
|
$("#BOXCODE").focus();
|
});
|
}
|
});
|
|
}
|
|
//当箱码输入框失去焦点时,检查一下箱子状态
|
// $("#BOXCODE").blur(function(){
|
// //console.log("0000000000000")
|
// if($("#BOXCODE").val() == ""){
|
// return
|
// }
|
// checkBoxInfo()
|
// })
|
|
var boxId = 0;
|
$("#BOXCODE").keydown(function(e) {
|
//console.log("e.keyCode is "+e.keyCode)
|
//console.log("bar val is "+$('select[id="bar"]').next().find('.layui-select-title input').val())
|
if (e.keyCode === 13) {
|
if($("#BOXCODE").val() == ""){
|
return
|
}
|
checkBoxInfo()
|
}
|
});
|
form.on('submit(formBind)', function(data) {
|
// $('input[name="boxType"]:checked').val("")
|
// $('#radioWhole').val('')
|
// $('#radioScatter').val('')
|
// form.render('radio')
|
// return
|
// if (!$.cookie('userId')) {
|
// layer.msg('登陆失效,请重新登陆', {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// }, function() {
|
// location.href = "login.html";
|
// //回调
|
// });
|
// }
|
let bval = $('select[id="bar"]').next().find('.layui-select-title input').val()
|
if (!bval) {
|
layer.msg('请选择入库单', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return;
|
}
|
if (!$("#STOCKCODE").val()) {
|
layer.msg('请扫描托盘条码', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return;
|
}
|
if (!$("#BOXCODE").val()) {
|
layer.msg('请扫描外箱条码', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return;
|
}
|
if (!$("#GoodsCode").val()) {
|
layer.msg('物料编号不能为空', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return;
|
}
|
let v = -1
|
let b = $('input[name="boxType"]:checked').val();
|
if(b == "whole"){
|
v = 0
|
}else if(b == "scatter"){
|
v = 1
|
}else{
|
layer.msg('请选择想类型', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return;
|
}
|
var param = {
|
// boxCode: $("#BOXCODE").val(),
|
// stockCode: $("#STOCKCODE").val(),
|
// Id: boxId,
|
// ImportId: $("#bar").val(),
|
// userId: $.cookie('userId'),
|
orderNo:bval,
|
ParentCode:$("#STOCKCODE").val(),
|
BoxCode:$("#BOXCODE").val(),
|
GoodId:$("#GoodsCode").val(),
|
LotNo:$("#LotNo").val(),
|
Qty:$("#qty").val(),
|
BulkTank:v
|
}
|
//console.log(data);
|
//console.log("绑定请求param is "+param);
|
sendData(IP + "/PdaInterface/OutBackConfirm", param, 'post', function(res) {
|
//console.log("res is "+JSON.stringify(res));
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
// $("#GoodsCode").val("");
|
// $("#GoodsName").val("");
|
// $("#LotNo").val("");
|
// $("#ImportQty").val("");
|
// $("#qty").val("");
|
// $("#BOXCODE").val("");
|
// $("#BOXCODE").focus();
|
// getBar($("#bar").val());
|
refreshTable()
|
|
$("#GoodsCode").val("");
|
$("#GoodsName").val("");
|
$("#LotNo").val("");
|
// $("#ImportQty").val(res.data.ImportQty);
|
$("#qty").val("");
|
|
var param2 = {
|
"boxNo": $("#BOXCODE").val(),
|
// "ImportId": $("#bar").val()
|
"orderNo": bval
|
}
|
sendData(IP + "/PdaInterface/GetBoxNoInfo", param2, 'post', function(res) {
|
if (res.code == 1) { //成功
|
$("#ImportQuantity").val(res.data.ImportQuantity)
|
$("#ImportFactQuantity").val(res.data.ImportFactQuantity)
|
//console.log("ImportFactQuantity is "+res.data.ImportFactQuantity)
|
}else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
$("#ImportQuantity").val("")
|
$("#ImportFactQuantity").val("")
|
// $("#BOXCODE").val("");
|
// document.activeElement.blur();
|
$("#BOXCODE").focus();
|
});
|
}
|
|
$("#BOXCODE").val("");
|
$("#BOXCODE").focus();
|
})
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
}
|
});
|
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
|
});
|
// form.verify({
|
// stock: [/^[\S]{6}$/, '托盘条码必须为六位字符']
|
// });
|
})
|
</script>
|
</body>
|
</html>
|