Commit 6a8b8aab authored by hubaoshan's avatar hubaoshan

1

parent 1e328b33
...@@ -100,6 +100,11 @@ ...@@ -100,6 +100,11 @@
<span>{{ scope.row.pn || '-' }}</span> <span>{{ scope.row.pn || '-' }}</span>
</template> </template>
</el-table-column> </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"> <el-table-column label="操作" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<span style="color: #46BCF3;cursor: pointer" @click="handleDispose(scope.row)">处理</span> <span style="color: #46BCF3;cursor: pointer" @click="handleDispose(scope.row)">处理</span>
......
...@@ -174,123 +174,55 @@ export default { ...@@ -174,123 +174,55 @@ export default {
/** /**
* 获取本次要高亮的行的下坐标和要加的数量 * 获取本次要高亮的行的下坐标和要加的数量
* **/ * **/
getIndexAndNeedNumber(search, lot) { getIndexAndNeedNumber(location, lot) {
var last = { let matchFlag = false
index: null, let matchObj = null
lot: null, let matchIndex = null
needNumber: null
}
/** /**
* 1.判断储存的list是不是为空 * 1.判断储存的list是不是为空
* **/ * **/
if (this.storeList.length > 0) { // this.storeList
var list = [] // this.tableList
// 判断tableList中location和search及lot相同的元素个数 for (let i = 0; i < this.tableList.length; i++) {
this.tableList.forEach((item, index) => { const tableObj = this.tableList[i]
if (customUpperCase(item.location) === customUpperCase(search) && customUpperCase(item.lot) === customUpperCase(lot)) { // 1. 匹配成功
list.push(index) if (customUpperCase(tableObj.location) === customUpperCase(location) &&
} customUpperCase(tableObj.lot) === customUpperCase(lot)) {
}) matchFlag = true
if (list.length > 0) { matchObj = tableObj
if (list.length === 1) { matchIndex = i
last.index = list[0] for (let j = 0; j < this.storeList.length; j++) {
last.lot = this.tableList[list[0]].lot const storeObj = this.storeList[j]
last.needNumber = this.tableList[list[0]].needNumber // 2. 重复验证
return last if (tableObj.businessId === storeObj.businessId) {
} matchFlag = false
if (list.length > 1) { break
// 是否能从储存中找到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
} }
} }
} 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 { // 3. 确认匹配成功
// 向储存列表加数据 if (matchFlag) {
var obj = { this.storeList.push(matchObj)
location: search, return {
lot: lot, index: matchIndex,
list: [], needNumber: matchObj.needNumber
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
} }
} 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 { ...@@ -345,6 +277,18 @@ export default {
}, },
handleSearchLot() { handleSearchLot() {
this.$refs.formRef.validateField('value2', (error) => { 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) { if (error) {
playAudio(true) playAudio(true)
this.$message.error({ this.$message.error({
...@@ -421,11 +365,11 @@ export default { ...@@ -421,11 +365,11 @@ export default {
if (abj) { if (abj) {
const { index, needNumber } = abj const { index, needNumber } = abj
if (!this.rowIndexList.includes(index)) { if (!this.rowIndexList.includes(index)) {
successAudio(true)
this.rowIndexList.push(index) this.rowIndexList.push(index)
this.search = null
this.lot = null
} }
successAudio(true)
this.search = null
this.lot = null
this.$nextTick().then(() => { this.$nextTick().then(() => {
this.$refs.input1.focus() this.$refs.input1.focus()
}) })
......
This diff is collapsed.
...@@ -342,18 +342,19 @@ export default { ...@@ -342,18 +342,19 @@ export default {
console.log('this.form.value2', this.form.value2) console.log('this.form.value2', this.form.value2)
} else { } else {
console.log(666) 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 newLot = values[1]
const tooPn = values[0] const tooPn = values[0]
const item = { const item = {
qty: NweQty, ...this.form,
qty: NewQty,
newPn: tooPn, newPn: tooPn,
lot: newLot, lot: newLot,
cheBzq: values[2], cheBzq: values[2],
cheBz: '', cheBz: '',
cheUnit: values[4], cheUnit: values[4],
cheCjName: values[5], cheCjName: values[5]
...this.form
} }
console.log('item', item) console.log('item', item)
addIncomeWmsBox(item).then(res => { addIncomeWmsBox(item).then(res => {
...@@ -368,8 +369,8 @@ export default { ...@@ -368,8 +369,8 @@ export default {
}) })
} }
} else { } else {
console.log(666)
const NewQty = this.form.qty * values[3] const NewQty = this.form.qty * values[3]
console.log('NweQty2', NewQty)
const newLot = values[1] const newLot = values[1]
const tooPn = values[0] const tooPn = values[0]
const item = { 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