subject-two/entry/src/main/ets/common/service/terminalService.ts

40 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-01-05 11:11:15 +08:00
// @ts-nocheck
import { obtainCarExamInfo} from '../../api/index'
import { dateFormat} from '../utils/tools'
//获取设备信息
export async function getDeviceInfo() {
2024-01-31 14:42:14 +08:00
// globalThis.deviceNo = 'J43405J003101'; //设备mac
2024-02-21 17:00:55 +08:00
// globalThis.deviceNo = 'FE-FC-FE-7C-5C-77'; //设备mac
// globalThis.diskId = '1231231231'; //硬盘号
// globalThis.hasAuth = true;
//
// return null
return new Promise((resolve, reject) => {
getSyncData('DeviceInfoTable').then((result: Array<any>) => {
if (result.length) {
globalThis.deviceNo = result[0].deviceId
this.deviceId = result[0].deviceId
resolve(result[0].deviceId)
} else {
resolve('')
}
})
})
2024-01-05 11:11:15 +08:00
}
//获取考车信息
export async function getCarInfo() {
let date = new Date();
let params = { time: dateFormat(date), deviceNo: globalThis.deviceNo };
let res:any = await obtainCarExamInfo(params)
if(!res.obtainCarExamInfoRsp.body){
this.errorMsg=decodeURI(res.examinerLoginRsp.head.resultMessage)
}else {
globalThis.carInfo=res.obtainCarExamInfoRsp.body
// globalThis.carInfo.carId=res.obtainCarExamInfoRsp.body.carId
globalThis.carInfo.plateNo = decodeURIComponent(globalThis.carInfo.plateNo)
}
return res
}