From 4c73175e4ef244c74e360a5eeafbcc2f83284d7e Mon Sep 17 00:00:00 2001
From: yuwanchiren <863666755@qq.com>
Date: Tue, 15 Oct 2024 10:11:07 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=8F=B0=E8=B4=A6?=
=?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../equipment/equipmentManagement/index.vue | 53 +++++++++++++++----
1 file changed, 44 insertions(+), 9 deletions(-)
diff --git a/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue b/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue
index a1d9a2ac..49cc5deb 100644
--- a/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue
+++ b/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue
@@ -132,10 +132,10 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -277,10 +287,10 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -416,7 +436,6 @@ const equipTypeList = () => {
formQuery.pageNum = currentPage.value
formQuery.objectType = res.data[0].equipmentTypeId
equipQuery(formQuery).then((res) => {
-
deviceList.value = res.rows
pageTotal.value = res.total
})
@@ -424,7 +443,7 @@ const equipTypeList = () => {
equipModeList({
objectType: res.data[0].equipmentTypeId,
})
- queryParameter.value.equipmentTypeId = res.data[0].equipmentTypeId
+ queryParameter.value.equipmentTypeId = res.data[0].equipmentTypeId
})
})
}
@@ -451,9 +470,17 @@ const equipOrgList = () => {
const belongingEquipment = ref()
const equipOrgBelonging = () => {
equipTree().then((res) => {
- belongingEquipment.value = res.data
+ belongingEquipment.value = filterEquipments(res.data)
})
}
+const filterEquipments = (data: any) => {
+ return data
+ .filter((item: any) => item.objectType == 10001)
+ ?.map((item: any) => ({
+ ...item,
+ equipChildren: filterEquipments(item.equipChildren),
+ }))
+}
const treeSelectLoad = (node: any, resolve: any) => {
if (node.level === 0) {
@@ -474,8 +501,7 @@ const treeSelectLoad = (node: any, resolve: any) => {
}
return resolve(res.data)
})
- .catch((err) => {
- })
+ .catch((err) => {})
}
}
@@ -600,6 +626,8 @@ const addDeviceList = () => {
editAddDeviceData.orgId = ''
editAddDeviceData.parentEquipmentId = ''
editAddDeviceData.iotModelId = ''
+ editAddDeviceData.belongingLine = ''
+ editAddDeviceData.isbenchMarkUnit = false
}
// 查看设备详情
@@ -620,6 +648,8 @@ const editDeviceData = reactive({
parentEquipmentId: '',
iotModelId: '',
id: '',
+ belongingLine: '',
+ isbenchMarkUnit: false,
})
const size = ref<'default' | 'large' | 'small'>('default')
@@ -647,6 +677,8 @@ const viewDeviceDetails = (data: any) => {
editDeviceData.orgId = data.row.orgId
editDeviceData.parentEquipmentId = data.row.parentEquipmentId
editDeviceData.iotModelId = data.row.iotModelId
+ editDeviceData.belongingLine = data.row.belongingLine
+ editDeviceData.isbenchMarkUnit = data.row.isbenchMarkUnit
}
// 设备删除
@@ -766,6 +798,8 @@ const editAddDeviceData = reactive({
orgId: '',
parentEquipmentId: '',
iotModelId: '',
+ belongingLine: '',
+ isbenchMarkUnit: false,
})
// 设备新增字段校验
@@ -798,6 +832,7 @@ const saveAddData = () => {
editAddDeviceData.objectType = ele.equipmentTypeId
}
})
+
equipAdd(editAddDeviceData).then((res) => {
if (res.code == 200) {
ElMessage({
From 2f23bad2377dea14b3abe4009b0bb5b940242754 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98=E7=8E=89=E9=9C=9E?=
Date: Tue, 15 Oct 2024 10:18:32 +0800
Subject: [PATCH 2/5] =?UTF-8?q?fix=EF=BC=9A=E7=89=88=E6=9C=AC=E5=BA=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ui/dasadmin/package.json | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/ui/dasadmin/package.json b/ui/dasadmin/package.json
index 88722da6..21178c9d 100644
--- a/ui/dasadmin/package.json
+++ b/ui/dasadmin/package.json
@@ -40,15 +40,16 @@
"@types/node": "20.14.0",
"@types/nprogress": "0.2.3",
"@types/sortablejs": "1.15.8",
- "@typescript-eslint/eslint-plugin": "^7.13.1",
- "@typescript-eslint/parser": "^7.13.1",
+ "@typescript-eslint/eslint-plugin": "^8.9.0",
+ "@typescript-eslint/parser": "^8.9.0",
"@vitejs/plugin-vue": "5.0.5",
"async-validator": "4.2.5",
"crypto-js": "^4.2.0",
- "eslint": "^8.57.0",
+ "eslint": "^9.0.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-vue": "9.26.0",
+ "glob": "^11.0.0",
"globals": "^15.6.0",
"prettier": "^3.3.2",
"sass": "1.77.4",
From 3728641a2947264d74c8a09ed6d49a420a850ce7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=AB=98=E4=BA=91=E9=B9=8F?=
Date: Tue, 15 Oct 2024 12:49:39 +0800
Subject: [PATCH 3/5] =?UTF-8?q?=E6=9C=BA=E6=9E=84=EF=BC=9A=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E6=97=A0=E4=B8=8A=E7=BA=A7=E6=9C=BA=E6=9E=84=E6=97=B6?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=90=8D=E7=A7=B0,=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91=20=E8=A7=92=E8=89=B2?=
=?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E8=A7=92=E8=89=B2?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/views/backend/auth/org/index.vue | 24 ++++++++++++-------
.../src/views/backend/auth/role/index.vue | 6 +++--
.../src/views/backend/auth/role/type.ts | 4 +++-
3 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/ui/dasadmin/src/views/backend/auth/org/index.vue b/ui/dasadmin/src/views/backend/auth/org/index.vue
index 9779b841..5d464af1 100644
--- a/ui/dasadmin/src/views/backend/auth/org/index.vue
+++ b/ui/dasadmin/src/views/backend/auth/org/index.vue
@@ -322,7 +322,7 @@ const addInstitutional = (rightClick = false) => {
const submitAddForm = () => {
console.log(formModel.value)
if (!formRef.value) return
- formRef.value.validate((valid:boolean) => {
+ formRef.value.validate((valid: boolean) => {
if (valid) {
if (dialogTitle.value === '新增机构') {
formModel.value.parentOrgId = formModel.value.parentOrgId ?? '0'
@@ -330,7 +330,7 @@ const submitAddForm = () => {
.then((res) => {
if (res.success) {
ElMessage.success('新增成功')
- getInstitutionList()
+ getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId})
dialogVible.value = false
refreshTreeData(formModel.value.parentOrgId)
} else {
@@ -345,7 +345,7 @@ const submitAddForm = () => {
.then((res) => {
if (res.success) {
ElMessage.success('编辑成功')
- getInstitutionList()
+ getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId})
dialogVible.value = false
refreshTreeData(rightClickMenuData.value!.parentOrgId).then(() => {
refreshTreeData(formModel.value.parentOrgId)
@@ -368,7 +368,14 @@ const closeAddForm = () => {
const getInstitutionList = (data: getDataType = { name: null }) => {
getInstitutionalListReq(data).then((res) => {
pageTotal.value = res.total
- originData.value = res.rows
+ console.log(res.rows);
+
+ originData.value = res.rows.map(item=>{
+ return {
+ ...item,
+ parentOrgName:item.parentOrgName ? item.parentOrgName : '无'
+ }
+ })
})
}
@@ -450,7 +457,7 @@ const delForm = (column: getTreeDataReturnType) => {
.then((res) => {
if (res.success) {
ElMessage.success('删除成功')
- getInstitutionList()
+ getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId})
refreshTreeData(column.parentOrgId)
} else {
ElMessage.error(res?.msg ?? '删除失败')
@@ -470,6 +477,7 @@ const treeReplaceProps = {
const treeSelectReplaceProps = {
label: 'name',
children: 'children',
+ isLeaf: 'isLeaf',
}
const loadTreeData = (node: Node, resolve: any) => {
if (node.level === 0) {
@@ -489,7 +497,6 @@ const loadTreeData = (node: Node, resolve: any) => {
})
}
const loadSelectTreeData = (node: Node, resolve: any) => {
- console.log(node)
if (node.level === 0) {
return getTreeData(null)
@@ -497,7 +504,8 @@ const loadSelectTreeData = (node: Node, resolve: any) => {
if (!res.length) {
node.data.isLeaf = true
}
- resolve(res)
+
+ resolve([{ id: '0', name: '无', isLeaf: true }, ...res])
})
.catch((err) => {
console.log(err)
@@ -552,8 +560,6 @@ const refreshTreeData = (parentOrgId: string | number | null) => {
return new Promise((resolve) => {
const data = parentOrgId === 0 || parentOrgId === '0' ? null : parentOrgId
getTreeData(data).then((res) => {
- console.log('res,', res)
- console.log(data)
if (data) {
treeRef.value?.updateKeyChildren(parentOrgId!, res)
} else {
diff --git a/ui/dasadmin/src/views/backend/auth/role/index.vue b/ui/dasadmin/src/views/backend/auth/role/index.vue
index 07d94f44..56697eca 100644
--- a/ui/dasadmin/src/views/backend/auth/role/index.vue
+++ b/ui/dasadmin/src/views/backend/auth/role/index.vue
@@ -5,7 +5,7 @@
-
+
@@ -241,13 +241,15 @@ const getRoleList = (roleName = '') => {
getRoleListReq({
roleName,
}).then((res) => {
+ console.log(res)
+
pageTotal.value = res.total
originData.value = res.rows.map((item) => {
return {
roleCode: item.roleCode,
roleName: item.roleName,
listName: item.list.map((item) => item.authorityName).join(','),
- authList: item.list.map((item) => item.id),
+ authList: item.list.map((item) => parseInt(item.id)),
id: item.id,
revision: item.revision,
}
diff --git a/ui/dasadmin/src/views/backend/auth/role/type.ts b/ui/dasadmin/src/views/backend/auth/role/type.ts
index cc9da7cf..87cc065c 100644
--- a/ui/dasadmin/src/views/backend/auth/role/type.ts
+++ b/ui/dasadmin/src/views/backend/auth/role/type.ts
@@ -12,6 +12,8 @@ export type formDataType = {
roleCode: string
}
+
+
export type formDataEnumKeyJointType = keyof typeof formDataEnum
export type formColumnListType = {
@@ -49,7 +51,7 @@ export type tableDataType = {
roleCode: number
roleName: string
listName: T['authorityName']
- authList: T['id'][]
+ authList: number[]
}
export type tableColumnType = {
From 9973a1acc1fabde583507121ac3b1a50d272f991 Mon Sep 17 00:00:00 2001
From: zhouhuang
Date: Tue, 15 Oct 2024 14:10:59 +0800
Subject: [PATCH 4/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E5=8D=8F=E8=AE=AEID?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
das-dn/CMakeLists.txt | 7 +-
das-dn/cmg/changemaster.cpp | 13 ---
das-dn/hostmodbustcp/host_modbus_tcp.cpp | 127 ++++++++++++++++-------
das-dn/hostmodbustcp/host_modbus_tcp.h | 21 +++-
das-dn/inc/process.h | 6 +-
5 files changed, 111 insertions(+), 63 deletions(-)
diff --git a/das-dn/CMakeLists.txt b/das-dn/CMakeLists.txt
index b60f0e3f..45239f79 100644
--- a/das-dn/CMakeLists.txt
+++ b/das-dn/CMakeLists.txt
@@ -3,7 +3,7 @@ project (application C CXX)
set (VERSION 1.0.1)
option (USE_MQTT "use mqtt protocol" ON)
-option (USE_WEBSOCKET "use websocket" OFF)
+option (USE_WEBSOCKET "use websocket" ON)
option (USE_SQLITE3 "use sqlite3" ON)
if (USE_SQLITE3)
@@ -41,9 +41,6 @@ else ()
message ("else:${CMAKE_BUILD_TYPE}")
message ("else:${CMAKE_C_FLAGS_RELEASE}")
endif()
-if (CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc")
- add_definitions (-DMCU_BIG_ENDIAN)
-endif ()
option (HAVE_FTP_PROCESS "use ry ftp" ON)
if (HAVE_FTP_PROCESS)
@@ -79,7 +76,6 @@ set (APP_SRCS
hostmodbustcp/host_modbus_tcp.cpp
rtustatusproc/rtustatus.cpp
subiec104/sub_iec104.cpp
- submodbustcp/sub_modbus_rtu_tcp.cpp
zjd3100proc/zjd3100pro.cpp
)
@@ -207,7 +203,6 @@ endif (USE_MQTT)
if (USE_SQLITE3)
set (APP_SRCS ${APP_SRCS}
- subgdw104/sub_gdw104.cpp
third_party/sqlite/KompexSQLiteBlob.cpp
third_party/sqlite/KompexSQLiteDatabase.cpp
third_party/sqlite/KompexSQLiteStatement.cpp
diff --git a/das-dn/cmg/changemaster.cpp b/das-dn/cmg/changemaster.cpp
index b649b724..8d607cc3 100644
--- a/das-dn/cmg/changemaster.cpp
+++ b/das-dn/cmg/changemaster.cpp
@@ -4,7 +4,6 @@
#include "../subiec104/sub_iec104.h"
#include "../hostmodbusrtu/host_modbus_rtu.h"
#include "../hostmodbustcp/host_modbus_tcp.h"
-#include "../submodbustcp/sub_modbus_rtu_tcp.h"
#include "../rtustatusproc/rtustatus.h"
#include "../zjd3100proc/zjd3100pro.h"
//#include "../bfftpfile2issmqtt/bfftpfile2issmqtt.h"
@@ -351,11 +350,6 @@ void CChangeMaster::StartUp(void)
vLog(LOG_INFO, "协议<%d>创建为: modbus tcp主协议.\n", i);
procs[i] = new CHostModbusTcpProcess(m_conn);
}
- else if (PROTOCOL_SUB_MODBUS_TCP == config.processes[i].proto)
- {
- vLog(LOG_INFO, "协议<%d>创建为: modbus tcp从协议.\n", i);
- procs[i] = new CSubModbusTcpProcess();
- }
else if (PROTOCOL_HOST_IEC104 == config.processes[i].proto)
{
vLog(LOG_INFO, "协议<%d>创建为: iec104主协议.\n", i);
@@ -376,13 +370,6 @@ void CChangeMaster::StartUp(void)
vLog(LOG_INFO, "协议<%d>创建为: 网关状态协议.\n", i);
procs[i] = new CRTUStatusProcess();
}
-#if 0
- else if (PROTOCOL_BF_FTP == config.processes[i].proto)
- {//倍福FTP文件协议
- vLog(LOG_INFO, "协议<%d>创建为: 倍福FTP文件协议.\n", i);
- procs[i] = new CBFFTPFile2ISSMQTTProcess();
- }
-#endif
else
{
vLog(LOG_ERROR, "(%s,%d)系统不支持该协议或该协议未知.\n", config.processes[i].name, config.processes[i].proto);
diff --git a/das-dn/hostmodbustcp/host_modbus_tcp.cpp b/das-dn/hostmodbustcp/host_modbus_tcp.cpp
index da8f08af..ad99e97f 100644
--- a/das-dn/hostmodbustcp/host_modbus_tcp.cpp
+++ b/das-dn/hostmodbustcp/host_modbus_tcp.cpp
@@ -5,14 +5,13 @@
//The individual slave devices are assigned addresses in the range of 1 锟?C 247. //
//Address 0 is used for the broadcast address, which all slave devices recognize.//
///////////////////////////////////////////////////////////////////////////////////
-
+#define HAVE_FTP_PROCESS
#ifdef HAVE_FTP_PROCESS
-#define MODBUSP_READ_ID 100 //读取文件及文件夹ID
-
+#define MODBUSP_READ_ID 100 //读取文件及文件夹ID
#define MODBUSP_READ_ID_FUNCCODE 0x03 //读取文件及文件夹ID功能码。
-#define MODBUSP_READ_ID_REGISTER_ADDRESS 0x01 //读取文件及文件夹ID寄存器地址。
-#define MODBUSP_READ_ID_REGISTER_LENGTH 0x6 //读取文件及文件夹ID寄存器长须。
+#define MODBUSP_READ_ID_REGISTER_ADDRESS 150 //读取文件及文件夹ID寄存器地址。
+#define MODBUSP_READ_ID_REGISTER_LENGTH 9 //读取文件及文件夹ID寄存器长度。
#include
@@ -129,6 +128,14 @@ static void* ryftp_process(void* param)
char password[128] = "123456";
char ipaddress[128] = "127.0.0.1";
+ //根据协议创建一个本地协议目录
+ int pid = mbt->GetCurID();
+ if (pid < 0 || pid >= PROCESSES_NUM) return ((void*)0);
+ char pathName[128];
+ snprintf(pathName, sizeof(pathName), "%d", pid);
+ if (mbt->_mkdir(pathName) < 0) return ((void*)0);
+
+ //配置的用户名和密码
#if 0
snprintf(user, sizeof(user), "%s", mbt->m_user);
snprintf(password, sizeof(password), "%s", mbt->m_password);
@@ -143,23 +150,26 @@ static void* ryftp_process(void* param)
while (TRUE) {
sleep(1); //每秒执行一次
//ftp获取文件
- snprintf(name, sizeof(name), "%d.rtd", mbt->m_currentFileNo + 1);
- snprintf(remote, sizeof(remote), "ftp://%s/data/rtdatalog/%d/%d.rtd", str, mbt->m_currentDirNo + 1, mbt->m_currentFileNo + 1);
+ if (mbt->m_iv == 1) {
+ //文件目录无效
+ continue;
+ }
+ snprintf(name, sizeof(name), "%s/%d", pathName, mbt->m_currentFileNo);
+ snprintf(remote, sizeof(remote), "ftp://%s/data/rtdatalog/%d/%d", str, mbt->m_currentDirNo, mbt->m_currentFileNo);
if (ftpget(remote, name, user, password)) {
//成功,处理文件
vLog(LOG_DEBUG, "get a file, then send to ws.\n");
- mbt->m_lastDirNo = mbt->m_currentDirNo;
mbt->m_lastFileNo = mbt->m_currentFileNo;
mbt->m_currentFileNo++;
- if (mbt->m_currentFileNo % 1000 == 0)
- { //一个文件夹最多存放1000个文件
- mbt->m_currentFileNo = 0;
+ if ((mbt->m_currentFileNo - mbt->m_lastStartFileNo) % 1000 == 0) {
+ //一个文件夹最多存放1000个文件, mbt->m_currentFileNo = 0;
mbt->m_currentDirNo++;
- if (mbt->m_currentDirNo >= 56)
- { //7天数据大约有56个文件夹
+ mbt->m_lastStartFileNo = mbt->m_currentFileNo;
+ if (mbt->m_currentDirNo >= 56) { //7天数据大约有56个文件夹
mbt->m_currentDirNo = 0;
}
+ //保存文件信息
}
}
}
@@ -269,11 +279,17 @@ CHostModbusTcpProcess::CHostModbusTcpProcess(noPollConn *conn)
m_nNeedSend = FALSE;
//websocket接口
+ m_conn = NULL;
if (conn != NULL)
{
m_conn = conn;
}
+ m_pid = 0;
+
+ //目录无效
+ m_iv = 1;
+
m_currentDirNo = -1; //当前目录编号
m_currentFileNo = -1; //当前文件编号
m_lastDirNo = -1; //上一目录编号
@@ -440,7 +456,17 @@ void CHostModbusTcpProcess::calc2(void)
if (yccount) ycparam = new STRUCT_PARAM[yccount];
if (ymcount) ymparam = new STRUCT_PARAM[ymcount];
if (yxcount) yxparam = new STRUCT_PARAM[yxcount];
-
+#if 0
+ //插入一帧读取信息的报文
+ ycframes[0].FrameType = MODBUSP_READ_ID;
+ ycframes[0].FuncCode = MODBUSP_READ_ID_FUNCCODE;
+ ycframes[0].RegBegin = MODBUSP_READ_ID_REGISTER_ADDRESS;
+ ycframes[0].RegCount = MODBUSP_READ_ID_REGISTER_LENGTH;
+
+ j = 1;
+#else
+ j = 0;
+#endif
if (ycparam)
{
memset(ycparam, 0, sizeof(STRUCT_PARAM) * yccount);
@@ -457,7 +483,7 @@ void CHostModbusTcpProcess::calc2(void)
{
WORD addr = MAKEWORD(ycparam[n].param[1], ycparam[n].param[2]);
if (addr >= 65535) continue;
- for (j = 0; j < MODBUS_RTU_AUTOMATIC_FRAME; j++)
+ for (; j < MODBUS_RTU_AUTOMATIC_FRAME; j++)
{
if (ycframes[j].FuncCode == 0)
{
@@ -600,7 +626,25 @@ BOOLEAN CHostModbusTcpProcess::OnPreCreate(int id)
m_nTimeout = 200;
calc2();
- //启动后,读取本地文件更新最后一次的文件夹及文件序号
+ //启动后,创建ftp线程
+ if (m_pid <= 0) {
+ vLog(LOG_DEBUG, "create a ftp thread.\n");
+
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, MEMERY_1M);
+ pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
+
+ if (pthread_create(&m_pid, &attr, ryftp_process, this) < 0) {
+ vLog(LOG_ERROR, "create ryftp_process error(%d,%s).\n", errno, strerror(errno));
+ return TRUE;
+ }
+ char name[17];
+ snprintf(name, 16, "%s_ftp", GetCurProcessName());
+ pthread_setname_np(m_pid, name);
+
+ pthread_attr_destroy(&attr);
+ }
return TRUE;
}
@@ -661,6 +705,8 @@ BOOLEAN CHostModbusTcpProcess::Run(void)
pItem->m_nNum++;
m_nSendPoint = system32.ticks;//0;
m_nNeedSend = FALSE;
+
+ //fprintf(stderr, "tx<%d>: ", count+6); for (int a = 0; a < count+6; a++) fprintf(stderr, "%02X ", buffer[a]); fprintf(stderr, "\n");
FeedDog();
}
}
@@ -701,10 +747,11 @@ BOOLEAN CHostModbusTcpProcess::OnTimer(void)
pItem = (CHostModbusTcpProcessItem *)GetNextItem();
if (pItem == NULL) return TRUE;
m_nNeedSend = TRUE;
+
+#if 1
+ //启动时读取一次,后面自己维护序号
if ((m_currentDirNo == -1) && (m_currentFileNo == -1))
{ //当前文件和目录都为-1,程序第一次启动。需要获取ftp目录及文件ID
- /* code */
- vLog(LOG_DEBUG, "here..... add read id frame.\n");
m_nFrameType = MODBUSP_READ_ID;
m_nCurFuncCode = MODBUSP_READ_ID_FUNCCODE;
m_nCurBeginReg = MODBUSP_READ_ID_REGISTER_ADDRESS;
@@ -712,6 +759,7 @@ BOOLEAN CHostModbusTcpProcess::OnTimer(void)
pItem->m_nFramePoll |= MODBUSP_GET_DATA_FRAME;
return TRUE;
}
+#endif
struModbusExtFrame* frame = pItem->GetNextFrame();
if (frame != NULL)
{
@@ -1179,29 +1227,30 @@ BOOLEAN CHostModbusTcpProcess::OnReceiveIDData(CHostModbusTcpProcessItem *pItem,
pBuf = pData;
- //根据结构来处理得到id信息
+/*
+ 1)、路径信息是否有效 byte;
+ 2)、当前文件夹路径名的后缀 dint,按照顺序增加1(转字符串时在前补0);
+ 3)、当前文件夹下最后新文件的编号 dint;
+ 4)、当前文件夹下第一个文件的编号 dint;
+ 5)、当前文件夹下文件个数 dint;
+*/
+ //路径有效性判断
+ int iv = ((pBuf[0] << 8) | pBuf[1]); pBuf += 2;
- //
- m_currentDirNo = 0;
- m_currentFileNo = 0;
-
- vLog(LOG_DEBUG, "create a ftp thread.\n");
- //创建ftp线程
- pthread_attr_t attr;
-
- pthread_attr_init(&attr);
- pthread_attr_setstacksize(&attr, MEMERY_1M);
- pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
-
- if (pthread_create(&m_pid, &attr, ryftp_process, this) < 0) {
- vLog(LOG_ERROR, "create ryftp_process error(%d,%s).\n", errno, strerror(errno));
- return TRUE;
+ m_iv = iv;
+ if (iv) {
+ vLog(LOG_DEBUG, "路径信息无效\n");
+ return FALSE;
}
- char name[16];
- snprintf(name, 16, "%s_ftp", GetCurProcessName());
- pthread_setname_np(m_pid, name);
-
- pthread_attr_destroy(&attr);
+ //当前文件夹路径名
+ m_currentDirNo = (DWORD)((pBuf[2] << 24) | (pBuf[3] << 16) | (pBuf[0] << 8) | pBuf[1]); pBuf += 4;
+ //当前文件夹下最后新文件
+ m_currentFileNo = (DWORD)((pBuf[2] << 24) | (pBuf[3] << 16) | (pBuf[0] << 8) | pBuf[1]); pBuf += 4;
+ //当前文件夹下第一个文件
+ m_lastStartFileNo = (DWORD)((pBuf[2] << 24) | (pBuf[3] << 16) | (pBuf[0] << 8) | pBuf[1]); pBuf += 4;
+
+ vLog(LOG_DEBUG, "dir: %d, file: %d: start: %d\n", m_currentDirNo, m_currentFileNo, m_lastStartFileNo);
+
return TRUE;
}
diff --git a/das-dn/hostmodbustcp/host_modbus_tcp.h b/das-dn/hostmodbustcp/host_modbus_tcp.h
index 1afc3ba9..54a29506 100644
--- a/das-dn/hostmodbustcp/host_modbus_tcp.h
+++ b/das-dn/hostmodbustcp/host_modbus_tcp.h
@@ -4,6 +4,7 @@
#include "netproc.h"
#include "modbus_def.h"
+#include
#include
#include
@@ -60,16 +61,28 @@ private:
public:
noPollConn *m_conn;
- int m_currentDirNo; //当前目录编号
- int m_currentFileNo; //当前文件编号
- int m_lastDirNo; //上一目录编号
- int m_lastFileNo; //上一文件编号
+ int m_iv;
+ LONG m_currentDirNo; //当前目录编号
+ LONG m_currentFileNo; //当前文件编号
+ LONG m_lastDirNo; //上一目录编号
+ LONG m_lastFileNo; //上一文件编号
+ LONG m_lastStartFileNo; //文件开始编号
//ftp参数信息
char m_user[128];
char m_password[128];
char m_remoteIp[64];
+ int _mkdir(const char* pathName) {
+ if (access(pathName, F_OK) == 0) return 0;
+ // 创建目录
+ if (mkdir(pathName, 0777) == -1) {
+ vLog(LOG_ERROR, "创建文件夹 %s失败<%d,%s>\r\n", pathName, errno, strerror(errno));
+ return -1;
+ }
+ return 1;
+ }
+
public:
CHostModbusTcpProcess(noPollConn *conn);
virtual ~CHostModbusTcpProcess();
diff --git a/das-dn/inc/process.h b/das-dn/inc/process.h
index a3cb03b1..84474ff7 100644
--- a/das-dn/inc/process.h
+++ b/das-dn/inc/process.h
@@ -47,11 +47,15 @@ public:
config.processes[m_nProcess].softdog = 0;
}
- inline char* GetCurProcessName() const
+ inline char* GetCurProcessName(void) const
{
if (m_nProcess < 0 || m_nProcess >= PROCESSES_NUM) return NULL;
return config.processes[m_nProcess].name;
}
+ inline int GetCurID(void) const
+ {
+ return m_nProcess;
+ }
inline int GetCurOrder() const
{
From ec2c51002711b8367fda7dd9c707ca6bc0c1e644 Mon Sep 17 00:00:00 2001
From: yuwanchiren <863666755@qq.com>
Date: Tue, 15 Oct 2024 14:52:29 +0800
Subject: [PATCH 5/5] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=8F=B0=E8=B4=A6?=
=?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../equipment/equipmentManagement/index.vue | 37 ++++++++++++-------
1 file changed, 24 insertions(+), 13 deletions(-)
diff --git a/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue b/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue
index 49cc5deb..eab17544 100644
--- a/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue
+++ b/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue
@@ -147,12 +147,12 @@
-
+
-
+
@@ -302,12 +302,17 @@
-
+
-
+
@@ -536,6 +541,7 @@ const handleNodeClick = (data: any) => {
formQuery.objectType = data.equipmentTypeId
equipQuery(formQuery).then((res) => {
deviceList.value = res.rows
+
pageTotal.value = res.total
})
equipModeList({
@@ -626,8 +632,8 @@ const addDeviceList = () => {
editAddDeviceData.orgId = ''
editAddDeviceData.parentEquipmentId = ''
editAddDeviceData.iotModelId = ''
- editAddDeviceData.belongingLine = ''
- editAddDeviceData.isbenchMarkUnit = false
+ editAddDeviceData.belongLine = ''
+ editAddDeviceData.standard = 0
}
// 查看设备详情
@@ -648,8 +654,8 @@ const editDeviceData = reactive({
parentEquipmentId: '',
iotModelId: '',
id: '',
- belongingLine: '',
- isbenchMarkUnit: false,
+ belongLine: '',
+ standard: 0,
})
const size = ref<'default' | 'large' | 'small'>('default')
@@ -677,8 +683,8 @@ const viewDeviceDetails = (data: any) => {
editDeviceData.orgId = data.row.orgId
editDeviceData.parentEquipmentId = data.row.parentEquipmentId
editDeviceData.iotModelId = data.row.iotModelId
- editDeviceData.belongingLine = data.row.belongingLine
- editDeviceData.isbenchMarkUnit = data.row.isbenchMarkUnit
+ editDeviceData.belongLine = data.row.belongLine
+ editDeviceData.standard = data.row.standard || 0
}
// 设备删除
@@ -798,9 +804,15 @@ const editAddDeviceData = reactive({
orgId: '',
parentEquipmentId: '',
iotModelId: '',
- belongingLine: '',
- isbenchMarkUnit: false,
+ belongLine: '',
+ standard: 0,
})
+const addhandleSwitchChange = (value: any) => {
+ editAddDeviceData.standard = value ? 1 : 0
+}
+const edithandleSwitchChange = (value: any) => {
+ editDeviceData.standard = value ? 1 : 0
+}
// 设备新增字段校验
const editAddDeviceRules = reactive({
@@ -832,7 +844,6 @@ const saveAddData = () => {
editAddDeviceData.objectType = ele.equipmentTypeId
}
})
-
equipAdd(editAddDeviceData).then((res) => {
if (res.code == 200) {
ElMessage({