Merge pull request 'feat_surenjun' (#49) from feat_surenjun into main
Reviewed-on: #49
This commit is contained in:
		
						commit
						a2fef1e83a
					
				| @ -2,7 +2,7 @@ import request from "../common/utils/request" | ||||
| import { getCurrentTime } from '../common/utils/tools' | ||||
| import { getSyncData } from '../common/service/initable'; | ||||
| import writeObjectOutNew from './judgeNew' | ||||
| import FileLog from '../pages/judgeSDK/utils/fileLog'; | ||||
| import FileUtil from '../common/utils/File'; | ||||
| let baseHost = globalThis.host; | ||||
| 
 | ||||
| 
 | ||||
| @ -17,7 +17,7 @@ export async function download() { | ||||
| } | ||||
| 
 | ||||
| // 通用监管接口
 | ||||
| export async function writeObjectOut(params): Promise<number> { | ||||
| export async function writeObjectOut(params,filePath?:string): Promise<number> { | ||||
|   const singlePlay = globalThis.singlePlay | ||||
|   if (singlePlay) { | ||||
|     return 1 | ||||
| @ -40,14 +40,18 @@ export async function writeObjectOut(params): Promise<number> { | ||||
|   const {xtlb,jkxlh,jkid,drvexam} = params; | ||||
|   //新监管调用
 | ||||
|   if (globalThis.isJGNew) { | ||||
|     return await writeObjectOutNew(params) | ||||
|     return await writeObjectOutNew(params,filePath) | ||||
|   } | ||||
|   const drvexamArrs = Reflect.ownKeys(drvexam).map((key: string) => (`<${key}>${drvexam[key]}</${key}>`)); | ||||
| 
 | ||||
|   if(filePath){ | ||||
|     const fileUtil = new FileUtil(globalThis.context); | ||||
|     await fileUtil.initFolder(filePath); | ||||
|     fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify({ | ||||
|       xtlb,jkxlh,jkid,drvexam | ||||
|     })); | ||||
|   } | ||||
| 
 | ||||
|   const fileLog = new FileLog(globalThis.context) | ||||
|   const drvexamArrs = Reflect.ownKeys(drvexam).map((key: string) => (`<${key}>${drvexam[key]}</${key}>`)); | ||||
|   fileLog.setExamJudgeWuxiData(JSON.stringify({ | ||||
|     xtlb,jkxlh,jkid,drvexam | ||||
|   })) | ||||
|   //对象转换成xml
 | ||||
|   const temp = await request({ | ||||
|     host: globalThis.JGHOST, | ||||
| @ -116,7 +120,6 @@ export async function uploadExamMileage(params) { | ||||
|     return | ||||
|   } | ||||
|   const time = await getCurrentTime() | ||||
| 
 | ||||
|   return await request({ | ||||
|     url: '/der2/services/exam/uploadExamMileage.ws', | ||||
|     data: `<?xml version="1.0" encoding="UTF-8"?>
 | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| import { getSyncData } from '../common/service/initable'; | ||||
| import request from "../common/utils/request" | ||||
| let baseHost = globalThis.host; | ||||
| import FileUtil from '../common/utils/File'; | ||||
| import FileLog from '../pages/judgeSDK/utils/fileLog'; | ||||
| 
 | ||||
| //新监管接口
 | ||||
| @ -16,12 +17,20 @@ const gjxlhObj = { | ||||
|   '17C56': '02-21-000014', | ||||
| } | ||||
| 
 | ||||
| export default async function writeObjectOutNew(data): Promise<number> { | ||||
| export default async function writeObjectOutNew(data,filePath): Promise<number> { | ||||
|   const fileUtil = new FileUtil(globalThis.context); | ||||
|   const {jkid , drvexam} = data; | ||||
|   const basic = await getBasicConfig(jkid); | ||||
|   const params = await getParams(jkid, drvexam); | ||||
|   const {wglb,jkxlh,glbm,jgbh,sjbs} = basic; | ||||
| 
 | ||||
|   console.info('surenjun filePath=>',filePath) | ||||
|   fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify({ | ||||
|     wglb,jkxlh,glbm,jgbh,sjbs, | ||||
|     data:params.data, | ||||
|     file:params.file, | ||||
|   })); | ||||
| 
 | ||||
|   return await request({ | ||||
|     host: globalThis.JGHOST, | ||||
|     method: 'post', | ||||
|  | ||||
| @ -1,7 +1,10 @@ | ||||
| // @ts-nocheck
 | ||||
| import promptAction from '@ohos.promptAction' | ||||
| import router from '@ohos.router' | ||||
| import { dateFormat } from '../utils/tools' | ||||
| import FileUtil from '../../common/utils/File' | ||||
| import AccountTable from '../../common/database/tables/AccountTable' | ||||
| import MA_SYSSET from '../../common/constants/MA_SYSSET' | ||||
| import { takePhoto } from '../../common/service/videoService' | ||||
| 
 | ||||
| import { | ||||
| @ -102,28 +105,8 @@ export async function getDoubleCeneterTable(param) { | ||||
|       'MA_ITEMINFO': false, | ||||
|       'MA_T_CARPARMSET': false | ||||
|     } | ||||
|     const name = { | ||||
|       'MA_MARKRULE': 'MA_MARKRULE', | ||||
|       'MA_SYSTEMPARM': 'MA_SYSTEMPARM', | ||||
|       'MA_MAP_COLLECT': 'MA_MAP_COLLECT', | ||||
|       'MA_MAP_COLLECT_SHAPE': 'MA_MAP_COLLECT_SHAPE', | ||||
|       'MA_MAP_ITEMCLASS': 'MA_MAP_ITEMCLASS', | ||||
|       'MA_MAP_POINT': 'MA_MAP_POINT', | ||||
|       'MA_MAP_POINT_ITEM': 'MA_MAP_POINT_ITEM', | ||||
|       'MA_MAP_ROAD': 'MA_MAP_ROAD', | ||||
|       'MA_MAP_ROAD_LANE': 'MA_MAP_ROAD_LANE', | ||||
|       'MA_MAP_SUBITEM': 'MAP_SUBITEM', | ||||
|       'ES_CARINFO': 'ES_CARINFO', | ||||
|       'ES_EXAMPOINTDETAIL': 'ES_EXAMPOINTDETAIL', | ||||
|       'MA_MARKRULESET': 'MA_MARKRULESET', | ||||
|       'ES_CAR_VIDEO_PARAMETER': 'ES_CAR_VIDEO_PARAMETER', | ||||
|       'MA_CDSBINFO': 'MA_CDSBINFO', | ||||
|       'MA_ITEMINFO': 'MA_ITEMINFO', | ||||
|       'MA_T_CARPARMSET': 'MA_T_CARPARMSET' | ||||
|     } | ||||
| 
 | ||||
|     for (let key in typeObj) { | ||||
|       typeObj[key] = await upDateTable({ tableName: name[key] }, param) | ||||
|       typeObj[key] = await upDateTable({ tableName: key }, param) | ||||
|       if (!typeObj[key]) { | ||||
|         promptAction.showToast({ | ||||
|           message: `未能查询到${key}表数据, 请先检查网络是否连接正常`, | ||||
| @ -134,9 +117,9 @@ export async function getDoubleCeneterTable(param) { | ||||
|       } | ||||
|     } | ||||
|     reslove(true) | ||||
|     // router.pushUrl({
 | ||||
|     //   url: 'pages/ExaminerLogin',
 | ||||
|     // }, router.RouterMode.Single);
 | ||||
|     router.pushUrl({ | ||||
|       url: 'pages/ExaminerLogin', | ||||
|     }, router.RouterMode.Single); | ||||
|   }) | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -83,8 +83,10 @@ function sqlInsertCommonFn(tableName, resultArr, context?, delFlag = true) { | ||||
|     }, map[tableName], context); | ||||
|     accountTable.getRdbStore(() => { | ||||
|       accountTable.query('0', async (result) => { | ||||
|         console.log('sqlsqlinsertresult',JSON.stringify(result)) | ||||
|         // console.log('表长度',result.length,tableName)
 | ||||
|         if (result.length == 0) { | ||||
|           console.log('sqlsqlinsert00000') | ||||
|           let INSERT_SQL = "INSERT INTO " + tableName | ||||
|             + " (" + map[tableName].ACCOUNT_TABLE.columns.toString() + ") VALUES " | ||||
| 
 | ||||
| @ -105,6 +107,7 @@ function sqlInsertCommonFn(tableName, resultArr, context?, delFlag = true) { | ||||
|             } | ||||
|             INSERT_SQL += str | ||||
|           }) | ||||
|           console.log('sqlsqlinsertINSERT_SQLINSERT_SQL', INSERT_SQL) | ||||
|           accountTable.sqlOperate(INSERT_SQL, tableName, (val) => { | ||||
|             console.log('sqlsqlinsert,', val, 'tableName', tableName) | ||||
|             resolve(val) | ||||
| @ -113,6 +116,9 @@ function sqlInsertCommonFn(tableName, resultArr, context?, delFlag = true) { | ||||
|         else { | ||||
|           if (delFlag) { | ||||
|             await delSyncTable(tableName, context) | ||||
|             const result = await sqlInsertCommonFn(tableName, resultArr, context) | ||||
|             resolve(result) | ||||
|             return | ||||
|           } | ||||
|           const result = await sqlInsertCommonFn(tableName, resultArr, context) | ||||
|           resolve(result) | ||||
| @ -159,7 +165,11 @@ export async function getDataBaseTable(params, reqParam) { | ||||
| 
 | ||||
| //依据数组和表名更新sql表
 | ||||
| export async function upDateTableByArray(tableName, arr) { | ||||
|   sqlInsertCommonFn(tableName, arr) | ||||
|   return new Promise(async (reslove,reject)=>{ | ||||
|     const data =await sqlInsertCommonFn(tableName, arr) | ||||
|     console.log('sqlsqlinsertsqlsqlinsertkkk',data) | ||||
|     reslove(data) | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| //更新双中心表
 | ||||
|  | ||||
| @ -191,7 +191,6 @@ export default class FileUtil{ | ||||
|     const {absolutePath} = this; | ||||
|     const { READ_WRITE }= fs.OpenMode | ||||
|     const path = `${absolutePath}/${filePath}` | ||||
|     let file = fs.openSync(path, READ_WRITE); | ||||
|     const str = fs.readTextSync(path); | ||||
|     return str | ||||
|   } | ||||
|  | ||||
| @ -125,6 +125,7 @@ export default class UdpClient { | ||||
|   } | ||||
| 
 | ||||
|   onMessage(callback?) { | ||||
|     console.info(TAG, '注册udp message监听事件') | ||||
|     this.udp.on('message', value => { | ||||
|       console.log(TAG,'udponmessage') | ||||
|       // 收到的是ArrayBuffer 需要进行转换解析
 | ||||
| @ -160,14 +161,12 @@ export default class UdpClient { | ||||
|       console.log('messageTimeEnd') | ||||
| 
 | ||||
|     }); | ||||
| 
 | ||||
|     const arrRed = [0x55, 0xaa, 0x01, 0x01, 0x02, 0x00, 0x03, 0x00]; | ||||
|     const arrBlue = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00]; | ||||
|     const arrGreen = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x00, 0x03, 0x01]; | ||||
|     const arrBlueBuffer = Array2Byte(arrBlue).buffer | ||||
|     const arrRedBuffer = Array2Byte(arrRed).buffer | ||||
|     const arrGreenBugger = Array2Byte(arrGreen).buffer | ||||
| 
 | ||||
|     //监听udp是否断开
 | ||||
|     clearInterval(globalThis.messageTimer) | ||||
|     globalThis.messageTimer = setInterval(() => { | ||||
| @ -229,8 +228,9 @@ export default class UdpClient { | ||||
|         // });
 | ||||
|       } | ||||
|     }); | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| interface StashFunction { | ||||
|   (str: string) | ||||
|  | ||||
| @ -42,6 +42,8 @@ export default class UdpClientByCenter { | ||||
|   private isWorking: Boolean = false | ||||
|   private plcUdpError = false; | ||||
|   private initParam | ||||
|   private onMessage_1Callback:Function = ()=>{} | ||||
|   public  currentValue:string = '' | ||||
| 
 | ||||
|   constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) { | ||||
|     this.localIp = udplocalIp | ||||
| @ -257,8 +259,19 @@ export default class UdpClientByCenter { | ||||
| 
 | ||||
|   //plc
 | ||||
|   onMessage_1(callback?) { | ||||
|     this.udp&&this.udp.on('message', value => { | ||||
|     this.onMessage_1Callback = callback; | ||||
|     this.udp&&this.udp.on('message', this.message_1Fn); | ||||
|   } | ||||
| 
 | ||||
|   closeMessage_1(){ | ||||
|     console.info('surenjun', '关闭udp message监听事件') | ||||
|     this.udp.off('message',this.message_1Fn); | ||||
|     console.info('surenjun', '关闭udp message监听事件 成功') | ||||
|   } | ||||
| 
 | ||||
|   message_1Fn = (value)=>{ | ||||
|     console.log(TAG, 'udponmessage') | ||||
|     let callback = this.onMessage_1Callback | ||||
|     // 收到的是ArrayBuffer 需要进行转换解析
 | ||||
|     this.plcUdpError = false | ||||
|     if (value) { | ||||
| @ -283,13 +296,17 @@ export default class UdpClientByCenter { | ||||
|       const newArr = JSON.parse(JSON.stringify(strachArr)) | ||||
|       // this.stashFn=()=>{}
 | ||||
|       callback && callback(newArr.toString()) | ||||
| 
 | ||||
|       this.currentValue = newArr.toString(); | ||||
|     } else { | ||||
|       callback && callback('') | ||||
|     } | ||||
|     console.log('messageTimeEnd') | ||||
|     this.testIfUdpConnetced(callback) | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   //获取当前UDP信号
 | ||||
|   getCurrentMessage = () => { | ||||
|     return this.currentValue | ||||
|   } | ||||
| 
 | ||||
|   testIfUdpConnetced(callback) { | ||||
|  | ||||
| @ -31,13 +31,14 @@ export default async function request(req: any) { | ||||
|     } | ||||
|     //params转url拼接参数
 | ||||
|     let paramsStr  = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || ''; | ||||
| 
 | ||||
|     paramsStr = paramsStr.toString(); | ||||
|     paramsStr = paramsStr.substring(0, paramsStr.length-1) | ||||
|     try { | ||||
|         let baseUrl=host?host:globalThis.host | ||||
|         // let baseUrl=host?config.csptHost:config.host'
 | ||||
|         console.log('响应头地址' + paramsStr) | ||||
|         const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, options); | ||||
|         console.log('响应头地址' + JSON.stringify(result)) | ||||
|         let res:any = xml ? xmlToJson(result,url) : result; | ||||
|         console.log('响应头地址' + JSON.stringify(res)) | ||||
|         let resObj = null; | ||||
|  | ||||
| @ -242,19 +242,25 @@ struct Index { | ||||
|         systemParm.txt3 = systemParm.TXT3; | ||||
|       } | ||||
|       const {no1,no2,no3,} = systemParm; | ||||
|       const txt1 =  decodeURI(systemParm.txt1) | ||||
|       const txt2 =  decodeURI(systemParm.txt2) | ||||
|       //获取当前考车的no2 | ||||
|       if (no1 == 3 && no3 == 1) { | ||||
|         const txt1 = decodeURI(systemParm.txt1) | ||||
|         if (txt1 === carName) { | ||||
|           carNo = no2 | ||||
|           console.info('surenjun carNo => ',carNo) | ||||
|         } | ||||
|       } | ||||
|       //获取及格分数线 | ||||
|       if(no1 == 3 && no3 == 3 && carNo === no2){ | ||||
|         this.passingScore = Number(txt1) || 0; | ||||
|       } | ||||
| 
 | ||||
|       //获取当前考车的考试项目 | ||||
|       if (carNo !== '' && no1 == 3 && no2 == carNo && no3 == 10) { | ||||
|         allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '') | ||||
|         console.info('surenjun', JSON.stringify(allItems)) | ||||
|       } | ||||
|       const txt2 = decodeURIComponent(systemParm.txt2); | ||||
|       if ( | ||||
|       //科目二获取项目 | ||||
|         (examSubject == 2 && allItems.length && no1 == 6 && allItems.includes(no2)) | ||||
| @ -277,6 +283,8 @@ struct Index { | ||||
|           isRequired: allItems.includes(no2 + ''), | ||||
|           //是否考过了 | ||||
|           isEnd: false, | ||||
|           //项目开始数据是否上传过 | ||||
|           isUpload:false, | ||||
|         } | ||||
|         this.projectsObj[no2*1] = currentProject | ||||
|         this.projectsCenterObj[txt2] = currentProject | ||||
| @ -358,6 +366,7 @@ struct Index { | ||||
|                 this.projectsObj[projectCode].type = '3' | ||||
|               } | ||||
|             }) | ||||
|             this.ddxkKsxmArr = ddxkKsxmArr | ||||
|           } | ||||
|         } | ||||
|         //扣分续考 | ||||
| @ -381,7 +390,6 @@ struct Index { | ||||
|           }) | ||||
|           this.totalScore += currentKf.markreal * 1; | ||||
|         }) | ||||
|         this.ddxkKsxmArr = ddxkKsxmArr | ||||
|         this.ddxkKfArr = ddxkKfArr | ||||
|         this.ddxkTime = Date.parse(startTime); | ||||
|         this.isDdxk = true | ||||
| @ -812,31 +820,6 @@ struct Index { | ||||
|         .margin({ bottom: 20 }) | ||||
|       }.height('90%').justifyContent(FlexAlign.Start).padding({ top: 37, left: 60, bottom: 35, right: 60 }) | ||||
| 
 | ||||
|       //结束考试弹窗 | ||||
|       if (this.endPopupVisible) { | ||||
|         EndPoPup({ | ||||
|           title: '确定结束考试吗?', | ||||
|           cancelFn: () => { | ||||
|             this.endPopupVisible = false; | ||||
|           }, | ||||
|           confirmFn: async () => { | ||||
|             if (this.judgeConfigObj['344'] == 1) { | ||||
|               Prompt.showToast({ | ||||
|                 message: '考试未结束,不允许手动退出!', | ||||
|                 duration: 4000 | ||||
|               }); | ||||
|               return | ||||
|             } | ||||
|             this.endPopupVisible = false; | ||||
|             this.loadingPopupVisible = true | ||||
|             clearInterval(this.timer); | ||||
|             clearInterval(globalThis.judgeTimer) | ||||
|             globalThis.windowClass.setWindowSystemBarEnable(['navigation']) | ||||
|             this.judge.checkExamIsEnd(true); | ||||
|           } | ||||
|         }) | ||||
|       } | ||||
| 
 | ||||
|       //loading 弹窗 | ||||
|       if (this.loadingPopupVisible) { | ||||
|         LoadingPopup({ | ||||
| @ -902,6 +885,30 @@ struct Index { | ||||
|         }) | ||||
|       } | ||||
| 
 | ||||
|       //结束考试弹窗 | ||||
|       if (this.endPopupVisible) { | ||||
|         EndPoPup({ | ||||
|           title: '确定结束考试吗?', | ||||
|           cancelFn: () => { | ||||
|             this.endPopupVisible = false; | ||||
|           }, | ||||
|           confirmFn: async () => { | ||||
|             if (this.judgeConfigObj['344'] == 1) { | ||||
|               Prompt.showToast({ | ||||
|                 message: '考试未结束,不允许手动退出!', | ||||
|                 duration: 4000 | ||||
|               }); | ||||
|               return | ||||
|             } | ||||
|             this.endPopupVisible = false; | ||||
|             this.loadingPopupVisible = true | ||||
|             clearInterval(this.timer); | ||||
|             clearInterval(globalThis.judgeTimer) | ||||
|             globalThis.windowClass.setWindowSystemBarEnable(['navigation']) | ||||
|             this.judge.checkExamIsEnd(true); | ||||
|           } | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|     .height('100%').backgroundColor('#000').justifyContent(FlexAlign.Start) | ||||
|   } | ||||
| @ -967,7 +974,6 @@ struct Index { | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   // 获取是否能人工进项目 | ||||
|   getIsExitManualProject = (index: number) => { | ||||
|     const { | ||||
| @ -1207,4 +1213,5 @@ struct Index { | ||||
|   //速度 | ||||
|   @State sd: string = '' | ||||
|   @State mileageTimer: number = 0; | ||||
|   @State passingScore: number = 80 | ||||
| } | ||||
|  | ||||
| @ -18,8 +18,8 @@ struct Index { | ||||
|   // '',] | ||||
|   // @State inputTextList2: string[] = ['192.168.7.124','20022'] | ||||
| 
 | ||||
|   // @State inputTextList1: string[] = ['172.37.55.191','18782','172.37.55.191','8082','255.255.255.0','172.37.55.1','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122'] | ||||
|   @State inputTextList1: string[] = ['172.37.55.191','18782','172.37.55.191','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122'] | ||||
|   @State inputTextList1: string[] = ['172.37.55.191','18782','172.37.55.191','8082','255.255.255.0','172.37.55.1','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122'] | ||||
|   // @State inputTextList1: string[] = ['172.37.55.191','18782','172.37.55.191','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122'] | ||||
|   // @State inputTextList2: string[] = [] | ||||
|   // 112.80.35.83 11052 | ||||
|   // @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000'] | ||||
|  | ||||
| @ -23,7 +23,6 @@ import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||
| import { JudgeConfig } from '../config/judge'; | ||||
| import { judgeConfig } from './judgeSDK/utils/judgeConfig'; | ||||
| 
 | ||||
| 
 | ||||
| @Entry | ||||
| @Component | ||||
| struct UserInfo { | ||||
|  | ||||
| @ -174,7 +174,7 @@ export default struct SignDisplayCom { | ||||
|               Text("改正数次数/改正数大小:" + this.signArr[58] || '0') | ||||
|                 .fontColor('#FFF5E5') | ||||
|                 .fontSize(14 * this.ratio) | ||||
|                 .width('25%') | ||||
|                 .width('30%') | ||||
|                 .textAlign(TextAlign.Start) | ||||
|             }.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio }) | ||||
|           } | ||||
| @ -222,11 +222,10 @@ export default struct SignDisplayCom { | ||||
|               Text('纬度:' + this.signArr[96]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) | ||||
|               Text('速度:' + this.signArr[97]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) | ||||
|             } | ||||
|             // .backgroundColor('red') | ||||
|             .backgroundColor('#1A1A1A') | ||||
|             // .width(180 * this.ratio) | ||||
|             .width(138 * this.ratio) | ||||
|             .height(300 * this.ratio) | ||||
|             .position({ y: 0 * this.ratio, x: 700 * this.ratio }) | ||||
|             .position({ y: 0 * this.ratio, x: 750 * this.ratio }) | ||||
|           }.backgroundColor('#282828').width(this.ratio * 890).height(308 * this.ratio).margin({ top: 3 * this.ratio }) | ||||
|         } | ||||
|         .width(936 * this.ratio) | ||||
| @ -237,26 +236,6 @@ export default struct SignDisplayCom { | ||||
|         .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|         .visibility(this.active == 0 ? Visibility.Visible : Visibility.None) | ||||
| 
 | ||||
|         Column() { | ||||
|           Column() { | ||||
|             Text(this.msg) | ||||
|               .fontColor('#FFF5E5') | ||||
|               .fontSize(14 * this.ratio) | ||||
|           } | ||||
|           .backgroundColor('#282828') | ||||
|           .width(this.ratio * 890) | ||||
|           .height(436 * this.ratio) | ||||
|           .margin({ left: 0 * this.ratio, top: 15 * this.ratio }) | ||||
| 
 | ||||
|         } | ||||
|         .width(936 * this.ratio) | ||||
|         .height(480 * this.ratio) | ||||
|         .margin({ left: 10 * this.ratio }) | ||||
|         .padding({ left: 10 * this.ratio, right: 10 * this.ratio }) | ||||
|         .backgroundImage($r('app.media.km_open')) | ||||
|         .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|         .visibility(this.active == 2 ? Visibility.Visible : Visibility.None) | ||||
| 
 | ||||
|         Row() { | ||||
|           Flex({ direction: FlexDirection.Column }) { | ||||
|             Row() { | ||||
| @ -328,7 +307,7 @@ export default struct SignDisplayCom { | ||||
| 
 | ||||
|     if (showBack) { | ||||
|       this.ratio = 1.4 | ||||
|       globalThis.udpClient.onMessage_1 && globalThis.udpClient.onMessage_1((msg) => { | ||||
|       globalThis.udpClient.onMessage_1((msg) => { | ||||
|         console.log('msgmsg', msg) | ||||
|         if (msg) { | ||||
|           getSignal(msg) | ||||
| @ -353,7 +332,7 @@ export default struct SignDisplayCom { | ||||
|     const that = this | ||||
|     const showBack = this.showBack; | ||||
|     if (showBack) { | ||||
|       globalThis.udpClient.onMessage_1 && globalThis.udpClient.onMessage_1((msg) => { | ||||
|       globalThis.udpClient.onMessage_1((msg) => { | ||||
|         getSignal(msg) | ||||
|       }) | ||||
|     } else { | ||||
|  | ||||
| @ -554,7 +554,7 @@ export default struct DeductedPopup { | ||||
|       } | ||||
|       .width(1300) | ||||
|       .height(710) | ||||
|       .position({ x: '15%', y: '10%' }) | ||||
|       .position({ x: '10%', y: '10%' }) | ||||
|       .backgroundColor('#E6E3DF') | ||||
|       .padding({ top: 15, bottom: 15, left: 25, right: 25 }) | ||||
|       .borderRadius(20) | ||||
|  | ||||
| @ -36,6 +36,9 @@ export default struct  DeductedPopup { | ||||
|     //@ts-ignore | ||||
|     this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno) || this.currentItems.includes(item.itemno + ''))); | ||||
|     this.currentIndex = this.defaultTabIndex | ||||
|     if(this.currentIndex == 1){ | ||||
|       this.universalMarkRules = this.markRules.filter(item => item.itemno == 20 ) | ||||
|     } | ||||
| 
 | ||||
|   } | ||||
|   //上一页 下一页 | ||||
|  | ||||
| @ -106,6 +106,7 @@ export default class Judge { | ||||
|       name, lsh, idCard | ||||
|     }); | ||||
|     this.fileLog = fileLog; | ||||
|     this.filePath = filePath; | ||||
| 
 | ||||
|     const {getJudgeBeginData,handleUdp,fileUtil,handleTrajectoryUdp,isTrajectoryOpen,trajectoryPath,avPlayer} = this; | ||||
|     const isJudgeInitBool = globalThis.isJudgeInitBool; | ||||
| @ -170,7 +171,9 @@ export default class Judge { | ||||
|       return | ||||
|     } | ||||
|     // 处理实时udp里的plc信号
 | ||||
|     // globalThis.udpClient.closeMessage_1();
 | ||||
|     globalThis.udpClient.onMessage_1(async (msg) => { | ||||
|       console.info('socketTag[PLC.UdpClient]', '收到udp回调数据') | ||||
|       handleUdp(msg) | ||||
|     }) | ||||
|   } | ||||
| @ -321,7 +324,6 @@ export default class Judge { | ||||
|     //项目结束
 | ||||
|       case 2: | ||||
|         judgeUI.projectsObj[xmdm].type = (xmjs.xmhg === 0 ? '4' : '3'); | ||||
| 
 | ||||
|       //计算项目是否全部结束
 | ||||
|         this.judgeUI.isProjectIn = (Reflect.ownKeys(judgeUI.projectsObj).filter( | ||||
|           projectKey => judgeUI.projectsObj[projectKey].type == '2').length | ||||
| @ -387,7 +389,6 @@ export default class Judge { | ||||
|       case 9: | ||||
|         this.judgeUI.lane = lane | ||||
|         this.lane = lane; | ||||
|         console.info(judgeTag + 'lane', JSON.stringify(lane)) | ||||
|         break; | ||||
| 
 | ||||
|       default: | ||||
| @ -443,19 +444,19 @@ export default class Judge { | ||||
|         } | ||||
|       //项目已考不上传监管信息
 | ||||
|         if (!isEnd) { | ||||
|           await judgeTask.addTask(async () => { | ||||
|            judgeTask.addTask(async () => { | ||||
|             console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) | ||||
|             await beginProject(xmdm) | ||||
|           }, { | ||||
|             isDelay: true | ||||
|           }) | ||||
| 
 | ||||
|           await judgeTask.addTask(async () => { | ||||
|             console.info(judgeTag, '上传照片 start') | ||||
|            judgeTask.addTask(async () => { | ||||
|             console.info(judgeTag, `项目-${xmdm}-上传照片 start`) | ||||
|             await uploadProgressPhoto(xmdm) | ||||
|           }, { | ||||
|             isDelay: true | ||||
|           }) | ||||
|           this.judgeUI.projectsObj[xmdm].isUpload = true; | ||||
|         } | ||||
|         break; | ||||
| 
 | ||||
| @ -467,18 +468,19 @@ export default class Judge { | ||||
|         if (!ignoreVoiceCodeArr.includes(endCode) && examSubject == 3) { | ||||
|           endKmCode && avPlayer.playAudio([`voice/${endKmCode}.mp3`]) | ||||
|         } | ||||
| 
 | ||||
|         const isStart = await checkProjectIsStart(xmdm,1); | ||||
|         if(isStart){ | ||||
|           //项目结束了就不再生成数据
 | ||||
|           console.info(judgeTag + ' projectIsEnd =>',projectIsEnd) | ||||
|           if (!projectIsEnd) { | ||||
|             await judgeTask.addTask(async () => { | ||||
|             judgeTask.addTask(async () => { | ||||
|               console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`) | ||||
|               await endProject(xmdm); | ||||
|             }, { | ||||
|               isDelay: true | ||||
|             }) | ||||
|           } | ||||
| 
 | ||||
|         } | ||||
|         judgeUI.projectsObj[xmdm].isEnd = true; | ||||
|         break; | ||||
| @ -487,14 +489,16 @@ export default class Judge { | ||||
|     // 扣分
 | ||||
|       case 3: | ||||
|       //扣分时实时播报语音(0-否+1-是)
 | ||||
|         const currentKf = kf[kfLen -1]; | ||||
|         if (judgeConfigObj['418'] == '1' || judgeConfig.kfVoiceOpen) { | ||||
|           avPlayer.playAudio([`voice/${kf[kfLen -1].markcatalog}.mp3`]) | ||||
|           avPlayer.playAudio([`voice/${currentKf.markcatalog}.mp3`]) | ||||
|         } | ||||
|         const isStart = await checkProjectIsStart(xmdm,2,kf[kfLen -1]); | ||||
|         const isStart = await checkProjectIsStart(currentKf.xmdm,2,currentKf); | ||||
|         console.info(judgeTag + '扣分 isStart=>',isStart) | ||||
|         if(isStart){ | ||||
|           await judgeTask.addTask(async () => { | ||||
|             console.info(judgeTag, `项目扣分-${kf[kfLen -1].markcatalog}-${kf[kfLen -1].desc}`) | ||||
|             await pointsDedute(kf[kfLen -1].xmdm, kf[kfLen -1]) | ||||
|             console.info(judgeTag, `项目扣分-${currentKf.markcatalog}-${currentKf.desc}`) | ||||
|             await pointsDedute(currentKf.xmdm, currentKf) | ||||
|           }, { | ||||
|             isDelay: true | ||||
|           }) | ||||
| @ -508,7 +512,7 @@ export default class Judge { | ||||
|     // 考试结束
 | ||||
|       case 5: | ||||
|         console.info(judgeTag, '考试结束') | ||||
|         await judgeTask.addTask(async () => { | ||||
|         judgeTask.addTask(async () => { | ||||
|           console.info(judgeTag, '考试结束 start') | ||||
|           globalThis.isJudge = false; | ||||
|           await handEndExam(ksjs) | ||||
| @ -519,29 +523,31 @@ export default class Judge { | ||||
|         break | ||||
|     } | ||||
|     if (event == 2 || event == 3) { | ||||
|       //科目三统计必考数量
 | ||||
|       await this.setCountItems(); | ||||
|       await checkExamIsEnd() | ||||
|       setTimeout(() => { | ||||
|         console.info(judgeTag,'滚动开始') | ||||
|         this.judgeUI.kfArrScroller.scrollTo({ | ||||
|           yOffset: 999999, xOffset: 0 | ||||
|         }) | ||||
|         console.info(judgeTag, '发生滚动') | ||||
|       }) | ||||
|         console.info(judgeTag,'滚动结束') | ||||
|       },500) | ||||
|       //科目三统计必考数量
 | ||||
|       await this.setCountItems(); | ||||
|       await checkExamIsEnd() | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   // 检测扣分、结束项目时该项目是否开始
 | ||||
|   checkProjectIsStart = async(xmdm,currentType:1|2,kf?:KF) => { | ||||
|     if(xmdm == 20){ | ||||
|       return | ||||
|       return true | ||||
|     } | ||||
|     const {judgeTask,beginProject,pointsDedute,uploadProgressPhoto,endProject,checkExamIsEnd} = this; | ||||
|     const {projectsObj} = this.judgeUI | ||||
|     const type = projectsObj[xmdm].type; | ||||
| 
 | ||||
|     console.info(judgeTag + ' projectsObj=> ',JSON.stringify(projectsObj)) | ||||
|     const {isUpload} = projectsObj[xmdm]; | ||||
|     console.info(judgeTag + ' projectsObj[xmdm] => ',JSON.stringify(projectsObj[xmdm])) | ||||
|     //如果项目没有开始
 | ||||
|     if(type == 1){ | ||||
|     if(!isUpload){ | ||||
|       console.info(judgeTag,'项目补传开始') | ||||
|       //项目开始补传
 | ||||
|       judgeTask.addTask(async ()=>{await beginProject(xmdm)},{isDelay:true}) | ||||
| @ -555,7 +561,6 @@ export default class Judge { | ||||
|         this.judgeUI.projectsObj[xmdm].isEnd = true; | ||||
|         checkExamIsEnd() | ||||
|       }) | ||||
| 
 | ||||
|       return false; | ||||
|     }else{ | ||||
|       return true | ||||
| @ -566,7 +571,7 @@ export default class Judge { | ||||
|   beginProject = async (ksxm) => { | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const { examSubject,plateNo } = carInfo; | ||||
|     const {judgeUI,fileLog,getSbbm,xmxh} = this; | ||||
|     const {judgeUI,fileLog,getSbbm,xmxh,filePath} = this; | ||||
|     const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,ksxl} = judgeUI | ||||
|     const time = await getCurrentTime(); | ||||
|     const project = projectsObj[ksxm] | ||||
| @ -589,19 +594,20 @@ export default class Judge { | ||||
|         kssj: time | ||||
|       } | ||||
|     } | ||||
|     const code = await writeObjectOut(data) | ||||
|     const code = await writeObjectOut(data,filePath) | ||||
|     console.info(judgeTag, '项目开始 end') | ||||
|     if (code === 2300007) { | ||||
|       this.isJudgeDisConnect = true; | ||||
|     } | ||||
|     promptWxCode('17C52', code) | ||||
|   } | ||||
| 
 | ||||
|   // 项目结束接口同步
 | ||||
|   endProject = async (ksxm) => { | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const deviceNo = globalThis.deviceNo; | ||||
|     const { examSubject,plateNo,carNo } = carInfo; | ||||
|     const {judgeUI,fileLog,getSbxh,xmxh,getSbbm} = this; | ||||
|     const {judgeUI,fileLog,getSbxh,xmxh,getSbbm,filePath} = this; | ||||
|     const {lsh,idCard,serialNumber,projectsObj,cdsbInfoObj,ksdd,kslx,ksxl,} = judgeUI | ||||
|     const time = await getCurrentTime(); | ||||
|     const project = projectsObj[ksxm] | ||||
| @ -624,19 +630,20 @@ export default class Judge { | ||||
|         jssj: time | ||||
|       } | ||||
|     } | ||||
|     const code = await writeObjectOut(data) | ||||
|     const code = await writeObjectOut(data,filePath) | ||||
|     if (code === 2300007) { | ||||
|       this.isJudgeDisConnect = true; | ||||
|     } | ||||
|     console.info(judgeTag, '项目结束 end') | ||||
|     promptWxCode('17C55', code) | ||||
|   } | ||||
| 
 | ||||
|   // 考试扣分
 | ||||
|   pointsDedute = async (ksxm, kf) => { | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const deviceNo = globalThis.deviceNo; | ||||
|     const { examSubject,plateNo,carNo } = carInfo; | ||||
|     const {judgeUI,getProjectInfo,fileLog,xmmcSingleCode} = this; | ||||
|     const {judgeUI,getProjectInfo,fileLog,xmmcSingleCode,filePath} = this; | ||||
|     const {lsh,idCard,serialNumber,ksdd} = judgeUI | ||||
|     const time = await getCurrentTime(); | ||||
|     const project = getProjectInfo(ksxm); | ||||
| @ -660,17 +667,18 @@ export default class Judge { | ||||
|         kfsj: time | ||||
|       } | ||||
|     } | ||||
|     const code = await writeObjectOut(data); | ||||
|     const code = await writeObjectOut(data,filePath); | ||||
|     if (code === 2300007) { | ||||
|       this.isJudgeDisConnect = true | ||||
|     } | ||||
|     console.info(judgeTag, '项目扣分 end') | ||||
|     promptWxCode('17C53', code) | ||||
|   } | ||||
| 
 | ||||
|   // 考试过程照片
 | ||||
|   uploadProgressPhoto = async (ksxm) => { | ||||
|     const time = await getCurrentTime(); | ||||
|     const {judgeUI,plcData,getPhoto,fileLog} = this; | ||||
|     const {judgeUI,plcData,getPhoto,fileLog,filePath} = this; | ||||
|     const photoBase64 = await getPhoto(); | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const { examSubject,plateNo,carNo } = carInfo; | ||||
| @ -689,11 +697,11 @@ export default class Judge { | ||||
|         zpsj: time, | ||||
|         //@ts-ignore
 | ||||
|         zp: photoBase64, | ||||
|         cs: Math.ceil(gps.sd * 1.852), | ||||
|         cs: Math.floor(gps.sd * 1.852), | ||||
|         ksdd: encodeURI(ksdd) | ||||
|       } | ||||
|     }; | ||||
|     const code = await writeObjectOut(data); | ||||
|     const code = await writeObjectOut(data,filePath); | ||||
|     if (code === 2300007) { | ||||
|       this.isJudgeDisConnect = true | ||||
|     } | ||||
| @ -707,9 +715,8 @@ export default class Judge { | ||||
|     const {xmdm,code,type} = sound; | ||||
|     //判断是不是模拟灯光语音
 | ||||
|     if (type == 1) { | ||||
|       console.info(judgeTag, '模拟灯光开始播放:' + code) | ||||
|       // console.info(judgeTag, '模拟灯光开始播放:' + code)
 | ||||
|     } | ||||
|     console.info(judgeTag, '语音播放代码:' + code) | ||||
|     avPlayer.playAudio([`voice/${code}.mp3`], false, () => { | ||||
|       if (type == 1) { | ||||
|         console.info(judgeTag, '播放结束:' + code) | ||||
| @ -728,14 +735,14 @@ export default class Judge { | ||||
| 
 | ||||
|   // 校验考试是否结束
 | ||||
|   checkExamIsEnd = async (isManual?: boolean) => { | ||||
|     const {judgeUI,avPlayer,isExamEnd} = this; | ||||
|     const {isAllProjectsEnd,examSubject,singlePlay,totalScore,judgeConfigObj,jl,examMileage} = judgeUI; | ||||
|     const {judgeUI,avPlayer,isExamEnd,} = this; | ||||
|     const {isAllProjectsEnd,examSubject,singlePlay,totalScore,judgeConfigObj,passingScore} = judgeUI; | ||||
| 
 | ||||
|     if (isExamEnd) { | ||||
|       return | ||||
|     } | ||||
|     //及格分
 | ||||
|     let passingGrade = examSubject == 2 ? 80 : 90 | ||||
|     let passingGrade = passingScore | ||||
|     if (isManual) { | ||||
|       if (isAllProjectsEnd) { | ||||
|         // 考试合格
 | ||||
| @ -754,7 +761,7 @@ export default class Judge { | ||||
|     } else { | ||||
|       //单机模式
 | ||||
|       if (singlePlay) { | ||||
|         console.info(judgeTag + ' isAllProjectsEnd',isAllProjectsEnd) | ||||
|         console.info(judgeTag + ' isAllProjectsEnd => ',isAllProjectsEnd) | ||||
|         if (isAllProjectsEnd) { | ||||
|           await examJudgeEndExam() | ||||
|           this.isExamEnd = true | ||||
| @ -786,9 +793,11 @@ export default class Judge { | ||||
|   public handEndExam = async (ksjs: KSJS) => { | ||||
|     this.judgeUI.loadingPopupVisible = true; | ||||
|     this.judgeUI.endPopupVisible = false; | ||||
|     this.judgeUI.isDeductedPopShow = false; | ||||
| 
 | ||||
|     const {qjjl,dcjl} = ksjs | ||||
|     const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual} = this; | ||||
|     const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,projectsObj} = judgeUI; | ||||
|     const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,passingScore} = judgeUI; | ||||
|     //计算考试分数
 | ||||
|     this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0; | ||||
|     const singlePlay = globalThis.singlePlay | ||||
| @ -796,7 +805,7 @@ export default class Judge { | ||||
|     globalThis.windowClass.setWindowSystemBarEnable(['navigation']) | ||||
| 
 | ||||
|     //自动退出待验证并且不合格
 | ||||
|     if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && totalScore < 90) { | ||||
|     if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && totalScore < passingScore) { | ||||
|       avPlayer.playAudio([`voice/考试结束.mp3`]) | ||||
|     } | ||||
| 
 | ||||
| @ -810,8 +819,7 @@ export default class Judge { | ||||
| 
 | ||||
|     if (examSubject == 3) { | ||||
|       const param302 = judgeConfigObj['302']; | ||||
|       //TODO 分数待修改从sysset表里获取
 | ||||
|       if (totalScore < 90) { | ||||
|       if (totalScore < passingScore) { | ||||
|         //考试不合格;考试模式,自动退出;
 | ||||
|         if (param302 == 4 || param302 == 5 || param302 == 7 || param302 == 8) { | ||||
|         } | ||||
| @ -844,8 +852,8 @@ export default class Judge { | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const singlePlay = globalThis.singlePlay | ||||
|     const { examSubject ,plateNo} = carInfo; | ||||
|     const {judgeUI,ksjs,getPhoto,uploadProgressData,uploadDisConnectData,avPlayer,kfArr,judgeTask} = this; | ||||
|     const {lsh,idCard,serialNumber,kssycs,totalScore,judgeConfigObj,isAllProjectsEnd} = judgeUI | ||||
|     const {judgeUI,ksjs,getPhoto,uploadProgressData,uploadDisConnectData,avPlayer,kfArr,judgeTask,filePath} = this; | ||||
|     const {lsh,idCard,serialNumber,kssycs,totalScore,judgeConfigObj,isAllProjectsEnd,passingScore} = judgeUI | ||||
|     await uploadDisConnectData(); | ||||
|     const time = await getCurrentTime(); | ||||
|     const photoBase64 = await getPhoto(); | ||||
| @ -865,22 +873,20 @@ export default class Judge { | ||||
|         dwlc: '', | ||||
|       } | ||||
|     } | ||||
|     const code = await writeObjectOut(data); | ||||
|     const code = await writeObjectOut(data,filePath); | ||||
|     promptWxCode('17C56', code) | ||||
|     console.info(judgeTag, '考试结束 end') | ||||
|     let noPassExitVoice = '' | ||||
|     const param302 = judgeConfigObj['302']; | ||||
| 
 | ||||
|     judgeUI.loadingPopupVisible = true; | ||||
| 
 | ||||
|     let voiceURL = '' | ||||
|     if (examSubject == 2) { | ||||
|       voiceURL = (totalScore < 80 ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') | ||||
|       voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') | ||||
|     } | ||||
| 
 | ||||
|     if (examSubject == 3) { | ||||
|       if (isAllProjectsEnd) { | ||||
|         if (totalScore < 90) { | ||||
|         if (totalScore < passingScore) { | ||||
|           voiceURL = `voice/${kssycs == 1 ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3` | ||||
|         } else { | ||||
|           voiceURL = 'voice/exam_pass.mp3' | ||||
| @ -900,7 +906,6 @@ export default class Judge { | ||||
|         try { | ||||
|           kfArr.forEach((kf, index) => { | ||||
|             score += Math.abs(Number(kf.score)); | ||||
|             console.info(judgeTag + 'score=>', score) | ||||
|             //TODO 考试分数待替换
 | ||||
|             if (score <= (examSubject == 3 ? 10 : 20)) { | ||||
|               if (kfArr.length - 1 === index) { | ||||
| @ -1221,7 +1226,7 @@ export default class Judge { | ||||
|       usbService.sendUSB(str) | ||||
|     } | ||||
|     this.judgeUI.isDwztRight = plcData.gps.dwzt == 4; | ||||
|     this.judgeUI.sd = (Math.floor(plcData.gps.sd as number) || 0) + ''; | ||||
|     this.judgeUI.sd = (Math.floor((plcData.gps.sd as number) || 0) * 1.852)  + ''; | ||||
|     this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' | ||||
|     await examJudgeRealExam(plcData) | ||||
|     const udpIndex = globalThis.udpIndex; | ||||
| @ -1276,19 +1281,19 @@ export default class Judge { | ||||
|     const {fileLog,setJudgeItem,setJudgeMark,endExam} = this; | ||||
|     let num = 2; | ||||
|     const judgeTimer = setInterval(async () => { | ||||
|       const msg = JSON.parse(strArr[num]); | ||||
|       await fileLog.setExamJudgeData(msg) | ||||
|       if (!msg) { | ||||
|       const msgStr = strArr[num]; | ||||
|       if(msgStr == ''){ | ||||
|         console.info(judgeTag, '模拟数据考试结束') | ||||
|         examJudgeEndExam(); | ||||
|         globalThis.windowClass.setWindowSystemBarEnable(['navigation']) | ||||
|         clearInterval(judgeTimer) | ||||
|         this.checkExamIsEnd(true) | ||||
|         return | ||||
|       } | ||||
|       const msg = JSON.parse(strArr[num]); | ||||
|       // 4.过程数据
 | ||||
|       this.tempData = msg | ||||
|       this.judgeUI.isDwztRight = msg?.gps?.dwzt == 4; | ||||
|       this.judgeUI.sd = Math.floor(msg?.gps?.sd) + ''; | ||||
|       this.judgeUI.sd = Math.floor(msg?.gps?.sd) * 1.852 + ''; | ||||
|       this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + '' | ||||
|       this.plcData = msg | ||||
|       // this.judgeUI.isDwztRight = msg.gps.dwzt == 4;
 | ||||
| @ -1301,7 +1306,7 @@ export default class Judge { | ||||
|       } | ||||
|       await examJudgeRealExam(msg) | ||||
|       num++ | ||||
|     }, 50) | ||||
|     }, 200) | ||||
|     globalThis.judgeTimer = judgeTimer; | ||||
|   } | ||||
|   // 统计必考项目、所有项目、已考数量
 | ||||
| @ -1347,6 +1352,7 @@ export default class Judge { | ||||
|   public plcStr: string | ||||
|   private judgeUI | ||||
|   private fileLog | ||||
|   private filePath | ||||
|   private totalScore: number | ||||
|   private folderPath: string | ||||
|   private modelPath: string | ||||
|  | ||||
| @ -34,7 +34,7 @@ export default class FileLog { | ||||
|     const time = await getCurrentTime() | ||||
|     const date = time.split(' ')[0].split('-').join('_') | ||||
|     const hourTime = time.split(' ')[1].split(':').join('_') | ||||
|     const folderPath = await fileUtil.initFolder(`/logs/${date}/${lsh}_${idCard}_${name}_${date}_${hourTime}`); | ||||
|     const folderPath = await fileUtil.initFolder(`/logs/${date}/${date}_${hourTime}_${lsh}_${idCard}_${name}`); | ||||
|     this.folderPath = folderPath; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| //考试回放开关
 | ||||
| export const judgeConfig = { | ||||
|   //本地目录开关
 | ||||
|   isTrajectoryOpen: false, | ||||
|   isTrajectoryOpen: true, | ||||
|   //是否开启拍照
 | ||||
|   isPhotoOpen: false, | ||||
|   //扣分语音是否强制开启
 | ||||
| @ -14,7 +14,7 @@ export const judgeConfig = { | ||||
|   // 本地模型地址
 | ||||
|   modelPath: 'models/model_enc', | ||||
|   // 济南科目三
 | ||||
|   trajectoryPath: 'logs/2024_07_31/0000000000001_342323199501470011_测试学员1_2024_07_31_10_21_38/judge_exam_data.txt', | ||||
|   trajectoryPath: 'logs/2024_08_01/9999931199729_210601620482055232_蒲秀_2024_08_01_11_52_27/judge_exam_data.txt', | ||||
|   // 杭州科目二
 | ||||
|   // trajectoryPath: 'logs/2024_07_19/0000000000001_342323199501470011_测试学员1_2024_07_19_06_49_12/judge_exam_data.txt',
 | ||||
|   //TODO 济南临时特殊配置
 | ||||
|  | ||||
| @ -86,15 +86,14 @@ class AVPlayer { | ||||
| 
 | ||||
|   // 以下为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例
 | ||||
|   async play(name,callback) { | ||||
|     let isInSD = true | ||||
|     try { | ||||
|       //检查SD中的语音
 | ||||
|       console.info('surenjun name',name) | ||||
|       console.info('surenjun name',name.split('/')[1]) | ||||
|       // console.info('surenjun name',name)
 | ||||
|       // console.info('surenjun name',name.split('/')[1])
 | ||||
|       let playSrc =  await this.queryFile(name.split('/')[1]); | ||||
|       let fdPath = await playSrc.open('r') | ||||
|       let audioPlayer = media.createAudioPlayer() | ||||
|       console.info('surenjun fdPath=>',fdPath) | ||||
|       // console.info('surenjun fdPath=>',fdPath)
 | ||||
|       audioPlayer.on('dataLoad', () => { | ||||
|         this.voiceStatus = 'playing' | ||||
|         audioPlayer.play() | ||||
| @ -114,30 +113,18 @@ class AVPlayer { | ||||
|         audioPlayer.reset() | ||||
|         audioPlayer.src = `fd://${fdPath}` | ||||
|       }) | ||||
| 
 | ||||
| 
 | ||||
|       return | ||||
|     }catch (e){ | ||||
|       console.info('surenjun fdPath=>',JSON.stringify(e)) | ||||
|       isInSD = false; | ||||
|     } | ||||
|     if(!isInSD){ | ||||
|       return | ||||
|     } | ||||
|       //检查SD中的语音
 | ||||
|       this.endCallback = callback | ||||
|       const avPlayer = await media.createAVPlayer(); | ||||
|       this.avPlayer = avPlayer; | ||||
| 
 | ||||
|       return new Promise(async (resolve,reject) => { | ||||
|       let url = '' | ||||
|         await this.setAVPlayerCallback(()=>{ | ||||
|           //@ts-ignore
 | ||||
|           resolve() | ||||
|         }); | ||||
|         try { | ||||
|          url =  await globalThis.context.resourceManager.getRawFd(name); | ||||
|          this.avPlayer.fdSrc = url; | ||||
|           this.avPlayer.fdSrc = await globalThis.context.resourceManager.getRawFd(name); | ||||
|         } catch  (e) { | ||||
|           Prompt.showToast({ | ||||
|             message: `${name}语音文件不存在`, | ||||
| @ -148,7 +135,11 @@ class AVPlayer { | ||||
|       }) | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   async queryFile(displayName): Promise<mediaLibrary.FileAsset> { | ||||
|     return new Promise(async (resolve,reject)=>{ | ||||
|       const mediaLib =  mediaLibrary.getMediaLibrary(globalThis.context); | ||||
|       let ret | ||||
|       let fetchOp = { | ||||
| @ -157,13 +148,14 @@ class AVPlayer { | ||||
|       }; | ||||
|       let fileResult = await mediaLib.getFileAssets(fetchOp); | ||||
|       let retCount = fileResult.getCount(); | ||||
|     console.info('surenjun retCount=>',retCount) | ||||
|       if (retCount > 0) { | ||||
|         ret =  fileResult.getFirstObject(); | ||||
|       return Promise.resolve(ret); | ||||
|         return resolve(ret); | ||||
|       }else{ | ||||
|       return Promise.reject(0); | ||||
|         return reject(false); | ||||
|       } | ||||
|     }) | ||||
| 
 | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user