|
@ -30,7 +30,7 @@ |
|
|
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'></u-line> |
|
|
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'></u-line> |
|
|
<scroll-view scroll-y="true" class="scroll-view" v-if="expand&&scanList.length>0" |
|
|
<scroll-view scroll-y="true" class="scroll-view" v-if="expand&&scanList.length>0" |
|
|
style="height: 70px;"> |
|
|
style="height: 70px;"> |
|
|
<view class="uni-flex u-col" v-for="(item,index) in scanList"> |
|
|
<view class="uni-flex u-col" v-for="(item,index) in scanList" :key="index"> |
|
|
<view style="width: 100%;max-height: 100px;"> |
|
|
<view style="width: 100%;max-height: 100px;"> |
|
|
<view class="uni-flex u-row space-between u-col-center" @click="showItem(item)"> |
|
|
<view class="uni-flex u-row space-between u-col-center" @click="showItem(item)"> |
|
|
<view class="text_ellipsis" style="padding: 15rpx;"> |
|
|
<view class="text_ellipsis" style="padding: 15rpx;"> |
|
@ -55,6 +55,13 @@ |
|
|
getLabelInfo |
|
|
getLabelInfo |
|
|
} from '../../common/label.js'; |
|
|
} from '../../common/label.js'; |
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
|
getMesPackInfo |
|
|
|
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
import { |
|
|
|
|
|
Exception |
|
|
|
|
|
} from 'sass'; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: "winComScan", |
|
|
name: "winComScan", |
|
|
emits: ["getResult"], |
|
|
emits: ["getResult"], |
|
@ -91,7 +98,8 @@ |
|
|
scanList: [], |
|
|
scanList: [], |
|
|
expand: true, |
|
|
expand: true, |
|
|
expendIcon: 'arrow-down', |
|
|
expendIcon: 'arrow-down', |
|
|
cursorIndex: 0 |
|
|
cursorIndex: 0, |
|
|
|
|
|
itemCode: "" |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
@ -117,6 +125,7 @@ |
|
|
this.placeholderValue = '请扫描' + this.placeholder; |
|
|
this.placeholderValue = '请扫描' + this.placeholder; |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
|
|
|
hide() { |
|
|
hide() { |
|
|
// #ifdef APP-PLUS |
|
|
// #ifdef APP-PLUS |
|
|
// 只是解决软键盘的闪现 |
|
|
// 只是解决软键盘的闪现 |
|
@ -130,6 +139,10 @@ |
|
|
}, 1000); |
|
|
}, 1000); |
|
|
// #endif |
|
|
// #endif |
|
|
}, |
|
|
}, |
|
|
|
|
|
setItemCode(itemCode) { |
|
|
|
|
|
this.itemCode = itemCode; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
getValue() { |
|
|
getValue() { |
|
|
return this.scanMsg |
|
|
return this.scanMsg |
|
|
}, |
|
|
}, |
|
@ -146,10 +159,13 @@ |
|
|
}, |
|
|
}, |
|
|
handelScanMsg() { |
|
|
handelScanMsg() { |
|
|
let that = this; |
|
|
let that = this; |
|
|
|
|
|
let index = that.scanMsg.indexOf('\n'); |
|
|
|
|
|
if (index >= 0) { |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
that.losefocus(); |
|
|
that.losefocus(); |
|
|
// let content = uni.$u.trim(that.scanMsg) |
|
|
// let content = uni.$u.trim(that.scanMsg) |
|
|
let content = that.scanMsg; |
|
|
let content = uni.$u.trim(that.scanMsg) |
|
|
|
|
|
// let content = that.scanMsg; |
|
|
if (content == "") { |
|
|
if (content == "") { |
|
|
that.getfocus(); |
|
|
that.getfocus(); |
|
|
this.$refs.comMessage.showErrorMessage("扫描内容为空,请重新扫描", res => { |
|
|
this.$refs.comMessage.showErrorMessage("扫描内容为空,请重新扫描", res => { |
|
@ -164,12 +180,26 @@ |
|
|
if (that.isShowHistory) { |
|
|
if (that.isShowHistory) { |
|
|
that.scanList.unshift(content); |
|
|
that.scanList.unshift(content); |
|
|
} |
|
|
} |
|
|
|
|
|
console.log("扫描长度", content.length) |
|
|
|
|
|
getMesPackInfo(this.itemCode).then(res => { |
|
|
try { |
|
|
try { |
|
|
let itemCode = content.substr(0, 10); |
|
|
if (res.data.list.length == 0) { |
|
|
let productDate = content.substr(10, 8); |
|
|
throw new Error("没有查找到物料号【"+this.itemCode+"】对应的mes物料号") |
|
|
let batch = content.substr(18, 3); |
|
|
} |
|
|
let order = content.substr(21, 8); |
|
|
var result = res.data.list[0] |
|
|
|
|
|
var partNumber = result.partNumber; |
|
|
|
|
|
var lengthMat = result.lengthMat; |
|
|
|
|
|
var lengthBc = result.lengthBc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let itemCode = content.substr(0, lengthMat); |
|
|
|
|
|
let productDate = content.substr(lengthMat, 8); |
|
|
|
|
|
let batch = content.substr(lengthMat + 8, 3); |
|
|
|
|
|
let order = content.substr(-8); |
|
|
|
|
|
if (itemCode != partNumber) { |
|
|
|
|
|
throw new Error("解析错误:扫描物料号【" + itemCode + "】与查询物料号【" + partNumber + |
|
|
|
|
|
"】不一致") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
let scanResult = { |
|
|
let scanResult = { |
|
|
itemCode: itemCode, |
|
|
itemCode: itemCode, |
|
@ -182,14 +212,26 @@ |
|
|
}; |
|
|
}; |
|
|
that.clear(); |
|
|
that.clear(); |
|
|
that.$emit("getResult", scanResult); |
|
|
that.$emit("getResult", scanResult); |
|
|
} catch (e) { |
|
|
} catch (error) { |
|
|
this.$refs.comMessage.showErrorMessage('解析错误', res => { |
|
|
this.$refs.comMessage.showErrorMessage( error.message, res => { |
|
|
if (res) { |
|
|
if (res) { |
|
|
that.getfocus(); |
|
|
that.getfocus(); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
this.$refs.comMessage.showErrorMessage(error, res => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
that.scanMsg = "" |
|
|
|
|
|
that.getfocus(); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
}, 500); |
|
|
}, 500); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
getfocus() { |
|
|
getfocus() { |
|
|
let that = this; |
|
|
let that = this; |
|
|