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()
})
......
......@@ -32,17 +32,17 @@
</div>
<div class="disposeTableContent">
<el-table :data="tableList" :row-class-name="tableRowClassName" style="width: 100%">
<el-table-column label="location">
<el-table-column label="location" width="80">
<template slot-scope="scope">
<span>{{ scope.row.location || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="保质期" align="center">
<el-table-column label="保质期">
<template slot-scope="scope">
<span>{{ formatCheBzq(scope.row.cheBzq) || '-' }}({{ scope.row.lot || '-' }})</span>
</template>
</el-table-column>
<el-table-column label="数量" fixed="right">
<el-table-column label="数量" style="float: right" width="70">
<template slot-scope="scope">
<span>{{ scope.row.needNumber || '-' }}</span>
</template>
......@@ -89,7 +89,8 @@ export default {
rules: {
search: [
{ pattern: /^.*,.*/ | /^.*$/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' }
]
],
value2: [{ pattern: /^[^,]+,[^,]+,\d{4}\/\d{2}\/\d{2}|\d{4}-\d{2}-\d{2},[1-9]\d*,[^,]+/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' }]
},
tableList: [],
searchForm: {
......@@ -119,9 +120,7 @@ export default {
getAllDict() {
getDict('APPLICATION_TYPE').then(res => {
if (res.code === 200) {
console.log('res', res)
this.typeList = res.data
console.log('ressssssss', this.typeList)
}
})
},
......@@ -130,7 +129,6 @@ export default {
if (list && list.length > 0 && value) {
if (list.find(item => item.dictValue === value)) {
label = list.find(item => item.dictValue === value).dictLabel
console.log('111')
return label
}
}
......@@ -148,7 +146,6 @@ export default {
businessId: this.businessId
}
handleOutWarehouse(obj).then(res => {
console.log('res', res)
if (res.code === 200) {
this.form = res.data
this.tableList = res.data.boxList
......@@ -158,128 +155,57 @@ export default {
/**
* 获取本次要高亮的行的下坐标和要加的数量
* **/
getIndexAndNeedNumber(search) {
var last = {
index: null,
needNumber: null
}
getIndexAndNeedNumber(location, lot, cheBzq) {
let matchFlag = false
let matchObj = null
let matchIndex = null
/**
* 1.判断储存的list是不是为空
* **/
if (this.storeList.length > 0) {
var list = []
// 判断tableList中location和search相同的元素个数
this.tableList.forEach((item, index) => {
if (customUpperCase(item.location) === customUpperCase(search)) {
list.push(index)
}
})
if (list.length > 0) {
if (list.length === 1) {
last.index = list[0]
last.needNumber = this.tableList[list[0]].needNumber
return last
}
if (list.length > 1) {
// 是否能从储存中找到location
if (this.storeList.find(Litem => customUpperCase(Litem.location) === customUpperCase(search))) {
var index = this.storeList.findIndex(Litem => customUpperCase(Litem.location) === customUpperCase(search))
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
return last
} else {
return null
}
} else {
var objT = {
location: search,
list: list,
frequency: 0
}
this.storeList.push(objT)
last.index = list[0]
last.needNumber = this.tableList[list[0]].needNumber
return last
* 1.判断储存的list是不是为空
* **/
// 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) &&
this.formatCheBzq(tableObj.cheBzq) === customUpperCase(cheBzq)) {
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
return null
}
} else {
// 向储存列表加数据
var obj = {
location: search,
list: [],
frequency: 0
}
// 判断tableList中location和search相同的元素个数
this.tableList.forEach((item, index) => {
if (customUpperCase(item.location) === customUpperCase(search)) {
obj.list.push(index)
}
})
if (obj.list.length > 0) {
if (obj.list.length === 1) {
this.storeList.push(obj)
last.index = obj.list[0]
last.needNumber = this.tableList[obj.list[0]].needNumber
return last
// 3. 确认匹配成功
if (matchFlag) {
this.storeList.push(matchObj)
return {
index: matchIndex,
needNumber: matchObj.needNumber
}
if (obj.list.length > 1) {
// 向本地本地储存存入obj
this.storeList.push(obj)
last.index = obj.list[0]
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
return null
}
console.log('判断tableList中location和search相同的元素个数', obj.list.length)
}
playAudio(true)
this.searchForm.value2 = ''
this.searchForm.search = ''
this.$message.error({
message: '输入的位置不正确请重新输入',
duration: 2000,
onClose: () => {
playAudio(false)
}
})
this.$nextTick().then(() => {
this.$refs.input1.focus()
})
},
// 查询回
// handleSearch() {
// var search = ''
// if (this.searchForm.search && this.searchForm.search !== '') {
// if (this.searchForm.search.includes(',')) {
// search = this.searchForm.search.split(',')[0]
// } else {
// search = this.searchForm.search
// }
// const obj = this.getIndexAndNeedNumber(search)
// if (obj) {
// const { index, needNumber } = obj
// if (!this.rowIndexList.includes(index)) {
// successAudio(true)
// this.rowIndexList.push(index)
// }
// this.total = this.total + needNumber
// this.searchForm.search = ''
// }
// }
// },
// 查询回
handleSearch() {
// 获取位置输入框的数据
if (this.searchForm.search.includes(',')) {
......@@ -295,7 +221,6 @@ export default {
let isLegalLocation = false
this.tableList.forEach(item => {
if (customUpperCase(item.location) === customUpperCase(data)) {
console.log(data, item.location)
isLegalLocation = true
}
})
......@@ -312,77 +237,70 @@ export default {
this.searchForm.search = null
}
},
// handleSearch() {
// const keyword = this.searchForm.search
// // 如果搜索关键字与上一次相同,则从当前索引的下一个位置开始搜索
// if (keyword === this.SearchKeyword) {
// this.currentIndex++
// } else {
// // 如果搜索关键字发生变化,则重置索引为-1,并更新上一次搜索的关键字
// this.currentIndex = -1
// this.SearchKeyword = keyword
// }
// // 清空之前的高亮记录
// this.rowIndexList = []
// // 查找匹配项,并将其索引添加到rowIndexList中
// for (let i = this.currentIndex + 1; i < this.tableList.length; i++) {
// const item = this.tableList[i]
// if (item.location === keyword) {
// this.rowIndexList.push(i)
// this.total = this.total + item.needNumber
// // 找到匹配项后,跳出循环
// break
// }
// }
// },
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({
message: '输入值不符合格式要求,请重新输入',
duration: 2000
})
// 清空输入框
this.searchForm.value2 = ''
} else {
const values = this.searchForm.value2.split(',')
const obj = {
lot: values[1],
pn: values[0],
bzq: values[2],
10: values[3],
unit: values[4],
cj_name: values[5]
}
if (customUpperCase(obj.pn) !== customUpperCase(this.form.pn) && customUpperCase(obj.lot) !== customUpperCase(this.tableList.lot) && obj.bzq !== this.tableList.cheBzq) {
this.$message.error({
message: '输入不符合要求请重新输入!',
duration: 2000
})
this.searchForm.value2 = null
} else {
// 获取LOT输入框的数据
this.lot = obj.lot
var lot = this.lot
var search = this.search
// 调用方法,并传入位置和LOT作为参数
const abj = this.getIndexAndNeedNumber(search, lot)
if (abj) {
const { index, needNumber } = abj
if (!this.rowIndexList.includes(index)) {
successAudio(true)
this.rowIndexList.push(index)
this.search = null
this.lot = null
}
this.$nextTick().then(() => {
this.$refs.input1.focus()
})
this.total = this.total + needNumber
this.searchForm.search = ''
this.searchForm.value2 = '' // 清空LOT输入框数据
}
return
}
const values = this.searchForm.value2.split(',')
const obj = {
lot: values[1],
pn: values[0],
cheBzq: values[2],
10: values[3],
unit: values[4],
cj_name: values[5]
}
// 1. pn 校验
if (customUpperCase(obj.pn) !== customUpperCase(this.form.pn)) {
playAudio(true)
this.$message.error({
message: 'PN值不符合要求请重新输入!',
duration: 2000
})
this.searchForm.value2 = null
return
}
// 获取LOT输入框的数据
this.lot = obj.lot
this.cheBzq = this.formatCheBzq(obj.cheBzq)
// 调用方法,并传入位置和LOT作为参数
const abj = this.getIndexAndNeedNumber(this.search, this.lot, this.cheBzq)
if (abj) {
const { index, needNumber } = abj
if (!this.rowIndexList.includes(index)) {
successAudio(true)
this.rowIndexList.push(index)
this.search = null
this.lot = null
this.cheBzq = null
}
this.$nextTick().then(() => {
this.$refs.input1.focus()
})
this.total = this.total + needNumber
this.searchForm.search = ''
this.searchForm.value2 = '' // 清空LOT输入框数据
}
})
},
......
......@@ -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