双中心修改
This commit is contained in:
parent
bf8e2226a7
commit
abb3e1bb47
@ -3,42 +3,45 @@ import promptAction from '@ohos.promptAction'
|
|||||||
import router from '@ohos.router'
|
import router from '@ohos.router'
|
||||||
import { dateFormat } from '../utils/tools'
|
import { dateFormat } from '../utils/tools'
|
||||||
import FileUtil from '../../common/utils/File'
|
import FileUtil from '../../common/utils/File'
|
||||||
import AccountTable from '../../common/database/tables/AccountTable';
|
import AccountTable from '../../common/database/tables/AccountTable'
|
||||||
import MA_SYSSET from '../../common/constants/MA_SYSSET';
|
import MA_SYSSET from '../../common/constants/MA_SYSSET'
|
||||||
import { takePhoto, deleteAllFileByPiC } from '../../common/service/videoService'
|
import { takePhoto } from '../../common/service/videoService'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getDataBaseTable,
|
|
||||||
upDateTable,
|
|
||||||
getMySystemSetTable,
|
|
||||||
delSyncTable,
|
delSyncTable,
|
||||||
upDataZhongxinginitialization
|
getDataBaseTable,
|
||||||
|
getMySystemSetTable,
|
||||||
|
upDataZhongxinginitialization,
|
||||||
|
upDateTable
|
||||||
} from '../../common/service/initable'
|
} from '../../common/service/initable'
|
||||||
import { GlobalConfig } from '../../config/index'
|
import { GlobalConfig } from '../../config/index'
|
||||||
import testNapi from '@ohos.hiserialsdk'
|
import testNapi from '@ohos.hiserialsdk'
|
||||||
let num=0
|
|
||||||
export async function getliushuiNum(context){
|
let num = 0
|
||||||
|
|
||||||
|
export async function getliushuiNum(context) {
|
||||||
console.log('getLiushuihao')
|
console.log('getLiushuihao')
|
||||||
const fileUtil = new FileUtil(context)
|
const fileUtil = new FileUtil(context)
|
||||||
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress+'/config/liushui.txt');
|
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/liushui.txt');
|
||||||
if(data === '' || data === undefined){
|
if (data === '' || data === undefined) {
|
||||||
num=0
|
num = 0
|
||||||
let str=num.toString()
|
let str = num.toString()
|
||||||
for(let i=0;str.length<=5;i++){
|
for (let i = 0; str.length <= 5; i++) {
|
||||||
str='0'+str
|
str = '0' + str
|
||||||
}
|
}
|
||||||
globalThis.lshNo=str
|
globalThis.lshNo = str
|
||||||
// return str
|
// return str
|
||||||
}else{
|
} else {
|
||||||
num=Number(JSON.parse(data).value)+1
|
num = Number(JSON.parse(data).value) + 1
|
||||||
let str=num.toString()
|
let str = num.toString()
|
||||||
for(let i=0;str.length<=5;i++){
|
for (let i = 0; str.length <= 5; i++) {
|
||||||
str='0'+str
|
str = '0' + str
|
||||||
}
|
}
|
||||||
globalThis.lshNo=str
|
globalThis.lshNo = str
|
||||||
// return str
|
// return str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//配置流水号
|
//配置流水号
|
||||||
export async function setliushuiNum(context) {
|
export async function setliushuiNum(context) {
|
||||||
const fileUtil = new FileUtil(context)
|
const fileUtil = new FileUtil(context)
|
||||||
@ -79,20 +82,20 @@ export async function getDoubleCeneterTable(param) {
|
|||||||
return new Promise(async (reslove, reject) => {
|
return new Promise(async (reslove, reject) => {
|
||||||
// MA_SYSSET双中心下做合并表格操作
|
// MA_SYSSET双中心下做合并表格操作
|
||||||
const db = new AccountTable(() => {
|
const db = new AccountTable(() => {
|
||||||
}, MA_SYSSET);
|
}, MA_SYSSET, param.context);
|
||||||
db.getRdbStore(() => {
|
db.getRdbStore(() => {
|
||||||
db.query('0', async (array) => {
|
db.query('0', async (array) => {
|
||||||
if (array.length) {
|
if (array.length) {
|
||||||
delSyncTable('MA_SYSSET').then(async () => {
|
delSyncTable('MA_SYSSET').then(async () => {
|
||||||
await getDataBaseTable({ tableName: 'MA_SYSSET' },param)
|
await getDataBaseTable({ tableName: 'MA_SYSSET' }, param)
|
||||||
await getMySystemSetTable({ tableName: 'MA_SYSSET' },param)
|
await getMySystemSetTable({ tableName: 'MA_SYSSET' }, param)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
await getDataBaseTable({ tableName: 'MA_SYSSET' },param)
|
await getDataBaseTable({ tableName: 'MA_SYSSET' }, param)
|
||||||
await getMySystemSetTable({ tableName: 'MA_SYSSET' },param)
|
await getMySystemSetTable({ tableName: 'MA_SYSSET' }, param)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},param.context)
|
}, param.context)
|
||||||
const typeObj = {
|
const typeObj = {
|
||||||
'MA_MARKRULE': false,
|
'MA_MARKRULE': false,
|
||||||
'MA_SYSTEMPARM': false,
|
'MA_SYSTEMPARM': false,
|
||||||
@ -113,7 +116,7 @@ export async function getDoubleCeneterTable(param) {
|
|||||||
'MA_T_CARPARMSET': false
|
'MA_T_CARPARMSET': false
|
||||||
}
|
}
|
||||||
for (let key in typeObj) {
|
for (let key in typeObj) {
|
||||||
typeObj[key] = await upDateTable({ tableName: key },param)
|
typeObj[key] = await upDateTable({ tableName: key }, param)
|
||||||
if (!typeObj[key]) {
|
if (!typeObj[key]) {
|
||||||
promptAction.showToast({
|
promptAction.showToast({
|
||||||
message: `未能查询到${key}表数据, 请先检查网络是否连接正常`,
|
message: `未能查询到${key}表数据, 请先检查网络是否连接正常`,
|
||||||
@ -130,6 +133,7 @@ export async function getDoubleCeneterTable(param) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//单中心存表
|
//单中心存表
|
||||||
export async function getSingleCenterTable(param) {
|
export async function getSingleCenterTable(param) {
|
||||||
return new Promise((reslove, reject) => {
|
return new Promise((reslove, reject) => {
|
||||||
@ -209,11 +213,11 @@ export async function takePhotoFn(context) {
|
|||||||
spzd1: false,
|
spzd1: false,
|
||||||
zdyz: '5',
|
zdyz: '5',
|
||||||
}
|
}
|
||||||
globalThis.spzd={
|
globalThis.spzd = {
|
||||||
spzd1:false,
|
spzd1: false,
|
||||||
spzd2:false,
|
spzd2: false,
|
||||||
spzd3:false,
|
spzd3: false,
|
||||||
spzd4:false,
|
spzd4: false,
|
||||||
}
|
}
|
||||||
globalThis.takePhotoNum = 0
|
globalThis.takePhotoNum = 0
|
||||||
const map = {}
|
const map = {}
|
||||||
@ -230,11 +234,11 @@ export async function takePhotoFn(context) {
|
|||||||
map[key] = false
|
map[key] = false
|
||||||
// param[key] = false
|
// param[key] = false
|
||||||
}
|
}
|
||||||
for(let i=0;i<=arr.length-1;i++){
|
for (let i = 0; i <= arr.length - 1; i++) {
|
||||||
let key=arr[i]
|
let key = arr[i]
|
||||||
if (param[key]) {
|
if (param[key]) {
|
||||||
param.pztd = param[`td${Number(i) + 1}`]
|
param.pztd = param[`td${Number(i) + 1}`]
|
||||||
takePhoto(param, context, 'jt/',0,(data)=>{
|
takePhoto(param, context, 'jt/', 0, (data) => {
|
||||||
if (Number(data.fileSize) <= (Number(param.zdyz) * 1000)) {
|
if (Number(data.fileSize) <= (Number(param.zdyz) * 1000)) {
|
||||||
map[key] = true
|
map[key] = true
|
||||||
promptAction.showToast({
|
promptAction.showToast({
|
||||||
@ -246,9 +250,9 @@ export async function takePhotoFn(context) {
|
|||||||
map[key] = false
|
map[key] = false
|
||||||
globalThis.spzd[key] = false
|
globalThis.spzd[key] = false
|
||||||
}
|
}
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
takePhotoFn()
|
takePhotoFn()
|
||||||
},3000)
|
}, 3000)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,14 +263,16 @@ export async function takePhotoFn(context) {
|
|||||||
}
|
}
|
||||||
}, 3000)
|
}, 3000)
|
||||||
}
|
}
|
||||||
|
|
||||||
let fd
|
let fd
|
||||||
const devPath="/dev/ttyS3"
|
const devPath = "/dev/ttyS3"
|
||||||
|
|
||||||
function openChuankouFn(callback) {
|
function openChuankouFn(callback) {
|
||||||
console.log('SerialOpen in indexservice, path=' + devPath)
|
console.log('SerialOpen in indexservice, path=' + devPath)
|
||||||
|
|
||||||
testNapi.SerialOpenAsync(devPath, (fd)=> {
|
testNapi.SerialOpenAsync(devPath, (fd) => {
|
||||||
globalThis.fd = fd;
|
globalThis.fd = fd;
|
||||||
globalThis.num=0
|
globalThis.num = 0
|
||||||
let parity = 0x4e; // 'N'
|
let parity = 0x4e; // 'N'
|
||||||
let ret = testNapi.SerialSetAsync(globalThis.fd, 115200, 0, 8, 1, parity, (ret) => {
|
let ret = testNapi.SerialSetAsync(globalThis.fd, 115200, 0, 8, 1, parity, (ret) => {
|
||||||
callback()
|
callback()
|
||||||
@ -277,42 +283,42 @@ function openChuankouFn(callback) {
|
|||||||
function getChuankouFnMsg() {
|
function getChuankouFnMsg() {
|
||||||
let timeout = 50000; // 2秒超时
|
let timeout = 50000; // 2秒超时
|
||||||
let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
|
let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
|
||||||
console.log('fdfd',globalThis.fd)
|
console.log('fdfd', globalThis.fd)
|
||||||
console.log('zzc 1 try send msg')
|
console.log('zzc 1 try send msg')
|
||||||
testNapi.SerialSendAsync(globalThis.fd, databuff,(ret)=>{
|
testNapi.SerialSendAsync(globalThis.fd, databuff, (ret) => {
|
||||||
console.log('zzc 2 send finished')
|
console.log('zzc 2 send finished')
|
||||||
console.log('zzc 3 try receive msg')
|
console.log('zzc 3 try receive msg')
|
||||||
testNapi.SerialRecvAsync(globalThis.fd, timeout, (revTestInfo) => {
|
testNapi.SerialRecvAsync(globalThis.fd, timeout, (revTestInfo) => {
|
||||||
console.log('zzc 4 received msg')
|
console.log('zzc 4 received msg')
|
||||||
console.log('revTestInfo',revTestInfo.recevedBuf.length)
|
console.log('revTestInfo', revTestInfo.recevedBuf.length)
|
||||||
|
|
||||||
const message = revTestInfo?.recevedBuf?.toString()
|
const message = revTestInfo?.recevedBuf?.toString()
|
||||||
console.log('chuankou',message)
|
console.log('chuankou', message)
|
||||||
if (message == '') {
|
if (message == '') {
|
||||||
console.log('zzc error msg is emptry')
|
console.log('zzc error msg is emptry')
|
||||||
globalThis.num=1
|
globalThis.num = 1
|
||||||
console.log('zzc 9 num=3 close serial')
|
console.log('zzc 9 num=3 close serial')
|
||||||
// clearInterval(chuankou)
|
// clearInterval(chuankou)
|
||||||
testNapi.SerialClose(globalThis.fd);
|
testNapi.SerialClose(globalThis.fd);
|
||||||
globalThis.fd=null
|
globalThis.fd = null
|
||||||
getChuankouFn()
|
getChuankouFn()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const msg = message?.split(',')
|
const msg = message?.split(',')
|
||||||
if(!msg?.length){
|
if (!msg?.length) {
|
||||||
|
|
||||||
} else if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
} else if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||||
|
|
||||||
} else if(msg.length<12){
|
} else if (msg.length < 12) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
globalThis.chuankoMsg=msg[9]
|
globalThis.chuankoMsg = msg[9]
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('zzc 5 sleep 1s')
|
console.log('zzc 5 sleep 1s')
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
getChuankouFnMsg()
|
getChuankouFnMsg()
|
||||||
},500)
|
}, 500)
|
||||||
|
|
||||||
// hilog.info(0x0000, 'testTag', 'Test NAPI SerialRecvAsync callback in');
|
// hilog.info(0x0000, 'testTag', 'Test NAPI SerialRecvAsync callback in');
|
||||||
// hilog.info(0x0000, 'testTag', 'Test NAPI SerialRecvAsync recevedLen = %{public}d', revTestInfo.recevedLen);
|
// hilog.info(0x0000, 'testTag', 'Test NAPI SerialRecvAsync recevedLen = %{public}d', revTestInfo.recevedLen);
|
||||||
@ -323,9 +329,11 @@ function getChuankouFnMsg() {
|
|||||||
// let revTestInfo = testNapi?.SerialRecv(globalThis.fd, timeout);
|
// let revTestInfo = testNapi?.SerialRecv(globalThis.fd, timeout);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let chuankou
|
let chuankou
|
||||||
export async function getChuankouFn(){
|
|
||||||
if(globalThis.fd){
|
export async function getChuankouFn() {
|
||||||
|
if (globalThis.fd) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
openChuankouFn(getChuankouFnMsg)
|
openChuankouFn(getChuankouFnMsg)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user