Compare commits

...

5 Commits

Author SHA1 Message Date
wangzhongjie
98e17164e1 fix: 考试结束 2025-10-15 10:31:18 +08:00
wangzhongjie
0040466703 fix: 参数问题 2025-10-14 17:04:54 +08:00
wangzhongjie
dcb826724e fix: 合并 2025-10-14 16:57:37 +08:00
wangzhongjie
d46a53f37e fix: 过程任务队列 2025-10-14 16:55:14 +08:00
wangzhongjie
e75a2c076f fix: 过程任务队列 2025-10-14 16:52:29 +08:00
21 changed files with 244 additions and 190 deletions

View File

@ -1,5 +1,5 @@
{ {
"lockfileVersion": 1, "lockfileVersion": 2,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {}, "specifiers": {},
"packages": {} "packages": {}

View File

@ -81,3 +81,9 @@ export const LogTag = '[LogWorker]';
// 开始考试,结束考试标志 // 开始考试,结束考试标志
export const StartEndExamTag = '[StartEndExam]'; export const StartEndExamTag = '[StartEndExam]';
// Queue
export const QueueTag = '[Queue]'
// 考试过程数据
export const ExamProcessDataTag = '[ExamProcessData]';

View File

@ -16,7 +16,7 @@ export const JudgeConfig: JudgeConfigType = {
//是否开启拍照 //是否开启拍照
isPhotoOpen: true, isPhotoOpen: true,
//扣分语音是否强制开启 //扣分语音是否强制开启
kfVoiceOpen: true, kfVoiceOpen: false,
//忽略的考试项目 //忽略的考试项目
ignoreProjects: [], ignoreProjects: [],
// 是否忽略考试前熄火、车门检查 // 是否忽略考试前熄火、车门检查

View File

@ -433,6 +433,8 @@ export interface MAPPOINT {
f_gps_e: number, f_gps_e: number,
f_gps_n: number, f_gps_n: number,
passed: number passed: number
X_MCH: string,
} }
export interface MAPITEMPOINTITEM { export interface MAPITEMPOINTITEM {
@ -558,6 +560,7 @@ export interface CAR_INFO {
FLAG: string, FLAG: string,
BK1: string, BK1: string,
BK2: string BK2: string
X_MCH: string,
} }
export interface KmItem { export interface KmItem {
@ -815,7 +818,7 @@ export interface DistanceClass {
export interface WR { export interface WR {
message?: string message?: string
code?: number code: string
keystr?: string keystr?: string
} }

View File

@ -0,0 +1,38 @@
/**
* 定义批次进度更新时的回调函数类型
* @param totalTasks 本批次总任务数
* @param completedTasks 已完成任务数 (成功 + 失败)
* @param successfulTasks 成功完成的任务数
* @param failedTasks 失败的任务数
* @param progressPercentage 当前进度百分比 (0-100)
*/
import { RegulatoryInterfaceParams, WR } from '.';
export type OnBatchProgressUpdateCallback = (
totalTasks: number,
completedTasks: number,
successfulTasks: number,
failedTasks: number,
progressPercentage: number
) => void;
/**
* 定义所有任务完成时的回调函数类型
* @param totalTasks 本批次总任务数
* @param completedTasks 已完成任务数 (成功 + 失败)
* @param successfulTasks 成功完成的任务数
* @param failedTasks 失败的任务数
*/
export type OnAllTasksCompletedCallback = (
totalTasks: number,
completedTasks: number,
successfulTasks: number,
failedTasks: number
) => void;
export type ProgressCallback = (data: WR) => void;
export interface QueueTask {
data: RegulatoryInterfaceParams;
callback?: ProgressCallback;
}

View File

@ -248,6 +248,7 @@ export interface ObtainCarExamInfoParams {
//监管接口参数 //监管接口参数
export interface RegulatoryInterfaceParams { export interface RegulatoryInterfaceParams {
JGHOST?: string
xtlb?: string; xtlb?: string;
jkxlh?: string; jkxlh?: string;
jkid?: string; jkid?: string;

View File

@ -20,4 +20,6 @@ export * from "./TableColumn"
export * from "./Other" export * from "./Other"
export * from "./Worker" export * from "./Worker"
export * from "./ProcessData"

View File

@ -23,7 +23,6 @@ import {
LANE, LANE,
MA_CDSBINFOType, MA_CDSBINFOType,
MA_ITEMINFOType, MA_ITEMINFOType,
MA_SYSTEMPARMType,
MAPITEMPOINTITEM, MAPITEMPOINTITEM,
MAPPOINT, MAPPOINT,
MarkRule, MarkRule,
@ -162,6 +161,7 @@ export struct JudgePage {
customStyle: true customStyle: true
}) })
// private judge: Judge = new Judge(this) // private judge: Judge = new Judge(this)
private judgeBusiness = new JudgeBusiness(this)
// 结束考试弹窗 // 结束考试弹窗
endExamDialogController: CustomDialogController = new CustomDialogController({ endExamDialogController: CustomDialogController = new CustomDialogController({
builder: ConfirmDialog({ builder: ConfirmDialog({
@ -194,10 +194,9 @@ export struct JudgePage {
}), }),
customStyle: true customStyle: true
}) })
private judgeBusiness = new JudgeBusiness(this)
laneSignalChange() { laneSignalChange() {
dConsole.log("车道信号变化1", this.laneSignal) // dConsole.log("车道信号变化1", this.laneSignal)
} }
async aboutToDisappear() { async aboutToDisappear() {
@ -261,6 +260,7 @@ export struct JudgePage {
FLAG: carInfo.flag!, FLAG: carInfo.flag!,
BK1: carInfo.bk1!, BK1: carInfo.bk1!,
BK2: carInfo.bk2!, BK2: carInfo.bk2!,
X_MCH: carInfo.x_mch || "",
}) })
dConsole.info(JudgeTag, 'surenjun =>carinfoArrr', JSON.stringify(this.carinfoArr)) dConsole.info(JudgeTag, 'surenjun =>carinfoArrr', JSON.stringify(this.carinfoArr))
} }

View File

@ -1,5 +1,4 @@
import { import {
CarInfoType,
JudgeBeginObj, JudgeBeginObj,
JudgeCallBackData, JudgeCallBackData,
JudgeConfigObj, JudgeConfigObj,
@ -12,13 +11,14 @@ import {
ProjectInfo, ProjectInfo,
ProjectInfos, ProjectInfos,
SYSTEM_PARAM, SYSTEM_PARAM,
User User,
WR
} from '../../model' } from '../../model'
import JudgeBusiness from './JudgeBusiness' import JudgeBusiness from './JudgeBusiness'
import { JudgePage } from '../Judge' import { JudgePage } from '../Judge'
import VoiceAnnounce from '../judgeSDK/utils/voiceAnnouncements' import VoiceAnnounce from '../judgeSDK/utils/voiceAnnouncements'
import { dConsole } from '../../utils/LogWorker' import { dConsole } from '../../utils/LogWorker'
import { JudgeConfig, JudgeTag } from '../../config' import { ExamProcessDataTag, JudgeConfig, JudgeTag, QueueTag } from '../../config'
import { import {
examJudgeArtificialItem, examJudgeArtificialItem,
examJudgeBeginExam, examJudgeBeginExam,
@ -29,7 +29,7 @@ import {
examJudgeSetRealExamCallback, examJudgeSetRealExamCallback,
examJudgeSoundEnd examJudgeSoundEnd
} from './JudgeSDKUtils' } from './JudgeSDKUtils'
import { ProjectStart, UploadProgressPhoto } from './ProcessDataProcessing' import { DeductPoints, ProjectEnd, ProjectStart, TheExamIsOver, UploadProgressPhoto } from './ProcessDataProcessing'
import { endRecordVideo, saveStartRecordVideo } from '../../utils/Video' import { endRecordVideo, saveStartRecordVideo } from '../../utils/Video'
import router from '@ohos.router' import router from '@ohos.router'
import { GetSyncData, UpdateTableByArray } from '../../utils/table/Operation' import { GetSyncData, UpdateTableByArray } from '../../utils/table/Operation'
@ -110,19 +110,31 @@ export class BaseJudge {
} }
}, 200) }, 200)
if (!project.isEnd) { if (!project.isEnd) {
// judgeTask.addTask(async () => {
// console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`)
// await beginProject(xmdm, xmxh)
// }, {
// isDelay: true
// })
// judgeTask.addTask(async () => {
// console.info(judgeTag, `项目-${xmdm}-上传照片 start`)
// await uploadProgressPhoto(xmdm)
// }, {
// isDelay: true
// })
ProjectStart(xmdm, that.xmxh, judgeUI) ProjectStart(xmdm, that.xmxh, judgeUI)
UploadProgressPhoto(xmdm, that.plcData!, judgeUI) UploadProgressPhoto(xmdm, that.plcData!, judgeUI)
} }
break; break;
} }
case 2: { case 2: {
dConsole.log(JudgeTag, "项目结束判定1") dConsole.log(JudgeTag, ExamProcessDataTag, "项目结束判定1")
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm)
const isStart = await this.checkProjectIsStart(xmdm, 2, judgeUI, that) const isStart = await this.checkProjectIsStart(xmdm, 2, judgeUI, that)
if (isStart) { if (isStart) {
// 项目结束了就不再生成数据 // 项目结束了就不再生成数据
dConsole.info(JudgeTag + ' projectIsEnd =>', project.isEnd) dConsole.info(JudgeTag, ExamProcessDataTag, ' 项目是否结束 =>', project.isEnd)
if (!project.isEnd) { if (!project.isEnd) {
// judgeTask.addTask(async () => { // judgeTask.addTask(async () => {
// dConsole.info(JudgeTag, `项目结束-${xmdm}-${project.name}`) // dConsole.info(JudgeTag, `项目结束-${xmdm}-${project.name}`)
@ -132,9 +144,10 @@ export class BaseJudge {
// }, { // }, {
// isDelay: true // isDelay: true
// }) // })
ProjectEnd(xmdm, that.xmxh, judgeUI)
} }
} }
dConsole.log(JudgeTag, "项目结束判定3") dConsole.log(JudgeTag, ExamProcessDataTag, "项目结束判定3")
try { try {
const param512: JudgeConfigObj = (Reflect.get(judgeUI.judgeConfigObj, '512') || '').split(','); const param512: JudgeConfigObj = (Reflect.get(judgeUI.judgeConfigObj, '512') || '').split(',');
if (!judgeUI.isProjectIn) { if (!judgeUI.isProjectIn) {
@ -164,16 +177,24 @@ export class BaseJudge {
// }, { // }, {
// isDelay: true // isDelay: true
// }) // })
DeductPoints(Number(currentKf.xmdm), currentKf, that.xmmcEndCode || "", judgeUI)
} }
break break
} }
case 5: { case 5: {
dConsole.log(JudgeTag, "考试结束") dConsole.log(JudgeTag, QueueTag, "考试结束")
const singlePlay = AppStorage.get<boolean>('singlePlay') const singlePlay = AppStorage.get<boolean>('singlePlay')
// 关闭录像 // 关闭录像
if (!singlePlay && that.videoData) { if (!singlePlay && that.videoData) {
await endRecordVideo(that.videoData) await endRecordVideo(that.videoData)
} }
// TODO
// ProcessDataTaskPoolInstance.setOnAllTasksCompletedCallback((data) => {
// if (event === 5) {
// dConsole.log(JudgeTag, QueueTag, "这才是考试结束判定")
// }
// dConsole.log(JudgeTag, QueueTag, "考试结束判断", data)
// })
// judgeTask.addTask(async () => { // judgeTask.addTask(async () => {
// dConsole.info(JudgeTag, '考试结束 start') // dConsole.info(JudgeTag, '考试结束 start')
// AppStorage.setOrCreate('isJudge', false) // AppStorage.setOrCreate('isJudge', false)
@ -356,51 +377,36 @@ export class BaseJudge {
} catch (e) { } catch (e) {
console.info(JudgeTag, JSON.stringify(e)) console.info(JudgeTag, JSON.stringify(e))
} }
TheExamIsOver(judgeUI, that, async (res: WR) => {
dConsole.log(JudgeTag, ExamProcessDataTag, "考试结束接口完成", res)
const code = res.code!.toString()
if (code !== "1") {
that?.avPlayer?.playAudio(['voice/监管失败.mp3'])
judgeUI.errorMsg = decodeURIComponent(res?.message || "")
if (code.toString() === "2300028" || code.toString() === "2300007") {
judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!'
}
judgeUI.generateExamRecordsDialogController.close();
return
} else {
await this.endExam(judgeUI, that)
}
})
await this.endExam(judgeUI, that) await this.endExam(judgeUI, that)
}) })
} }
// 考试结束 Todo // 考试结束 Todo
async endExam(judgeUI: JudgePage, that: JudgeBusiness) { async endExam(judgeUI: JudgePage, that: JudgeBusiness) {
const carInfo: CarInfoType = AppStorage.get("carInfo")!
const singlePlay = judgeUI.singlePlay const singlePlay = judgeUI.singlePlay
//TODO 断网考试结束补传 //TODO 断网考试结束补传
// await uploadDisConnectData(); // await uploadDisConnectData();
// const time = GetCurrentTime();
// const photoBase64 = await getPhoto();
// const {d1,d2,d3,d4,d5} = that.ksjs
// const data = {
// xtlb: '17', jkxlh: serialNumber, jkid: '17C56',
// drvexam: {
// lsh,
// kchp: encodeURI(plateNo),
// kskm: examSubject,
// sfzmhm: idCard,
// //@ts-ignore
// zp: photoBase64,
// jssj: time,
// kscj: (totalScore * 1) > 0 ? totalScore : 0,
// kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100),
// // 1,22;2,560;3,128;4,0;5,0;
// dwlc: [d1, d2, d3, d4, d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`).join(';'),
// }
// }
let backTimeOut = setTimeout(() => { let backTimeOut = setTimeout(() => {
router.back() router.back()
}, 90 * 1000) }, 90 * 1000)
// const {code,keystr,message} = await this.sendWriteObjectOut(data, filePath);
// promptWxCode('17C56', code)
// if (code != 1) {
// that.avPlayer.playAudio(['voice/监管失败.mp3'])
// judgeUI.errorMsg = decodeURIComponent(message)
//
// if (code == 2300028 || code == 2300007) {
// judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!'
// }
// judgeUI.generateExamRecordsDialogController.close();
// return
// }
console.info(JudgeTag, '考试结束 end') console.info(JudgeTag, '考试结束 end')
const param302 = judgeUI.judgeConfigObj.param_302; const param302 = judgeUI.judgeConfigObj.param_302;
let currentKssycs = 0; let currentKssycs = 0;
@ -451,7 +457,6 @@ export class BaseJudge {
case 'voice/exam_pass.mp3': case 'voice/exam_pass.mp3':
currentKssycs = 0; currentKssycs = 0;
break; break;
} }
} }
@ -514,7 +519,7 @@ export class BaseJudge {
} }
const currentProject: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) const currentProject: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm)
if (currentProject.isUpload) { if (!currentProject.isUpload) {
dConsole.info(JudgeTag, '项目补传开始') dConsole.info(JudgeTag, '项目补传开始')
// judgeTask.addTask(async () => { // judgeTask.addTask(async () => {
// await this.beginProject(xmdm) // await this.beginProject(xmdm)
@ -570,7 +575,7 @@ export class BaseJudge {
} }
//日志回调 //日志回调
dConsole.info(JudgeTag, '1.进入评判入口') dConsole.info(JudgeTag, '1.进入评判入口')
await examJudgeSetLogCallback(6, async (level: number, info: string, len: number) => { await examJudgeSetLogCallback(1, async (level: number, info: string, len: number) => {
dConsole.log(JudgeTag, '评判日志:' + info) dConsole.log(JudgeTag, '评判日志:' + info)
dConsole.writeProcessData(ProcessDataEnumType.JudgeLogData, info) dConsole.writeProcessData(ProcessDataEnumType.JudgeLogData, info)
}) })
@ -593,7 +598,7 @@ export class BaseJudge {
await this.judging(strData, callBack, judgeUI, that) await this.judging(strData, callBack, judgeUI, that)
}) })
await examJudgeSetPerformCallback(async (info: string) => { await examJudgeSetPerformCallback(async (info: string) => {
dConsole.info('评判实时数据', info) // dConsole.info('评判实时数据', info)
that.performInfo = JSON.parse(info) that.performInfo = JSON.parse(info)
const jl = Math.floor((that.performInfo!.qjjl + that.performInfo!.dcjl) / 100); const jl = Math.floor((that.performInfo!.qjjl + that.performInfo!.dcjl) / 100);
if (jl > Number(judgeUI.examMileage)) { if (jl > Number(judgeUI.examMileage)) {
@ -735,9 +740,6 @@ export class BaseJudge {
case 5: { case 5: {
dConsole.info(JudgeTag, "考试结束") dConsole.info(JudgeTag, "考试结束")
that.ksjs = ksjs; that.ksjs = ksjs;
// await fileLog?.setExamJudgeData(JSON.stringify({
// method: 'examJudgeEndExam'
// }))
dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify({ dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify({
method: 'examJudgeEndExam' method: 'examJudgeEndExam'
})) }))

View File

@ -1,15 +1,15 @@
/** /**
* 过程数据处理 * 过程数据处理
*/ */
import { ProcessDataTag } from '../../config'; import { ExamProcessDataTag, ProcessDataTag, QueueTag } from '../../config';
import { import {
CarInfoType, CarInfoType,
CDSBInfo, CDSBInfo,
CDSBInfos, CDSBInfos,
DrvexamType, DrvexamType,
JudgeUI,
MarkRule, MarkRule,
PLCType, PLCType,
ProgressCallback,
ProjectInfo, ProjectInfo,
RegulatoryInterfaceParams RegulatoryInterfaceParams
} from '../../model'; } from '../../model';
@ -17,6 +17,7 @@ import { GetPhotoBase64 } from '../../utils/Common';
import dayTs from '../../utils/Date'; import dayTs from '../../utils/Date';
import { dConsole } from '../../utils/LogWorker'; import { dConsole } from '../../utils/LogWorker';
import { JudgePage } from '../Judge'; import { JudgePage } from '../Judge';
import JudgeBusiness from './JudgeBusiness';
import { ProcessDataTaskPoolInstance } from './ProcessDataTaskPool'; import { ProcessDataTaskPoolInstance } from './ProcessDataTaskPool';
/** /**
@ -39,13 +40,14 @@ export const ProjectStart = (ksxm: number, xmxh: string, judgeUI: JudgePage) =>
kssj: dayTs().format("YYYY-MM-DD HH:mm:ss") kssj: dayTs().format("YYYY-MM-DD HH:mm:ss")
} }
const data: RegulatoryInterfaceParams = { const data: RegulatoryInterfaceParams = {
JGHOST: AppStorage.get<string>("JGHOST") || "",
//系统类别 接口序列号 接口标识 //系统类别 接口序列号 接口标识
xtlb: '17', xtlb: '17',
jkxlh: judgeUI.serialNumber, jkxlh: judgeUI.serialNumber,
jkid: '17C52', jkid: '17C52',
drvexam drvexam
} }
dConsole.log(ProcessDataTag, "项目开始数据处理", data) dConsole.log(ProcessDataTag, QueueTag, ExamProcessDataTag, "项目开始数据处理", data)
ProcessDataTaskPoolInstance.addTask(data) ProcessDataTaskPoolInstance.addTask(data)
} }
@ -69,12 +71,13 @@ export const UploadProgressPhoto = async (ksxm: number, plcData: PLCType, judgeU
ksdd: encodeURI(judgeUI.ksdd) ksdd: encodeURI(judgeUI.ksdd)
} }
const data: RegulatoryInterfaceParams = { const data: RegulatoryInterfaceParams = {
JGHOST: AppStorage.get<string>("JGHOST") || "",
xtlb: '17', xtlb: '17',
jkxlh: judgeUI.serialNumber, jkxlh: judgeUI.serialNumber,
jkid: '17C54', jkid: '17C54',
drvexam drvexam
}; };
dConsole.log(ProcessDataTag, "上传过程照片数据处理", data); dConsole.log(ProcessDataTag, QueueTag, ExamProcessDataTag, "上传过程照片数据处理", data);
ProcessDataTaskPoolInstance.addTask(data) ProcessDataTaskPoolInstance.addTask(data)
} }
@ -131,12 +134,13 @@ export const DeductPoints = (ksxm: number, kf: MarkRule, xmmcEndCode: string, ju
kfsj: dayTs().format("YYYY-MM-DD HH:mm:ss"), kfsj: dayTs().format("YYYY-MM-DD HH:mm:ss"),
} }
const data: RegulatoryInterfaceParams = { const data: RegulatoryInterfaceParams = {
JGHOST: AppStorage.get<string>("JGHOST") || "",
xtlb: '17', xtlb: '17',
jkxlh: serialNumber, jkxlh: serialNumber,
jkid: '17C53', jkid: '17C53',
drvexam drvexam
} }
dConsole.log(ProcessDataTag, "扣分上传数据", data) dConsole.log(ProcessDataTag, QueueTag, ExamProcessDataTag, "扣分上传数据", data)
ProcessDataTaskPoolInstance.addTask(data) ProcessDataTaskPoolInstance.addTask(data)
} }
@ -163,14 +167,45 @@ export const ProjectEnd = (ksxm: number, xmxh: string, judgeUI: JudgePage) => {
} }
const data: RegulatoryInterfaceParams = { const data: RegulatoryInterfaceParams = {
xtlb: '17', xtlb: '17',
JGHOST: AppStorage.get<string>("JGHOST") || "",
jkxlh: judgeUI.serialNumber, jkxlh: judgeUI.serialNumber,
jkid: '17C55', jkid: '17C55',
drvexam drvexam
} }
dConsole.log(ProcessDataTag, "结束项目数据", data) dConsole.log(ProcessDataTag, QueueTag, ExamProcessDataTag, "结束项目数据", data)
ProcessDataTaskPoolInstance.addTask(data) ProcessDataTaskPoolInstance.addTask(data)
} }
/**
* 考试结束接口
* @returns
*/
export const TheExamIsOver = async (judgeUI: JudgePage, that: JudgeBusiness, callback: ProgressCallback) => {
const carInfo: CarInfoType = AppStorage.get("carInfo")!
const photoBase64 = await GetPhotoBase64(judgeUI.context);
const ksjs = that.ksjs!
const data: RegulatoryInterfaceParams = {
JGHOST: AppStorage.get<string>("JGHOST") || "",
xtlb: '17',
jkxlh: judgeUI.serialNumber,
jkid: '17C56',
drvexam: {
lsh: judgeUI.lsh,
kchp: encodeURI(carInfo?.plateNo || ""),
kskm: carInfo?.examSubject || "2",
sfzmhm: judgeUI.idCard,
zp: photoBase64,
jssj: dayTs().format("YYYY-MM-DD HH:mm:ss"),
kscj: (judgeUI.totalScore * 1) > 0 ? judgeUI.totalScore : 0,
kslc: Math.ceil(((ksjs?.qjjl! + ksjs?.dcjl!) || 0) / 100),
dwlc: [ksjs.d1, ksjs.d2, ksjs.d3, ksjs.d4, ksjs!.d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`)
.join(';'),
}
}
dConsole.log(ProcessDataTag, QueueTag, ExamProcessDataTag, "考试结束数据", data)
ProcessDataTaskPoolInstance.addTask(data, callback)
}
const getSBXH = (ksxm: number, xmxh: string, cdsbInfoObj: CDSBInfos, projectsObj: object, examSubject: string): string => { const getSBXH = (ksxm: number, xmxh: string, cdsbInfoObj: CDSBInfos, projectsObj: object, examSubject: string): string => {
const project: ProjectInfo = Reflect.get(projectsObj, ksxm); const project: ProjectInfo = Reflect.get(projectsObj, ksxm);

View File

@ -1,42 +1,22 @@
import { ProcessDataEnumType, RegulatoryInterfaceParams, WR, WuxiExamType } from '../../model'; import {
OnAllTasksCompletedCallback,
OnBatchProgressUpdateCallback,
ProcessDataEnumType,
ProgressCallback,
QueueTask,
RegulatoryInterfaceParams,
WR,
WuxiExamType
} from '../../model';
import taskpool from '@ohos.taskpool'; import taskpool from '@ohos.taskpool';
import { dConsole } from '../../utils/LogWorker'; import { QueueTag } from '../../config';
import http from '@ohos.net.http'; import http from '@ohos.net.http';
import Request from '../../utils/Request'; import Request from '../../utils/Request';
import { dConsole } from '../../utils/LogWorker';
/**
* 定义批次进度更新时的回调函数类型
* @param totalTasks 本批次总任务数
* @param completedTasks 已完成任务数 (成功 + 失败)
* @param successfulTasks 成功完成的任务数
* @param failedTasks 失败的任务数
* @param progressPercentage 当前进度百分比 (0-100)
*/
export type OnBatchProgressUpdateCallback = (
totalTasks: number,
completedTasks: number,
successfulTasks: number,
failedTasks: number,
progressPercentage: number
) => void;
/**
* 定义所有任务完成时的回调函数类型
* @param totalTasks 本批次总任务数
* @param completedTasks 已完成任务数 (成功 + 失败)
* @param successfulTasks 成功完成的任务数
* @param failedTasks 失败的任务数
*/
export type OnAllTasksCompletedCallback = (
totalTasks: number,
completedTasks: number,
successfulTasks: number,
failedTasks: number
) => void;
export class ProcessDataTaskPool { export class ProcessDataTaskPool {
private queue: RegulatoryInterfaceParams[] = []; private queue: QueueTask[] = [];
private isProcessing: boolean = false; private isProcessing: boolean = false;
/** 最大重试次数。1次初次尝试 + 5次重试 = 总共6次尝试。 */ /** 最大重试次数。1次初次尝试 + 5次重试 = 总共6次尝试。 */
private readonly maxRetries = 5; private readonly maxRetries = 5;
@ -77,9 +57,9 @@ export class ProcessDataTaskPool {
* 进而影响 `onAllTasksCompletedCallback` 的触发时机和进度计算。 * 进而影响 `onAllTasksCompletedCallback` 的触发时机和进度计算。
* @param dataItem 任务数据 * @param dataItem 任务数据
*/ */
public addTask(dataItem: RegulatoryInterfaceParams): void { public addTask(dataItem: RegulatoryInterfaceParams, callback?: ProgressCallback): void {
console.info(`[Queue] 新任务已添加: ${JSON.stringify(dataItem)},当前队列长度: ${this.queue.length + 1}`); console.info(QueueTag, `新任务已添加: ${JSON.stringify(dataItem)},当前队列长度: ${this.queue.length + 1}`);
this.queue.push(dataItem); // 将任务添加到队尾 this.queue.push({ data: dataItem, callback: callback }); // 将任务添加到队尾
// 每次添加任务,增加当前批次的总任务数 // 每次添加任务,增加当前批次的总任务数
this.totalTasksInCurrentBatch++; this.totalTasksInCurrentBatch++;
@ -92,7 +72,7 @@ export class ProcessDataTaskPool {
*/ */
private triggerProcessing(): void { private triggerProcessing(): void {
if (this.isProcessing) { if (this.isProcessing) {
console.log('[Queue] 处理器正在运行中,新任务将在稍后被处理。'); console.log(QueueTag, '处理器正在运行中,新任务将在稍后被处理。');
return; return;
} }
this.processQueue(); this.processQueue();
@ -100,14 +80,16 @@ export class ProcessDataTaskPool {
private async processQueue(): Promise<void> { private async processQueue(): Promise<void> {
this.isProcessing = true; this.isProcessing = true;
console.log(`[Queue] 启动处理器... 待处理任务数: ${this.queue.length}`); console.log(QueueTag, `启动处理器... 待处理任务数: ${this.queue.length}`);
while (this.queue.length > 0) { while (this.queue.length > 0) {
const taskData = this.queue[0]; // 查看队首任务 const taskData = this.queue[0].data; // 查看队首任务
const callback = this.queue[0].callback || (() => {
});
this.taskStartTime = Date.now(); // 记录任务开始时间 this.taskStartTime = Date.now(); // 记录任务开始时间
try { try {
console.log(`[Queue] 开始处理任务: ${JSON.stringify(taskData)}`); console.log(QueueTag, `开始处理任务: ${JSON.stringify(taskData)}`);
const obj: WuxiExamType = { const obj: WuxiExamType = {
xtlb: taskData.xtlb, xtlb: taskData.xtlb,
@ -119,15 +101,15 @@ export class ProcessDataTaskPool {
}; };
dConsole.writeProcessData(ProcessDataEnumType.WuxiExam, JSON.stringify(obj)); dConsole.writeProcessData(ProcessDataEnumType.WuxiExam, JSON.stringify(obj));
await this.processSingleTaskWithRetries(taskData); await this.processSingleTaskWithRetries(taskData, callback);
// 任务成功 // 任务成功
this.queue.shift(); this.queue.shift();
console.log(`[Queue] ✅ 任务处理成功,已从队列移除。剩余任务: ${this.queue.length}`); console.log(QueueTag, `✅ 任务处理成功,已从队列移除。剩余任务: ${this.queue.length}`);
this.successfulTasksInCurrentBatch++; // 增加成功任务计数 this.successfulTasksInCurrentBatch++; // 增加成功任务计数
} catch (error) { } catch (error) {
// 任务永久失败 // 任务永久失败
console.error(`[Queue] 🔥 任务永久失败: ${(error as Error).message}`); console.error(QueueTag, ` 🔥 任务永久失败: ${(error as Error).message}`);
const failedTask = this.queue.shift(); // 移除失败的任务 const failedTask = this.queue.shift(); // 移除失败的任务
console.error(`[Queue] 失败的任务已被移除: ${JSON.stringify(failedTask)},将继续处理下一个任务。`); console.error(`[Queue] 失败的任务已被移除: ${JSON.stringify(failedTask)},将继续处理下一个任务。`);
this.failedTasksInCurrentBatch++; // 增加失败任务计数 this.failedTasksInCurrentBatch++; // 增加失败任务计数
@ -140,7 +122,7 @@ export class ProcessDataTaskPool {
// 检查是否所有任务都已处理完 // 检查是否所有任务都已处理完
if (this.queue.length === 0 && this.completedTasksInCurrentBatch === this.totalTasksInCurrentBatch) { if (this.queue.length === 0 && this.completedTasksInCurrentBatch === this.totalTasksInCurrentBatch) {
console.log('[Queue] 所有任务处理完毕!'); console.log(QueueTag, ' 所有任务处理完毕!"总数', this.totalTasksInCurrentBatch, "完成的");
this.onAllTasksCompletedCallback?.( this.onAllTasksCompletedCallback?.(
this.totalTasksInCurrentBatch, this.totalTasksInCurrentBatch,
this.completedTasksInCurrentBatch, this.completedTasksInCurrentBatch,
@ -155,14 +137,14 @@ export class ProcessDataTaskPool {
const elapsedTime = Date.now() - this.taskStartTime; const elapsedTime = Date.now() - this.taskStartTime;
if (elapsedTime < this.minProcessingTime) { if (elapsedTime < this.minProcessingTime) {
const delayTime = this.minProcessingTime - elapsedTime; const delayTime = this.minProcessingTime - elapsedTime;
console.log(`[Queue] 任务处理耗时 ${elapsedTime}ms需要延迟 ${delayTime}ms 以满足最小处理时间要求`); console.log(QueueTag, ` 任务处理耗时 ${elapsedTime}ms需要延迟 ${delayTime}ms 以满足最小处理时间要求`);
await this.delay(delayTime); await this.delay(delayTime);
} }
} }
} }
this.isProcessing = false; this.isProcessing = false;
console.log('[Queue] 处理器已停止。'); console.log(QueueTag, ' 处理器已停止。');
} }
/** /**
@ -199,23 +181,22 @@ export class ProcessDataTaskPool {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
private async processSingleTaskWithRetries(taskData: RegulatoryInterfaceParams): Promise<void> { private async processSingleTaskWithRetries(taskData: RegulatoryInterfaceParams, callback: ProgressCallback): Promise<void> {
for (let attempt = 0; attempt <= this.maxRetries; attempt++) { for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
const attemptNum = attempt + 1; const attemptNum = attempt + 1;
try { try {
const attemptType = attempt === 0 ? '初次尝试' : `重试 ${attempt}`; const attemptType = attempt === 0 ? '初次尝试' : `重试 ${attempt}`;
console.log(`[Queue] 开始上传 (${attemptType}, 总共第 ${attemptNum} 次)`); console.log(QueueTag, `开始上传 (${attemptType}, 总共第 ${attemptNum} 次)`);
const result: WR = (await taskpool.execute(uploadWorkerTask, taskData)) as WR; const result: WR = (await taskpool.execute(uploadWorkerTask, taskData)) as WR;
callback(result)
dConsole.writeProcessData(ProcessDataEnumType.WuxiExam, JSON.stringify(result)); dConsole.writeProcessData(ProcessDataEnumType.WuxiExam, JSON.stringify(result));
if (result.code === 1) { if (result.code === "1") {
console.log(`[Queue] ✔️ 上传成功 (在第 ${attemptNum} 次尝试)`); console.log(QueueTag, ` ✔️ 上传成功 (在第 ${attemptNum} 次尝试)`);
return; // 成功,立即返回 return; // 成功,立即返回
} }
console.warn(`[Queue] ❌ 上传失败 (第 ${attemptNum} 次)。响应: ${result.message}`); console.warn(QueueTag, ` ❌ 上传失败 (第 ${attemptNum} 次)。${result.code},响应: ${decodeURIComponent(result.message)}`);
} catch (e) { } catch (e) {
console.error(`[Queue] ❌ TaskPool 执行或网络错误 (第 ${attemptNum} 次): ${e}`); console.error(QueueTag, ` ❌ TaskPool 执行或网络错误 (第 ${attemptNum} 次): ${e}`);
} }
if (attempt === this.maxRetries) { if (attempt === this.maxRetries) {
@ -229,40 +210,39 @@ export class ProcessDataTaskPool {
export const ProcessDataTaskPoolInstance = new ProcessDataTaskPool(); export const ProcessDataTaskPoolInstance = new ProcessDataTaskPool();
@Concurrent
export async function uploadWorkerTask(data: RegulatoryInterfaceParams): Promise<WR> { export async function uploadWorkerTask(data: RegulatoryInterfaceParams): Promise<WR> {
let singlePlay: boolean = false; let singlePlay: boolean = false;
let isJGNew = false; let isJGNew = false;
try { try {
const sendProcessData = async (data: RegulatoryInterfaceParams, singlePlay: boolean, isJGNew: boolean): Promise<WR> => {
if (singlePlay) {
return { code: "1" }
}
if (isJGNew) {
// 调用新监管
}
data.drvexam = data.drvexam ?? {};
if (data.drvexam.zp !== undefined && data.drvexam.zp !== null) {
data.drvexam.zp = encodeURIComponent(data.drvexam.zp);
}
const drvexamArr = Object.entries(data.drvexam)
.filter((item: [string, string]) => item[1] != undefined)
.map((item: [string, object]) => `<${item[0]}>${item[1]}</${item[0]}>`)
return await Request<object>({
host: data.JGHOST,
url: '/dems_ws/services/TmriOutAccess?wsdl',
data: `<?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" > <SOAP-ENV:Body> <writeObjectOut xmlns="http://service.es.doron"> <xtlb>${data.xtlb}</xtlb> <jkxlh>${data.jkxlh}</jkxlh> <jkid>${data.jkid}</jkid> <UTF8XmlDoc> <![CDATA[ <?xm lversion="1.0 "encoding="GBK"?> <root> <drvexam> ${drvexamArr.join('')} </drvexam> </root> ]]> </UTF8XmlDoc> </writeObjectOut> </SOAP-ENV:Body> </SOAP-ENV:Envelope>`,
method: http.RequestMethod.POST,
xml: true
}) as WR
}
const response = await sendProcessData(data, singlePlay, isJGNew); const response = await sendProcessData(data, singlePlay, isJGNew);
return response; return response;
} catch (err) { } catch (err) {
const error = err as Error; const error = err as Error;
console.error(`[Worker] 上传时发生异常: ${error.message}`); console.error(QueueTag, `[Worker] 上传时发生异常: ${error.message}`);
throw error; throw error;
} }
} }
async function sendProcessData(data: RegulatoryInterfaceParams, singlePlay: boolean, isJGNew: boolean): Promise<WR> {
if (singlePlay) {
return { code: 1 }
}
if (isJGNew) {
// 调用新监管
}
data.drvexam = data.drvexam ?? {};
if (data.drvexam.zp !== undefined && data.drvexam.zp !== null) {
data.drvexam.zp = encodeURIComponent(data.drvexam.zp);
}
const drvexamArr = Object.entries(data.drvexam)
.filter((item: [string, string]) => item[1] != undefined)
.map((item: [string, object]) => `<${item[0]}>${item[1]}</${item[0]}>`)
let JGHOST: string = AppStorage.get<string>("JGHOST") || ""
return await Request<object>({
host: JGHOST,
url: '/dems_ws/services/TmriOutAccess?wsdl',
data: `<?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" > <SOAP-ENV:Body> <writeObjectOut xmlns="http://service.es.doron"> <xtlb>${data.xtlb}</xtlb> <jkxlh>${data.jkxlh}</jkxlh> <jkid>${data.jkid}</jkid> <UTF8XmlDoc> <![CDATA[ <?xm lversion="1.0 "encoding="GBK"?> <root> <drvexam> ${drvexamArr.join('')} </drvexam> </root> ]]> </UTF8XmlDoc> </writeObjectOut> </SOAP-ENV:Body> </SOAP-ENV:Envelope>`,
method: http.RequestMethod.POST,
xml: true
})
}

View File

@ -15,43 +15,25 @@ import {
MAPITEMPOINTITEM, MAPITEMPOINTITEM,
MAPPOINT, MAPPOINT,
MarkRule, MarkRule,
ProcessDataEnumType, Project,
ProjectInfo, ProjectInfo,
ProjectInfos,
RouteParamsType, RouteParamsType,
SyssetConfig, SyssetConfig,
SYSTEM_PARAM, SYSTEM_PARAM
Project,
ProjectInfos,
JudgeCallBackData,
KmItem
} from '../../model'; } from '../../model';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import { dConsole } from '../../utils/LogWorker'; import { dConsole } from '../../utils/LogWorker';
import { import { examJudgeVersion } from './JudgeSDKUtils';
examJudgeBeginExam,
examJudgeEndExam,
examJudgeInit,
examJudgeSetLogCallback,
examJudgeSetPerformCallback,
examJudgeSetRealExamCallback,
examJudgeVersion
} from './JudgeSDKUtils';
import JudgeBusiness from './JudgeBusiness'; import JudgeBusiness from './JudgeBusiness';
import { saveStartRecordVideo } from '../../utils/Video';
import router from '@ohos.router'; import router from '@ohos.router';
import { import { GetModelData } from './utils';
CurrentProjectConversion,
DeductionProjectConversion,
DetectingDifferences,
GetCarStatus,
GetModelData
} from './utils';
import { BaseJudge, BaseJudgeImpl, GetSysSetResult } from './BaseJudgeBussines'; import { BaseJudge, BaseJudgeImpl, GetSysSetResult } from './BaseJudgeBussines';
import { GetSyncData } from '../../utils/table/Operation'; import { GetSyncData } from '../../utils/table/Operation';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { JudgePage } from '../Judge'; import { JudgePage } from '../Judge';
import systemDateTime from '@ohos.systemDateTime'; import systemDateTime from '@ohos.systemDateTime';
import { testKm2Items, testKm3Items } from "../../mock/Judge" import { testKm2Items, testKm3Items } from '../../mock/Judge';
export class SmallJudge extends BaseJudge implements BaseJudgeImpl { export class SmallJudge extends BaseJudge implements BaseJudgeImpl {
public async GetJudgeBeginData(projects: Project[], carType: string, kssycs: string, isDdxk: boolean, ddxkTime: number, projectsCenterObj: Object, ddxkKsxmArr: string[], ddxkKfArr: string[], passingScore: number, wayno: number, name: string, lsh: string, idCard: string, isExam: boolean) { public async GetJudgeBeginData(projects: Project[], carType: string, kssycs: string, isDdxk: boolean, ddxkTime: number, projectsCenterObj: Object, ddxkKsxmArr: string[], ddxkKfArr: string[], passingScore: number, wayno: number, name: string, lsh: string, idCard: string, isExam: boolean) {
@ -133,10 +115,11 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl {
} }
//获取版本号 //获取版本号
const mark: MarkRule[] = Reflect.ownKeys(markRuleListObj).map(ruleKey => { // const mark: MarkRule[] = Reflect.ownKeys(markRuleListObj).map(ruleKey => {
const current: MarkRule = Reflect.get(markRuleListObj, ruleKey) // const current: MarkRule = Reflect.get(markRuleListObj, ruleKey)
return current // return current
}) // })
const mark: MarkRule[] = Object.values(markRuleListObj)
const initInfo: JudgeInitObj = { const initInfo: JudgeInitObj = {
sdkver: await examJudgeVersion(), sdkver: await examJudgeVersion(),
appver: AppStorage.get<BaseInfoType>('baseInfo')?.version || "", appver: AppStorage.get<BaseInfoType>('baseInfo')?.version || "",

View File

@ -274,6 +274,7 @@ struct UserInfoPage {
res.id = index.toString() res.id = index.toString()
}) })
await SqlInsertTable("USERLIST", this.list || []) await SqlInsertTable("USERLIST", this.list || [])
} else { } else {
await this.getExaminationStudentInfoFn() await this.getExaminationStudentInfoFn()
} }

View File

@ -13,7 +13,7 @@ class logWorker {
public currentExamCatalog: string = "" public currentExamCatalog: string = ""
private workerInstance: worker.ThreadWorker | null = null; private workerInstance: worker.ThreadWorker | null = null;
// 是否开启日志 1开启 // 是否开启日志 1开启
private isLogEnabled: string = "0"; private isLogEnabled: string = "1";
constructor() { constructor() {
if (logWorker.instance) { if (logWorker.instance) {

View File

@ -145,7 +145,7 @@ type RequestResult = Object | object | string | CenterCodeResult
export default function Request<T extends RequestResult>(options: RequestOption): Promise<T> { export default function Request<T extends RequestResult>(options: RequestOption): Promise<T> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const base: string = AppStorage.get<string>("host") || "http://127.0.0.1" const base: string = options.host ? options.host : AppStorage.get<string>("host") || "http://127.0.0.1"
const instance = http.createHttp() const instance = http.createHttp()
const baseURL = options.host || base const baseURL = options.host || base
console.log(RequestTag, "基础url:", baseURL) console.log(RequestTag, "基础url:", baseURL)

View File

@ -144,7 +144,7 @@ export default class UdpClient {
private bindEvent() { private bindEvent() {
this.udp?.on("message", value => { this.udp?.on("message", value => {
let result = this.dealMethod?.(value.message) let result = this.dealMethod?.(value.message)
console.log(UDPTag, "udp获取消息", result) // console.log(UDPTag, "udp获取消息", result)
this.messageEvents.forEach(cb => { this.messageEvents.forEach(cb => {
cb(result) cb(result)
}) })

View File

@ -72,8 +72,8 @@ class differentialAndSignal {
getMessage() { getMessage() {
this.workerInstance.onmessage = (e: MessageEvents): void => { this.workerInstance.onmessage = (e: MessageEvents): void => {
if (e.data) { if (e.data) {
console.log(WorkerTag, "Worker 收到消息: " + e.data); // console.log(WorkerTag, "Worker 收到消息: " + e.data);
console.log(WorkerTag, "Worker 目前监听数量: " + this.events.length.toString()); // console.log(WorkerTag, "Worker 目前监听数量: " + this.events.length.toString());
this.events.forEach((callback) => { this.events.forEach((callback) => {
callback(e.data); callback(e.data);
}); });

View File

@ -1,6 +1,7 @@
//差分信号 //差分信号
import { TCPTag } from '../../config'; import { TCPTag } from '../../config';
import { EnvironmentConfigurationType } from '../../model'; import { EnvironmentConfigurationType } from '../../model';
import { dConsole } from '../LogWorker';
import TcpClient from '../TcpUtils'; import TcpClient from '../TcpUtils';
class differentialSignal { class differentialSignal {
@ -16,7 +17,7 @@ class differentialSignal {
console.error(TCPTag, "TCP发生错误") console.error(TCPTag, "TCP发生错误")
this.differentialSignalTcp.reBind() this.differentialSignalTcp.reBind()
}) })
console.log(TCPTag, "初始化", JSON.stringify(config)) dConsole.low(TCPTag, "初始化", JSON.stringify(config))
if (config.tcplocalIp || config.tcplocalIpPort || config.tcpOppositeIp || config.tcpOppositePort) { if (config.tcplocalIp || config.tcplocalIpPort || config.tcpOppositeIp || config.tcpOppositePort) {
this.differentialSignalTcp.init(config.tcplocalIp || "", config.tcplocalIpPort || "", config.tcpOppositeIp || "", this.differentialSignalTcp.init(config.tcplocalIp || "", config.tcplocalIpPort || "", config.tcpOppositeIp || "",
config.tcpOppositePort || ""); config.tcpOppositePort || "");
@ -30,7 +31,7 @@ class differentialSignal {
// 组装消息,一秒发送五次 // 组装消息,一秒发送五次
let data = "1"; let data = "1";
this.timer = setInterval(() => { this.timer = setInterval(() => {
console.log(TCPTag, "发送给中心消息") // dConsole.low(TCPTag, "发送给中心消息")
this.differentialSignalTcp.sendMsg(data); this.differentialSignalTcp.sendMsg(data);
}, 200); }, 200);
@ -39,7 +40,7 @@ class differentialSignal {
// 获取消息 // 获取消息
getData(callback: (data: ArrayBuffer) => void) { getData(callback: (data: ArrayBuffer) => void) {
this.differentialSignalTcp.onMsg((data: ArrayBuffer) => { this.differentialSignalTcp.onMsg((data: ArrayBuffer) => {
// console.log(TCPTag, "获取TCP消息", data); // dConsole.low(TCPTag, "获取TCP消息", data);
callback(data); callback(data);
}); });
} }

View File

@ -1,6 +1,6 @@
// 处理worker线程的消息tcp拿差分改正数,udp给后置机 // 处理worker线程的消息tcp拿差分改正数,udp给后置机
import worker, { ErrorEvent, MessageEvents, ThreadWorkerGlobalScope } from '@ohos.worker'; import worker, { ErrorEvent, MessageEvents, ThreadWorkerGlobalScope } from '@ohos.worker';
import { SerialPortTag, WorkerTag } from '../config'; import { WorkerTag } from '../config';
import { import {
CenterCallBackMsgType, CenterCallBackMsgType,
EnvironmentConfigurationType, EnvironmentConfigurationType,
@ -68,17 +68,17 @@ function getDataFn(config: EnvironmentConfigurationType) {
if (data !== "" && config.carType !== "2") { if (data !== "" && config.carType !== "2") {
// TODO // TODO
// 需要观察 // 需要观察
console.log(WorkerTag, "后置机消息", data) // console.log(WorkerTag, "后置机消息", data)
const res = await SerialPortService.getData() const res = await SerialPortService.getData()
console.log(SerialPortTag, "档位原始数据", res) // console.log(SerialPortTag, "档位原始数据", res)
if (res.length > 0) { if (res.length > 0) {
const dataArray = data.split(","); const dataArray = data.split(",");
// 替换data的第28位 // 替换data的第28位
dataArray[28] = res[9].toString(); dataArray[28] = res[9].toString();
data = dataArray.join(","); data = dataArray.join(",");
console.log(SerialPortTag, "档位", res[9].toString()) // console.log(SerialPortTag, "档位", res[9].toString())
} }
console.log(SerialPortTag, "处理完的档位信号", data) // console.log(SerialPortTag, "处理完的档位信号", data)
workerPort.postMessage( workerPort.postMessage(
JSON.stringify({ JSON.stringify({
type: WorkerBackMessageType.ObtainUdpData, type: WorkerBackMessageType.ObtainUdpData,

View File

@ -13,7 +13,7 @@ let fileFdArr: number[] = []
let writeQueue: Array<FileQueueType> = []; let writeQueue: Array<FileQueueType> = [];
let isProcessing = false; let isProcessing = false;
workerPort.onmessage = (e: MessageEvents) => { workerPort.onmessage = (e: MessageEvents) => {
console.log(LogTag, "日志系统worker收到消息") // console.log(LogTag, "日志系统worker收到消息")
// 日志文件目录 // 日志文件目录
let logPaths: LogPathType = { let logPaths: LogPathType = {
log: `${GlobalConfig.commonFileWriteAddress}/logs/${dayTs().format("YYYY_MM_DD")}/log/log.log`, log: `${GlobalConfig.commonFileWriteAddress}/logs/${dayTs().format("YYYY_MM_DD")}/log/log.log`,

View File

@ -1,18 +1,20 @@
{ {
"lockfileVersion": 1, "lockfileVersion": 2,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": { "specifiers": {
"@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3", "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19",
"@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19" "@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3"
}, },
"packages": { "packages": {
"@ohos/crypto-js@2.0.3": {
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har",
"integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ=="
},
"@ohos/hypium@1.0.19": { "@ohos/hypium@1.0.19": {
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har",
"integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==" "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==",
"registryType": "ohpm"
},
"@ohos/crypto-js@2.0.3": {
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har",
"integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==",
"registryType": "ohpm"
} }
} }
} }