<!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: auto;
|
/* background-color: #009E94; */
|
}
|
.layout-tbl-submit {
|
margin-top: 10px;
|
}
|
/* .out-scatter-num {
|
background-color: #009688;
|
|
} */
|
.out-scatter-num .local-input {
|
width: 40%;
|
height: 25px;
|
float: left;
|
}
|
.out-scatter-num .local-ok button {
|
height: 25px;
|
border: 0;
|
color: #FFFFFF;
|
background-color: #0a93e3;
|
border-radius: 3px;
|
padding: 2px;
|
margin-left: 10px;
|
width: 100%;
|
}
|
.out-scatter-num .layui-form-label {
|
width: 30%;
|
/* background-color: #007BFF; */
|
}
|
.out-scatter-num .layui-input-block {
|
width: 100%;
|
/* background-color: #009E94; */
|
margin-left: 0;
|
}
|
.out-scatter-num .local-ok {
|
width: 20%;
|
height: 25px;
|
float: left;
|
}
|
.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-tbl-paging {
|
margin-top: 20px;
|
}
|
.foot-container {
|
text-align: center;
|
}
|
.layout-tab-page {
|
height: auto;
|
}
|
.layui-form-checkbox {
|
margin: auto;
|
/* padding-left: 2px; */
|
/* padding-right: 2px; */
|
}
|
.div-tbl-title {
|
width: 98%;
|
margin: auto;
|
/* background-color: #4476A7; */
|
height: 30px;
|
}
|
.div-tbl-title table {
|
width: 100%;
|
height: 30px;
|
}
|
td{
|
word-break: break-all; word-wrap:break-word;
|
}
|
#tabShow::-webit-scrollbar{
|
display: none;
|
}
|
</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">创建入库单</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="" style="height: auto;">
|
|
<div id="layout-wavebill" class="layui-form-item layout-dropdownlist" >
|
<label class="layui-form-label">单据类型:</label>
|
<div class="layui-input-block" id="selectWaveDiv">
|
<select id="billType" lay-filter="billType" lay-search>
|
<option value=""></option>
|
</select>
|
<img src="/assets/down_arraw.png" >
|
</div>
|
</div>
|
<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="customer" lay-filter="customer" lay-search>
|
<option value=""></option>
|
</select>
|
<img src="/assets/down_arraw.png" >
|
</div>
|
</div>
|
|
|
<div id="" class="layout-tab-page">
|
|
<div class="layui-form-item layout-dropdownlist" style="margin-top: 10px;">
|
<label class="layui-form-label">物料名称:</label>
|
<div class="layui-input-block" >
|
<select id="goodSelect" lay-filter="goodSelect" lay-search>
|
<option value=""></option>
|
</select>
|
<img src="/assets/down_arraw.png" >
|
</div>
|
</div>
|
|
<div id="layout-pallet" class="layui-form-item layout-input">
|
<label class="layui-form-label">批次号:</label>
|
<div class="layui-input-block">
|
<input id="lotNo" type="text" lay-verify="lotNo" placeholder="请输入批次"
|
autocomplete="off" class="layui-input" style="height:24px">
|
</div>
|
</div>
|
<table id="outHalf" class="layout-tab-content" border="" cellspacing="" cellpadding="">
|
|
<tr id="outScatter">
|
<td>
|
<div id="layout-boxcode" class="layui-form-item out-scatter-num">
|
<label class="layui-form-label" style="width: 21%;">入库数量:</label>
|
<div id="" class="local-input" >
|
<div class="layui-input-block" >
|
<input id="ImQty" type="number" placeholder="请输入入库数量"
|
autocomplete="off" class="layui-input" style="padding-left:0.1rem;" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">
|
</div>
|
</div>
|
<div id="" class="local-ok" >
|
<button type="button" lay-submit lay-filter="formPickScatter">确认</button>
|
</div>
|
</div>
|
</td>
|
</tr>
|
</table>
|
<div id="" style="text-align: right;margin-top: 10px;">
|
<div id="" class="cut-line" >
|
<img src="/assets/fengexian.png" >
|
</div>
|
</div>
|
</div>
|
|
</form>
|
</div>
|
|
<div class="layout-tbl-paging" id="tabShow" style="overflow-y:auto;overflow-x:hidden; ">
|
<table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding="">
|
<tr id="tableHead">
|
<th style="width: 21%;">编码</th>
|
<th style="width: 32%;">名称</th>
|
<th style="width: 22%;">批次</th>
|
<th name="hpicknum" style="width: 15%;">数量</th>
|
<th lang style="width: 10%;">操作</th>
|
</tr>
|
<tr class="boxCell" style="display: none;">
|
<td name="goodCode">AG00000asdfdsaf1</td>
|
<td name="goodName">疫苗名称名称</td>
|
<td name="lotNo">30</td>
|
<td name="qty">30</td>
|
<td name="del">
|
<div id="" class="tbl-btn-del" lang>
|
删除
|
</div>
|
</td>
|
</tr>
|
</table>
|
|
<!-- 按钮提交 -->
|
<div style="width:100%; text-align: center; margin-top: 5px;">
|
<button class="layout-btn layout-btn-red" lang type="button" lay-submit lay-filter="formBind"
|
style="width: 50%; ">提交</button>
|
</div>
|
</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 tableData = new Array();
|
var canPickBox = true
|
// $("#STOCKCODE").focus();
|
//判断是否有登录信息
|
//console.log($.cookie('userId'));
|
if (!$.cookie('token')) {
|
layer.msg('登陆失效,请重新登陆', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
location.href = "/View/login.html";
|
//回调
|
});
|
}
|
|
Init();
|
function clear(){
|
|
$("#lotNo").val("");
|
$("#ImQty").val("");
|
}
|
|
//初始化渲染 入库单据类型
|
function InitBillTypeList(){
|
$("#billType").empty()
|
$("#billType").append('<option value =>' + '</option>');
|
form.render('select');
|
var param = {
|
type:"入"
|
};
|
synData(IP + "/PdaInterface/GetImExBillType", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
if (i == 0) {
|
$("#billType").append('<option value =' + res.data[i].BillTypeCode + ' selected>' + res.data[i].BillTypeName+'</option>');
|
}else{
|
$("#billType").append('<option value =' + res.data[i].BillTypeCode + '>' + res.data[i].BillTypeName+'</option>');
|
}
|
}
|
form.render('select');
|
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
}
|
});
|
}
|
|
//初始化渲染 客户下拉框
|
function InitCustomerList(){
|
|
$("#customer").empty()
|
$("#customer").append('<option value =>' + '</option>');
|
form.render('select');
|
|
var param = {};
|
synData(IP + "/PdaInterface/GetCustomer", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
// if (i==0) {
|
// $("#customer").append('<option value =' + res.data[i].CustomerCode + ' selected>' + res.data[i].CustomerName+ '</option>');
|
// } else {
|
// $("#customer").append('<option value =' + res.data[i].CustomerCode + '>' + res.data[i].CustomerName + '</option>');
|
// }
|
$("#customer").append('<option value =' + res.data[i].CustomerCode + '>' + res.data[i].CustomerName + '</option>');
|
}
|
form.render('select');
|
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
}
|
});
|
}
|
|
//初始化渲染 物料下拉框
|
function InitGoodList(){
|
$("#goodSelect").empty()
|
$("#goodSelect").append('<option value =>' + '</option>');
|
form.render('select');
|
|
var param = {};
|
sendData(IP + "/PdaInterface/GetGoodList", param, 'post', function(res) {
|
// console.log(JSON.stringify(res))
|
if (res.code == 1) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
// if (i ==0) {
|
// $("#goodSelect").append('<option value =' + res.data[i].GoodCode + ' selected>' + res.data[i].GoodName +'</option>');
|
// } else {
|
// $("#goodSelect").append('<option value =' + res.data[i].GoodCode + '>' + res.data[i].GoodName +'</option>');
|
// }
|
$("#goodSelect").append('<option value =' + res.data[i].GoodsCode + '>' + res.data[i].GoodsName +'</option>');
|
}
|
form.render('select');
|
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
}
|
|
//渲染表格数据
|
function refreshTable(list) {
|
//先清空一下信息列表
|
let trs = $("#tableBoxList tr")
|
let len = trs.length
|
console.log("tr 数量 + " + trs.length)
|
for(i=len - 1; i >=2; i--){
|
trs[i].remove();
|
}
|
|
// var list = tableData;
|
console.log(list );
|
if (list != null && list.length > 0) { //成功
|
|
var arrTrs = new Array()
|
let idx = 0
|
for(var i in list) {
|
var tr = $(".boxCell").eq(0).clone();
|
tr.appendTo("#tableBoxList");
|
tr.attr('good', list[i].GoodsCode)
|
tr.attr('lotno', list[i].ImportLotNo)
|
idx++;
|
tr.attr('index', idx)
|
tr.find("td[name='goodCode']").html(list[i].GoodsCode);
|
tr.find("td[name='goodName']").html(list[i].GoodsName);
|
tr.find("td[name='lotNo']").html(list[i].ImportLotNo);
|
tr.find("td[name='qty']").html(list[i].ImportQuantity);
|
tr.find("td[name='del']").click(function () {
|
|
var elem = $(this).parent()
|
console.log(elem);
|
var num = elem.attr('index')
|
var goodcode = elem.attr('good')
|
var lotno = elem.attr('lotno')
|
console.log("删除箱子按钮被点击 " + goodcode+lotno)
|
layer.confirm("确定要从托盘上删除这个批次的物料吗?<br>" + goodcode, {
|
icon: 2,
|
time: 0, //2秒关闭(如果不配置,默认是3秒)
|
btn: ['删除', '取消'],
|
yes: function (index) {
|
|
var s = 0;
|
tableData.forEach(d => {
|
if ( tableData[s].GoodsCode == goodcode && tableData[s].ImportLotNo == lotno) {
|
tableData.splice(s,1);
|
if (s!=0) {
|
s--;
|
}
|
}else{
|
s++;
|
}
|
});
|
refreshTable(tableData);
|
parent.layer.close(index);//关闭当前页
|
// $("#tableBoxList").find("tr[index="+num+"]").remove()
|
}
|
})
|
})
|
tr.show();
|
arrTrs[i] = tr
|
}
|
|
}
|
}
|
|
//添加明细(确认按钮)
|
form.on('submit(formPickScatter)', function(data) {
|
if (!$.cookie('userId')) {
|
layer.msg('登陆失效,请重新登陆', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
location.href = "login.html";
|
//回调
|
});
|
}
|
if($('#goodSelect').val() == ""){
|
layer.msg("请选择入库物料", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
return
|
}
|
if($('#lotNo').val() == ""){
|
layer.msg("请输入批次号", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
return
|
}
|
if($('#ImQty').val() == ""){
|
layer.msg("请输入入库数量", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
return
|
}
|
var item = {
|
GoodsCode:$('#goodSelect').val(),
|
GoodsName:$('#goodSelect option:selected').text(),
|
ImportLotNo:$('#lotNo').val(),
|
ImportQuantity:$('#ImQty').val()
|
};
|
var isHave = false;
|
tableData.forEach(d => {
|
if (d.GoodsCode == item.GoodsCode && d.LotNo == item.ImportLotNo) {
|
isHave = true;
|
}
|
});
|
if (isHave == true) {
|
layer.msg("当前物料已有此批次,请核实", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return
|
}else{
|
tableData.push(item);
|
refreshTable(tableData);
|
clear();
|
InitGoodList();
|
}
|
|
|
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
|
});
|
|
//添加单据(提交按钮)后端交互
|
form.on('submit(formBind)', function(data) {
|
if (!$.cookie('userId')) {
|
layer.msg('登陆失效,请重新登陆', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
location.href = "login.html";
|
//回调
|
});
|
}
|
|
if($('#billType').val() == ""){
|
layer.msg("请选择入库单据类型", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
return
|
}
|
if(tableData.length == 0){
|
layer.msg("单据明细信息为空,请填写!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
return
|
}
|
if (canPickBox == true) {
|
canPickBox = false;
|
var model = {
|
ImportBillType:$("#billType").val(),
|
ImportCustomerName:$("#customer").val(),
|
List:tableData
|
};
|
var param = {
|
notifyList:model,
|
userid:$.cookie('userId'),
|
source:"PDA"
|
};
|
sendData(IP + "/PdaInterface/AddImportNotify", param, 'post', function(res) {
|
console.log("出库:"+JSON.stringify(res))
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
clear();
|
Init();
|
tableData= new Array();
|
refreshTable(tableData);
|
canPickBox = true;
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {canPickBox = true;});
|
}
|
});
|
}else{
|
layer.msg("请求未完成,不要重复请求", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
}
|
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
|
});
|
|
// form.verify({
|
// stock: [/^[\S]{6}$/, '托盘条码必须为六位字符']
|
// });
|
|
|
//------------------------------------------------------------------------------------------------------------------
|
//主页及重新登录
|
$("#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()
|
})
|
|
function Init() {
|
InitBillTypeList();
|
InitCustomerList();
|
InitGoodList();
|
}
|
})
|
</script>
|
</body>
|
</html>
|