Commit 7b74af66 LN

报警修改

1 个父辈 57fcc6e2
......@@ -18,6 +18,7 @@ using System.IO.Ports;
using OnlineStore.LoadCSVLibrary;
using CodeLibrary;
using UserFromControl;
using System.Diagnostics;
namespace OnlineStore.ACSingleStore
{
......@@ -159,9 +160,41 @@ namespace OnlineStore.ACSingleStore
btnStoreStop.Enabled = isOpen;
}
private DateTime lastLogTime = DateTime.Now;
PerformanceCounter curtime = null;
private void LogM()
{
try
{
TimeSpan sp = DateTime.Now - lastLogTime;
if (sp.TotalMinutes >= 1)
{
lastLogTime = DateTime.Now;
Process process = Process.GetCurrentProcess();
if (curtime == null)
{
curtime = new PerformanceCounter("Process", "% Processor Time", process.ProcessName);
}
if (process != null)
{
StringBuilder sbResult = new StringBuilder();
PerformanceCounter pf1 = new PerformanceCounter("Process", "Working Set - Private", process.ProcessName);
sbResult.AppendFormat(DateTime.Now.ToLongTimeString() + ", 名称:{0} 内存:{1}M ", process.ProcessName, Math.Round(pf1.NextValue() / 1024 / 1024F, 2));
sbResult.AppendFormat(", CPU : {0} %", curtime.NextValue() / Environment.ProcessorCount);
LogUtil.info(sbResult.ToString());
}
}
//ClearMemory();
}
catch (Exception ex)
{
LogUtil.error("LogM Error: "+ex.ToString());
}
}
private void timer1_Tick(object sender, EventArgs e)
{
LogM();
if (!this.Visible)
{
return;
......
......@@ -682,7 +682,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, StoreName + " 报警,报警类型:" + nalarmType);
this.alarmType = nalarmType;
if (nalarmType.Equals(StoreAlarmType.AxisAlarm) | nalarmType.Equals(StoreAlarmType.AxisMoveError))
if (nalarmType.Equals(StoreAlarmType.AxisAlarm) || nalarmType.Equals(StoreAlarmType.AxisMoveError))
{
if (StoreMove.MoveType.Equals(StoreMoveType.InStore) || StoreMove.MoveType.Equals(StoreMoveType.OutStore))
//只有第一次报警才处理库位号
......@@ -707,6 +707,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, StoreName + "轴报警,关闭刹车,停止运动,关闭轴,打开报警灯");
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
StoreMove.EndMove();
StopMove(true);
}
else if (nalarmType == StoreAlarmType.SuddenStop)
......@@ -1410,9 +1411,10 @@ namespace OnlineStore.DeviceLibrary
{
try
{
if ((DateTime.Now - preLogTime).TotalSeconds > 10)
if ((DateTime.Now - preLogTime).TotalSeconds > 3)
{
preLogTime = DateTime.Now;
HumitureController.QueryData();
//用最大的湿度判断是否需要吹气,开始吹气的值=发过来的值-4
//温湿度
//ASTemperateParam param = HumitureServer.GetTemperateParam(Config.GetTempAddrList());
......@@ -1558,7 +1560,6 @@ namespace OnlineStore.DeviceLibrary
}
}
HumitureController.QueryData();
HumidityProcess();
LedProcess();
}catch(Exception ex)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!