Compare commits
	
		
			2 Commits
		
	
	
		
			6e0c61ca0d
			...
			5c3846f303
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 5c3846f303 | |||
| a3a9224791 | 
| @ -96,6 +96,9 @@ export async function initTable() { | ||||
| export function sqlInsertCommonFn(tableName, resultArr, delFlag = true) { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     DB.clearTable(tableName).then((res) => { | ||||
|       if(!resultArr?.length){ | ||||
|         return | ||||
|       } | ||||
|       let INSERT_SQL = "INSERT INTO " + tableName | ||||
|         + " (" + map[tableName].ACCOUNT_TABLE.columns.toString() + ") VALUES " | ||||
| 
 | ||||
|  | ||||
| @ -88,69 +88,7 @@ export async function getTCP(flag=false) { | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
|   return | ||||
|   getSyncData('IpConfigTable').then(async (result: Array<any>) => { | ||||
| 
 | ||||
|     console.log('result222', JSON.stringify(result)) | ||||
|     if (result.length) { | ||||
|       if (globalThis.TcpClient && globalThis.TcpClient.closeTcp) { | ||||
|         globalThis.TcpClient.closeTcp(async () => { | ||||
|           // const tcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
 | ||||
|           // globalThis.TcpClient = tcpClient
 | ||||
|           setTimeout(async () => { | ||||
|             await globalThis.TcpClient.rebindTcp(result[0].tcplocalIp, result[0].tcplocalIpPort, result[0].tcpOppositeIp, result[0].tcpOppositePort) | ||||
|             await globalThis.TcpClient.connectTcp() | ||||
|             await globalThis.TcpClient.sendMsg('1002') //1002
 | ||||
|             globalThis.TcpClient.onError((val) => { | ||||
|               setTimeout(() => { | ||||
|                 getTCP() | ||||
|               }, 1000) | ||||
|             }) | ||||
|             await globalThis.TcpClient.onMessage((val) => { | ||||
|               setTimeout(() => { | ||||
|                 globalThis.TcpClient.sendMsg('1002') //1002
 | ||||
|                 if (val) { | ||||
|                   // const msg=val.substring(5,val.length-1)
 | ||||
|                   console.log('socketTag[PLC.UdpClient] status:', globalThis.udpClient.getStatus()) | ||||
|                   globalThis.udpClient?.sendMsg(val) | ||||
|                 } | ||||
|               }, 1000) | ||||
| 
 | ||||
|             }) | ||||
|           }, 2000) | ||||
|         }) | ||||
| 
 | ||||
|       } | ||||
|       else { | ||||
|         const tcpClient: TcpClient = new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort, result[0].tcpOppositeIp, result[0].tcpOppositePort) | ||||
|         globalThis.TcpClient = tcpClient | ||||
|         await globalThis.TcpClient.bindTcp() | ||||
|         await globalThis.TcpClient.connectTcp() | ||||
|         await globalThis.TcpClient.sendMsg('1002') //1002
 | ||||
|         globalThis.TcpClient.onError((val) => { | ||||
|           setTimeout(() => { | ||||
|             getTCP() | ||||
|           }, 1000) | ||||
|         }) | ||||
|         await globalThis.TcpClient.onMessage((val) => { | ||||
|           hilog.info(0x0000, 'testTag', "valvalval2" + JSON.stringify(val)); | ||||
|           setTimeout(() => { | ||||
|             globalThis.TcpClient.sendMsg('1002') //1002
 | ||||
|             if (val && globalThis.udpClient?.sendMsg) { | ||||
|               globalThis.udpClient?.sendMsg(val) | ||||
|             } | ||||
|           }, 1000) | ||||
| 
 | ||||
|         }) | ||||
|       } | ||||
|       // globalThis.udpClient = new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort)
 | ||||
| 
 | ||||
|     } else { | ||||
|       globalThis.TcpClient = {} | ||||
|       globalThis.TcpClient.onMessage = () => { | ||||
|       } | ||||
|     } | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -192,10 +192,7 @@ export default class TcpClient { | ||||
|             duration: 2000 | ||||
|           }); | ||||
|         } | ||||
|         this.writeLog({ | ||||
|           time:dateFormat(new Date()), | ||||
|           message: `${TAG} tcp信号丢失`, | ||||
|         }) | ||||
| 
 | ||||
|         globalThis.tcpUdpError = true; | ||||
|       },3000) | ||||
|       // callback(value.message)
 | ||||
|  | ||||
| @ -5,6 +5,9 @@ import TopLogo from './compontents/TopLogo'; | ||||
| import testNapi from '@ohos.hiserialsdk'; | ||||
| import { dateFormat } from '../common/utils/tools'; | ||||
| import { DwMapData, PassData, RealNumData, StackValueData, WarnFlagData, WarnFlagTipData } from '../mock'; | ||||
| import FileUtil from '../common/utils/File'; | ||||
| import { GlobalConfig } from '../config'; | ||||
| import common from '@ohos.app.ability.common'; | ||||
| 
 | ||||
| @Entry | ||||
| @Component | ||||
| @ -37,6 +40,7 @@ export default struct Index { | ||||
|   @State stopFlag: boolean = false | ||||
|   @State fromIndex: boolean = false | ||||
|   private vocObj = null; | ||||
|   private context = getContext(this) as common.UIAbilityContext; | ||||
| 
 | ||||
|   // private AccountTable = new AccountTable(()=>{},CommonConstants); | ||||
|   aboutToAppear() { | ||||
| @ -114,28 +118,66 @@ export default struct Index { | ||||
|   } | ||||
| 
 | ||||
|   // | ||||
|   carConfigurationInfoFn() { | ||||
|     // const fileUtil = new FileUtil(context) | ||||
|     // const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt'); | ||||
|     // if (data === '' || data === undefined) { | ||||
|     //   promptAction.showToast({ | ||||
|     //     message: `请先进行设备注册`, | ||||
|     //     duration: 3000 | ||||
|     //   }); | ||||
|     //   globalThis.type='1' | ||||
|     //   globalThis.title=decodeURIComponent('请先进行设备注册') | ||||
|     //   globalThis.errorDialog.open() | ||||
|     //   resolve('') | ||||
|     // } else { | ||||
|     //   const fileData=JSON.parse(data) | ||||
|     //   globalThis.deviceNo = fileData.deviceName | ||||
|     //   console.log('globalThis.deviceNo', globalThis.deviceNo) | ||||
|     //   // getCarInfo() | ||||
|     //   resolve(fileData.deviceName) | ||||
|     // } | ||||
|     if (globalThis.singlePlay) { | ||||
|       const str = "1:5;2:5;3:5;4:5;5:5;6:5;7:5;8:5;9:5;10:5;11:5;12:5;13:5;14:5;15:5;16:5;17:5;18:5;19:5;20:5;21:5;22:2;23:5;24:5" | ||||
|       const data = str.split(';') | ||||
|  async carConfigurationInfoFn() { | ||||
|     const fileUtil = new FileUtil(this.context) | ||||
|     const checkListStr = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/carcheck.txt'); | ||||
| 
 | ||||
|     if (checkListStr === '' || checkListStr === undefined) { | ||||
|       //模拟真实数据 | ||||
|       const param = { | ||||
|         "body": | ||||
|         { | ||||
|           "carIdString": globalThis.carInfo.carId, //考车ID | ||||
|           "deviceNo": globalThis.deviceNo | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
|       carConfigurationInfo(param).then(res => { | ||||
|         // @ts-ignore | ||||
|         console.log('ES_CHECK_CAR_ITEM',JSON.stringify(res.body)) | ||||
|         // @ts-ignore | ||||
|         if(res?.body?.ES_CHECK_CAR_ITEM){ | ||||
|           // @ts-ignore | ||||
|           const data = res.body.ES_CHECK_CAR_ITEM[0].ITEMS.split(';'); | ||||
|           this.checkList = [] | ||||
|           const list = data | ||||
|           list.map(res => { | ||||
|             const arr = res.split(':') | ||||
|             this.checkList.push({ | ||||
|               'key': parseInt(arr[0]) + 2, 'time': arr[1] | ||||
|             }) | ||||
|           }) | ||||
|           this.checkListCopy = JSON.parse(JSON.stringify(this.checkList)) | ||||
|         }else{ | ||||
|           const str = "1:5;2:5;3:5;4:5;5:5;6:5;7:5;8:5;9:5;10:5;11:5;12:5;13:5;14:5;15:5;16:5;17:5;18:5;19:5;20:5;21:5;22:2;23:5;24:5" | ||||
|           const data = str.split(';') | ||||
|           this.checkList = [] | ||||
|           const list = data | ||||
|           list.map(res => { | ||||
|             const arr = res.split(':') | ||||
|             this.checkList.push({ | ||||
|               'key': parseInt(arr[0]) + 2, 'time': arr[1] | ||||
|             }) | ||||
|           }) | ||||
|           this.checkListCopy = JSON.parse(JSON.stringify(this.checkList)) | ||||
|         } | ||||
| 
 | ||||
|       }).catch((error) => { | ||||
|         console.log('error12error' + error) | ||||
|         const str = "1:5;2:5;3:5;4:5;5:5;6:5;7:5;8:5;9:5;10:5;11:5;12:5;13:5;14:5;15:5;16:5;17:5;18:5;19:5;20:5;21:5;22:2;23:5;24:5" | ||||
|         const data = str.split(';') | ||||
|         this.checkList = [] | ||||
|         const list = data | ||||
|         list.map(res => { | ||||
|           const arr = res.split(':') | ||||
|           this.checkList.push({ | ||||
|             'key': parseInt(arr[0]) + 2, 'time': arr[1] | ||||
|           }) | ||||
|         }) | ||||
|         this.checkListCopy = JSON.parse(JSON.stringify(this.checkList)) | ||||
|       }) | ||||
|     }else { | ||||
|       const data = checkListStr.split(';') | ||||
|       this.checkList = [] | ||||
|       const list = data | ||||
|       list.map(res => { | ||||
| @ -147,30 +189,7 @@ export default struct Index { | ||||
|       this.checkListCopy = JSON.parse(JSON.stringify(this.checkList)) | ||||
|       return | ||||
|     } | ||||
|     //模拟真实数据 | ||||
|     const param = { | ||||
|       "body": | ||||
|       { | ||||
|         "carIdString": globalThis.carInfo.carId, //考车ID | ||||
|         "deviceNo": globalThis.deviceNo | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     carConfigurationInfo(param).then(res => { | ||||
|       // @ts-ignore | ||||
|       const data = res.body.ES_CHECK_CAR_ITEM[0].ITEMS.split(';'); | ||||
|       this.checkList = [] | ||||
|       const list = data | ||||
|       list.map(res => { | ||||
|         const arr = res.split(':') | ||||
|         this.checkList.push({ | ||||
|           'key': parseInt(arr[0]) + 2, 'time': arr[1] | ||||
|         }) | ||||
|       }) | ||||
|       this.checkListCopy = JSON.parse(JSON.stringify(this.checkList)) | ||||
|     }).catch((error) => { | ||||
|       console.log('error12error' + error) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|   async kszj() { | ||||
|  | ||||
| @ -1,15 +1,13 @@ | ||||
| { | ||||
|   "lockfileVersion": 2, | ||||
|   "lockfileVersion": 1, | ||||
|   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | ||||
|   "specifiers": { | ||||
|     "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6" | ||||
|   }, | ||||
|   "packages": { | ||||
|     "@ohos/hypium@1.0.6": { | ||||
|       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz", | ||||
|       "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==", | ||||
|       "registryType": "ohpm", | ||||
|       "shasum": "3f5fed65372633233264b3447705b0831dfe7ea1" | ||||
|       "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz", | ||||
|       "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==" | ||||
|     } | ||||
|   } | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user