|
@@ -10,6 +10,8 @@ import RequestParamModel from '../viewmodel/RequestParamModel';
|
|
|
@Entry
|
|
|
@CustomDialog
|
|
|
export struct RfidAllocation{
|
|
|
+ //todo 读写器编号
|
|
|
+ @State ReadingWriting:string='SGHRI3LR48500'
|
|
|
//写入rfid
|
|
|
@State InRfid:string=''
|
|
|
@State workstation: WorkstationInfo = {}
|
|
@@ -53,27 +55,33 @@ export struct RfidAllocation{
|
|
|
//获取rfid
|
|
|
RfidHttp= async() : Promise<RfidClass> => {
|
|
|
//todo SGHRI3LR48500设备编号,从后端数据获取,暂时写死
|
|
|
- let res:RfidClass = await EquipmentRequest.get("/api/y1/device/data/recentlyRecord/SGHRI3LR48500", {})
|
|
|
+ let res:RfidClass = await EquipmentRequest.get("/api/v1/device/data/recentlyRecord/SGHRI3LR48500", {})
|
|
|
this.httpRfid=res
|
|
|
+ this.RfidOnlineStatus=1
|
|
|
console.log('textTag', 'rfid请求结果' +JSON.stringify(res)
|
|
|
);
|
|
|
return res
|
|
|
}
|
|
|
//写入rfid
|
|
|
- InRfidHttp= async() : Promise<RfidClass> => {
|
|
|
+ InRfidHttp= async() : Promise<InRfidClass> => {
|
|
|
//todo SGHRI3LR48500设备编号,从后端数据获取,暂时写死
|
|
|
- let res:RfidClass = await EquipmentRequest.get("/api/y1/device/data/recentlyRecord/SGHRI3LR48500", {})
|
|
|
- this.httpRfid=res
|
|
|
- console.log('textTag', 'rfid请求结果' +JSON.stringify(res)
|
|
|
+ let res:InRfidClass = await EquipmentRequest.post("/api/v1/device/setup", {
|
|
|
+ deviceNo:this.ReadingWriting,
|
|
|
+ data:{
|
|
|
+ rfid0:this.InRfid
|
|
|
+ }
|
|
|
+ }as RequestParamModel)
|
|
|
+ console.log('textTag', 'rfid写入结果' +JSON.stringify(res)
|
|
|
);
|
|
|
return res
|
|
|
}
|
|
|
aboutToAppear(): void {
|
|
|
setInterval(async () => {
|
|
|
this.RfidHttp().then((res:RfidClass)=> {
|
|
|
+
|
|
|
console.log('textTag', '-------rfid获取信息' + JSON.stringify(res))
|
|
|
})
|
|
|
- }, 1000);
|
|
|
+ }, 5000);
|
|
|
|
|
|
|
|
|
|
|
@@ -365,7 +373,7 @@ aboutToAppear(): void {
|
|
|
.textAlign(TextAlign.End)
|
|
|
.width('40%')
|
|
|
.height('100%')
|
|
|
- if (this.RfidOnlineStatus===0){
|
|
|
+ if (this.RfidOnlineStatus===1){
|
|
|
Text().width(px2vp(12))
|
|
|
.height(px2vp(12))
|
|
|
.borderRadius(px2vp(50))
|
|
@@ -377,7 +385,7 @@ aboutToAppear(): void {
|
|
|
.textAlign(TextAlign.Start)
|
|
|
.width('35%')
|
|
|
.height('100%')
|
|
|
- }else if (this.RfidOnlineStatus===1){
|
|
|
+ }else if (this.RfidOnlineStatus===0){
|
|
|
|
|
|
Text().width('5%')
|
|
|
.height('30%')
|
|
@@ -403,7 +411,7 @@ aboutToAppear(): void {
|
|
|
.textAlign(TextAlign.End)
|
|
|
.width('40%')
|
|
|
.height('100%')
|
|
|
- Text('6537289495783').width('40%')
|
|
|
+ Text(this.httpRfid.data?.RFID!).width('40%')
|
|
|
.height('30%')
|
|
|
.borderRadius(px2vp(50))
|
|
|
.fontColor($r('app.color.blue_100'))
|
|
@@ -440,6 +448,11 @@ aboutToAppear(): void {
|
|
|
.width(px2vp(292))
|
|
|
.height(px2vp(80))
|
|
|
.margin({bottom:$r('app.float.topMargins_20')})
|
|
|
+ .onClick(()=>{
|
|
|
+ this.InRfidHttp().then((res:InRfidClass)=> {
|
|
|
+ console.log('textTag', '-------rfid写入信息' + JSON.stringify(res))
|
|
|
+ })
|
|
|
+ })
|
|
|
|
|
|
}.width('100%')
|
|
|
.height('49%')
|
|
@@ -480,4 +493,11 @@ export interface datalass{
|
|
|
RFID?:string
|
|
|
UID?:string
|
|
|
errCode?:string
|
|
|
-}
|
|
|
+}
|
|
|
+export interface InRfidClass{
|
|
|
+ deviceNo?:string
|
|
|
+ data?:InDataClass
|
|
|
+}
|
|
|
+export interface InDataClass{
|
|
|
+ rfid0?:string
|
|
|
+}
|