Commit 0030a01d 几米阳光

温湿度功能修改,增加温湿度报警显示

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