<!DOCTYPE html>
|
<html>
|
<head>
|
<meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" />
|
<meta charset="UTF-8" />
|
<!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=1, user-scalable=no" /> -->
|
<!-- <meta name="viewport" content="width=device-width, initial-scale=0.665" /> -->
|
<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: auto;
|
/* background-color: #009E94; */
|
}
|
.btn-ok-blue {
|
border: none;
|
color: #FFFFFF;
|
background-color: #0a93e3;
|
width: 48%;
|
height: 36px;
|
border-radius: 5px;
|
}
|
.btn-ok-red {
|
border: none;
|
color: #FFFFFF;
|
background-color: #9f1707;
|
width: 48%;
|
height: 36px;
|
border-radius: 5px;
|
}
|
.btn-ok-blue:active {
|
opacity: 0.8;
|
}
|
.btn-ok-red:active {
|
opacity: 0.8;
|
}
|
.layout-tab-page {
|
height: auto;
|
}
|
</style>
|
<link rel="stylesheet" href="/css/adapter.css" />
|
</head>
|
<body>
|
<div id="" class="main-content">
|
<div id="" class="layout-title">
|
<table border="" cellspacing="" cellpadding="">
|
<tr>
|
<td class="img-back"><a href="../index.html"><img src="/assets/back.jpg" ></a></td>
|
<td class="title-text" lang>拼托入库</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" lang>主页</a></li>
|
<!-- <li><a href="productEnterConfirm.html">入库信息确认</a></li> -->
|
<li><a href="../login.html" lang>重新登录</a></li>
|
</ul>
|
</div>
|
|
<div id="" class="layout-bill-info">
|
<form class="layui-form" action="" style="height: auto;">
|
<div id="" class="layui-form-item layout-dropdownlist">
|
<label class="layui-form-label" lang>入库单:</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 class="layui-form-item layout-dropdownlist" style="margin-top: 10px;">
|
<label class="layui-form-label">物料-批次:</label>
|
<div class="layui-input-block" id="goodDiv">
|
<select id="goodSelect" lay-filter="goodSelect" 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" lang>托盘条码:</label>
|
<div class="layui-input-block">
|
<input id="PalletNo" type="text" lay-verify="stock" lang langholder placeholder="请扫描托盘条码"
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
<div id="" class="layui-form-item layout-input" style="margin-top: 10px;">
|
<div id="layout-boxcode" class="layui-form-item layout-input">
|
<label class="layui-form-label">外箱条码:</label>
|
<div class="layui-input-block">
|
<input id="BoxNo" type="text" placeholder="请扫描外箱条码"
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
</div>
|
<div id="" class="layout-tab-page">
|
<table class="tbl-box-sim-info" border="" cellspacing="" cellpadding="">
|
<tr>
|
<td>
|
<div class="layui-form-item">
|
<label class="layui-form-label" style="width: 50%;">物料编号:</label>
|
<div class="layui-input-block" style="width: 50%;margin-left:50%;">
|
<input id="SkuNo" type="text" lay-verify="" disabled placeholder=""
|
class="layui-input" style="font-size: 12px;padding-left: 0;">
|
</div>
|
</div>
|
</td>
|
<td>
|
<div class="layui-form-item">
|
<label class="layui-form-label" style="width: 25%">批次:</label>
|
<div class="layui-input-block" style="width: 75%;margin-left:25%;">
|
<input id="LotNo" type="text" lay-verify="" disabled placeholder=""
|
class="layui-input" style="font-size: 12px;padding-left: 0;">
|
</div>
|
</div>
|
</td>
|
<td>
|
<div class="layui-form-item">
|
<label class="layui-form-label" style="width: 34%;">数量:</label>
|
<div class="layui-input-block" style="width: 66%;margin-left:34%;">
|
<input id="BoxQty" type="text" lay-verify="" disabled placeholder=""
|
class="layui-input" style="font-size: 12px;padding-left: 0;">
|
</div>
|
</div>
|
</td>
|
</tr>
|
<tr>
|
<td colspan="3">
|
<div class="layui-form-item">
|
<label class="layui-form-label" style="width: 17%;">物料名称:</label>
|
<div class="layui-input-block" style="width: 83%;margin-left:17%;">
|
<input id="SkuName" type="text" lay-verify="" disabled placeholder=""
|
class="layui-input" style="font-size: 12px; padding-left: 0;">
|
</div>
|
</div>
|
</td>
|
</tr>
|
</table>
|
</div>
|
</form>
|
<div id="" style="text-align: center;">
|
<button class="btn-ok-blue" type="button" lay-submit lay-filter="formBind">确认入库</button>
|
<!-- <button class="btn-ok-red" type="button" lay-submit lay-filter="formCancel">取消入库</button> -->
|
</div>
|
</div>
|
|
<div id="" class="cut-line" >
|
<img src="/assets/fengexian.png" >
|
</div>
|
|
<div class="layout-tbl-paging" id="" >
|
<table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding="">
|
<tr><th lang>箱码</th><th lang>名称</th><th lang>数量</th></tr>
|
<tr id="boxCell" style="display: none">
|
<td id="BoxNo" name="BoxNo">AG000001</td>
|
<td id="SkuName" name="SkuName">疫苗名称名称名称</td>
|
<td id="Qty" name="Qty">30</td>
|
<!-- <td name="del">
|
<div id="" class="tbl-btn-del" lang>
|
删除
|
</div>
|
</td> -->
|
</tr>
|
</table>
|
|
<!-- 分页 -->
|
<table id="tableBoxPages" class="tbl-box-pages" border="" cellspacing="" cellpadding="">
|
<tr >
|
<td class="page-prev" lang>上一页</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" lang>下一页</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/language.js"></script>
|
<script src="/js/jquery.cookie.js"></script>
|
<script>
|
layui.use(['form', 'jquery'], function() {
|
var form = layui.form
|
|
initLanguage()
|
setLanguage()
|
|
//当前分页
|
var curPageIndex = 1
|
var billList = null
|
var IsHuiKu=0 //是否回库,0:否 1:是
|
|
//点击入库单据下拉框事件
|
$("#selectDiv").click(function () {
|
var input = $('select[id="bar"]').next().find('.layui-select-title input')
|
var val = input.val()
|
//先更新一下入库单
|
updateBillList(function (data) {
|
$('select[id="bar"]').next().addClass('layui-form-selected')
|
$('select[id="bar"]').next().find('.layui-select-title input').val(val)
|
})
|
})
|
// 绑定入库单信息
|
function updateBillList(callback) {
|
var input = $('select[id="bar"]').next().find('.layui-select-title input')
|
var val = input.val()
|
$("#bar").empty()
|
$("#bar").append('<option value =>' + '</option>');
|
form.render('select');
|
|
var param = {
|
Type: "0,1"
|
};
|
sendData(IP + "/PdaAsn/GetArrivalNotices", param, 'post', function (res) {
|
if (res.code == 0) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
$("#bar").append('<option value =' + res.data[i].ASNNo + '>' + res.data[i]
|
.ASNNo +
|
'</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')
|
}
|
|
callback(res.data)
|
} else { //不成功
|
// layer.msg(res.msg, {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// }, function() {});
|
}
|
});
|
}
|
//点击物料下拉框事件
|
$("#goodDiv").click(function () {
|
if ($("#bar").val() == null || $("#bar").val() == "" || $("#bar").val() == undefined) {
|
layer.msg("请先选择入库单", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
}
|
})
|
//选中入库单事件
|
form.on('select(getbar)', function (data) {
|
updateGoodList()
|
});
|
// 绑定入库单物料及批次
|
function updateGoodList() {
|
console.log("aaaa");
|
var input = $('select[id="goodSelect"]').next().find('.layui-select-title input')
|
var val = input.val()
|
|
$("#goodSelect").empty()
|
$("#goodSelect").append('<option value =>' + '</option>');
|
|
var param = {
|
AsnNo: $("#bar").val(),
|
};
|
synData(IP + "/PdaAsn/GetArrivalNoticeDetails", param, 'post', function (res) {
|
if (res.code == 0) { //成功
|
asnDetails = res.data;
|
for (var i = 0; i < res.data.length; i++) {
|
if (i == 0) {
|
$("#goodSelect").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i]
|
.SkuName + "-" + res.data[i].LotNo +
|
'</option>');
|
} else {
|
$("#goodSelect").append('<option value =' + res.data[i].Id + '>' + res.data[i]
|
.SkuName + "-" + res.data[i].LotNo +
|
'</option>');
|
}
|
|
}
|
form.render('select');
|
|
if (!val) {
|
$('#goodSelect').siblings("div.layui-form-select").find('dl').find('.layui-select-tips').addClass('layui-this')
|
} else {
|
var sel = 'dd[lay-value=' + val + ']';
|
$('#goodSelect').siblings("div.layui-form-select").find('dl').find(sel).addClass('layui-this')
|
}
|
} else {
|
}
|
});
|
}
|
|
//当托盘条码输入框失去焦点时,检查一下托盘状态
|
$("#PalletNo").blur(function(){
|
checkPalletStat()
|
})
|
//当托盘条码输入库回车时
|
$("#PalletNo").keydown(function(e) {
|
if (e.keyCode === 13) {
|
//检查托盘状态
|
checkPalletStat();
|
}
|
});
|
//检查托盘状态
|
function checkPalletStat(){
|
if($("#PalletNo").val() == ""){
|
return
|
}
|
IsHuiKu=0
|
var param1 = {
|
"PalletNo": $("#PalletNo").val()
|
}
|
//获取托盘管理的入库单
|
sendData(IP + "/PdaAsn/GetASNNoByPalletNo", param1, 'post', function(res) {
|
if (res.code == 0) { //成功
|
if(res.data==''){
|
IsHuiKu=1
|
}
|
var param = {
|
"PalletNo": $("#PalletNo").val()
|
}
|
sendData(IP + "/PdaAsn/IsEnablePalletNo", param, 'post', function(res) {
|
if (res.code == 0) { //成功
|
$.cookie('PalletNo', $("#PalletNo").val());
|
refreshTable()
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//先清空一下箱子列表
|
let trs = $("#tableBoxList tr")
|
let len = trs.length
|
for(i=len - 1; i >=2; i--){
|
trs[i].remove();
|
}
|
});
|
}
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//先清空一下箱子列表
|
let trs = $("#tableBoxList tr")
|
let len = trs.length
|
for(i=len - 1; i >=2; i--){
|
trs[i].remove();
|
}
|
});
|
return
|
}
|
});
|
}
|
//渲染箱子列表
|
function refreshTable() {
|
//先清空一下箱子列表
|
let trs = $("#tableBoxList tr")
|
let len = trs.length
|
for(i=len - 1; i >=2; i--){
|
trs[i].remove();
|
}
|
//设置托盘号
|
$("#PalletNo").val($.cookie('PalletNo'))
|
|
var param = {
|
// PalletNo: $.cookie('PalletNo')
|
PalletNo: $.cookie('PalletNo'),
|
IsHuiKu : IsHuiKu
|
};
|
sendData(IP + "/PdaAsn/GetBoxInfos", param, 'post', function(res) {
|
if (res.code == 0) { //成功
|
$("#boxNum").val(res.length)
|
var list = res.data
|
var arrTrs = new Array()
|
let idx = 0
|
for(var i in list) {
|
var tr = $("#boxCell").eq(0).clone();
|
tr.appendTo("#tableBoxList");
|
tr.attr('id', list[i].BoxNo)
|
idx++;
|
tr.attr('index', idx)
|
tr.find("td[name='BoxNo']").html(list[i].BoxNo);
|
tr.find("td[name='SkuName']").html(list[i].SkuName);
|
tr.find("td[name='Qty']").html(list[i].Qty);
|
var code = list[i].BoxNo
|
|
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)
|
}
|
});
|
}
|
|
|
//当箱码输入框失去焦点时
|
$("#BoxNo").blur(function(){
|
readerBoxInfo()
|
})
|
//当箱码输入库回车时
|
$("#BoxNo").keydown(function(e) {
|
if (e.keyCode === 13) {
|
readerBoxInfo();
|
}
|
});
|
function readerBoxInfo() {
|
if($("#BoxNo").val() == ""){
|
return
|
}
|
$("#SkuNo").val('');
|
$("#SkuName").val('');
|
$("#LotNo").val('');
|
$("#BoxQty").val('');
|
var param = {
|
"boxNo": $("#BoxNo").val()
|
}
|
synData(IP + "/PdaAsn/GetBoxInfoByBoxNo", param, 'get', function (res) {
|
console.log(res);
|
if (res.code == 0) { //成功
|
$("#SkuNo").val(res.data.SkuNo);
|
$("#SkuName").val(res.data.SkuName);
|
$("#LotNo").val(res.data.LotNo);
|
$("#BoxQty").val(res.data.Qty);
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
}
|
});
|
}
|
|
//确认入库事件
|
form.on('submit(formBind)', function (data) {
|
if ($("#bar").val() == "") {
|
layer.msg('请选择入库单', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return;
|
}
|
if ($("#goodSelect").val() == "") {
|
layer.msg('请选择物料及明细', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return;
|
}
|
if ($("#PalletNo").val() == "") {
|
layer.msg('请扫描托盘条码', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return;
|
}
|
if ($("#BoxNo").val() == "") {
|
layer.msg('请扫描外箱条码', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return;
|
}
|
var param = {
|
AsnNo: $("#bar").val(),
|
PalletNo: $("#PalletNo").val(),
|
AsnDetailId: parseInt($("#goodSelect").val()),
|
BoxNo: $("#BoxNo").val()
|
}
|
//入库
|
sendData(IP + "/PdaAsn/CompleteInStockLing", param, 'post', function (res) {
|
if (res.code == 0) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2500 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
refreshTable();
|
$("#BoxNo").val('');
|
$("#SkuNo").val('');
|
$("#SkuName").val('');
|
$("#LotNo").val('');
|
$("#BoxQty").val('');
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2500 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
//回调
|
});
|
}
|
});
|
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
|
});
|
|
//设置分页
|
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){
|
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
|
}
|
|
$("#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()
|
})
|
})
|
|
</script>
|
</body>
|
</html>
|