Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO1057_XLC_Store
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 738ee324
由
张东亮
编写于
2025-09-10 11:11:21 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
温湿度上报
1 个父辈
39c38bcb
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
76 行增加
和
24 行删除
Common/bean/Bean.cs
Common/util/HumitureController.cs
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
DeviceLibrary/theMachine/MainMachine _LedProcess.cs
DeviceLibrary/theMachine/RobotManage.cs
Common/bean/Bean.cs
查看文件 @
738ee32
...
@@ -233,11 +233,12 @@ namespace OnlineStore.Common
...
@@ -233,11 +233,12 @@ namespace OnlineStore.Common
/// 湿度报警值
/// 湿度报警值
/// </summary>
/// </summary>
public
static
string
maxHumidity
=
"humi"
;
public
static
string
maxHumidity
=
"humi"
;
public
static
string
minHumidity
=
"minHumi"
;
/// <summary>
/// <summary>
/// 温度报警值
/// 温度报警值
/// </summary>
/// </summary>
public
static
string
maxTemperature
=
"temp"
;
public
static
string
maxTemperature
=
"temp"
;
public
static
string
minTemperature
=
"minTemp"
;
/// <summary>
/// <summary>
/// urgentReel: true 表示紧急料,需要出到料串上
/// urgentReel: true 表示紧急料,需要出到料串上
/// </summary>
/// </summary>
...
...
Common/util/HumitureController.cs
查看文件 @
738ee32
...
@@ -107,7 +107,7 @@ namespace OnlineStore.Common
...
@@ -107,7 +107,7 @@ namespace OnlineStore.Common
// else
// else
// data[0] += Setting_Init.Device_HumidityAdjust;
// data[0] += Setting_Init.Device_HumidityAdjust;
//}
//}
data
[
0
]
=
ProcessHumity
(
data
[
0
]);
data
[
0
]
=
ProcessHumity
(
serialPort
,
data
[
0
]);
//if (Setting_Init.Device_TemptureAdjust != 0 && Setting_Init.Device_TemptureLimited != 0)
//if (Setting_Init.Device_TemptureAdjust != 0 && Setting_Init.Device_TemptureLimited != 0)
//{
//{
// if (data[1] + Setting_Init.Device_TemptureAdjust < Setting_Init.Device_TemptureLimited)
// if (data[1] + Setting_Init.Device_TemptureAdjust < Setting_Init.Device_TemptureLimited)
...
@@ -117,7 +117,7 @@ namespace OnlineStore.Common
...
@@ -117,7 +117,7 @@ namespace OnlineStore.Common
// else
// else
// data[1] += Setting_Init.Device_TemptureAdjust;
// data[1] += Setting_Init.Device_TemptureAdjust;
//}
//}
data
[
1
]
=
ProcessTemp
(
data
[
1
]);
data
[
1
]
=
ProcessTemp
(
serialPort
,
data
[
1
]);
param
=
new
ASTemperateParam
(
data
[
1
],
data
[
0
],
data
[
2
]);
param
=
new
ASTemperateParam
(
data
[
1
],
data
[
0
],
data
[
2
]);
}
}
LastData
=
param
;
LastData
=
param
;
...
@@ -128,7 +128,7 @@ namespace OnlineStore.Common
...
@@ -128,7 +128,7 @@ namespace OnlineStore.Common
/// </summary>
/// </summary>
/// <param name="nowTemp"></param>
/// <param name="nowTemp"></param>
/// <returns></returns>
/// <returns></returns>
private
static
double
ProcessTemp
(
double
nowTemp
)
private
static
double
ProcessTemp
(
string
port
,
double
nowTemp
)
{
{
double
temp
=
nowTemp
;
double
temp
=
nowTemp
;
double
minVal
=
5
;
//ConfigHelper.Config.Get("TempThreshold_Min", 5);
double
minVal
=
5
;
//ConfigHelper.Config.Get("TempThreshold_Min", 5);
...
@@ -147,7 +147,12 @@ namespace OnlineStore.Common
...
@@ -147,7 +147,12 @@ namespace OnlineStore.Common
{
{
temp
=
(
nowTemp
-
11
)
*
(
nowTemp
-
10
)
/
10
+
11
;
temp
=
(
nowTemp
-
11
)
*
(
nowTemp
-
10
)
/
10
+
11
;
}
}
else
{
var
calib
=
ConfigHelper
.
Config
.
Get
(
$
"TemptureCalib_{port}"
,
0
);
nowTemp
+=
calib
;
return
nowTemp
;
}
return
Math
.
Round
(
temp
,
1
);
return
Math
.
Round
(
temp
,
1
);
}
}
/// <summary>
/// <summary>
...
@@ -155,7 +160,7 @@ namespace OnlineStore.Common
...
@@ -155,7 +160,7 @@ namespace OnlineStore.Common
/// </summary>
/// </summary>
/// <param name="nowHumity"></param>
/// <param name="nowHumity"></param>
/// <returns></returns>
/// <returns></returns>
private
static
double
ProcessHumity
(
double
nowHumity
)
private
static
double
ProcessHumity
(
string
port
,
double
nowHumity
)
{
{
double
temp
=
nowHumity
;
double
temp
=
nowHumity
;
double
minVal
=
ConfigHelper
.
Config
.
Get
(
"HumidityThreshold_Min"
,
5
);
double
minVal
=
ConfigHelper
.
Config
.
Get
(
"HumidityThreshold_Min"
,
5
);
...
@@ -170,7 +175,6 @@ namespace OnlineStore.Common
...
@@ -170,7 +175,6 @@ namespace OnlineStore.Common
{
{
temp
=
(
nowHumity
-
minVal
)
*
coefVal
+
minVal
;
temp
=
(
nowHumity
-
minVal
)
*
coefVal
+
minVal
;
}
}
return
Math
.
Round
(
temp
,
1
);
return
Math
.
Round
(
temp
,
1
);
}
}
/// <summary>
/// <summary>
...
...
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
738ee32
...
@@ -209,8 +209,8 @@ namespace DeviceLibrary
...
@@ -209,8 +209,8 @@ namespace DeviceLibrary
boxStatus
.
boxId
=
StoreID
;
boxStatus
.
boxId
=
StoreID
;
if
(
RobotManage
.
humitureControllers
.
Count
>
0
)
if
(
RobotManage
.
humitureControllers
.
Count
>
0
)
{
{
boxStatus
.
humidity
=
RobotManage
.
humitureControllers
.
Average
(
x
=>
x
.
LastData
.
Humidity
).
ToString
();
boxStatus
.
humidity
=
RobotManage
.
averageHumidity
(
).
ToString
();
boxStatus
.
temperature
=
RobotManage
.
humitureControllers
.
Average
(
x
=>
x
.
LastData
.
Temperate
).
ToString
();
boxStatus
.
temperature
=
RobotManage
.
averageTemp
(
).
ToString
();
}
}
List
<
humidata
>
humidatas
=
new
List
<
humidata
>();
List
<
humidata
>
humidatas
=
new
List
<
humidata
>();
for
(
int
i
=
0
;
i
<
RobotManage
.
humitureControllers
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
RobotManage
.
humitureControllers
.
Count
;
i
++)
...
@@ -421,7 +421,10 @@ namespace DeviceLibrary
...
@@ -421,7 +421,10 @@ namespace DeviceLibrary
}
}
public
float
Max_Humidity
;
public
float
Max_Humidity
;
public
float
Min_Humidity
;
public
float
Max_Temperature
;
public
float
Max_Temperature
;
public
float
Min_Temperature
;
/// <summary>
/// <summary>
/// 处理服务器温湿度消息
/// 处理服务器温湿度消息
/// </summary>
/// </summary>
...
@@ -446,6 +449,23 @@ namespace DeviceLibrary
...
@@ -446,6 +449,23 @@ namespace DeviceLibrary
LogUtil
.
error
(
"转换温湿度失败:"
+
ex
.
ToString
());
LogUtil
.
error
(
"转换温湿度失败:"
+
ex
.
ToString
());
}
}
}
}
if
(
data
!=
null
&&
data
.
ContainsKey
(
ParamDefine
.
minHumidity
)
&&
data
.
ContainsKey
(
ParamDefine
.
minTemperature
))
{
string
maxHumidity
=
data
[
ParamDefine
.
minHumidity
];
string
maxTemp
=
data
[
ParamDefine
.
minTemperature
];
LogUtil
.
info
(
"收到服务器温湿度预警值:minHumidity="
+
maxHumidity
+
",minTemperature="
+
maxTemp
);
try
{
this
.
Min_Humidity
=
(
float
)
Convert
.
ToDouble
(
maxHumidity
);
this
.
Min_Temperature
=
(
float
)
Convert
.
ToDouble
(
maxTemp
);
LogUtil
.
info
(
"保存温湿度预警值:Min_Humidity="
+
Min_Humidity
+
",Min_Temperature="
+
Min_Temperature
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"转换温湿度失败:"
+
ex
.
ToString
());
}
}
}
}
/// <summary>
/// <summary>
/// 处理服务器出库任务消息
/// 处理服务器出库任务消息
...
...
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
查看文件 @
738ee32
...
@@ -42,7 +42,8 @@ namespace DeviceLibrary
...
@@ -42,7 +42,8 @@ namespace DeviceLibrary
else
else
{
{
var
timediff
=
DateTime
.
Now
-
lastBtnUpPressTime
;
var
timediff
=
DateTime
.
Now
-
lastBtnUpPressTime
;
if
(
timediff
.
TotalSeconds
<
3
&&
trueCount
==
2
)
{
if
(
timediff
.
TotalSeconds
<
3
&&
trueCount
==
2
)
{
if
(
btnUP_L
&&
btnUP_R
)
if
(
btnUP_L
&&
btnUP_R
)
{
{
BtnAction
=
BtnActionE
.
Mid_Up
;
BtnAction
=
BtnActionE
.
Mid_Up
;
...
@@ -51,12 +52,16 @@ namespace DeviceLibrary
...
@@ -51,12 +52,16 @@ namespace DeviceLibrary
{
{
BtnAction
=
BtnActionE
.
Mid_Down
;
BtnAction
=
BtnActionE
.
Mid_Down
;
}
}
}
else
if
(
timediff
.
TotalSeconds
>
3
&&
trueCount
==
1
)
{
}
if
(
BtnAction
==
BtnActionE
.
None
)
{
else
if
(
timediff
.
TotalSeconds
>
3
&&
trueCount
==
1
)
{
if
(
BtnAction
==
BtnActionE
.
None
)
{
if
(
btnUP_L
)
if
(
btnUP_L
)
{
{
BtnAction
=
BtnActionE
.
Left_IN
;
BtnAction
=
BtnActionE
.
Left_IN
;
}
else
if
(
btnUP_R
)
}
else
if
(
btnUP_R
)
{
{
BtnAction
=
BtnActionE
.
Right_IN
;
BtnAction
=
BtnActionE
.
Right_IN
;
}
}
...
@@ -86,7 +91,8 @@ namespace DeviceLibrary
...
@@ -86,7 +91,8 @@ namespace DeviceLibrary
}
}
if
(
BtnAction
==
BtnActionE
.
Left_IN
||
BtnAction
==
BtnActionE
.
Right_IN
)
{
if
(
BtnAction
==
BtnActionE
.
Left_IN
||
BtnAction
==
BtnActionE
.
Right_IN
)
{
var
side
=
BtnAction
==
BtnActionE
.
Left_IN
?
InOutSideE
.
Left
:
InOutSideE
.
Right
;
var
side
=
BtnAction
==
BtnActionE
.
Left_IN
?
InOutSideE
.
Left
:
InOutSideE
.
Right
;
var
ld
=
InOutDevice
.
InOutDeviceList
[
side
];
var
ld
=
InOutDevice
.
InOutDeviceList
[
side
];
...
@@ -97,7 +103,8 @@ namespace DeviceLibrary
...
@@ -97,7 +103,8 @@ namespace DeviceLibrary
ld
.
CurrnetDirection
=
InOutDirectionE
.
IN
;
ld
.
CurrnetDirection
=
InOutDirectionE
.
IN
;
return
;
return
;
}
}
else
{
else
{
Msg
.
add
(
ld
.
Name
+
msg
,
MsgLevel
.
info
);
Msg
.
add
(
ld
.
Name
+
msg
,
MsgLevel
.
info
);
}
}
}
}
...
@@ -116,7 +123,7 @@ namespace DeviceLibrary
...
@@ -116,7 +123,7 @@ namespace DeviceLibrary
IOMove
(
IO_Type
.
AirValue
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
AirValue
,
IO_VALUE
.
HIGH
);
return
;
return
;
}
}
if
((
DateTime
.
Now
-
lastAirprocesstime
).
TotalSeconds
<
5
)
if
((
DateTime
.
Now
-
lastAirprocesstime
).
TotalSeconds
<
5
)
return
;
return
;
lastAirprocesstime
=
DateTime
.
Now
;
lastAirprocesstime
=
DateTime
.
Now
;
...
@@ -124,8 +131,8 @@ namespace DeviceLibrary
...
@@ -124,8 +131,8 @@ namespace DeviceLibrary
IOManager
.
IOMove
(
IO_Type
.
SafeDoor_Lock
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
SafeDoor_Lock
,
IO_VALUE
.
HIGH
);
//var temp = HumitureController.QueryData();
//var temp = HumitureController.QueryData();
//var temp = HumitureController.LastData;
//var temp = HumitureController.LastData;
Current_Humidity
=
RobotManage
.
humitureControllers
.
Average
(
x
=>
x
.
LastData
.
Humidity
);
Current_Humidity
=
averageHumidity
(
);
Current_Temperate
=
RobotManage
.
humitureControllers
.
Average
(
x
=>
x
.
LastData
.
Temperate
);
Current_Temperate
=
averageTemp
(
);
//var tempIsOK = Current_Temperate < ServerCM.Max_Temperature;
//var tempIsOK = Current_Temperate < ServerCM.Max_Temperature;
var
humiNeedStart
=
Current_Humidity
>
ServerCM
.
Max_Humidity
-
Setting_Init
.
Device_HumidityStartOffser
;
var
humiNeedStart
=
Current_Humidity
>
ServerCM
.
Max_Humidity
-
Setting_Init
.
Device_HumidityStartOffser
;
...
@@ -139,17 +146,30 @@ namespace DeviceLibrary
...
@@ -139,17 +146,30 @@ namespace DeviceLibrary
else
if
(
humiNeedStop
&&
airisopen
)
else
if
(
humiNeedStop
&&
airisopen
)
{
{
IOMove
(
IO_Type
.
AirValue
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
AirValue
,
IO_VALUE
.
HIGH
);
// airisopen = false;
// airisopen = false;
LogUtil
.
info
(
$
"关闭吹气,当前最大湿度:{Current_Humidity} < {ServerCM.Max_Humidity}-{Setting_Init.Device_HumidityEndOffser}."
);
LogUtil
.
info
(
$
"关闭吹气,当前最大湿度:{Current_Humidity} < {ServerCM.Max_Humidity}-{Setting_Init.Device_HumidityEndOffser}."
);
}
}
}
}
bool
lastTHoutRangeStatus
=
false
;
bool
lastTHoutRangeStatus
=
false
;
DateTime
lastTHoutRangeTime
=
DateTime
.
MaxValue
;
DateTime
lastTHoutRangeTime
=
DateTime
.
MaxValue
;
double
averageHumidity
()
{
return
RobotManage
.
averageHumidity
();
}
double
averageTemp
()
{
return
RobotManage
.
averageTemp
();
}
bool
IsTHoutRange
()
bool
IsTHoutRange
()
{
{
if
(
RobotManage
.
humitureControllers
.
Average
(
x
=>
x
.
LastData
.
Humidity
)
>
ServerCM
.
Max_Humidity
// || HumitureController.LastData.Humidity < ServerCM.Min_Humidity
if
(
averageHumidity
()
>
ServerCM
.
Max_Humidity
||
RobotManage
.
humitureControllers
.
Average
(
x
=>
x
.
LastData
.
Temperate
)
>
ServerCM
.
Max_Temperature
)
||
averageHumidity
()
<
ServerCM
.
Min_Humidity
||
averageTemp
()
>
ServerCM
.
Max_Temperature
||
averageTemp
()
<
ServerCM
.
Min_Temperature
)
{
{
Msg
.
add
(
$
"温湿度超出范围,当前温度:{averageTemp()},范围:{ServerCM.Min_Temperature}~{ServerCM.Max_Temperature},"
+
$
"当前湿度:{averageHumidity()},范围:{ServerCM.Min_Humidity}~{ServerCM.Max_Humidity}"
,
MsgLevel
.
warning
);
if
(!
lastTHoutRangeStatus
)
if
(!
lastTHoutRangeStatus
)
lastTHoutRangeTime
=
DateTime
.
Now
;
lastTHoutRangeTime
=
DateTime
.
Now
;
lastTHoutRangeStatus
=
true
;
lastTHoutRangeStatus
=
true
;
...
...
DeviceLibrary/theMachine/MainMachine _LedProcess.cs
查看文件 @
738ee32
...
@@ -83,10 +83,10 @@ namespace DeviceLibrary
...
@@ -83,10 +83,10 @@ namespace DeviceLibrary
MachineLedState
.
Add
(
MachineLedStateE
.
SystemPause
,
nls
(
LedState
.
blink
,
LedState
.
off
,
LedState
.
blink
));
MachineLedState
.
Add
(
MachineLedStateE
.
SystemPause
,
nls
(
LedState
.
blink
,
LedState
.
off
,
LedState
.
blink
));
//温湿度超限30分钟. 红闪,黄闪
//温湿度超限30分钟. 红闪,黄闪
MachineLedStateName
[
MachineLedStateE
.
THoutRangeOver30m
]
=
"温湿度超限30分钟"
;
MachineLedStateName
[
MachineLedStateE
.
THoutRangeOver30m
]
=
"温湿度超限30分钟"
;
MachineLedState
.
Add
(
MachineLedStateE
.
THoutRangeOver30m
,
nls
(
LedState
.
blink
,
LedState
.
blink
,
LedState
.
none
));
MachineLedState
.
Add
(
MachineLedStateE
.
THoutRangeOver30m
,
nls
(
LedState
.
blink
,
LedState
.
blink
,
LedState
.
off
));
//温湿度超限 绿闪黄闪
//温湿度超限 绿闪黄闪
MachineLedStateName
[
MachineLedStateE
.
THoutRange
]
=
"温湿度超限"
;
MachineLedStateName
[
MachineLedStateE
.
THoutRange
]
=
"温湿度超限"
;
MachineLedState
.
Add
(
MachineLedStateE
.
THoutRange
,
nls
(
LedState
.
none
,
LedState
.
blink
,
LedState
.
blink
));
MachineLedState
.
Add
(
MachineLedStateE
.
THoutRange
,
nls
(
LedState
.
blink
,
LedState
.
blink
,
LedState
.
off
));
//进出库, 绿亮,黄闪
//进出库, 绿亮,黄闪
MachineLedStateName
[
MachineLedStateE
.
InOut
]
=
"出入库中"
;
MachineLedStateName
[
MachineLedStateE
.
InOut
]
=
"出入库中"
;
MachineLedState
.
Add
(
MachineLedStateE
.
InOut
,
nls
(
LedState
.
none
,
LedState
.
blink
,
LedState
.
on
));
MachineLedState
.
Add
(
MachineLedStateE
.
InOut
,
nls
(
LedState
.
none
,
LedState
.
blink
,
LedState
.
on
));
...
...
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
738ee32
...
@@ -29,7 +29,14 @@ namespace DeviceLibrary
...
@@ -29,7 +29,14 @@ namespace DeviceLibrary
static
string
baseDir
=
Application
.
StartupPath
;
static
string
baseDir
=
Application
.
StartupPath
;
static
Thread
mainThread
;
static
Thread
mainThread
;
public
static
List
<
HumitureController
>
humitureControllers
=
new
List
<
HumitureController
>();
public
static
List
<
HumitureController
>
humitureControllers
=
new
List
<
HumitureController
>();
public
static
double
averageHumidity
()
{
return
humitureControllers
.
FindAll
(
s
=>
s
.
LastData
.
Humidity
>
0
).
Average
(
x
=>
x
.
LastData
.
Humidity
);
}
public
static
double
averageTemp
()
{
return
humitureControllers
.
FindAll
(
s
=>
s
.
LastData
.
Temperate
>
0
).
Average
(
x
=>
x
.
LastData
.
Temperate
);
}
public
static
HIKCamera
CameraA
=
new
HIKCamera
();
public
static
HIKCamera
CameraA
=
new
HIKCamera
();
public
static
HIKCamera
CameraB
=
new
HIKCamera
();
public
static
HIKCamera
CameraB
=
new
HIKCamera
();
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论