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