eslint
This commit is contained in:
@@ -219,240 +219,240 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { initPickPerson, initMachineProject, searchgroup, searchList, searchListDetail, searchStockNumber1, searchStockNumber2, submitOutStore, errorRecord, searchStockNumber3, initOutType } from '@/api/Inventory/MaterialOut'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'MaterialOut',
|
||||
data() {
|
||||
return {
|
||||
pickingListNum: '', // 领料单流水号
|
||||
pickingPersonNum: '', // 领料人流水号
|
||||
pickingListNumber: '',
|
||||
pickingListNumberShow: '',
|
||||
pickListTable1: [],
|
||||
pageCurrent3: 1,
|
||||
pageSize3: 20,
|
||||
total3: 0,
|
||||
pickListTable2: [],
|
||||
StockNumberTable: [],
|
||||
dialogFormVisible1: false,
|
||||
dialogFormVisible2: false,
|
||||
outType: [],
|
||||
form1: {
|
||||
machineValue: '',
|
||||
groupNumValue: '',
|
||||
outNumber: '',
|
||||
outNumberMax: '', // 出库最大值
|
||||
personValue: '',
|
||||
outTypeValue: '' // 出库类别
|
||||
},
|
||||
form2: {
|
||||
errorNumber: '',
|
||||
reason: '',
|
||||
物料流水号: '',
|
||||
基本件流水号: '',
|
||||
货位流水号: ''
|
||||
},
|
||||
rules1: {
|
||||
machineValue: [{ required: true, message: '请选择' }],
|
||||
groupNumValue: [{ required: true, message: '请选择' }],
|
||||
outNumber: [{ required: true, message: '请输入' }],
|
||||
personValue: [{ required: true, message: '请输入' }],
|
||||
outTypeValue: [{ required: true, message: '请选择' }] // 出库类别
|
||||
},
|
||||
rules2: {
|
||||
errorNumber: [{ required: true, message: '请输入' }],
|
||||
reason: [{ required: true, message: '请输入' }]
|
||||
},
|
||||
machine: [],
|
||||
group: [],
|
||||
person: [],
|
||||
materialNum: '', // 中间变量物料流水号
|
||||
machineValue: '', // 中间变量机床流水号
|
||||
groupNumValue: '', // 中间变量组件流水号
|
||||
basePartNum: '', // 中间变量基本件流水号
|
||||
purchaseBillNum: '', // 中间变量请购单明细流水号
|
||||
parchasePartNum: '', // 中间变量标准件和外购件流水号
|
||||
inventoryNum: '', // 中间变量仓库流水号
|
||||
locationNum: '', // 中间变量货位流水号
|
||||
outNumber: 0 // 中间变量出库数量
|
||||
}
|
||||
import { initPickPerson, initMachineProject, searchgroup, searchList, searchListDetail, searchStockNumber1, searchStockNumber2, submitOutStore, errorRecord, searchStockNumber3, initOutType } from '@/api/Inventory/MaterialOut'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'MaterialOut',
|
||||
data() {
|
||||
return {
|
||||
pickingListNum: '', // 领料单流水号
|
||||
pickingPersonNum: '', // 领料人流水号
|
||||
pickingListNumber: '',
|
||||
pickingListNumberShow: '',
|
||||
pickListTable1: [],
|
||||
pageCurrent3: 1,
|
||||
pageSize3: 20,
|
||||
total3: 0,
|
||||
pickListTable2: [],
|
||||
StockNumberTable: [],
|
||||
dialogFormVisible1: false,
|
||||
dialogFormVisible2: false,
|
||||
outType: [],
|
||||
form1: {
|
||||
machineValue: '',
|
||||
groupNumValue: '',
|
||||
outNumber: '',
|
||||
outNumberMax: '', // 出库最大值
|
||||
personValue: '',
|
||||
outTypeValue: '' // 出库类别
|
||||
},
|
||||
form2: {
|
||||
errorNumber: '',
|
||||
reason: '',
|
||||
物料流水号: '',
|
||||
基本件流水号: '',
|
||||
货位流水号: ''
|
||||
},
|
||||
rules1: {
|
||||
machineValue: [{ required: true, message: '请选择' }],
|
||||
groupNumValue: [{ required: true, message: '请选择' }],
|
||||
outNumber: [{ required: true, message: '请输入' }],
|
||||
personValue: [{ required: true, message: '请输入' }],
|
||||
outTypeValue: [{ required: true, message: '请选择' }] // 出库类别
|
||||
},
|
||||
rules2: {
|
||||
errorNumber: [{ required: true, message: '请输入' }],
|
||||
reason: [{ required: true, message: '请输入' }]
|
||||
},
|
||||
machine: [],
|
||||
group: [],
|
||||
person: [],
|
||||
materialNum: '', // 中间变量物料流水号
|
||||
machineValue: '', // 中间变量机床流水号
|
||||
groupNumValue: '', // 中间变量组件流水号
|
||||
basePartNum: '', // 中间变量基本件流水号
|
||||
purchaseBillNum: '', // 中间变量请购单明细流水号
|
||||
parchasePartNum: '', // 中间变量标准件和外购件流水号
|
||||
inventoryNum: '', // 中间变量仓库流水号
|
||||
locationNum: '', // 中间变量货位流水号
|
||||
outNumber: 0 // 中间变量出库数量
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'id'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData()
|
||||
this.searchList()
|
||||
},
|
||||
methods: {
|
||||
// 初始化数据
|
||||
fetchData() {
|
||||
this.person = []
|
||||
initPickPerson().then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.person.push({
|
||||
label: response.data[i].姓名,
|
||||
value: response.data[i].人员编号
|
||||
})
|
||||
}
|
||||
})
|
||||
this.machine = []
|
||||
initMachineProject().then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.machine.push({
|
||||
label: response.data[i].机床图号,
|
||||
name: response.data[i].项目名称,
|
||||
value: response.data[i].机床流水号
|
||||
})
|
||||
}
|
||||
})
|
||||
initOutType().then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.outType.push({
|
||||
label: response.data[i].出库类别名称,
|
||||
value: response.data[i].出库类别流水号
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'id'
|
||||
])
|
||||
// 查询组号
|
||||
searchGroup() {
|
||||
this.group = []
|
||||
this.form1.groupNumValue = ''
|
||||
searchgroup(this.form1.machineValue).then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.group.push({
|
||||
label: response.data[i].组号,
|
||||
value: Number(response.data[i].组件流水号)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData()
|
||||
// 查询领料单列表
|
||||
searchList() {
|
||||
let check
|
||||
this.pickingListNumber ? check = 1 : check = 0
|
||||
searchList(this.pageCurrent3, this.pageSize3, check, this.pickingListNumber).then(response => {
|
||||
this.pickListTable1 = response.data.rows
|
||||
this.total3 = response.data.total
|
||||
})
|
||||
},
|
||||
handleSizeChange3(val) {
|
||||
this.pageSize3 = val
|
||||
this.pageCurrent3 = 1
|
||||
this.searchList()
|
||||
},
|
||||
methods: {
|
||||
// 初始化数据
|
||||
fetchData() {
|
||||
this.person = []
|
||||
initPickPerson().then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.person.push({
|
||||
label: response.data[i].姓名,
|
||||
value: response.data[i].人员编号
|
||||
})
|
||||
}
|
||||
handleCurrentChange3(val) {
|
||||
this.pageCurrent3 = val
|
||||
this.searchList()
|
||||
},
|
||||
// 查看领料单明细
|
||||
clickList(row) {
|
||||
row && row.领料单流水号 ? this.pickingListNum = row.领料单流水号 : this.pickingListNum
|
||||
row && row.人员编号 ? this.pickingPersonNum = row.人员编号 : this.pickingListNum
|
||||
row && row.领料单编号 ? this.pickingListNumberShow = row.领料单编号 : this.pickingListNumberShow
|
||||
searchListDetail(this.pickingListNum).then(res => {
|
||||
this.pickListTable2 = res.data
|
||||
})
|
||||
},
|
||||
// 查看领料单明细相关的物料货位数量
|
||||
clickListDetail(row) {
|
||||
row && row.基本件流水号 ? (this.basePartNum = row.基本件流水号, this.materialNum = null, this.parchasePartNum = null, this.purchaseBillNum = null) : this.basePartNum
|
||||
row && row.物料流水号 ? (this.materialNum = row.物料流水号, this.basePartNum = null, this.purchaseBillNum = null) : this.materialNum
|
||||
row && row.标准件和外购件流水号 ? (this.parchasePartNum = row.标准件和外购件流水号, this.basePartNum = null, this.purchaseBillNum = null) : this.parchasePartNum
|
||||
row && row.请购单明细流水号 ? (this.purchaseBillNum = row.请购单明细流水号, this.basePartNum = null, this.materialNum = null, this.parchasePartNum = null) : this.parchasePartNum
|
||||
row && row.机床流水号 ? this.machineValue = row.机床流水号 : this.machineValue
|
||||
row && row.组件流水号 ? this.groupNumValue = row.组件流水号 : this.groupNumValue
|
||||
row && row.总数量 ? this.outNumber = row.总数量 : this.outNumber
|
||||
if (this.materialNum) {
|
||||
searchStockNumber1(this.materialNum).then(res => {
|
||||
this.StockNumberTable = res.data
|
||||
})
|
||||
this.machine = []
|
||||
initMachineProject().then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.machine.push({
|
||||
label: response.data[i].机床图号,
|
||||
name: response.data[i].项目名称,
|
||||
value: response.data[i].机床流水号
|
||||
})
|
||||
}
|
||||
} else if (this.basePartNum) {
|
||||
searchStockNumber2(this.basePartNum).then(res => {
|
||||
this.StockNumberTable = res.data
|
||||
})
|
||||
initOutType().then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.outType.push({
|
||||
label: response.data[i].出库类别名称,
|
||||
value: response.data[i].出库类别流水号
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 查询组号
|
||||
searchGroup() {
|
||||
this.group = []
|
||||
this.form1.groupNumValue = ''
|
||||
searchgroup(this.form1.machineValue).then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.group.push({
|
||||
label: response.data[i].组号,
|
||||
value: Number(response.data[i].组件流水号)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 查询领料单列表
|
||||
searchList() {
|
||||
let check
|
||||
this.pickingListNumber ? check = 1 : check = 0
|
||||
searchList(this.pageCurrent3, this.pageSize3, check, this.pickingListNumber).then(response => {
|
||||
this.pickListTable1 = response.data.rows
|
||||
this.total3 = response.data.total
|
||||
})
|
||||
},
|
||||
handleSizeChange3(val) {
|
||||
this.pageSize3 = val
|
||||
this.pageCurrent3 = 1
|
||||
this.searchList()
|
||||
},
|
||||
handleCurrentChange3(val) {
|
||||
this.pageCurrent3 = val
|
||||
this.searchList()
|
||||
},
|
||||
// 查看领料单明细
|
||||
clickList(row) {
|
||||
row && row.领料单流水号 ? this.pickingListNum = row.领料单流水号 : this.pickingListNum
|
||||
row && row.人员编号 ? this.pickingPersonNum = row.人员编号 : this.pickingListNum
|
||||
row && row.领料单编号 ? this.pickingListNumberShow = row.领料单编号 : this.pickingListNumberShow
|
||||
searchListDetail(this.pickingListNum).then(res => {
|
||||
this.pickListTable2 = res.data
|
||||
})
|
||||
},
|
||||
// 查看领料单明细相关的物料货位数量
|
||||
clickListDetail(row) {
|
||||
row && row.基本件流水号 ? (this.basePartNum = row.基本件流水号, this.materialNum = null, this.parchasePartNum = null, this.purchaseBillNum = null) : this.basePartNum
|
||||
row && row.物料流水号 ? (this.materialNum = row.物料流水号, this.basePartNum = null, this.purchaseBillNum = null) : this.materialNum
|
||||
row && row.标准件和外购件流水号 ? (this.parchasePartNum = row.标准件和外购件流水号, this.basePartNum = null, this.purchaseBillNum = null) : this.parchasePartNum
|
||||
row && row.请购单明细流水号 ? (this.purchaseBillNum = row.请购单明细流水号, this.basePartNum = null, this.materialNum = null, this.parchasePartNum = null) : this.parchasePartNum
|
||||
row && row.机床流水号 ? this.machineValue = row.机床流水号 : this.machineValue
|
||||
row && row.组件流水号 ? this.groupNumValue = row.组件流水号 : this.groupNumValue
|
||||
row && row.总数量 ? this.outNumber = row.总数量 : this.outNumber
|
||||
if (this.materialNum) {
|
||||
searchStockNumber1(this.materialNum).then(res => {
|
||||
this.StockNumberTable = res.data
|
||||
})
|
||||
} else if (this.basePartNum) {
|
||||
searchStockNumber2(this.basePartNum).then(res => {
|
||||
this.StockNumberTable = res.data
|
||||
})
|
||||
} else if (this.purchaseBillNum) {
|
||||
searchStockNumber3(this.purchaseBillNum).then(res => {
|
||||
this.StockNumberTable = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
// 出库
|
||||
outStore(row) {
|
||||
if (this.$refs['form1'] !== undefined) {
|
||||
this.$refs['form1'].resetFields()
|
||||
}
|
||||
this.form1.machineValue = this.machineValue
|
||||
this.inventoryNum = row.仓库流水号
|
||||
this.locationNum = row.货位流水号
|
||||
this.outNumber > row.货位存量 ? (this.form1.outNumber = row.货位存量, this.form1.outNumberMax = row.货位存量) : (this.form1.outNumber = this.outNumber, this.form1.outNumberMax = this.outNumber) // 货位存量和领料数量对比取小
|
||||
this.form1.personValue = Number(this.id)
|
||||
this.group = []
|
||||
this.form1.groupNumValue = ''
|
||||
searchgroup(this.form1.machineValue).then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.group.push({
|
||||
label: response.data[i].组号,
|
||||
value: Number(response.data[i].组件流水号)
|
||||
})
|
||||
}
|
||||
}).then(() => {
|
||||
this.form1.groupNumValue = this.groupNumValue
|
||||
this.dialogFormVisible1 = true
|
||||
})
|
||||
},
|
||||
// 提交出库
|
||||
submitOutStore() {
|
||||
this.$refs['form1'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 出库数量,出库人,基本件流水号/标准件和外购件流水号 => 记录到一个新表
|
||||
// 物料流水号,货位流水号,出库数量 => 减掉货位物料数
|
||||
submitOutStore(this.materialNum, this.locationNum, this.form1.outNumber, this.form1.personValue, this.basePartNum, this.parchasePartNum, this.purchaseBillNum, this.pickingListNum, this.pickingPersonNum, this.inventoryNum, this.form1.outTypeValue).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('出库成功')
|
||||
this.dialogFormVisible1 = false
|
||||
this.clickListDetail()
|
||||
this.clickList()
|
||||
} else { this.$message.error('操作失败') }
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 异常记录
|
||||
errorRecord(row) {
|
||||
if (this.$refs['form2'] !== undefined) {
|
||||
this.$refs['form2'].resetFields()
|
||||
}
|
||||
this.form2.errorNumber = ''
|
||||
this.form2.reason = ''
|
||||
this.form2.物料流水号 = row.物料流水号
|
||||
this.form2.基本件流水号 = row.基本件流水号
|
||||
this.form2.货位流水号 = row.货位流水号
|
||||
this.dialogFormVisible2 = true
|
||||
},
|
||||
// 提交异常记录
|
||||
submitErrorRecord() {
|
||||
this.$refs['form2'].validate((valid) => {
|
||||
if (valid) {
|
||||
errorRecord(this.form2.errorNumber, this.form2.reason, this.form2.物料流水号, this.form2.基本件流水号, this.form2.货位流水号).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('记录成功')
|
||||
this.dialogFormVisible2 = false
|
||||
} else { this.$message.error('操作失败') }
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else if (this.purchaseBillNum) {
|
||||
searchStockNumber3(this.purchaseBillNum).then(res => {
|
||||
this.StockNumberTable = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
// 出库
|
||||
outStore(row) {
|
||||
if (this.$refs['form1'] !== undefined) {
|
||||
this.$refs['form1'].resetFields()
|
||||
}
|
||||
this.form1.machineValue = this.machineValue
|
||||
this.inventoryNum = row.仓库流水号
|
||||
this.locationNum = row.货位流水号
|
||||
this.outNumber > row.货位存量 ? (this.form1.outNumber = row.货位存量, this.form1.outNumberMax = row.货位存量) : (this.form1.outNumber = this.outNumber, this.form1.outNumberMax = this.outNumber) // 货位存量和领料数量对比取小
|
||||
this.form1.personValue = Number(this.id)
|
||||
this.group = []
|
||||
this.form1.groupNumValue = ''
|
||||
searchgroup(this.form1.machineValue).then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.group.push({
|
||||
label: response.data[i].组号,
|
||||
value: Number(response.data[i].组件流水号)
|
||||
})
|
||||
}
|
||||
}).then(() => {
|
||||
this.form1.groupNumValue = this.groupNumValue
|
||||
this.dialogFormVisible1 = true
|
||||
})
|
||||
},
|
||||
// 提交出库
|
||||
submitOutStore() {
|
||||
this.$refs['form1'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 出库数量,出库人,基本件流水号/标准件和外购件流水号 => 记录到一个新表
|
||||
// 物料流水号,货位流水号,出库数量 => 减掉货位物料数
|
||||
submitOutStore(this.materialNum, this.locationNum, this.form1.outNumber, this.form1.personValue, this.basePartNum, this.parchasePartNum, this.purchaseBillNum, this.pickingListNum, this.pickingPersonNum, this.inventoryNum, this.form1.outTypeValue).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('出库成功')
|
||||
this.dialogFormVisible1 = false
|
||||
this.clickListDetail()
|
||||
this.clickList()
|
||||
} else { this.$message.error('操作失败') }
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 异常记录
|
||||
errorRecord(row) {
|
||||
if (this.$refs['form2'] !== undefined) {
|
||||
this.$refs['form2'].resetFields()
|
||||
}
|
||||
this.form2.errorNumber = ''
|
||||
this.form2.reason = ''
|
||||
this.form2.物料流水号 = row.物料流水号
|
||||
this.form2.基本件流水号 = row.基本件流水号
|
||||
this.form2.货位流水号 = row.货位流水号
|
||||
this.dialogFormVisible2 = true
|
||||
},
|
||||
// 提交异常记录
|
||||
submitErrorRecord() {
|
||||
this.$refs['form2'].validate((valid) => {
|
||||
if (valid) {
|
||||
errorRecord(this.form2.errorNumber, this.form2.reason, this.form2.物料流水号, this.form2.基本件流水号, this.form2.货位流水号).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('记录成功')
|
||||
this.dialogFormVisible2 = false
|
||||
} else { this.$message.error('操作失败') }
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user