|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
|
|
|
|
<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/lib/layui-v2.8.6/css/layui.css" media="all">
|
|
|
|
|
<link rel="stylesheet" href="/static/css/public.css" media="all">
|
|
|
|
|
<link rel="stylesheet" href="/static/js/lay-module/step-lay/step.css" media="all">
|
|
|
|
|
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.inputdiv {
|
|
|
|
|
display: flex;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
height: 38px;
|
|
|
|
|
line-height: 38px;
|
|
|
|
|
border: 1px solid rgb(238, 238, 238);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.layui-form-label {
|
|
|
|
|
padding: 9px 0px;
|
|
|
|
|
text-align: left;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.layui-input-block {
|
|
|
|
|
margin-left: 80px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.layui-form-select {
|
|
|
|
|
width: 100%;
|
|
|
|
|
border-style: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div class="layuimini-container">
|
|
|
|
|
<div class="layuimini-main">
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<fieldset class="table-search-fieldset">
|
|
|
|
|
<legend>转移盘点</legend>
|
|
|
|
|
<div class="layui-fluid">
|
|
|
|
|
<div class="layui-card">
|
|
|
|
|
<form class="layui-form"
|
|
|
|
|
style="margin: 0 auto;max-width: 700px;padding-top: 100px; padding-bottom: 200px"
|
|
|
|
|
lay-filter="form1" id="form1">
|
|
|
|
|
<div class="layui-card-body" id="takingHeader" style="padding-right: 0px">
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">转移位置:</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="text" id="minIds" name="minIds" th:value="${minIds}"
|
|
|
|
|
style="display:none;">
|
|
|
|
|
<input type="text" name="mainId" id="mainId" th:value="${mainRecord.getId()}"
|
|
|
|
|
style="display:none;">
|
|
|
|
|
<input type="text" class="layui-input"
|
|
|
|
|
id="openSonByDepository" readonly
|
|
|
|
|
lay-verify="required"/>
|
|
|
|
|
<input type="text" name="depositoryId" class="layui-input"
|
|
|
|
|
id="depositoryId"
|
|
|
|
|
style="display: none" lay-verify="required"/>
|
|
|
|
|
<input type="text" name="placeId" class="layui-input" id="placeId"
|
|
|
|
|
style="display: none" lay-verify="required"/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<fieldset class="table-search-fieldset">
|
|
|
|
|
<legend>转移明细</legend>
|
|
|
|
|
<div class="layui-card-body" id="InventoryDetails" style="padding-right: 0px">
|
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
|
|
<div class="layui-collapse" lay-accordion>
|
|
|
|
|
<div class="layui-colla-item"
|
|
|
|
|
th:each="recordMin,iterStar:${recordChild}">
|
|
|
|
|
<h2 class="layui-colla-title"
|
|
|
|
|
th:text="${recordMin.getMname()}"></h2>
|
|
|
|
|
<div class="layui-colla-content">
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label" style="height: 40px;">物料编码:</label>
|
|
|
|
|
<div class="layui-input-block" style="margin: 0px;">
|
|
|
|
|
<div class="inputdiv">
|
|
|
|
|
<input th:attr="name='code' +${recordMin.getId()},id='code'+${recordMin.getId()}"
|
|
|
|
|
type="text" placeholder="请填写入物料编码"
|
|
|
|
|
th:value="${recordMin.getMcode()}"
|
|
|
|
|
class="layui-input" lay-verify="required"
|
|
|
|
|
style="border-style: none">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label" style="height: 40px;">条形编码:</label>
|
|
|
|
|
<div class="layui-input-block" style="margin: 0px;">
|
|
|
|
|
<div class="inputdiv">
|
|
|
|
|
<select
|
|
|
|
|
th:attr="id='barCode'+${recordMin.getId()},name='barCode'+${recordMin.getId()}"
|
|
|
|
|
style="border-style: none">
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">物料类型:</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="text" placeholder="请选择物料类型"
|
|
|
|
|
class="layui-input"
|
|
|
|
|
th:value="${recordMin.getTname()}"
|
|
|
|
|
th:attr="id='openSonByMateralType'+${recordMin.getId()}"
|
|
|
|
|
readonly
|
|
|
|
|
lay-verify="required"/>
|
|
|
|
|
<input type="text"
|
|
|
|
|
th:value="${recordMin.getMtId()}"
|
|
|
|
|
th:attr="id='materialTypeId'+${recordMin.getId()},name='typeId'+${recordMin.getId()}"
|
|
|
|
|
placeholder="请选择物料类型" class="layui-input"
|
|
|
|
|
style="display: none" lay-verify="required"/>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">材质:</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="text" placeholder="请填写材质名称"
|
|
|
|
|
class="layui-input"
|
|
|
|
|
th:value="${recordMin.getMtexture()}"
|
|
|
|
|
th:attr="id='texture'+${recordMin.getId()},name='texture'+${recordMin.getId()}"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">规格型号:</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="text" placeholder="请填写规格型号"
|
|
|
|
|
class="layui-input"
|
|
|
|
|
th:value="${recordMin.getMversion()}"
|
|
|
|
|
th:attr="id='version'+${recordMin.getId()},name='version'+${recordMin.getId()}"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">计量单位:</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="text" placeholder="请填写计量单位"
|
|
|
|
|
class="layui-input"
|
|
|
|
|
th:value="${recordMin.getMunit()}"
|
|
|
|
|
th:attr="id='unit'+${recordMin.getId()},name='unit'+${recordMin.getId()}"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">盘点数量:</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="number" class="layui-input"
|
|
|
|
|
th:value="${recordMin.getNewInventory()}"
|
|
|
|
|
th:attr="id='newInventory'+${recordMin.getId()},name='newInventory'+${recordMin.getId()}"
|
|
|
|
|
readonly
|
|
|
|
|
lay-verify="required"/>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">转移数量:</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="number" class="layui-input"
|
|
|
|
|
th:value="${recordMin.getInventory()}"
|
|
|
|
|
th:attr="id='invnetory'+${recordMin.getId()},name='invnetory'+${recordMin.getId()}"
|
|
|
|
|
onblur="checkNumber(this)"
|
|
|
|
|
lay-verify="required"/>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
|
|
<div class="layui-card-body" id="takingFooter" style="padding-right: 0px">
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<button class="layui-btn" lay-submit lay-filter="formStep">
|
|
|
|
|
 提交 
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<script src="/static/lib/layui-v2.8.6/layui.js" charset="utf-8"></script>
|
|
|
|
|
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于扫描条形码或二维码
|
|
|
|
|
function scanCode(obj) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用于盘点当前转移数量是否合适
|
|
|
|
|
function checkNumber(obj) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用于标志是否为第一次提交
|
|
|
|
|
let flagForForm = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于暂存卡片个数
|
|
|
|
|
let params = [];
|
|
|
|
|
|
|
|
|
|
// 用于存储当前选择的盘点位置
|
|
|
|
|
let depositoryId;
|
|
|
|
|
let placeId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//用于存储当前最小转移量
|
|
|
|
|
let minTransferNum = {};
|
|
|
|
|
|
|
|
|
|
let minIds = [];
|
|
|
|
|
layui.use(['form', 'flow'], function () {
|
|
|
|
|
var $ = layui.$,
|
|
|
|
|
form = layui.form;
|
|
|
|
|
|
|
|
|
|
var minRecordIds = $("#minIds").val();
|
|
|
|
|
let split = minRecordIds.split(",");
|
|
|
|
|
for (let i = 0; i < split.length; i++) {
|
|
|
|
|
var s = split[i];
|
|
|
|
|
if ("" === s) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
minIds.push(Number(s));
|
|
|
|
|
minTransferNum["invnetory" + s] = ($("#invnetory" + s).val());
|
|
|
|
|
}
|
|
|
|
|
// 用于打开仓库树形菜单
|
|
|
|
|
$('#openSonByDepository').on('click', function () {
|
|
|
|
|
layer.open({
|
|
|
|
|
type: 2,
|
|
|
|
|
title: '弹窗内容',
|
|
|
|
|
skin: 'layui-layer-rim',
|
|
|
|
|
maxmin: true,
|
|
|
|
|
shadeClose: true, //点击遮罩关闭层
|
|
|
|
|
area: ['70%', '70%'],
|
|
|
|
|
move: '.layui-layer-title',
|
|
|
|
|
fixed: false,
|
|
|
|
|
content: '/selectDepository?type=2',
|
|
|
|
|
success: function (layero, index) {
|
|
|
|
|
var children = layero.children();
|
|
|
|
|
var content = $(children[1]);
|
|
|
|
|
var iframeChildren = $(content.children());
|
|
|
|
|
content.css('height', '100%');
|
|
|
|
|
iframeChildren.css('height', '100%');
|
|
|
|
|
},
|
|
|
|
|
end: function () {
|
|
|
|
|
var nowDepositoryId = $("#depositoryId").val();
|
|
|
|
|
var nowPlaceId = $("#placeId").val();
|
|
|
|
|
if (nowDepositoryId !== depositoryId || nowPlaceId !== placeId) {
|
|
|
|
|
// 如果重新选择盘点位置
|
|
|
|
|
var nowDepositoryName = $("#openSonByDepository").val();
|
|
|
|
|
$("#form1")[0].reset();
|
|
|
|
|
$("#depositoryId").val(nowDepositoryId);
|
|
|
|
|
$("#placeId").val(nowPlaceId);
|
|
|
|
|
$("#openSonByDepository").val(nowDepositoryName);
|
|
|
|
|
form.render();
|
|
|
|
|
}
|
|
|
|
|
depositoryId = nowDepositoryId;
|
|
|
|
|
placeId = nowPlaceId;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于提交盘点转移情况
|
|
|
|
|
form.on('submit(formStep)', function (data) {
|
|
|
|
|
if (!flagForForm) {
|
|
|
|
|
flagForForm = true;
|
|
|
|
|
if (depositoryId !== null && depositoryId !== undefined && depositoryId !== "") {
|
|
|
|
|
data = data.field;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "/stockTaking/stockTransfer",
|
|
|
|
|
type: 'post',
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
contentType: "application/json;charset=utf-8",
|
|
|
|
|
data: JSON.stringify(data),
|
|
|
|
|
beforeSend: function () {
|
|
|
|
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
|
|
|
|
|
},
|
|
|
|
|
success: function (data) {
|
|
|
|
|
layer.msg("申请提交成功", {
|
|
|
|
|
icon: 6,//成功的表情
|
|
|
|
|
time: 500 //1秒关闭(如果不配置,默认是3秒)
|
|
|
|
|
}, function () {
|
|
|
|
|
// 关闭当前页
|
|
|
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
|
|
|
parent.layer.close(index);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
complete: function () {
|
|
|
|
|
layer.close(this.layerIndex);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
layer.msg("请先选择盘点位置", {
|
|
|
|
|
icon: 0,
|
|
|
|
|
time: 500
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//删除数组中指定元素
|
|
|
|
|
function remove(arr, item) {
|
|
|
|
|
var result = [];
|
|
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
|
|
if (arr[i] === item) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
result.push(arr[i]);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 扫码盘点位置
|
|
|
|
|
scanCode = function () {
|
|
|
|
|
layer.open({
|
|
|
|
|
type: 2,
|
|
|
|
|
title: '弹窗内容',
|
|
|
|
|
skin: 'layui-layer-rim',
|
|
|
|
|
maxmin: true,
|
|
|
|
|
shadeClose: true, //点击遮罩关闭层
|
|
|
|
|
area: ['100%', '100%'],
|
|
|
|
|
move: '.layui-layer-title',
|
|
|
|
|
fixed: false,
|
|
|
|
|
content: '/scanCodeByTaking',
|
|
|
|
|
success: function (layero, index) {
|
|
|
|
|
var children = layero.children();
|
|
|
|
|
var content = $(children[1]);
|
|
|
|
|
var iframeChildren = $(content.children());
|
|
|
|
|
content.css('height', '100%');
|
|
|
|
|
iframeChildren.css('height', '100%');
|
|
|
|
|
},
|
|
|
|
|
end: function () {
|
|
|
|
|
var nowDepositoryId = $("#depositoryId").val();
|
|
|
|
|
var nowPlaceId = $("#placeId").val();
|
|
|
|
|
if (nowDepositoryId !== depositoryId || nowPlaceId !== placeId) {
|
|
|
|
|
// 如果重新选择盘点位置
|
|
|
|
|
var nowDepositoryName = $("#openSonByDepository").val();
|
|
|
|
|
$("#form1")[0].reset();
|
|
|
|
|
$("#depositoryId").val(nowDepositoryId);
|
|
|
|
|
$("#placeId").val(nowPlaceId);
|
|
|
|
|
$("#openSonByDepository").val(nowDepositoryName);
|
|
|
|
|
form.render();
|
|
|
|
|
}
|
|
|
|
|
depositoryId = nowDepositoryId;
|
|
|
|
|
placeId = nowPlaceId;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于判断当前数量是否合适
|
|
|
|
|
checkNumber = function (obj) {
|
|
|
|
|
var id = obj.id;
|
|
|
|
|
var oldNumber = Number(minTransferNum[id]);
|
|
|
|
|
if (depositoryId !== null && depositoryId !== undefined && depositoryId !== "") {
|
|
|
|
|
var req = {};
|
|
|
|
|
req.depositoryId = depositoryId;
|
|
|
|
|
req.placeId = placeId;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "/stockTaking/findInventoryByLocation",
|
|
|
|
|
type: 'post',
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
contentType: "application/json;charset=utf-8",
|
|
|
|
|
data: JSON.stringify(req),
|
|
|
|
|
success: function (d) {
|
|
|
|
|
var data = d.data;
|
|
|
|
|
var placeInventory = data.inventory;
|
|
|
|
|
id = id.split("invnetory")[1];
|
|
|
|
|
var number = Number(obj.value);
|
|
|
|
|
var inventory = Number($("#newInventory" + id).val());
|
|
|
|
|
if (number < oldNumber) {
|
|
|
|
|
layer.msg("转移数量不能小于" + oldNumber);
|
|
|
|
|
obj.value = oldNumber;
|
|
|
|
|
}
|
|
|
|
|
if (number > inventory) {
|
|
|
|
|
layer.msg("转移数量不能大于当前盘点数量:" + inventory);
|
|
|
|
|
obj.value = oldNumber;
|
|
|
|
|
}
|
|
|
|
|
if (number > placeInventory) {
|
|
|
|
|
layer.msg("当前转移库位只能存放:" + placeInventory + "的物料");
|
|
|
|
|
obj.value = oldNumber;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
layer.msg("请先选择盘点位置", {
|
|
|
|
|
icon: 0,
|
|
|
|
|
time: 500
|
|
|
|
|
}, function () {
|
|
|
|
|
obj.value = oldNumber;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('body').on('click', '[data-refresh]', function () {
|
|
|
|
|
location.reload();
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|