单机模式优化
This commit is contained in:
parent
c6bffaaf6f
commit
7c57ba3e93
@ -1,42 +1,42 @@
|
||||
import systemTime from '@ohos.systemTime';
|
||||
import systemDateTime from '@ohos.systemDateTime';
|
||||
import { timeSynchronization } from '../../api/index'
|
||||
import { dateFormat,dateVersionFormat } from '../utils/tools';
|
||||
import { dateFormat, dateVersionFormat } from '../utils/tools';
|
||||
|
||||
//同步时时间
|
||||
export async function timeSynchronize() {
|
||||
let date = new Date();
|
||||
console.info('jiangsong1:timeSynchronization begin ' );
|
||||
console.info('jiangsong1:timeSynchronization begin ');
|
||||
|
||||
let params = { time: dateFormat(date), deviceNo: globalThis.deviceNo,version:globalThis.version,judgeVersion:globalThis.judgeVersion}
|
||||
let res:any = await timeSynchronization(params)
|
||||
let params = {
|
||||
time: dateFormat(date),
|
||||
deviceNo: globalThis.deviceNo,
|
||||
version: globalThis.version,
|
||||
judgeVersion: globalThis.judgeVersion
|
||||
}
|
||||
let res: any = await timeSynchronization(params)
|
||||
res = res.timeSynchronizationRsp;
|
||||
globalThis.timeInfo=res.body
|
||||
console.log('timeInfo',JSON.stringify(res.body))
|
||||
|
||||
globalThis.timeInfo = res.body
|
||||
console.log('timeInfo', JSON.stringify(res.body))
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function setCurrentTime():Promise<void> {
|
||||
export async function setCurrentTime(): Promise<void> {
|
||||
let res = await timeSynchronize();
|
||||
let currentTime = res.head.time;
|
||||
let times = new Date(currentTime).getTime();
|
||||
console.log('jiangsong:times==' + times);
|
||||
try {
|
||||
await systemTime.setTime(times)
|
||||
// systemTime.setTime(times).then(() => {
|
||||
// console.info(`Succeeded in setting time.`);
|
||||
// }).catch((error) => {
|
||||
// console.info(`Failed to set time. message: ${error.message}, code: ${error.code}`);
|
||||
// });
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`);
|
||||
}
|
||||
}
|
||||
|
||||
//获取当前时间并转化
|
||||
export async function getCurrentTime():Promise<string> {
|
||||
export async function getCurrentTime(): Promise<string> {
|
||||
const date = await systemTime.getDate();
|
||||
const year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
@ -58,7 +58,7 @@ export async function getCurrentTime():Promise<string> {
|
||||
}
|
||||
|
||||
//时间戳转日期
|
||||
export function formatTime(time:number):string {
|
||||
export function formatTime(time: number): string {
|
||||
//@ts-ignore
|
||||
const h = parseInt(time / 3600)
|
||||
//@ts-ignore
|
||||
|
||||
@ -230,23 +230,19 @@ struct Index {
|
||||
}
|
||||
|
||||
async initParams() {
|
||||
// deleteAllFIleLog(GlobalConfig.comoonfileWriteAddress + '/PLC/')
|
||||
//设置plc udp 同步requesthost
|
||||
await getUDP(this.context, false)
|
||||
|
||||
// 判断是否需要开启gps2导航仪,A2需要
|
||||
getSyncData('ES_CARINFO').then(result => {
|
||||
console.log("CARINFO", JSON.stringify(result))
|
||||
const carInfo = result[0] || {};
|
||||
if (carInfo.kscx == 'A2') {
|
||||
console.log("GPS2 udp")
|
||||
// A2牵引车2号导航仪
|
||||
getUDPGps2(this.context, false)
|
||||
}
|
||||
})
|
||||
|
||||
this.loading = false
|
||||
await getDeviceInfo(this.context)
|
||||
|
||||
await getCarInfo()
|
||||
await getUDP2(this.context, false)
|
||||
getTCP()
|
||||
@ -366,6 +362,10 @@ struct Index {
|
||||
const carInfo = result[0] || {};
|
||||
if ((globalThis.isA1 && carInfo.kscx != "A1") || (globalThis.isA3 && carInfo.kscx != "A3")) {
|
||||
console.log("lixiao 重新拉表")
|
||||
setTimeout(() => {
|
||||
this.angle = 360
|
||||
}, 1000)
|
||||
this.angle = 0
|
||||
this.networkExam(true)
|
||||
return
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ export const judgeConfig = {
|
||||
// 外壳版本号
|
||||
version: "2025.05.14.01",
|
||||
// 是否A1A3共用一车
|
||||
isUseSameCar: true,
|
||||
isUseSameCar: false,
|
||||
//本地目录开关
|
||||
isTrajectoryOpen: false,
|
||||
//是否开启拍照
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user