统计任务看板

This commit is contained in:
2022-06-30 15:45:59 +08:00
parent 805db30284
commit 2f27393184
4 changed files with 335 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
package org.nl.wms.sb.stat.websocket;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.mnt.websocket.MsgType;
import org.nl.modules.mnt.websocket.SocketMsg;
import org.nl.modules.mnt.websocket.WebSocketServer;
import org.nl.wms.pf.service.AutoPfTaskService;
import org.nl.wql.WQL;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.HashMap;
@Slf4j
@Component
@RequiredArgsConstructor
public class AutoWebSocketTask {
public void run() {
try {
String today = DateUtil.today();
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
map.put("today", "%"+today+"%");
JSONArray resultJSONArray = WQL.getWO("TASK_AUTOWEBSOCKETTSK").addParamMap(map).process().getResultJSONArray(0);
SocketMsg socketMsg = new SocketMsg(resultJSONArray, MsgType.INFO);
WebSocketServer.sendInfo(socketMsg,"20");
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,163 @@
[交易说明]
交易名: 实时查询统计任务
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.today TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
QUERY
SELECT
mst.input_time AS input_time,
mst.repair_code AS repair_code,
(
CASE
mst.maintenancecycle
WHEN '01' THEN '计划维修'
WHEN '02' THEN '临时维修'
END
) AS maintenancecycle,
file.device_code,
file.device_name,
(
CASE
mst.invstatus
WHEN '01' THEN '生成'
WHEN '02' THEN '提交'
WHEN '03' THEN '开始'
WHEN '04' THEN '委外维修'
WHEN '05' THEN '委外验收'
WHEN '06' THEN '结束'
WHEN '07' THEN '确认'
WHEN '99' THEN '审核'
END
) AS invstatus,
mst.real_start_date,
mst.real_end_date
FROM
EM_BI_DeviceRepairMst mst
LEFT JOIN EM_BI_EquipmentFile file ON mst.devicerecord_id = file.devicerecord_id
WHERE
mst.is_delete = '0'
AND (mst.invstatus <> '99' or (mst.invstatus = '99' and mst.audit_time like 输入.today))
AND ( ISNULL( mst.source_bill_id ) OR mst.source_bill_type = 'WXJH' )
UNION
SELECT
st.create_time AS input_time,
st.request_code AS repair_code,
class.class_name AS maintenancecycle,
file.device_code,
file.device_name,
(
CASE
st.is_passed
WHEN '0' THEN
(
CASE st.is_passed
WHEN '0' THEN '否'
WHEN '1' THEN '是'
END
)
WHEN '1' THEN
(
CASE mst.invstatus
WHEN '01' THEN '生成'
WHEN '02' THEN '提交'
WHEN '03' THEN '开始'
WHEN '04' THEN '委外维修'
WHEN '05' THEN '委外验收'
WHEN '06' THEN '结束'
WHEN '07' THEN '确认'
WHEN '99' THEN '审核'
END
)
END
) AS invstatus,
mst.real_start_date,
mst.real_end_date
FROM
EM_BI_DeviceRepairRequest st
LEFT JOIN EM_BI_EquipmentFile file ON st.devicerecord_id = file.devicerecord_id
LEFT JOIN md_pb_classstandard class ON class.class_id = st.device_faultclass_id
LEFT JOIN EM_BI_DeviceRepairMst mst ON mst.source_bill_id = st.request_id
WHERE
st.is_delete = '0'
AND (st.status <> '99' or (st.status = '99' and st.finish_time like 输入.today))
AND mst.source_bill_type = 'BXD'
UNION
SELECT
mst.input_time AS input_time,
mst.maint_code AS repair_code,
(
CASE
mst.maintenancecycle
WHEN '01' THEN '计划保养'
WHEN '02' THEN '临时保养'
END
) AS maintenancecycle,
file.device_code,
file.device_name,
(
CASE
mst.invstatus
WHEN '01' THEN '生成'
WHEN '02' THEN '提交'
WHEN '03' THEN '开始'
WHEN '04' THEN '结束'
WHEN '05' THEN '确认'
WHEN '99' THEN '审核'
END
) AS invstatus,
mst.real_start_date,
mst.real_end_date
FROM
EM_BI_DeviceMaintenanceMst mst
LEFT JOIN EM_BI_EquipmentFile file ON mst.devicerecord_id = file.devicerecord_id
WHERE
mst.is_delete = '0'
AND (mst.invstatus <> '99' or (mst.invstatus = '99' and mst.audit_time like 输入.today))
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -17,6 +17,12 @@ export const constantRouterMap = [
hidden: true,
meta: { title: '扩展屏' }
},
{
path: '/bigScreen/task/stat',
component: (resolve) => require(['@/views/wms/sb/stat/task/bigScreen'], resolve),
hidden: true,
meta: { title: '任务看板' }
},
{
path: '/404',
component: (resolve) => require(['@/views/features/404'], resolve),

View File

@@ -0,0 +1,128 @@
<template>
<div style="border: 1px solid #938d8d;margin-left: 10px;margin-right: 10px;">
<el-row>
<el-col :span="12">
<div class="grid-content bg-purple"><h2 style="margin-left: 30px;padding-top: 10px;">统计任务看板</h2></div>
</el-col>
<el-col :span="12">
<div class="grid-content bg-purple-light">
<h2 style="text-align:right;margin-right: 140px;">{{ getTime }}</h2>
</div>
<div class="grid-content bg-purple-light">
<p style="text-align:right;margin-right: 110px;"><b>{{ getDate }}</b></p>
</div>
</el-col>
</el-row>
<br>
<br>
<div>
<!--表格渲染-->
<el-table
ref="table"
:data="tableData"
size="small"
style="width: 100%;"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="input_time" label="生成时间" />
<el-table-column prop="repair_code" label="任务号" />
<el-table-column prop="maintenancecycle" label="任务类型" />
<!-- <el-table-column prop="" label="部门" />-->
<el-table-column prop="device_code" label="设备编码" />
<el-table-column prop="device_name" label="设备名称" />
<el-table-column prop="invstatus" label="状态" />
<el-table-column prop="real_start_date" label="开始时间" />
<el-table-column prop="real_end_date" label="结束时间" />
</el-table>
<!--分页组件-->
</div>
</div>
</template>
<script>
import crud from '@/mixins/crud'
export default {
name: 'BigscreenTask',
mixins: [crud],
data() {
return {
path: 'ws://localhost:8010/webSocket/20',
currentDate: new Date(),
getTime: '',
getDate: '',
tableData: []
}
},
created() {
},
mounted() {
// 定时器
const timer = setInterval(() => {
this.settime()// 你所加载数据的方法
}, 1000)
// 销毁定时器
this.$once('hook:beforeDestroy', () => {
clearInterval(timer)
})
this.init()
},
methods: {
settime() {
const _this = this
const yy = new Date().getFullYear()
const mm = new Date().getMonth() + 1
const dd = new Date().getDate()
const hh = new Date().getHours()
const mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
_this.getDate = yy + '年' + mm + '月' + dd + '日 ' + '星期' + '日一二三四五六'.charAt(new Date().getDay())
_this.getTime = hh + ':' + mf + ':' + ss
},
// webSocket
init: function() {
if (typeof (WebSocket) === 'undefined') {
alert('您的浏览器不支持socket')
} else {
// 实例化socket
this.socket = new WebSocket(this.path)
// 监听socket连接
this.socket.onopen = this.open
// 监听socket错误信息
this.socket.onerror = this.error
// 监听socket消息
this.socket.onmessage = this.getMessage
}
},
open: function() {
console.log('socket连接成功')
},
error: function() {
console.log('连接错误')
},
getMessage: function(msg) {
debugger
const data = JSON.parse(msg.data)
this.tableData = data.msg
},
send: function() {
// eslint-disable-next-line no-undef
this.socket.send(params)
},
close: function() {
console.log('socket已经关闭')
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>