Browse Source

装配任务扫码校验

hella_vue3
lijuncheng 8 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> <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;

8
src/mycomponents/scan/winScanFgLabel.vue

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

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

@ -6,19 +6,20 @@
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"></itemCompareQty> <itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"></itemCompareQty>
</template> </template>
<view class="split_line"></view> <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 ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,item)" <uni-swipe-action-item @click="swipeClick($event,item)"
:right-options="item.scaned?scanOptions:detailOptions"> :right-options="item.scaned?scanOptions:detailOptions">
<recommend :detail="item" :isShowFromLocation="false" <recommend :detail="item" :isShowFromLocation="false"
:isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommend> :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-item>
</uni-swipe-action> </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> </view>
</uni-collapse-item> </uni-collapse-item>
</uni-collapse> </uni-collapse>

41
src/pages/productReceipt/job/fgProductReceiptDetail.vue

@ -111,7 +111,8 @@
managementList: [], managementList: [],
jobStatus: "", jobStatus: "",
jobToLocationCode: "", jobToLocationCode: "",
fgList: [] fgList: [],
itemCode: ""
}; };
}, },
onLoad(option) { onLoad(option) {
@ -213,8 +214,26 @@
if (subItem.fgList == undefined) { if (subItem.fgList == undefined) {
subItem.fgList = []; 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 => { setTimeout(r => {
this.scanPopupGetFocus(); this.scanPopupGetFocus();
}, 500) }, 500)
@ -243,7 +262,11 @@
}, },
openScanPopup() { openScanPopup() {
this.$refs.scanPopup.openScanPopup(); var itemCode = this.detailSource[0].subList[0].itemCode
// itemCode = "015553147"
console.log("物料", itemCode)
this.$refs.scanPopup.openScanPopup(itemCode);
}, },
closeScanPopup() { closeScanPopup() {
@ -324,7 +347,7 @@
productReceiptJobsubmit(params).then(res => { productReceiptJobsubmit(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data) { if (res.data) {
this.showCommitSuccessMessage("提交成功<br>生成制品收货记录<br>" + res.data, ) this.showCommitSuccessMessage("提交成功<br>生成装配收货记录<br>" + res.data, )
} else { } else {
this.showErrorMessage("提交失败[" + res.msg + "]") this.showErrorMessage("提交失败[" + res.msg + "]")
} }
@ -402,6 +425,14 @@
navigateBack(1) navigateBack(1)
}) })
}, },
showQuestionMessage(hint,callback){
this.$refs.comMessage.showQuestionMessage(hint, res => {
if (res) {
callback()
}
});
}
} }
} }
</script> </script>

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

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

6
src/pages/productReceipt/job/productReceiptJob.vue

@ -164,7 +164,7 @@
this.totalCount = res.data.total this.totalCount = res.data.total
if (this.type == 'predict') { if (this.type == 'predict') {
updateTitle("预生产收货任务(" + this.totalCount + ")"); updateTitle("预生产收货任务(" + this.totalCount + ")");
} else if(this.type == 'fg'){ } else if(this.type == 'assemble'){
updateTitle("装配收货任务(" + this.totalCount + ")"); updateTitle("装配收货任务(" + this.totalCount + ")");
}else { }else {
updateTitle("报废收货任务(" + this.totalCount + ")"); updateTitle("报废收货任务(" + this.totalCount + ")");
@ -184,7 +184,7 @@
} }
if (this.type == 'predict') { if (this.type == 'predict') {
updateTitle("预生产收货任务(" + this.totalCount + ")"); updateTitle("预生产收货任务(" + this.totalCount + ")");
} else if(this.type == 'fg'){ } else if(this.type == 'assemble'){
updateTitle("装配收货任务(" + this.totalCount + ")"); updateTitle("装配收货任务(" + this.totalCount + ")");
}else { }else {
updateTitle("报废收货任务(" + this.totalCount + ")"); updateTitle("报废收货任务(" + this.totalCount + ")");
@ -200,7 +200,7 @@
uni.navigateTo({ uni.navigateTo({
url: './productReceiptDetail?id=' + item.id + '&status=' + item.status url: './productReceiptDetail?id=' + item.id + '&status=' + item.status
}); });
} else if(this.type == 'fg'){ } else if(this.type == 'assemble'){
uni.navigateTo({ uni.navigateTo({
url: './fgProductReceiptDetail?id=' + item.id + '&status=' + item.status url: './fgProductReceiptDetail?id=' + item.id + '&status=' + item.status
}); });

Loading…
Cancel
Save