Commit b3c81d79 LN

1

1 个父辈 3800bd60
...@@ -67,10 +67,29 @@ ...@@ -67,10 +67,29 @@
<conversionPattern value="[%date][%t]%-5p %m%n" /> <conversionPattern value="[%date][%t]%-5p %m%n" />
</layout> </layout>
</appender> </appender>
<root> <appender name="RfidLog" type="log4net.Appender.RollingFileAppender">
<file value="logs/RFID.log"/>
<param name="Encoding" value="UTF-8" />
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="RfidLog">
<level value="Debug" />
<appender-ref ref="RfidLog" />
</logger>
<!--<root>
<level value="Info" /> <level value="Info" />
<appender-ref ref="RollingLogFileAppender" /> <appender-ref ref="RollingLogFileAppender" />
</root> </root>-->
</log4net> </log4net>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
......
...@@ -15,7 +15,7 @@ namespace OnlineStore.Common ...@@ -15,7 +15,7 @@ namespace OnlineStore.Common
private static LogUtil instance = new LogUtil(); private static LogUtil instance = new LogUtil();
public delegate void ShowLog(string msg, Color color); public delegate void ShowLog(string msg, Color color);
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static readonly ILog rfidLog = LogManager.GetLogger("RfidLog");
public static Dictionary<int, DateTime> lastErrorLogTime = new Dictionary<int, DateTime>(); public static Dictionary<int, DateTime> lastErrorLogTime = new Dictionary<int, DateTime>();
public static System.Windows.Forms.RichTextBox logBox = null; public static System.Windows.Forms.RichTextBox logBox = null;
...@@ -74,13 +74,16 @@ namespace OnlineStore.Common ...@@ -74,13 +74,16 @@ namespace OnlineStore.Common
} }
} }
public static void RfidLog(string msg)
{
rfidLog.Debug(msg);
}
public static void error(string errorMsg, int type) public static void error(string errorMsg, int type)
{ {
if (lastErrorLogTime.ContainsKey(type)) if (lastErrorLogTime.ContainsKey(type))
{ {
TimeSpan span = DateTime.Now - lastErrorLogTime[type]; TimeSpan span = DateTime.Now - lastErrorLogTime[type];
if (span.TotalSeconds > 5) if (span.TotalSeconds > 10)
{ {
lastErrorLogTime.Remove(type); lastErrorLogTime.Remove(type);
lastErrorLogTime.Add(type, DateTime.Now); lastErrorLogTime.Add(type, DateTime.Now);
......
...@@ -123,7 +123,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -123,7 +123,7 @@ namespace OnlineStore.DeviceLibrary
} }
private DateTime lastProTimer = DateTime.Now; private DateTime lastProTimer = DateTime.Now;
protected int TimerMaxSeconds = 1; protected int TimerMaxSeconds = 3;
public void TimerProcess() public void TimerProcess()
{ {
...@@ -306,7 +306,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -306,7 +306,7 @@ namespace OnlineStore.DeviceLibrary
#region CheckWait处理 #region CheckWait处理
private DateTime preCheckAxisTime = DateTime.Now;
protected DateTime preRWTime = DateTime.Now; protected DateTime preRWTime = DateTime.Now;
internal void CheckWait(LineMoveInfo moveInfo) internal void CheckWait(LineMoveInfo moveInfo)
{ {
...@@ -334,6 +334,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -334,6 +334,10 @@ namespace OnlineStore.DeviceLibrary
NotOkMsg = wait.ToStr(); NotOkMsg = wait.ToStr();
if (wait.WaitType.Equals(WaitEnum.W001_AxisMove)) if (wait.WaitType.Equals(WaitEnum.W001_AxisMove))
{ {
TimeSpan axisSpan = DateTime.Now - preCheckAxisTime;
if (axisSpan.TotalSeconds > 1)
{
preCheckAxisTime = DateTime.Now;
string msg = ""; string msg = "";
if (wait.IsHomeMove) if (wait.IsHomeMove)
{ {
...@@ -353,6 +357,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -353,6 +357,7 @@ namespace OnlineStore.DeviceLibrary
break; break;
} }
} }
}
else if (wait.WaitType.Equals(WaitEnum.W002_IOValue)) else if (wait.WaitType.Equals(WaitEnum.W002_IOValue))
{ {
NotOkMsg = " (" + baseConfig.GetDisplayName(wait.IoType) + "=" + wait.IoValue + ") "; NotOkMsg = " (" + baseConfig.GetDisplayName(wait.IoType) + "=" + wait.IoValue + ") ";
......
...@@ -299,10 +299,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -299,10 +299,10 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
Task.Factory.StartNew(delegate // Task.Factory.StartNew(delegate
{ //{
bool result = moveEquip.StartRun(); bool result = moveEquip.StartRun();
}); // });
Thread.Sleep(60); Thread.Sleep(60);
} }
...@@ -393,7 +393,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -393,7 +393,7 @@ namespace OnlineStore.DeviceLibrary
mainTimer.Enabled = true; mainTimer.Enabled = true;
return true; return true;
} }
private void EquipReset(EquipBase equip,bool isNeedAllReset) private void EquipReset(EquipBase equip, bool isNeedAllReset)
{ {
//调试状态不再重置 //调试状态不再重置
if (!equip.IsDebug) if (!equip.IsDebug)
...@@ -401,9 +401,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -401,9 +401,9 @@ namespace OnlineStore.DeviceLibrary
if (isNeedAllReset || TrayManager.ErrorDeviceId.Equals(equip.DeviceID) || (!NoAlarm())) if (isNeedAllReset || TrayManager.ErrorDeviceId.Equals(equip.DeviceID) || (!NoAlarm()))
{ {
LogUtil.info(Name + "收到复位信号," + equip.Name + " 需要复位"); LogUtil.info(Name + "收到复位信号," + equip.Name + " 需要复位");
Task.Factory.StartNew(delegate { // Task.Factory.StartNew(delegate {
equip.Reset(); equip.Reset();
}); // });
Thread.Sleep(60); Thread.Sleep(60);
} }
else else
...@@ -425,6 +425,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -425,6 +425,7 @@ namespace OnlineStore.DeviceLibrary
mainTimer.Enabled = false; mainTimer.Enabled = false;
ledProcessTimer.Enabled = false; ledProcessTimer.Enabled = false;
WriteDrivetMotorRun(IO_VALUE.LOW);
//停止运行时,把阻挡气缸上升 //停止运行时,把阻挡气缸上升
StopMove(); StopMove();
runStatus = LineRunStatus.Wait; runStatus = LineRunStatus.Wait;
......
...@@ -68,24 +68,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -68,24 +68,7 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
//internal bool DLineStopOut(int dlineId, int LineNum)
//{
// foreach (DischargeLine line in DisLineMap.Values)
// {
// if ((line.DeviceID % 100).Equals(dlineId))
// {
// if (LineNum.Equals(1) && line.MoveInfo.MoveType.Equals(LineMoveType.OutStore))
// {
// line.MoveInfo.EndMove();
// }
// else if (LineNum.Equals(2) && line.SecondMoveInfo.MoveType.Equals(LineMoveType.OutStore))
// {
// line.SecondMoveInfo.EndMove();
// }
// }
// }
// return false;
//}
private bool isInprocess = false; private bool isInprocess = false;
private DateTime lastProTime = DateTime.Now; private DateTime lastProTime = DateTime.Now;
private void InOutTimerProcess() private void InOutTimerProcess()
......
...@@ -125,7 +125,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -125,7 +125,13 @@ namespace OnlineStore.DeviceLibrary
public static void Close() public static void Close()
{ {
try
{
RfidReader.Close(); RfidReader.Close();
}catch(Exception ex)
{
LogUtil.error("关闭RFID出错:" + ex.ToString());
}
} }
} }
public class RFIDData public class RFIDData
......
...@@ -393,7 +393,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -393,7 +393,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return GetActualtPosition(axis.DeviceName, axis.GetAxisValue()); return GetActualtPosition(axis.DeviceName, axis.GetAxisValue());
} }
public static int GetActualtPosition(string portName, int slvAddr) public static int GetActualtPosition(string portName, int slvAddr,int rGetCount=2)
{ {
PreReadAddr = ACCMDManager.ActualPosition; PreReadAddr = ACCMDManager.ActualPosition;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadRegisters, ACCMDManager.ActualPosition, "0000", 2); byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadRegisters, ACCMDManager.ActualPosition, "0000", 2);
...@@ -401,7 +401,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -401,7 +401,7 @@ namespace OnlineStore.DeviceLibrary
byte[] reviceData = SendCommand(portName, dataArray, ReviceOutTimeMS, 9); byte[] reviceData = SendCommand(portName, dataArray, ReviceOutTimeMS, 9);
int result = -1; int result = -1;
for (int i = 1; i <= 3; i++) for (int i = 1; i <= rGetCount; i++)
{ {
result = GetRegisterData(portName, reviceData, ACCMDManager.ActualPosition); result = GetRegisterData(portName, reviceData, ACCMDManager.ActualPosition);
if (!result.Equals(-1)) if (!result.Equals(-1))
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!