自制件入库

This commit is contained in:
Vergil
2020-05-15 14:32:25 +08:00
parent ad91c0649d
commit 253675f77d

View File

@@ -204,67 +204,52 @@ export default {
this.listLoading = true
searchTable(this.partNumber).then(response => {
console.log(response.data)
if (response.data.length === 0) {
if (response.data[0].结果 === '成功' || response.data[0].结果 === '自动完成入库') {
this.listLoading = false
this.tableData.push({
plannumber: response.data[0].剩余数量,
innumber: response.data[0].入库数量,
capture: '',
note: '',
工艺计划流水号: response.data[0].工艺计划流水号,
项目名称: response.data[0].项目名称,
机床图号: response.data[0].机床图号,
零件图号: response.data[0].零件图号
})
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[0].结果 === '未查到') {
this.$notify({
title: '警告',
message: '该零件未加工',
message: '跟单号有误',
type: 'warning'
})
} else if (response.data[0].结果 === '未完成') {
this.$notify({
title: '警告',
message: '此零件未加工完成',
type: 'warning'
})
} else if (response.data[0].结果 === '已入库') {
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: ''
})
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
})
},