Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
JunmpPoliceStation
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
zxw
JunmpPoliceStation
Commits
ea5dfad7
Commit
ea5dfad7
authored
Dec 02, 2022
by
zxw
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去除redis数据写入
mqtt不记录连接断开数据
parent
162e7717
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
48 行增加
和
48 行删除
+48
-48
InventoryController.cs
JunmpPoliceStation/Controllers/InventoryController.cs
+5
-5
MQTTServer.cs
JunmpPoliceStation/Extensions/MQTTServer.cs
+43
-43
没有找到文件。
JunmpPoliceStation/Controllers/InventoryController.cs
View file @
ea5dfad7
...
...
@@ -7373,11 +7373,11 @@ namespace JunmpPoliceStation.Controllers
sizeList
.
AddRange
(
UpdateEpc
.
Select
(
x
=>
x
.
EquipmentSizecode
).
ToList
());
_unitOfWork
.
CalcThreshold
(
sizeList
.
Distinct
().
ToList
(),
orgId
,
warehouseId
);
//更新redis上货架相关数据
if
(!
ChannelExtension
.
UpdateShelfAndInventoryToRedis
(
_unitOfWork
,
warehouseId
,
out
string
msg
))
{
_logger
.
LogError
(
"更新redis上货架相关数据失败:"
+
msg
);
}
//
//
更新redis上货架相关数据
//
if (!ChannelExtension.UpdateShelfAndInventoryToRedis(_unitOfWork, warehouseId, out string msg))
//
{
//
_logger.LogError("更新redis上货架相关数据失败:" + msg);
//
}
return
JsonManager
.
ReturnSuccessResponse
(
resultEpc
);
}
...
...
JunmpPoliceStation/Extensions/MQTTServer.cs
View file @
ea5dfad7
...
...
@@ -139,62 +139,62 @@ namespace JunmpPoliceStation.Extensions
public
void
OnMqttServerClientConnected
(
MqttServerClientConnectedEventArgs
e
)
{
using
(
var
scope
=
Startup
.
ServiceLocator
.
Instance
.
CreateScope
())
{
var
dbContext
=
scope
.
ServiceProvider
.
GetService
<
JunmppolicesqlContext
>();
//
using (var scope = Startup.ServiceLocator.Instance.CreateScope())
//
{
//
var dbContext = scope.ServiceProvider.GetService<JunmppolicesqlContext>();
dbContext
?.
ApiMqttMessages
.
Add
(
new
ApiMqttMessage
{
Id
=
Guid
.
NewGuid
().
ToString
(),
CreateTime
=
DateTime
.
Now
,
DeviceNo
=
e
.
ClientId
,
DeviceType
=
e
.
ClientId
.
Substring
(
0
,
2
),
Topic
=
"Connected"
,
Payload
=
$"客户端[
{
e
.
ClientId
}
]已连接"
});
dbContext
?.
SaveChanges
();
}
//
dbContext?.ApiMqttMessages.Add(new ApiMqttMessage
//
{
//
Id = Guid.NewGuid().ToString(),
//
CreateTime = DateTime.Now,
//
DeviceNo = e.ClientId,
//
DeviceType = e.ClientId.Substring(0, 2),
//
Topic = "Connected",
//
Payload = $"客户端[{e.ClientId}]已连接"
//
});
//
dbContext?.SaveChanges();
//
}
//Console.WriteLine($"客户端[{e.ClientId}]已连接");
}
public
void
OnMqttServerClientDisconnected
(
MqttServerClientDisconnectedEventArgs
e
)
{
using
(
var
scope
=
Startup
.
ServiceLocator
.
Instance
.
CreateScope
())
{
var
dbContext
=
scope
.
ServiceProvider
.
GetService
<
JunmppolicesqlContext
>();
//
using (var scope = Startup.ServiceLocator.Instance.CreateScope())
//
{
//
var dbContext = scope.ServiceProvider.GetService<JunmppolicesqlContext>();
dbContext
?.
ApiMqttMessages
.
Add
(
new
ApiMqttMessage
{
Id
=
Guid
.
NewGuid
().
ToString
(),
CreateTime
=
DateTime
.
Now
,
DeviceNo
=
e
.
ClientId
,
DeviceType
=
e
.
ClientId
.
Substring
(
0
,
2
),
Topic
=
"Disconnected"
,
Payload
=
$"客户端[
{
e
.
ClientId
}
]已断开连接!"
});
dbContext
?.
SaveChanges
();
}
//
dbContext?.ApiMqttMessages.Add(new ApiMqttMessage
//
{
//
Id = Guid.NewGuid().ToString(),
//
CreateTime = DateTime.Now,
//
DeviceNo = e.ClientId,
//
DeviceType = e.ClientId.Substring(0, 2),
//
Topic = "Disconnected",
//
Payload = $"客户端[{e.ClientId}]已断开连接!"
//
});
//
dbContext?.SaveChanges();
//
}
//Console.WriteLine($"客户端[{e.ClientId}]已断开连接!");
}
public
void
OnMqttServerClientSubscribedTopic
(
MqttServerClientSubscribedTopicEventArgs
e
)
{
using
(
var
scope
=
Startup
.
ServiceLocator
.
Instance
.
CreateScope
())
{
var
dbContext
=
scope
.
ServiceProvider
.
GetService
<
JunmppolicesqlContext
>();
//
using (var scope = Startup.ServiceLocator.Instance.CreateScope())
//
{
//
var dbContext = scope.ServiceProvider.GetService<JunmppolicesqlContext>();
var
message
=
new
ApiMqttMessage
{
Id
=
Guid
.
NewGuid
().
ToString
(),
CreateTime
=
DateTime
.
Now
,
DeviceNo
=
e
.
ClientId
,
DeviceType
=
e
.
ClientId
.
Substring
(
0
,
2
),
Topic
=
e
.
TopicFilter
.
Topic
,
Payload
=
$"客户端[
{
e
.
ClientId
}
]已成功订阅主题[
{
e
.
TopicFilter
}
]!"
};
dbContext
?.
ApiMqttMessages
.
Add
(
message
);
dbContext
?.
SaveChanges
();
}
//
var message = new ApiMqttMessage
//
{
//
Id = Guid.NewGuid().ToString(),
//
CreateTime = DateTime.Now,
//
DeviceNo = e.ClientId,
//
DeviceType = e.ClientId.Substring(0, 2),
//
Topic = e.TopicFilter.Topic,
//
Payload = $"客户端[{e.ClientId}]已成功订阅主题[{e.TopicFilter}]!"
//
};
//
dbContext?.ApiMqttMessages.Add(message);
//
dbContext?.SaveChanges();
//
}
//Console.WriteLine($"客户端[{e.ClientId}]已成功订阅主题[{e.TopicFilter}]!");
}
...
...
zxw
@zxw
被提及 commit
63b28915
Dec 07, 2022
被提及 commit
63b28915
被提及 commit 63b289155635882d733e31e900d1dea567375c48
切换提交列表
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论