This commit is contained in:
wangzhongjie 2025-07-01 10:42:14 +08:00
commit 0c2715821d
7 changed files with 78 additions and 38 deletions

View File

@ -433,10 +433,11 @@ let fd
const devPath = "/dev/ttyS3" const devPath = "/dev/ttyS3"
function openChuankouFn(callback) { function openChuankouFn(callback) {
console.log('SerialOpen in indexservice, path=' + devPath) getSyncData('ES_CARINFO').then(result => {
const carInfo = result[0] || {};
//自动挡车不读取串口 globalThis.carInfo.kscx = carInfo.kscx
if(globalThis.carInfo && globalThis.carInfo.kscx == 'C1'){ console.info('srj ES_CARINFO=>',JSON.stringify(carInfo))
if(carInfo.kscx == 'C1'){
testNapi.SerialOpenAsync(devPath, (fd) => { testNapi.SerialOpenAsync(devPath, (fd) => {
globalThis.fd = fd; globalThis.fd = fd;
globalThis.num = 0 globalThis.num = 0
@ -446,6 +447,7 @@ function openChuankouFn(callback) {
}); });
}); });
} }
})
} }
function getChuankouFnMsg() { function getChuankouFnMsg() {

View File

@ -3,7 +3,7 @@ import { getSyncData } from '../service/initable';
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import FileUtil from '../../common/utils/File' import FileUtil from '../../common/utils/File'
import { GlobalConfig } from '../../config/index' import { GlobalConfig } from '../../config/index'
const TAG = 'socketTag[TcpDemo.TcpClient]'
export async function getTCP(flag=false) { export async function getTCP(flag=false) {
globalThis.getCloseTcp=true globalThis.getCloseTcp=true
const fileUtil = new FileUtil(globalThis.context) const fileUtil = new FileUtil(globalThis.context)
@ -35,10 +35,16 @@ export async function getTCP(flag=false) {
console.log('ttttttt00') console.log('ttttttt00')
clearInterval(globalThis.intervalSendmsg) clearInterval(globalThis.intervalSendmsg)
globalThis.intervalSendmsg=setInterval(()=>{ globalThis.intervalSendmsg=setInterval(async()=>{
console.log('getCloseTcp',globalThis.carInfo.carNo) console.log('getCloseTcp',globalThis.carInfo.carNo)
if(!globalThis.getCloseTcp){ if(!globalThis.getCloseTcp){
globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
globalThis.tcpStep+=1
if(globalThis.tcpStep>30){
console.log(TAG,'tcp重连开始')
globalThis.tcpStep=0
getTCP()
}
} }
},1000/3) },1000/3)
globalThis.TcpClient.onError((val) => { globalThis.TcpClient.onError((val) => {
@ -68,10 +74,16 @@ export async function getTCP(flag=false) {
console.log('ttttttt12') console.log('ttttttt12')
clearInterval(globalThis.intervalSendmsg) clearInterval(globalThis.intervalSendmsg)
globalThis.intervalSendmsg=setInterval(()=>{ globalThis.intervalSendmsg=setInterval(async()=>{
// console.log('getCloseTcp',globalThis.getCloseTcp) // console.log('getCloseTcp',globalThis.getCloseTcp)
if(!globalThis.getCloseTcp){ if(!globalThis.getCloseTcp){
globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
globalThis.tcpStep+=1
if(globalThis.tcpStep>30){
console.log(TAG,'tcp重连开始')
globalThis.tcpStep=0
getTCP()
}
} }
},1000/3) },1000/3)
globalThis.TcpClient.onError((val) => { globalThis.TcpClient.onError((val) => {

View File

@ -148,13 +148,12 @@ export default class TcpClient {
this.tcpSendNum=0 this.tcpSendNum=0
return return
} }
globalThis.getCloseTcp=true
console.log(`${TAG} TCPsend error ${JSON.stringify(err)}`) console.log(`${TAG} TCPsend error ${JSON.stringify(err)}`)
// this.writeLog({ // this.writeLog({
// time:dateFormat(new Date()), // time:dateFormat(new Date()),
// message: `${TAG} TCPsend error ${JSON.stringify(err)}`, // message: `${TAG} TCPsend error ${JSON.stringify(err)}`,
// }) // })
reslove(false) reject(false)
}); });
}) })
} }
@ -165,6 +164,7 @@ export default class TcpClient {
// time:dateFormat(new Date()), // time:dateFormat(new Date()),
// PLC:`${TAG} Tcponmessage`, // PLC:`${TAG} Tcponmessage`,
// }) // })
globalThis.tcpStep=0
globalThis.tcpUdpError = false globalThis.tcpUdpError = false
if (value) { if (value) {
callback && callback(value.message) callback && callback(value.message)

View File

@ -37,6 +37,8 @@ export default class EntryAbility extends UIAbility {
// this.context // this.context
// Main window is created, set main page for this ability // Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
await tcpUtil.init()
globalThis.tcpStep=0
globalThis.carInfo = {} globalThis.carInfo = {}
globalThis.examinerInfo = {} globalThis.examinerInfo = {}
@ -64,11 +66,15 @@ export default class EntryAbility extends UIAbility {
globalThis.pathDir = this.context.filesDir; globalThis.pathDir = this.context.filesDir;
globalThis.context = this.context; globalThis.context = this.context;
globalThis.isJudgeInitBool = false globalThis.isJudgeInitBool = false
console.info('jiangsong globalThis.pathDir = ' + globalThis.pathDir);
// this.requestPermission(this.context)
// this.featureAbilityAuth()
const windowClass = await windowStage.getMainWindow(); const windowClass = await windowStage.getMainWindow();
globalThis.windowClass = windowClass globalThis.windowClass = windowClass
await windowClass.setWindowLayoutFullScreen(true) // await windowClass.setWindowLayoutFullScreen(true)
await windowClass.setWindowSystemBarEnable([]) // await windowClass.setWindowSystemBarEnable([]) //全屏
await windowClass.setWindowSystemBarEnable(['navigation'])
windowStage.loadContent('pages/Index', (err, data) => { windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) { if (err.code) {

View File

@ -91,6 +91,7 @@ struct UserInfo {
'Param398': '0', //考前上车准备 'Param398': '0', //考前上车准备
'Param835': '0', //考前上车准备 'Param835': '0', //考前上车准备
'Param850': '0', //考前上车准备 'Param850': '0', //考前上车准备
'Param853': '0', //未熄火不能开始考试
} }
@State startExam: boolean = false @State startExam: boolean = false
// 过程照片拍照 // 过程照片拍照
@ -537,6 +538,9 @@ struct UserInfo {
if (sys.v_no === '770') { if (sys.v_no === '770') {
that.systemParam.Param770Str = sys.v_value; that.systemParam.Param770Str = sys.v_value;
} }
if(sys.v_no === '853'){
that.systemParam.Param853 = sys.v_value;
}
if (sys.v_no === '835') { if (sys.v_no === '835') {
that.systemParam.Param835 = sys.v_value; that.systemParam.Param835 = sys.v_value;
} }
@ -946,8 +950,10 @@ struct UserInfo {
const {isCheckFireOpen} = judgeConfig const {isCheckFireOpen} = judgeConfig
const {systemParam,isBoardPrePareSetPopupOpen} = this; const {systemParam,isBoardPrePareSetPopupOpen} = this;
const Param803Str = systemParam.Param803Str const Param803Str = systemParam.Param803Str
if (Param803Str === '') { const Param853Str = systemParam.Param853
if (Param803Str === '' && Param853Str != '1') {
return true return true
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (isCheckFireOpen) { if (isCheckFireOpen) {
@ -963,6 +969,14 @@ struct UserInfo {
const ygd = msgArr[8]; const ygd = msgArr[8];
const ssc = msgArr[13]; const ssc = msgArr[13];
const dw = msgArr[28]; const dw = msgArr[28];
if(Param853Str == '1'){
this.avPlayer.playAudio(['voice/熄火.mp3'])
promptAction.showToast({
message: '请熄火',
duration: 4000
})
reject(false)
}
// 开始考试信号检测 // 开始考试信号检测
if (Param803Str !== '') { if (Param803Str !== '') {
//安全带 //安全带
@ -1482,4 +1496,5 @@ type systemParam = {
'Param398': string, //考前上车准备 'Param398': string, //考前上车准备
'Param835': string, //考前上车准备 'Param835': string, //考前上车准备
'Param850': string, //考前上车准备 'Param850': string, //考前上车准备
'Param853': string, //未熄火不能开始考试
} }

View File

@ -538,14 +538,14 @@ export default class Judge {
// 调代理接口是否断网了 // 调代理接口是否断网了
private isJudgeDisConnect: boolean; private isJudgeDisConnect: boolean;
// 项目开始接口同步 // 项目开始接口同步
beginProject = async (ksxm) => { beginProject = async (ksxm,xmxh?:string) => {
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const { examSubject,plateNo } = carInfo; const { examSubject,plateNo } = carInfo;
const {judgeUI,fileLog,getSbbm,xmxh,filePath} = this; const {judgeUI,fileLog,getSbbm,filePath} = this;
const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,xldm} = judgeUI const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,xldm} = judgeUI
const time = await getCurrentTime(); const time = await getCurrentTime();
const project = projectsObj[ksxm] const project = projectsObj[ksxm]
const sbxh = getSbbm(ksxm, xmxh) const sbxh = getSbbm(ksxm, xmxh || this.xmxh)
const data = { const data = {
//系统类别 接口序列号 接口标识 //系统类别 接口序列号 接口标识
xtlb: '17', jkxlh: serialNumber, jkid: '17C52', xtlb: '17', jkxlh: serialNumber, jkid: '17C52',
@ -572,15 +572,15 @@ export default class Judge {
promptWxCode('17C52', code) promptWxCode('17C52', code)
} }
// 项目结束接口同步 // 项目结束接口同步
endProject = async (ksxm) => { endProject = async (ksxm,xmxh?:string) => {
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const deviceNo = globalThis.deviceNo; const deviceNo = globalThis.deviceNo;
const { examSubject,plateNo,carNo } = carInfo; const { examSubject,plateNo,carNo } = carInfo;
const {judgeUI,fileLog,getSbxh,xmxh,getSbbm,filePath} = this; const {judgeUI,fileLog,getSbxh,getSbbm,filePath} = this;
const {lsh,idCard,serialNumber,projectsObj,cdsbInfoObj,ksdd,kslx,xldm,} = judgeUI const {lsh,idCard,serialNumber,projectsObj,cdsbInfoObj,ksdd,kslx,xldm,} = judgeUI
const time = await getCurrentTime(); const time = await getCurrentTime();
const project = projectsObj[ksxm] const project = projectsObj[ksxm]
const sbxh = examSubject == 3 ? undefined : getSbbm(ksxm, xmxh) const sbxh = examSubject == 3 ? undefined : getSbbm(ksxm, xmxh || this.xmxh)
const data = { const data = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C55', xtlb: '17', jkxlh: serialNumber, jkid: '17C55',
@ -1066,7 +1066,7 @@ export default class Judge {
if (!isEnd) { if (!isEnd) {
judgeTask.addTask(async () => { judgeTask.addTask(async () => {
console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`)
await beginProject(xmdm) await beginProject(xmdm,xmxh)
}, { }, {
isDelay: true isDelay: true
}) })
@ -1095,7 +1095,7 @@ export default class Judge {
if (!projectIsEnd) { if (!projectIsEnd) {
judgeTask.addTask(async () => { judgeTask.addTask(async () => {
console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`) console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`)
await endProject(xmdm); await endProject(xmdm,xmxh)
this.xmmcSingleCode = 0; this.xmmcSingleCode = 0;
this.xmmcEndCode = undefined; this.xmmcEndCode = undefined;
}, { }, {
@ -1714,7 +1714,7 @@ export default class Judge {
// 检测差分状态 // 检测差分状态
checkDwzt = async (type) => { checkDwzt = async (type) => {
const {avPlayer} = this; const {avPlayer} = this;
const judgeConfig = this.judgeUI.judgeConfig; const config499 = this.judgeUI.judgeConfigObj['499'];
switch (type) { switch (type) {
case 0: case 0:
this.judgeUI.isDwztRight = true; this.judgeUI.isDwztRight = true;
@ -1722,10 +1722,17 @@ export default class Judge {
case 1: case 1:
this.judgeUI.dwztErrorVisible = true; this.judgeUI.dwztErrorVisible = true;
clearInterval(this.judgeUI.timer);
clearInterval(globalThis.judgeTimer)
avPlayer.playAudio([`voice/差分状态异常.mp3`], true) avPlayer.playAudio([`voice/差分状态异常.mp3`], true)
setTimeout(() => { setTimeout(() => {
try {
this.checkExamIsEnd(true);
} catch (e) {
this.closeAllFiles()
router.back() router.back()
}, 3000) }
}, config499 * 1000)
break; break;
case 2: case 2:

View File

@ -1,15 +1,13 @@
{ {
"lockfileVersion": 2, "lockfileVersion": 1,
"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/hypium@1.0.6": "@ohos/hypium@1.0.6" "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6"
}, },
"packages": { "packages": {
"@ohos/hypium@1.0.6": { "@ohos/hypium@1.0.6": {
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz", "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
"integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==", "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
"registryType": "ohpm",
"shasum": "3f5fed65372633233264b3447705b0831dfe7ea1"
} }
} }
} }