Andon监控

This commit is contained in:
caoxinyu
2019-05-11 17:10:41 +08:00
parent 9754debef3
commit fe0ba3d7bd
8 changed files with 190 additions and 7 deletions

View File

@@ -172,7 +172,7 @@ export default {
this.Partpaint = response.data[0].零件图号
return this.Partpaint
}).then(() => {
this. getCraftNumber()
this.getCraftNumber()
})
// this.getscantable()
},
@@ -188,27 +188,27 @@ export default {
} else {
this.listLoading = true
searchTable(this.partNumber).then(response => {
if(response.data.length === 0) {
if (response.data.length === 0) {
this.listLoading = false
this.$notify({
title: '警告',
message: '该零件未加工完成',
type: 'warning'
})
}else {
} else {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].考核状态 === 8) {
this.listLoading = false
this.$notify({
title: '警告',
message: 'P' + response.data[i].工艺计划流水号 + '已入库',
message: 'P' + response.data[i].工艺计划流水号 + '已入库',
type: 'warning'
})
} else if (response.data[i].考核状态 === 9) {
this.listLoading = false
this.$notify({
title: '警告',
message: 'P' + response.data[i].工艺计划流水号 + '已出库',
message: 'P' + response.data[i].工艺计划流水号 + '已出库',
type: 'warning'
})
} else if (response.data[i].考核状态 === 7) {
@@ -223,7 +223,7 @@ export default {
机床图号: response.data[i].机床图号,
零件图号: response.data[i].零件图号
})
let hash = {}; // 一个新数组data为你需要去重的数组newData用于接收去重后的数组, curVal.去重条件
const hash = {} // 一个新数组data为你需要去重的数组newData用于接收去重后的数组, curVal.去重条件
this.tableDataNum = this.tableData.reduce((preVal, curVal) => {
hash[curVal.工艺计划流水号] ? '' : hash[curVal.工艺计划流水号] = true && preVal.push({
工艺计划流水号: curVal.工艺计划流水号,
@@ -234,7 +234,7 @@ export default {
innumber: curVal.innumber,
capture: '',
note: ''
});
})
return preVal
}, [])
}

View File

@@ -0,0 +1,153 @@
<template>
<div>
<el-card>
<el-badge :value="value" class="item" style="margin-bottom: 10px; float: right">
<el-button size="small" @click="openWindow">Andon信息</el-button>
</el-badge>
<el-table
:data="tableData"
style="width: 100%;"
size="mini"
height="800"
highlight-current-row
border>
<el-table-column align="center" label="工位号">
<template slot-scope="scope">
<el-button type="text">{{ scope.row.工位号 }}</el-button>
</template>
</el-table-column>
<el-table-column align="center" label="登陆人">
<template slot-scope="scope">
<el-tag v-if="scope.row.姓名===''||scope.row.姓名===null" slot="reference" size="small" style="width: 80px" type="warning">未登录</el-tag>
<el-tag v-else slot="reference" type="success" size="small" style="width: 80px"> {{ scope.row.姓名 }} </el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="呼叫类型">
<template slot-scope="scope">
<div v-if="scope.row.呼叫备注===''|| scope.row.呼叫备注===null"><div style="width: 12px;height: 12px;border-radius: 50%;background-color: rgb(103, 194, 58);display: inline-block;margin:0px 5px 0 0"/>正常工作</div>
<div v-else ><div style="width: 12px;height: 12px;border-radius: 50%;background-color: red;display: inline-block;margin:0px 5px 0 0"/>{{ scope.row.呼叫备注 }}</div>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
width="60%">
<el-table
:data="tableDataMassage"
style="width: 100%;"
size="mini"
height="500"
highlight-current-row
border>
<el-table-column align="center" label="工位号">
<template slot-scope="scope">
<el-button type="text">{{ scope.row.工位号 }}</el-button>
</template>
</el-table-column>
<el-table-column align="center" label="登陆人">
<template slot-scope="scope">
<el-tag v-if="scope.row.姓名===''||scope.row.姓名===null" slot="reference" size="small" style="width: 80px" type="warning">未登录</el-tag>
<el-tag v-else slot="reference" type="success" size="small" style="width: 80px"> {{ scope.row.姓名 }} </el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="呼叫类型">
<template slot-scope="scope">
<div v-if="scope.row.呼叫备注===''|| scope.row.呼叫备注===null"><div style="width: 12px;height: 12px;border-radius: 50%;background-color: rgb(103, 194, 58);display: inline-block;margin:0px 5px 0 0"/>正常工作</div>
<div v-else ><div style="width: 12px;height: 12px;border-radius: 50%;background-color: red;display: inline-block;margin:0px 5px 0 0"/>{{ scope.row.呼叫备注 }}</div>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import { ANDON_countselect } from '@/api/ManufacturingCenter/AntonMonitoring'
import { wsuri, name1 } from '@/utils/request'
export default {
data() {
return {
tableData: [],
timer_ANDON: '',
andonMsg: '',
Name: '',
massage: [],
dialogVisible: false,
tableDataMassage: [],
value: 0
}
},
mounted() {
this.ANDON_countselect()
this.timer_ANDON = setInterval(this.search(), 60 * 1000 * 5) // ANDON看板 5 分钟一刷新
},
created() {
this.initWebpack()
},
methods: {
ANDON_countselect() {
ANDON_countselect().then(response => {
this.tableData = response.data
})
},
// 初始化websocket
initWebpack() {
this.websock = new WebSocket(wsuri)// 这里面的this都指向vue
this.websock.onopen = this.websocketopen
this.websock.onmessage = this.websocketonmessage
this.websock.onclose = this.websocketclose
this.websock.onerror = this.websocketerror
},
// 打开
websocketopen() {
console.log('WebSocket连接成功')
this.websock.send('{<' + name1 + '>}')
},
// 数据接收
websocketonmessage(msg) {
console.log(msg)
this.andonMsg = msg.data.split('|')[3]
this.Name = msg.data.split('|')[2]
if (this.andonMsg === '1') {
this.search()
}
},
// 关闭
websocketclose() {
console.log('WebSocket关闭')
},
// 失败
websocketerror() {
console.log('WebSocket连接失败')
},
search() {
this.tableDataMassage = []
ANDON_countselect().then(response => {
this.tableData = response.data
return response.data
}).then(data => {
for (let i = 0; i < data.length; i++) {
if (data[i].呼叫备注 !== null) {
this.tableDataMassage.push(data[i])
}
}
this.value = this.tableDataMassage.length
})
},
openWindow() {
this.dialogVisible = true
}
}
}
</script>
<style scoped>
.el-card{
margin-left: 2px;
margin-top: 2px;
margin-bottom: 2px;
margin-right: 2px;
}
</style>