Commit 1e328b33 authored by hubaoshan's avatar hubaoshan

1

parent 064b78b1
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
<el-form-item label="位置"> <el-form-item label="位置">
<el-input ref="input1" v-model="searchForm.search" clearable @keyup.enter.native="handleSearch" /> <el-input ref="input1" v-model="searchForm.search" clearable @keyup.enter.native="handleSearch" />
</el-form-item> </el-form-item>
<el-form-item label="YY" prop="value2">
<el-input ref="input2" v-model="searchForm.value2" clearable @keyup.enter.native="handleSearchLot" />
</el-form-item>
</el-form> </el-form>
</div> </div>
<div class="disposeTableContent"> <div class="disposeTableContent">
...@@ -34,7 +37,12 @@ ...@@ -34,7 +37,12 @@
<span>{{ scope.row.location || '-' }}</span> <span>{{ scope.row.location || '-' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量"> <el-table-column label="保质期" align="center">
<template slot-scope="scope">
<span>{{ formatCheBzq(scope.row.cheBzq) || '-' }}({{ scope.row.lot || '-' }})</span>
</template>
</el-table-column>
<el-table-column label="数量" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.needNumber || '-' }}</span> <span>{{ scope.row.needNumber || '-' }}</span>
</template> </template>
...@@ -79,7 +87,9 @@ export default { ...@@ -79,7 +87,9 @@ export default {
}, },
rules: { rules: {
search: [
{ pattern: /^.*,.*/ | /^.*$/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' }
]
}, },
tableList: [], tableList: [],
searchForm: { searchForm: {
...@@ -249,33 +259,59 @@ export default { ...@@ -249,33 +259,59 @@ export default {
} }
}, },
// 查询回 // 查询回
// 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() {
var search = '' // 获取位置输入框的数据
if (this.searchForm.search && this.searchForm.search !== '') { if (this.searchForm.search.includes(',')) {
if (this.searchForm.search.includes(',')) { this.search = this.searchForm.search.split(',')[0]
search = this.searchForm.search.split(',')[0] this.judgePush(this.search)
} else { } else {
search = this.searchForm.search this.search = this.searchForm.search
} this.judgePush(this.search)
const obj = this.getIndexAndNeedNumber(search) }
if (obj) { },
const { index, needNumber } = obj /** 判断是否可以输入*/
if (!this.rowIndexList.includes(index)) { judgePush(data) {
successAudio(true) let isLegalLocation = false
this.rowIndexList.push(index) this.tableList.forEach(item => {
} if (customUpperCase(item.location) === customUpperCase(data)) {
this.total = this.total + needNumber console.log(data, item.location)
this.searchForm.search = '' isLegalLocation = true
} }
})
if (isLegalLocation) {
successAudio(true)
this.$nextTick().then(() => {
this.$refs.input2.focus()
})
} else {
this.$message.error({
message: '请输入正确的location值!',
duration: 2000
})
this.searchForm.search = null
} }
// this.tableList.forEach((item, index) => {
// if (item.location === this.searchForm.search) {
// this.rowIndexList.push(index)
// this.total = this.total + item.needNumber
// }
// })
}, },
// handleSearch() { // handleSearch() {
// const keyword = this.searchForm.search // const keyword = this.searchForm.search
// // 如果搜索关键字与上一次相同,则从当前索引的下一个位置开始搜索 // // 如果搜索关键字与上一次相同,则从当前索引的下一个位置开始搜索
...@@ -299,7 +335,57 @@ export default { ...@@ -299,7 +335,57 @@ export default {
// } // }
// } // }
// }, // },
handleSearchLot() {
this.$refs.formRef.validateField('value2', (error) => {
if (error) {
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输入框数据
}
}
}
})
},
// 出库 // 出库
handleSave() { handleSave() {
if (this.total === this.form.qty) { if (this.total === this.form.qty) {
...@@ -328,6 +414,9 @@ export default { ...@@ -328,6 +414,9 @@ export default {
duration: 2000 duration: 2000
}) })
} }
},
formatCheBzq(date) {
return date ? date.split(' ')[0].replace(/-/g, '/') : ''
} }
} }
} }
...@@ -376,5 +465,10 @@ export default { ...@@ -376,5 +465,10 @@ export default {
margin-top: 10px; margin-top: 10px;
} }
} }
::v-deep.bzq{
position: absolute;
right: 70%;
text-align: center;
}
} }
</style> </style>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="yy:" prop="value2"> <el-form-item label="yy:" prop="value2">
<el-input ref="input2" v-model="form.value2" clearable @keyup.enter.native="handelTab(2,$event)" /> <el-input ref="input2" v-model.trim="form.value2" clearable @keyup.enter.native="handelTab(2,$event)" />
</el-form-item> </el-form-item>
<el-form-item label="数量:" prop="qty"> <el-form-item label="数量:" prop="qty">
<el-input ref="input3" v-model="form.qty" :maxlength="4" /> <el-input ref="input3" v-model="form.qty" :maxlength="4" />
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
import { getDict } from '@/api/system/dict/data' import { getDict } from '@/api/system/dict/data'
import { addIncomeWmsBox, getJcCode } from '@/api/incomeWmsBox' import { addIncomeWmsBox, getJcCode } from '@/api/incomeWmsBox'
import { findByLocation } from '@/api/incomeWmsLabel' import { findByLocation } from '@/api/incomeWmsLabel'
import { playAudio, successAudio } from '@/utils/common' import { customUpperCase, playAudio, successAudio } from '@/utils/common'
export default { export default {
name: 'EnterboundTwo', name: 'EnterboundTwo',
...@@ -96,15 +96,16 @@ export default { ...@@ -96,15 +96,16 @@ export default {
}, },
obj: {}, obj: {},
newPn: '', newPn: '',
rules: { rules: {
value1: [ value1: [
{ required: true, message: '请输入XX的值', trigger: 'blur' }, { required: true, message: '请输入XX的值', trigger: 'blur' },
{ pattern: /^.*,.*/ | /^.*$/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' } { pattern: /^.*$/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' }
], ],
qty: [{ validator: this.validatorQty, trigger: 'blur' }], qty: [{ pattern: /[1-9]\d*/, trigger: 'blur' }],
// value2: [{ pattern: /^[^,]+,[^,]+,\d{4}\/\d{2}\/\d{2},[1-9]\d*,\d+$/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' }] value2: [{ pattern: /^[^,]+,[^,]+,\d{4}\/\d{2}\/\d{2}|\d{4}-\d{2}-\d{2},[1-9]\d*,[^,]+/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' }]
value2: [{ pattern: /^[^,]+,[^,]+,\d{4}\/\d{2}\/\d{2},[1-9]\d*,[^,]+/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' }]
} }
} }
}, },
created() { created() {
...@@ -205,6 +206,8 @@ export default { ...@@ -205,6 +206,8 @@ export default {
this.form.labelId = res.data.businessId this.form.labelId = res.data.businessId
if (res.data.pn) { if (res.data.pn) {
this.responsePn = res.data.pn this.responsePn = res.data.pn
} else {
this.responsePn = ''
} }
if (res.data.location) { if (res.data.location) {
this.form.location = res.data.location this.form.location = res.data.location
...@@ -225,7 +228,7 @@ export default { ...@@ -225,7 +228,7 @@ export default {
} }
}) })
this.form.value1 = null this.form.value1 = null
this.responsePn = null this.responsePn = ''
this.form.location = null this.form.location = null
this.form.labelId = null this.form.labelId = null
this.form.pn = null this.form.pn = null
...@@ -267,14 +270,15 @@ export default { ...@@ -267,14 +270,15 @@ export default {
console.log(obj.pn) console.log(obj.pn)
this.newPn = obj.pn this.newPn = obj.pn
if (this.responsePn !== '' && this.responsePn !== null) { if (this.responsePn !== '' && this.responsePn !== null) {
if (obj.pn !== this.responsePn) { if (customUpperCase(obj.pn) !== customUpperCase(this.responsePn)) {
console.log(obj.pn) console.log('obj.pn', obj.pn)
console.log(this.responsePn) console.log(this.responsePn)
this.$message.error({ this.$message.error({
message: '您输入的pn ' + obj.pn + ' 与返回pn ' + this.responsePn + ' 不一样', message: '您输入的pn ' + obj.pn + ' 与返回pn ' + this.responsePn + ' 不一样',
duration: 2000 duration: 2000
}) })
this.form.pn = '' this.form.pn = ''
this.form.value2 = ''
} else { } else {
this.obj = { this.obj = {
lot: values[1], lot: values[1],
...@@ -301,7 +305,9 @@ export default { ...@@ -301,7 +305,9 @@ export default {
* @return: * @return:
**/ **/
SubmitForm() { SubmitForm() {
const values = this.form.value2.split(',') const value = this.form.value2.replace(/\s+/g, '')
console.log('value', value)
const values = value.split(',')
const newObj = { const newObj = {
lot: values[1], lot: values[1],
pn: values[0], pn: values[0],
...@@ -310,31 +316,37 @@ export default { ...@@ -310,31 +316,37 @@ export default {
unit: values[4], unit: values[4],
cj_name: values[5] cj_name: values[5]
} }
console.log(newObj) console.log('newObj', newObj)
this.$refs.from.validate(valid => { this.$refs.from.validate(valid => {
console.log(111)
if (valid) { if (valid) {
console.log(222)
if (!values[0] && !values[1] && !values[2] && !values[3] && !values[4]) { if (!values[0] && !values[1] && !values[2] && !values[3] && !values[4]) {
console.log('1') console.log(333)
this.$message.error({ this.$message.error({
message: '前5个值不能为空,请检查', message: '前5个值不能为空,请检查',
duration: 2000 duration: 2000
}) })
this.form.value2 = '' this.form.value2 = ''
} else if (this.responsePn && this.responsePn !== '' && this.responsePn !== undefined) { } else if (this.responsePn && this.responsePn !== '' && this.responsePn !== undefined) {
if (values[0] !== this.responsePn) { console.log(444)
if (customUpperCase(values[0]) !== customUpperCase(this.responsePn) && this.responsePn === '') {
console.log('customUpperCase(this.responsePn)', customUpperCase(this.responsePn))
console.log('2') console.log('2')
this.$message.error({ this.$message.error({
message: '您输入的pn:' + values[0] + '与返回pn:' + this.responsePn + '的不一样', message: '您输入的pn:' + values[0] + '与返回pn:' + this.responsePn + '的不一样',
duration: 2000 duration: 2000
}) })
this.form.pn = '' this.form.pn = ''
this.form.value2 = ''
console.log('this.form.value2', this.form.value2)
} else { } else {
console.log('3') console.log(666)
this.form.qty = this.form.qty * values[3] const NweQty = this.form.qty * values[3]
const newLot = values[1] const newLot = values[1]
const tooPn = values[0] const tooPn = values[0]
const item = { const item = {
qty: this.form.qty, qty: NweQty,
newPn: tooPn, newPn: tooPn,
lot: newLot, lot: newLot,
cheBzq: values[2], cheBzq: values[2],
...@@ -355,6 +367,32 @@ export default { ...@@ -355,6 +367,32 @@ export default {
} }
}) })
} }
} else {
console.log(666)
const NewQty = this.form.qty * values[3]
const newLot = values[1]
const tooPn = values[0]
const item = {
qty: NewQty,
newPn: tooPn,
lot: newLot,
cheBzq: values[2],
cheBz: '',
cheUnit: values[4],
cheCjName: values[5],
...this.form
}
console.log('item', item)
addIncomeWmsBox(item).then(res => {
if (res.code === 200) {
this.$message.success('保存成功')
this.resetForm()
this.getOrderCode()
this.$nextTick().then(() => {
this.$refs.input1.focus()
})
}
})
} }
} }
}) })
......
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