提交修改

This commit is contained in:
lvyuankang 2024-12-31 10:21:19 +08:00
parent ac5186ef97
commit e917107df1
5 changed files with 118 additions and 149 deletions

View File

@ -6,7 +6,8 @@ import common from '@ohos.app.ability.common'
import fs from '@ohos.file.fs' import fs from '@ohos.file.fs'
const LOGTAG = 'LOGTAG' const LOGTAG = 'LOGTAG'
export default class FileUtil{
export default class FileUtil {
private context: common.UIAbilityContext private context: common.UIAbilityContext
private wantInfos: Want[] private wantInfos: Want[]
private fileAccessHelper: fileAccess.FileAccessHelper private fileAccessHelper: fileAccess.FileAccessHelper
@ -14,8 +15,7 @@ export default class FileUtil{
//后续文件路径待替换 //后续文件路径待替换
private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files' private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files'
public destFile:string public destFile: string
public filePathFdObj:Object = {}
constructor(wantInfos) { constructor(wantInfos) {
const {requestPermission} = this; const {requestPermission} = this;
@ -27,81 +27,88 @@ export default class FileUtil{
* @desc * @desc
* *
*/ */
public initFolder = async (folderPath:string) => { public initFolder = async (folderPath: string) => {
const {absolutePath} = this; const {absolutePath} = this;
const folderList = folderPath.split('/').filter(folderName => folderName !== ''); const folderList = folderPath.split('/').filter(folderName => folderName !== '');
let path = absolutePath let path = absolutePath
folderList.forEach((folderName=>{ folderList.forEach((folderName => {
path += `/${folderName}`; path += `/${folderName}`;
try { try {
const isExit = fs.accessSync(path); const isExit = fs.accessSync(path);
if(!isExit){ if (!isExit) {
fs.mkdirSync(path) fs.mkdirSync(path)
} }
} catch (e) { } catch (e) {
console.info('初始化文件夹失败',path) console.info('初始化文件夹失败', path)
promptAction.showToast({ promptAction.showToast({
message:`初始化文件夹失败`+ folderPath + JSON.stringify(e), message: `初始化文件夹失败` + JSON.stringify(e),
duration:4000, duration: 4000,
}) })
} }
})); }));
return path; return path;
} }
/* /*
* @desc * @desc
* *
*/ */
public addFile = async (filePath:string,content:string,type?:string)=>{ public addFile = async (filePath: string, content: string, type?: string, fd?) => {
const { READ_WRITE,CREATE,APPEND }= fs.OpenMode const { READ_WRITE,CREATE,APPEND } = fs.OpenMode
const isExit = fs.accessSync(filePath); const isExit = fs.accessSync(filePath);
//文件存在先删除 //文件存在先删除
if(isExit){ if (isExit) {
fs.unlinkSync(filePath); fs.unlinkSync(filePath);
} }
try { try {
let file = fs.openSync(filePath, READ_WRITE | CREATE); let file
if (!fd) {
file = fs.openSync(filePath, READ_WRITE | CREATE);
}
//追加写入文件 //追加写入文件
fs.writeSync(file.fd,content) fs.writeSync(file.fd, content)
fs.closeSync(file) fs.closeSync(file)
console.error(LOGTAG,'写入文件成功') return file.fd
return true
}catch (e){ } catch (e) {
promptAction.showToast({ console.error(LOGTAG, '写入失败', JSON.stringify(e))
message:`addFile文件失败`+ filePath +JSON.stringify(e),
duration:4000,
})
console.error(LOGTAG,'写入失败',JSON.stringify(e))
} }
} }
public openFileSync = async (filePath) => {
const { READ_WRITE,CREATE,APPEND } = fs.OpenMode
let file = fs.openSync(filePath, READ_WRITE | APPEND | CREATE);
return file
}
public editFileWidthOutOpen(file, content) {
const newStr = content + '\n'
fs.writeSync(file.fd, newStr)
fs.closeSync(file)
console.error(LOGTAG, '写入文件成功')
}
/* /*
* @desc * @desc
* *
*/ */
public editFile = async (filePath:string,content:string,fd?:number)=>{ public editFile = async (filePath: string, content: string, fd?: number) => {
const {filePathFdObj} = this; const { READ_WRITE,CREATE,APPEND } = fs.OpenMode
const { READ_WRITE,CREATE,APPEND }= fs.OpenMode
const newStr = content + '\n'
const thisFileFd = filePathFdObj[filePath];
try { try {
if(thisFileFd){ const newStr = content + '\n'
fs.writeSync(fd,newStr) if (fd !== undefined) {
return fd; fs.writeSync(fd, newStr)
}else{ return fd
let file = fs.openSync(filePath, READ_WRITE | APPEND |CREATE); } else {
fs.writeSync(file.fd,newStr) let file = fs.openSync(filePath, READ_WRITE | APPEND | CREATE);
this.filePathFdObj[filePath] = file.fd fs.writeSync(file.fd, newStr)
return file.fd return file.fd
} }
} catch (e) { } catch (e) {
promptAction.showToast({ console.error(LOGTAG, JSON.stringify(e))
message:`editFile文件失败`+ filePath +JSON.stringify(e),
duration:4000,
})
console.error(LOGTAG,JSON.stringify(e))
} }
} }
@ -109,17 +116,12 @@ export default class FileUtil{
* @desc * @desc
* *
**/ **/
public readFile = async (filePath:string) => { public readFile = async (filePath: string) => {
try{ try {
console.log('strrr',filePath) console.log('strrr', filePath)
const str = await fs.readText(filePath); const str = await fs.readText(filePath);
return str return str
}catch (e){ } catch (err) {
promptAction.showToast({
message:`读取文件失败`+ filePath +JSON.stringify(e),
duration:4000,
})
console.log('readFile文件失败'+ filePath +JSON.stringify(e))
return '' return ''
} }
@ -128,9 +130,9 @@ export default class FileUtil{
/* /*
* @desc获取系统目录里的文件列表 * @desc获取系统目录里的文件列表
*/ */
public getDeviceList = async (folderPath?:string)=>{ public getDeviceList = async (folderPath?: string) => {
const {absolutePath,getFilePathList} = this; const {absolutePath,getFilePathList} = this;
return getFilePathList(`${absolutePath}/${folderPath}`,false) return getFilePathList(`${absolutePath}/${folderPath}`, false)
}; };
// 删除文件夹或者文件 // 删除文件夹或者文件
@ -139,29 +141,29 @@ export default class FileUtil{
* @param{{type}} 1:文件夹 2 3 * @param{{type}} 1:文件夹 2 3
**/ **/
public deleteF = async (path:string,type: 1 | 2 | 3) => { public deleteF = async (path: string, type: 1 | 2 | 3) => {
const {getFilePathList,absolutePath} = this const {getFilePathList,absolutePath} = this
if(type === 1){ if (type === 1) {
const fileList = await getFilePathList(`${absolutePath}/${path}`,false); const fileList = await getFilePathList(`${absolutePath}/${path}`, false);
fileList.forEach(filePath =>{ fileList.forEach(filePath => {
fs.unlinkSync(`${absolutePath}/${path}/${filePath}`); fs.unlinkSync(`${absolutePath}/${path}/${filePath}`);
}) })
fs.rmdirSync(`${absolutePath}/${path}`); fs.rmdirSync(`${absolutePath}/${path}`);
return true return true
} }
if(type === 2){ if (type === 2) {
fs.unlinkSync(`${absolutePath}/${path}`); fs.unlinkSync(`${absolutePath}/${path}`);
return true return true
} }
if(type === 3){ if (type === 3) {
fs.unlinkSync(`${path}`); fs.unlinkSync(`${path}`);
return true return true
} }
} }
// 获取系统文件绝对路径 // 获取系统文件绝对路径
public getAbsolutePath = () =>{ public getAbsolutePath = () => {
const {absolutePath} = this; const {absolutePath} = this;
return absolutePath return absolutePath
} }
@ -170,7 +172,7 @@ export default class FileUtil{
public getSdCardPathList = async () => { public getSdCardPathList = async () => {
this.wantInfos = await fileAccess.getFileAccessAbilityInfo(); this.wantInfos = await fileAccess.getFileAccessAbilityInfo();
const {wantInfos,context} = this; const {wantInfos,context} = this;
const fileAccessHelper = fileAccess.createFileAccessHelper(this.context,this.wantInfos); const fileAccessHelper = fileAccess.createFileAccessHelper(this.context, this.wantInfos);
this.fileAccessHelper = fileAccessHelper; this.fileAccessHelper = fileAccessHelper;
let isDone = false; let isDone = false;
@ -186,48 +188,48 @@ export default class FileUtil{
if (!isDone) { if (!isDone) {
let deviceType = rootInfo.value.deviceType; let deviceType = rootInfo.value.deviceType;
let displayName = rootInfo.value.displayName; let displayName = rootInfo.value.displayName;
let uri:string = rootInfo.value.uri; let uri: string = rootInfo.value.uri;
let deviceFlags = rootInfo.value.deviceFlags; let deviceFlags = rootInfo.value.deviceFlags;
console.error(LOGTAG,`设备类型:${deviceType},设备名称:${displayName}设备根目录Uri${uri},设备支持的能力:${deviceFlags}`); console.error(LOGTAG, `设备类型:${deviceType},设备名称:${displayName}设备根目录Uri${uri},设备支持的能力:${deviceFlags}`);
if(uri.indexOf('/mnt/external/')>0){ if (uri.indexOf('/mnt/external/') > 0) {
// if('vol-8-1' ==displayName){ // if('vol-8-1' ==displayName){
this.destFile = uri.split('ExternalFileManager')[1]+'/' this.destFile = uri.split('ExternalFileManager')[1] + '/'
console.error(LOGTAG,`外置存储路径:`+this.destFile); console.error(LOGTAG, `外置存储路径:` + this.destFile);
this.getFilePathList(this.destFile,true) this.getFilePathList(this.destFile, true)
} }
} }
} }
} catch (error) { } catch (error) {
console.error(LOGTAG,"getRoots failed, errCode:" + error.code + ", errMessage:" + error.message); console.error(LOGTAG, "getRoots failed, errCode:" + error.code + ", errMessage:" + error.message);
} }
} }
public getFileContent = (filePath:string) => { public getFileContent = (filePath: string) => {
const {absolutePath} = this; const {absolutePath} = this;
const { READ_WRITE }= fs.OpenMode const { READ_WRITE } = fs.OpenMode
const path = `${absolutePath}/${filePath}` const path = `${absolutePath}/${filePath}`
const str = fs.readTextSync(path); const str = fs.readTextSync(path);
return str return str
} }
private getFilePathList = async (filePath:string,isSdcard:boolean) => { private getFilePathList = async (filePath: string, isSdcard: boolean) => {
let fileName = [],sdCardFileName = []; let fileName = [], sdCardFileName = [];
try { try {
const filenames = await fs.listFile(filePath); const filenames = await fs.listFile(filePath);
for (let i = 0; i < filenames.length; i++) { for (let i = 0; i < filenames.length; i++) {
console.error(LOGTAG,`目录:${filePath}的子文件:${filenames[i]}`); console.error(LOGTAG, `目录:${filePath}的子文件:${filenames[i]}`);
if(isSdcard){ if (isSdcard) {
sdCardFileName.push(filenames[i]) sdCardFileName.push(filenames[i])
}else{ } else {
fileName.push(filenames[i]) fileName.push(filenames[i])
} }
} }
return isSdcard ? sdCardFileName : fileName return isSdcard ? sdCardFileName : fileName
}catch (e){ } catch (e) {
console.error(LOGTAG,JSON.stringify(e)); console.error(LOGTAG, JSON.stringify(e));
} }
} }
@ -241,17 +243,15 @@ export default class FileUtil{
]; ];
this.wantInfos = await fileAccess.getFileAccessAbilityInfo(); this.wantInfos = await fileAccess.getFileAccessAbilityInfo();
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager() let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
atManager.requestPermissionsFromUser(context, permissions , async (code, result) => { atManager.requestPermissionsFromUser(context, permissions, async (code, result) => {
const permissionRequest = result.authResults[0] const permissionRequest = result.authResults[0]
if(permissionRequest == -1){ if (permissionRequest == -1) {
promptAction.showToast({ promptAction.showToast({
message: "请先授权", message: "请先授权",
duration:3000, duration: 3000,
}) })
return return
} }
}) })
} }
} }

View File

@ -31,7 +31,7 @@ export default async function request(req: any) {
'Content-Type': xml ? 'text/xml' : 'application/json' 'Content-Type': xml ? 'text/xml' : 'application/json'
}, },
extraData: xml ? data : JSON.stringify(data), extraData: xml ? data : JSON.stringify(data),
connectTimeout:120000, // connectTimeout:120000,
} }
//params转url拼接参数 //params转url拼接参数
let paramsStr = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || ''; let paramsStr = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || '';

View File

@ -31,7 +31,6 @@ import { judgeConfig } from './judgeSDK/utils/judgeConfig';
import FileUtil from '../common/utils/File'; import FileUtil from '../common/utils/File';
import SignDisplayCom from './compontents/signDisplayCom'; import SignDisplayCom from './compontents/signDisplayCom';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { voiceService } from '../common/service/voiceService';
@Entry @Entry
@Component @Component
@ -41,8 +40,6 @@ struct Index {
} }
async aboutToAppear() { async aboutToAppear() {
this.vocObj = new voiceService(async (status, val, next) => {
});
globalThis.windowClass.setWindowSystemBarEnable([]) globalThis.windowClass.setWindowSystemBarEnable([])
const time = await getCurrentTime() const time = await getCurrentTime()
@ -763,10 +760,6 @@ struct Index {
.height(118 * 0.95) .height(118 * 0.95)
.margin({ bottom: 8 }) .margin({ bottom: 8 })
.onClick(() => { .onClick(() => {
this.vocObj.playAudio({
type: 1,
name: 'button_media.wav'
})
this.setManualProjectFn(index) this.setManualProjectFn(index)
}) })
}) })
@ -799,10 +792,6 @@ struct Index {
.alignItems(VerticalAlign.Center) .alignItems(VerticalAlign.Center)
.border({ width: 5, color: '#4D4136', radius: 30 }) .border({ width: 5, color: '#4D4136', radius: 30 })
.onClick(() => { .onClick(() => {
this.vocObj.playAudio({
type: 1,
name: 'button_media.wav'
})
this.signDisplayComVisible = true this.signDisplayComVisible = true
}) })
@ -838,10 +827,6 @@ struct Index {
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 10 }) .margin({ bottom: 10 })
.onClick(() => { .onClick(() => {
this.vocObj.playAudio({
type: 1,
name: 'button_media.wav'
})
this.isDeductedPopShow = true this.isDeductedPopShow = true
}) })
} }
@ -871,10 +856,6 @@ struct Index {
.backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat) .backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => { .onClick(() => {
this.vocObj.playAudio({
type: 1,
name: 'button_media.wav'
})
if (this.judgeConfigObj['353'] == '0') { if (this.judgeConfigObj['353'] == '0') {
this.endPopupVisible = true this.endPopupVisible = true
} else { } else {
@ -938,10 +919,6 @@ struct Index {
.backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat) .backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '33.33%', height: '33.33%' }) .backgroundImageSize({ width: '33.33%', height: '33.33%' })
.onClick(() => { .onClick(() => {
this.vocObj.playAudio({
type: 1,
name: 'button_media.wav'
})
this.signDisplayComVisible = false this.signDisplayComVisible = false
}) })
}.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)') }.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)')
@ -1353,11 +1330,10 @@ struct Index {
@State lane: LANE = { road: '', num: 0, count: 0 } @State lane: LANE = { road: '', num: 0, count: 0 }
@State roadData: Object = {}; @State roadData: Object = {};
//定位差分状态时候正常 //定位差分状态时候正常
@State isDwztRight: boolean = true; @State isDwztRight: boolean = false;
@State defaultTabIndex: number = 0; @State defaultTabIndex: number = 0;
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
public kfArrScroller: Scroller = new Scroller() public kfArrScroller: Scroller = new Scroller()
private vocObj = null;
//档位 //档位
@State dw: string = '' @State dw: string = ''
//速度 //速度

View File

@ -97,8 +97,8 @@ export interface MAPITEMPOINTITEM {
} }
export interface EXAMDATA { export interface EXAMDATA {
//1:项目开始 2:项目结束 3:扣分 4:考车状态 5:考试结束 6:项目取消 7:语音播放和提示 8:模拟灯光事件 9:车道信息事件 10:预进项目事件 11:差分事件 //1:项目开始 2:项目结束 3:扣分 4:考车状态 5:考试结束 6:项目取消 7:语音播放和提示 8:模拟灯光事件 9:车道信息事件 10:预进项目事件
event: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 event: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
//时间 //时间
sj: number sj: number
//考车状态 -1:后退 0:停车 1:前进 //考车状态 -1:后退 0:停车 1:前进
@ -164,9 +164,6 @@ export interface EXAMDATA {
xmdm:number, xmdm:number,
xmxh:string xmxh:string
} }
nongps:{
type:0|1|2|3|4
}
} }
export interface KSJS { export interface KSJS {

View File

@ -72,6 +72,7 @@ export default class Judge {
this.kfArr = judgeUI.kfArr this.kfArr = judgeUI.kfArr
this.xmmcStr = ''; this.xmmcStr = '';
this.xmmcCode = ''; this.xmmcCode = '';
this.xmmcEndCode = undefined;
this.carztStr = ''; this.carztStr = '';
this.testKmItems = {}; this.testKmItems = {};
// 考试回放配置 // 考试回放配置
@ -358,7 +359,7 @@ export default class Judge {
handleRealExam = async (strData, callBack) => { handleRealExam = async (strData, callBack) => {
let examData: EXAMDATA = JSON.parse(strData); let examData: EXAMDATA = JSON.parse(strData);
const {getDqxmStr,getKfStr,goJudgeVoice,setMndg,avPlayer,fileLog,judgeUI} = this; const {getDqxmStr,getKfStr,goJudgeVoice,setMndg,avPlayer,fileLog,judgeUI} = this;
const {carzt,xmks,kf,event,xmjs,xmqx,ksjs,sound,mndg,lane,precast,nongps} = examData const {carzt,xmks,kf,event,xmjs,xmqx,ksjs,sound,mndg,lane,precast} = examData
const param512 = (judgeUI.judgeConfigObj['512'] || '').split(','); const param512 = (judgeUI.judgeConfigObj['512'] || '').split(',');
//获取项目结束、项目开始代码 //获取项目结束、项目开始代码
const xmdm = event == 2 ? xmjs.xmdm : xmks.xmdm const xmdm = event == 2 ? xmjs.xmdm : xmks.xmdm
@ -385,6 +386,7 @@ export default class Judge {
this.xmmcStr = xmmcStr; this.xmmcStr = xmmcStr;
this.xmmcCode = xmmcCode; this.xmmcCode = xmmcCode;
this.xmmcSingleCode = xmmcSingleCode this.xmmcSingleCode = xmmcSingleCode
this.xmmcEndCode = xmmcCode
this.xmdm = xmdm; this.xmdm = xmdm;
this.xmxh = xmxh; this.xmxh = xmxh;
this.judgeUI.isProjectIn = true this.judgeUI.isProjectIn = true
@ -482,7 +484,7 @@ export default class Judge {
case 10:{ case 10:{
const param611 = judgeConfigObj['611'] || ''; const param611 = judgeConfigObj['611'] || '';
const [f,s] = param611.split('/') const [f,s] = param611.split('/')
const {xmdm} = precast; const {xmdm,xmxh} = precast;
const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter;
const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode; const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode;
// if(examSubject == 2 && ((xmdm == 0 && f == 1) || (xmdm == 1 && s == 1) || xmdm == 3)){ // if(examSubject == 2 && ((xmdm == 0 && f == 1) || (xmdm == 1 && s == 1) || xmdm == 3)){
@ -492,16 +494,13 @@ export default class Judge {
this.testKmItems[xmmcCode].status = 2; this.testKmItems[xmmcCode].status = 2;
this.xmmcStr = xmmcStr; this.xmmcStr = xmmcStr;
this.xmmcCode = xmmcCode; this.xmmcCode = xmmcCode;
this.xmdm = xmdm;
this.xmxh = xmxh;
this.xmmcSingleCode = xmmcSingleCode; this.xmmcSingleCode = xmmcSingleCode;
judgeUI.projectsObj[xmdm].type = '2'; judgeUI.projectsObj[xmdm].type = '2';
} }
break; break;
//差分事件
case 11:{
const {type}= nongps
this.checkDwzt(type)
}
default: default:
break; break;
@ -594,6 +593,7 @@ export default class Judge {
console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`) console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`)
await endProject(xmdm); await endProject(xmdm);
this.xmmcSingleCode = 0; this.xmmcSingleCode = 0;
this.xmmcEndCode = undefined;
}, {isDelay: true}) }, {isDelay: true})
} }
} }
@ -760,7 +760,7 @@ export default class Judge {
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const deviceNo = globalThis.deviceNo; const deviceNo = globalThis.deviceNo;
const { examSubject,plateNo,carNo } = carInfo; const { examSubject,plateNo,carNo } = carInfo;
const {judgeUI,getProjectInfo,fileLog,xmmcSingleCode,filePath} = this; const {judgeUI,getProjectInfo,fileLog,xmmcEndCode,filePath} = this;
const {lsh,idCard,serialNumber,ksdd,projectsObj} = judgeUI const {lsh,idCard,serialNumber,ksdd,projectsObj} = judgeUI
const time = await getCurrentTime(); const time = await getCurrentTime();
const project = getProjectInfo(ksxm); const project = getProjectInfo(ksxm);
@ -776,6 +776,11 @@ export default class Judge {
} }
}) })
console.info('surenjun','开始扣分')
console.info('surenjun ksxm=>',ksxm)
console.info('surenjun commonKsxm=>',commonKsxm)
console.info('surenjun project=>',JSON.stringify(project))
const data = { const data = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C53', xtlb: '17', jkxlh: serialNumber, jkid: '17C53',
drvexam: { drvexam: {
@ -784,7 +789,7 @@ export default class Judge {
ksxm: project == undefined ksxm: project == undefined
? (commonKsxm ? (commonKsxm
? (projectsObj[commonKsxm].projectCodeCenter) ? (projectsObj[commonKsxm].projectCodeCenter)
: (examSubject == 3 ? 30000 : 10000)) : (examSubject == 3 ? 30000 : (xmmcEndCode == undefined?10000:xmmcEndCode)))
: project.projectCodeCenter , : project.projectCodeCenter ,
kfxm: kf.markcatalog, kfxm: kf.markcatalog,
kfxmmx: `${ksxm},${kf.markserial}`, kfxmmx: `${ksxm},${kf.markserial}`,
@ -1482,13 +1487,13 @@ export default class Judge {
const str = await senorToWXDataStr(msg); const str = await senorToWXDataStr(msg);
usbService.sendUSB(str) usbService.sendUSB(str)
} }
// this.judgeUI.isDwztRight = (plcData.gps.dwzt == 4 && plcData.gps.jdzt == 3); this.judgeUI.isDwztRight = (plcData.gps.dwzt == 4 && plcData.gps.jdzt == 3);
const param350 = judgeUI.judgeConfigObj['350'] const param350 = judgeUI.judgeConfigObj['350']
//@ts-ignore //@ts-ignore
this.judgeUI.sd = ((param350 == 0? plcData.gps.sd :plcData.sensor.cs) as number * 1.852).toFixed(0) + '' this.judgeUI.sd = ((param350 == 0? plcData.gps.sd :plcData.sensor.cs) as number * 1.852).toFixed(0) + ''
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
//TODO 暂时关闭差分检测异常 //TODO 暂时关闭差分检测异常
// await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt); await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt);
if(!isExamEnd){ if(!isExamEnd){
await examJudgeRealExam(plcData) await examJudgeRealExam(plcData)
} }
@ -1574,7 +1579,7 @@ export default class Judge {
const bytes = await this.getMessageHeartbeat(); const bytes = await this.getMessageHeartbeat();
bytes && globalThis.judgeUdp.send(bytes) bytes && globalThis.judgeUdp.send(bytes)
}, 20) }, 50)
globalThis.judgeTimer = judgeTimer; globalThis.judgeTimer = judgeTimer;
} }
@ -1615,35 +1620,25 @@ export default class Judge {
} }
// 检测差分状态 // 检测差分状态
checkDwzt = async (type) => { checkDwzt = async (dwzt,jdzt) => {
const {avPlayer} = this; const {avPlayer} = this;
const judgeConfig = this.judgeUI.judgeConfig; const judgeConfig = this.judgeUI.judgeConfig;
switch (type){ const param499 = judgeConfig['499'] || '';
case 0: if(param499 == '' || param499 == undefined){
this.judgeUI.isDwztRight = true; return
break; }
//10秒内dwzt不为4
const dwztNum = this.dwztNum
if(dwztNum != 0 && (dwztNum % (5 * 10) == 0) && (param499 !== '' || param499 !== undefined)){
this.judgeUI.dwztErrorVisible = true;
avPlayer.playAudio([`voice/差分状态异常.mp3`],true)
}
case 1: if(dwzt != 4 || jdzt != 3){
this.judgeUI.dwztErrorVisible = true; this.dwztNum += 1
avPlayer.playAudio([`voice/差分状态异常.mp3`],true) }else{
setTimeout(()=>{ this.dwztNum = 0;
router.back() this.judgeUI.dwztErrorVisible = false;
},3000)
break;
case 2:
avPlayer.playAudio([`voice/差分状态异常.mp3`],true);
break;
case 3:
this.judgeUI.dwztErrorVisible = true;
avPlayer.playAudio([`voice/差分状态异常.mp3`],true);
break;
case 4:
this.judgeUI.isDwztRight = false;
//差分异常上报
break;
} }
} }
@ -1664,6 +1659,7 @@ export default class Judge {
private xmmcStr: string private xmmcStr: string
private xmmcCode: string private xmmcCode: string
private xmmcSingleCode: number private xmmcSingleCode: number
private xmmcEndCode?:number
private xmdm: string | number private xmdm: string | number
private xmxh: string private xmxh: string
private fileModel: FileModel private fileModel: FileModel