30 changed files with 1196 additions and 108 deletions
@ -0,0 +1,475 @@ |
|||
// 用于扫描条形码或二维码
|
|||
function scanCode(obj) { |
|||
} |
|||
|
|||
// 用于加载物料选择菜单
|
|||
function selectMaterial() { |
|||
|
|||
} |
|||
|
|||
// 用于通过物料名称获取物料
|
|||
function selectMaterialByName() { |
|||
|
|||
} |
|||
|
|||
// 用于编码查询
|
|||
function selectCode(obj) { |
|||
} |
|||
|
|||
|
|||
// 用于扫描物料码
|
|||
function scanCodeForMaterial() { |
|||
|
|||
} |
|||
|
|||
// 用于计算盘点结果
|
|||
function calculateForMaterial(obj) { |
|||
|
|||
} |
|||
|
|||
|
|||
function updateFlowShowForMaterial() { |
|||
|
|||
} |
|||
|
|||
// 用于展示具体库存数据
|
|||
function showDetail() { |
|||
|
|||
} |
|||
|
|||
|
|||
layui.use(['form', 'step', 'flow', 'table', 'inputTag'], function () { |
|||
var $ = layui.$, |
|||
form = layui.form, |
|||
table = layui.table, |
|||
inputTag = layui.inputTag, |
|||
dropdown = layui.dropdown, //下拉菜单
|
|||
flow = layui.flow; |
|||
departmentManagerIdForMaterial = $("#departmentManagerIdForMaterial").val(); |
|||
|
|||
let takingPre = 0; |
|||
|
|||
|
|||
let tagData = []; |
|||
let tempData = $("#departmentManagerForMaterial").val().split(","); |
|||
$.each(tempData, function (index, item) { |
|||
if (item !== "") { |
|||
tagData.push(item) |
|||
} |
|||
}); |
|||
$("#departmentManagerForMaterial").val(""); |
|||
|
|||
|
|||
let tagLabel = inputTag.render({ |
|||
elem: '#departmentManagerForMaterial', |
|||
data: tagData,//初始值
|
|||
removeKeyNum: 8,//删除按键编号 默认,BackSpace 键
|
|||
createKeyNum: 13,//创建按键编号 默认,Enter 键
|
|||
onChange: function (data, value, type, index) { |
|||
if (type === "remove") { |
|||
let split = departmentManagerIdForMaterial.split(","); |
|||
split.splice(index, 1); |
|||
departmentManagerIdForMaterial = split.toString(); |
|||
$("#departmentManagerIdForMaterial").val(departmentManagerIdForMaterial); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
|
|||
updateFlowShowForMaterial = function () { |
|||
let req = {}; |
|||
req.mid = $("#mid").val(); |
|||
req.size = size; |
|||
flow.load({ |
|||
elem: '#LAY_FlowForMaterial' //流加载容器
|
|||
, done: function (page, next) { //执行下一页的回调
|
|||
let result; |
|||
let lis = []; |
|||
req.page = page; |
|||
$.ajax({ |
|||
url: '/material/findMaterialByConditionForStockTaking', |
|||
data: req, |
|||
type: 'get', |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (res) { |
|||
result = res.data; |
|||
lis.push("<div class='clearfix'>"); |
|||
for (let i = 0; i < result.length; i++) { |
|||
let splitInventory = result[i].splitInventory; |
|||
let keys = Object.keys(splitInventory); |
|||
let InventoryItem = ""; |
|||
for (let j = 0; j < keys.length; j++) { |
|||
let key = keys[j]; |
|||
let item = '<p>' + "计量单位:" + key + ";库存数量:" + splitInventory[key] + '</p>'; |
|||
InventoryItem += item; |
|||
} |
|||
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1" iid='+result[i].id+' pid='+result[i].pid+' onclick="showDetail(this)">' + |
|||
'<div class="layui-card-header"><h2>' + "所处位置:" + result[i].dname + "-" + result[i].kingdeecode + '</h2></div>'); |
|||
lis.push('<div class="layui-col-md4 my-info" style="margin-left: 15px; color: #999;font-size: 15px;">' |
|||
+ InventoryItem |
|||
+ '</div></div></li>'); |
|||
} |
|||
lis.push('</div>'); |
|||
takingPre += result.length; |
|||
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
|
|||
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
|
|||
next(lis.join(''), takingPre < res.count); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
|
|||
// 用于打开负责人树形菜单
|
|||
$("#selectdepartmentManagerForMaterial").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: '/selectManager?type=Material', |
|||
end: function () { |
|||
departmentManagerIdForMaterial = $("#departmentManagerIdForMaterial").val(); |
|||
tagLabel.createItem(); |
|||
}, |
|||
success: function (layero, index) { |
|||
var children = layero.children(); |
|||
var content = $(children[1]); |
|||
var iframeChildren = $(content.children()); |
|||
content.css('height', '100%'); |
|||
iframeChildren.css('height', '100%'); |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
table.on('edit(currentTableFilterForMaterial)', function (obj) { |
|||
obj.update({stockTakingQuantity: obj.value});//修改当前行数据
|
|||
calculateForMaterial(obj); |
|||
}); |
|||
// 用于监听下拉菜单
|
|||
table.on('tool(currentTableFilterForMaterial)', function (obj) { //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
|
|||
var data = obj.data //获得当前行数据
|
|||
, layEvent = obj.event; //获得 lay-event 对应的值
|
|||
if (layEvent === 'more') { |
|||
let splitInfoList = obj.data.splitInfoList; |
|||
if (splitInfoList.length > 0) { |
|||
let dropDownDataList = []; |
|||
for (var i = 0; i < splitInfoList.length; i++) { |
|||
let dropDownData = {}; |
|||
dropDownData.title = splitInfoList[i].newUnit; |
|||
dropDownData.id = obj.data.id; |
|||
dropDownDataList.push(dropDownData); |
|||
} |
|||
dropdown.render({ |
|||
elem: this //触发事件的 DOM 对象
|
|||
, show: true //外部事件触发即显示
|
|||
, data: dropDownDataList |
|||
, click: function (unit) { |
|||
this.elem[0].childNodes[0].data = unit.title; |
|||
obj.tr[0].childNodes[7].childNodes[0].innerText = obj.data.splitInventory[unit.title]; |
|||
} |
|||
, align: 'right' //右对齐弹出(v2.6.8 新增)
|
|||
, style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' //设置额外样式
|
|||
}) |
|||
} |
|||
//下拉菜单
|
|||
|
|||
} |
|||
}); |
|||
|
|||
// 用于计算盘点结果
|
|||
calculateForMaterial = function (obj) { |
|||
let oldInventory = Number(obj.tr[0].childNodes[7].childNodes[0].innerText); |
|||
let nowInventory = Number(obj.value); |
|||
let number = 0; |
|||
let takingResult = ''; |
|||
let takingResultString = ''; |
|||
let req = {}; |
|||
if ((oldInventory) > (nowInventory)) { |
|||
number = oldInventory - nowInventory; |
|||
takingResult = "Inventory_down"; |
|||
takingResultString = "盘亏"; |
|||
} else if ((oldInventory) < (nowInventory)) { |
|||
number = nowInventory - oldInventory; |
|||
takingResult = "Inventory_up"; |
|||
takingResultString = "盘盈"; |
|||
} else { |
|||
takingResult = "Inventory_normal"; |
|||
takingResultString = "正常"; |
|||
} |
|||
obj.tr[0].childNodes[9].childNodes[0].innerText = takingResultString; |
|||
obj.tr[0].childNodes[10].childNodes[0].innerText = number; |
|||
obj.update({takingResult: takingResult}); |
|||
obj.update({takingInventory: number}); |
|||
req.number = number + ""; |
|||
req.takingResult = takingResult; |
|||
req.takingResultString = takingResultString; |
|||
req.id = obj.data.id + ""; |
|||
req.unit = obj.tr[0].childNodes[6].childNodes[0].innerText; |
|||
req.oldInventory = oldInventory + ""; |
|||
$.ajax({ |
|||
url: "/stockTaking/temporaryStorageForTakingResult", |
|||
dataType: "json", |
|||
data: JSON.stringify(req), |
|||
type: "POST", |
|||
contentType: "application/json;charset=utf-8" |
|||
}); |
|||
}; |
|||
|
|||
// 用于通过物料名称获取物料
|
|||
selectMaterialByName = function (obj) { |
|||
// 输入code
|
|||
var data = obj.value; |
|||
var req = {}; |
|||
data = data.split(",")[0]; |
|||
if (data !== "") { |
|||
req.mname = data; |
|||
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); |
|||
$.ajax({ |
|||
url: "/material/findMaterialByCondition", |
|||
type: "post", |
|||
dataType: 'json', |
|||
data: JSON.stringify(req), |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
if (d.count > 1) { |
|||
layer.msg("请点击右侧搜索确定物品",{ |
|||
icon:0, |
|||
time:1000 |
|||
},function () { |
|||
$("#mname").val(""); |
|||
$("#mid").val(""); |
|||
$("#code").val(""); |
|||
$("#version").val(""); |
|||
$("#mtype").val(""); |
|||
$("#texture").val(""); |
|||
$("#brand").val(""); |
|||
layer.close(loading2); |
|||
}); |
|||
|
|||
return false; |
|||
} else if (d.count === 0) { |
|||
layer.msg("没有该物品,请确认输入是否正确",{ |
|||
icon:0, |
|||
time:1000 |
|||
},function () { |
|||
$("#mname").val(""); |
|||
$("#mid").val(""); |
|||
$("#code").val(""); |
|||
$("#version").val(""); |
|||
$("#mtype").val(""); |
|||
$("#texture").val(""); |
|||
$("#brand").val(""); |
|||
layer.close(loading2); |
|||
}); |
|||
return false; |
|||
} else { |
|||
var material = d.data[0]; |
|||
$("#mname").val(material.mname); |
|||
$("#mid").val(material.mid); |
|||
$("#code").val(material.code); |
|||
$("#version").val(material.version); |
|||
$("#mtype").val(material.typeName); |
|||
$("#texture").val(material.texture); |
|||
$("#brand").val(material.brand); |
|||
form.render(); |
|||
updateFlowShowForMaterial(); |
|||
layer.close(loading2); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
}; |
|||
|
|||
|
|||
// 用于实现点击搜索按钮
|
|||
selectMaterial = function (obj) { |
|||
var mname = $("#mname").val(); |
|||
mname = mname.split(",")[0]; |
|||
layer.open({ |
|||
type: 2, |
|||
title: '弹窗内容', |
|||
skin: 'layui-layer-rim', |
|||
maxmin: true, |
|||
shadeClose: true, //点击遮罩关闭层
|
|||
area: ['70%', '70%'], |
|||
content: '/selectMaterial?mname=' + mname + '&type=2', |
|||
move: '.layui-layer-title', |
|||
fixed: false, |
|||
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 mid = $("#mid").val(); |
|||
if (mid !== '') { |
|||
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); |
|||
$.ajax({ |
|||
url: "/material/findMatrialById?mid=" + mid + "&type=out", |
|||
type: "get", |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
var material = d.data.materialById; |
|||
$("#mid").val(material.mid); |
|||
$("#mname").val(material.mname); |
|||
$("#code").val(material.code); |
|||
$("#version").val(material.version); |
|||
$("#mtype").val(material.typeName); |
|||
$("#texture").val(material.texture); |
|||
$("#brand").val(material.brand); |
|||
layer.close(loading2); |
|||
updateFlowShowForMaterial(); |
|||
form.render(); |
|||
} |
|||
}); |
|||
|
|||
} |
|||
else{ |
|||
updateFlowShowForMaterial() |
|||
} |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
|
|||
// 用于实现通过编码查询物料
|
|||
selectCode = function (obj) { |
|||
// 输入code
|
|||
var code = obj.value; |
|||
var req = {}; |
|||
req.code = code; |
|||
req.type = "out"; |
|||
if (code !== "") { |
|||
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); |
|||
$.ajax({ |
|||
url: "/material/findMatrialByCode", |
|||
type: "get", |
|||
dataType: 'json', |
|||
data: (req), |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
var d = d.data; |
|||
if (d == null) { |
|||
layer.msg("仓库中暂无该物料", { |
|||
icon: 0, |
|||
time: 1000 |
|||
}, function () { |
|||
$("#mname").val(""); |
|||
$("#mid").val(""); |
|||
$("#code").val(""); |
|||
$("#version").val(""); |
|||
$("#mtype").val(""); |
|||
$("#texture").val(""); |
|||
$("#brand").val(""); |
|||
updateFlowShowForMaterial(); |
|||
layer.close(loading2); |
|||
}); |
|||
|
|||
} else { |
|||
$("#mname").val(d.mname); |
|||
$("#mid").val(d.mid); |
|||
$("#version").val(d.version); |
|||
$("#mtype").val(d.typeName); |
|||
$("#texture").val(d.texture); |
|||
$("#brand").val(d.brand); |
|||
form.render(); |
|||
updateFlowShowForMaterial(); |
|||
layer.close(loading2); |
|||
|
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
}; |
|||
|
|||
|
|||
scanCodeForMaterial = function () { |
|||
let wxScan = parent; |
|||
|
|||
if (wxScan.wx === undefined) { |
|||
wxScan = wxScan.parent.wx; |
|||
} else { |
|||
wxScan = wxScan.wx; |
|||
} |
|||
wxScan.scanQRCode({ |
|||
desc: 'scanQRCode desc', |
|||
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
|
|||
scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
|
|||
success: function (res) { |
|||
// 回调
|
|||
var result = res.resultStr;//当needResult为1时返回处理结果
|
|||
var req = {}; |
|||
req.qrCode = result; |
|||
req.codeFlag = 2; |
|||
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); |
|||
$.ajax({ |
|||
url: "/material/qywxApplicationOutScanQrCode", |
|||
type: "post", |
|||
dataType: 'json', |
|||
data: JSON.stringify(req), |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
var data = d.data; |
|||
if (data === null) { |
|||
layer.msg("对于编码:" + result + ",并未发现仓库中存在对应的物料", { |
|||
icon: 0, |
|||
time: 1000 //0.5秒关闭(如果不配置,默认是3秒)
|
|||
}, function () { |
|||
$("#mname").val(""); |
|||
$("#mid").val(""); |
|||
$("#code").val(""); |
|||
$("#version").val(""); |
|||
$("#mtype").val(""); |
|||
$("#texture").val(""); |
|||
$("#brand").val(""); |
|||
updateFlowShowForMaterial(); |
|||
layer.close(loading2); |
|||
}) |
|||
} else { |
|||
$("#mname").val(data.mname); |
|||
$("#mid").val(data.id); |
|||
$("#code").val(data.code); |
|||
$("#version").val(data.version); |
|||
$("#mtype").val(data.typeName); |
|||
$("#texture").val(data.texture); |
|||
$("#brand").val(data.brand); |
|||
updateFlowShowForMaterial(); |
|||
layer.close(loading2); |
|||
} |
|||
} |
|||
}) |
|||
} |
|||
}) |
|||
}; |
|||
|
|||
showDetail = function (obj) { |
|||
let pid = $(obj).attr("pid"); |
|||
let iid = $(obj).attr("iid"); |
|||
layer.open({ |
|||
type: 2, |
|||
title: '盘点详情', |
|||
skin: 'layui-layer-rim', |
|||
maxmin: true, |
|||
shadeClose: true, //点击遮罩关闭层
|
|||
area: ['100%', '100%'], |
|||
content: '/stockTakingInfoForInventory?id=' + iid + '&pid='+pid, |
|||
move: '.layui-layer-title', |
|||
fixed: false |
|||
}) |
|||
} |
|||
|
|||
|
|||
}); |
|||
@ -0,0 +1,141 @@ |
|||
<!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.6.3/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/css/inputTag.css"> |
|||
<style> |
|||
|
|||
.inputdiv { |
|||
display: flex; |
|||
background-color: #fff; |
|||
height: 38px; |
|||
line-height: 38px; |
|||
border: 1px solid rgb(238, 238, 238); |
|||
} |
|||
|
|||
.layui-card-body { |
|||
padding: 0px; |
|||
} |
|||
|
|||
.layui-form-label { |
|||
padding: 9px 0px; |
|||
text-align: left; |
|||
} |
|||
|
|||
.layui-input-block { |
|||
margin-left: 80px; |
|||
} |
|||
|
|||
.layui-form-select { |
|||
width: 100%; |
|||
height: 38px; |
|||
|
|||
} |
|||
|
|||
.lay-step { |
|||
display: none; |
|||
} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="layuimini-container"> |
|||
<div class="layuimini-main"> |
|||
<div class="layui-fluid"> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<script id="changeUnit" type="text/html"> |
|||
<a class="layui-btn layui-btn-xs" lay-event="more">{{d.unit}}<i class="layui-icon layui-icon-down"></i></a> |
|||
</script> |
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script> |
|||
<script src="/static/js/stockTaking/stockTakingForMaterial.js" charset="utf-8"></script> |
|||
<script> |
|||
layui.use(['form', 'step'], function () { |
|||
var $ = layui.$, |
|||
step = layui.step, |
|||
form = layui.form; |
|||
|
|||
// 用于分步表单加载 |
|||
step.render({ |
|||
elem: '#stepForm', |
|||
filter: 'stepForm', |
|||
width: '100%', //设置容器宽度 |
|||
height: '900px', |
|||
stepItems: [{ |
|||
title: '填写信息' |
|||
}, { |
|||
title: '提交成功' |
|||
}] |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
// 用于提交盘点情况 |
|||
form.on('submit(formStep)', function (data) { |
|||
if(!flagForForm){ |
|||
flagForForm = true; |
|||
data = data.field; |
|||
data.depositoryId = depositoryId; |
|||
data.placeId = placeId; |
|||
let submitType = this.getAttribute("submitType"); |
|||
if ("Material" === submitType) { |
|||
data.departmentManager = departmentManagerIdForMaterial; |
|||
} else if ("Location" === submitType) { |
|||
data.departmentManager = departmentManagerIdForLocation; |
|||
} |
|||
$.ajax({ |
|||
url: "/stockTaking/submitStockTaking", |
|||
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 () { |
|||
step.next('#stepForm'); |
|||
}); |
|||
}, |
|||
complete: function () { |
|||
layer.close(this.layerIndex); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
form.on('submit(formStep2)', function (data) { |
|||
step.next('#stepForm'); |
|||
return false; |
|||
}); |
|||
|
|||
|
|||
$('.pre').click(function () { |
|||
step.pre('#stepForm'); |
|||
}); |
|||
|
|||
$('.next').click(function () { |
|||
step.next('#stepForm'); |
|||
}); |
|||
}) |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,265 @@ |
|||
<!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.6.3/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"> |
|||
</head> |
|||
<body> |
|||
<div class="layuimini-container"> |
|||
<div class="layuimini-main"> |
|||
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto; "> |
|||
<div carousel-item style="overflow: inherit"> |
|||
<div> |
|||
<form class="layui-form" |
|||
style="margin: 0 auto;max-width: 700px;" |
|||
lay-filter="form1"> |
|||
<div class="layui-card-body" style="padding-right: 0px"> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label">盘点位置:</label> |
|||
<div class="layui-input-block"> |
|||
<input type="text" class="layui-input" |
|||
th:value="${record.getDepositoryCode()}" |
|||
id="openSonByDepository" readonly |
|||
lay-verify="required"/> |
|||
<input type="text" name="depositoryId" class="layui-input" |
|||
th:value="${record.getDepositoryId()}" |
|||
id="depositoryId" |
|||
style="display: none" lay-verify="required"/> |
|||
<input type="text" name="placeId" class="layui-input" th:value="${record.getPid()}" |
|||
id="placeId" |
|||
style="display: none" lay-verify="required"/> |
|||
<input type="text" name="mpId" class="layui-input" th:value="${mpId}" |
|||
id="mpId" |
|||
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" class="layui-input" |
|||
th:value="${record.getMname()}" |
|||
id="mname" readonly/> |
|||
<input type="text" name="mid" class="layui-input" th:value="${record.getId()}" |
|||
id="mid" |
|||
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" class="layui-input" |
|||
th:value="${record.getCode()}" |
|||
id="mcode" readonly/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label">物料品牌:</label> |
|||
<div class="layui-input-block"> |
|||
<input type="text" class="layui-input" |
|||
th:value="${record.getBrand()}" |
|||
id="mbrand" readonly/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label">物料型号:</label> |
|||
<div class="layui-input-block"> |
|||
<input type="text" class="layui-input" |
|||
th:value="${record.getVersion()}" |
|||
id="mversion" readonly/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label">计量单位:</label> |
|||
<div class="layui-input-block"> |
|||
<select id="unit" name="unit"> |
|||
<option th:value="${record.getUnit()}" th:text="${record.getUnit()}"></option> |
|||
<option th:each="splitInfo,iterStar:${record.getSplitInfoList()}" |
|||
th:value="${splitInfo?.getNewUnit()}" |
|||
th:text="${splitInfo?.getNewUnit()}"></option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label">库存数量:</label> |
|||
<div class="layui-input-block"> |
|||
<input type="text" class="layui-input" |
|||
th:value="${record.getQuantity()}" |
|||
id="quantity" readonly/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label">盘点数量:</label> |
|||
<div class="layui-input-block"> |
|||
<input type="number" class="layui-input" id="newInventory" |
|||
onblur="calculateForMaterial(this)" |
|||
name="newInventory" |
|||
lay-verify="required"/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label">盘点结果:</label> |
|||
<div class="layui-input-block"> |
|||
<input name="takingResult" id="result" class="layui-input"/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label">盈亏数量:</label> |
|||
<div class="layui-input-block"> |
|||
<input type="number" class="layui-input" |
|||
readonly |
|||
id="Inventory_number" |
|||
name="inventory" lay-verify="required"/> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script> |
|||
<script> |
|||
|
|||
|
|||
layui.use(['form', 'flow', 'step', 'element'], function () { |
|||
var $ = layui.$, |
|||
step = layui.step, |
|||
element = layui.element, |
|||
form = layui.form; |
|||
|
|||
|
|||
// 用于分步表单加载 |
|||
step.render({ |
|||
elem: '#stepForm', |
|||
filter: 'stepForm', |
|||
width: '100%', //设置容器宽度 |
|||
stepWidth: '750px', |
|||
height: '1050px', |
|||
stepItems: [] |
|||
}); |
|||
|
|||
$(function() { |
|||
$.ajax({ |
|||
url: "/stockTaking/getTemporaryStorageForTakingResult", |
|||
type: "post", |
|||
dataType: 'json', |
|||
data: JSON.stringify({"mpId":$("#mpId").val()}), |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (res) { |
|||
let data = res.data; |
|||
if(data !== null){ |
|||
let nowUnit = $("#unit").val(); |
|||
let stockUnit = data.unit; |
|||
if(nowUnit !== stockUnit){ |
|||
$("#unit").val(stockUnit); |
|||
findInventoryForUnit({}); |
|||
form.render(); |
|||
} |
|||
$("#Inventory_number").val(data.number); |
|||
$("#result").val(data.takingResultString); |
|||
let takingResult = data.takingResult; |
|||
if("Inventory_up" === takingResult){ |
|||
// 如果盘盈 |
|||
$("#newInventory").val(Number(data.oldInventory) + Number(data.number)); |
|||
}else if("Inventory_down" === takingResult){ |
|||
// 如果盘亏 |
|||
$("#newInventory").val(Number(data.oldInventory) - Number(data.number)); |
|||
}else{ |
|||
// 如果正常 |
|||
$("#newInventory").val(0); |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
form.on('select()', function (data) { |
|||
var id = data.elem.id; //得到select原始DOM对象id |
|||
var req = {}; |
|||
if (id.includes("producedDate")) { |
|||
req.mid = $("#mid").val(); |
|||
req.producedDate = data.value; |
|||
$.ajax({ |
|||
url: "/material/findQuantityByProducedDate", |
|||
type: "post", |
|||
dataType: 'json', |
|||
data: JSON.stringify(req), |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
$("#quantity").val(d.data) |
|||
} |
|||
}); |
|||
} else if (id.includes("unit")) { |
|||
findInventoryForUnit(req); |
|||
} |
|||
}); |
|||
|
|||
findInventoryForUnit = function(req){ |
|||
req.mid = $("#mid").val(); |
|||
req.unit = $("#unit").val(); |
|||
req.placeId = $("#placeId").val(); |
|||
$.ajax({ |
|||
url: "/material/findQuantityByUnit", |
|||
type: "post", |
|||
dataType: 'json', |
|||
data: JSON.stringify(req), |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
$("#quantity").val(d.data); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
// 用于计算盘点结果 |
|||
calculateForMaterial = function (obj) { |
|||
let oldInventory = Number($("#quantity").val()); |
|||
let nowInventory = Number(obj.value); |
|||
let number = 0; |
|||
let takingResult = ''; |
|||
let takingResultString = ''; |
|||
let req = {}; |
|||
if ((oldInventory) > (nowInventory)) { |
|||
number = oldInventory - nowInventory; |
|||
takingResult = "Inventory_down"; |
|||
takingResultString = "盘亏"; |
|||
} else if ((oldInventory) < (nowInventory)) { |
|||
number = nowInventory - oldInventory; |
|||
takingResult = "Inventory_up"; |
|||
takingResultString = "盘盈"; |
|||
} else { |
|||
takingResult = "Inventory_normal"; |
|||
takingResultString = "正常"; |
|||
} |
|||
$("#result").val(takingResultString); |
|||
$("#Inventory_number").val(number); |
|||
req.number = number + ""; |
|||
req.takingResult = takingResult; |
|||
req.takingResultString = takingResultString; |
|||
req.id = $("#mpId").val(); |
|||
req.unit = $("#unit").val(); |
|||
req.oldInventory = oldInventory + ""; |
|||
$.ajax({ |
|||
url: "/stockTaking/temporaryStorageForTakingResult", |
|||
dataType: "json", |
|||
data: JSON.stringify(req), |
|||
type: "POST", |
|||
contentType: "application/json;charset=utf-8" |
|||
}); |
|||
}; |
|||
|
|||
}); |
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
|||
Loading…
Reference in new issue