rfid扫描管理-lSun
This commit is contained in:
parent
232331df54
commit
9952d688d4
|
|
@ -2,8 +2,8 @@
|
|||
<view class="hole-page">
|
||||
<view class="upper-bgd">
|
||||
<h4 style="font-size: 16px; font-weight: normal;">RFID标签绑定</h4>
|
||||
<uni-data-select v-model="powerVal" :localdata="powerRange" placeholder="请选择功率" @change="powerChange"
|
||||
:clear="false"></uni-data-select>
|
||||
<!-- <uni-data-select v-model="powerVal" :localdata="powerRange" placeholder="请选择功率" @change="powerChange"
|
||||
:clear="false"></uni-data-select> -->
|
||||
</view>
|
||||
<view class="lower-rfid" v-show="showStats">
|
||||
<view class="stat-cont">
|
||||
|
|
@ -96,7 +96,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
const rfidMod = uni.requireNativePlugin('BNS-RfidRed')
|
||||
// const rfidMod = uni.requireNativePlugin('BNS-RfidRed')
|
||||
var rfidModule = uni.requireNativePlugin("DeviceModule_RFID");
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -152,21 +153,27 @@
|
|||
let that = this
|
||||
that.showPrompt = true;
|
||||
that.promptMessage = '识别中,请稍候...';
|
||||
|
||||
// 延迟关闭提示,显示Toast
|
||||
setTimeout(() => {
|
||||
let goVeri = rfidMod.redTag()
|
||||
console.log(goVeri);
|
||||
if (goVeri.code == 1001) {
|
||||
let jsonData = {
|
||||
"bank": 1,
|
||||
"ptr": 2,
|
||||
"cnt": 6,
|
||||
"accessPwd": "00000000"
|
||||
}
|
||||
let goVeri = rfidModule.readData(jsonData)
|
||||
// let goVeri = rfidMod.redTag()
|
||||
// console.log(goVeri);
|
||||
if (goVeri.code == 0) {
|
||||
that.showPrompt = false; // 关闭提示
|
||||
that.rfidCode = goVeri.res
|
||||
that.rfidCode = goVeri.data
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '识别成功',
|
||||
success: () => {
|
||||
// 调用编码获取设备信息
|
||||
that.$api.fetchMaterialOutStore.searchRfid({
|
||||
rfidCode: goVeri.res
|
||||
rfidCode: goVeri.data
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
console.log(res.data.data[0]);
|
||||
|
|
@ -250,15 +257,15 @@
|
|||
that.maId = ''
|
||||
that.showStats = false
|
||||
},
|
||||
powerChange(e) {
|
||||
console.log(e);
|
||||
const ctrlPower = rfidMod.setPower(e)
|
||||
console.log(ctrlPower);
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: ctrlPower.res
|
||||
})
|
||||
},
|
||||
// powerChange(e) {
|
||||
// console.log(e);
|
||||
// const ctrlPower = rfidMod.setPower(e)
|
||||
// console.log(ctrlPower);
|
||||
// uni.showToast({
|
||||
// icon: 'none',
|
||||
// title: ctrlPower.res
|
||||
// })
|
||||
// },
|
||||
// 根据设备类型获取规格类型
|
||||
typeChange(e) {
|
||||
let that = this
|
||||
|
|
@ -302,7 +309,7 @@
|
|||
let that = this
|
||||
|
||||
this.showPrompt = true;
|
||||
this.promptMessage = '识别中,请稍候...';
|
||||
this.promptMessage = '正在绑定,请稍候...';
|
||||
// 延迟关闭提示,显示Toast
|
||||
setTimeout(() => {
|
||||
that.$refs.qrForm.validate().then(formData => {
|
||||
|
|
@ -336,15 +343,35 @@
|
|||
this.showPrompt = false; // 关闭提示
|
||||
console.log(err);
|
||||
})
|
||||
})
|
||||
}).catch(validationError => {
|
||||
// 验证失败的情况
|
||||
this.showPrompt = false;
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '表单验证失败,请检查输入'
|
||||
});
|
||||
console.error('Validation error:', validationError);
|
||||
});
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
// 使用模块前必须先初始化RDIF模块
|
||||
let res = rfidModule.init();
|
||||
console.log(res)
|
||||
// log(JSON.stringify(res));
|
||||
if (res.code == 0) {
|
||||
// this.isLoading = false;
|
||||
} else if (res.code == -1) {
|
||||
uni.showToast({
|
||||
title: 'RFID模块加载失败'
|
||||
})
|
||||
}
|
||||
// 初始化rfid识别
|
||||
const obj = rfidMod.initUHF()
|
||||
console.log(obj);
|
||||
// const obj = rfidMod.initUHF()
|
||||
// console.log(obj);
|
||||
// 筛入频率
|
||||
for (let i = 5; i <= 30; i++) {
|
||||
this.powerRange.push({
|
||||
|
|
@ -370,7 +397,30 @@
|
|||
}).catch(err => {
|
||||
console.log(err);
|
||||
})
|
||||
}
|
||||
},
|
||||
// mounted() {
|
||||
// setTimeout(() => {
|
||||
// // 使用模块前必须先初始化RDIF模块
|
||||
// let res = rfidModule.init();
|
||||
// // log(JSON.stringify(res));
|
||||
// if (res.code == 0) {
|
||||
// this.isLoading = false;
|
||||
// } else if (res.code == -1) {
|
||||
// uni.showToast({
|
||||
// title: 'RFID模块加载失败'
|
||||
// })
|
||||
// }
|
||||
// }, 400);
|
||||
|
||||
// },
|
||||
// beforeDestroy() {
|
||||
// // 移除按键事件
|
||||
// plus.key.removeEventListener('keydown', this.keyListener)
|
||||
// // 使用完毕必须释放RDIF模块
|
||||
// let res = rfidModule.free();
|
||||
// console.log("使用完毕必须释放RDIF模块",res)
|
||||
// // log("free: " + JSON.stringify(res))
|
||||
// },
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
const rfidMod = uni.requireNativePlugin('BNS-RfidRed')
|
||||
// const rfidMod = uni.requireNativePlugin('BNS-RfidRed');
|
||||
var rfidModule = uni.requireNativePlugin("DeviceModule_RFID");
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -268,11 +269,21 @@
|
|||
that.promptMessage = '识别中,请稍候...';
|
||||
// 延迟关闭提示,显示Toast
|
||||
setTimeout(() => {
|
||||
let b = rfidMod.initUHF()
|
||||
// let b = rfidMod.initUHF()
|
||||
let b = rfidModule.init();
|
||||
console.log(b);
|
||||
let goVeri = rfidMod.redTag()
|
||||
// let goVeri = rfidMod.redTag()
|
||||
|
||||
let jsonData = {
|
||||
"bank": 1,
|
||||
"ptr": 2,
|
||||
"cnt": 6,
|
||||
"accessPwd": "00000000"
|
||||
}
|
||||
let goVeri = rfidModule.readData(jsonData)
|
||||
|
||||
console.log(goVeri);
|
||||
if (goVeri.code == 1001) {
|
||||
if (goVeri.code == 0) {
|
||||
that.showLoading = true
|
||||
that.showPrompt = false; // 关闭提示
|
||||
uni.showToast({
|
||||
|
|
@ -281,7 +292,7 @@
|
|||
success: () => {
|
||||
// 调用编码获取设备信息
|
||||
that.$api.fetchMaterialOutStore.searchRfid({
|
||||
rfidCode: goVeri.res
|
||||
rfidCode: goVeri.data
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.data.code == 200) {
|
||||
|
|
@ -317,17 +328,19 @@
|
|||
}, 1000)
|
||||
},
|
||||
stopVeri() {
|
||||
let endVeri = rfidMod.closeRfid()
|
||||
// let endVeri = rfidMod.closeRfid()
|
||||
let endVeri = rfidModule.free();
|
||||
|
||||
console.log(endVeri);
|
||||
if (endVeri.code == 1001) {
|
||||
if (endVeri.code == 0) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: endVeri.res
|
||||
title: "停止成功"
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: endVeri.res
|
||||
title: "停止失败"
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
@ -344,8 +357,20 @@
|
|||
this.parentId = params.parentId
|
||||
this.taskId = params.taskId
|
||||
// 初始化rfid识别
|
||||
const obj = rfidMod.initUHF()
|
||||
console.log(obj);
|
||||
// const obj = rfidMod.initUHF()
|
||||
// console.log(obj);
|
||||
|
||||
// 使用模块前必须先初始化RDIF模块
|
||||
let res = rfidModule.init();
|
||||
console.log(res)
|
||||
// log(JSON.stringify(res));
|
||||
if (res.code == 0) {
|
||||
|
||||
} else if (res.code == -1) {
|
||||
uni.showToast({
|
||||
title: 'RFID模块加载失败'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
const rfidMod = uni.requireNativePlugin('BNS-RfidRed')
|
||||
// const rfidMod = uni.requireNativePlugin('BNS-RfidRed')
|
||||
var rfidModule = uni.requireNativePlugin("DeviceModule_RFID");
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -246,11 +247,19 @@
|
|||
that.promptMessage = '识别中,请稍候...';
|
||||
// 延迟关闭提示,显示Toast
|
||||
setTimeout(() => {
|
||||
let b = rfidMod.initUHF()
|
||||
// let b = rfidMod.initUHF()
|
||||
let b = rfidModule.init();
|
||||
console.log(b);
|
||||
let goVeri = rfidMod.redTag()
|
||||
// let goVeri = rfidMod.redTag()
|
||||
let jsonData = {
|
||||
"bank": 1,
|
||||
"ptr": 2,
|
||||
"cnt": 6,
|
||||
"accessPwd": "00000000"
|
||||
}
|
||||
let goVeri = rfidModule.readData(jsonData)
|
||||
console.log(goVeri);
|
||||
if (goVeri.code == 1001) {
|
||||
if (goVeri.code == 0) {
|
||||
that.showLoading = true
|
||||
that.showPrompt = false; // 关闭提示
|
||||
uni.showToast({
|
||||
|
|
@ -259,7 +268,7 @@
|
|||
success: () => {
|
||||
// 调用编码获取设备信息
|
||||
that.$api.backMaterialReceive.searchRfid({
|
||||
rfidCode: goVeri.res
|
||||
rfidCode: goVeri.data
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.data.code == 200) {
|
||||
|
|
@ -294,17 +303,18 @@
|
|||
}, 1000)
|
||||
},
|
||||
stopVeri() {
|
||||
let endVeri = rfidMod.closeRfid()
|
||||
// let endVeri = rfidMod.closeRfid()
|
||||
let endVeri = rfidModule.free();
|
||||
console.log(endVeri);
|
||||
if (endVeri.code == 1001) {
|
||||
if (endVeri.code == 0) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: endVeri.res
|
||||
title: "停止成功"
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: endVeri.res
|
||||
title: "停止失败"
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
@ -321,8 +331,9 @@
|
|||
this.parentId = params.parentId
|
||||
this.taskId = params.taskId
|
||||
// 初始化rfid识别
|
||||
const obj = rfidMod.initUHF()
|
||||
console.log(obj);
|
||||
// const obj = rfidMod.initUHF()
|
||||
let res = rfidModule.init();
|
||||
console.log(res);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue