You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
593 lines
24 KiB
593 lines
24 KiB
<!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">
|
|
<link rel="stylesheet" href="/static/lib/bootstrap-3.4.1-dist/css/bootstrap.min.css">
|
|
|
|
<style>
|
|
.editButton {
|
|
position: absolute;
|
|
top: 5px;
|
|
right: 15px;
|
|
|
|
}
|
|
|
|
.myEchart {
|
|
min-width: 500px;
|
|
min-height: 500px;
|
|
margin: 0 2px;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<input type="text" id="id" th:value="${record.getId()}" name="id" style="display: none">
|
|
<div class="layui-fluid">
|
|
<div class="layui-row layui-col-space1">
|
|
<div class="layui-row layui-col-xs12 layui-col-md8">
|
|
<div>
|
|
<div class="panel panel-info">
|
|
<div class="panel-heading">物料基本信息
|
|
<button type="button" th:attr="mid=${record.getMid()}" lay-on="editMaterialInfo"
|
|
th:style="'display:'+${display}"
|
|
class="editButton layui-btn layui-btn-sm layui-btn-primary">
|
|
<i class="layui-icon layui-icon-edit"></i>
|
|
</button>
|
|
</div>
|
|
<div class="panel-body">
|
|
<table class="table">
|
|
<tbody>
|
|
<tr>
|
|
<td th:text="'物料编码:'+${record.getCode()}">物料编码:</td>
|
|
<td th:text="'物料名称:'+${record.getMname()}">物料名称:</td>
|
|
<td th:text="'规格型号:'+${record.getVersion()}">规格型号:</td>
|
|
<td th:text="'物料材质:'+${record.getTexture()}">物料材质:</td>
|
|
</tr>
|
|
<tr>
|
|
<td th:text="'物料品牌:'+${record.getBrand()}">物料品牌:</td>
|
|
<td th:text="'物料类型:'+${record.getTypeName()}">物料类型:</td>
|
|
<td>
|
|
计量单位:
|
|
<span th:text="${record.getUnit()}"></span>
|
|
<span th:each="splitInfo,iterStar:${record.getSplitInfoList()}"
|
|
th:text="${splitInfo.getNewUnit()}"></span>
|
|
</td>
|
|
<td th:text="'物料单价:'+${record.getPrice()}" th:style="'display:'+${display}">物料单价:</td>
|
|
</tr>
|
|
<tr>
|
|
<td th:text="'物料备注:'+${record.getRemark()}">物料备注:</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="">
|
|
<div class="panel panel-success">
|
|
<div class="panel-heading">库存基本信息</div>
|
|
<div class="panel-body">
|
|
|
|
<!-- <table class="table">
|
|
<caption th:text="${record.getDepositoryName()}">所属仓库:</caption>
|
|
<caption th:text="'备注:'+${record.getRemark()}">备注:</caption>
|
|
|
|
<thead>
|
|
<tr>
|
|
<td>所处库位</td>
|
|
<td>计量单位</td>
|
|
<td>对应数量</td>
|
|
<td th:style="'display:'+${display}">金额</td>
|
|
<td>操作</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr type="button"
|
|
th:each="materialAndPlace,iterStar:${record.getMaterialAndPlaceList()}">
|
|
<td>
|
|
<button onclick="changePlaceCode(this)"
|
|
th:text="${materialAndPlace.getKingdeecode()}"
|
|
th:attr="id=${materialAndPlace.getId()}"
|
|
class="layui-btn layui-btn-primary layui-btn-sm"></button>
|
|
</td>
|
|
<td>
|
|
<select class="mySelect" onchange="changeUnitForQuantity(this)"
|
|
th:attr="id='materialUnit'+${materialAndPlace.getId()}">
|
|
<option th:text="${record.getUnit()}" value="-1"
|
|
class="myOption"></option>
|
|
<option class="myOption"
|
|
th:each="splitInfo,iterStar:${record.getSplitInfoList()}"
|
|
th:value="${splitInfo.getNewUnit()}"
|
|
th:text="${splitInfo.getNewUnit()}"></option>
|
|
</select>
|
|
|
|
</td>
|
|
<td>
|
|
<span th:attr="id='quantity'+${materialAndPlace.getId()}"
|
|
th:text="${materialAndPlace.getInventory()}"></span>
|
|
</td>
|
|
<td th:style="'display:'+${display}">
|
|
<span th:attr="id='amounts'+${materialAndPlace.getId()}"
|
|
th:text="${materialAndPlace.getAmount()}"></span>
|
|
</td>
|
|
<td>
|
|
<a class="layui-btn layui-btn-xs"
|
|
th:attr="mid=${materialAndPlace.getIid()},depositoryId=${materialAndPlace.getDepository_id()},placeId=${materialAndPlace.getPid()}"
|
|
lay-on="applicationIn">入库</a>
|
|
<a class="layui-btn layui-btn-xs"
|
|
th:attr="code=${materialAndPlace.getMcode()},depositoryId=${materialAndPlace.getDepository_id()}"
|
|
lay-on="applicationOut">出库</a>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>-->
|
|
<table class="layui-hide" id="currentTableId"></table>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-xs6 layui-col-md4">
|
|
<div>
|
|
<div class="panel panel-primary">
|
|
<div class="panel-heading">数据图标
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="layui-col-xs4 myEchart">
|
|
<div class="panel panel-warning">
|
|
<div class="panel-heading">物料入库明细</div>
|
|
<div class="panel-body">
|
|
<div id="echarts-line-in" style="height:500px;width: 500px;">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-xs4 myEchart">
|
|
<div class="panel panel-warning">
|
|
<div class="panel-heading">物料出库明细</div>
|
|
<div class="panel-body">
|
|
<div id="echarts-line-out" style="height: 500px;width: 500px">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-xs4 myEchart">
|
|
<div class="panel panel-warning">
|
|
<div class="panel-heading">物料库存明细</div>
|
|
<div class="panel-body">
|
|
<div id="echarts-line-inventory" style="height: 500px;width: 500px">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/html" id="currentTableBar">
|
|
<div class="layui-clear-space">
|
|
<a class="layui-btn layui-btn-xs" id="applicationIn{{d.id}}"
|
|
mid="{{d.id}}" depositoryId="{{d.depositoryId}}" placeId="{{d.materialAndPlaceList[0].pid}}"
|
|
lay-on="applicationIn">入库</a>
|
|
<a class="layui-btn layui-btn-xs" id="applicationOut{{d.id}}"
|
|
code="{{d.code}}" depositoryId="{{d.depositoryId}}"
|
|
lay-on="applicationOut">出库</a>
|
|
</div>
|
|
</script>
|
|
|
|
<script type="text/html" id="unitItemList">
|
|
<select id="unitItem{{d.id}}" lay-ignore onchange="changeUnitForQuantity(this)">
|
|
<option value="-1">{{d.unit}}</option>
|
|
{{# layui.each(d.splitInfoList, function(index, item){ }}
|
|
<option value="{{= item.newUnit}}">{{= item.newUnit }}</option>
|
|
{{# }); }}
|
|
</select>
|
|
</script>
|
|
|
|
<script type="text/html" id="placeItemList">
|
|
<select id="placeItem{{d.id}}" lay-ignore onchange="changePlaceForQuantity(this)">
|
|
{{# layui.each(d.materialAndPlaceList, function(index, item){ }}
|
|
<option pid="{{= item.pid}}" value="{{= item.id}}">{{= item.kingdeecode }}</option>
|
|
{{# }); }}
|
|
</select>
|
|
</script>
|
|
|
|
<script type="text/html" id="quantityItem">
|
|
<span class="layui-badge-rim" id="quantity{{d.id}}" style="margin-right: 10px;">库存数:{{d.materialAndPlaceList[0].inventory}}</span>
|
|
<span class="layui-badge-rim" id="amount{{d.id}}" style="margin-right: 10px;">总金额:{{d.materialAndPlaceList[0].amount}}</span>
|
|
</script>
|
|
|
|
<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 src="/static/lib/echarts/echarts.js" charset="utf-8"></script>
|
|
<script>
|
|
|
|
function updateInventoryRemark() {
|
|
|
|
}
|
|
|
|
function changePlaceCode() {
|
|
}
|
|
|
|
function changeUnitForQuantity() {
|
|
|
|
}
|
|
|
|
function changePlaceForQuantity() {
|
|
|
|
}
|
|
|
|
|
|
var barCode = [];
|
|
var flag = false;
|
|
layui.use(['form', 'laydate', 'util', 'table'], function () {
|
|
var form = layui.form,
|
|
laydate = layui.laydate,
|
|
$ = layui.$,
|
|
table = layui.table,
|
|
util = layui.util;
|
|
let iremark = $("#iremark").val();
|
|
let mid = $("#id").val();
|
|
|
|
table.render({
|
|
elem: "#currentTableId",
|
|
url: '/material/findInventoryByMid',
|
|
parseData: function (res) { //res 即为原始返回的数据
|
|
return {
|
|
"status": res.status, //解析接口状态
|
|
"message": res.statusInfo.message, //解析提示文本
|
|
"count": res.count, //解析数据长度
|
|
"data": res.data //解析数据列表
|
|
};
|
|
},
|
|
request: {
|
|
pageName: 'page', //页码的参数名称,默认:page
|
|
limitName: 'size' //每页数据量的参数名,默认:limit
|
|
},
|
|
where: {
|
|
"mid": mid
|
|
},
|
|
response: {
|
|
statusName: 'status' //规定数据状态的字段名称,默认:code
|
|
, statusCode: 200 //规定成功的状态码,默认:0
|
|
, msgName: 'message' //规定状态信息的字段名称,默认:msg
|
|
, countName: 'count' //规定数据总数的字段名称,默认:count
|
|
, dataName: 'data' //规定数据列表的字段名称,默认:data
|
|
},
|
|
cols: [
|
|
[
|
|
{type: "checkbox", width: 50},
|
|
{field: 'depositoryName', width: 200, title: '仓库名称'},
|
|
{
|
|
field: 'unit',
|
|
width: 100,
|
|
title: '计量单位',
|
|
templet: '#unitItemList',
|
|
},
|
|
{field: 'place', width: 100, title: '所处库位', templet: '#placeItemList'},
|
|
{title: '库存数', width: 230, templet: '#quantityItem', align: "center"},
|
|
{field: 'remark', width: 150, title: '备注'},
|
|
{title: '操作', width: 150, toolbar: '#currentTableBar', align: "center"},
|
|
|
|
]
|
|
],
|
|
limits: [10, 15, 20, 25, 50, 100],
|
|
limit: 10,
|
|
page: true,
|
|
skin: 'line',
|
|
done: function (res, curr, count) {
|
|
}
|
|
|
|
});
|
|
|
|
|
|
form.on('select()', function (data) {
|
|
var id = data.elem.id; //得到select原始DOM对象id
|
|
var req = {};
|
|
req.id = $("#id").val();
|
|
req.unit = data.value;
|
|
$.ajax({
|
|
url: "/material/findSplitInventoryByUnit",
|
|
type: "post",
|
|
dataType: 'json',
|
|
data: JSON.stringify(req),
|
|
contentType: "application/json;charset=utf-8",
|
|
success: function (d) {
|
|
$("#quantity").val(d.data)
|
|
}
|
|
});
|
|
});
|
|
|
|
util.on('lay-on', {
|
|
'editMaterialInfo': function (obj) {
|
|
let mid = $(obj).attr("mid");
|
|
layer.open({
|
|
type: 2,
|
|
offset: 'r',
|
|
anim: 'slideLeft', // 从右往左
|
|
area: ['40%', '100%'],
|
|
shade: 0.1,
|
|
title: "物料详情",
|
|
shadeClose: true,
|
|
id: 'ID-demo-layer-direction-r',
|
|
content: '/materialEditForInventory?id=' + mid,
|
|
end: function () {
|
|
location.reload();
|
|
}
|
|
|
|
});
|
|
},
|
|
'applicationIn': function (obj) {
|
|
let mid = $(obj).attr('mid');
|
|
let depositoryId = $(obj).attr('depositoryId');
|
|
let placeId = $(obj).attr('placeId');
|
|
layer.open({
|
|
type: 2,
|
|
offset: 'r',
|
|
anim: 'slideLeft', // 从右往左
|
|
area: ['40%', '100%'],
|
|
shade: 0.1,
|
|
title: "入库申请",
|
|
shadeClose: true,
|
|
id: 'ID-demo-layer-direction-r',
|
|
content: '/application_in_back?mid=' + mid + "&depositoryId=" + depositoryId + "&placeId=" + placeId
|
|
});
|
|
},
|
|
'applicationOut': function (obj) {
|
|
let code = $(obj).attr('code');
|
|
let depositoryId = $(obj).attr('depositoryId');
|
|
layer.open({
|
|
type: 2,
|
|
offset: 'r',
|
|
anim: 'slideLeft', // 从右往左
|
|
area: ['40%', '100%'],
|
|
shade: 0.1,
|
|
title: "出库申请",
|
|
shadeClose: true,
|
|
id: 'ID-demo-layer-direction-r',
|
|
content: '/application_out_back?code=' + code + "&depositoryId=" + depositoryId
|
|
});
|
|
},
|
|
});
|
|
|
|
updateInventoryRemark = function () {
|
|
let newIremark = $("#iremark").val();
|
|
let index = layer.confirm('确认更改备注?', {
|
|
btn: ['确定', '取消'] //按钮
|
|
}, function () {
|
|
let req = {};
|
|
req.id = mid;
|
|
req.remark = newIremark;
|
|
$.ajax({
|
|
url: "/material/updateInventoryRemark",
|
|
type: "post",
|
|
dataType: 'json',
|
|
data: JSON.stringify(req),
|
|
contentType: "application/json;charset=utf-8",
|
|
success: function (data) {
|
|
if (data.status >= 300) {
|
|
layer.msg(data.statusInfo.message, {
|
|
icon: 5,//失败的表情
|
|
time: 500 //1秒关闭(如果不配置,默认是3秒)
|
|
}, function () {
|
|
layer.close(index);
|
|
});
|
|
} else {
|
|
layer.msg("修改成功", {
|
|
icon: 6,//成功的表情
|
|
time: 500 //1秒关闭(如果不配置,默认是3秒)
|
|
}, function () {
|
|
layer.close(index);
|
|
})
|
|
}
|
|
}
|
|
});
|
|
}, function () {
|
|
$("#iremark").val(iremark);
|
|
});
|
|
};
|
|
|
|
// 用于更改同一仓库下的库位
|
|
changePlaceCode = function (obj) {
|
|
var id = $(obj).attr("id");
|
|
// 当前点击行中的计量单位按钮
|
|
let materialUnitObj = $("#materialUnit" + id + " option:selected");
|
|
let unit = materialUnitObj.val();
|
|
if (unit === -1 || unit === "-1") {
|
|
unit = materialUnitObj.text();
|
|
}
|
|
unit = unit.trim();
|
|
layer.open({
|
|
title: '选择库位',
|
|
type: 2,
|
|
shade: 0.2,
|
|
maxmin: true,
|
|
shadeClose: true,
|
|
area: ['70%', '70%'],
|
|
content: '/selectPlaceByDepository?id=' + id + '&unit=' + unit,
|
|
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 () {
|
|
location.reload();
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
/**
|
|
* 用于修改展示的库存数量
|
|
* @param obj
|
|
*/
|
|
changeUnitForQuantity = function (obj) {
|
|
let id = obj.id.split("unitItem")[1];
|
|
let unit = obj.value;
|
|
let placeAndMaterialId = $("#placeItem" + id).val();
|
|
let req = {};
|
|
req.unit = unit;
|
|
req.id = placeAndMaterialId;
|
|
$.ajax({
|
|
url: "/material/getQuantityForLocationAndUnit",
|
|
type: "post",
|
|
dataType: 'json',
|
|
data: JSON.stringify(req),
|
|
contentType: "application/json;charset=utf-8",
|
|
success: function (res) {
|
|
let data = res.data;
|
|
$("#quantity" + id).text("库存数:" + data.quantity);
|
|
$("#amount" + id).text("总金额:" + data.amount);
|
|
}
|
|
});
|
|
|
|
};
|
|
|
|
changePlaceForQuantity = function (obj) {
|
|
let pid = $(obj).find("option:selected").attr("pid");
|
|
let id = obj.id.split("placeItem")[1];
|
|
let placeAndMaterialId = obj.value;
|
|
$("#applicationIn"+id).attr("placeId",pid);
|
|
let unit = $("#unitItem" + id).val();
|
|
let req = {};
|
|
req.unit = unit;
|
|
req.id = placeAndMaterialId;
|
|
$.ajax({
|
|
url: "/material/getQuantityForLocationAndUnit",
|
|
type: "post",
|
|
dataType: 'json',
|
|
data: JSON.stringify(req),
|
|
contentType: "application/json;charset=utf-8",
|
|
success: function (res) {
|
|
let data = res.data;
|
|
$("#quantity" + id).text("库存数:" + data.quantity);
|
|
$("#amount" + id).text("总金额:" + data.amount);
|
|
|
|
}
|
|
});
|
|
|
|
};
|
|
|
|
|
|
// 柱状图
|
|
var echartLineChartIn = echarts.init(document.getElementById('echarts-line-in'));
|
|
var echartLineChartOut = echarts.init(document.getElementById('echarts-line-out'));
|
|
var echartLineChartInventory = echarts.init(document.getElementById('echarts-line-inventory'));
|
|
var optionLineChartIn = {
|
|
xAxis: {
|
|
type: 'category',
|
|
boundaryGap: false,
|
|
data: []
|
|
},
|
|
yAxis: {
|
|
type: 'value'
|
|
},
|
|
tooltip: {
|
|
trigger: "axis",
|
|
},
|
|
series: []
|
|
|
|
};
|
|
var optionLineChartOut = {
|
|
xAxis: {
|
|
type: 'category',
|
|
boundaryGap: false,
|
|
data: []
|
|
},
|
|
yAxis: {
|
|
type: 'value'
|
|
},
|
|
tooltip: {
|
|
trigger: "axis",
|
|
},
|
|
series: []
|
|
|
|
};
|
|
var optionLineChartInventory = {
|
|
xAxis: {
|
|
type: 'category',
|
|
boundaryGap: false,
|
|
data: []
|
|
},
|
|
yAxis: {
|
|
type: 'value'
|
|
},
|
|
tooltip: {
|
|
trigger: "axis",
|
|
},
|
|
series: []
|
|
|
|
};
|
|
|
|
/*$.ajax({
|
|
url: '/depositoryRecord/getApplicationForMaterial',
|
|
type: 'post',
|
|
async: true,
|
|
dataType: "json",
|
|
data: JSON.stringify({"id": id}),
|
|
contentType: "application/json;charset=utf-8",
|
|
complete: function (XHR, TS) {
|
|
layer.close(this.layerIndex);
|
|
if (XHR.status !== 200) {
|
|
layer.alert("系统繁忙,稍后重试");
|
|
}
|
|
},
|
|
beforeSend: function () {
|
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
|
|
},
|
|
success: function (result) {
|
|
let data = result.data;
|
|
let dayNames = data["dayNames"];
|
|
let amountItemForIn = data["amountItemForIn"];
|
|
let countItemForIn = data["countItemForIn"];
|
|
let amountItemForOut = data["amountItemForOut"];
|
|
let countItemForOut = data["countItemForOut"];
|
|
let countItemForInventory = data["countItemForInventory"];
|
|
let amountItemForInventory = data["amountItemForInventory"];
|
|
let legendItem = data["legend"];
|
|
let seriesInItem = [];
|
|
let seriesOutItem = [];
|
|
let seriesInventoryItem = [];
|
|
seriesInItem.push(amountItemForIn);
|
|
seriesInItem.push(countItemForIn);
|
|
seriesOutItem.push(amountItemForOut);
|
|
seriesOutItem.push(countItemForOut);
|
|
seriesInventoryItem.push(countItemForInventory);
|
|
seriesInventoryItem.push(amountItemForInventory);
|
|
optionLineChartIn.series = seriesInItem;
|
|
optionLineChartOut.series = seriesOutItem;
|
|
optionLineChartInventory.series = seriesInventoryItem;
|
|
|
|
optionLineChartIn.xAxis.data = dayNames;
|
|
optionLineChartIn.legend = legendItem;
|
|
optionLineChartOut.legend = legendItem;
|
|
optionLineChartOut.xAxis.data = dayNames;
|
|
optionLineChartInventory.legend = legendItem;
|
|
optionLineChartInventory.xAxis.data = dayNames;
|
|
echartLineChartIn.setOption(optionLineChartIn);
|
|
echartLineChartOut.setOption(optionLineChartOut);
|
|
echartLineChartInventory.setOption(optionLineChartInventory);
|
|
}
|
|
})*/
|
|
|
|
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|