<!DOCTYPE html>
|
<html>
|
|
<head>
|
<meta charset="utf-8">
|
<title>新增组盘信息</title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport"
|
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
<link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
|
<style>
|
.rightMargin {
|
margin-right: 0px;
|
}
|
|
.buJu {
|
margin-top: 10px;
|
display: flex;
|
flex-direction: row-reverse;
|
}
|
|
.beiJing {
|
background-color: #fafafa;
|
padding-top: 5px;
|
border-radius: 3px;
|
box-shadow: inset 0 0 3px 1px #ccc;
|
}
|
|
/* 表格下拉小箭头隐藏 */
|
.layui-table-grid-down {
|
display: none;
|
}
|
</style>
|
</head>
|
|
<body>
|
|
<div class="layui-fluid" style="padding: 3px;">
|
<div class="layui-card">
|
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
|
<div class="layui-form-item">
|
<div class="layui-inline" style="margin-right: 0;">
|
<label class="layui-form-label" style="width: 60px;">箱 号</label>
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<input type="text" id="BoxNo" name="BoxNo" placeholder="箱号" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline" style="margin-right: 0;">
|
<label class="layui-form-label" style="width: 60px;">盒 号</label>
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<input type="text" id="BoxNo2" name="BoxNo2" placeholder="盒号" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline" style="margin-right: 0;">
|
<label class="layui-form-label" style="width: 60px;">支 号</label>
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<input type="text" id="BoxNo3" name="BoxNo3" placeholder="支号" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline" style="margin-right: 0;">
|
<label class="layui-form-label" style="width: 60px;">物品编号</label>
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<input type="text" id="SkuNo" name="SkuNo" placeholder="物料编号" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline" style="margin-right: 0;">
|
<label class="layui-form-label" style="width: 60px;">批次号</label>
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<input type="text" id="LotNo" name="LotNo" placeholder="批次号" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
</div>
|
<div class="layui-inline" style="margin-right: 0;">
|
<label class="layui-form-label" style="width: 60px;">批次描述</label>
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<input type="text" id="LotText" name="LotText" placeholder="批次描述" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
</div>
|
<div class="layui-inline" style="margin-right: 0;">
|
<label class="layui-form-label" style="width: 60px;">实际数量</label>
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<input type="number" id="Qty" name="Qty" placeholder="实际数量" autocomplete="off"
|
class="layui-input" min="0" value="0" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">
|
</div>
|
</div>
|
|
<div class="layui-inline" style="margin-right: 0;">
|
<label class="layui-form-label">生产日期</label>
|
<div class="layui-input-inline">
|
<input type="text" autocomplete="off" name="ProductionTime" id="ProductionTime"
|
class="layui-input" placeholder="生产日期">
|
</div>
|
</div>
|
|
|
<div class="layui-inline" style="margin-right: 0;">
|
<label class="layui-form-label">检验标记</label>
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<select name="InspectMark" id="InspectMark" lay-filter="InspectMark" lay-search>
|
<option value=""></option>
|
<option value="0">否</option>
|
<option value="1">是</option>
|
|
</select>
|
</div>
|
</div>
|
</div>
|
<div class="layui-inline" style="margin-right: 0;">
|
<label class="layui-form-label" style="width: 60px;">零箱标记</label>
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<div class="layui-input-inline" style="margin-right: 0;">
|
<select name="BitBoxMark" id="BitBoxMark" lay-filter="BitBoxMark" lay-search>
|
<option value=""></option>
|
<option value="0">否</option>
|
<option value="1">是</option>
|
</select>
|
</div>
|
</div>
|
</div>
|
|
<div class="layui-inline">
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit
|
lay-filter="LAY-app-contlist-search">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索
|
</button>
|
</div>
|
</div>
|
</div>
|
<div class="layui-card-body">
|
<!-- <button type="button" class="layui-btn layui-btn-sm" id="daoru1">
|
导入
|
</button> -->
|
<table id="Box-list" lay-filter="Box-list"></table>
|
|
<script type="text/html" id="toolbarDemo">
|
<button style="margin-right: 5px;" class="layui-btn layui-btn-sm layuiadmin-btn-list addClass" lay-event="add" >
|
<i class="layui-icon"></i>添加
|
</button>
|
|
<button style="margin-right: 5px;" id="daoru" class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-event="import" >
|
<i class="layui-icon"></i>导入
|
</button>
|
</script>
|
|
<script type="text/html" id="toolbarDemoList">
|
{{# function GetBtn2(d){
|
var html = '';
|
if(d.Origin == "录入" || d.Origin == "导入"){
|
html = `<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">
|
<i class="layui-icon layui-icon-delete"></i>删除</a>`;
|
|
}
|
return html;
|
}
|
}}
|
{{ GetBtn2(d) }}
|
</script>
|
</div>
|
|
</div>
|
</div>
|
|
|
<script src="../../layuiadmin/layui/layui.js"></script>
|
<script src="../../js/public.js"></script>
|
<script src="../../js/jquery-3.5.1.min.js"></script>
|
<script src="../../js/jquery.cookie.js"></script>
|
<script>
|
layui.extend({
|
excel: '../../layuiadmin/layui/layui_exts/excel' // {/}的意思即代表采用自有路径,即不跟随 base 路径
|
})
|
|
layui.config({
|
base: '../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index' //主入口模块
|
}).use(['index', 'form', 'layer', 'table', 'laydate', 'upload', 'excel'], function () {
|
var form = layui.form,
|
table = layui.table,
|
layer = layui.layer,
|
laydate = layui.laydate;
|
var upload = layui.upload;
|
|
laydate.render({
|
elem: '#ProductionTime'
|
, format: 'yyyy-MM-dd' //可任意组合
|
});
|
|
// 页面加载绑定Table
|
bindTable();
|
|
// 搜索方法
|
form.on('submit(LAY-app-contlist-search)', function (data) {
|
bindTable();
|
|
});
|
// 添加导入按钮单机事件
|
table.on('toolbar(Box-list)', function (obj) {
|
switch (obj.event) {
|
case 'add': // 添加箱支关系
|
// 代码区域
|
var param = getBoxInforVlues();
|
if (param != "") {
|
console.log(param);
|
sendData(IP + "/BllAsn/AddBllBoxInfo", param, 'post', function (res) {
|
if (res.code == 0) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
bindTable();
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { doing = true });
|
}
|
});
|
}
|
break;
|
|
default: break;
|
}
|
});
|
|
|
// 删除箱支信息
|
table.on('tool(Box-list)', function (obj) {
|
var data = obj.data;
|
switch (obj.event) {
|
case "del":
|
layer.confirm('确定删除箱支明细吗?', function (index) {
|
// 代码区域
|
var param = {
|
Id: data.Id,
|
Status: "0",
|
};
|
console.log(param);
|
sendData(IP + "/BllAsn/DelBllBoxInfo", param, 'post', function (res) {
|
if (res.code == 0) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
bindTable();
|
doing = true
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { doing = true });
|
}
|
});
|
});
|
|
break;
|
default: break;
|
}
|
});
|
|
//#region 事件方法
|
// 查询录入的箱支关系
|
function bindTable() {
|
var param = {
|
BoxNo: $("#BoxNo").val(),
|
BoxNo2: $("#BoxNo2").val(),
|
BoxNo3: $("#BoxNo3").val(),
|
SkuNo: $("#SkuNo").val(),
|
LotNo: $("#LotNo").val(),
|
LotText: $("#LotText").val(),
|
ProductionTime: $("#ProductionTime").val(),
|
InspectMark: $("#InspectMark").val(),
|
BitBoxMark: $("#BitBoxMark").val(),
|
// Origin: "录入",
|
};
|
|
table.render({
|
elem: '#Box-list',
|
url: IP + "/BllAsn/GetBllBoxInfoList",
|
method: 'POST',
|
height: 'full-136',
|
id: 'Box-list',
|
where: param,
|
contentType: 'application/json',
|
toolbar: '#toolbarDemo',
|
defaultToolbar: ['filter'], //'print', 'exports'
|
headers: { ToKen: $.cookie('token') },
|
page: true,
|
even: true,
|
limit: pageCnt,
|
limits: pageLimits,
|
cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
|
done: function (res) {
|
setRight();
|
},
|
cols: [
|
[{
|
field: 'BoxNo',
|
title: '箱号',
|
align: 'center',
|
fixed: 'left'
|
}, {
|
field: 'BoxNo2',
|
title: '盒号',
|
align: 'center',
|
fixed: 'left'
|
}, {
|
field: 'BoxNo3',
|
title: '支号',
|
align: 'center',
|
fixed: 'left'
|
}, {
|
field: 'SkuNo',
|
title: '物料编码',
|
align: 'center',
|
fixed: 'left'
|
}, {
|
field: 'SkuName',
|
title: '物料名称',
|
align: 'center',
|
fixed: 'left'
|
}, {
|
field: 'LotNo',
|
title: '批次号',
|
align: 'center',
|
width: 100,
|
}, {
|
field: 'Qty',
|
title: '数量',
|
align: 'center',
|
width: 80,
|
}, {
|
field: 'LotText',
|
title: '批次描述',
|
align: 'center',
|
|
}, {
|
field: 'ProductionTime',
|
title: '生产日期',
|
align: 'center',
|
width: 160,
|
templet: function (d) {
|
return formatDate(d.ProductionTime);
|
}
|
}, {
|
field: 'ExpirationTime',
|
title: '过期日期',
|
align: 'center',
|
width: 160,
|
templet: function (d) {
|
return formatDate(d.ExpirationTime);
|
}
|
}, {
|
field: 'SupplierLot',
|
title: '供货批次',
|
align: 'center',
|
}, {
|
field: 'InspectMark',
|
title: '检验标记',
|
align: 'center',
|
templet: function (d) {
|
switch (d.InspectMark) {
|
case "0": return "否";
|
case "1": return "是";
|
default: return "";
|
}
|
}
|
}, {
|
field: 'BitBoxMark',
|
title: '零箱标记',
|
align: 'center',
|
templet: function (d) {
|
switch (d.BitBoxMark) {
|
case "0": return "否";
|
case "1": return "是";
|
default: return "";
|
}
|
}
|
}, {
|
field: 'Origin',
|
title: '来源',
|
align: 'center',
|
}, {
|
field: 'CreateUserName',
|
title: '创建人',
|
align: 'center',
|
width: 100
|
}, {
|
field: 'CreateTime',
|
title: '创建时间',
|
align: 'center',
|
width: 160,
|
templet: function (d) {
|
return formatDate(d.CreateTime);
|
}
|
}, {
|
title: '操作',
|
fixed: 'right',
|
width: 100,
|
align: 'center',
|
toolbar: '#toolbarDemoList'
|
}]
|
],
|
|
});
|
|
upload.render({
|
elem: '#daoru' //绑定元素
|
, url: '' //上传接口
|
, auto: false //是否选完文件后自动上传。如果设定 false,那么需要设置 bindAction 参数来指向一个其它按钮提交上传
|
, exts: 'slx|excel|xlsx' //允许上传的文件后缀
|
, accept: 'file' //指定允许上传时校验的文件类型
|
//, bindAction: '#daoru' //指向一个按钮触发上传
|
, choose: function (obj) {// 选择文件回调
|
console.log(obj);
|
var files = obj.pushFile(); //将每次选择的文件追加到文件队列
|
var fileArr = Object.values(files);// 注意这里的数据需要是数组,所以需要转换一下
|
console.log(fileArr)
|
// 用完就清理掉,避免多次选中相同文件时出现问题
|
for (var index in files) {
|
console.log(index);
|
if (files.hasOwnProperty(index)) {
|
delete files[index];
|
}
|
}
|
console.log("abs");
|
uploadExcel(fileArr); // 如果只需要最新选择的文件,可以这样写: uploadExcel([files.pop()])
|
}
|
, done: function (res) {
|
console.log(res);
|
//上传完毕回调
|
}
|
, error: function (res) {
|
console.log(res);
|
//请求异常回调
|
}
|
});
|
}
|
|
// 权限设置
|
function setRight() {
|
$(function () {
|
$(".addClass").hide();
|
$(".editClass").hide();
|
$(".delClass").hide();
|
$(".delMxClass").hide();
|
});
|
sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function (res) {
|
if (res.code == 0) { //成功
|
for (var k = 0; k < res.data.length; k++) {
|
if (res.data[k].MenuName == "添加入库单") {
|
$(function () {
|
$(".addClass").show();
|
});
|
}
|
if (res.data[k].MenuName == "编辑入库单") {
|
$(function () {
|
$(".editClass").show();
|
});
|
}
|
if (res.data[k].MenuName == "删除入库单") {
|
$(function () {
|
$(".delClass").show();
|
$(".delMxClass").show();
|
});
|
}
|
}
|
} else { //不成功
|
layer.msg('获取权限信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
}
|
});
|
}
|
|
// 获取箱支信息
|
function getBoxInforVlues() {
|
var msg = "";
|
if ($("#BoxNo").val() == "") {
|
layer.msg("请输入箱码!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return msg;
|
}
|
// if ($("#BoxNo2").val() == "") {
|
// layer.msg("请输入盒码!", {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// });
|
// return msg;
|
// }
|
if ($("#BoxNo3").val() == "") {
|
layer.msg("请输入支码!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return msg;
|
}
|
if ($("#SkuNo").val() == "") {
|
layer.msg("请输入物料编码!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return msg;
|
}
|
if ($("#LotNo").val() == "") {
|
layer.msg("请输入批次号!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return msg;
|
}
|
if ($("#Qty").val() == "") {
|
layer.msg("请输入实际数量!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return msg;
|
}
|
|
var param = {
|
BoxNo: $("#BoxNo").val(),
|
BoxNo2: $("#BoxNo2").val(),
|
BoxNo3: $("#BoxNo3").val(),
|
SkuNo: $("#SkuNo").val(),
|
LotNo: $("#LotNo").val(),
|
LotText: $("#LotText").val(),
|
Qty: parseInt($("#Qty").val()),
|
ProductionTime: $("#ProductionTime").val(),
|
InspectMark: $("#InspectMark").val(),
|
BitBoxMark: $("#BitBoxMark").val(),
|
Origin: "录入",
|
};
|
|
return param;
|
}
|
|
// 导入箱支关系
|
function uploadExcel(files) {
|
console.log("123");
|
var list = [];
|
try {
|
var excel = layui.excel;
|
excel.importExcel(files, {
|
// 读取数据的同时梳理数据
|
fields: {
|
'BoxNo': 'A',
|
'BoxNo2': 'B',
|
'BoxNo3': 'C',
|
'Qty': 'D',
|
'SkuNo': 'E',
|
'LotNo': 'F',
|
'LotText': 'G',
|
'ProductionTime': 'H',
|
'InspectMark': 'I',
|
'BitBoxMark': 'J',
|
}
|
},
|
function (data) {
|
console.log(data);
|
// var arr = new Array();
|
//excel第一行不读取、设置为标题
|
for (i = 1; i < data[0].Sheet1.length; i++) {
|
|
var Qty = 0;
|
if (isIntNum(data[0].Sheet1[i].Qty)) {
|
Qty = parseInt(data[0].Sheet1[i].Qty);
|
}
|
|
var InspectMark = "0";
|
var BitBoxMark = "0";
|
if (data[0].Sheet1[i].InspectMark == "是") {
|
InspectMark = "1";
|
}
|
if (data[0].Sheet1[i].BitBoxMark == "是") {
|
BitBoxMark = "1";
|
}
|
var tt = {
|
BoxNo: data[0].Sheet1[i].BoxNo,
|
BoxNo2: data[0].Sheet1[i].BoxNo2,
|
BoxNo3: data[0].Sheet1[i].BoxNo3,
|
Qty: Qty,
|
SkuNo: data[0].Sheet1[i].SkuNo,
|
LotNo: data[0].Sheet1[i].LotNo,
|
LotText: data[0].Sheet1[i].LotText,
|
ProductionTime: data[0].Sheet1[i].ProductionTime,
|
InspectMark: InspectMark,
|
BitBoxMark: BitBoxMark,
|
};
|
list.push(tt);
|
console.log(data[0].Sheet1[i].ProductionTime);
|
}
|
console.log(list);
|
var param = {
|
"OperType": "Add",
|
"ListBoxInfo": list,
|
}
|
|
sendData(IP + "/BllAsn/ImportBllBoxInfo", param, 'post', function (res) {
|
if (res.code == 0) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
bindTable();
|
doing = true
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { bindTable();doing = true });
|
}
|
});
|
});
|
} catch (e) {
|
layer.alert(e.message);
|
}
|
|
}
|
//#endregion
|
})
|
</script>
|
</body>
|
|
</html>
|