Commit f379d31e LN

bug修改

1 个父辈 c5c3c74a
......@@ -6,6 +6,7 @@ using log4net;
using System.Reflection;
using System.Drawing;
using System.Runtime.ExceptionServices;
using System.Threading;
namespace OnlineStore.Common
{
......@@ -102,15 +103,27 @@ namespace OnlineStore.Common
}
AddToBox(errorMsg, Color.Red);
}
private static object lockObj = "";
private static void AddToBox(string msg, Color color)
{
try
if (Monitor.TryEnter(lockObj, 2))
{
ShowLogPro(msg, color);
try
{
ShowLogPro(msg, color);
}
catch (Exception ex)
{
LOGGER.Error("出错:", ex);
}
finally
{
Monitor.Exit(lockObj);
}
}
catch (Exception ex)
else
{
LOGGER.Error("出错:",ex);
LOGGER.Error ("ShowLogPro【" + msg + "】失败,未得到锁");
}
}
private static List<string> logList = new List<string>();
......@@ -119,11 +132,7 @@ namespace OnlineStore.Common
private static void ShowLogPro(string msg, Color color)
{
try
{
if (logList.Count > 0)
{
// logList.RemoveAt(0);
}
{
if (logList.Count >= showCount)
{
logList.RemoveAt(0);
......
......@@ -182,22 +182,23 @@ namespace OnlineStore.DeviceLibrary
{
TimeSpan span = DateTime.Now - MoveInfo.LastSetpTime;
MoveInfo.NextMoveStep(LineMoveStep.DON_08_CRun);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
IOMove(IO_Type.SeparateDevice_Run, IO_VALUE.HIGH);
if (IOValue(IO_Type.SeparateDevice_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
SeparateStopTime = DateTime.Now.AddSeconds(30);
int robotIndex = GetRobotIndex();
LogUtil.info(hengyiName + MoveInfo.SLog + "送料,接驳台有料,调用arriveRobotLocation=" + robotIndex + "[" + StationInfo_Move.CodeStr + "]");
SServerManager.arriveRobotLocation(Name, robotIndex, StationInfo_Move.CodeStr);
string msg = SServerManager.arriveRobotLocation(Name, robotIndex, StationInfo_Move.CodeStr);
MoveEndS();
LogUtil.info(hengyiName + MoveInfo.SLog + "送料结束 ");
LogUtil.info(hengyiName + MoveInfo.SLog + "送料结束 [" + msg + "]");
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.DON_07_SeparateCheck);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.NextMoveStep(LineMoveStep.DON_07_SeparateCheck);
LogUtil.info(hengyiName + MoveInfo.SLog + "送料,未检测到SeparateDevice_Check,再次 等待料盘到达接驳台 ");
MoveInfo.TimeOutSeconds = 40;
MoveInfo.TimeOutSeconds = 40;
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SeparateDevice_Check, IO_VALUE.HIGH));
}
......
......@@ -344,10 +344,13 @@ namespace OnlineStore.DeviceLibrary
public bool CanStart(int totalMS = 1000)
{
TimeSpan span = DateTime.Now - LastEndTime;
if (span.TotalMilliseconds > totalMS)
if (IOManager.IOValue(MoveDO, subType).Equals(IO_VALUE.LOW))
{
return true;
TimeSpan span = DateTime.Now - LastEndTime;
if (span.TotalMilliseconds > totalMS)
{
return true;
}
}
return false;
}
......
......@@ -303,7 +303,7 @@ namespace OnlineStore.DeviceLibrary
{
if (robotIndex <= 0)
{
return msg;
return "robotIndex="+robotIndex;
}
DateTime startTime = DateTime.Now;
Dictionary<string, string> paramMap = new Dictionary<string, string>();
......@@ -315,6 +315,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
msg = deviceName + " " + ex.ToString();
LogUtil.error(deviceName + " " + ex.ToString());
}
return msg;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!