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,59 +174,45 @@ export default { ...@@ -174,59 +174,45 @@ 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 // 3. 确认匹配成功
if (this.storeList[index].frequency < this.storeList[index].list.length) { if (matchFlag) {
last.index = this.storeList[index].list[this.storeList[index].frequency] this.storeList.push(matchObj)
last.needNumber = this.tableList[this.storeList[index].list[this.storeList[index].frequency]].needNumber return {
last.lot = this.tableList[this.storeList[index].list[this.storeList[index].frequency]].lot index: matchIndex,
return last needNumber: matchObj.needNumber
} 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) playAudio(true)
// todo 清空
this.searchForm.value2 = ''
this.searchForm.search = ''
this.$message.error({ this.$message.error({
message: '输入的位置' + this.searchForm.search + '不正确请重新输入', message: '输入的位置' + this.searchForm.search + '不正确请重新输入',
duration: 2000, duration: 2000,
...@@ -234,63 +220,9 @@ export default { ...@@ -234,63 +220,9 @@ export default {
playAudio(false) playAudio(false)
} }
}) })
this.searchForm.search = null this.$nextTick().then(() => {
this.searchForm.lot = null this.$refs.input1.focus()
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
}
} 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
}
}
}, },
// 查询回 // 查询回
...@@ -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)
}
successAudio(true)
this.search = null this.search = null
this.lot = null this.lot = null
}
this.$nextTick().then(() => { this.$nextTick().then(() => {
this.$refs.input1.focus() this.$refs.input1.focus()
}) })
......
...@@ -32,17 +32,17 @@ ...@@ -32,17 +32,17 @@
</div> </div>
<div class="disposeTableContent"> <div class="disposeTableContent">
<el-table :data="tableList" :row-class-name="tableRowClassName" style="width: 100%"> <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"> <template slot-scope="scope">
<span>{{ scope.row.location || '-' }}</span> <span>{{ scope.row.location || '-' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="保质期" align="center"> <el-table-column label="保质期">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ formatCheBzq(scope.row.cheBzq) || '-' }}({{ scope.row.lot || '-' }})</span> <span>{{ formatCheBzq(scope.row.cheBzq) || '-' }}({{ scope.row.lot || '-' }})</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量" fixed="right"> <el-table-column label="数量" style="float: right" width="70">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.needNumber || '-' }}</span> <span>{{ scope.row.needNumber || '-' }}</span>
</template> </template>
...@@ -89,7 +89,8 @@ export default { ...@@ -89,7 +89,8 @@ export default {
rules: { rules: {
search: [ search: [
{ pattern: /^.*,.*/ | /^.*$/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' } { 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: [], tableList: [],
searchForm: { searchForm: {
...@@ -119,9 +120,7 @@ export default { ...@@ -119,9 +120,7 @@ export default {
getAllDict() { getAllDict() {
getDict('APPLICATION_TYPE').then(res => { getDict('APPLICATION_TYPE').then(res => {
if (res.code === 200) { if (res.code === 200) {
console.log('res', res)
this.typeList = res.data this.typeList = res.data
console.log('ressssssss', this.typeList)
} }
}) })
}, },
...@@ -130,7 +129,6 @@ export default { ...@@ -130,7 +129,6 @@ export default {
if (list && list.length > 0 && value) { if (list && list.length > 0 && value) {
if (list.find(item => item.dictValue === value)) { if (list.find(item => item.dictValue === value)) {
label = list.find(item => item.dictValue === value).dictLabel label = list.find(item => item.dictValue === value).dictLabel
console.log('111')
return label return label
} }
} }
...@@ -148,7 +146,6 @@ export default { ...@@ -148,7 +146,6 @@ export default {
businessId: this.businessId businessId: this.businessId
} }
handleOutWarehouse(obj).then(res => { handleOutWarehouse(obj).then(res => {
console.log('res', res)
if (res.code === 200) { if (res.code === 200) {
this.form = res.data this.form = res.data
this.tableList = res.data.boxList this.tableList = res.data.boxList
...@@ -158,128 +155,57 @@ export default { ...@@ -158,128 +155,57 @@ export default {
/** /**
* 获取本次要高亮的行的下坐标和要加的数量 * 获取本次要高亮的行的下坐标和要加的数量
* **/ * **/
getIndexAndNeedNumber(search) { getIndexAndNeedNumber(location, lot, cheBzq) {
var last = { let matchFlag = false
index: null, let matchObj = null
needNumber: null let matchIndex = null
}
/** /**
* 1.判断储存的list是不是为空 * 1.判断储存的list是不是为空
* **/ * **/
if (this.storeList.length > 0) { // this.storeList
var list = [] // this.tableList
// 判断tableList中location和search相同的元素个数 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)) { // 1. 匹配成功
list.push(index) if (customUpperCase(tableObj.location) === customUpperCase(location) &&
} customUpperCase(tableObj.lot) === customUpperCase(lot) &&
}) this.formatCheBzq(tableObj.cheBzq) === customUpperCase(cheBzq)) {
if (list.length > 0) { matchFlag = true
if (list.length === 1) { matchObj = tableObj
last.index = list[0] matchIndex = i
last.needNumber = this.tableList[list[0]].needNumber for (let j = 0; j < this.storeList.length; j++) {
return last const storeObj = this.storeList[j]
} // 2. 重复验证
if (list.length > 1) { if (tableObj.businessId === storeObj.businessId) {
// 是否能从储存中找到location matchFlag = false
if (this.storeList.find(Litem => customUpperCase(Litem.location) === customUpperCase(search))) { break
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] // 3. 确认匹配成功
last.needNumber = this.tableList[this.storeList[index].list[this.storeList[index].frequency]].needNumber if (matchFlag) {
return last this.storeList.push(matchObj)
} else { return {
return null index: matchIndex,
} needNumber: matchObj.needNumber
} 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
} }
} }
} else {
playAudio(true) playAudio(true)
this.searchForm.value2 = ''
this.searchForm.search = ''
this.$message.error({ this.$message.error({
message: '输入的位置' + this.searchForm.search + '不正确请重新输入', message: '输入的位置不正确请重新输入',
duration: 2000, duration: 2000,
onClose: () => { onClose: () => {
playAudio(false) playAudio(false)
} }
}) })
this.searchForm.search = null this.$nextTick().then(() => {
return null this.$refs.input1.focus()
}
} 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
}
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)
}
}, },
// 查询回 // 查询回
// 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() { handleSearch() {
// 获取位置输入框的数据 // 获取位置输入框的数据
if (this.searchForm.search.includes(',')) { if (this.searchForm.search.includes(',')) {
...@@ -295,7 +221,6 @@ export default { ...@@ -295,7 +221,6 @@ export default {
let isLegalLocation = false let isLegalLocation = false
this.tableList.forEach(item => { this.tableList.forEach(item => {
if (customUpperCase(item.location) === customUpperCase(data)) { if (customUpperCase(item.location) === customUpperCase(data)) {
console.log(data, item.location)
isLegalLocation = true isLegalLocation = true
} }
}) })
...@@ -312,61 +237,55 @@ export default { ...@@ -312,61 +237,55 @@ export default {
this.searchForm.search = null 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() { 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)
this.$message.error({ this.$message.error({
message: '输入值不符合格式要求,请重新输入', message: '输入值不符合格式要求,请重新输入',
duration: 2000 duration: 2000
}) })
// 清空输入框 // 清空输入框
this.searchForm.value2 = '' this.searchForm.value2 = ''
} else { return
}
const values = this.searchForm.value2.split(',') const values = this.searchForm.value2.split(',')
const obj = { const obj = {
lot: values[1], lot: values[1],
pn: values[0], pn: values[0],
bzq: values[2], cheBzq: values[2],
10: values[3], 10: values[3],
unit: values[4], unit: values[4],
cj_name: values[5] cj_name: values[5]
} }
if (customUpperCase(obj.pn) !== customUpperCase(this.form.pn) && customUpperCase(obj.lot) !== customUpperCase(this.tableList.lot) && obj.bzq !== this.tableList.cheBzq) { // 1. pn 校验
if (customUpperCase(obj.pn) !== customUpperCase(this.form.pn)) {
playAudio(true)
this.$message.error({ this.$message.error({
message: '输入不符合要求请重新输入!', message: 'PN值不符合要求请重新输入!',
duration: 2000 duration: 2000
}) })
this.searchForm.value2 = null this.searchForm.value2 = null
} else { return
}
// 获取LOT输入框的数据 // 获取LOT输入框的数据
this.lot = obj.lot this.lot = obj.lot
var lot = this.lot this.cheBzq = this.formatCheBzq(obj.cheBzq)
var search = this.search
// 调用方法,并传入位置和LOT作为参数 // 调用方法,并传入位置和LOT作为参数
const abj = this.getIndexAndNeedNumber(search, lot) const abj = this.getIndexAndNeedNumber(this.search, this.lot, this.cheBzq)
if (abj) { if (abj) {
const { index, needNumber } = abj const { index, needNumber } = abj
if (!this.rowIndexList.includes(index)) { if (!this.rowIndexList.includes(index)) {
...@@ -374,6 +293,7 @@ export default { ...@@ -374,6 +293,7 @@ export default {
this.rowIndexList.push(index) this.rowIndexList.push(index)
this.search = null this.search = null
this.lot = null this.lot = null
this.cheBzq = null
} }
this.$nextTick().then(() => { this.$nextTick().then(() => {
this.$refs.input1.focus() this.$refs.input1.focus()
...@@ -382,8 +302,6 @@ export default { ...@@ -382,8 +302,6 @@ export default {
this.searchForm.search = '' this.searchForm.search = ''
this.searchForm.value2 = '' // 清空LOT输入框数据 this.searchForm.value2 = '' // 清空LOT输入框数据
} }
}
}
}) })
}, },
// 出库 // 出库
......
...@@ -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