diff --git a/entry/src/main/cpp/sdk/common/HVersion.h b/entry/src/main/cpp/sdk/common/HVersion.h index 0052c215..50fe437a 100644 --- a/entry/src/main/cpp/sdk/common/HVersion.h +++ b/entry/src/main/cpp/sdk/common/HVersion.h @@ -27,7 +27,7 @@ #define JUDGE_VERSION_MAJOR 1 #define JUDGE_VERSION_MINOR 0 #define JUDGE_VERSION_PATCH 3 -#define JUDGE_VERSION_STAMP "2504281937b" +#define JUDGE_VERSION_STAMP "2505132200b" #if JUDGE_USE_OLD # undef JUDGE_VERSION_STAMP # define JUDGE_VERSION_STAMP "2411121010b.old" diff --git a/entry/src/main/cpp/sdk/common/Tools.cpp b/entry/src/main/cpp/sdk/common/Tools.cpp index 797e0a6a..6a348c93 100644 --- a/entry/src/main/cpp/sdk/common/Tools.cpp +++ b/entry/src/main/cpp/sdk/common/Tools.cpp @@ -1,6 +1,21 @@ #include "Tools.h" +#include "HVersion.h" #include "Loggerxx.h" +bool Tools::checkVersion(const std::string& version) +{ + std::vector ver = Tools::split(version, "."); + //int major = std::atoi(ver[0].c_str()); + //int minor = std::atoi(ver[1].c_str()); + //int patch = std::atoi(ver[2].c_str()); + std::string v3 = ver[3]; + if(v3.back() == 'b') + { + v3.pop_back(); + } + return (v3 < "2505121242"); +} + int64 Tools::nowTime() { return std::chrono::duration_cast diff --git a/entry/src/main/cpp/sdk/common/Tools.h b/entry/src/main/cpp/sdk/common/Tools.h index 66083ada..de223227 100644 --- a/entry/src/main/cpp/sdk/common/Tools.h +++ b/entry/src/main/cpp/sdk/common/Tools.h @@ -13,6 +13,8 @@ class Tools { public: + + static bool checkVersion(const std::string& version); //获取当前系统时间,单位:毫秒 static int64 nowTime(); //壁钟,防止有人篡改系统时间,导致考试有些评判项目计时限时不准 @@ -190,6 +192,7 @@ public: //获取当前机器的CPU逻辑核心数 static int getCpuProcessors(); + }; #endif // TOOLS_H diff --git a/entry/src/main/cpp/sdk/exam/ExamCarSub2.cpp b/entry/src/main/cpp/sdk/exam/ExamCarSub2.cpp index 412b5dd7..dffce997 100644 --- a/entry/src/main/cpp/sdk/exam/ExamCarSub2.cpp +++ b/entry/src/main/cpp/sdk/exam/ExamCarSub2.cpp @@ -284,13 +284,35 @@ bool ExamCarSub2::examMarkItem(ExamItemCode itemNo, const std::string& serial, b void ExamCarSub2::examNonGps(TChuanGan* cg) { - const TGpsInfo& gps = cg->real.gps; - if(!gps.rtkEnabled || !gps.valid() || cg->real.gps.errorFlag) + const TGpsInfo* gps = nullptr; + bool ok = true; + const TGpsInfo* gps1 = &cg->real.gps; + //如果gps1异常了就直接报gps1,如gps1正常就检查gps2 + if(!gps1->rtkEnabled || !gps1->valid() || gps1->errorFlag) + { + gps = gps1; + ok = false; + } + else + { + ExamCarType cartype = carType(); + if(IS_A2C6(cartype)) + { + const TGpsInfo* gps2 = &cg->real.gps2; + if(!gps2->rtkEnabled || !gps2->valid() || gps2->errorFlag) + { + gps = gps2; + ok = false; + } + } + } + + if(!ok) { if(m_nontime == 0) { - m_nontime = gps.sj; - m_nongps = gps; + m_nontime = Tools::nowTime(); + m_nongps = *gps; createEventNonGps({TNonGpsReport, m_nongps}); //上报GPS异常数据 } else diff --git a/entry/src/main/cpp/sdk/exam/ExamCarSub3.cpp b/entry/src/main/cpp/sdk/exam/ExamCarSub3.cpp index 9909476d..08778168 100644 --- a/entry/src/main/cpp/sdk/exam/ExamCarSub3.cpp +++ b/entry/src/main/cpp/sdk/exam/ExamCarSub3.cpp @@ -268,7 +268,7 @@ bool ExamCarSub3::Init_KM3_Global() const TDBCarInfo* carInfo = TableCarInfo->findCarInfo(carId); if(nullptr == carInfo || carInfo->CARCLASS.empty()) { - logerror("database not find carID=%d or carClass=%p is empty, init error", carId, carInfo); + logerror("database carInfo error, carID=%d, carInfo=0x%p, carClass=%s", carId, carInfo, carInfo->CARCLASS.c_str()); return false; } TASSERT_BOOL(carInfo->CARCLASS == carClass(), ""); @@ -409,7 +409,8 @@ bool ExamCarSub3::Init_KM3_Global() //当前时间到达夜考时间点了 //if( (Now() - Trunc(now())) > (Car.Night_Hr / 24 + Car.Night_Mi / 24 / 60) ) DateTimex dt = Tools::nowDateTime(); - if(dt.hour*60 + dt.minute >= m_car.Night_Hr*60 + m_car.Night_Mi) + //考试模式判断时间,训练模式用外壳传的参数 + if((isExamMode() && (dt.hour*60 + dt.minute >= m_car.Night_Hr*60 + m_car.Night_Mi)) || (isExamDrill() && isSfyk())) { //如果不考模拟灯光 if(!m_stuInfo.dmndg) @@ -4405,13 +4406,35 @@ bool ExamCarSub3::examMarkItem(ExamItemCode itemNo, const std::string& serial, b void ExamCarSub3::examNonGps(TChuanGan* cg) { - const TGpsInfo& gps = cg->real.gps; - if(!gps.rtkEnabled || !gps.valid() || cg->real.gps.errorFlag) + const TGpsInfo* gps = nullptr; + bool ok = true; + const TGpsInfo* gps1 = &cg->real.gps; + //如果gps1异常了就直接报gps1,如gps1正常就检查gps2 + if(!gps1->rtkEnabled || !gps1->valid() || gps1->errorFlag) + { + gps = gps1; + ok = false; + } + else + { + ExamCarType cartype = carType(); + if(IS_A2C6(cartype)) + { + const TGpsInfo* gps2 = &cg->real.gps2; + if(!gps2->rtkEnabled || !gps2->valid() || gps2->errorFlag) + { + gps = gps2; + ok = false; + } + } + } + + if(!ok) { if(m_nontime == 0) { m_nontime = Tools::nowTime(); - m_nongps = gps; + m_nongps = *gps; createEventNonGps({TNonGpsReport, m_nongps}); //上报GPS异常数据 } else @@ -5036,7 +5059,7 @@ void ExamCarSub3::dealItemNoIDEndItem() { //ToDo1:生成 全程加减挡 进项目事件 //createEventEnterItem({item14->ItemNo, ""}); - KM3EndItem(item14->ItemNo); + KM3EndItem(item14->ItemNo, true, false); } } else @@ -5046,7 +5069,7 @@ void ExamCarSub3::dealItemNoIDEndItem() { //ToDo1:生成 全程加减挡 进项目事件 //createEventEnterItem({item14->ItemNo, ""}); - KM3EndItem(item14->ItemNo); + KM3EndItem(item14->ItemNo, true, false); } } } @@ -5063,7 +5086,7 @@ void ExamCarSub3::dealItemNoIDEndItem() { if(item->FinishFlag == false) { - KM3EndItem(item->ItemNo); + KM3EndItem(item->ItemNo, true, false); } } else if(item->ItemNo == Sub3ItemType14Jjdw) //加减档单独处理 @@ -5073,7 +5096,7 @@ void ExamCarSub3::dealItemNoIDEndItem() { if(item->Item_Color == itemStateWk) //&& item->FinishFlag == false { - KM3EndItem(item->ItemNo); + KM3EndItem(item->ItemNo, true, false); } } } @@ -5848,6 +5871,8 @@ void ExamCarSub3::Calc_LaneDistance_Tail() { calcToLaneArc2(Lj, road->Area, body.b1_b_G, body.ZH_W_b_G, RTKKM3_Tail.Wheel_LB_ToBaseLine); calcToLaneArc2(Lj, road->Area, body.b1_b_G, body.YH_W_b_G, RTKKM3_Tail.Wheel_RB_ToBaseLine); + calcToLaneArc2(Lj, road->Area, body.b1_b_G, body.b(RF_I), RTKKM3_Tail.Body_RF_ToBaseLine); + calcToLaneArc2(Lj, road->Area, body.b1_b_G, body.b(RB_I), RTKKM3_Tail.Body_RB_ToBaseLine); } //else if(p == 3) //3:车身左侧与本车道左侧距离 @@ -5870,6 +5895,8 @@ void ExamCarSub3::Calc_LaneDistance_Tail() { calcToLaneLine(Lj, road->Area.Pts, body.b1_b_G, body.ZH_W_b_G, RTKKM3_Tail.Wheel_LB_ToBaseLine); calcToLaneLine(Lj, road->Area.Pts, body.b1_b_G, body.YH_W_b_G, RTKKM3_Tail.Wheel_RB_ToBaseLine); + calcToLaneLine(Lj, road->Area.Pts, body.b1_b_G, body.b(RF_I), RTKKM3_Tail.Body_RF_ToBaseLine, true); + calcToLaneLine(Lj, road->Area.Pts, body.b1_b_G, body.b(RB_I), RTKKM3_Tail.Body_RB_ToBaseLine, true); } //else if(p == 3) //3:车身左侧与本车道左侧距离 diff --git a/entry/src/main/cpp/sdk/exam/ExamSensor.cpp b/entry/src/main/cpp/sdk/exam/ExamSensor.cpp index f556551a..60f1cc12 100644 --- a/entry/src/main/cpp/sdk/exam/ExamSensor.cpp +++ b/entry/src/main/cpp/sdk/exam/ExamSensor.cpp @@ -50,12 +50,11 @@ bool ExamSensor::pretreatment(TChuanGan* cg) return false; } - if(!cg->real.gps.rtkEnabled) - { - //cg->move = moveUnknown; - //cg->real.gps.ai_gps = Pointi(0, 0); - return true; - } + //2025-05-09 //杭州临平KM3一开始就不在差分不然计算不到行驶距离和前进状态 + //if(!cg->real.gps.rtkEnabled) + //{ + // return true; + //} ExamSubject subject = m_car->examSubject(); if(subject == ExamSubject2) @@ -169,14 +168,19 @@ bool ExamSensor::convertDatas(TChuanGan* cg) //} //航向角(默认是按诺瓦泰的数据格式定义的,所以要加上180度) 1:天宝(北云)/C1 2:诺瓦泰 - if(gps.bklx == boardTypeTB) + //2505121242兼容这个时间之前的特殊版卡类型做航向角转换处理的 + if(Tools::checkVersion(m_car->carVerison())) { - gps.hxj += 180.0; - } - if(gps.hxj >= 360.0) - { - gps.hxj -= 360.0; + if(gps.bklx == boardTypeTB) + { + gps.hxj += 180.0; + } + if(gps.hxj >= 360.0) + { + gps.hxj -= 360.0; + } } + //实际上车这里经纬度要转化,测试的数据都是转化好的 gps.jd = GpsMath::convertGpsCoord2(gps.jd); gps.wd = GpsMath::convertGpsCoord2(gps.wd); @@ -191,19 +195,23 @@ bool ExamSensor::convertDatas(TChuanGan* cg) if(IS_A2C6(cartype)) { TGpsInfo& gps2 = cg->real.gps2; - if(gps2.bklx == boardTypeTB) + //2505121242兼容这个时间之前的特殊版卡类型做航向角转换处理的 + if(Tools::checkVersion(m_car->carVerison())) { - gps2.hxj += 180.0; - } - if(gps2.hxj >= 360.0) - { - gps2.hxj -= 360.0; + if(gps2.bklx == boardTypeTB) + { + gps2.hxj += 180.0; + } + if(gps2.hxj >= 360.0) + { + gps2.hxj -= 360.0; + } } //实际上车这里经纬度要转化,测试的数据都是转化好的 gps2.jd = GpsMath::convertGpsCoord2(gps2.jd); gps2.wd = GpsMath::convertGpsCoord2(gps2.wd); #if !JUDGE_USE_INSPECT - gps.sd *= GPS_VEL_COEFF; //无锡所检测不需要乘这个系数,因为我们实际用的时候是gps速度,无锡所是加工后的数据 + gps2.sd *= GPS_VEL_COEFF; //无锡所检测不需要乘这个系数,因为我们实际用的时候是gps速度,无锡所是加工后的数据 #endif } @@ -534,24 +542,29 @@ bool ExamSensor::GetCarDirStauts(TChuanGan* cg) if(!m_initGPSFlag) { - if(cg->real.gps.rtkEnabled == true) - { - m_initGPSFlag = true; - setStatus(cg, moveStop); - m_stopOffset = cg->real.gps.ai_gps; - } - else - { - //数据异常 - return true; //如果从一开始考试一直在非差分状态 如果返回false就进不了评判了 比如模拟灯光 20240726 - } + m_initGPSFlag = true; + setStatus(cg, moveStop); + m_stopOffset = cg->real.gps.ai_gps; + //2025-05-09 KM3 //杭州临平KM3一开始就不在差分不然计算不到行驶距离和前进状态 + //if(cg->real.gps.rtkEnabled == true) + //{ + // m_initGPSFlag = true; + // setStatus(cg, moveStop); + // m_stopOffset = cg->real.gps.ai_gps; + //} + //else + //{ + // //数据异常 + // return true; //如果从一开始考试一直在非差分状态 如果返回false就进不了评判了 比如模拟灯光 20240726 + //} } //if(cg.Rtk_Enabled = False) or (Lscg[zj(1)].Rtk_Enabled = False) or (Lscg[zj(2)].Rtk_Enabled = False) then Exit; - if(cg->move == moveStop && cg->real.gps.rtkEnabled == false) - { - return false; - } + //2025-05-09 KM3 //杭州临平KM3一开始就不在差分不然计算不到行驶距离和前进状态 + //if(cg->move == moveStop && cg->real.gps.rtkEnabled == false) + //{ + // return false; + //} static constexpr int MoveAgainCm = 20; //1、拿到通用的停车时间阈值 @@ -584,7 +597,7 @@ bool ExamSensor::GetCarDirStauts(TChuanGan* cg) int b = 0, c = 0; if(I == 0) { - if(cg->real.gps.rtkEnabled == false) continue; + //if(cg->real.gps.rtkEnabled == false) continue; //2025-05-09 KM3 //杭州临平KM3一开始就不在差分不然计算不到行驶距离和前进状态 b = m_stopOffset.x - cg->real.gps.ai_gps.x; c = m_stopOffset.y - cg->real.gps.ai_gps.y; } @@ -789,6 +802,10 @@ bool ExamSensor::GetCarDirStatus_KM2(TChuanGan* cg) if(!m_initGPSFlag) { + //m_initGPSFlag = true; + //setStatus(cg, moveStop); + //m_stopOffset = cg->real.gps.ai_gps; + //2025-05-09 KM2 //杭州临平KM3一开始就不在差分不然计算不到行驶距离和前进状态 if(cg->real.gps.rtkEnabled == true) { m_initGPSFlag = true; @@ -803,6 +820,7 @@ bool ExamSensor::GetCarDirStatus_KM2(TChuanGan* cg) } //if(cg.Rtk_Enabled = False) or (Lscg[zj(1)].Rtk_Enabled = False) or (Lscg[zj(2)].Rtk_Enabled = False) then Exit; + //2025-05-09 KM2 //杭州临平KM3一开始就不在差分不然计算不到行驶距离和前进状态 if(cg->move == moveStop && cg->real.gps.rtkEnabled == false) { return false; @@ -872,7 +890,7 @@ bool ExamSensor::GetCarDirStatus_KM2(TChuanGan* cg) int b = 0, c = 0; if(I == 0) { - if(cg->real.gps.rtkEnabled == false) continue; + if(cg->real.gps.rtkEnabled == false) continue; //2025-05-09 KM2 //杭州临平KM3一开始就不在差分不然计算不到行驶距离和前进状态 b = m_stopOffset.x - cg->real.gps.ai_gps.x; c = m_stopOffset.y - cg->real.gps.ai_gps.y; } @@ -986,82 +1004,80 @@ void ExamSensor::setStatus(TChuanGan* cg, CarMoveState s) bool ExamSensor::filterWrong(TChuanGan* cg) { - TGpsInfo& gps = cg->real.gps; - - //位置差分, 角度差分 - if(gps.dwzt == gpsStatusNARROW_INT && gps.jdzt == gpsStatusANGLE) - { - gps.rtkEnabled = true; - } - else - { - gps.rtkEnabled = false; - logwarning("rtk Enabled not, dwzt=%d, jdzt=%d", gps.dwzt, gps.jdzt); - } - TChuanGan* his = m_car->historyChuanGan(); - gps.errorFlag = false; - //过滤GPS漂移数据 - if(his != nullptr) + bool ok1 = filterGpsWrong(&cg->real.gps, his != nullptr ? &his->real.gps : nullptr); + bool ok2 = true; + ExamCarType cartype = m_car->carType(); + if(IS_A2C6(cartype)) { - const TGpsInfo& h_gps = his->real.gps; - int64 interval = std::abs(gps.sj - h_gps.sj); - //如果是正常连续数据才判断漂移,有可能是断网收不到数据,然后过了几秒又收到数据距离会远超过限制距离 - if(interval < 1*SECOND) - { - TGPSPoint p1 = h_gps.to(); - TGPSPoint p2 = gps.to(); - double distance = GpsMath::calcGpsDistanceCM(p1, p2, p1.gc); - if(distance > DEVIATION_RANGE_DISTANCE_CM) - { - logwarning("deviation rang distance=%0.2f CM", distance); - gps.errorFlag = true; - } - double angle = std::abs(gps.hxj - h_gps.hxj); - if(angle > DEVIATION_RANGE_ANGLE_MIN && angle < DEVIATION_RANGE_ANGLE_MAX) - { - logwarning("deviation rang angle=%0.2f", angle); - gps.errorFlag = true; - } - } + ok2 = filterGpsWrong(&cg->real.gps2, his != nullptr ? &his->real.gps2 : nullptr); } m_car->examNonGps(cg); - if(gps.errorFlag) + //ExamSubject sub = m_car->examSubject(); + //if(ExamSubject2 == sub) + //{ + // return ok1 && ok2; + //} + //else if(ExamSubject3 == sub) + //{ + // return ok1 && ok2; + //} + + return ok1 && ok2; +} + +bool ExamSensor::filterGpsWrong(TGpsInfo* gps, const TGpsInfo* h_gps) +{ + //位置差分, 角度差分 + if(gps->dwzt == gpsStatusNARROW_INT && gps->jdzt == gpsStatusANGLE) { - logwarning("errorFlag invalid dwzt=%d, jdzt=%d, jd=%0.8f, wd=%0.8f", gps.dwzt, gps.jdzt, gps.jd, gps.wd); + gps->rtkEnabled = true; + } + else + { + gps->rtkEnabled = false; + logwarning("rtk Enabled not, dwzt=%d, jdzt=%d", gps->dwzt, gps->jdzt); + } + + gps->errorFlag = false; + //过滤GPS漂移数据 + if(h_gps != nullptr) + { + int64 interval = std::abs(gps->sj - h_gps->sj); + //如果是正常连续数据才判断漂移,有可能是断网收不到数据,然后过了几秒又收到数据距离会远超过限制距离 + if(interval < 1*SECOND) + { + TGPSPoint p1 = h_gps->to(); + TGPSPoint p2 = gps->to(); + double distance = GpsMath::calcGpsDistanceCM(p1, p2, p1.gc); + if(distance > DEVIATION_RANGE_DISTANCE_CM) + { + logwarning("deviation rang distance=%0.2f CM", distance); + gps->errorFlag = true; + } + double angle = std::abs(gps->hxj - h_gps->hxj); + if(angle > DEVIATION_RANGE_ANGLE_MIN && angle < DEVIATION_RANGE_ANGLE_MAX) + { + logwarning("deviation rang angle=%0.2f", angle); + gps->errorFlag = true; + } + } + } + + if(gps->errorFlag) + { + logwarning("errorFlag invalid dwzt=%d, jdzt=%d, jd=%0.8f, wd=%0.8f", gps->dwzt, gps->jdzt, gps->jd, gps->wd); return false; } - if(!gps.valid()) + if(!gps->valid()) { - logwarning("gps invalid dwzt=%d, jdzt=%d, jd=%0.8f, wd=%0.8f", gps.dwzt, gps.jdzt, gps.jd, gps.wd); + logwarning("gps invalid dwzt=%d, jdzt=%d, jd=%0.8f, wd=%0.8f", gps->dwzt, gps->jdzt, gps->jd, gps->wd); return false; } - ExamSubject sub = m_car->examSubject(); - if(ExamSubject2 == sub) - { - //return gps.rtkEnabled == true && gps.valid(); - return gps.valid(); //2025-03-20 modify - } - else if(ExamSubject3 == sub) - { - if(gps.valid()) //20240811 yhy - { - //数据是正常的 - } - else - { - //if(m_car->historyCount() > 0) - //{ - // cloneWith(m_car->historyChuanGan(), cg); - //} - } - return true; - } - return true; } diff --git a/entry/src/main/cpp/sdk/exam/ExamSensor.h b/entry/src/main/cpp/sdk/exam/ExamSensor.h index 0e4072a8..5276616d 100644 --- a/entry/src/main/cpp/sdk/exam/ExamSensor.h +++ b/entry/src/main/cpp/sdk/exam/ExamSensor.h @@ -26,6 +26,7 @@ public: virtual bool calcCarBody(TChuanGan* cg); //过滤异常数据 virtual bool filterWrong(TChuanGan* cg); + virtual bool filterGpsWrong(TGpsInfo* gps, const TGpsInfo* h_gps); //计算考车状态(科目三) virtual bool GetCarDirStauts(TChuanGan* cg); //计算考车状态(科目二) diff --git a/entry/src/main/cpp/sdk/exam/IExamCar.cpp b/entry/src/main/cpp/sdk/exam/IExamCar.cpp index 18c636e2..c3ba0db9 100644 --- a/entry/src/main/cpp/sdk/exam/IExamCar.cpp +++ b/entry/src/main/cpp/sdk/exam/IExamCar.cpp @@ -483,6 +483,26 @@ void IExamCar::examPerformSummary() exam.bxjl = dis.y*10; //单位毫米 所以要乘10 exam.hint = m_message; exam.lane = historyChuanGan()->RTKKM3; + ExamCarType cartype = carType(); + if(IS_A2C6(cartype)) + { + //对于牵引车,车身距离都是指的挂车(车厢),如果车轮,车前轮指的是车头的轮子,车后轮指的挂车最后面轮子,和军华确认过的 2025-05-13 + const TRTKResult& rtkTail = historyChuanGan()->RTKKM3_Tail; + TRTKResult& lane = exam.lane; + + lane.Body_LF_ToLeftEdge = rtkTail.Body_LF_ToLeftEdge; + lane.Body_LB_ToLeftEdge = rtkTail.Body_LB_ToLeftEdge; + lane.Body_RF_ToRightEdge = rtkTail.Body_RF_ToRightEdge; + lane.Body_RB_ToRightEdge = rtkTail.Body_RB_ToRightEdge; + lane.Body_RF_ToBaseLine = rtkTail.Body_RF_ToBaseLine; + lane.Body_RB_ToBaseLine = rtkTail.Body_RB_ToBaseLine; + + lane.Wheel_RB_ToRightEdge = rtkTail.Wheel_RB_ToRightEdge; + lane.Wheel_RB_ToBaseLine = rtkTail.Wheel_RB_ToBaseLine; + lane.Wheel_LB_ToRightEdge = rtkTail.Wheel_LB_ToRightEdge; + lane.Wheel_LB_ToBaseLine = rtkTail.Wheel_LB_ToBaseLine; + + } std::string data = XParser::toAny(exam); FactoryExamService->examJudgeCallbackPerformToCaller(data.c_str(), data.size()); diff --git a/entry/src/main/cpp/sdk/exam/IExamCar.h b/entry/src/main/cpp/sdk/exam/IExamCar.h index 5edb854c..7aa03a69 100644 --- a/entry/src/main/cpp/sdk/exam/IExamCar.h +++ b/entry/src/main/cpp/sdk/exam/IExamCar.h @@ -89,6 +89,7 @@ public: virtual ISurveyCarAbstract* carModel() MEANS { return m_carModel; } virtual int modelSize() MEANS { return m_carModel->size(); } virtual ExamSubject examSubject() MEANS { return ExamSubject(m_carInfo->kskm); } + virtual const std::string& carVerison() MEANS { return m_carInfo->sdkver; } virtual int carID() MEANS { return m_carInfo->kchm; } virtual const std::string& carClass() MEANS { return m_carInfo->name; } virtual int carCode() MEANS { return m_carCode; } diff --git a/entry/src/main/cpp/sdk/exam/IExamCarAbstract.h b/entry/src/main/cpp/sdk/exam/IExamCarAbstract.h index 0c4c1f80..67e30787 100644 --- a/entry/src/main/cpp/sdk/exam/IExamCarAbstract.h +++ b/entry/src/main/cpp/sdk/exam/IExamCarAbstract.h @@ -104,6 +104,8 @@ public: virtual int modelSize() const = 0; //考试科目 virtual ExamSubject examSubject() const = 0; + //轨迹初始化版本号 + virtual const std::string& carVerison() const = 0; //考车ID virtual int carID() const = 0; //考车名称 diff --git a/entry/src/main/cpp/sdk/graphic/GraphicImage.cpp b/entry/src/main/cpp/sdk/graphic/GraphicImage.cpp index 2b2258bb..94aa126f 100644 --- a/entry/src/main/cpp/sdk/graphic/GraphicImage.cpp +++ b/entry/src/main/cpp/sdk/graphic/GraphicImage.cpp @@ -136,12 +136,6 @@ const char* GraphicImage::image() #endif int offset_y = 1; - if(m_showVersion) - { - drawText(Pointi(1, offset_y), JUDGE_VERSION_INFO, RGB_BLUE, 16); - offset_y += 16; - } - if(m_showTime) { int64 tick = Tools::nowTime(); @@ -149,6 +143,11 @@ const char* GraphicImage::image() drawText(Pointi(1, offset_y), tm.c_str(), RGB_PERILLA, 16); offset_y += 16; } + //if(m_showVersion) + //{ + // drawText(Pointi(1, offset_y), JUDGE_VERSION_INFO, RGB_BLUE, 16); + // offset_y += 16; + //} toRgb(); return (const char*)m_rgb; diff --git a/entry/src/main/cpp/sdk/judge/sub3/ISub3JudgeWrap.h b/entry/src/main/cpp/sdk/judge/sub3/ISub3JudgeWrap.h index e6ff0744..6ffeae50 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/ISub3JudgeWrap.h +++ b/entry/src/main/cpp/sdk/judge/sub3/ISub3JudgeWrap.h @@ -95,6 +95,8 @@ protected: //当前路段是否禁止左右转、直行、掉头 bool forbidInLane(const std::string& laneDir, TURN_TYPE d); + bool judgeAllowable() { return true; /*(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) ? false : true; */ } + //显示状态信息 void showStatus(const std::string& msg); protected: diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge01Sczb.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge01Sczb.cpp index 021b17a4..514ec206 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge01Sczb.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge01Sczb.cpp @@ -101,7 +101,7 @@ void Sub3Judge01Sczb::dealJudgeItem() HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; //超声波评判跟差分信号没有关系,所以不做差分信号状态的判断 - //if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + //if(!judgeAllowable()) return; const std::string& s386 = TableSysSet->get386(); //if(s386 == "3") //无锡地区模式只要发动机启动了,点切换就上车准备自动完成播报模拟灯光 diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.cpp index b8a6de20..d60df9d2 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.cpp @@ -52,6 +52,16 @@ bool Sub3Judge02Qbxx::dealJudgeEnter() m_exam->TestPro = ItemProFlagJudge; //ToDo2:生成进项目事件 + + if(m_car->examAlready(Sub3ItemType01Sczb) && m_car->examAlready(Sub3ItemType41Mndg)) + { + if(!m_sound_qibu) + { + m_sound_qibu = true; + m_car->createEventSound({m_exam->ItemNo, sound::sub3_402001}); + } + } + return true; } @@ -63,7 +73,7 @@ void Sub3Judge02Qbxx::dealJudgeItem() HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; const TChuanGan* cg = m_car->historyChuanGan(); const TSensorInfo& sor = cg->real.sensor; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.h b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.h index 6307bdea..1d3a3501 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.h +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge02Qbxx.h @@ -69,7 +69,7 @@ protected: private: TSub3Item02Qbxx m_itemv; bool m_Pub_First_QiBu_Flag = false; //起步方向灯和喇叭 只判一次 第一次进起步项目才判 - + bool m_sound_qibu = false; //**********************以下是新科目三************************ private: //起步项目中,车辆状态从停止切换前进前10s内,头部姿态没有大于左后侧角度【23度】 diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge03Zxxs.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge03Zxxs.cpp index 1a5c81d1..811b024e 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge03Zxxs.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge03Zxxs.cpp @@ -105,7 +105,7 @@ void Sub3Judge03Zxxs::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; const TChuanGan* cg = m_car->historyChuanGan(); const TRTKResult& RTKKM3 = cg->RTKKM3; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge04Bgcd.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge04Bgcd.cpp index fcf7a5ca..86745870 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge04Bgcd.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge04Bgcd.cpp @@ -56,7 +56,7 @@ void Sub3Judge04Bgcd::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; const TChuanGan* cg = m_car->historyChuanGan(); const TRTKResult& RTKKM3 = cg->RTKKM3; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge05Lkzx.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge05Lkzx.cpp index 96ea70e9..730f08a9 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge05Lkzx.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge05Lkzx.cpp @@ -78,7 +78,7 @@ void Sub3Judge05Lkzx::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; //setup1: 路口类型 1-平交 2-环道 3-三叉 缺省 1-平交 //setup2: 限速值,通过路口停车线时的车速 缺省 35 diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge06Rxhd.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge06Rxhd.cpp index a3f2229c..f9fb7437 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge06Rxhd.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge06Rxhd.cpp @@ -110,7 +110,7 @@ void Sub3Judge06Rxhd::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; const TChuanGan* cg = m_car->historyChuanGan(); const TSensorInfo& sor = cg->real.sensor; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge07Xxqy.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge07Xxqy.cpp index 8a4745cf..9558c20a 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge07Xxqy.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge07Xxqy.cpp @@ -82,7 +82,7 @@ void Sub3Judge07Xxqy::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; const TChuanGan* cg = m_car->historyChuanGan(); const TSensorInfo& sor = cg->real.sensor; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge08Gjzt.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge08Gjzt.cpp index 039e353a..2397bfa0 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge08Gjzt.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge08Gjzt.cpp @@ -93,7 +93,7 @@ void Sub3Judge08Gjzt::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; const TChuanGan* cg = m_car->historyChuanGan(); const TRTKResult& RTKKM3 = cg->RTKKM3; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge09Hcxx.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge09Hcxx.cpp index 5c480b73..ee1cfe35 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge09Hcxx.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge09Hcxx.cpp @@ -63,7 +63,7 @@ void Sub3Judge09Hcxx::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; const TChuanGan* cg = m_car->historyChuanGan(); const TRTKResult& RTKKM3 = cg->RTKKM3; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge10Ccxx.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge10Ccxx.cpp index 13555f9e..2815d334 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge10Ccxx.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge10Ccxx.cpp @@ -144,7 +144,7 @@ void Sub3Judge10Ccxx::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; const TChuanGan* cg = m_car->historyChuanGan(); const TRTKResult& RTKKM3 = cg->RTKKM3; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge11Kbtc.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge11Kbtc.cpp index 5e0413db..c81de233 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge11Kbtc.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge11Kbtc.cpp @@ -141,7 +141,7 @@ void Sub3Judge11Kbtc::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - //if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + //if(!judgeAllowable()) return; const TChuanGan* cg = m_car->historyChuanGan(); const TSensorInfo& sor = cg->real.sensor; @@ -554,7 +554,7 @@ void Sub3Judge11Kbtc::DoStatus_2() else if(s430 == "1") //拉手刹放空挡 { //20180625 - if(sor.ssc == SYES && sor.dw == 0) + if(sor.ssc == SYES && (sor.dw == 0 || sor.dw == 10)) { m_itemv.Status = 3; return; @@ -699,8 +699,14 @@ void Sub3Judge11Kbtc::DoStatus_3() } //压路边线 - Judge_KBTC_YaXian(); - Judge_KBTC_YaXian_Tail(); //A2C6-20250314 + if(!IS_A2C6(m_carType)) + { + Judge_KBTC_YaXian(); + } + else + { + Judge_KBTC_YaXian_Tail(); //A2C6-20250314 + } } else @@ -1077,8 +1083,14 @@ void Sub3Judge11Kbtc::DoStatus_4() { if(m_car->rtkEnabled()) { - Judge_KBTC_YaXian(); - Judge_KBTC_YaXian_Tail(); //A2C6-20250314 + if(!IS_A2C6(m_carType)) + { + Judge_KBTC_YaXian(); + } + else + { + Judge_KBTC_YaXian_Tail(); //A2C6-20250314 + } } } // 20171211 } @@ -1307,7 +1319,6 @@ void Sub3Judge11Kbtc::Judge_KBTC_YaXian() RightJL1_RF = RTKKM3_1.Body_RF_ToBaseLine; RightJL2_RF = RTKKM3_2.Body_RF_ToBaseLine; - RightJL0_RB = RTKKM3_0.Body_RB_ToBaseLine; RightJL1_RB = RTKKM3_1.Body_RB_ToBaseLine; RightJL2_RB = RTKKM3_2.Body_RB_ToBaseLine; @@ -1457,16 +1468,20 @@ void Sub3Judge11Kbtc::Judge_KBTC_YaXian_Tail() RightJL1_RF = RTKKM3_Tail_1.Body_RF_ToBaseLine; RightJL2_RF = RTKKM3_Tail_2.Body_RF_ToBaseLine; - RightJL0_RB = RTKKM3_Tail_0.Body_RB_ToBaseLine; RightJL1_RB = RTKKM3_Tail_1.Body_RB_ToBaseLine; RightJL2_RB = RTKKM3_Tail_2.Body_RB_ToBaseLine; } else { - RightJL0_RF = RTKKM3_Tail_0.Wheel_RF_ToBaseLine; - RightJL1_RF = RTKKM3_Tail_1.Wheel_RF_ToBaseLine; - RightJL2_RF = RTKKM3_Tail_2.Wheel_RF_ToBaseLine; + //对于牵引车,车身距离都是指的挂车(车厢),如果车轮,车前轮指的是车头的轮子,车后轮指的挂车最后面轮子,和军华确认过的 2025-05-13 + const TRTKResult& RTKKM3_0 = m_car->historyRtkKM3(0); + const TRTKResult& RTKKM3_1 = m_car->historyRtkKM3(1); + const TRTKResult& RTKKM3_2 = m_car->historyRtkKM3(2); + + RightJL0_RF = RTKKM3_0.Wheel_RF_ToBaseLine; + RightJL1_RF = RTKKM3_1.Wheel_RF_ToBaseLine; + RightJL2_RF = RTKKM3_2.Wheel_RF_ToBaseLine; RightJL0_RB = RTKKM3_Tail_0.Wheel_RB_ToBaseLine; RightJL1_RB = RTKKM3_Tail_1.Wheel_RB_ToBaseLine; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge12Lkdt.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge12Lkdt.cpp index 4319137b..82f7b81f 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge12Lkdt.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge12Lkdt.cpp @@ -59,7 +59,7 @@ void Sub3Judge12Lkdt::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; //setup1: 路口类型 1-平交 2-环道 3-三叉 缺省 1-平交 //setup2: 限速值,通过路口停车线时的车速 缺省 35 diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge12Ptdt.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge12Ptdt.cpp index bf35af8f..b39d5810 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge12Ptdt.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge12Ptdt.cpp @@ -48,7 +48,7 @@ void Sub3Judge12Ptdt::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; const TChuanGan* cg = m_car->historyChuanGan(); const TRTKResult& RTKKM3 = cg->RTKKM3; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge14Jjdw.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge14Jjdw.cpp index 29cb18d2..8aa977e9 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge14Jjdw.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge14Jjdw.cpp @@ -31,7 +31,7 @@ void Sub3Judge14Jjdw::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; std::string Str425; std::string TempLog; diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge15Lkzz.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge15Lkzz.cpp index 3c5734eb..aa27c636 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge15Lkzz.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge15Lkzz.cpp @@ -73,7 +73,7 @@ void Sub3Judge15Lkzz::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; //setup1: 路口类型 1-平交 2-环道 3-三叉 缺省 1-平交 //setup2: 限速值,通过路口停车线时的车速 缺省 35 diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge16Lkyz.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge16Lkyz.cpp index ffaf466f..60e939a9 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge16Lkyz.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge16Lkyz.cpp @@ -73,7 +73,7 @@ void Sub3Judge16Lkyz::dealJudgeItem() { HELP_COST_TIME(""); if(m_exam->TestPro != ItemProFlagJudge) return; - if(!m_car->rtkEnabled() || !m_car->rtkEnabled(1)) return; + if(!judgeAllowable()) return; //setup1: 路口类型 1-平交 2-环道 3-三叉 缺省 1-平交 //setup2: 限速值,通过路口停车线时的车速 缺省 35 diff --git a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge20Comm.cpp b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge20Comm.cpp index d7d0a589..e2d5527b 100644 --- a/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge20Comm.cpp +++ b/entry/src/main/cpp/sdk/judge/sub3/Sub3Judge20Comm.cpp @@ -868,7 +868,8 @@ void Sub3Judge20Comm::CallMoNiDengGuang() if(m > 0) { - if(m_engineTick > 0 && cg->tkCnt - m_engineTick > m*SECOND) + //if(m_engineTick > 0 && cg->tkCnt - m_engineTick > m*SECOND) + if(m_engineTick > 0 && m_car->timeElapsed() > m*SECOND) { JUDGE_MARK_SUB3(20, "94", true); } diff --git a/entry/src/main/ets/api/judgeNew.ts b/entry/src/main/ets/api/judgeNew.ts index bad95561..b2de1816 100644 --- a/entry/src/main/ets/api/judgeNew.ts +++ b/entry/src/main/ets/api/judgeNew.ts @@ -76,13 +76,24 @@ export default async function writeObjectOutNew(data, filePath): Promise { await systemPasteboard.clear() await systemPasteboard.setData(pasteData) } catch (e) { - console.log("wzj pasteboard error", e,"项目代码:", params.data.param.ksxm) + console.log("wzj pasteboard error", e, "项目代码:", params.data.param.ksxm) } let fn = () => { return new Promise((resolve, reject) => { + let tick = setTimeout(() => { + emitter.emit({ + eventId: 1 + }) + reject({ + code: 1, data: { + code: 2300007 + } + }) + }, 15 * 1000) console.log("wzj process start,项目代码:", params.data.param.ksxm) globalThis.serviceExtProxy.processData("1", (errorCode: number, retVal: string) => { - console.log("lixiao process accept,项目代码:", params.data.param.ksxm," 错误码:", errorCode, JSON.stringify(retVal)) + console.log("lixiao process accept,项目代码:", params.data.param.ksxm, " 错误码:", errorCode, JSON.stringify(retVal)) + clearTimeout(tick) let result = JSON.parse(retVal) if (result.code === 0) { resolve(result.data) @@ -92,7 +103,6 @@ export default async function writeObjectOutNew(data, filePath): Promise { }) reject(result.data) } - // console.log(`js-test index.ets processData, errorCode: ${errorCode}, retVal: ${retVal}`); }); }) } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index d4eb9c48..16dd71a4 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -52,6 +52,8 @@ struct Index { confirm: () => { } }), + + customStyle: true, alignment: DialogAlignment.Center, }) @@ -60,7 +62,7 @@ struct Index { private context = getContext(this) as common.UIAbilityContext; private serviceExtProxy: IdlServiceExtProxy @State judgeVersion: string = "" - private version: string = "2025.05.06.01" + private version: string = "2025.05.09.01" @Styles commStyle(){ @@ -452,7 +454,6 @@ struct Index { } }) }); - } aboutToDisappear() { @@ -463,10 +464,6 @@ struct Index { if (this.loading) { return } - // let mode=globalThis.timeInfo?.mode?globalThis.timeInfo?.mode:1 - - // console.log('mode',mode) - const param = { carId: globalThis.carInfo?.carId, examinationRoomId: globalThis.carInfo?.examinationRoomId, @@ -481,30 +478,18 @@ struct Index { singlePlay: globalThis.singlePlay } this.loading = true - console.log("sql 1111") getSingleCenterTable(param).then((ret) => { - console.log('teststetfinsh1', ret) - // DB.queryListBySql('select * from MA_SYSSET', [{ - // name: "v_no", - // type: ColumnType.STRING, - // columnName: "v_no" - // }]).then((res) => { - // console.log('sql success', JSON.stringify(res)) - // }).catch((err) => { - // console.log('sql error1', err) - // }) + console.log('getSingleCenterTable finish', ret) if (ret) { - getSyncData('MA_SYSSET').then(data => { - console.log('datadata', JSON.stringify(data)) - // @ts-ignore + getSyncData('MA_SYSSET').then((data: any[]) => { + console.log('MA_SYSSET data', JSON.stringify(data)) data.forEach(sys => { //判断是否能点开始考试 if (sys.v_no === '854') { globalThis.param854Str = sys.v_value } if (sys.v_no === '824' && decodeURIComponent(sys.v_value) == '0') { - // this.Param612Str= decodeURIComponent(sys.v_value) router.pushUrl({ url: 'pages/CarCheck', params: { @@ -517,9 +502,12 @@ struct Index { }, router.RouterMode.Single) } }) + }).finally(() => { + this.loading = false }); - } + }).finally(() => { + this.loading = false }) } @@ -568,9 +556,7 @@ struct Index { globalThis.singlePlay = false } this.isSingle = globalThis.singlePlay - // this.loading = false this.num = 0 - // const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort) globalThis.lsh = '1111111111111' } @@ -611,7 +597,6 @@ struct Index { console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`); }) }) - } async initParams() { diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 9515c312..156645b9 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -109,7 +109,6 @@ struct UserInfo { if (this.ksksLimit) { return } - console.log('routerParamrouterParam') try { await this.checkSignal() this.faceCompareSucess = 0 @@ -140,7 +139,6 @@ struct UserInfo { // 同一学员连续第二次考试时不再验证身份 if (this.currentUser.kssycs == '1' && this.systemParam.Param830Str == '1') { this.sfbdinterfaceFn() - } else { this.ksksLimit = false this.showFaceCompare = true @@ -891,14 +889,24 @@ struct UserInfo { const {carId,examinationRoomId} = carInfo; let examItems = { getExaminationItemRsp: { body: { ykxx: '' } } }; if (!globalThis.singlePlay) { - //获取已考项目 - // @ts-ignore - examItems = await getExaminationItem({ - time: getCurrentTime(), - carId, - lsh: this.currentUser.lsh || '', - examinationRoomId - }) + try { + //获取已考项目 + // @ts-ignore + examItems = await getExaminationItem({ + time: getCurrentTime(), + carId, + lsh: this.currentUser.lsh || '', + examinationRoomId + }) + } catch (e) { + promptAction.showToast({ + message: "获取考试信息失败,请重试", + duration: 3000 + }) + this.isLoadingPopupVisible = false + this.isExamStart = false + return + } } this.currentUser.id = '1' const avPlayer = this.avPlayer; @@ -906,38 +914,45 @@ struct UserInfo { avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => { console.info('surenjun', '播放结束开始考试接口调用') - const {code,keystr,message} = await this.beginExam() || {}; - console.info('surenjun', '开始考试接口调用结束') - // console.info('surenjun',code +'') - //@ts-ignore TODO code转换 - - if (code != 1) { - avPlayer.playAudio([code == -200 ? 'voice/photo_error.mp3' : 'voice/监管审核未通过.mp3']); + try { + const {code,keystr,message} = await this.beginExam() || {}; + console.info('surenjun', '开始考试接口调用结束') + if (code != 1) { + avPlayer.playAudio([code == -200 ? 'voice/photo_error.mp3' : 'voice/监管审核未通过.mp3']); + this.isLoadingPopupVisible = false + this.isExamStart = false + promptAction.showToast({ + message, + duration: 4000 + }) + return + } + this.currentUser.id = '0' + await upDateTableByArray('USER', [this.currentUser]) + this.stepFlag = false + this.isLoadingPopupVisible = false + router.pushUrl({ + url: 'pages/Judge', + params: { + examItems: examItems?.getExaminationItemRsp?.body?.ykxx, + sczb: Number(this.isBoardPrePareSetPopupOpen), + kfdm: this.sczbkf, + //真实监管项目 + kString: decodeURIComponent(keystr || '') + } + }, router.RouterMode.Single); + this.updateTimeLimit = false + this.stopDeviceById() + this.stepFlag = false + } catch (e) { + promptAction.showToast({ + message: "监管审核失败,请重试", + duration: 3000 + }) this.isLoadingPopupVisible = false this.isExamStart = false - promptAction.showToast({ - message, - duration: 4000 - }) return } - this.currentUser.id = '0' - await upDateTableByArray('USER', [this.currentUser]) - this.stepFlag = false - this.isLoadingPopupVisible = false - router.pushUrl({ - url: 'pages/Judge', - params: { - examItems: examItems?.getExaminationItemRsp?.body?.ykxx, - sczb: Number(this.isBoardPrePareSetPopupOpen), - kfdm: this.sczbkf, - //真实监管项目 - kString: decodeURIComponent(keystr || '') - } - }, router.RouterMode.Single); - this.updateTimeLimit = false - this.stopDeviceById() - this.stepFlag = false }) } @@ -1097,9 +1112,7 @@ struct UserInfo { }).catch(err => { console.log("USER insert fail", JSON.stringify(err)) }) - // await upDateTableByArray('USER', [this.currentUser]) console.log("User", JSON.stringify(this.currentUser)) - // await sqlInsertCommonFn("USER", [this.currentUser]) globalThis.statue = 4 this.isBoardPrePareSetPopupShow = true; this.isFirstBoardPrePareSetPopupBtnShow = true; @@ -1284,9 +1297,9 @@ struct UserInfo { return } //835参数值和预约考试次数对比 - if(Number(this.systemParam.Param835)<=Number(this.currentUser.yycs)&&!globalThis.singlePlay){ - this.type='4' - this.title='当前考生预约考试次数为'+this.currentUser.yycs + if (Number(this.systemParam.Param835) <= Number(this.currentUser.yycs) && !globalThis.singlePlay) { + this.type = '4' + this.title = '当前考生预约考试次数为' + this.currentUser.yycs this.errorDialog.open() return } @@ -1446,5 +1459,5 @@ type systemParam = { 'Param830Str': string, //同一学员连续第二次考试时不再验证身份 'Param364': string, //考前上车准备 'Param398': string, //考前上车准备 - 'Param835' :string + 'Param835': string } \ No newline at end of file diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index 0d9d3833..4ca85062 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -54,6 +54,7 @@ import { examJudgeVersion } from './api/index'; import { getSyncData, upDateTableByArray } from '../../common/service/initable'; +import promptAction from '@ohos.promptAction'; const judgeTag = 'SURENJUN_JUDGE' @@ -382,10 +383,10 @@ export default class Judge { //成绩不合格 if (totalScore < passingGrade) { //科目三不合格报靠边停车 - if (examSubject == 3 ) { - if( param302 == 1){ + if (examSubject == 3) { + if (param302 == 1) { avPlayer.playAudio([`voice/考试结束.mp3`]); - }else if(param302 == 0){ + } else if (param302 == 0) { return } } @@ -895,7 +896,7 @@ export default class Judge { //扣分 case 3: const thisKf = getKfStr(`${kf.xmdm}_${kf.kfdm}`) - //扣分信息 + //扣分信息 this.kfArr.push({ //扣分项目名称 xmmcStr: getDqxmStr(kf.xmdm), @@ -1037,20 +1038,20 @@ export default class Judge { const code = projectsObj[xmdm].projectCodeCenter; const isEnd = projectsObj[xmdm].isEnd; const kmCode = getKmProjectVoice(code, 1, judgeConfigObj, lane, xmxh) - // if (!ignoreVoiceCodeArr.includes(code)) { - // if(examSubject == 2 && ((xmdm == 0 && f == 2) || (xmdm == 1 && s == 2) || xmdm == 3)){ - // //倒出入库、桩考\进项目语音控制 - // }else{ - // kmCode && avPlayer.playAudio([`voice/${kmCode}.mp3`],true) - // } - // } + // if (!ignoreVoiceCodeArr.includes(code)) { + // if(examSubject == 2 && ((xmdm == 0 && f == 2) || (xmdm == 1 && s == 2) || xmdm == 3)){ + // //倒出入库、桩考\进项目语音控制 + // }else{ + // kmCode && avPlayer.playAudio([`voice/${kmCode}.mp3`],true) + // } + // } setTimeout(() => { if (param512[7] != 0) { clearTimeout(this.deductedPopShowTimer) this.judgeUI.isDeductedPopShow = true } }, 200) - //项目已考不上传监管信息 + //项目已考不上传监管信息 if (!isEnd) { judgeTask.addTask(async () => { console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) @@ -1103,7 +1104,7 @@ export default class Judge { // 扣分 case 3: console.info('surenjun', '扣分开始') - //扣分时实时播报语音(0-否+1-是) + //扣分时实时播报语音(0-否+1-是) const currentKf = kf[kfLen -1]; if (judgeConfig.kfVoiceOpen || (examSubject == 2 && judgeConfigObj['618'] == '1') || (examSubject == 3 && judgeConfigObj['418'] == '1')) { @@ -1127,7 +1128,7 @@ export default class Judge { // 考试结束 case 5: console.info(judgeTag, '考试结束') - //关闭录像 + //关闭录像 if (!globalThis.singlePlay) { await endRecordVideo(this.videoData) } @@ -1226,7 +1227,7 @@ export default class Judge { }) } else { //收到综合评判语音时,显示综合评判弹窗 - if(code[0] == 'zhpp'){ + if (code[0] == 'zhpp') { clearTimeout(this.deductedPopShowTimer) this.judgeUI.isDeductedPopShow = true this.judgeUI.defaultTabIndex = 1 @@ -1298,135 +1299,142 @@ export default class Judge { judgeUI, ksjs, getPhoto, - uploadProgressData, - uploadDisConnectData, avPlayer, kfArr, - judgeTask, filePath, closeAllFiles } = this; const { lsh, idCard, serialNumber, kssycs, totalScore, judgeConfigObj, isAllProjectsEnd, passingScore } = judgeUI //TODO 断网考试结束补传 // await uploadDisConnectData(); - const time = await getCurrentTime(); - const photoBase64 = await getPhoto(); - const { d1, d2, d3, d4, d5 } = 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(';'), + try { + const time = await getCurrentTime(); + const photoBase64 = await getPhoto(); + const { d1, d2, d3, d4, d5 } = 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(() => { - router.back() - }, 90 * 1000) - const { code, keystr, message } = await this.sendWriteObjectOut(data, filePath); - promptWxCode('17C56', code) + let backTimeOut = setTimeout(() => { + router.back() + }, 90 * 1000) + const { code, keystr, message } = await this.sendWriteObjectOut(data, filePath); + promptWxCode('17C56', code) - if (code != 1) { - avPlayer.playAudio(['voice/监管失败.mp3']) - this.judgeUI.errorMsg = decodeURIComponent(message) + if (code != 1) { + avPlayer.playAudio(['voice/监管失败.mp3']) + this.judgeUI.errorMsg = decodeURIComponent(message) - if (code == 2300028 || code == 2300007) { - this.judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!' + if (code == 2300028 || code == 2300007) { + this.judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!' + } + this.isUdpEnd = true; + closeAllFiles() + this.judgeUI.loadingPopupVisible = false; + return } - this.isUdpEnd = true; - closeAllFiles() - this.judgeUI.loadingPopupVisible = false; - return - } - console.info(judgeTag, '考试结束 end') - const param302 = judgeConfigObj['302']; - judgeUI.loadingPopupVisible = true; - let currentKssycs = 0; - let voiceURL = '' - if (examSubject == 2) { - if (isAllProjectsEnd) { - voiceURL = - (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') - } else { - voiceURL = `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` - currentKssycs = kssycs == 1 ? 0 : 1 - } - switch (voiceURL) { - case 'voice/unqualified_one.wav': - currentKssycs = 0; - break; + console.info(judgeTag, '考试结束 end') + const param302 = judgeConfigObj['302']; + judgeUI.loadingPopupVisible = true; + let currentKssycs = 0; + let voiceURL = '' + if (examSubject == 2) { + if (isAllProjectsEnd) { + voiceURL = + (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') + } else { + voiceURL = `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` + currentKssycs = kssycs == 1 ? 0 : 1 + } + switch (voiceURL) { + case 'voice/unqualified_one.wav': + currentKssycs = 0; + break; - case 'voice/unqualified_two.wav': - currentKssycs = 1; - break; + case 'voice/unqualified_two.wav': + currentKssycs = 1; + break; - case 'voice/qualified.mp3': - currentKssycs = 0; - break; + case 'voice/qualified.mp3': + currentKssycs = 0; + break; + } } - } - if (examSubject == 3) { - if (isAllProjectsEnd) { - if (totalScore < passingScore) { + if (examSubject == 3) { + if (isAllProjectsEnd) { + if (totalScore < passingScore) { + voiceURL = `voice/${kssycs == 1 ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3` + currentKssycs = kssycs == 1 ? 0 : 1 + } else { + voiceURL = 'voice/exam_pass.mp3' + currentKssycs = 0 + } + } else { voiceURL = `voice/${kssycs == 1 ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3` currentKssycs = kssycs == 1 ? 0 : 1 - } else { - voiceURL = 'voice/exam_pass.mp3' - currentKssycs = 0 } - } else { - voiceURL = `voice/${kssycs == 1 ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3` - currentKssycs = kssycs == 1 ? 0 : 1 + switch (voiceURL) { + case 'voice/exam_no_pass_finish.mp3': + currentKssycs = 0; + break; + + case 'voice/exam_no_pass.mp3': + currentKssycs = 1; + break; + + case 'voice/exam_pass.mp3': + currentKssycs = 0; + break; + + } } - switch (voiceURL) { - case 'voice/exam_no_pass_finish.mp3': - currentKssycs = 0; - break; - case 'voice/exam_no_pass.mp3': - currentKssycs = 1; - break; - - case 'voice/exam_pass.mp3': - currentKssycs = 0; - break; + const USER = await getSyncData('USER'); + await upDateTableByArray('USER', [{ + ...USER[0], + kssycs: currentKssycs + }]) + console.info(judgeTag, `考试成绩:${totalScore}`) + if (!singlePlay) { + // await uploadProgressData(); } - } - - const USER = await getSyncData('USER'); - await upDateTableByArray('USER', [{ - ...USER[0], - kssycs: currentKssycs - }]) - - console.info(judgeTag, `考试成绩:${totalScore}`) - if (!singlePlay) { - // await uploadProgressData(); - } - clearTimeout(backTimeOut) - //语音播放扣分项 - let score = 0; - //结束考试时候是否播报一遍所有扣分 - const param634 = judgeConfigObj['634']; - if (kfArr.length && ((examSubject == 2 && param634 == 1) || examSubject == 3)) { - avPlayer.playAudio([`voice/kfdesc.mp3`], false, () => { - try { - kfArr.forEach((kf, index) => { - score += Math.abs(Number(kf.score)); - //TODO 考试分数待替换 - if (score <= (examSubject == 3 ? 10 : 20)) { - if (kfArr.length - 1 === index) { + clearTimeout(backTimeOut) + //语音播放扣分项 + let score = 0; + //结束考试时候是否播报一遍所有扣分 + const param634 = judgeConfigObj['634']; + if (kfArr.length && ((examSubject == 2 && param634 == 1) || examSubject == 3)) { + avPlayer.playAudio([`voice/kfdesc.mp3`], false, () => { + try { + kfArr.forEach((kf, index) => { + score += Math.abs(Number(kf.score)); + //TODO 考试分数待替换 + if (score <= (examSubject == 3 ? 10 : 20)) { + if (kfArr.length - 1 === index) { + avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { + this.isUdpEnd = true; + closeAllFiles() + router.back(); + }) + throw new Error('End Loop') + } + avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`]) + } else { avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { this.isUdpEnd = true; closeAllFiles() @@ -1434,28 +1442,27 @@ export default class Judge { }) throw new Error('End Loop') } - avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`]) - } else { - avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { - this.isUdpEnd = true; - closeAllFiles() - router.back(); - }) - throw new Error('End Loop') - } - }) - } catch (e) { - console.info(judgeTag, JSON.stringify(e)) - } - }) - } else { - avPlayer.playAudio([voiceURL], true, () => { - setTimeout(() => { - this.isUdpEnd = true - closeAllFiles() - router.back(); - }, param302 == 8 ? 3000 : 0) + }) + } catch (e) { + console.info(judgeTag, JSON.stringify(e)) + } + }) + } else { + avPlayer.playAudio([voiceURL], true, () => { + setTimeout(() => { + this.isUdpEnd = true + closeAllFiles() + router.back(); + }, param302 == 8 ? 3000 : 0) + }) + } + + } catch (e) { + promptAction.showToast({ + message: "考试结束异常,请尝试重新结束", + duration: 3000 }) + judgeUI.loadingPopupVisible = false } } @@ -1742,7 +1749,7 @@ export default class Judge { case 4: this.judgeUI.isDwztRight = false; - //差分异常上报 + //差分异常上报 break; } }