first commit

This commit is contained in:
LIUHAO
2022-08-17 08:50:11 +08:00
commit 65457345b3
787 changed files with 84046 additions and 0 deletions

View File

@@ -0,0 +1,456 @@
<!--<script src="../../../utils/setMethods.js"></script>-->
<template>
<div class="app-container">
<el-card class="topCard">
<div class="topDiv">
<span style="margin-left: 10px">生产时间</span>
<el-date-picker
v-model="dateTime"
size="small"
type="daterange"
align="center"
style="width: 240px;"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="getOrderNumber()"/>
<span style="margin-left: 10px">工位号</span>
<el-select v-model="stationNumberValue" placeholder="请选择工位号" filterable clearable size="small" style="width: 200px; margin-left: 13px">
<el-option
v-for="item in stationNumber"
:key="item.value"
:label="item.label"
:value="item.value"
size="mini"/>
</el-select>
<span style="margin-left: 10px">产品型号</span>
<el-select v-model="engineTypeValue" placeholder="请选择产品型号" clearable size="small" style="width: 150px">
<el-option
v-for="item in engineType"
:key="item.value"
:label="item.label"
:value="item.value"
size="mini"/>
</el-select>
<span style="margin-left: 10px">订单号</span>
<el-select v-model="orderNumberValue" placeholder="请选择订单" clearable size="small" style="width: 150px">
<el-option
v-for="item in orderNumber"
:key="item.value"
:label="item.label"
:value="item.value"
size="mini"/>
</el-select>
<el-button type="primary" plain size="small" icon="el-icon-search" style="margin-left: 5px" @click="pageSize=15;pageCurrent=1;searchOrder();searchOrder1()">查询</el-button>
<el-button type="info" size="small" icon="el-icon-download" @click="exportExcel()">Excel</el-button>
</div>
<div style="border: 1px solid #EBEEF5;width: 100%;height: 400px;">
<div id="myChart" style="width: 100%;height: 380px;float: right;"/>
</div>
<el-table
v-loading="loading"
ref="multipleTable"
:data="tableData"
:header-cell-style="{background:'#eef1f6',color:'#606266'}"
:cell-class-name="tableRowClassName"
element-loading-text="数据加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.2)"
stripe
class="main"
tooltip-effect="dark"
height="350px"
style="width: 100%;"
border
size="mini">
<el-table-column align="center" label="工位号">
<template slot-scope="scope">
{{ scope.row.工位号 }}
</template>
</el-table-column>
<el-table-column align="center" label="订单号">
<template slot-scope="scope">
{{ scope.row.订单号 }}
</template>
</el-table-column>
<el-table-column align="center" label="机型">
<template slot-scope="scope">
{{ scope.row.机型 }}
</template>
</el-table-column>
<el-table-column align="center" label="总成编号">
<template slot-scope="scope">
{{ scope.row.发动机号 }}
</template>
</el-table-column>
<el-table-column align="center" width="80px" label="合格状态">
<template slot-scope="scope">
{{ scope.row.是否合格 }}
</template>
</el-table-column>
<el-table-column align="center" label="到达时间">
<template slot-scope="scope">
{{ scope.row.到达时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="离开时间">
<template slot-scope="scope">
{{ scope.row.离开时间 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[15, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
number: [],
tableData: [], // 总数据数组
tableData1: [], // 总数据数组
xData: [], // echars x轴
yData: [], // echars y轴
engineTypeValue: '', // 产品型号
engineType: [], // 产品型号数组
orderNumber: [], // 订单号
orderNumberValue: '', // 订单号
stationNumberValue: '', // 工位号
stationNumber: [], // 工位号
statePlan: [], // 计划状态数组
statePlanValue: '', // 计划状态
importTime: '', // 计划状态
releaseTime: '', // 计划状态
dateTime: '',
total: 0, // 总条数
pageList: 15, // 每页显示条数
pageSize: 15, // 每页显示条数
pageCurrent: 1, // 后台获取页
mid: [], // id
loading: false,
timer_1: null,
MIDGroup: []
}
},
created() {
var year, month, day, audiTime
this.date = new Date() // 修改数据date
year = new Date().getFullYear()
month = new Date().getMonth() + 1 < 10 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1
day = new Date().getDate() < 10 ? '0' + new Date().getDate() : new Date().getDate()
audiTime = year + '-' + month + '-' + day
console.log(audiTime, 'audiTime')
this.dateTime = [audiTime, audiTime]
this.getOrderNumber()
this.getEndStation()
this.getStationNumber()
},
mounted() {
},
methods: {
// 表格颜色变化
tableRowClassName({ row, rowIndex }) {
// console.log(row, rowIndex)
if (rowIndex % 2 === 0) {
return 'black'
} else {
return 'red'
}
},
// 初始化获取产品型号
getEndStation() {
this.engineType = []
var param = []
var Data = this.CreateData('11', 'MES_基本变量_机型代码_查询', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.engineType.push({
label: response.data[i].发动机型号,
value: response.data[i].发动机型号
})
}
})
},
// 初始化获取订单号
getOrderNumber() {
this.orderNumber = []
var param = []
param[0] = ['开始时间', this.dateTime[0]]
param[1] = ['结束时间', this.dateTime[1]]
var Data = this.CreateData('11', '测量数据发动机在线状态_订单号_查询', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.orderNumber.push({
label: response.data[i].订单号,
value: response.data[i].订单号
})
}
})
},
// 工位号
getStationNumber() {
this.stationNumber = []
this.xData = []
var param = []
var Data = this.CreateData('11', 'MES_计划BOM_工位与名称_查询', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.stationNumber.push({
label: response.data[i].工位号,
value: response.data[i].工位号
})
this.xData.push(response.data[i].工位号)
}
})
},
// 实时扭矩曲线
drawLine() {
// 基于准备好的dom初始化echarts实例
const myChart = this.$echarts.init(document.getElementById('myChart'))
myChart.clear()
myChart.setOption({
title: {
left: 'center',
text: '生产订单完工统计'
},
toolbox: {// echart保存为图片
show: true,
feature: {
mark: {
show: true
},
saveAsImage: {
show: true,
pixelRatio: 1,
title: '保存为图片',
type: 'png',
lang: ['点击保存']
}
}
},
xAxis: {
type: 'category',
data: this.xData,
axisLabel: {
interval: 0,
rotate: 30
}
},
yAxis: {
type: 'value'
},
series: [
{
name: 'PASS',
data: this.number,
type: 'bar',
showBackground: true,
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)'
},
itemStyle: { // 上方显示数值
normal: {
label: {
show: true, // 开启显示
position: 'top', // 在上方显示
textStyle: { // 数值样式
color: 'black',
fontSize: 16
}
}
}
}
},
{
name: 'NO',
data: this.yData,
type: 'bar',
showBackground: true,
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)'
},
itemStyle: { // 上方显示数值
normal: {
label: {
show: true, // 开启显示
position: 'top', // 在上方显示
textStyle: { // 数值样式
color: 'black',
fontSize: 16
}
}
}
}
}
],
legend: {
data: ['PASS', 'NO'],
bottom: 0
}
})
},
// 查询订单
searchOrder() {
this.tableData = []
let engineTypeValue_check, stationNumberValue_check, orderNumberValue_check
this.engineTypeValue ? engineTypeValue_check = 1 : (engineTypeValue_check = 0, this.engineTypeValue = '')
this.stationNumberValue ? stationNumberValue_check = 1 : (stationNumberValue_check = 0, this.stationNumberValue = '')
this.orderNumberValue ? orderNumberValue_check = 1 : (orderNumberValue_check = 0, this.orderNumberValue = '')
var param = []
param[0] = ['开始时间', this.dateTime[0]]
param[1] = ['结束时间', this.dateTime[1]]
param[2] = ['工位号_ischeck', stationNumberValue_check]
param[3] = ['工位号', this.stationNumberValue]
param[4] = ['订单号_ischeck', orderNumberValue_check]
param[5] = ['订单号', this.orderNumberValue]
param[6] = ['产品型号_ischeck', engineTypeValue_check]
param[7] = ['产品型号', this.engineTypeValue]
param[8] = ['PageCurrent', this.pageCurrent]
param[9] = ['PageSize', this.pageSize]
param[10] = ['PageCount', '1111', 'int', '1']
param[11] = ['ItemCount', '1111', 'int', '1']
var Data = this.CreateData('11', 'MES_计划BOM_发动机订单计划_订单完工_查询', param)
this.ExecDatabase(Data).then(response => {
console.log(response, 66)
if (response.data.result.length !== 0) {
this.tableData = response.data.result
}
this.total = parseInt(response.data.output[0].ItemCount)
this.loading = false
})
},
// 查询订单
searchOrder1() {
this.yData = []
this.number = []
if (this.stationNumberValue) {
this.xData = []
this.xData.push(this.stationNumberValue)
} else {
this.getStationNumber()
}
this.tableData1 = []
let engineTypeValue_check, stationNumberValue_check, orderNumberValue_check
this.engineTypeValue ? engineTypeValue_check = 1 : (engineTypeValue_check = 0, this.engineTypeValue = '')
this.stationNumberValue ? stationNumberValue_check = 1 : (stationNumberValue_check = 0, this.stationNumberValue = '')
this.orderNumberValue ? orderNumberValue_check = 1 : (orderNumberValue_check = 0, this.orderNumberValue = '')
var param = []
param[0] = ['开始时间', this.dateTime[0]]
param[1] = ['结束时间', this.dateTime[1]]
param[2] = ['工位号_ischeck', stationNumberValue_check]
param[3] = ['工位号', this.stationNumberValue]
param[4] = ['订单号_ischeck', orderNumberValue_check]
param[5] = ['订单号', this.orderNumberValue]
param[6] = ['产品型号_ischeck', engineTypeValue_check]
param[7] = ['产品型号', this.engineTypeValue]
var Data = this.CreateData('11', 'MES_计划BOM_发动机订单计划_订单完工_报表', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length !== 0) {
for (let i = 0; i < response.data.length; i++) {
for (let j = 0; j < this.xData.length; j++) {
if (!this.number[j]) {
this.number[j] = 0
}
if (!this.yData[j]) {
this.yData[j] = 0
}
if (this.xData[j] === response.data[i].工位号) {
if (response.data[i].是否合格 === 'PASS') {
this.number[j]++
} else if (response.data[i].是否合格 === 'FAIL') {
this.yData[j]++
}
}
}
}
}
}).then(() => {
this.drawLine()
})
},
exportExcel() {
if (this.tableData.length !== 0) {
let engineTypeValue_check, stationNumberValue_check, orderNumberValue_check
this.engineTypeValue ? engineTypeValue_check = 1 : (engineTypeValue_check = 0, this.engineTypeValue = '')
this.stationNumberValue ? stationNumberValue_check = 1 : (stationNumberValue_check = 0, this.stationNumberValue = '')
this.orderNumberValue ? orderNumberValue_check = 1 : (orderNumberValue_check = 0, this.orderNumberValue = '')
var param = []
param[0] = ['开始时间', this.dateTime[0]]
param[1] = ['结束时间', this.dateTime[1]]
param[2] = ['工位号_ischeck', stationNumberValue_check]
param[3] = ['工位号', this.stationNumberValue]
param[4] = ['订单号_ischeck', orderNumberValue_check]
param[5] = ['订单号', this.orderNumberValue]
param[6] = ['产品型号_ischeck', engineTypeValue_check]
param[7] = ['产品型号', this.engineTypeValue]
var Data = this.CreateData('2001', 'MES_计划BOM_发动机订单计划_订单完工_报表', param)
this.exportExcel_NPOI(Data)
} else {
this.$message.warning('暂无数据')
}
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchOrder()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchOrder()
}
}
}
</script>
<style scoped>
.topCard{
margin: 5px;
}
.topDiv{
margin-bottom: 10px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
.text {
font-size: 14px;
}
.item {
padding: 18px 0;
}
.box-card {
position: absolute;
right: 6px;
top: 80px;
width: 300px;
}
.el-table .warning-row {
background: oldlace;
}
.el-table .success-row {
background: #f0f9eb;
}
</style>