Commit 6a8b8aab authored by hubaoshan's avatar hubaoshan

1

parent 1e328b33
......@@ -100,6 +100,11 @@
<span>{{ scope.row.pn || '-' }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="qty" width="55">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ scope.row.qty || '-' }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="操作" width="80">
<template slot-scope="scope">
<span style="color: #46BCF3;cursor: pointer" @click="handleDispose(scope.row)">处理</span>
......
......@@ -174,123 +174,55 @@ export default {
/**
* 获取本次要高亮的行的下坐标和要加的数量
* **/
getIndexAndNeedNumber(search, lot) {
var last = {
index: null,
lot: null,
needNumber: null
}
getIndexAndNeedNumber(location, lot) {
let matchFlag = false
let matchObj = null
let matchIndex = null
/**
* 1.判断储存的list是不是为空
* **/
if (this.storeList.length > 0) {
var list = []
// 判断tableList中location和search及lot相同的元素个数
this.tableList.forEach((item, index) => {
if (customUpperCase(item.location) === customUpperCase(search) && customUpperCase(item.lot) === customUpperCase(lot)) {
list.push(index)
}
})
if (list.length > 0) {
if (list.length === 1) {
last.index = list[0]
last.lot = this.tableList[list[0]].lot
last.needNumber = this.tableList[list[0]].needNumber
return last
}
if (list.length > 1) {
// 是否能从储存中找到location
if (this.storeList.find(Litem => customUpperCase(Litem.location) === customUpperCase(search) && customUpperCase(Litem.lot) === customUpperCase(lot))) {
var index = this.storeList.findIndex(Litem => customUpperCase(Litem.location) === customUpperCase(search) && customUpperCase(Litem.lot) === customUpperCase(lot))
this.storeList[index].frequency = this.storeList[index].frequency + 1
if (this.storeList[index].frequency < this.storeList[index].list.length) {
last.index = this.storeList[index].list[this.storeList[index].frequency]
last.needNumber = this.tableList[this.storeList[index].list[this.storeList[index].frequency]].needNumber
last.lot = this.tableList[this.storeList[index].list[this.storeList[index].frequency]].lot
return last
} else {
return null
}
} else {
var objT = {
location: search,
lot: lot,
list: list,
frequency: 0
}
this.storeList.push(objT)
last.index = list[0]
last.needNumber = this.tableList[list[0]].needNumber
last.lot = this.tableList[list[0]].lot
return last
// this.storeList
// this.tableList
for (let i = 0; i < this.tableList.length; i++) {
const tableObj = this.tableList[i]
// 1. 匹配成功
if (customUpperCase(tableObj.location) === customUpperCase(location) &&
customUpperCase(tableObj.lot) === customUpperCase(lot)) {
matchFlag = true
matchObj = tableObj
matchIndex = i
for (let j = 0; j < this.storeList.length; j++) {
const storeObj = this.storeList[j]
// 2. 重复验证
if (tableObj.businessId === storeObj.businessId) {
matchFlag = false
break
}
}
} else {
playAudio(true)
this.$message.error({
message: '输入的位置' + this.searchForm.search + '不正确请重新输入',
duration: 2000,
onClose: () => {
playAudio(false)
}
})
this.searchForm.search = null
this.searchForm.lot = null
return null
}
} else {
// 向储存列表加数据
var obj = {
location: search,
lot: lot,
list: [],
frequency: 0
}
// 判断tableList中location和search相同的元素个数
this.tableList.forEach((item, index) => {
let oneLot = ''
let twoLot = ''
if (item.lot && item.lot !== '') {
oneLot = customUpperCase(item.lot)
}
if (lot && lot !== '') {
twoLot = customUpperCase(lot)
}
if (customUpperCase(item.location) === customUpperCase(search) && oneLot === twoLot) {
obj.list.push(index)
}
})
if (obj.list.length > 0) {
if (obj.list.length === 1) {
this.storeList.push(obj)
last.index = obj.list[0]
last.lot = this.tableList[obj.list[0].lot]
last.needNumber = this.tableList[obj.list[0]].needNumber
return last
}
if (obj.list.length > 1) {
// 向本地本地储存存入obj
this.storeList.push(obj)
last.index = obj.list[0]
last.lot = this.tableList[obj.list[0].lot]
last.needNumber = this.tableList[obj.list[0]].needNumber
return last
// 3. 确认匹配成功
if (matchFlag) {
this.storeList.push(matchObj)
return {
index: matchIndex,
needNumber: matchObj.needNumber
}
} else {
playAudio(true)
this.$message.error({
message: '输入的位置' + this.searchForm.search + '不正确请重新输入',
duration: 2000,
onClose: () => {
playAudio(false)
}
})
this.searchForm.search = null
this.searchForm.lot = null
return null
}
}
playAudio(true)
// todo 清空
this.searchForm.value2 = ''
this.searchForm.search = ''
this.$message.error({
message: '输入的位置' + this.searchForm.search + '不正确请重新输入',
duration: 2000,
onClose: () => {
playAudio(false)
}
})
this.$nextTick().then(() => {
this.$refs.input1.focus()
})
},
// 查询回
......@@ -345,6 +277,18 @@ export default {
},
handleSearchLot() {
this.$refs.formRef.validateField('value2', (error) => {
if (this.total === this.form.qty) {
this.$message.info({
message: '满了',
duration: 2000
})
this.searchForm.search = ''
this.searchForm.value2 = ''
this.$nextTick().then(() => {
this.$refs.input1.focus()
})
return
}
if (error) {
playAudio(true)
this.$message.error({
......@@ -421,11 +365,11 @@ export default {
if (abj) {
const { index, needNumber } = abj
if (!this.rowIndexList.includes(index)) {
successAudio(true)
this.rowIndexList.push(index)
this.search = null
this.lot = null
}
successAudio(true)
this.search = null
this.lot = null
this.$nextTick().then(() => {
this.$refs.input1.focus()
})
......
This diff is collapsed.
......@@ -342,18 +342,19 @@ export default {
console.log('this.form.value2', this.form.value2)
} else {
console.log(666)
const NweQty = this.form.qty * values[3]
const NewQty = this.form.qty * values[3]
console.log('NweQty1', NewQty)
const newLot = values[1]
const tooPn = values[0]
const item = {
qty: NweQty,
...this.form,
qty: NewQty,
newPn: tooPn,
lot: newLot,
cheBzq: values[2],
cheBz: '',
cheUnit: values[4],
cheCjName: values[5],
...this.form
cheCjName: values[5]
}
console.log('item', item)
addIncomeWmsBox(item).then(res => {
......@@ -368,8 +369,8 @@ export default {
})
}
} else {
console.log(666)
const NewQty = this.form.qty * values[3]
console.log('NweQty2', NewQty)
const newLot = values[1]
const tooPn = values[0]
const item = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment