fix: 完善Date工具函数 对毫秒的支持,以及完善judge工具函数的完善
This commit is contained in:
parent
f604c1c8f2
commit
11e738bb47
@ -1,4 +1,4 @@
|
|||||||
import { AmplifyItem, PerLane } from '../model';
|
import { AmplifyItem, DefaultJudgeConfigObj, PerLane, PLCType } from '../model';
|
||||||
|
|
||||||
export const AmplifyArr: AmplifyItem[] = [
|
export const AmplifyArr: AmplifyItem[] = [
|
||||||
{ name: '直线', projectCode: '3', projectCodeCenter: '40300' },
|
{ name: '直线', projectCode: '3', projectCodeCenter: '40300' },
|
||||||
@ -46,3 +46,222 @@ export const InitialPerLane: PerLane = {
|
|||||||
ShapeNo: 0,
|
ShapeNo: 0,
|
||||||
CrossPointNo: 0
|
CrossPointNo: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const TestRealExam: PLCType = {
|
||||||
|
sensor: {
|
||||||
|
aqd: 0,
|
||||||
|
mkg: 0,
|
||||||
|
ssc: 0,
|
||||||
|
jsc: 0,
|
||||||
|
fsc: 0,
|
||||||
|
lhq: 0,
|
||||||
|
lb: 0,
|
||||||
|
skd: 0,
|
||||||
|
jgd: 0,
|
||||||
|
ygd: 1,
|
||||||
|
zfxd: 0,
|
||||||
|
yfxd: 0,
|
||||||
|
shtd: 0,
|
||||||
|
wd: 0,
|
||||||
|
ygq: 0,
|
||||||
|
dh1: 1,
|
||||||
|
dh2: 0,
|
||||||
|
fdjzs: 2400,
|
||||||
|
dw: 0,
|
||||||
|
cs: 5.8,
|
||||||
|
fxp: -5,
|
||||||
|
ljmc: 23,
|
||||||
|
lcmc: 0,
|
||||||
|
csbzh: 0,
|
||||||
|
csbyh: 0,
|
||||||
|
csbyq: 0,
|
||||||
|
csbzq: 0,
|
||||||
|
csb1: 3000,
|
||||||
|
csb2: 0,
|
||||||
|
csb3: 0,
|
||||||
|
csb4: 0,
|
||||||
|
zy: 0,
|
||||||
|
tbp: 0,
|
||||||
|
hsj: 0,
|
||||||
|
dcj: 0,
|
||||||
|
gx: 123070,
|
||||||
|
yl: 0
|
||||||
|
},
|
||||||
|
gps: {
|
||||||
|
bklx: 2,
|
||||||
|
dwzt: 4,
|
||||||
|
jdzt: 3,
|
||||||
|
sj: 1680840026000,
|
||||||
|
jd: 113.12345678,
|
||||||
|
wd: 31.12345678,
|
||||||
|
hxj: 50.1234,
|
||||||
|
fyj: 1.1234,
|
||||||
|
hbg: 22.123,
|
||||||
|
gdc: 1.123,
|
||||||
|
sd: 10.9,
|
||||||
|
age: 1.2,
|
||||||
|
jdyz: 0.001,
|
||||||
|
wdyz: 0.001,
|
||||||
|
dwsxs: 17,
|
||||||
|
jdsxs: 14
|
||||||
|
},
|
||||||
|
gps2: {
|
||||||
|
bklx: 1,
|
||||||
|
dwzt: 4,
|
||||||
|
jdzt: 4,
|
||||||
|
sj: 1680840026000,
|
||||||
|
jd: 113.12345678,
|
||||||
|
wd: 31.12345678,
|
||||||
|
hxj: 50.1234,
|
||||||
|
fyj: 1.1234,
|
||||||
|
hbg: 22.123,
|
||||||
|
gdc: 1.123,
|
||||||
|
sd: 10.9,
|
||||||
|
age: 1.2,
|
||||||
|
jdyz: 0.001,
|
||||||
|
wdyz: 0.001,
|
||||||
|
dwsxs: 17,
|
||||||
|
jdsxs: 14
|
||||||
|
},
|
||||||
|
vision: {
|
||||||
|
sj: 1680840026000,
|
||||||
|
score: 0.85,
|
||||||
|
zyjd: 60.23,
|
||||||
|
sxjd: 65.33,
|
||||||
|
ytjd: 68.45,
|
||||||
|
fxp: 2,
|
||||||
|
ch: 0,
|
||||||
|
hld: 1
|
||||||
|
},
|
||||||
|
radar: {
|
||||||
|
sj: 1680840026000,
|
||||||
|
zxh: 999,
|
||||||
|
qfsj: [{
|
||||||
|
bh: 1,
|
||||||
|
lx: 1,
|
||||||
|
jl: 2.35,
|
||||||
|
sd: 3.68
|
||||||
|
}, {
|
||||||
|
bh: 2,
|
||||||
|
lx: 2,
|
||||||
|
jl: 4.82,
|
||||||
|
sd: 5.24
|
||||||
|
}],
|
||||||
|
hfsj: [{
|
||||||
|
bh: 1,
|
||||||
|
lx: 1,
|
||||||
|
jl: 2.35,
|
||||||
|
sd: 3.68
|
||||||
|
}, {
|
||||||
|
bh: 2,
|
||||||
|
lx: 2,
|
||||||
|
jl: 4.82,
|
||||||
|
sd: 5.24
|
||||||
|
}],
|
||||||
|
zqsj: [{
|
||||||
|
bh: 1,
|
||||||
|
lx: 1,
|
||||||
|
jl: 2.35,
|
||||||
|
sd: 3.68
|
||||||
|
}, {
|
||||||
|
bh: 2,
|
||||||
|
lx: 2,
|
||||||
|
jl: 4.82,
|
||||||
|
sd: 5.24
|
||||||
|
}],
|
||||||
|
zhsj: [{
|
||||||
|
bh: 1,
|
||||||
|
lx: 1,
|
||||||
|
jl: 2.35,
|
||||||
|
sd: 3.68
|
||||||
|
}, {
|
||||||
|
bh: 2,
|
||||||
|
lx: 2,
|
||||||
|
jl: 4.82,
|
||||||
|
sd: 5.24
|
||||||
|
}],
|
||||||
|
zcsj: [{
|
||||||
|
bh: 1,
|
||||||
|
lx: 1,
|
||||||
|
jl: 2.35,
|
||||||
|
sd: 3.68
|
||||||
|
}, {
|
||||||
|
bh: 2,
|
||||||
|
lx: 2,
|
||||||
|
jl: 4.82,
|
||||||
|
sd: 5.24
|
||||||
|
}],
|
||||||
|
yqsj: [{
|
||||||
|
bh: 1,
|
||||||
|
lx: 1,
|
||||||
|
jl: 2.35,
|
||||||
|
sd: 3.68
|
||||||
|
}, {
|
||||||
|
bh: 2,
|
||||||
|
lx: 2,
|
||||||
|
jl: 4.82,
|
||||||
|
sd: 5.24
|
||||||
|
}],
|
||||||
|
yhsj: [{
|
||||||
|
bh: 1,
|
||||||
|
lx: 1,
|
||||||
|
jl: 2.35,
|
||||||
|
sd: 3.68
|
||||||
|
}, {
|
||||||
|
bh: 2,
|
||||||
|
lx: 2,
|
||||||
|
jl: 4.82,
|
||||||
|
sd: 5.24
|
||||||
|
}],
|
||||||
|
ycsj: [{
|
||||||
|
bh: 1,
|
||||||
|
lx: 1,
|
||||||
|
jl: 2.35,
|
||||||
|
sd: 3.68
|
||||||
|
}, {
|
||||||
|
bh: 2,
|
||||||
|
lx: 2,
|
||||||
|
jl: 4.82,
|
||||||
|
sd: 5.24
|
||||||
|
}],
|
||||||
|
fqsj: [{
|
||||||
|
bh: 1,
|
||||||
|
lx: 1,
|
||||||
|
jl: 2.35,
|
||||||
|
sd: 3.68
|
||||||
|
}, {
|
||||||
|
bh: 2,
|
||||||
|
lx: 2,
|
||||||
|
jl: 4.82,
|
||||||
|
sd: 5.24
|
||||||
|
}],
|
||||||
|
qfwt: { xrjl: 2.357, zawjl: 3.608 },
|
||||||
|
rcyz: 1,
|
||||||
|
show: [{ bh: 1, zb: [{ x: 0, y: 1 }, { x: 0, y: 1 }, { x: 0, y: 1 }, { x: 0, y: 1 }] },
|
||||||
|
{ bh: 2, zb: [{ x: 0, y: 1 }, { x: 0, y: 1 }, { x: 0, y: 1 }, { x: 0, y: 1 }] }]
|
||||||
|
},
|
||||||
|
extend: {}
|
||||||
|
}
|
||||||
|
export const DefaultJudgeConfigData: DefaultJudgeConfigObj = {
|
||||||
|
//结束考试方式 0-不合格继续 1-考试不合格报靠边停车 2-不合格不报靠边 3-训练不合格报靠边 4-自动退出 5-不合格自动退出
|
||||||
|
param_302: '5',
|
||||||
|
param_332: '',
|
||||||
|
//是否能进行人工操作 0-不能人工评判 1-不能人工进项目 3-都不能
|
||||||
|
param_342: '',
|
||||||
|
//有项目未结束时可以靠边停车 0-否 1-是
|
||||||
|
param_343: '1',
|
||||||
|
//考试未结束且有扣分,是否可以退出
|
||||||
|
param_344: '0',
|
||||||
|
//直线行驶中是否可以进其它项目 0-否 1-是
|
||||||
|
param_348: '0',
|
||||||
|
//车上是否能点结束考试 0:否 1:是
|
||||||
|
param_353: '0',
|
||||||
|
//是否启动断电续考 0:否 1:是
|
||||||
|
param_369: '1',
|
||||||
|
//是否显示应考里程
|
||||||
|
param_375: '0',
|
||||||
|
//里程不够允许手工点靠边停车
|
||||||
|
param_387: '0',
|
||||||
|
//监管模式有扣分续考(0-否++1-是+把上次未考完的扣分带下来重新考试)
|
||||||
|
param_432: '1'
|
||||||
|
}
|
||||||
@ -143,12 +143,17 @@ export interface Sensor {
|
|||||||
dcj: number
|
dcj: number
|
||||||
gx: number
|
gx: number
|
||||||
yl: number
|
yl: number
|
||||||
yy: number
|
csb1?: number
|
||||||
sde: number
|
csb2?: number
|
||||||
xhd: string
|
csb3?: number
|
||||||
rmndg: number
|
csb4?: number
|
||||||
wav: number
|
yy?: number
|
||||||
mndg: string
|
sde?: number
|
||||||
|
xhd?: string
|
||||||
|
rmndg?: number
|
||||||
|
wav?: number
|
||||||
|
mndg?: string
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Gps {
|
export interface Gps {
|
||||||
@ -203,13 +208,13 @@ interface Qfwt {
|
|||||||
zawjl: number
|
zawjl: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Plc {
|
export interface PLCType {
|
||||||
sensor: Sensor,
|
sensor: Sensor,
|
||||||
gps: Gps,
|
gps: Gps,
|
||||||
gps2: Gps,
|
gps2: Gps,
|
||||||
vision: Vision,
|
vision: Vision,
|
||||||
radar: Radar,
|
radar: Radar,
|
||||||
extend: object
|
extend: ExtendType
|
||||||
//轨迹回放需要
|
//轨迹回放需要
|
||||||
method?: string
|
method?: string
|
||||||
itemno?: string
|
itemno?: string
|
||||||
@ -217,6 +222,9 @@ export interface Plc {
|
|||||||
serial?: 1 | 2
|
serial?: 1 | 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ExtendType {}
|
||||||
|
|
||||||
|
|
||||||
interface Qfsj {
|
interface Qfsj {
|
||||||
bh: number
|
bh: number
|
||||||
lx: number
|
lx: number
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import BottomMessageComponent from './Index/BottomMessage';
|
|||||||
import LoadingComponent from './Index/Loading';
|
import LoadingComponent from './Index/Loading';
|
||||||
import Prompt from '@system.prompt';
|
import Prompt from '@system.prompt';
|
||||||
import { DifferentialAndSignal } from '../utils/business/DifferentialAndSignalWorker';
|
import { DifferentialAndSignal } from '../utils/business/DifferentialAndSignalWorker';
|
||||||
|
import dayTs from '../utils/Date';
|
||||||
|
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@ -61,6 +62,10 @@ struct Index {
|
|||||||
|
|
||||||
async aboutToAppear() {
|
async aboutToAppear() {
|
||||||
console.log("首页 aboutToAppear")
|
console.log("首页 aboutToAppear")
|
||||||
|
const date = new Date()
|
||||||
|
const getMilliseconds = date.getMilliseconds()
|
||||||
|
const timeStr = dayTs().format('YYYYMMDDHHmmss.SS')
|
||||||
|
console.log(getMilliseconds.toString(), "时间测试", timeStr)
|
||||||
await UseAuth(this.context)
|
await UseAuth(this.context)
|
||||||
this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4
|
this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4
|
||||||
this.angle = 0
|
this.angle = 0
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import LoadingPopup from './compontents/judge/LoadingPopup';
|
|||||||
import DeductedPopup from './compontents/judge/DeductionPopup';
|
import DeductedPopup from './compontents/judge/DeductionPopup';
|
||||||
import AmplifyPopup from './compontents/judge/AmplifyPopup';
|
import AmplifyPopup from './compontents/judge/AmplifyPopup';
|
||||||
import Judge from './judgeSDK/judge';
|
import Judge from './judgeSDK/judge';
|
||||||
import { defaultJudgeConfigObj } from './judgeSDK/utils//judgeCommon';
|
|
||||||
import { uploadExamMileage } from '../api/judge';
|
import { uploadExamMileage } from '../api/judge';
|
||||||
import DwztErrorPopup from './compontents/judge/DwztErrorPopup';
|
import DwztErrorPopup from './compontents/judge/DwztErrorPopup';
|
||||||
import MsgPopup from './compontents/judge/MsgPopup';
|
import MsgPopup from './compontents/judge/MsgPopup';
|
||||||
@ -50,6 +49,7 @@ import dayTs from '../utils/Date';
|
|||||||
import { CutArray, FormatTimeFlexible, GetCurrentTime } from '../utils/Common';
|
import { CutArray, FormatTimeFlexible, GetCurrentTime } from '../utils/Common';
|
||||||
import FileUtils from '../utils/FileUtils';
|
import FileUtils from '../utils/FileUtils';
|
||||||
import SignalTrajectoryDialog from './Judge/SignalTrajectoryDialog';
|
import SignalTrajectoryDialog from './Judge/SignalTrajectoryDialog';
|
||||||
|
import { DefaultJudgeConfigData } from '../mock';
|
||||||
|
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@ -94,7 +94,7 @@ struct Index {
|
|||||||
@State itemInfoObj?: ItemInfos = {}
|
@State itemInfoObj?: ItemInfos = {}
|
||||||
@State timer: number = 0
|
@State timer: number = 0
|
||||||
@State judgeConfig: SyssetConfig[] = []
|
@State judgeConfig: SyssetConfig[] = []
|
||||||
@State judgeConfigObj: DefaultJudgeConfigObj = defaultJudgeConfigObj
|
@State judgeConfigObj: DefaultJudgeConfigObj = DefaultJudgeConfigData
|
||||||
//流水号
|
//流水号
|
||||||
@State lsh: string = ''
|
@State lsh: string = ''
|
||||||
@State kszp: string = ''
|
@State kszp: string = ''
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import libJudgeSdk from 'libjudgesdk.so';
|
import libJudgeSdk from 'libjudgesdk.so';
|
||||||
import { JudgeBeginObj, JudgeInitObj, Plc } from '../../model';
|
import { JudgeBeginObj, JudgeInitObj, PLCType } from '../../model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 苏仁君
|
* 苏仁君
|
||||||
@ -43,7 +43,7 @@ export async function examJudgeInit(data: JudgeInitObj) {
|
|||||||
*
|
*
|
||||||
* @desc 执行实时考试过程 实时传递传感信息
|
* @desc 执行实时考试过程 实时传递传感信息
|
||||||
*/
|
*/
|
||||||
export async function examJudgeRealExam(data: Plc) {
|
export async function examJudgeRealExam(data: PLCType) {
|
||||||
const str = JSON.stringify(data);
|
const str = JSON.stringify(data);
|
||||||
const temp: number = libJudgeSdk.examJudgeRealExam(str, str.length);
|
const temp: number = libJudgeSdk.examJudgeRealExam(str, str.length);
|
||||||
return await handle(temp, 'examJudgeRealExam')
|
return await handle(temp, 'examJudgeRealExam')
|
||||||
|
|||||||
@ -1,15 +1,12 @@
|
|||||||
import { testRealExam } from '../dataTest/index';
|
|
||||||
import { ArrayToByteArray, NumberToByteArray } from '../../../utils/Common';
|
|
||||||
|
|
||||||
import systemTime from '@ohos.systemDateTime';
|
import systemTime from '@ohos.systemDateTime';
|
||||||
|
import { TestRealExam } from '../../mock';
|
||||||
|
import { CarInfoType, DefaultJudgeConfigObj, ExtendType, Gps, LANE, PLCType, Radar, Vision } from '../../model';
|
||||||
|
import { ArrayToByteArray, NumberToByteArray } from '../../utils/Common';
|
||||||
|
import dayTs from '../../utils/Date';
|
||||||
|
|
||||||
import { CarInfoType } from '../../../model';
|
|
||||||
import { DefaultJudgeConfigObj, Gps, LANE, Plc, Radar, Vision } from '../../../model/Judge';
|
|
||||||
|
|
||||||
interface Extend {}
|
|
||||||
|
|
||||||
// 中心信号转换
|
// 中心信号转换
|
||||||
export const getTranslateSignals = (tempItems: number[]) => {
|
export const GetTranslateSignals = (tempItems: number[]) => {
|
||||||
const len = Math.floor(tempItems.length / 8);
|
const len = Math.floor(tempItems.length / 8);
|
||||||
const arr: string[] = [];
|
const arr: string[] = [];
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
@ -21,7 +18,7 @@ export const getTranslateSignals = (tempItems: number[]) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// c++评判考车行驶状态转换
|
// c++评判考车行驶状态转换
|
||||||
export function getCarStatus(status: -1 | 0 | 1): string {
|
export function GetCarStatus(status: -1 | 0 | 1): string {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case -1:
|
case -1:
|
||||||
return '后退'
|
return '后退'
|
||||||
@ -35,7 +32,7 @@ export function getCarStatus(status: -1 | 0 | 1): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 当前考车中心状态转换
|
// 当前考车中心状态转换
|
||||||
export function getCarStatusType(carzt?: number) {
|
export function GetCarStatusType(carzt?: number) {
|
||||||
switch (carzt) {
|
switch (carzt) {
|
||||||
case -1:
|
case -1:
|
||||||
return [1, 0]
|
return [1, 0]
|
||||||
@ -49,7 +46,7 @@ export function getCarStatusType(carzt?: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取档位信号
|
// 获取档位信号
|
||||||
export function getDwStatusType(dw?: number) {
|
export function GetDwStatusType(dw?: number) {
|
||||||
switch (dw) {
|
switch (dw) {
|
||||||
case 0:
|
case 0:
|
||||||
return [0, 0, 0, 0]
|
return [0, 0, 0, 0]
|
||||||
@ -72,7 +69,7 @@ export function getDwStatusType(dw?: number) {
|
|||||||
|
|
||||||
|
|
||||||
// 中心实时项目状态转换
|
// 中心实时项目状态转换
|
||||||
export function getCenterProjectStatus(status?: number): string {
|
export function GetCenterProjectStatus(status?: number): string {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
//不考
|
//不考
|
||||||
case 0:
|
case 0:
|
||||||
@ -192,7 +189,7 @@ export function getKmProjectCancelVoice(examSubject: number, projectCode: number
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 上传监管数据code转换
|
// 上传监管数据code转换
|
||||||
export function promptWxCode(
|
export function UploadRegulatoryCodeConversion(
|
||||||
jkid: '17C51' | '17C52' | '17C54' | '17C55' | '17C53' | '17C56',
|
jkid: '17C51' | '17C52' | '17C54' | '17C55' | '17C53' | '17C56',
|
||||||
code: number
|
code: number
|
||||||
) {
|
) {
|
||||||
@ -448,7 +445,7 @@ export function promptWxCode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取plc数据
|
// 获取plc数据
|
||||||
export const plcStrToJson = async (plc: string) => {
|
export const PlcStrToJson = async (plc: string) => {
|
||||||
const plcArr = plc.split(',')
|
const plcArr = plc.split(',')
|
||||||
const p = plcArr.map((val, key) => {
|
const p = plcArr.map((val, key) => {
|
||||||
if (key !== 27 && key !== 92) {
|
if (key !== 27 && key !== 92) {
|
||||||
@ -506,11 +503,11 @@ export const plcStrToJson = async (plc: string) => {
|
|||||||
// wav: 0,
|
// wav: 0,
|
||||||
// mndg: ''
|
// mndg: ''
|
||||||
// }
|
// }
|
||||||
const gps2: Gps = testRealExam.gps2
|
const gps2: Gps = TestRealExam.gps2
|
||||||
const radar: Radar = testRealExam.radar
|
const radar: Radar = TestRealExam.radar
|
||||||
const vision: Vision = testRealExam.vision
|
const vision: Vision = TestRealExam.vision
|
||||||
const extend: Extend = {};
|
const extend: ExtendType = {};
|
||||||
const tempData: Plc = {
|
const tempData: PLCType = {
|
||||||
sensor: {
|
sensor: {
|
||||||
//安全带 车门门开关 手刹 脚刹 副刹 离合器 喇叭 示宽灯 近光灯 远光灯
|
//安全带 车门门开关 手刹 脚刹 副刹 离合器 喇叭 示宽灯 近光灯 远光灯
|
||||||
aqd: p[19],
|
aqd: p[19],
|
||||||
@ -589,7 +586,7 @@ export const plcStrToJson = async (plc: string) => {
|
|||||||
return tempData
|
return tempData
|
||||||
}
|
}
|
||||||
|
|
||||||
export const plcStrToWXJson = async (plc: string) => {
|
export const PlcStrToWXJson = async (plc: string) => {
|
||||||
const plcArr = plc.split(',')
|
const plcArr = plc.split(',')
|
||||||
const p = plc.split(',').map((val, key) => {
|
const p = plc.split(',').map((val, key) => {
|
||||||
if (key !== 27 && key !== 92) {
|
if (key !== 27 && key !== 92) {
|
||||||
@ -646,10 +643,13 @@ export const plcStrToWXJson = async (plc: string) => {
|
|||||||
return wuXiDataStr
|
return wuXiDataStr
|
||||||
}
|
}
|
||||||
|
|
||||||
export const senorToWXDataStr = async (tempData: Plc) => {
|
export const senorToWXDataStr = async (tempData: PLCType) => {
|
||||||
const sensor = tempData.sensor
|
const sensor = tempData.sensor
|
||||||
const gps = tempData.gps
|
const gps = tempData.gps
|
||||||
const timeStr = await getTimeStr()
|
// 格式为20250623020817.14
|
||||||
|
// const timeStr = await getTimeStr()
|
||||||
|
const timeStr = dayTs().format('YYYYMMDDHHmmss.SS')
|
||||||
|
|
||||||
|
|
||||||
const judgeSignal: number[] = [
|
const judgeSignal: number[] = [
|
||||||
//车门 安全带 熄火 发动机启动 左转向 右转向 前照灯近灯 前照灯远灯
|
//车门 安全带 熄火 发动机启动 左转向 右转向 前照灯近灯 前照灯远灯
|
||||||
@ -12,8 +12,6 @@ import JudgeTask from './utils/judgeTask';
|
|||||||
import { JudgeConfig } from '../../config';
|
import { JudgeConfig } from '../../config';
|
||||||
import { GetSyncData, SqlInsertTable } from '../../utils/table/Operation';
|
import { GetSyncData, SqlInsertTable } from '../../utils/table/Operation';
|
||||||
|
|
||||||
import { getCarStatus, getCenterProjectStatus, plcStrToJson, plcStrToWXJson, promptWxCode } from './utils/judgeCommon';
|
|
||||||
|
|
||||||
import { uploadExamProgressData, writeObjectOut } from '../../api/judge';
|
import { uploadExamProgressData, writeObjectOut } from '../../api/judge';
|
||||||
import { endRecordVideo, saveStartRecordVideo } from '../../utils/Video';
|
import { endRecordVideo, saveStartRecordVideo } from '../../utils/Video';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
@ -45,7 +43,7 @@ import {
|
|||||||
KmItem,
|
KmItem,
|
||||||
LANE,
|
LANE,
|
||||||
MarkRule,
|
MarkRule,
|
||||||
Plc,
|
PLCType,
|
||||||
ProjectInfo,
|
ProjectInfo,
|
||||||
RecordHandleType,
|
RecordHandleType,
|
||||||
RegulatoryInterfaceParams,
|
RegulatoryInterfaceParams,
|
||||||
@ -69,6 +67,13 @@ import {
|
|||||||
examJudgeSoundEnd,
|
examJudgeSoundEnd,
|
||||||
examJudgeVersion
|
examJudgeVersion
|
||||||
} from '../Judge/JudgeUtils';
|
} from '../Judge/JudgeUtils';
|
||||||
|
import {
|
||||||
|
GetCarStatus,
|
||||||
|
GetCenterProjectStatus,
|
||||||
|
PlcStrToJson,
|
||||||
|
PlcStrToWXJson,
|
||||||
|
UploadRegulatoryCodeConversion
|
||||||
|
} from '../Judge/utils';
|
||||||
|
|
||||||
const judgeTag = 'SURENJUN_JUDGE'
|
const judgeTag = 'SURENJUN_JUDGE'
|
||||||
|
|
||||||
@ -279,7 +284,7 @@ export default class Judge {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private tempData?: Plc
|
private tempData?: PLCType
|
||||||
//实时计算gps经纬度距离
|
//实时计算gps经纬度距离
|
||||||
handDistance = async () => {
|
handDistance = async () => {
|
||||||
const dwzt = this.tempData?.gps?.dwzt || "";
|
const dwzt = this.tempData?.gps?.dwzt || "";
|
||||||
@ -421,18 +426,18 @@ export default class Judge {
|
|||||||
private kfArr?: MarkRule[]
|
private kfArr?: MarkRule[]
|
||||||
//所有的科目考试项目(大车&小车)
|
//所有的科目考试项目(大车&小车)
|
||||||
private kmItems: JudgeConfigObjKmItems
|
private kmItems: JudgeConfigObjKmItems
|
||||||
private plcData?: Plc
|
private plcData?: PLCType
|
||||||
// 获取plc数据
|
// 获取plc数据
|
||||||
getPlcData = async (plc: string) => {
|
getPlcData = async (plc: string) => {
|
||||||
await this.fileLog?.setPlcProgressData(plc)
|
await this.fileLog?.setPlcProgressData(plc)
|
||||||
//plc字符串转化成评判初始化数据
|
//plc字符串转化成评判初始化数据
|
||||||
const tempData = await plcStrToJson(plc);
|
const tempData = await PlcStrToJson(plc);
|
||||||
//模拟灯光回放时刻
|
//模拟灯光回放时刻
|
||||||
tempData.sensor.rmndg = this.rmndg;
|
tempData.sensor.rmndg = this.rmndg;
|
||||||
//模拟灯灯光灯光项目
|
//模拟灯灯光灯光项目
|
||||||
tempData.sensor.mndg = this.mndgStr || "";
|
tempData.sensor.mndg = this.mndgStr || "";
|
||||||
//plc字符串转化成无锡所过程数据
|
//plc字符串转化成无锡所过程数据
|
||||||
const wuXiDataStr = await plcStrToWXJson(plc)
|
const wuXiDataStr = await PlcStrToWXJson(plc)
|
||||||
this.plcData = tempData
|
this.plcData = tempData
|
||||||
await this.fileLog?.setExamJudgeWuxiProgressData(wuXiDataStr)
|
await this.fileLog?.setExamJudgeWuxiProgressData(wuXiDataStr)
|
||||||
this.tempData = tempData
|
this.tempData = tempData
|
||||||
@ -486,7 +491,7 @@ export default class Judge {
|
|||||||
this.checkExamIsEnd(true)
|
this.checkExamIsEnd(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const msg: Plc = JSON.parse(strArr[num]);
|
const msg: PLCType = JSON.parse(strArr[num]);
|
||||||
num++
|
num++
|
||||||
// 4.过程数据
|
// 4.过程数据
|
||||||
this.tempData = msg
|
this.tempData = msg
|
||||||
@ -561,7 +566,7 @@ export default class Judge {
|
|||||||
if (temp.code === 2300007) {
|
if (temp.code === 2300007) {
|
||||||
this.isJudgeDisConnect = true;
|
this.isJudgeDisConnect = true;
|
||||||
}
|
}
|
||||||
promptWxCode('17C52', temp.code || 0)
|
UploadRegulatoryCodeConversion('17C52', temp.code || 0)
|
||||||
}
|
}
|
||||||
// 项目结束接口同步
|
// 项目结束接口同步
|
||||||
endProject = async (ksxm: number) => {
|
endProject = async (ksxm: number) => {
|
||||||
@ -596,7 +601,7 @@ export default class Judge {
|
|||||||
this.isJudgeDisConnect = true;
|
this.isJudgeDisConnect = true;
|
||||||
}
|
}
|
||||||
console.info(judgeTag, '项目结束 end')
|
console.info(judgeTag, '项目结束 end')
|
||||||
promptWxCode('17C55', temp.code || 0)
|
UploadRegulatoryCodeConversion('17C55', temp.code || 0)
|
||||||
}
|
}
|
||||||
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
|
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
|
||||||
private lane: LANE = {
|
private lane: LANE = {
|
||||||
@ -656,7 +661,7 @@ export default class Judge {
|
|||||||
if (temp.code === 2300007) {
|
if (temp.code === 2300007) {
|
||||||
this.isJudgeDisConnect = true
|
this.isJudgeDisConnect = true
|
||||||
}
|
}
|
||||||
promptWxCode('17C54', temp.code || 0)
|
UploadRegulatoryCodeConversion('17C54', temp.code || 0)
|
||||||
console.info(judgeTag, '上传照片 end')
|
console.info(judgeTag, '上传照片 end')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -966,7 +971,7 @@ export default class Judge {
|
|||||||
|
|
||||||
//考车状态
|
//考车状态
|
||||||
case 4:
|
case 4:
|
||||||
this.carztStr = getCarStatus(carzt);
|
this.carztStr = GetCarStatus(carzt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//考试结束
|
//考试结束
|
||||||
@ -1292,7 +1297,7 @@ export default class Judge {
|
|||||||
this.isJudgeDisConnect = true
|
this.isJudgeDisConnect = true
|
||||||
}
|
}
|
||||||
console.info(judgeTag, '项目扣分 end')
|
console.info(judgeTag, '项目扣分 end')
|
||||||
promptWxCode('17C53', temp?.code || 0)
|
UploadRegulatoryCodeConversion('17C53', temp?.code || 0)
|
||||||
}
|
}
|
||||||
// 评判语音提示
|
// 评判语音提示
|
||||||
goJudgeVoice = async (sound: JudgeSound) => {
|
goJudgeVoice = async (sound: JudgeSound) => {
|
||||||
@ -1436,7 +1441,7 @@ export default class Judge {
|
|||||||
router.back()
|
router.back()
|
||||||
}, 90 * 1000)
|
}, 90 * 1000)
|
||||||
const temp = await this.sendWriteObjectOut(data, filePath);
|
const temp = await this.sendWriteObjectOut(data, filePath);
|
||||||
promptWxCode('17C56', temp?.code || 0)
|
UploadRegulatoryCodeConversion('17C56', temp?.code || 0)
|
||||||
|
|
||||||
if (temp.code != 1) {
|
if (temp.code != 1) {
|
||||||
avPlayer?.playAudio(['voice/监管失败.mp3'])
|
avPlayer?.playAudio(['voice/监管失败.mp3'])
|
||||||
@ -1733,7 +1738,7 @@ export default class Judge {
|
|||||||
const examSubject = this.judgeUI.examSubject;
|
const examSubject = this.judgeUI.examSubject;
|
||||||
const tempItems: TKmItem[] = (examSubject == '2' ? testKm2Items : testKm3Items).map(item => {
|
const tempItems: TKmItem[] = (examSubject == '2' ? testKm2Items : testKm3Items).map(item => {
|
||||||
const kmItem: KmItem = Reflect.get(this.kmItems, item.code)
|
const kmItem: KmItem = Reflect.get(this.kmItems, item.code)
|
||||||
const status = getCenterProjectStatus(kmItem.status)
|
const status = GetCenterProjectStatus(kmItem.status)
|
||||||
const temp: TKmItem = {
|
const temp: TKmItem = {
|
||||||
code: item.code, status
|
code: item.code, status
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,6 +45,7 @@ class DayTs {
|
|||||||
'h{2}': (dateData: DateData) => DayTs._paddingZero(dateData.getHours() % 12),
|
'h{2}': (dateData: DateData) => DayTs._paddingZero(dateData.getHours() % 12),
|
||||||
'm{2}': (dateData: DateData) => DayTs._paddingZero(dateData.getMinutes()),
|
'm{2}': (dateData: DateData) => DayTs._paddingZero(dateData.getMinutes()),
|
||||||
's{2}': (dateData: DateData) => DayTs._paddingZero(dateData.getSeconds()),
|
's{2}': (dateData: DateData) => DayTs._paddingZero(dateData.getSeconds()),
|
||||||
|
'S{2}': (dateData: DateData) => DayTs._paddingZero(dateData.getMilliseconds() / 10 | 0), // 2-digit milliseconds
|
||||||
'S{3}': (dateData: DateData) => DayTs._paddingZero(dateData.getMilliseconds(), 3), // 添加毫秒支持
|
'S{3}': (dateData: DateData) => DayTs._paddingZero(dateData.getMilliseconds(), 3), // 添加毫秒支持
|
||||||
'M': (dateData: DateData) => dateData.getMonth() + 1,
|
'M': (dateData: DateData) => dateData.getMonth() + 1,
|
||||||
'd': (dateData: DateData) => dateData.getDate(),
|
'd': (dateData: DateData) => dateData.getDate(),
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import { ObtainUdpBusinessInstance } from './ObtainUdpBusiness';
|
|||||||
import systemTime from '@ohos.systemDateTime';
|
import systemTime from '@ohos.systemDateTime';
|
||||||
import { SerialNumberInstance } from '../SerialNumber';
|
import { SerialNumberInstance } from '../SerialNumber';
|
||||||
import { examCalcGpsDistance } from '../../pages/Judge/JudgeUtils';
|
import { examCalcGpsDistance } from '../../pages/Judge/JudgeUtils';
|
||||||
|
import { GetDwStatusType, GetTranslateSignals } from '../../pages/Judge/utils';
|
||||||
|
|
||||||
|
|
||||||
class JudgeUdpBusiness {
|
class JudgeUdpBusiness {
|
||||||
@ -56,9 +57,9 @@ class JudgeUdpBusiness {
|
|||||||
return keys.indexOf(item[0])
|
return keys.indexOf(item[0])
|
||||||
})
|
})
|
||||||
.map((item: [string, number]) => item[1])
|
.map((item: [string, number]) => item[1])
|
||||||
.concat(this.getDwStatusType(plcData.sensor.dw))
|
.concat(GetDwStatusType(plcData.sensor.dw))
|
||||||
.concat([0, 0, plcData.sensor.ygq, plcData.sensor.wd, 0])
|
.concat([0, 0, plcData.sensor.ygq, plcData.sensor.wd, 0])
|
||||||
const translateSignals = this.getTranslateSignals(param)
|
const translateSignals = GetTranslateSignals(param)
|
||||||
const translateProject = this.getTranslateProject();
|
const translateProject = this.getTranslateProject();
|
||||||
const translateJd = Number(this.convertGpsCoord2(plcData.gps.wd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit);
|
const translateJd = Number(this.convertGpsCoord2(plcData.gps.wd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit);
|
||||||
const translateWd = Number(this.convertGpsCoord2(plcData.gps.jd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit)
|
const translateWd = Number(this.convertGpsCoord2(plcData.gps.jd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit)
|
||||||
@ -260,16 +261,6 @@ class JudgeUdpBusiness {
|
|||||||
return du + fen / 60
|
return du + fen / 60
|
||||||
}
|
}
|
||||||
|
|
||||||
// 中心plc实时信号转换成字节
|
|
||||||
private getTranslateSignals(tempItems: number[]) {
|
|
||||||
const len = Math.floor(tempItems.length / 8);
|
|
||||||
const arr: string[] = [];
|
|
||||||
for (let i = 0; i < len; i++) {
|
|
||||||
arr.push(tempItems.slice(i * 8, (i + 1) * 8).join(''));
|
|
||||||
}
|
|
||||||
return arr.map(numStr => parseInt(numStr, 2)).map(item => NumberToByteArray(item, 8)[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
// 中心所有项目转换
|
// 中心所有项目转换
|
||||||
private getTranslateProject(): string[] {
|
private getTranslateProject(): string[] {
|
||||||
this.carInfo.examSubject
|
this.carInfo.examSubject
|
||||||
@ -408,27 +399,6 @@ class JudgeUdpBusiness {
|
|||||||
gps,
|
gps,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getDwStatusType(dw: number) {
|
|
||||||
switch (dw) {
|
|
||||||
case 0:
|
|
||||||
return [0, 0, 0, 0]
|
|
||||||
case 1:
|
|
||||||
return [0, 0, 0, 1]
|
|
||||||
case 2:
|
|
||||||
return [0, 0, 1, 0]
|
|
||||||
case 3:
|
|
||||||
return [0, 0, 1, 1]
|
|
||||||
case 4:
|
|
||||||
return [0, 1, 0, 0]
|
|
||||||
case 5:
|
|
||||||
return [0, 1, 0, 1]
|
|
||||||
case 9:
|
|
||||||
return [1, 0, 0, 1]
|
|
||||||
default:
|
|
||||||
return [0, 0, 0, 0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user