fix: 修改部分文件

This commit is contained in:
wangzhongjie 2025-02-18 10:47:28 +08:00
parent 24c1a22168
commit f041e2a8bb
11 changed files with 75 additions and 110 deletions

View File

@ -11,7 +11,7 @@ import {
getMySystemSetTable,
upDataZhongxinginitialization,
upDateTable
} from '../../common/service/initable'
} from './initable'
import { GlobalConfig } from '../../config/index'
import testNapi from '@ohos.hiserialsdk'
import fs from '@ohos.file.fs';
@ -26,14 +26,14 @@ async function getliushuiNum(data) {
for (let i = 0; str.length <= 5; i++) {
str = '0' + str
}
AppStorage.setOrCreate('lshNo',str)
AppStorage.setOrCreate('lshNo', str)
} else {
num = 0
let str = num.toString()
for (let i = 0; str.length <= 5; i++) {
str = '0' + str
}
AppStorage.setOrCreate('lshNo',str)
AppStorage.setOrCreate('lshNo', str)
}
}
@ -220,7 +220,7 @@ export async function takePhotoFn(context) {
spzd1: false,
zdyz: '5',
}
const spzd = {
const spzd = {
spzd1: false,
spzd2: false,
spzd3: false,
@ -264,7 +264,7 @@ export async function takePhotoFn(context) {
map[key1] = false
spzd[key1] = false
}
AppStorage.setOrCreate('spzd',spzd)
AppStorage.setOrCreate('spzd', spzd)
setTimeout(() => {
takePhotoFn()
@ -280,12 +280,13 @@ export async function takePhotoFn(context) {
let fd
const devPath = "/dev/ttyS3"
let chuankoufd
function openChuankouFn(callback) {
console.log('SerialOpen in indexservice, path=' + devPath)
//TODO 自动挡车不读取串口
testNapi.SerialOpenAsync(devPath, (fd) => {
chuankoufd=fd
chuankoufd = fd
// AppStorage.setOrCreate('fd',fd)
// AppStorage.setOrCreate('num',0)
let parity = 0x4e; // 'N'
@ -305,7 +306,7 @@ function getChuankouFnMsg() {
if (message == '') {
// clearInterval(chuankou)
testNapi.SerialClose(chuankoufd);
chuankoufd= null
chuankoufd = null
setTimeout(() => {
getChuankouFn()
}, 2000)
@ -319,7 +320,7 @@ function getChuankouFnMsg() {
} else if (msg.length < 12) {
} else {
AppStorage.setOrCreate('chuankoMsg',msg[9])
AppStorage.setOrCreate('chuankoMsg', msg[9])
}
setTimeout(() => {

View File

@ -30,7 +30,6 @@ import FileUtil from '../../common/utils/File';
import { GlobalConfig } from '../../config/index';
import prompt from '@ohos.promptAction';
import DB, { ColumnType } from '../database/DbSql';
import App from '@system.app';
//读表
//参数平台
@ -123,57 +122,6 @@ export function sqlInsertCommonFn(tableName, resultArr, delFlag = true) {
reject(err)
})
})
// const accountTable = new AccountTable(() => {
// accountTable.query('0', async (result) => {
// console.log('表长度', result.length, tableName)
// if (result.length == 0 || !delFlag) {
// console.log('sqlsqlinsert', resultArr.length)
// if (resultArr.length == 0) {
// resolve(true)
// return
// }
// let INSERT_SQL = "INSERT INTO " + tableName
// + " (" + map[tableName].ACCOUNT_TABLE.columns.toString() + ") VALUES "
//
// resultArr.map((data, i) => {
// data.id = !delFlag ? `${i + result.length}` : `${i}`
// let str = '('
// map[tableName].ACCOUNT_TABLE.columns.map((res, index) => {
// if (map[tableName].ACCOUNT_TABLE.columns.length - 1 == index) {
// str += data[res] ? `'${data[res]}'` : 'NULL'
// } else {
// str += (data[res] ? `'${data[res]}'` : 'NULL') + ','
// }
// })
// if (i == resultArr.length - 1) {
// str += ')'
// } else {
// str += '),'
// }
// INSERT_SQL += str
// })
// console.log('sqlsINSERT_SQLINSERT_SQL', INSERT_SQL)
// accountTable.sqlOperate(INSERT_SQL, tableName, (val) => {
// console.log('teststet3', val, tableName)
//
// console.log('sqlsqlinsert,', val, 'tableName', tableName)
// resolve(val)
// })
// }
// else {
// if (delFlag) {
// console.log("sql message 删除表")
// await delSyncTable(tableName, context)
// const result = await sqlInsertCommonFn(tableName, resultArr, context)
// resolve(result)
// return
// }
// const result = await sqlInsertCommonFn(tableName, resultArr, context)
// resolve(result)
// }
// }, true);
// }, map[tableName], context);
})
}
@ -346,7 +294,7 @@ export async function delSyncTable(tableName, context?) {
//获取车模、场地模型
export async function getEsCarModel(context) {
const date = new Date()
const timeInfo=AppStorage.get('timeInfo')
const timeInfo = AppStorage.get('timeInfo')
if (!timeInfo?.paraKdid) {
prompt.showToast({
message: 'paraKdid获取失败',

View File

@ -14,6 +14,10 @@ export interface CarConfigurationParamsType {
type: string;
}
export interface CarConfigurationParams {
body: Record<string, string>;
}
export interface CarInfoType {
carId?: string;
examinationRoomId?: string;

View File

@ -0,0 +1,9 @@
export interface MASYSTEMPARMType {
id: string;
no1: number;
no2: number;
no3: number;
txt1: string;
txt2: string;
txt3: string;
}

View File

@ -15,3 +15,5 @@ export * from "./UserInfo"
export * from "./CarCheck"
export * from "./api"
export * from "./TableColumn"

View File

@ -5,7 +5,7 @@ import TopLogo from './compontents/TopLogo';
import testNapi from '@ohos.hiserialsdk';
import { dateFormat } from '../common/utils/tools';
import { DwMapData, PassData, RealNumData, StackValueData, WarnFlagData, WarnFlagTipData } from '../mock';
import { baseInfo } from '../model/Common';
import { BaseInfoType } from '../model/Common';
import { CarCheckDataType, CarConfigurationParams, CarInfoType } from '../model/CarCheck';
import { BusinessError } from '@ohos.base';
@ -136,7 +136,7 @@ struct Index {
this.checkListCopy = JSON.parse(JSON.stringify(this.checkList))
return
}
const baseInfo = AppStorage.get('baseInfo') as baseInfo
const baseInfo = AppStorage.get('baseInfo') as BaseInfoType
//模拟真实数据
const param: CarConfigurationParams = {
body: {
@ -262,16 +262,16 @@ struct Index {
this.zjFlag = true
let flag = false
for (let item in this.warnFlag) {
if (this.warnFlag[item] == '1') {
flag = true
}
}
// Object.keys(this.warnFlag).map((key) => {
// if (this.warnFlag[key] == '0') {
// for (let item in this.warnFlag) {
// if (this.warnFlag[item] == '1') {
// flag = true
// }
// })
// }
Object.keys(this.warnFlag).forEach((item) => {
if (this.warnFlag[item] === '1') {
flag = true;
}
});
this.vocObj.playAudio({
type: 1,
name: flag ? 'zjwtg.wav' : 'zjtg.wav'

View File

@ -3,7 +3,6 @@ import TopLogo from './compontents/TopLogo';
import Md5 from '../common/utils/md5';
import promptAction from '@ohos.promptAction';
import errorMsgDialog from './compontents/errorMsgDialog';
// import { voiceService } from '../common/service/voiceService';
import imageBtn from './compontents/imageBtn';
import { UserLoginType } from '../model/ExaminerLogin';
import { BusinessError } from '@ohos.base';

View File

@ -18,7 +18,7 @@ import UdpEvent from '../common/utils/UdpEvent';
import { delPic } from '../service/videoService';
import imageBtn from './compontents/imageBtn';
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
import { baseInfo } from '../model/Common';
import { BaseInfoType } from '../model/Common';
import { CarCheckDataType } from '../model/CarCheck';
// import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
@ -32,7 +32,7 @@ struct Index {
@State hasAuth: boolean = false;
@State dialogVisiable: boolean = false;
@State singlePlay: boolean = false;
@State baseInfo: baseInfo = {};
@State baseInfo: BaseInfoType = {};
@State deviceId: string = '';
@State angle: number = 0
@State dialogRatio: number = 0.8

View File

@ -1,6 +1,7 @@
import TopLogo from './compontents/TopLogo';
import { getSyncData } from '../common/service/initable';
import router from '@ohos.router';
import { MASYSTEMPARMType } from '../model';
const cBg = $rawfile('judge/km3/road/luxian_pre.png');
const lBg = $rawfile('judge/km3/road/luxian_nor.png');
@ -12,16 +13,16 @@ const ltBg = $rawfile('judge/km3/road/luxian_nor.png');
@Component
struct Index {
@State @Watch('outClick') outFlag: boolean = false;
@State roadObj: any = {}
@State roadObj: ESObject = {}
async aboutToAppear() {
//读取systemparam表的no1等于4的
const systemParms: any = await getSyncData('MA_SYSTEMPARM')
systemParms.forEach((systemParm) => {
const systemParms: Array<MASYSTEMPARMType> = await getSyncData('MA_SYSTEMPARM') as MASYSTEMPARMType[];
systemParms.forEach((systemParm: MASYSTEMPARMType) => {
//TODO 字段名称待修改
const { no1, no2, no3, txt1, txt2 } = systemParm;
if (no1 == 4) {
this.roadObj[no2] = no2
// const { no1, no2, no3, txt1, txt2 } = systemParm;
if (systemParm.no1 == 4) {
this.roadObj[systemParm.no2] = systemParm.no2
}
})
}

View File

@ -22,6 +22,7 @@ import imageBtn from './compontents/imageBtn';
import FileUtil from '../common/utils/File';
import DB, { ColumnType } from '../common/database/DbSql';
import { LabelBlockType, QKParamType, SckType, SystemParamType, User } from '../model';
import { BusinessError } from '@ohos.base';
@Entry
@Component
@ -96,18 +97,18 @@ struct UserInfo {
try {
await this.checkSignal()
this.faceCompareSucess = 0
AppStorage.setOrCreate('statue',2)
AppStorage.setOrCreate('statue', 2)
if (!this.currentUser.xm) {
return
}
this.ksksLimit = true
if (this.singlePlay) {
const { examSubject } = this.carInfo;
// const { examSubject } = this.carInfo;
this.currentUser.id = '0'
await upDateTableByArray('USER', [this.currentUser])
router.pushUrl({
url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge',
url: this.carInfo.examSubject == 3 ? 'pages/Roads' : 'pages/Judge',
params: {
sczb: Number(this.isBoardPrePareSetPopupOpen),
kfdm: this.sczbkf,
@ -184,8 +185,8 @@ struct UserInfo {
this.currentUser = EmptyCandidateObject
this.filePhoto = new FilePhoto(this.context);
this.singlePlay = AppStorage.get('singlePlay')
this.examinerLoginInfo=AppStorage.get('examinerLoginInfo')
this.carInfo=AppStorage.get('carInfo')
this.examinerLoginInfo = AppStorage.get('examinerLoginInfo')
this.carInfo = AppStorage.get('carInfo')
//语音功能on
// new WebRTCVoice(this.context);
//初始化数据
@ -229,7 +230,7 @@ struct UserInfo {
setTimeout(() => {
this.currentUser = this.dataList[0]
this.currentUser.ksy2 = this.examinerLoginInfo.kgxm
AppStorage.setOrCreate('lsh',this.currentUser.lsh)
AppStorage.setOrCreate('lsh', this.currentUser.lsh)
}, 200)
} else {
this.currentUser = EmptyCandidateObject
@ -273,7 +274,7 @@ struct UserInfo {
//身份证读卡器初始化
openDeviceByIDCard() {
AppStorage.setOrCreate('indexComponent',this)
AppStorage.setOrCreate('indexComponent', this)
// 应用启动时打开读卡设备
let ret = testNapi.OpenDevice();
if (ret == 0) {
@ -305,8 +306,8 @@ struct UserInfo {
}, 200)
this.examinerLoginInfo.ksyh = res.ksy1sfzmhm
AppStorage.setOrCreate('examinerLoginInfo',this.examinerLoginInfo)
AppStorage.setOrCreate('lsh',res.lsh)
AppStorage.setOrCreate('examinerLoginInfo', this.examinerLoginInfo)
AppStorage.setOrCreate('lsh', res.lsh)
const { examSubject } = this.carInfo;
// this.currentUser.kszp=this.photo+res.kszp
// this.currentUser.ksmjzp=this.photo+this.currentUser.ksmjzp
@ -329,12 +330,12 @@ struct UserInfo {
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
if (!flag) {
AppStorage.setOrCreate('lsh','0000000000000')
AppStorage.setOrCreate('lsh', '0000000000000')
await upDateTableByArray('USER', [])
setTimeout(() => {
this.currentUser = this.list[0]
this.currentUser.ksy2 = this.examinerLoginInfo.kgxm
AppStorage.setOrCreate('lsh',this.currentUser.lsh)
AppStorage.setOrCreate('lsh', this.currentUser.lsh)
}, 200)
// promptAction.showToast({
@ -408,8 +409,8 @@ struct UserInfo {
this.showFaceCompare = false
this.lsh = '1111111111111'
this.callBackFlag = false
AppStorage.setOrCreate('lsh',this.lsh)
AppStorage.setOrCreate('statue',2)
AppStorage.setOrCreate('lsh', this.lsh)
AppStorage.setOrCreate('statue', 2)
// this.currentUser = EmptyCandidateObject
this.numCount = 0
if (thiis.singlePlay) {
@ -421,9 +422,9 @@ struct UserInfo {
this.currentUser.ksy2 = ''
this.lsh = this.currentUser.lsh
this.examinerLoginInfo.ksyh=this.currentUser.ksy1sfzmhm
AppStorage.setOrCreate('examinerLoginInfo',this.examinerLoginInfo)
AppStorage.setOrCreate('lsh',this.lsh)
this.examinerLoginInfo.ksyh = this.currentUser.ksy1sfzmhm
AppStorage.setOrCreate('examinerLoginInfo', this.examinerLoginInfo)
AppStorage.setOrCreate('lsh', this.lsh)
}
// const syssetParams = await getSyncData('MA_SYSSET');
@ -599,7 +600,7 @@ struct UserInfo {
console.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser))
if (this.faceCompareSucess > 0) {
//人脸比对通过
AppStorage.setOrCreate('statue',4)
AppStorage.setOrCreate('statue', 4)
this.showFaceCompare = false
this.sfbdinterfaceFn()
}
@ -713,11 +714,11 @@ struct UserInfo {
})
if (this.dataList.length) {
setTimeout(() => {
this.currentUser=user.length?user[0]:this.dataList[0]
this.currentUser = user.length ? user[0] : this.dataList[0]
this.currentUser.ksy2 = this.examinerLoginInfo.kgxm
AppStorage.setOrCreate('lsh',this.currentUser.lsh)
this.examinerLoginInfo.ksyh=this.currentUser.ksy1sfzmhm
AppStorage.setOrCreate('examinerLoginInfo',this.examinerLoginInfo)
AppStorage.setOrCreate('lsh', this.currentUser.lsh)
this.examinerLoginInfo.ksyh = this.currentUser.ksy1sfzmhm
AppStorage.setOrCreate('examinerLoginInfo', this.examinerLoginInfo)
}, 200)
} else {
this.currentUser = EmptyCandidateObject
@ -788,7 +789,7 @@ struct UserInfo {
this.getExaminationStudentInfoFn()
return
}
}).catch((error) => {
}).catch((error: BusinessError) => {
console.log('error12error' + error)
})
@ -817,7 +818,7 @@ struct UserInfo {
//身份比对
async sfbdinterfaceFn() {
AppStorage.setOrCreate('statue',4)
AppStorage.setOrCreate('statue', 4)
this.stepFlag = true
const { carId, examinationRoomId } = this.carInfo;
let examItems = { getExaminationItemRsp: { body: { ykxx: '' } } };
@ -983,7 +984,7 @@ struct UserInfo {
const { examSubject, plateNo } = this.carInfo;
const date = new Date()
const startHourTime = await getCurrentHourTime()
AppStorage.setOrCreate('startHourTime',startHourTime)
AppStorage.setOrCreate('startHourTime', startHourTime)
const photoBase64 = await this.getPhoto();
if (photoBase64 == '') {
this.ksksLimit = false
@ -1012,9 +1013,9 @@ struct UserInfo {
}
console.info('surenjunjianguan', JSON.stringify(param))
const temp = await writeObjectOut(param);
AppStorage.setOrCreate('lsh',this.currentUser.lsh)
this.examinerLoginInfo.ksyh= this.currentUser.ksy1sfzmhm
AppStorage.setOrCreate('examinerLoginInfo',this.examinerLoginInfo)
AppStorage.setOrCreate('lsh', this.currentUser.lsh)
this.examinerLoginInfo.ksyh = this.currentUser.ksy1sfzmhm
AppStorage.setOrCreate('examinerLoginInfo', this.examinerLoginInfo)
return temp
}
@ -1032,7 +1033,7 @@ struct UserInfo {
// await upDateTableByArray('USER', [this.currentUser])
console.log("User", JSON.stringify(this.currentUser))
// await sqlInsertCommonFn("USER", [this.currentUser])
AppStorage.setOrCreate('statue',4)
AppStorage.setOrCreate('statue', 4)
this.isBoardPrePareSetPopupShow = true;
this.isFirstBoardPrePareSetPopupBtnShow = true;
this.stepFlag = false
@ -1096,7 +1097,7 @@ struct UserInfo {
return
}
this.currentUser = EmptyCandidateObject
AppStorage.setOrCreate('lsh',item.lsh)
AppStorage.setOrCreate('lsh', item.lsh)
setTimeout(() => {
this.currentUser = item
this.currentUser.ksy2 = this.examinerLoginInfo.kgxm
@ -1361,7 +1362,7 @@ struct LabelBlock {
}
}
interface systemParam {
interface systemParam {
'Param341': boolean, //是否按顺序考试
'Param803Str': string, //开始考试前必须解开安全带或关车门
'Param612Str': string, //开始考试触发方式