Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0030a01d
由
几米阳光
编写于
2019-05-05 15:11:22 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
温湿度功能修改,增加温湿度报警显示
1 个父辈
999ff99e
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
150 行增加
和
84 行删除
source/ACSingleStore/FrmStoreBox.cs
source/ACSingleStore/记录.txt
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/ACSingleStore/FrmStoreBox.cs
查看文件 @
0030a01
...
...
@@ -250,6 +250,10 @@ namespace OnlineStore.ACSingleStore
{
lblWarnMsg
.
Text
=
lblWarnMsg
.
Text
+
" 叉子料盘检测有料,请检查"
;
}
if
(
store
.
TempOrHumidityIsAlarm
)
{
lblWarnMsg
.
Text
=
lblWarnMsg
.
Text
+
" 温湿度报警["
+
store
.
TempAlarmTime
.
ToLongTimeString
()
+
"]"
;
}
if
(
store
.
autoNext
)
{
string
msg
=
store
.
autoMsg
;
...
...
source/ACSingleStore/记录.txt
查看文件 @
0030a01
...
...
@@ -70,6 +70,8 @@
增加相机重新加载功能
增加新的温湿度代码。
20190505
温湿度功能修改,增加温湿度报警显示。
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
0030a01
...
...
@@ -35,7 +35,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 轴报警信息
/// </summary>
private
Dictionary
<
string
,
AxisAlarmInfo
>
AxisAlarmCodeMap
=
new
Dictionary
<
string
,
AxisAlarmInfo
>();
private
Dictionary
<
string
,
AxisAlarmInfo
>
AxisAlarmCodeMap
=
new
Dictionary
<
string
,
AxisAlarmInfo
>();
/// <summary>
/// 是否有压紧轴
...
...
@@ -68,8 +68,8 @@ namespace OnlineStore.DeviceLibrary
this
.
Config
=
config
;
this
.
DIList
=
config
.
StoreDIList
;
this
.
DOList
=
config
.
StoreDOList
;
Max_Humidity
=
config
.
Max_Humidity
;
Max_Temperature
=
config
.
Max_Temperature
;
//
Max_Humidity = config.Max_Humidity;
//
Max_Temperature = config.Max_Temperature;
moveAxisList
=
new
List
<
ConfigMoveAxis
>();
MoveAxisConfig
();
List
<
ACStorePosition
>
positionList
=
CSVPositionReader
<
ACStorePosition
>.
getPositionList
();
...
...
@@ -89,7 +89,7 @@ namespace OnlineStore.DeviceLibrary
//初始化摄像机配置
string
nameStr
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
CameraName
);
string
codeStr
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
CodeType
);
CodeManager
.
LoadConfig
(
nameStr
,
codeStr
);
CodeManager
.
LoadConfig
(
nameStr
,
codeStr
);
//初始化 //连接设备
KNDManager
.
ConnectionKND
(
Config
.
DIODeviceNameList
);
...
...
@@ -128,24 +128,24 @@ namespace OnlineStore.DeviceLibrary
}
}
else
{
{
//光栅处理
SafetyLightProcess
();
}
}
}
}
/// <summary>
/// 配置速度,加减速时间
/// </summary>
public
void
MoveAxisConfig
()
{
AC_SA_Config
.
ConfigAxis
(
Config
);
AC_SA_Config
.
ConfigAxis
(
Config
);
moveAxisList
=
new
List
<
ConfigMoveAxis
>();
moveAxisList
.
Add
(
Config
.
Middle_Axis
);
moveAxisList
.
Add
(
Config
.
UpDown_Axis
);
moveAxisList
.
Add
(
Config
.
InOut_Axis
);
this
.
AxisAlarmCodeMap
=
new
Dictionary
<
string
,
AxisAlarmInfo
>();
this
.
AxisAlarmCodeMap
=
new
Dictionary
<
string
,
AxisAlarmInfo
>();
this
.
AxisAlarmCodeMap
.
Add
(
Config
.
UpDown_Axis
.
GetNameStr
(),
new
AxisAlarmInfo
());
this
.
AxisAlarmCodeMap
.
Add
(
Config
.
InOut_Axis
.
GetNameStr
(),
new
AxisAlarmInfo
());
this
.
AxisAlarmCodeMap
.
Add
(
this
.
Config
.
Middle_Axis
.
GetNameStr
(),
new
AxisAlarmInfo
());
...
...
@@ -190,7 +190,7 @@ namespace OnlineStore.DeviceLibrary
storeStatus
=
StoreStatus
.
ResetMove
;
//启动温湿度服务器
HumitureController
.
Init
(
Config
.
Humiture_Port
);
ReturnHome
();
StartTime
=
DateTime
.
Now
;
mainTimer
.
Enabled
=
true
;
...
...
@@ -213,7 +213,7 @@ namespace OnlineStore.DeviceLibrary
}
}
#
region
原点返回和复位处理
private
void
ReturnHome
()
{
...
...
@@ -255,7 +255,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove
.
NewMove
(
StoreMoveType
.
StoreReset
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_M_H_TOP1_InOutToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态,进出轴到P1,判断叉子没有料盘"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
ComBeforeHomeMove
();
//判断叉子没有料盘
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.LOW));
...
...
@@ -273,16 +273,16 @@ namespace OnlineStore.DeviceLibrary
CurrInOutCount
=
0
;
CurrInOutACount
=
0
;
KNDIOMove
(
IO_Type
.
Alarm_HddLed
,
IO_VALUE
.
LOW
);
KNDIOMove
(
IO_Type
.
AutoRun_HddLed
,
IO_VALUE
.
HIGH
);
KNDIOMove
(
IO_Type
.
RunSign_HddLed
,
IO_VALUE
.
LOW
);
KNDIOMove
(
IO_Type
.
Alarm_HddLed
,
IO_VALUE
.
LOW
);
KNDIOMove
(
IO_Type
.
AutoRun_HddLed
,
IO_VALUE
.
HIGH
);
KNDIOMove
(
IO_Type
.
RunSign_HddLed
,
IO_VALUE
.
LOW
);
//复位之前先停止运行
if
(
isNeedClearAuto
)
{
autoNext
=
false
;
}
ACServerManager
.
SuddenStop
(
Config
.
Middle_Axis
.
DeviceName
,
Config
.
Middle_Axis
.
GetAxisValue
());
ACServerManager
.
SuddenStop
(
Config
.
UpDown_Axis
.
DeviceName
,
Config
.
UpDown_Axis
.
GetAxisValue
());
ACServerManager
.
SuddenStop
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
());
...
...
@@ -294,7 +294,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove
.
NewMove
(
StoreMoveType
.
StoreReset
);
WarnMsg
=
""
;
if
(!
RunAxis
(
true
))
if
(!
RunAxis
(
true
))
////打开四个轴
//if (!OpenAllAxis())
{
...
...
@@ -303,9 +303,9 @@ namespace OnlineStore.DeviceLibrary
}
if
(
IsHasCompress_Axis
||
Config
.
IsHasLocationCylinder
.
Equals
(
0
))
{
InoutStartReset
();
InoutStartReset
();
//硕科压紧轴回原点
SetShuokeSpeed
();
SetShuokeSpeed
();
}
else
{
...
...
@@ -313,7 +313,7 @@ namespace OnlineStore.DeviceLibrary
// 复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_LocationCylinderBack
);
LocationDownAndWait
();
}
}
isInPro
=
false
;
}
private
void
InoutStartReset
()
...
...
@@ -370,7 +370,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_InOutToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"复位中:进出轴到待机点P1,关闭舱门"
);
//进出轴原点返回完成,将进出轴的位置设置=0
AxisCountClear
(
Config
.
InOut_Axis
);
AxisCountClear
(
Config
.
InOut_Axis
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
ComBeforeHomeMove
();
//判断叉子没有料盘
...
...
@@ -396,7 +396,7 @@ namespace OnlineStore.DeviceLibrary
ACAxisHomeMove
(
Config
.
UpDown_Axis
);
break
;
case
StoreMoveStep
.
BOX_H_OtherAxisBack
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_MiddleAxisToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"复位中:旋转轴运动到P1,上下轴走到P1,压紧轴到P1!"
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_P1_Position
,
Config
.
MiddleAxis_P1_Speed
);
...
...
@@ -430,7 +430,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
LOGGER
,
StoreName
+
"复位中:旋转轴运动到P1,上下轴走到P1,压紧轴到P1!"
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_P1_Position
,
Config
.
MiddleAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_DoorOPosition_P1
,
Config
.
UpDownAxis_P1_Speed
);
ComMoveToPosition
(
Config
.
CompressAxis_P1_Position
);
ComMoveToPosition
(
Config
.
CompressAxis_P1_Position
);
break
;
case
StoreMoveStep
.
BOX_M_H_TOP1_OtherAxisToP1
:
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态完成"
);
...
...
@@ -442,7 +442,7 @@ namespace OnlineStore.DeviceLibrary
WarnMsg
=
""
;
}
break
;
default
:
break
;
}
}
...
...
@@ -519,7 +519,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_InOutToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"原点返回中,进出轴退回P1点,关闭仓门,检测叉子没有料盘"
);
//进出轴原点返回完成,将进出轴的位置设置=0
AxisCountClear
(
Config
.
InOut_Axis
);
AxisCountClear
(
Config
.
InOut_Axis
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
ComBeforeHomeMove
();
//判断叉子没有料盘
...
...
@@ -547,7 +547,7 @@ namespace OnlineStore.DeviceLibrary
ACAxisHomeMove
(
Config
.
UpDown_Axis
);
break
;
case
StoreMoveStep
.
BOX_H_OtherAxisBack
:
case
StoreMoveStep
.
BOX_H_OtherAxisBack
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_MiddleAxisToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"回原点:旋转轴运动到P1,上下轴到P1,压紧轴到P1!"
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_P1_Position
,
Config
.
MiddleAxis_P1_Speed
);
...
...
@@ -586,7 +586,7 @@ namespace OnlineStore.DeviceLibrary
}
ACServerManager
.
AlarmClear
(
portName
,
slvAddr
);
Thread
.
Sleep
(
50
);
ACServerManager
.
ServoOn
(
portName
,
slvAddr
);
ACServerManager
.
ServoOn
(
portName
,
slvAddr
);
}
Thread
.
Sleep
(
1000
);
//打开所有轴
...
...
@@ -606,10 +606,10 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
/// <returns></returns>
private
bool
OpenAllAxis
()
{
{
//判断轴是否正常
foreach
(
ConfigMoveAxis
axis
in
moveAxisList
)
{
{
if
(
ACServerManager
.
ServerOnStatus
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"成功打开轴:"
+
axis
.
Explain
);
...
...
@@ -620,7 +620,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
LOGGER
,
StoreName
+
"第一次打开轴"
+
axis
.
Explain
+
"失败,先清理一下报警,再重新打开一次"
);
ACServerManager
.
AlarmClear
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
System
.
Threading
.
Thread
.
Sleep
(
1200
);
ACServerManager
.
ServoOn
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
ACServerManager
.
ServoOn
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
System
.
Threading
.
Thread
.
Sleep
(
100
);
if
(
ACServerManager
.
ServerOnStatus
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
{
...
...
@@ -642,7 +642,7 @@ namespace OnlineStore.DeviceLibrary
public
void
CloseAllAxis
()
{
LogUtil
.
info
(
StoreName
+
"关闭刹车,关闭伺服"
);
LogUtil
.
info
(
StoreName
+
"关闭刹车,关闭伺服"
);
KNDIOMove
(
IO_Type
.
Axis_Brake
,
IO_VALUE
.
LOW
);
foreach
(
ConfigMoveAxis
axis
in
moveAxisList
)
{
...
...
@@ -653,7 +653,7 @@ namespace OnlineStore.DeviceLibrary
Thread
.
Sleep
(
100
);
KNDIOMove
(
IO_Type
.
Run_Signal
,
IO_VALUE
.
LOW
);
}
private
int
GetAlarmCodeByAxis
(
ConfigMoveAxis
axis
)
{
int
alarmCode
=
LineAlarm
.
InOutAxisAlarm
;
...
...
@@ -689,7 +689,7 @@ namespace OnlineStore.DeviceLibrary
StopMove
(
true
);
storeRunStatus
=
StoreRunStatus
.
Wait
;
mainTimer
.
Enabled
=
false
;
mainTimer
.
Enabled
=
false
;
TimeSpan
span
=
DateTime
.
Now
-
StartTime
;
IsRun
=
false
;
...
...
@@ -697,7 +697,7 @@ namespace OnlineStore.DeviceLibrary
if
(
IsHasCompress_Axis
)
{
ShuoKeControls
.
ClosePort
();
}
}
LogUtil
.
info
(
LOGGER
,
StoreName
+
",停止运行,总运行时间:"
+
span
.
ToString
());
}
...
...
@@ -712,13 +712,13 @@ namespace OnlineStore.DeviceLibrary
return
;
}
LogUtil
.
error
(
LOGGER
,
StoreName
+
" 报警,报警类型:"
+
alarmType
);
this
.
alarmType
=
alarmType
;
if
(
alarmType
.
Equals
(
StoreAlarmType
.
AxisAlarm
)
|
alarmType
.
Equals
(
StoreAlarmType
.
AxisMoveError
))
{
LogUtil
.
error
(
LOGGER
,
StoreName
+
"轴报警,关闭刹车,停止运动,关闭轴,打开报警灯"
);
KNDIOMove
(
IO_Type
.
Axis_Brake
,
IO_VALUE
.
LOW
);
StopMove
(
true
);
StopMove
(
true
);
}
else
if
(
alarmType
==
StoreAlarmType
.
SuddenStop
)
{
...
...
@@ -726,7 +726,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
LOGGER
,
StoreName
+
"收到急停信号,关闭刹车,停止运动,关闭轴,打开报警灯 "
);
KNDIOMove
(
IO_Type
.
Axis_Brake
,
IO_VALUE
.
LOW
);
StoreMove
.
EndMove
();
StopMove
(
true
);
StopMove
(
true
);
storeStatus
=
StoreStatus
.
SuddenStop
;
}
else
if
(
alarmType
.
Equals
(
StoreAlarmType
.
NoAirCheck
))
...
...
@@ -734,8 +734,8 @@ namespace OnlineStore.DeviceLibrary
isNoAirCheck
=
true
;
LogUtil
.
error
(
LOGGER
,
StoreName
+
" 未检测到气压信号 ,打开刹车,停止运动,关闭轴,打开报警灯 "
);
KNDIOMove
(
IO_Type
.
Axis_Brake
,
IO_VALUE
.
LOW
);
StoreMove
.
EndMove
();
StopMove
(
true
);
StoreMove
.
EndMove
();
StopMove
(
true
);
storeStatus
=
StoreStatus
.
SuddenStop
;
}
//if (alarmType != StoreAlarmType.IoSingleTimeOut)
...
...
@@ -768,11 +768,11 @@ namespace OnlineStore.DeviceLibrary
//preProcessTime = DateTime.Now;
stopwatch
.
Restart
();
IoCheckProcess
();
ShowTimeLog
(
"IoCheckProcess"
);
TimerProcess
();
ShowTimeLog
(
"IoCheckProcess"
);
TimerProcess
();
ShowTimeLog
(
"TimerProcess"
);
//检查运动轴报警
if
(
storeRunStatus
>
StoreRunStatus
.
Wait
&&
(!
isInSuddenDown
)
&&
(!
isNoAirCheck
))
if
(
storeRunStatus
>
StoreRunStatus
.
Wait
&&
(!
isInSuddenDown
)
&&
(!
isNoAirCheck
))
{
ShowTimeLog
(
"开始检测轴报警"
);
CheckAxisAlarm
();
...
...
@@ -937,7 +937,7 @@ namespace OnlineStore.DeviceLibrary
{
//取新的Io状态
IO_VALUE
autoSingle
=
KNDIOValue
(
IO_Type
.
AutoRun_Signal
);
if
(
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
App_AutoRun
)
.
Equals
(
1
))
if
(
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
App_AutoRun
)
.
Equals
(
1
))
{
if
(
autoSingle
.
Equals
(
IO_VALUE
.
HIGH
)
&&
lastAutoRun
.
Equals
(
IO_VALUE
.
LOW
))
{
...
...
@@ -946,8 +946,8 @@ namespace OnlineStore.DeviceLibrary
bool
result
=
StartRun
();
if
(
result
.
Equals
(
false
))
{
LogUtil
.
error
(
"料仓启动失败,继续等待下次启动!"
);
mainTimer
.
Enabled
=
true
;
LogUtil
.
error
(
"料仓启动失败,继续等待下次启动!"
);
mainTimer
.
Enabled
=
true
;
}
}
lastAutoRun
=
autoSingle
;
...
...
@@ -988,7 +988,7 @@ namespace OnlineStore.DeviceLibrary
//判断已经在复位中并且没有报警,不需要重新复位
if
(
StoreMove
.
MoveType
.
Equals
(
StoreMoveType
.
StoreReset
)
&&
alarmType
.
Equals
(
StoreAlarmType
.
None
))
{
LogUtil
.
error
(
LOGGER
,
"收到复位信号:已经在复位中且没有报警,不需要重新复位!"
);
LogUtil
.
error
(
LOGGER
,
"收到复位信号:已经在复位中且没有报警,不需要重新复位!"
);
}
else
{
...
...
@@ -1011,14 +1011,14 @@ namespace OnlineStore.DeviceLibrary
//}
}
private
object
safetyInProcess
=
""
;
private
object
safetyInProcess
=
""
;
/// <summary>
/// 光栅处理
/// </summary>
private
void
SafetyLightProcess
()
{
if
(
Monitor
.
TryEnter
(
safetyInProcess
))
{
{
try
{
//遮挡光栅信号
...
...
@@ -1065,7 +1065,7 @@ namespace OnlineStore.DeviceLibrary
{
Monitor
.
Exit
(
safetyInProcess
);
}
}
}
}
public
void
TimerProcess
()
{
...
...
@@ -1074,7 +1074,7 @@ namespace OnlineStore.DeviceLibrary
DateTime
time
=
DateTime
.
Now
;
if
(
StoreMove
.
MoveType
!=
StoreMoveType
.
None
)
{
BusyMoveProcess
();
BusyMoveProcess
();
ShowTimeLog
(
"BusyMoveProcess"
);
}
else
if
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
))
...
...
@@ -1099,8 +1099,8 @@ namespace OnlineStore.DeviceLibrary
{
isWaitScan
=
false
;
IsScanCode
=
true
;
LogUtil
.
info
(
StoreName
+
"检测到"
+
height
+
"寸料盘,开始扫码"
);
LogUtil
.
info
(
StoreName
+
"检测到"
+
height
+
"寸料盘,开始扫码"
);
GetCameraCode
();
}
}
...
...
@@ -1115,14 +1115,14 @@ namespace OnlineStore.DeviceLibrary
isWaitScan
=
false
;
}
}
ShowTimeLog
(
"判断是否需要出入库"
);
AutoResetProcess
();
ShowTimeLog
(
"AutoResetProcess"
);
IOTimeOutProcess
();
ShowTimeLog
(
"IOTimeOutProcess"
);
}
}
}
catch
(
Exception
ex
)
{
...
...
@@ -1236,7 +1236,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
LOGGER
,
"处理出入库排队列表出错:"
+
ex
.
ToString
());
}
}
/// <summary>
/// 判断是否报警,返回 true表示报警 报警检测2秒钟检测一次
/// </summary>
...
...
@@ -1300,7 +1300,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 停止所有运行
/// </summary>
public
override
void
StopMove
(
bool
IsCloseAxis
)
public
override
void
StopMove
(
bool
IsCloseAxis
)
{
KNDIOMove
(
IO_Type
.
Axis_Brake
,
IO_VALUE
.
LOW
);
...
...
@@ -1314,7 +1314,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if
(
Config
.
IsHasLocationCylinder
>=
1
)
if
(
Config
.
IsHasLocationCylinder
>=
1
)
{
//定位气缸停止
KNDIOMove
(
IO_Type
.
LocationCylinder_Down
,
IO_VALUE
.
LOW
);
...
...
@@ -1328,7 +1328,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
LOGGER
,
StoreName
+
"StopMove"
);
KNDIOMove
(
IO_Type
.
Door_Down
,
IO_VALUE
.
LOW
);
KNDIOMove
(
IO_Type
.
Door_Up
,
IO_VALUE
.
LOW
);
isInPro
=
false
;
}
...
...
@@ -1380,7 +1380,7 @@ namespace OnlineStore.DeviceLibrary
IsScanCode
=
false
;
return
;
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil
.
info
(
LOGGER
,
StoreName
+
"收到二维码【 "
+
message
+
"】,发送给服务器获取入库PosID"
);
//发送扫码内容到服务器进行入库操作
Operation
operation
=
getLineBoxStatus
();
...
...
@@ -1390,7 +1390,7 @@ namespace OnlineStore.DeviceLibrary
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
operation
,
false
);
if
(
resultOperation
==
null
)
{
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogUtil
.
info
(
LOGGER
,
StoreName
+
"二维码【"
+
message
+
"】没有收到服务器反馈!"
);
IsScanCode
=
false
;
return
;
...
...
@@ -1508,7 +1508,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
"盘尺寸错误,清理二维码【"
+
message
+
"】"
);
message
=
""
;
}
KNDIOMove
(
IO_Type
.
CameraLight_Power
,
IO_VALUE
.
LOW
);
KNDIOMove
(
IO_Type
.
CameraLight_Power
,
IO_VALUE
.
LOW
);
onCodeReceived
(
message
);
}
...
...
@@ -1561,7 +1561,7 @@ namespace OnlineStore.DeviceLibrary
{
return
result
;
}
double
ai1Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI1_Addr
),
Config
.
AIDI1_DefaultPosition
);
double
ai2Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI2_Addr
),
Config
.
AIDI2_DefaultPosition
);
double
Value
=
Math
.
Round
((
ai1Value
+
ai2Value
)
/
2
,
1
);
...
...
@@ -1627,8 +1627,8 @@ namespace OnlineStore.DeviceLibrary
return
result
;
}
double
ai1Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI3_Addr
),
Config
.
AIDI3_DefaultPosition
);
double
ai2Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI4_Addr
),
Config
.
AIDI4_DefaultPosition
);
double
Value
=
Math
.
Round
((
ai1Value
+
ai2Value
)
/
2
,
1
);
double
ai2Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI4_Addr
),
Config
.
AIDI4_DefaultPosition
);
double
Value
=
Math
.
Round
((
ai1Value
+
ai2Value
)
/
2
,
1
);
if
(
Value
>
14
)
{
result
=
16
;
...
...
@@ -1639,7 +1639,7 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
Value
>=
4
)
{
if
(
ai1Value
>=
9
||
ai2Value
>=
9
)
if
(
ai1Value
>=
9
||
ai2Value
>=
9
)
{
result
=
12
;
}
...
...
@@ -1653,7 +1653,7 @@ namespace OnlineStore.DeviceLibrary
result
=
0
;
}
return
result
;
return
result
;
}
#
endregion
...
...
@@ -1672,8 +1672,8 @@ namespace OnlineStore.DeviceLibrary
private
DateTime
LastEndBlowTime
=
new
DateTime
(
1997
,
1
,
1
);
private
DateTime
preLogTime
=
DateTime
.
Now
;
p
rivate
bool
TempOrHumidityIsAlarm
=
false
;
p
rivate
DateTime
TempAlarmTime
=
DateTime
.
Now
;
p
ublic
bool
TempOrHumidityIsAlarm
=
false
;
p
ublic
DateTime
TempAlarmTime
=
DateTime
.
Now
;
private
float
StartBlowValue
=
(
float
)
ConfigAppSettings
.
GetNumValue
(
Setting_Init
.
StartBlowValue
);
private
float
StopBlowValue
=
(
float
)
ConfigAppSettings
.
GetNumValue
(
Setting_Init
.
StopBlowValue
);
...
...
@@ -1695,7 +1695,7 @@ namespace OnlineStore.DeviceLibrary
{
humidity
=
param
.
Humidity
;
temp
=
param
.
Temperate
;
currTempStr
=(
"当前湿度:"
+
humidity
.
ToString
()+
",当前温度:"
+
temp
);
currTempStr
=
(
"当前湿度:"
+
humidity
.
ToString
()
+
",当前温度:"
+
temp
);
}
//double currMaxHumidity = HumitureServer.GetMaxHumidity(Config.GetTempAddrList());
double
currMaxHumidity
=
param
.
Humidity
;
...
...
@@ -1723,7 +1723,6 @@ namespace OnlineStore.DeviceLibrary
{
LOGGER
.
Info
(
"当前最大湿度:"
+
currMaxHumidity
.
ToString
()
+
",停止吹气湿度:"
+
stopBlowHumidity
+
",停止吹气!"
);
IsInBlowing
=
false
;
//Thread.Sleep(100);
KNDIOMove
(
IO_Type
.
StartOrStopBlow
,
IO_VALUE
.
LOW
);
LastEndBlowTime
=
DateTime
.
Now
;
}
...
...
@@ -1740,24 +1739,16 @@ namespace OnlineStore.DeviceLibrary
LastEndBlowTime
=
DateTime
.
Now
;
}
}
bool
needAlarm
=
false
;
//如果开始吹气并且当前达到报警值
if
(
IsInBlowing
.
Equals
(
true
)
&&
humidity
>
Max_Humidity
)
{
TempAlarmTime
=
DateTime
.
Now
;
TempOrHumidityIsAlarm
=
true
;
}
else
if
(
IsInBlowing
&&
humidity
>
Max_Humidity
)
{
TempOrHumidityIsAlarm
=
fals
e
;
needAlarm
=
tru
e
;
}
//如果湿度没有报警,温度达到范围也需要报警
if
(
temp
>
Max_Temperature
&&
Max_Temperature
>
0
)
else
if
(
temp
>
Max_Temperature
&&
Max_Temperature
>
0
)
{
LOGGER
.
Info
(
"当前温度【"
+
param
.
Temperate
+
"】超过最高温度【"
+
Max_Temperature
+
"】,开始报警!"
);
TempAlarmTime
=
DateTime
.
Now
;
TempOrHumidityIsAlarm
=
true
;
needAlarm
=
true
;
//Thread.Sleep(100);
KNDIOMove
(
IO_Type
.
StartOrStopBlow
,
IO_VALUE
.
LOW
);
}
...
...
@@ -1771,6 +1762,14 @@ namespace OnlineStore.DeviceLibrary
KNDIOMove
(
IO_Type
.
StartOrStopBlow
,
IO_VALUE
.
LOW
);
}
}
else
{
TempOrHumidityIsAlarm
=
false
;
}
if
(
needAlarm
)
{
HTAlarm
();
}
}
}
catch
(
Exception
ex
)
...
...
@@ -1778,7 +1777,17 @@ namespace OnlineStore.DeviceLibrary
LOGGER
.
Error
(
StoreName
+
"HumidityProcess出错:"
+
ex
.
ToString
());
}
}
private
void
HTAlarm
()
{
if
(
TempOrHumidityIsAlarm
)
{
return
;
}
TempAlarmTime
=
DateTime
.
Now
;
TempOrHumidityIsAlarm
=
true
;
}
#
endregion
#
region
与服务器通信定时器,每
1
秒向服务器通知一次状态
,
同时执行出库操作
private
string
CodeMsg
=
""
;
...
...
@@ -1790,7 +1799,7 @@ namespace OnlineStore.DeviceLibrary
return
;
}
//HumitureServer.RandomData(Config.GetTempAddrList());
isInProcess
=
true
;
if
(
StoreManager
.
IsConnectServer
)
{
...
...
@@ -1903,7 +1912,12 @@ namespace OnlineStore.DeviceLibrary
DateTime
time
=
DateTime
.
Now
;
//构建发送给服务器的对象
Operation
lineOperation
=
getLineBoxStatus
();
//如果还没湿度范围,先获取
if
(
Max_Humidity
<=
0
||
(
Max_Temperature
<=
0
))
{
lineOperation
.
op
=
5
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"没有湿度预警范围,需要从服务器获取,发送OP="
+
lineOperation
.
op
);
}
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
lineOperation
,
false
);
//发送状态信息到服务器
...
...
@@ -1912,7 +1926,53 @@ namespace OnlineStore.DeviceLibrary
//判断服务端是否返回出库操作
return
;
}
//发送状态信息到服务器
if
(
resultOperation
==
null
||
(
resultOperation
.
op
<=
0
))
{
//判断服务端是否返回出库操作
return
;
}
if
(
resultOperation
.
op
.
Equals
(
2
))
{
ReviceOutStoreProcess
(
resultOperation
);
}
else
if
(
resultOperation
.
op
.
Equals
(
5
))
{
ProcessHumidityCMD
(
resultOperation
);
}
else
{
LogUtil
.
error
(
"收到服务器命令:op="
+
resultOperation
.
op
+
",未找到对应处理"
);
}
TimeSpan
span
=
DateTime
.
Now
-
time
;
if
(
span
.
TotalMilliseconds
>
10
)
{
LogUtil
.
info
(
StoreName
+
"执行TimerProcess 共处理了【"
+
span
.
TotalMilliseconds
+
"】毫秒"
);
}
}
private
void
ProcessHumidityCMD
(
Operation
resultOperation
)
{
Dictionary
<
string
,
string
>
data
=
resultOperation
.
data
;
if
(
data
!=
null
&&
data
.
ContainsKey
(
ParamDefine
.
maxHumidity
)
&&
data
.
ContainsKey
(
ParamDefine
.
maxTemperature
))
{
string
maxHumidity
=
data
[
ParamDefine
.
maxHumidity
];
string
maxTemp
=
data
[
ParamDefine
.
maxTemperature
];
LogUtil
.
info
(
LOGGER
,
"收到服务器温湿度预警值:maxHumidity="
+
maxHumidity
+
",maxTemperature="
+
maxTemp
);
try
{
this
.
Max_Humidity
=
(
float
)
Convert
.
ToDouble
(
maxHumidity
);
this
.
Max_Temperature
=
(
float
)
Convert
.
ToDouble
(
maxTemp
);
LogUtil
.
info
(
LOGGER
,
"保存温湿度预警值:Max_Humidity="
+
Max_Humidity
+
",Max_Temperature="
+
Max_Temperature
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"转换温湿度失败:"
+
ex
.
ToString
());
}
}
}
private
void
ReviceOutStoreProcess
(
Operation
resultOperation
)
{
DateTime
time
=
DateTime
.
Now
;
Dictionary
<
string
,
string
>
data
=
resultOperation
.
data
;
if
(
data
!=
null
&&
data
.
ContainsKey
(
ParamDefine
.
posId
)
&&
data
.
ContainsKey
(
ParamDefine
.
plateH
)
&&
data
.
ContainsKey
(
ParamDefine
.
plateW
))
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论