<!DOCTYPE html>
|
<html lang="en">
|
<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, maximum-scale=1">
|
<link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="../../static/css/cool.css" media="all">
|
<link rel="stylesheet" href="../../static/css/common.css" media="all">
|
<link rel="stylesheet" href="../../static/css/print.css" media="all">
|
|
</head>
|
<body>
|
<div>
|
<div class="layui-form" style="padding-top: 8px; padding-left: 8px">
|
<button style="margin-bottom: 0px" class="layui-btn layui-btn-sm layui-form-item" style="display: inline-block"
|
id="outbound" lay-submit
|
lay-event="outbound" onclick="outbound()">启动出库
|
</button>
|
</div>
|
<table class="layui-hide" id="stockOut" lay-filter="stockOut" style="margin-top: 0px"></table>
|
</div>
|
|
</body>
|
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
|
<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
|
<script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
|
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
|
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
|
<script>
|
var orderData = parent.getOrderData();
|
var locData = [];
|
var table;
|
var sourceData = [];
|
|
function getCol() {
|
var cols = [
|
{type: 'checkbox'}
|
, {field: 'warehouseName', align: 'center', title: '库区名称'}
|
, {field: 'warehouse', align: 'center', title: '库位编号'}
|
, {field: 'anfme', align: 'center', title: '数量', edit: 'text'}
|
];
|
cols.push.apply(cols, locNormalCols);
|
cols.push({field: 'modiUser$', align: 'center', title: '修改人员', hide: true}
|
, {field: 'modiTime$', align: 'center', title: '修改时间', hide: true})
|
return cols;
|
}
|
|
layui.use(['table', 'laydate', 'form'], function () {
|
table = layui.table;
|
var $ = layui.jquery;
|
var layer = layui.layer;
|
var layDate = layui.laydate;
|
var form = layui.form;
|
// 数据渲染
|
locDetlTableIns = table.render({
|
elem: '#stockOut',
|
headers: {token: localStorage.getItem('token')},
|
url: baseUrl + '/outStock/query/locNormalList?fbillNo=' + orderData.fbillNo,
|
page: true,
|
limit: 9999,
|
limits: [9999],
|
even: true,
|
// cellMinWidth: 50,
|
cols: [getCol()],
|
request: {
|
pageName: 'curr',
|
pageSize: 'limit'
|
},
|
parseData: function (res) {
|
return {
|
'data': res.data,
|
'code': res.code,
|
}
|
},
|
response: {
|
statusCode: 200
|
},
|
done: function (res, curr, count) {
|
if (res.code === 403) {
|
top.location.href = baseUrl + "/";
|
}
|
if (res.code === 200) {
|
locData = res.data;
|
sourceData = [];
|
if (res.data && res.data.length > 0) {
|
res.data.map(function (item) {
|
var obj = {
|
anfme: item.anfme,
|
id: item.id,
|
matnr: item.matnr,
|
supplier: item.supplier,
|
}
|
sourceData.push(obj);
|
});
|
}
|
}
|
}
|
});
|
|
// 页面修改
|
table.on('edit(stockOut)', function (obj) {
|
if (obj.field === 'anfme') {
|
if (isNaN(obj.value)) {
|
layer.msg("请输入数字");
|
locDetlTableIns.reload();
|
}
|
// 单元格编辑之前的值进行比较
|
for (var i = 0; i < sourceData.length; i++) {
|
if (obj.data.id == sourceData[i].id) {
|
if (Number(obj.value) > sourceData[i].anfme) {
|
layer.msg("数量不可大于库存量");
|
locDetlTableIns.reload();
|
}
|
}
|
}
|
if (obj.value <= 0) {
|
layer.msg("数量不可小于等于零");
|
locDetlTableIns.reload();
|
}
|
}
|
});
|
});
|
|
/* 启动出库 */
|
function outbound() {
|
var checkStatus = table.checkStatus('stockOut');
|
var checkData = checkStatus.data;
|
var obj = {
|
list: checkData,
|
supplier: orderData.fbillNo,
|
}
|
if (checkData.length > 0) {
|
$.ajax({
|
url: baseUrl + "/outStock/locNormal",
|
headers: {'token': localStorage.getItem('token')},
|
contentType: 'application/json;charset=UTF-8',
|
data: JSON.stringify(obj),
|
method: 'POST',
|
traditional: true,
|
success: function (res) {
|
if (res.code === 200) {
|
parent.closeDetail(res.msg);
|
} else if (res.code === 403) {
|
top.location.href = baseUrl + "/";
|
} else {
|
layer.msg(res.msg)
|
}
|
}
|
})
|
} else {
|
layer.msg("请选择需要出库物料");
|
return;
|
}
|
}
|
|
</script>
|
</html>
|