This commit is contained in:
liushuai
2020-05-11 18:53:06 +08:00
parent 18349b0f90
commit e5a23954be
7 changed files with 214 additions and 260 deletions

View File

@@ -2,13 +2,13 @@
<div class="app-container">
<el-card style="width: 1000px">
<el-row>
<span style="margin-left: 10px">零件图</span>
<el-input v-model="Partpaint" clearable size="small" style="width:170px;height: 29px;margin-top: 10px;margin-bottom: 10px" />
<el-button size="small" type="primary" icon="el-icon-search" plain style="margin: 0 0 0 10px" @click="getCraftNumber()">查询</el-button>
<el-tooltip :open-delay="1200" effect="dark" content="清除所有机床零件信息" placement="top">
<el-button size="small" type="danger" icon="el-icon-remove-outline" style="margin: 0 0 0 10px" plain @click="Empty()">清空</el-button>
</el-tooltip>
<el-tooltip :open-delay="1200" effect="dark" content="将所有机床零件入库" placement="top">
<span style="margin-left: 10px">跟单</span>
<el-input v-model="partNumber" clearable size="small" style="width:170px;height: 29px;margin-top: 10px;margin-bottom: 10px" />
<el-button size="small" type="primary" icon="el-icon-search" plain style="margin: 0 0 0 10px" @click="getscantable()">查询</el-button>
<!--<el-tooltip :open-delay="1200" effect="dark" content="清除所有机床零件信息" placement="top">-->
<!--<el-button size="small" type="danger" icon="el-icon-remove-outline" style="margin: 0 0 0 10px" plain @click="Empty()">清空</el-button>-->
<!--</el-tooltip>-->
<el-tooltip :open-delay="1200" effect="dark" content="自制件件入库" placement="top">
<el-button type="warning" size="small" class="el-icon-success" style="margin: 0 0 0 10px" plain @click="Innumber">入库</el-button>
</el-tooltip>
</el-row>
@@ -58,16 +58,16 @@
<el-input v-model="tableData[scope.$index].note" clearable size="mini"/>
</template>
</el-table-column>
<el-table-column label="操作" min-width="100" align="center">
<template slot-scope="scope">
<el-button
:disabled="scope.row.是否禁用"
size="mini"
type="danger"
class="el-icon-delete"
@click="handleDelete(scope.$index, scope.row)">移除</el-button>
</template>
</el-table-column>
<!--<el-table-column label="操作" min-width="100" align="center">-->
<!--<template slot-scope="scope">-->
<!--<el-button-->
<!--:disabled="scope.row.是否禁用"-->
<!--size="mini"-->
<!--type="danger"-->
<!--class="el-icon-delete"-->
<!--@click="handleDelete(scope.$index, scope.row)">移除</el-button>-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
</el-card>
@@ -108,7 +108,7 @@ export default {
ace: 0,
a: '',
tableData: [],
partNumber: [],
partNumber: '',
listLoading: false,
craftplannumber: '',
radio2: 3,
@@ -162,7 +162,7 @@ export default {
websocketonmessage(msg) {
this.partNumber = msg.data.split('|')[3]
this.partNumber = this.partNumber.slice(1)
this.getPaint(this.partNumber)
this.getscantable(this.partNumber)
},
// 关闭
websocketclose() {
@@ -198,93 +198,73 @@ export default {
// 根据流水号查询
getscantable() {
// this.tableData = []
if (this.partNumber.length === 0) {
this.$notify({
title: '警告',
message: '请输入正确的零件图号',
type: 'warning'
})
} else {
this.finishParts = []
this.listLoading = true
searchTable(this.partNumber).then(response => {
console.log(response.data)
if (response.data.length === 0) {
this.listLoading = false
this.$notify({
title: '警告',
message: '该零件未加工',
type: 'warning'
})
} else {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].状态 === '未完成') {
this.$notify({
title: '警告',
message: 'P' + response.data[i].工艺计划流水号 + '未加工完成',
type: 'warning'
})
} else if (response.data[i].状态 === '可完成') {
this.finishParts.push({
plannumber: response.data[i].剩余数量,
innumber: response.data[i].入库数量,
this.finishParts = []
this.listLoading = true
searchTable(this.partNumber).then(response => {
console.log(response.data)
if (response.data.length === 0) {
this.listLoading = false
this.$notify({
title: '警告',
message: '该零件未加工',
type: 'warning'
})
} else {
console.log(response.data, 1233)
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].考核状态 === 7) {
this.listLoading = false
this.tableData.push({
plannumber: response.data[i].剩余数量,
innumber: response.data[i].入库数量,
capture: '',
note: '',
工艺计划流水号: response.data[i].工艺计划流水号,
项目名称: response.data[i].项目名称,
机床图号: response.data[i].机床图号,
零件图号: response.data[i].零件图号
})
const hash = {} // 一个新数组data为你需要去重的数组newData用于接收去重后的数组, curVal.去重条件
this.tableDataNum = this.tableData.reduce((preVal, curVal) => {
hash[curVal.工艺计划流水号] ? '' : hash[curVal.工艺计划流水号] = true && preVal.push({
工艺计划流水号: curVal.工艺计划流水号,
项目名称: curVal.项目名称,
机床图号: curVal.机床图号,
零件图号: curVal.零件图号,
plannumber: curVal.plannumber,
innumber: curVal.innumber,
capture: '',
note: '',
工艺计划流水号: response.data[i].工艺计划流水号,
项目名称: response.data[i].项目名称,
机床图号: response.data[i].机床图号,
零件图号: response.data[i].零件图号
note: ''
})
} else if (response.data[i].状态 === '已完成') {
if (response.data[i].考核状态 === '7') {
this.listLoading = false
this.tableData.push({
plannumber: response.data[i].剩余数量,
innumber: response.data[i].入库数量,
capture: '',
note: '',
工艺计划流水号: response.data[i].工艺计划流水号,
项目名称: response.data[i].项目名称,
机床图号: response.data[i].机床图号,
零件图号: response.data[i].零件图号
})
const hash = {} // 一个新数组data为你需要去重的数组newData用于接收去重后的数组, curVal.去重条件
this.tableDataNum = this.tableData.reduce((preVal, curVal) => {
hash[curVal.工艺计划流水号] ? '' : hash[curVal.工艺计划流水号] = true && preVal.push({
工艺计划流水号: curVal.工艺计划流水号,
项目名称: curVal.项目名称,
机床图号: curVal.机床图号,
零件图号: curVal.零件图号,
plannumber: curVal.plannumber,
innumber: curVal.innumber,
capture: '',
note: ''
})
return preVal
}, [])
} else if (response.data[i].考核状态 === '8') {
this.$notify({
title: '警告',
message: 'P' + response.data[i].工艺计划流水号 + '已入库',
type: 'warning'
})
} else if (response.data[i].考核状态 === '9') {
this.$notify({
title: '警告',
message: 'P' + response.data[i].工艺计划流水号 + '已出库',
type: 'warning'
})
}
}
return preVal
}, [])
} else if (response.data[i].考核状态 === 6) {
this.$notify({
title: '警告',
message: 'P' + response.data[i].工艺计划流水号 + '未加工完成',
type: 'warning'
})
} else if (response.data[i].考核状态 === 8) {
this.$notify({
title: '警告',
message: 'P' + response.data[i].工艺计划流水号 + '已入库',
type: 'warning'
})
} else if (response.data[i].考核状态 === 9) {
this.$notify({
title: '警告',
message: 'P' + response.data[i].工艺计划流水号 + '已出库',
type: 'warning'
})
}
}
}).then(() => {
if (this.finishParts.length > 0) {
this.dialogFormVisible = true
}
this.listLoading = false
})
}
}
}).then(() => {
// if (this.finishParts.length > 0) {
// this.dialogFormVisible = true
// }
this.listLoading = false
})
},
FinishPart() {
var nums = []