You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

177 lines
4.1 KiB

<template>
<view>
<uni-popup ref="popup" @change="change" @maskClick="closeScanPopup()">
<view class="popup_box">
<view class="pop_title">
扫描位置码
<text class="fr" @click="closeScanPopup()">关闭</text>
</view>
<view class="pop_tab">
<view class="tab_info">
<win-com-scan ref="comscan" @getScanResult="getScanResult" placeholder="位置码"
:clearResult="true"></win-com-scan>
<view class="uni-flex">
<button class="clean_scan_btn" @click="cancelClick()">清空</button>
<button class="scan_btn" @click="scanClick()">扫描</button>
</view>
</view>
</view>
</view>
</uni-popup>
<com-message ref="comMessage" @afterClose="getfocus"></com-message>
</view>
</template>
<script>
import winComScan from '@/mycomponents/wincom/winComScan.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
import {
getPositionCodeInfo
} from '@/api/index.js';
export default {
name: 'winScanByPack',
components: {
winComScan,
comMessage
},
props: {
title: {
type: String,
default: ''
},
},
data() {
return {
scanResult: {},
show: false,
}
},
created() {
},
methods: {
openScanPopup(content) {
this.$refs.popup.open('bottom');
},
closeScanPopup(content) {
this.$refs.popup.close();
this.$emit("close", '');
},
scanClick() {
this.$refs.comscan.handelScanMsg();
},
cancelClick() {
this.$refs.comscan.clearScanValue();
},
getScanResult(result) {
console.log("扫描",result.data.code)
if (result != null) {
// if(result.data.code[0].toUpperCase()!="W"){
// this.showMessage("标签格式不正确")
// return;
// }
uni.showLoading({
title: '扫描中...',
mask: true
})
// var data =
// {
// code: "W19",
// partCode: "TMDLYA0AFM6A",
// partName: "P000000000000015",
// partDesc: "MY前保总成件售后件(冲孔)",
// basicUom: "PC",
// locationCode: "W",
// locationName: "原物料库位",
// stdPackQty: 100,
// remark: null,
// tenantId: null,
// extraProperties: {},
// concurrencyStamp: "b3f2cf7ba3e14166bb97dac768d91741",
// lastModificationTime: null,
// lastModifierId: null,
// creationTime: "2024-02-28T14:47:08.6878607",
// creatorId: null,
// qty:0,
// id: "4c40f72b-a86d-54be-aed2-3a1100a46436"
// }
getPositionCodeInfo(result.data.code).then(res=>{
uni.hideLoading()
if(res){
this.scanResult = res;
this.scanResult.qty =1;
this.callBack()
this.closeScanPopup()
}else {
this.showMessage("未查找到位置码【"+result.data.code+"】")
}
}).catch(error=>{
uni.hideLoading()
this.showMessage(error.message)
})
}
},
getLabelResult(label) {
let labelResult = {
sucess: true,
message: "",
data: label,
// data: {
// isPack: true,
// // scanType: null,
// itemCode: label.itemCode,
// itemName: label.itemName,
// itemDesc1: label.itemDesc1,
// itemDesc2: label.itemDesc2,
// lot: label.lot,
// qty: label.qty,
// uom: label.uom,
// poNumber: label.poNumber,
// // asn: null,
// packingCode: label.code,
// supplierBatch: label.supplierBatch,
// // order: null,
// // poLine: null,
// code: label.code,
// }
};
labelResult.data.isPack = true;
labelResult.data.packingCode = label.code;
return labelResult;
},
callBack() {
this.$refs.comscan.clear();
this.$emit("getScanResult", this.scanResult);
},
getfocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.getfocus();
}
},
losefocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.losefocus();
}
},
showMessage(message) {
this.$refs.comMessage.showMessage(message);
},
change(e) {
this.show = e.show
}
}
}
</script>
<style>
</style>