首页预警代码提交
This commit is contained in:
parent
417cb7e497
commit
7f4d00ca00
|
|
@ -11,7 +11,6 @@
|
|||
<script src="${bonuspath}/static/js/layui/layui.js"></script>
|
||||
<meta charset="UTF-8">
|
||||
<title>预警信息</title>
|
||||
<%-- <link href="https://www.layuicdn.com/layui-v2.6.8/css/layui.css" rel="stylesheet">--%>
|
||||
|
||||
<style>
|
||||
.warning-container {
|
||||
|
|
@ -61,116 +60,123 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="warning-container">
|
||||
<div class="warning-tabs">
|
||||
<div class="warning-tab active" data-target="expire">计划到期</div>
|
||||
<div class="warning-tab" data-target="stock">库存不足</div>
|
||||
<div class="warning-tab" data-target="check">检验周期</div>
|
||||
<div class="warning-tab" data-target="occupy">长期占用</div>
|
||||
<div class="warning-tab" data-target="change">保有量变化</div>
|
||||
</div>
|
||||
|
||||
<!-- 计划到期预警 -->
|
||||
<div class="warning-content active" id="expire">
|
||||
<div class="search-box">
|
||||
<div class="layui-form">
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="projectName" placeholder="工程名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maName" placeholder="设备名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" lay-submit lay-filter="expireSearch">搜索</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="expireReset">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="expireTable" lay-filter="expireTable"></table>
|
||||
</div>
|
||||
|
||||
<!-- 库存不足 -->
|
||||
<div class="warning-content active" id="stock">
|
||||
<div class="search-box">
|
||||
<div class="layui-form">
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maName" placeholder="请输入机具名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maType" placeholder="请输入规格型号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" lay-submit lay-filter="stockSearch">搜索</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="stockReset">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="stockTable" lay-filter="stockTable"></table>
|
||||
</div>
|
||||
|
||||
<!-- 检验周期 -->
|
||||
<div class="warning-content" id="check">
|
||||
<div class="search-box">
|
||||
<div class="layui-form">
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maName" placeholder="请输入机具名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maType" placeholder="请输入规格型号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" lay-submit lay-filter="checkSearch">搜索</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="checkReset">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="checkTable" lay-filter="checkTable"></table>
|
||||
</div>
|
||||
|
||||
<!-- 长期占用 -->
|
||||
<div class="warning-content" id="occupy">
|
||||
<div class="search-box">
|
||||
<div class="layui-form">
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maName" placeholder="请输入机具名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maType" placeholder="请输入规格型号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" lay-submit lay-filter="occupySearch">搜索</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="occupyReset">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="occupyTable" lay-filter="occupyTable"></table>
|
||||
</div>
|
||||
|
||||
<!-- 保有量变化 -->
|
||||
<div class="warning-content" id="change">
|
||||
<div class="search-box">
|
||||
<div class="layui-form">
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maName" placeholder="请输入机具名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maType" placeholder="请输入规格型号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" lay-submit lay-filter="changeSearch">搜索</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="changeReset">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="changeTable" lay-filter="changeTable"></table>
|
||||
</div>
|
||||
<div class="warning-container">
|
||||
<div class="warning-tabs">
|
||||
<div class="warning-tab active" data-target="expire">计划到期</div>
|
||||
<div class="warning-tab" data-target="stock">库存不足</div>
|
||||
<div class="warning-tab" data-target="check">检验周期</div>
|
||||
<div class="warning-tab" data-target="occupy">长期占用</div>
|
||||
<div class="warning-tab" data-target="change">保有量变化</div>
|
||||
</div>
|
||||
|
||||
<script src="${bonuspath}/static/js/index/layui.min.js"></script>
|
||||
<script>
|
||||
<!-- 计划到期预警 -->
|
||||
<div class="warning-content active" id="expire">
|
||||
<div class="search-box">
|
||||
<div class="layui-form">
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="projectName" placeholder="工程名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maName" placeholder="设备名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" lay-submit lay-filter="expireSearch">搜索</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="expireReset">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="expireTable" lay-filter="expireTable"></table>
|
||||
</div>
|
||||
|
||||
<!-- 库存不足 -->
|
||||
<div class="warning-content" id="stock">
|
||||
<div class="search-box">
|
||||
<div class="layui-form">
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maName" placeholder="请输入机具名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maType" placeholder="请输入规格型号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" lay-submit lay-filter="stockSearch">搜索</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="stockReset">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/html" id="stockToolbar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="export">
|
||||
<i class="layui-icon layui-icon-export"></i> 导出
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
<table id="stockTable" lay-filter="stockTable"></table>
|
||||
</div>
|
||||
|
||||
<!-- 检验周期 -->
|
||||
<div class="warning-content" id="check">
|
||||
<div class="search-box">
|
||||
<div class="layui-form">
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maName" placeholder="请输入机具名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maType" placeholder="请输入规格型号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" lay-submit lay-filter="checkSearch">搜索</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="checkReset">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="checkTable" lay-filter="checkTable"></table>
|
||||
</div>
|
||||
|
||||
<!-- 长期占用 -->
|
||||
<div class="warning-content" id="occupy">
|
||||
<div class="search-box">
|
||||
<div class="layui-form">
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maName" placeholder="请输入机具名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maType" placeholder="请输入规格型号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" lay-submit lay-filter="occupySearch">搜索</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="occupyReset">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="occupyTable" lay-filter="occupyTable"></table>
|
||||
</div>
|
||||
|
||||
<!-- 保有量变化 -->
|
||||
<div class="warning-content" id="change">
|
||||
<div class="search-box">
|
||||
<div class="layui-form">
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maName" placeholder="请输入机具名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="maType" placeholder="请输入规格型号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" lay-submit lay-filter="changeSearch">搜索</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="changeReset">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="changeTable" lay-filter="changeTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="${bonuspath}/static/js/index/layui.min.js"></script>
|
||||
<script>
|
||||
layui.use(['table', 'form'], function(){
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
|
|
@ -212,9 +218,9 @@
|
|||
height: 'full-100',
|
||||
method: 'post',
|
||||
page: true,
|
||||
limit: 50, // 每页显示的条数
|
||||
limits: [10, 20, 50, 100], // 每页条数的选择项
|
||||
loading: true, // 显示加载条
|
||||
limit: 50,
|
||||
limits: [10, 20, 50, 100],
|
||||
loading: true,
|
||||
cols: [[
|
||||
{type: 'numbers', title: '序号', width: '5%'},
|
||||
{field: 'projectName', title: '工程名称', width: '18%'},
|
||||
|
|
@ -222,17 +228,17 @@
|
|||
{field: 'needNum', title: '领用数量', width: '8%'},
|
||||
{field: 'backDate', title: '计划归还时间', width: '10%'},
|
||||
{ title: '状态', width: '10%',templet:function(d) {
|
||||
if (d.planStatus == null) {
|
||||
return '';
|
||||
}
|
||||
if (d.planStatus.indexOf("已过期") !== -1) {
|
||||
return '<span style="color: red;">' + d.planStatus + '</span>';
|
||||
}
|
||||
if (d.planStatus === "今天到期") {
|
||||
return '<span style="color: #dea54c;">' + d.planStatus + '</span>';
|
||||
}
|
||||
return d.planStatus;
|
||||
}},
|
||||
if (d.planStatus == null) {
|
||||
return '';
|
||||
}
|
||||
if (d.planStatus.indexOf("已过期") !== -1) {
|
||||
return '<span style="color: red;">' + d.planStatus + '</span>';
|
||||
}
|
||||
if (d.planStatus === "今天到期") {
|
||||
return '<span style="color: #dea54c;">' + d.planStatus + '</span>';
|
||||
}
|
||||
return d.planStatus;
|
||||
}},
|
||||
{field: 'maType', title: '设备类型', width: '10%'},
|
||||
{field: 'maName', title: '设备名称', width: '10%'},
|
||||
{field: 'maModel', title: '规格型号', width: '12%'},
|
||||
|
|
@ -244,19 +250,17 @@
|
|||
parseData: function(res) {
|
||||
var data = [];
|
||||
if(res.obj && Array.isArray(res.obj)) {
|
||||
// 根据当前页码和每页条数计算起始索引
|
||||
var curr = this.page.curr || 1;
|
||||
var limit = this.page.limit || 50;
|
||||
var start = (curr - 1) * limit;
|
||||
var end = start + limit;
|
||||
// 截取对应页的数据
|
||||
data = res.obj.slice(start, end);
|
||||
}
|
||||
return {
|
||||
"code": 200,
|
||||
"msg": res.resMsg,
|
||||
"count": res.obj ? res.obj.length : 0, // 总数据条数
|
||||
"data": data // 当前页数据
|
||||
"count": res.obj ? res.obj.length : 0,
|
||||
"data": data
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
@ -270,14 +274,15 @@
|
|||
height: 'full-100',
|
||||
method: 'post',
|
||||
page: true,
|
||||
limit: 20, // 每页显示的条数
|
||||
limits: [10, 20, 30, 50], // 每页条数的选择项
|
||||
loading: true, // 显示加载条
|
||||
limit: 20,
|
||||
limits: [10, 20, 30, 50],
|
||||
loading: true,
|
||||
toolbar: '#stockToolbar',
|
||||
cols: [[
|
||||
{type: 'numbers', title: '序号', width: '10%'},
|
||||
{ title: '机具类别', width: '20%',templet:function(d) {
|
||||
return d.isCount === '0' ? '设备' : '机具';
|
||||
}},
|
||||
return d.isCount === '0' ? '设备' : '机具';
|
||||
}},
|
||||
{field: 'maType', title: '机具名称', width: '20%'},
|
||||
{field: 'maName', title: '规格型号', width: '25%'},
|
||||
{field: 'storageNum', title: '库存量', width: '10%'},
|
||||
|
|
@ -289,22 +294,27 @@
|
|||
parseData: function(res) {
|
||||
var data = [];
|
||||
if(res.obj && Array.isArray(res.obj)) {
|
||||
// 根据当前页码和每页条数计算起始索引
|
||||
var curr = this.page.curr || 1;
|
||||
var limit = this.page.limit || 50;
|
||||
var start = (curr - 1) * limit;
|
||||
var end = start + limit;
|
||||
// 截取对应页的数据
|
||||
data = res.obj.slice(start, end);
|
||||
}
|
||||
return {
|
||||
"code": 200,
|
||||
"msg": res.resMsg,
|
||||
"count": res.obj ? res.obj.length : 0, // 总数据条数
|
||||
"data": data // 当前页数据
|
||||
"count": res.obj ? res.obj.length : 0,
|
||||
"data": data
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// 监听工具栏事件
|
||||
table.on('toolbar(stockTable)', function(obj){
|
||||
if(obj.event === 'export'){
|
||||
exportStockData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化检验周期表格
|
||||
|
|
@ -319,38 +329,38 @@
|
|||
limits: [10, 20, 30, 50],
|
||||
loading: true,
|
||||
cols: [[
|
||||
{type: 'numbers', title: '序号', width: '5%'}, // 序号
|
||||
{type: 'numbers', title: '序号', width: '5%'},
|
||||
{field: 'deviceType', title: '机具类别', width: '5%',templet:function(d) {
|
||||
return d.isCount === '0' ? '设备' : '机具';
|
||||
}},
|
||||
return d.isCount === '0' ? '设备' : '机具';
|
||||
}},
|
||||
{field: 'maType', title: '机具名称', width: '10%'},
|
||||
{field: 'maName', title: '规格型号', width: '10%'},
|
||||
{field: 'maCode', title: '设备编码', width: '10%'},
|
||||
{field: 'thisCheckTime', title: '下次检验时间', width: '10%'},
|
||||
{field: 'nextCheckTime', title: '距下次检验时长', width: '10%'},
|
||||
{field: 'maStatus', title: '状态', width: '10%',templet:function(d) {
|
||||
switch(d.maStatus) {
|
||||
case '1': return '待通知';
|
||||
case '2': return '待检验';
|
||||
case '3': return '待打印';
|
||||
case '4': return '待入库';
|
||||
case '5': return '在库';
|
||||
case '6': return '在用';
|
||||
case '7': return '在修';
|
||||
case '8': return '在检';
|
||||
case '9': return '修饰后待入库';
|
||||
case '10': return '待报废';
|
||||
case '11': return '已报废';
|
||||
case '12': return '报废封存';
|
||||
case '13': return '在检';
|
||||
case '14': return '在审';
|
||||
case '15': return '出库审核通过';
|
||||
case '16': return '待报废检验';
|
||||
case '17': return '待封存检验';
|
||||
case '19': return '维修合格';
|
||||
default: return '未知';
|
||||
}
|
||||
}},
|
||||
switch(d.maStatus) {
|
||||
case '1': return '待通知';
|
||||
case '2': return '待检验';
|
||||
case '3': return '待打印';
|
||||
case '4': return '待入库';
|
||||
case '5': return '在库';
|
||||
case '6': return '在用';
|
||||
case '7': return '在修';
|
||||
case '8': return '在检';
|
||||
case '9': return '修饰后待入库';
|
||||
case '10': return '待报废';
|
||||
case '11': return '已报废';
|
||||
case '12': return '报废封存';
|
||||
case '13': return '在检';
|
||||
case '14': return '在审';
|
||||
case '15': return '出库审核通过';
|
||||
case '16': return '待报废检验';
|
||||
case '17': return '待封存检验';
|
||||
case '19': return '维修合格';
|
||||
default: return '未知';
|
||||
}
|
||||
}},
|
||||
{field: 'projectName', title: '在用工程', width: '10%'},
|
||||
{field: 'agreementCode', title: '协议号', width: '10%'},
|
||||
{field: 'companyName', title: '施工单位', width: '10%'}
|
||||
|
|
@ -377,6 +387,47 @@
|
|||
});
|
||||
}
|
||||
|
||||
// 导出库存不足数据
|
||||
function exportStockData() {
|
||||
// 获取搜索条件
|
||||
var maName = $('#stock input[name="maName"]').val();
|
||||
var maType = $('#stock input[name="maType"]').val();
|
||||
|
||||
// 构建请求参数
|
||||
var params = {
|
||||
maName: maName || '',
|
||||
maType: maType || ''
|
||||
};
|
||||
|
||||
// 构建URL参数
|
||||
var queryParams = [];
|
||||
for(var key in params){
|
||||
if(params[key]){
|
||||
queryParams.push(key + '=' + encodeURIComponent(params[key]));
|
||||
}
|
||||
}
|
||||
|
||||
var url = '${bonuspath}/backstage/indexHomeDetails/exportStorageWarn';
|
||||
if(queryParams.length > 0){
|
||||
url += '?' + queryParams.join('&');
|
||||
}
|
||||
|
||||
// 使用layer提示
|
||||
layer.load(1);
|
||||
|
||||
// 创建隐藏的iframe下载文件
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
iframe.src = url;
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
// 移除iframe
|
||||
setTimeout(function(){
|
||||
document.body.removeChild(iframe);
|
||||
layer.closeAll('loading');
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
// 初始化长期占用表格
|
||||
function initOccupyTable() {
|
||||
table.render({
|
||||
|
|
@ -389,10 +440,10 @@
|
|||
limits: [10, 20, 30, 50],
|
||||
loading: true,
|
||||
cols: [[
|
||||
{type: 'numbers', title: '序号', width: '7%'}, // 序号
|
||||
{type: 'numbers', title: '序号', width: '7%'},
|
||||
{field: 'deviceType', title: '机具类别', width: '8%',templet:function(d) {
|
||||
return d.isCount === '0' ? '设备' : '机具';
|
||||
}},
|
||||
return d.isCount === '0' ? '设备' : '机具';
|
||||
}},
|
||||
{field: 'maType', title: '机具名称', width: '10%'},
|
||||
{field: 'maName', title: '规格型号', width: '20%'},
|
||||
{field: 'inuseNum', title: '长期占用量', width: '10%'},
|
||||
|
|
@ -436,19 +487,19 @@
|
|||
cols: [[
|
||||
{type: 'numbers', title: '序号', width: '5%'},
|
||||
{title: '机具类别', width: '6%',templet:function(d) {
|
||||
return d.isCount === '0' ? '设备' : '机具';
|
||||
}},
|
||||
return d.isCount === '0' ? '设备' : '机具';
|
||||
}},
|
||||
{field: 'maType', title: '机具名称', width: '14%'},
|
||||
{field: 'maName', title: '规格型号', width: '15%'},
|
||||
{field: 'total', title: '总保有量', width: '6%'},
|
||||
{title: '在库/在用/在修', width: '10%',templet:function(d) {
|
||||
return (d.storageNum | 0) + '/' + (d.inuseNum | 0) + '/' + (d.repairNum | 0);
|
||||
}},
|
||||
return (d.storageNum | 0) + '/' + (d.inuseNum | 0) + '/' + (d.repairNum | 0);
|
||||
}},
|
||||
{field: 'time', title: '最后更新时间', width: '12%'},
|
||||
{field: 'content', title: '保有量变化概述', width: '22%'},
|
||||
{field: 'operation', title: '操作', width: '10%', templet: function(d){
|
||||
return '<a class="layui-btn layui-btn-xs" lay-event="detail">查看来源</a>';
|
||||
}}
|
||||
return '<a class="layui-btn layui-btn-xs" lay-event="detail">查看来源</a>';
|
||||
}}
|
||||
]],
|
||||
response: {
|
||||
statusCode: 200
|
||||
|
|
@ -621,6 +672,6 @@
|
|||
// 默认加载超期领用预警表格
|
||||
initExpireTable();
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -597,7 +597,7 @@
|
|||
mt.`NAME` as maName,
|
||||
mt.UNIT as maUnit,
|
||||
mt.is_COUNT AS isCount,
|
||||
mt.NUM as storageNum
|
||||
CAST(mt.NUM AS SIGNED) AS storageNum
|
||||
FROM
|
||||
mm_type mt
|
||||
LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID
|
||||
|
|
@ -641,33 +641,52 @@
|
|||
|
||||
<select id="getInUseWarn" parameterType="com.bonus.index.beans.IndexInuseWarnBean" resultType="com.bonus.index.beans.IndexInuseWarnBean">
|
||||
SELECT
|
||||
mt2.`NAME` as maType,
|
||||
mt.`NAME` as maName,
|
||||
mt.UNIT as maUnit,
|
||||
COUNT( DISTINCT mm.ID) as inuseNum,
|
||||
MIN(mtp.start_date) as outTime,
|
||||
mt.IS_COUNT as isCount,
|
||||
to_days(now()) -to_days(mtp.start_date) as days ,
|
||||
wla.`CODE` as agreementCode,
|
||||
bc.`NAME` as projectName,
|
||||
bp.`NAME` as companyName
|
||||
FROM
|
||||
ma_type_project_storage mtp
|
||||
LEFT JOIN mm_machines mm on mtp.machine = mm.ID
|
||||
LEFT JOIN mm_type mt on mm.TYPE = mt.ID
|
||||
LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID
|
||||
LEFT JOIN wf_lease_agreement wla on mtp.agreement_id = wla.ID
|
||||
LEFT JOIN bm_project bp on wla.PROJECT = bp.ID
|
||||
LEFT JOIN bm_company bc on bp.COMPANY_ID = bc.ID
|
||||
WHERE mm.BATCH_STATUS=6 and mtp.`status` =1
|
||||
<if test="maType != null and maType != ''">
|
||||
mt2.`NAME` AS maType,
|
||||
mt.`NAME` AS maName,
|
||||
mt.UNIT AS maUnit,
|
||||
COUNT( DISTINCT mm.ID ) AS inuseNum,
|
||||
MIN( filtered_mtp.start_date ) AS outTime,
|
||||
mt.IS_COUNT AS isCount,
|
||||
DATEDIFF(
|
||||
NOW(),
|
||||
MIN( filtered_mtp.start_date )) AS days,
|
||||
wla.`CODE` AS agreementCode,
|
||||
bp.`NAME` AS projectName,
|
||||
bc.`NAME` AS companyName
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
ps.machine,
|
||||
ps.agreement_id,
|
||||
ps.start_date
|
||||
FROM
|
||||
ma_type_project_storage ps
|
||||
INNER JOIN mm_machines mm ON ps.machine = mm.ID
|
||||
WHERE
|
||||
ps.`status` = 1
|
||||
AND ps.`end_date` is null
|
||||
AND mm.BATCH_STATUS = 6
|
||||
AND DATEDIFF( NOW(), ps.start_date ) > 180
|
||||
) AS filtered_mtp
|
||||
INNER JOIN mm_machines mm ON filtered_mtp.machine = mm.ID
|
||||
INNER JOIN mm_type mt ON mm.TYPE = mt.ID
|
||||
LEFT JOIN mm_type mt2 ON mt.PARENT_ID = mt2.ID
|
||||
LEFT JOIN wf_lease_agreement wla ON filtered_mtp.agreement_id = wla.ID
|
||||
LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID
|
||||
LEFT JOIN bm_company bc ON bp.COMPANY_ID = bc.ID
|
||||
where 1=1
|
||||
<if test="maType != null and maType != ''">
|
||||
and mt2.`NAME` like concat('%', #{maType}, '%')
|
||||
</if>
|
||||
<if test="maName != null and maName != ''">
|
||||
and mt.`NAME` like concat('%', #{maName}, '%')
|
||||
</if>
|
||||
GROUP BY mm.TYPE
|
||||
HAVING days > 180
|
||||
GROUP BY
|
||||
mt.ID,
|
||||
mt2.ID,
|
||||
wla.ID,
|
||||
bp.ID,
|
||||
bc.ID
|
||||
</select>
|
||||
|
||||
<select id="getTotalChangeWarn" parameterType="com.bonus.index.beans.IndexTotalWarnBean" resultType="com.bonus.index.beans.IndexTotalWarnBean">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,19 @@
|
|||
package com.bonus.index.controller;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.bonus.ma.beans.pickDetailsBean;
|
||||
import com.bonus.sys.*;
|
||||
import com.bonus.sys.beans.UserBean;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
|
|
@ -9,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.bonus.exp.POIOutputHelper;
|
||||
import com.bonus.index.beans.IndexCheckWarnBean;
|
||||
import com.bonus.index.beans.IndexHomeCalendarBean;
|
||||
import com.bonus.index.beans.IndexHomeDetailsBean;
|
||||
|
|
@ -19,9 +32,6 @@ import com.bonus.index.beans.IndexStorageWarnBean;
|
|||
import com.bonus.index.beans.IndexTodoWarnBean;
|
||||
import com.bonus.index.beans.IndexTotalWarnBean;
|
||||
import com.bonus.index.service.IndexHomeDetailsService;
|
||||
import com.bonus.sys.AjaxRes;
|
||||
import com.bonus.sys.BaseController;
|
||||
import com.bonus.sys.GlobalConst;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/backstage/indexHomeDetails/")
|
||||
|
|
@ -235,6 +245,63 @@ public class IndexHomeDetailsController extends BaseController<IndexHomeDetailsB
|
|||
}
|
||||
return ar;
|
||||
}
|
||||
// 库存不足-导出
|
||||
@RequestMapping(value = "exportStorageWarn", method = RequestMethod.GET)
|
||||
public void export(HttpServletResponse response, IndexStorageWarnBean o) {
|
||||
try {
|
||||
List<IndexStorageWarnBean> list = service.getStorageWarn(o);
|
||||
expOutExcel(response, list, "库存不足预警导出");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void expOutExcel(HttpServletResponse response, List<IndexStorageWarnBean> list, String filename)
|
||||
throws Exception {
|
||||
if (list != null) {
|
||||
List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
IndexStorageWarnBean bean = list.get(i);
|
||||
Map<String, Object> maps = outMaLeaseBeanToMap(i, bean);
|
||||
results.add(maps);
|
||||
}
|
||||
|
||||
List<String> headers = reportHeader();
|
||||
HSSFWorkbook workbook = POIOutputHelper.excel(results, headers, filename);
|
||||
OutputStream out = null;
|
||||
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||
response.addHeader("Content-Disposition",
|
||||
"attachment;filename=" + URLEncoder.encode(filename, "UTF-8") + ".xls");
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
out = response.getOutputStream();
|
||||
workbook.write(out);
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> outMaLeaseBeanToMap(int i, IndexStorageWarnBean o) {
|
||||
Map<String, Object> maps = new LinkedHashMap<String, Object>();
|
||||
maps.put("id", i + 1);
|
||||
maps.put("isCount", o.getIsCount().equals("0")?"设备":"机具");
|
||||
maps.put("maType", o.getMaType());
|
||||
maps.put("maName", o.getMaName());
|
||||
maps.put("storageNum", o.getStorageNum());
|
||||
maps.put("maUnit", o.getMaUnit());
|
||||
return maps;
|
||||
}
|
||||
|
||||
private List<String> reportHeader() {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
list.add("序号");
|
||||
list.add("机具类别");
|
||||
list.add("机具名称");
|
||||
list.add("规格型号");
|
||||
list.add("库存量");
|
||||
list.add("单位");
|
||||
return list;
|
||||
}
|
||||
|
||||
// 检验周期
|
||||
@RequestMapping(value = "getCheckWarn", method = RequestMethod.POST)
|
||||
|
|
|
|||
Loading…
Reference in New Issue