diff --git a/src/api/request2.js b/src/api/request2.js index 424742a2..3ca3e1e6 100644 --- a/src/api/request2.js +++ b/src/api/request2.js @@ -395,6 +395,31 @@ export function getPackageListByNumber(number) { }); } +/** + * 获取mes箱码信息(通过物料号 + * @param {*} + * + */ +export function getMesPackInfo(code) { + var params = { + filters: [{ + column:"lowerLim", + action:"==", + value:code + }], + pageNo: 1, + pageSize: 10 + } + return request({ + url: baseApi + "/wms/mes-bar-code/senior", + method: "post", + data: params, + }); +} + + + + /** diff --git a/src/mycomponents/scan/winComScanFg.vue b/src/mycomponents/scan/winComScanFg.vue index e23070b9..e61fef82 100644 --- a/src/mycomponents/scan/winComScanFg.vue +++ b/src/mycomponents/scan/winComScanFg.vue @@ -30,7 +30,7 @@ - + @@ -55,6 +55,13 @@ getLabelInfo } from '../../common/label.js'; + import { + getMesPackInfo + } from '@/api/request2.js'; + import { + Exception + } from 'sass'; + export default { name: "winComScan", emits: ["getResult"], @@ -91,7 +98,8 @@ scanList: [], expand: true, expendIcon: 'arrow-down', - cursorIndex: 0 + cursorIndex: 0, + itemCode: "" } }, mounted() { @@ -117,6 +125,7 @@ this.placeholderValue = '请扫描' + this.placeholder; }, methods: { + hide() { // #ifdef APP-PLUS // 只是解决软键盘的闪现 @@ -130,6 +139,10 @@ }, 1000); // #endif }, + setItemCode(itemCode) { + this.itemCode = itemCode; + }, + getValue() { return this.scanMsg }, @@ -146,50 +159,79 @@ }, handelScanMsg() { let that = this; - setTimeout(() => { - that.losefocus(); - // let content = uni.$u.trim(that.scanMsg) - let content = that.scanMsg; - if (content == "") { - that.getfocus(); - this.$refs.comMessage.showErrorMessage("扫描内容为空,请重新扫描", res => { - if (res) { - that.scanMsg = "" - that.getfocus(); - } - }) - return; - } + let index = that.scanMsg.indexOf('\n'); + if (index >= 0) { + setTimeout(() => { + that.losefocus(); + // let content = uni.$u.trim(that.scanMsg) + let content = uni.$u.trim(that.scanMsg) + // let content = that.scanMsg; + if (content == "") { + that.getfocus(); + this.$refs.comMessage.showErrorMessage("扫描内容为空,请重新扫描", res => { + if (res) { + that.scanMsg = "" + 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, 10); - let productDate = content.substr(10, 8); - let batch = content.substr(18, 3); - let order = content.substr(21, 8); + 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 = { - itemCode: itemCode, - productDate: productDate, - batch: batch, - order: order, - qty: 1, - content: content, - success: true, - }; - that.clear(); - that.$emit("getResult", scanResult); - } catch (e) { - this.$refs.comMessage.showErrorMessage('解析错误', res => { - if (res) { - that.getfocus(); + let scanResult = { + itemCode: itemCode, + productDate: productDate, + batch: batch, + order: order, + qty: 1, + content: content, + success: true, + }; + that.clear(); + that.$emit("getResult", scanResult); + } catch (error) { + this.$refs.comMessage.showErrorMessage( error.message, res => { + if (res) { + that.getfocus(); + } + }) } + + }).catch(error => { + this.$refs.comMessage.showErrorMessage(error, res => { + if (res) { + that.scanMsg = "" + that.getfocus(); + } + }) }) - } - }, 500); + + }, 500); + } + }, getfocus() { let that = this; diff --git a/src/mycomponents/scan/winScanFgLabel.vue b/src/mycomponents/scan/winScanFgLabel.vue index 99c9720b..2992510a 100644 --- a/src/mycomponents/scan/winScanFgLabel.vue +++ b/src/mycomponents/scan/winScanFgLabel.vue @@ -15,7 +15,7 @@ @@ -52,9 +52,13 @@ }, methods: { - openScanPopup() { + openScanPopup(itemCode) { setTimeout(res => { this.$refs.popup.open('bottom') + setTimeout(re=>{ + this.$refs.comscan.setItemCode(itemCode) + },500) + }, 200) }, diff --git a/src/pages/productReceipt/coms/comProductDetailCard.vue b/src/pages/productReceipt/coms/comProductDetailCard.vue index 1203277c..6f191ad7 100644 --- a/src/pages/productReceipt/coms/comProductDetailCard.vue +++ b/src/pages/productReceipt/coms/comProductDetailCard.vue @@ -6,19 +6,20 @@ - + - - - + + + + diff --git a/src/pages/productReceipt/job/fgProductReceiptDetail.vue b/src/pages/productReceipt/job/fgProductReceiptDetail.vue index 221820dc..53a6c3a3 100644 --- a/src/pages/productReceipt/job/fgProductReceiptDetail.vue +++ b/src/pages/productReceipt/job/fgProductReceiptDetail.vue @@ -111,7 +111,8 @@ managementList: [], jobStatus: "", jobToLocationCode: "", - fgList: [] + fgList: [], + itemCode: "" }; }, onLoad(option) { @@ -213,8 +214,26 @@ if (subItem.fgList == undefined) { subItem.fgList = []; } - subItem.fgList.push(result); - that.calcFgQty(this.detailSource); + + if(subItem.fgList.length==0){ + subItem.fgList.push(result); + that.calcFgQty(this.detailSource); + }else { + var itemIndex = subItem.fgList.findIndex(r => + r.itemCode == result.itemCode && + r.productDate == result.productDate && + r.order == result.order); + if (itemIndex ==-1) { + subItem.fgList.push(result); + that.calcFgQty(this.detailSource); + } else { + this.showQuestionMessage("标签【"+result.content+'】已经扫描,是否移除',confirm=>{ + subItem.fgList.splice(itemIndex,1) + that.calcFgQty(this.detailSource); + }) + } + } + setTimeout(r => { this.scanPopupGetFocus(); }, 500) @@ -243,7 +262,11 @@ }, openScanPopup() { - this.$refs.scanPopup.openScanPopup(); + var itemCode = this.detailSource[0].subList[0].itemCode + + // itemCode = "015553147" + console.log("物料", itemCode) + this.$refs.scanPopup.openScanPopup(itemCode); }, closeScanPopup() { @@ -324,7 +347,7 @@ productReceiptJobsubmit(params).then(res => { uni.hideLoading() if (res.data) { - this.showCommitSuccessMessage("提交成功
生成制品收货记录
" + res.data, ) + this.showCommitSuccessMessage("提交成功
生成装配收货记录
" + res.data, ) } else { this.showErrorMessage("提交失败[" + res.msg + "]") } @@ -402,6 +425,14 @@ navigateBack(1) }) }, + + showQuestionMessage(hint,callback){ + this.$refs.comMessage.showQuestionMessage(hint, res => { + if (res) { + callback() + } + }); + } } } diff --git a/src/pages/productReceipt/job/fgProductReceiptJob.vue b/src/pages/productReceipt/job/fgProductReceiptJob.vue index 8fd0dd95..1c674ad6 100644 --- a/src/pages/productReceipt/job/fgProductReceiptJob.vue +++ b/src/pages/productReceipt/job/fgProductReceiptJob.vue @@ -1,6 +1,6 @@ diff --git a/src/pages/productReceipt/job/productReceiptJob.vue b/src/pages/productReceipt/job/productReceiptJob.vue index 4d5a9982..f42615e5 100644 --- a/src/pages/productReceipt/job/productReceiptJob.vue +++ b/src/pages/productReceipt/job/productReceiptJob.vue @@ -164,7 +164,7 @@ this.totalCount = res.data.total if (this.type == 'predict') { updateTitle("预生产收货任务(" + this.totalCount + ")"); - } else if(this.type == 'fg'){ + } else if(this.type == 'assemble'){ updateTitle("装配收货任务(" + this.totalCount + ")"); }else { updateTitle("报废收货任务(" + this.totalCount + ")"); @@ -184,7 +184,7 @@ } if (this.type == 'predict') { updateTitle("预生产收货任务(" + this.totalCount + ")"); - } else if(this.type == 'fg'){ + } else if(this.type == 'assemble'){ updateTitle("装配收货任务(" + this.totalCount + ")"); }else { updateTitle("报废收货任务(" + this.totalCount + ")"); @@ -200,7 +200,7 @@ uni.navigateTo({ url: './productReceiptDetail?id=' + item.id + '&status=' + item.status }); - } else if(this.type == 'fg'){ + } else if(this.type == 'assemble'){ uni.navigateTo({ url: './fgProductReceiptDetail?id=' + item.id + '&status=' + item.status });