|
@ -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,50 +159,79 @@ |
|
|
}, |
|
|
}, |
|
|
handelScanMsg() { |
|
|
handelScanMsg() { |
|
|
let that = this; |
|
|
let that = this; |
|
|
setTimeout(() => { |
|
|
let index = that.scanMsg.indexOf('\n'); |
|
|
that.losefocus(); |
|
|
if (index >= 0) { |
|
|
// let content = uni.$u.trim(that.scanMsg) |
|
|
setTimeout(() => { |
|
|
let content = that.scanMsg; |
|
|
that.losefocus(); |
|
|
if (content == "") { |
|
|
// let content = uni.$u.trim(that.scanMsg) |
|
|
that.getfocus(); |
|
|
let content = uni.$u.trim(that.scanMsg) |
|
|
this.$refs.comMessage.showErrorMessage("扫描内容为空,请重新扫描", res => { |
|
|
// let content = that.scanMsg; |
|
|
if (res) { |
|
|
if (content == "") { |
|
|
that.scanMsg = "" |
|
|
that.getfocus(); |
|
|
that.getfocus(); |
|
|
this.$refs.comMessage.showErrorMessage("扫描内容为空,请重新扫描", res => { |
|
|
} |
|
|
if (res) { |
|
|
}) |
|
|
that.scanMsg = "" |
|
|
return; |
|
|
that.getfocus(); |
|
|
} |
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (that.isShowHistory) { |
|
|
|
|
|
that.scanList.unshift(content); |
|
|
|
|
|
} |
|
|
|
|
|
console.log("扫描长度", content.length) |
|
|
|
|
|
getMesPackInfo(this.itemCode).then(res => { |
|
|
|
|
|
try { |
|
|
|
|
|
if (res.data.list.length == 0) { |
|
|
|
|
|
throw new Error("没有查找到物料号【"+this.itemCode+"】对应的mes物料号") |
|
|
|
|
|
} |
|
|
|
|
|
var result = res.data.list[0] |
|
|
|
|
|
var partNumber = result.partNumber; |
|
|
|
|
|
var lengthMat = result.lengthMat; |
|
|
|
|
|
var lengthBc = result.lengthBc; |
|
|
|
|
|
|
|
|
if (that.isShowHistory) { |
|
|
|
|
|
that.scanList.unshift(content); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
let itemCode = content.substr(0, lengthMat); |
|
|
let itemCode = content.substr(0, 10); |
|
|
let productDate = content.substr(lengthMat, 8); |
|
|
let productDate = content.substr(10, 8); |
|
|
let batch = content.substr(lengthMat + 8, 3); |
|
|
let batch = content.substr(18, 3); |
|
|
let order = content.substr(-8); |
|
|
let order = content.substr(21, 8); |
|
|
if (itemCode != partNumber) { |
|
|
|
|
|
throw new Error("解析错误:扫描物料号【" + itemCode + "】与查询物料号【" + partNumber + |
|
|
|
|
|
"】不一致") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
let scanResult = { |
|
|
let scanResult = { |
|
|
itemCode: itemCode, |
|
|
itemCode: itemCode, |
|
|
productDate: productDate, |
|
|
productDate: productDate, |
|
|
batch: batch, |
|
|
batch: batch, |
|
|
order: order, |
|
|
order: order, |
|
|
qty: 1, |
|
|
qty: 1, |
|
|
content: content, |
|
|
content: content, |
|
|
success: true, |
|
|
success: true, |
|
|
}; |
|
|
}; |
|
|
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; |
|
|