Browse Source

装配任务扫码校验

hella_vue3
lijuncheng 7 months ago
parent
commit
5c9165bc75
  1. 25
      src/api/request2.js
  2. 124
      src/mycomponents/scan/winComScanFg.vue
  3. 8
      src/mycomponents/scan/winScanFgLabel.vue
  4. 13
      src/pages/productReceipt/coms/comProductDetailCard.vue
  5. 41
      src/pages/productReceipt/job/fgProductReceiptDetail.vue
  6. 2
      src/pages/productReceipt/job/fgProductReceiptJob.vue
  7. 6
      src/pages/productReceipt/job/productReceiptJob.vue

25
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,
});
}
/**

124
src/mycomponents/scan/winComScanFg.vue

@ -30,7 +30,7 @@
<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"
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 class="uni-flex u-row space-between u-col-center" @click="showItem(item)">
<view class="text_ellipsis" style="padding: 15rpx;">
@ -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;

8
src/mycomponents/scan/winScanFgLabel.vue

@ -15,7 +15,7 @@
<view class="">
<view class="">
<win-com-scan-fg ref="comscan" :placeholder="title" @getResult="getScanResult"
:headerType="headerType" :isShowHistory="isShowHistory"
:isShowHistory="isShowHistory"
:clearResult="true"></win-com-scan-fg>
</view>
</view>
@ -52,9 +52,13 @@
},
methods: {
openScanPopup() {
openScanPopup(itemCode) {
setTimeout(res => {
this.$refs.popup.open('bottom')
setTimeout(re=>{
this.$refs.comscan.setItemCode(itemCode)
},500)
}, 200)
},

13
src/pages/productReceipt/coms/comProductDetailCard.vue

@ -6,19 +6,20 @@
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"></itemCompareQty>
</template>
<view class="split_line"></view>
<view class="" v-for="(item,index) in dataContent.subList">
<view class="" v-for="(item,index) in dataContent.subList" :key="index">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,item)"
:right-options="item.scaned?scanOptions:detailOptions">
<recommend :detail="item" :isShowFromLocation="false"
:isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommend>
<view v-if="item.fgList!=undefined && item.fgList.length>0" class="card_view"
style="margin-left: 20px;"
v-for="(fg, index) in item.fgList">
<com-fg-card :detail='fg'></com-fg-card>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
<view v-if="item.fgList!=undefined && item.fgList.length>0" class="card_view"
style="margin-left: 20px;"
v-for="(fg, index) in item.fgList" :key="index">
<com-fg-card :detail='fg'></com-fg-card>
</view>
</view>
</uni-collapse-item>
</uni-collapse>

41
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("提交成功<br>生成制品收货记录<br>" + res.data, )
this.showCommitSuccessMessage("提交成功<br>生成装配收货记录<br>" + 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()
}
});
}
}
}
</script>

2
src/pages/productReceipt/job/fgProductReceiptJob.vue

@ -1,6 +1,6 @@
<template>
<view class="">
<product-receipt-job ref="productreceiptjob" type='fg'></product-receipt-job>
<product-receipt-job ref="productreceiptjob" type='assemble'></product-receipt-job>
</view>
</template>

6
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
});

Loading…
Cancel
Save