Compare commits
5 Commits
6abd03b0b8
...
afd3dbd72d
| Author | SHA1 | Date | |
|---|---|---|---|
| afd3dbd72d | |||
| d04828c5b4 | |||
| a2fef1e83a | |||
| 5b43845710 | |||
| e14e3d4fb5 |
@ -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);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -17,12 +17,7 @@ export async function getTCP() {
|
||||
await globalThis.TcpClient.sendMsg('1002') //1002
|
||||
globalThis.TcpClient.onError((val) => {
|
||||
setTimeout(() => {
|
||||
globalThis.TcpClient.sendMsg('1002') //1002
|
||||
if (val) {
|
||||
// const msg=val.substring(5,val.length-1)
|
||||
console.log('socketTag[PLC.UdpClient] status:', globalThis.udpClient.getStatus())
|
||||
globalThis.udpClient?.sendMsg(val)
|
||||
}
|
||||
getTCP()
|
||||
}, 1000)
|
||||
})
|
||||
await globalThis.TcpClient.onMessage((val) => {
|
||||
@ -46,12 +41,8 @@ export async function getTCP() {
|
||||
await globalThis.TcpClient.connectTcp()
|
||||
await globalThis.TcpClient.sendMsg('1002') //1002
|
||||
globalThis.TcpClient.onError((val) => {
|
||||
hilog.info(0x0000, 'testTag', "valvalval2" + JSON.stringify(val));
|
||||
setTimeout(() => {
|
||||
globalThis.TcpClient.sendMsg('1002') //1002
|
||||
if (val && globalThis.udpClient?.sendMsg) {
|
||||
globalThis.udpClient?.sendMsg(val)
|
||||
}
|
||||
getTCP()
|
||||
}, 1000)
|
||||
})
|
||||
await globalThis.TcpClient.onMessage((val) => {
|
||||
|
||||
@ -7,7 +7,7 @@ export async function sendMsg(val) {
|
||||
// globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val)
|
||||
}
|
||||
|
||||
export async function getUDP() {
|
||||
export async function getUDP(errorFlag?) {
|
||||
return new Promise((reslove,reject)=>{
|
||||
getSyncData('IpConfigTable').then((result: Array<any>) => {
|
||||
if (result.length) {
|
||||
@ -19,10 +19,19 @@ export async function getUDP() {
|
||||
globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort)
|
||||
globalThis.udpClient.sendMsg('111', null)
|
||||
globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
|
||||
globalThis.udpClient.onError_Callback(()=>{
|
||||
console.log('getUDPgetUDPgetUDP')
|
||||
getUDP(true)
|
||||
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
|
||||
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
|
||||
}
|
||||
})
|
||||
reslove(`http://${result[0].centerIp}:${result[0].centerPort}`)
|
||||
|
||||
// globalThis.udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
}
|
||||
else {
|
||||
// 未绑定
|
||||
@ -31,11 +40,22 @@ export async function getUDP() {
|
||||
udpClient.bindUdp()
|
||||
udpClient.sendMsg('111')
|
||||
globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
|
||||
// udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
|
||||
globalThis.udpClient = udpClient
|
||||
|
||||
globalThis.udpClient.onMessage_1(()=>{
|
||||
|
||||
})
|
||||
globalThis.udpClient.onError_Callback(()=>{
|
||||
getUDP(true)
|
||||
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
|
||||
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
|
||||
}
|
||||
})
|
||||
// udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
|
||||
getChuankouFn()
|
||||
reslove(`http://${result[0].centerIp}:${result[0].centerPort}`)
|
||||
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -56,7 +76,7 @@ export async function getUDP() {
|
||||
|
||||
}
|
||||
|
||||
export async function getUDP2() {
|
||||
export async function getUDP2(errorFlag?) {
|
||||
console.log(` getUDP2 enter`);
|
||||
getSyncData('IpConfigTable').then(async (result: Array<any>) => {
|
||||
if (result.length) {
|
||||
@ -66,6 +86,12 @@ export async function getUDP2() {
|
||||
globalThis.udpClient2.closeUdp(async () => {
|
||||
setTimeout(() => {
|
||||
globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
|
||||
globalThis.udpClient2.onError_Callback(()=>{
|
||||
getUDP2(true);
|
||||
if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
|
||||
globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
|
||||
}
|
||||
})
|
||||
}, 1000)
|
||||
})
|
||||
}
|
||||
@ -74,27 +100,35 @@ export async function getUDP2() {
|
||||
console.log(` getUDP2 has no udclent and bind `);
|
||||
const udpClient2: UdpClientByCenter = new UdpClientByCenter(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
|
||||
await udpClient2.bindUdp()
|
||||
await udpClient2.onError_Callback()
|
||||
await udpClient2.onMessage_2((val) => {
|
||||
if (val.id == '32') {
|
||||
globalThis.signNum = val.body[1]
|
||||
|
||||
} else if (val.id == '46') {
|
||||
let tmpList = []
|
||||
const str = globalThis.lsh
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
|
||||
}
|
||||
const param = {
|
||||
id: 47,
|
||||
list: tmpList,
|
||||
carNo: globalThis.carInfo.carNo,
|
||||
placeId: globalThis.carInfo.examinationRoomId
|
||||
}
|
||||
globalThis.udpClient2.send(param)
|
||||
await udpClient2.onError_Callback(()=>{
|
||||
getUDP2(true);
|
||||
if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
|
||||
globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
|
||||
}
|
||||
})
|
||||
if(!errorFlag){
|
||||
await udpClient2.onMessage_2((val) => {
|
||||
if (val.id == '32') {
|
||||
globalThis.signNum = val.body[1]
|
||||
|
||||
} else if (val.id == '46') {
|
||||
let tmpList = []
|
||||
const str = globalThis.lsh
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
|
||||
}
|
||||
const param = {
|
||||
id: 47,
|
||||
list: tmpList,
|
||||
carNo: globalThis.carInfo.carNo,
|
||||
placeId: globalThis.carInfo.examinationRoomId
|
||||
}
|
||||
globalThis.udpClient2.send(param)
|
||||
}
|
||||
})
|
||||
}
|
||||
globalThis.udpClient2 = udpClient2
|
||||
|
||||
}
|
||||
} else {
|
||||
globalThis.udpClient2 = {}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import socket from '@ohos.net.socket';
|
||||
import hilog from '@ohos.hilog';
|
||||
import { getTCP } from './GlobalTcp';
|
||||
|
||||
const TAG = 'socketTag[TcpDemo.TcpClient]'
|
||||
|
||||
@ -24,9 +25,7 @@ export default class TcpClient {
|
||||
this.tcp.on('error', err => {
|
||||
console.log(TAG, 'tcpOnerror', JSON.stringify(err))
|
||||
setTimeout(async () => {
|
||||
await this.bindTcp()
|
||||
await this.connectTcp()
|
||||
this.onMessage(callback)
|
||||
getTCP()
|
||||
}, 2000)
|
||||
// this.closeUdp(()=>{
|
||||
// this.bindUdp()
|
||||
|
||||
@ -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,39 +259,54 @@ export default class UdpClientByCenter {
|
||||
|
||||
//plc
|
||||
onMessage_1(callback?) {
|
||||
this.udp&&this.udp.on('message', value => {
|
||||
console.log(TAG, 'udponmessage')
|
||||
// 收到的是ArrayBuffer 需要进行转换解析
|
||||
this.plcUdpError = false
|
||||
if (value) {
|
||||
let dataView = new DataView(value.message)
|
||||
let str = ""
|
||||
for (let i = 0; i < dataView?.byteLength; ++i) {
|
||||
let c = String.fromCharCode(dataView?.getUint8(i))
|
||||
if (c !== "\n") {
|
||||
str += c
|
||||
}
|
||||
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) {
|
||||
let dataView = new DataView(value.message)
|
||||
let str = ""
|
||||
for (let i = 0; i < dataView?.byteLength; ++i) {
|
||||
let c = String.fromCharCode(dataView?.getUint8(i))
|
||||
if (c !== "\n") {
|
||||
str += c
|
||||
}
|
||||
|
||||
console.log(`${TAG} udp on message array buffer:${str}`);
|
||||
let strachArr = str.split(',')
|
||||
if (strachArr[0] != '#DN_GD') {
|
||||
return
|
||||
}
|
||||
console.log(`${TAG} udp222 on message array buffer:${str}`);
|
||||
|
||||
strachArr[28] = globalThis.chuankoMsg || '0'
|
||||
// this.stashFn(str)
|
||||
const newArr = JSON.parse(JSON.stringify(strachArr))
|
||||
// this.stashFn=()=>{}
|
||||
callback && callback(newArr.toString())
|
||||
|
||||
} else {
|
||||
callback && callback('')
|
||||
}
|
||||
console.log('messageTimeEnd')
|
||||
this.testIfUdpConnetced(callback)
|
||||
});
|
||||
|
||||
console.log(`${TAG} udp on message array buffer:${str}`);
|
||||
let strachArr = str.split(',')
|
||||
if (strachArr[0] != '#DN_GD') {
|
||||
return
|
||||
}
|
||||
console.log(`${TAG} udp222 on message array buffer:${str}`);
|
||||
|
||||
strachArr[28] = globalThis.chuankoMsg || '0'
|
||||
// this.stashFn(str)
|
||||
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,7 +18,7 @@ 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','192.168.7.1','8082','255.255.255.0','192.168.7.170','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
|
||||
|
||||
@ -22,7 +22,6 @@ import LoadingPopup from './compontents/judge/LoadingPopup';
|
||||
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
||||
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
||||
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct UserInfo {
|
||||
@ -70,6 +69,7 @@ struct UserInfo {
|
||||
@State numCount: number = 0;
|
||||
@State signNum: number = 0;
|
||||
@State isCanClick: boolean = true;
|
||||
@State updateTimeLimit: boolean = true
|
||||
@State faceFlag: string = '0';
|
||||
@State FaceOpenStatue: string = '0'; //是否开启人脸识别
|
||||
subscriber;
|
||||
@ -386,11 +386,15 @@ struct UserInfo {
|
||||
|
||||
//获取下载考生
|
||||
getExaminationStudentInfoFn() {
|
||||
if (globalThis.singlePlay) {
|
||||
if (globalThis.singlePlay && this.updateTimeLimit) {
|
||||
return
|
||||
}
|
||||
const param = `<getExaminationStudentInfoReq><head><checkCode>${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}</checkCode></head><body><carId>${globalThis.carInfo.carId}</carId><examinationRoomId>${globalThis.carInfo.examinationRoomId}</examinationRoomId><examinerName>${globalThis.username}</examinerName></body></getExaminationStudentInfoReq>`
|
||||
getExaminationStudentInfo(param).then(res => {
|
||||
setTimeout(() => {
|
||||
this.updateTimeLimit = true
|
||||
}, 30000)
|
||||
this.updateTimeLimit = false
|
||||
if (!res) {
|
||||
this.dataList = []
|
||||
this.currentUser = EmptyCandidateObject
|
||||
@ -758,13 +762,7 @@ struct UserInfo {
|
||||
if (!this.currentUser.xm) {
|
||||
return
|
||||
}
|
||||
// if(globalThis.spzdFlag){
|
||||
// promptAction.showToast({
|
||||
// message: '摄像头被遮挡',
|
||||
// duration: 2000
|
||||
// });
|
||||
// return
|
||||
// }
|
||||
|
||||
console.info('surenjun currentUser', JSON.stringify(this.currentUser))
|
||||
if (globalThis.singlePlay) {
|
||||
const {examSubject} = globalThis.carInfo;
|
||||
|
||||
@ -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)
|
||||
@ -236,12 +235,14 @@ export default struct SignDisplayCom {
|
||||
.backgroundImage($r('app.media.km_open'))
|
||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||
.visibility(this.active == 0 ? Visibility.Visible : Visibility.None)
|
||||
|
||||
Column() {
|
||||
Column() {
|
||||
Text(this.msg)
|
||||
Text( this.msg || '0')
|
||||
.fontColor('#FFF5E5')
|
||||
.fontSize(14 * this.ratio)
|
||||
.width('100%')
|
||||
.textAlign(TextAlign.Start)
|
||||
|
||||
}
|
||||
.backgroundColor('#282828')
|
||||
.width(this.ratio * 890)
|
||||
@ -256,7 +257,6 @@ export default struct SignDisplayCom {
|
||||
.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 +328,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 +353,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,56 +113,49 @@ 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;
|
||||
} catch (e) {
|
||||
Prompt.showToast({
|
||||
message: `${name}语音文件不存在`,
|
||||
duration: 4000
|
||||
//检查SD中的语音
|
||||
this.endCallback = callback
|
||||
const avPlayer = await media.createAVPlayer();
|
||||
this.avPlayer = avPlayer;
|
||||
return new Promise(async (resolve,reject) => {
|
||||
await this.setAVPlayerCallback(()=>{
|
||||
//@ts-ignore
|
||||
resolve()
|
||||
});
|
||||
resolve(1)
|
||||
}
|
||||
})
|
||||
try {
|
||||
this.avPlayer.fdSrc = await globalThis.context.resourceManager.getRawFd(name);
|
||||
} catch (e) {
|
||||
Prompt.showToast({
|
||||
message: `${name}语音文件不存在`,
|
||||
duration: 4000
|
||||
});
|
||||
resolve(1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async queryFile(displayName): Promise<mediaLibrary.FileAsset> {
|
||||
const mediaLib = mediaLibrary.getMediaLibrary(globalThis.context);
|
||||
let ret
|
||||
let fetchOp = {
|
||||
selections: `media_type=? AND display_name = ?`,
|
||||
selectionArgs: [`${mediaLibrary.MediaType.AUDIO}`,displayName],
|
||||
};
|
||||
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);
|
||||
}else{
|
||||
return Promise.reject(0);
|
||||
}
|
||||
return new Promise(async (resolve,reject)=>{
|
||||
const mediaLib = mediaLibrary.getMediaLibrary(globalThis.context);
|
||||
let ret
|
||||
let fetchOp = {
|
||||
selections: `media_type=? AND display_name = ?`,
|
||||
selectionArgs: [`${mediaLibrary.MediaType.AUDIO}`,displayName],
|
||||
};
|
||||
let fileResult = await mediaLib.getFileAssets(fetchOp);
|
||||
let retCount = fileResult.getCount();
|
||||
if (retCount > 0) {
|
||||
ret = fileResult.getFirstObject();
|
||||
return resolve(ret);
|
||||
}else{
|
||||
return reject(false);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user