<!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">
|
<style type="text/css">
|
.layui-table-cell, .layui-table-box{
|
overflow: visible;
|
}
|
td .layui-form-select {
|
margin-top: -10px;
|
margin-left: -15px;
|
margin-right: -15px;
|
}
|
</style>
|
</head>
|
<body>
|
|
<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
|
<div class="layui-form-item">
|
<label class="layui-form-label">移库仓库:</label>
|
<div class="layui-input-inline" style="width: 35%;">
|
<select name="WarehouseId" id="WarehouseId"
|
lay-filter="getHouseId" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
<label class="layui-form-label">移库巷道:</label>
|
<div class="layui-input-inline" style="width: 35%;">
|
<select name="LanewayId" id="LanewayId"
|
lay-filter="getLanwayId" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label">移出货位:</label>
|
<div class="layui-input-inline" style="width: 35%;">
|
<select name="OutSlotId" id="OutSlotId" lay-filter="getOutSlotId" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
<label class="layui-form-label">移入货位:</label>
|
<div class="layui-input-inline" style="width: 35%;">
|
<select name="InSlotId" id="InSlotId" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
</div>
|
|
<div class="layui-form-item">
|
<div class="layui-card">
|
<div class="layui-card-body">
|
<div style="padding-bottom: 6px;">
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-list" data-type="add" id="approvalBtn">添加明细</button>
|
</div>
|
<table id="LAY-app-content-list" name="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
|
<script type="text/html" id="table-content-list">
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"> <i class="layui-icon layui-icon-delete"></i>删除</a>
|
</script>
|
<button type="submit" class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit="" lay-filter="form1">立即提交</button>
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item layui-hide">
|
<input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" id="layuiadmin-app-form-submit" value="确认添加">
|
<input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="确认编辑">
|
</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.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index' //主入口模块
|
}).use(['index', 'form', 'layer', 'table'], function() {
|
var $ = layui.$,
|
form = layui.form,
|
table = layui.table,
|
layer = layui.layer;
|
var houseid = 0;
|
var lanId = 0;
|
var outSlotId = 0;
|
var MoveBillCode = getQueryString('moveno');
|
|
// function getOutSlotId(selectedvalue) {
|
// if (selectedvalue) {
|
// outSlotId = selectedvalue;
|
// refreshTable(outSlotId);
|
// } else {
|
// outSlotId = 0;
|
// refreshTable(outSlotId);
|
// }
|
// }
|
refreshTable(MoveBillCode);
|
// form.on('select(getOutSlotId)', function(data) {
|
// getOutSlotId(data.value);
|
// });
|
function getHouseId(selectedvalue) {
|
if (selectedvalue) {
|
houseid = selectedvalue;
|
var param = {
|
LanewayWarehouseId: houseid,
|
};
|
sendData(IP + "/MoveNotify/GetWmsBaseLaneway", param, 'post', function(res) {
|
$("#LanewayId").empty();
|
$("#OutSlotId").empty();
|
$("#InSlotId").empty();
|
if (res.code == 1) { //成功
|
$("#LanewayId").append('<option value =""></option>');
|
for (var i = 0; i < res.data.length; i++) {
|
var name = res.data[i].LanewayName;
|
var id = res.data[i].Id;
|
$("#LanewayId").append('<option value =' + id + '>' + name +
|
'</option>');
|
}
|
form.render('select');
|
} else { //不成功
|
layer.msg('获取巷道信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
form.render('select');
|
});
|
}
|
});
|
} else {
|
houseid = 0;
|
lanId = 0;
|
outSlotId = 0;
|
$("#LanewayId").empty();
|
$("#OutSlotId").empty();
|
$("#InSlotId").empty();
|
form.render('select');
|
//refreshTable(outSlotId);
|
}
|
}
|
form.on('select(getHouseId)', function(data) {
|
getHouseId(data.value);
|
});
|
function getLanwayId(selectedvalue) {
|
if (selectedvalue) {
|
lanId = selectedvalue;
|
var param = {
|
MoveLanewayCode: lanId
|
};
|
sendData(IP + "/MoveNotify/GetSlotIdHaveStock", param, 'post', function(res) {
|
$("#OutSlotId").empty();
|
$("#InSlotId").empty();
|
if (res.code == 1) { //成功
|
$("#OutSlotId").append('<option value =""></option>');
|
for (var i = 0; i < res.data.length; i++) {
|
var name = res.data[i].SlotCode;
|
var id = res.data[i].SlotId;
|
$("#OutSlotId").append('<option value =' + id + '>' + name +
|
'</option>');
|
}
|
sendData(IP + "/MoveNotify/GetEmptySlotId", param, 'post', function(res) {
|
$("#InSlotId").empty();
|
if (res.code == 1) { //成功
|
$("#InSlotId").append('<option value =""></option>');
|
for (var i = 0; i < res.data.length; i++) {
|
var name = res.data[i].SlotCode;
|
var id = res.data[i].SlotId;
|
$("#InSlotId").append('<option value =' + id + '>' + name +
|
'</option>');
|
}
|
form.render('select');
|
} else { //不成功
|
layer.msg('获取巷道信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
//refreshTable(outSlotId);
|
});
|
}
|
});
|
form.render('select');
|
} else { //不成功
|
layer.msg('获取巷道信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
form.render('select');
|
});
|
}
|
});
|
|
} else {
|
lanId = 0;
|
outSlotId = 0;
|
$("#OutSlotId").empty();
|
$("#InSlotId").empty();
|
form.render('select');
|
//refreshTable(outSlotId);
|
}
|
}
|
form.on('select(getLanwayId)', function(data) {
|
|
getLanwayId(data.value);
|
});
|
var param = {
|
id: $.cookie('userId'),
|
};
|
sendData(IP + "/MoveNotify/GetWareHouseList", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
$("#WarehouseId").append('<option value =' + res.data[i].WarehouseId + '>' + res.data[i].WarehouseName +
|
'</option>');
|
}
|
form.render('select');
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
function refreshTable(id) {
|
|
var param = {
|
MoveBillCode: id
|
};
|
sendData(IP + "/MoveNotify/GetStockSlotListBySlotId", param, 'post', function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
var list = res.data;
|
$.extend(infoOptions, {
|
data: list
|
});
|
infoOptions.page = {
|
curr: 1
|
}
|
tableIns = table.render(infoOptions);
|
} else { //不成功
|
layer.msg('获取入库单信息失败!', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
}
|
var infoOptions = {
|
elem: '#LAY-app-content-list',
|
height: 'full-260',
|
id: 'LAY-app-content-list',
|
page: true,
|
limit: pageCnt,
|
limits: pageLimits,
|
cellMinWidth: 80, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
|
cols: [
|
[
|
{
|
field: 'StockStockCode',
|
title: '托盘条码',
|
align: 'center',
|
width: 100,
|
}, {
|
field: 'StockSlotCode',
|
title: '移出货位',
|
align: 'center',
|
|
width: 120,
|
//fixed: 'left'
|
},{
|
field: 'MoveInSlotCode',
|
title: '移入货位',
|
align: 'center',
|
|
width: 120,
|
//fixed: 'right'
|
},
|
{
|
field: 'GoodsCode',
|
title: '物品编码',
|
align: 'center',
|
|
width: 120,
|
|
}, {
|
field: 'GoodsName',
|
title: '物品名称',
|
align: 'center',
|
sort:true,
|
width: 200,
|
},
|
// {
|
// field: 'GoodsStandard',
|
// title: '物品规格',
|
// align: 'center',
|
// width: 100,
|
// },
|
{
|
field: 'StockLotNo',
|
title: '批次',
|
align: 'center',
|
width: 100,
|
},
|
// {
|
// field: 'StockQuantity',
|
// title: '库存数量',
|
// align: 'center',
|
// width: 105,
|
// },
|
// {
|
// field: 'UnitName',
|
// title: '物品单位',
|
// align: 'center',
|
// width: 100,
|
// },
|
|
// {
|
// field: 'StockProductionDate',
|
// title: '生产日期',
|
// align: 'center',
|
// width: 120,
|
// templet: function(d) {
|
// return formatDate(d.StockProductionDate);
|
// }
|
// },
|
{
|
field: 'StockDate',
|
title: '入库时间',
|
width: 180,
|
align: 'center',
|
templet: function(d) {
|
return formatDate(d.StockDate);
|
}
|
},
|
{
|
field: 'aaa',
|
title: '操作',
|
align:'center',
|
templet: '#table-content-list',
|
width: 100
|
//fixed: 'right'
|
}
|
]
|
],
|
};
|
var tableIns;
|
var doing = true;
|
form.on('submit(form1)', function(data) {
|
|
if(infoOptions.data==null||infoOptions.data==""){
|
layer.msg("请添加数据!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
return;
|
}
|
console.log(infoOptions.data);
|
console.log(table.cache["LAY-app-content-list"]);
|
var param={
|
options:infoOptions.data,
|
MoveBillCode:MoveBillCode,
|
CreateUser: $.cookie('userId') //当前登录人
|
};
|
if (doing) {
|
doing = false;
|
sendData(IP + "/MoveNotify/AddWmsMoveNotify", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
parent.location.reload();
|
parent.layer.close(layer.index);
|
doing = true;
|
// table.reload('LAY-app-content-list'); //数据刷新
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {doing=true;});
|
}
|
});
|
}
|
return false;
|
});
|
$('#approvalBtn').on('click', function() {
|
var arr = table.cache["LAY-app-content-list"];
|
var MoveWarehouseId = $('#WarehouseId').val();
|
var MoveLanewayCode = $('#LanewayId').val();
|
var MoveOutSlotCode = $('#OutSlotId').val();
|
var MoveInSlotCode = $('#InSlotId').find("option:selected").text();
|
var slot = true;
|
if(MoveWarehouseId==null || MoveWarehouseId==undefined ||MoveWarehouseId==""){
|
layer.msg("请选择仓库!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
return;
|
}
|
if(MoveLanewayCode==null || MoveLanewayCode==undefined ||MoveLanewayCode==""){
|
layer.msg("请选择巷道!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
return;
|
}
|
if(MoveOutSlotCode==null || MoveOutSlotCode==undefined ||MoveOutSlotCode==""){
|
layer.msg("请选择移出货位!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
return;
|
}
|
if(MoveInSlotCode==null || MoveInSlotCode==undefined ||MoveInSlotCode==""){
|
layer.msg("请选择移入货位!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
return;
|
}
|
for(var i=0;i<arr.length;i++)
|
{
|
if(arr[i].SlotCode==MoveOutSlotCode){
|
layer.msg("移出货位已经选择,请重新选择!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
slot=false;
|
continue;
|
}else if(arr[i].MoveInSlotCode==MoveInSlotCode){
|
layer.msg("移入货位已经选择,请重新选择!", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
slot = false;
|
continue;
|
}
|
|
}
|
if(slot){
|
var param = {
|
MoveOutSlotCode: MoveOutSlotCode,
|
|
};
|
|
synData(IP + "/MoveNotify/GetStockSlotListBySlotId", param, 'post', function(res) {
|
|
if (res.code == 1) { //成功
|
var list = res.data;
|
if(list !=null){
|
list[0].MoveInSlotCode=MoveInSlotCode;
|
arr.push(list[0]);
|
}
|
|
$.extend(infoOptions, {
|
data: arr
|
});
|
infoOptions.page = {
|
curr: 1
|
}
|
tableIns = table.render(infoOptions);
|
} else { //不成功
|
layer.msg('获取入库单信息失败!', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
|
}
|
|
});
|
|
table.on('tool(LAY-app-content-list)', function(obj) {
|
var data = obj.data;
|
var arr = table.cache["LAY-app-content-list"];
|
if (obj.event == 'del') {
|
var ii = -1;
|
for(var j in arr)
|
{
|
if(obj.data.SlotCode == arr[j].SlotCode){
|
ii = j;
|
break;
|
}
|
}
|
if(ii>-1)
|
{
|
arr.splice(ii, 1);
|
}
|
obj.del();
|
//console.log(infoOptions);
|
}
|
});
|
|
|
//获取浏览器参数
|
function getQueryString(name) {
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
var r = window.location.search.substr(1).match(reg);
|
if (r != null) return unescape(r[2]);
|
return null;
|
}
|
})
|
</script>
|
</body>
|
</html>
|