基本件出库

This commit is contained in:
caoxinyu
2019-05-11 12:47:37 +08:00
parent b22fc95b31
commit 9754debef3

View File

@@ -9,7 +9,7 @@
</el-card>
<el-card>
<el-table v-loading="listLoading" :data="tableData" border size="mini" style="width: 100%" height="650px">
<el-table v-loading="listLoading" :data="tableDataNum" border size="mini" style="width: 100%" height="650px">
<el-table-column
label="序号"
align="center"
@@ -32,12 +32,12 @@
</el-table-column>
<el-table-column label="计划数量" align="center" min-width="100">
<template slot-scope="scope" align="center">
{{ tableData[scope.$index].plannumber }}
{{ tableDataNum[scope.$index].plannumber }}
</template>
</el-table-column>
<el-table-column label="入库数量" align="center" min-width="100">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].innumber" clearable size="mini"/>
<el-input v-model="tableDataNum[scope.$index].innumber" clearable size="mini"/>
</template>
</el-table-column>
<el-table-column label="仓库" align="center" min-width="100">
@@ -101,7 +101,8 @@ export default {
inventoryNumber: '',
locateName: [], // 货位名称下拉框
locateNumber: '',
Partpaint: ''
Partpaint: '',
tableDataNum: []
}
},
computed: {
@@ -118,6 +119,7 @@ export default {
methods: {
// 移除
handleDelete(index, row) {
this.tableDataNum.splice(index, 1)
this.tableData.splice(index, 1)
},
// 获取人员编号
@@ -176,7 +178,7 @@ export default {
},
// 根据流水号查询
getscantable() {
this.tableData = []
// this.tableData = []
if (this.partNumber.length === 0) {
this.$notify({
title: '警告',
@@ -212,52 +214,34 @@ export default {
} else if (response.data[i].考核状态 === 7) {
this.listLoading = false
this.tableData.push({
plannumber: response.data[0].剩余数量,
innumber: response.data[0].入库数量,
plannumber: response.data[i].剩余数量,
innumber: response.data[i].入库数量,
capture: '',
note: '',
工艺计划流水号: response.data[0].工艺计划流水号,
项目名称: response.data[0].项目名称,
机床图号: response.data[0].机床图号,
零件图号: response.data[0].零件图号
工艺计划流水号: response.data[i].工艺计划流水号,
项目名称: response.data[i].项目名称,
机床图号: response.data[i].机床图号,
零件图号: response.data[i].零件图号
})
let 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
}, [])
}
}
}
// if (response.data.length === 0) {
// this.listLoading = false
// this.$message.warning('该零件未加工完成')
// } else if (response.data[0].考核状态 === 8) {
// this.listLoading = false
// this.$message.warning('该零件已入库')
// } else if (response.data[0].考核状态 === 9) {
// this.listLoading = false
// this.$message.warning('该零件已出库')
// } else if (response.data[0].考核状态 === 7) {
// for (let i = 0; i < this.tableData.length; i++) {
// if (response.data[0].工艺计划流水号 === this.tableData[i].工艺计划流水号) {
// this.ace = this.ace + 1
// }
// }
// if (this.ace === 0) {
// 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].零件图号
// })
// } else {
// this.$message.error('此件已在列表中')
// }
// }
}).then(() => {
this.listLoading = false
// this.ace = 0
})
}
},
@@ -271,14 +255,14 @@ export default {
if (this.locateNumber === '') {
this.$message.error('请选择货位')
} else {
for (let i = 0; i < this.tableData.length; i++) {
if (Number(this.tableData[i].innumber) === 0) {
for (let i = 0; i < this.tableDataNum.length; i++) {
if (Number(this.tableDataNum[i].innumber) === 0) {
this.$message.error('请输入正确数量')
} else {
if (this.tableData[i].innumber > this.tableData[i].plannumber) {
this.tableData[i].innumber = this.tableData[i].plannumber
if (this.tableDataNum[i].innumber > this.tableDataNum[i].plannumber) {
this.tableDataNum[i].innumber = this.tableDataNum[i].plannumber
}
insertOne(this.tableData[i].工艺计划流水号, this.tableData[i].innumber, this.PeopleNumber, this.tableData[i].capture, this.inventoryNumber, this.locateNumber, this.tableData[i].note).then(response => {
insertOne(this.tableDataNum[i].工艺计划流水号, this.tableDataNum[i].innumber, this.PeopleNumber, this.tableDataNum[i].capture, this.inventoryNumber, this.locateNumber, this.tableDataNum[i].note).then(response => {
if (response.data[0].result === '1') {
this.$message({
type: 'success',
@@ -305,6 +289,7 @@ export default {
// 清空
Empty() {
this.tableData = []
this.tableDataNum = []
this.Partpaint = ''
},
// 仓库查询