Commit a2cde732 LN

bug修改

1 个父辈 1b5b1337
...@@ -53,6 +53,9 @@ namespace OnlineStore.DUOStore ...@@ -53,6 +53,9 @@ namespace OnlineStore.DUOStore
[STAThread] [STAThread]
static void Main(string[] Args) static void Main(string[] Args)
{ {
//string path = @"http://localhost:4090/rest/api/v1/station/status";
//HttpHelper.PostOperation(path, new Operation());
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
......
...@@ -276,6 +276,7 @@ namespace OnlineStore.DUOStore ...@@ -276,6 +276,7 @@ namespace OnlineStore.DUOStore
private List<int> PositionList = new List<int>(); private List<int> PositionList = new List<int>();
private IO_VALUE LastValue = IO_VALUE.LOW; private IO_VALUE LastValue = IO_VALUE.LOW;
private DateTime LastGetPTime = DateTime.Now; private DateTime LastGetPTime = DateTime.Now;
private object timerLock = "";
private void ToolTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void ToolTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
TimeSpan span = DateTime.Now - LastTime; TimeSpan span = DateTime.Now - LastTime;
...@@ -283,46 +284,62 @@ namespace OnlineStore.DUOStore ...@@ -283,46 +284,62 @@ namespace OnlineStore.DUOStore
{ {
return; return;
} }
isInProcesss = true; if (Monitor.TryEnter(timerLock, 2))
try
{ {
int moveS = ACServerManager.GetBusyStatus(PortName, SlvAddr); isInProcesss = true;
if (moveS.Equals(1)) try
{ {
IO_VALUE currValue = GetSingleValue(); int moveS = ACServerManager.GetBusyStatus(PortName, SlvAddr);
TimeSpan checkSpan = DateTime.Now - LastGetPTime; if (moveS.Equals(1))
if (LastValue.Equals(IO_VALUE.LOW) && currValue.Equals(IO_VALUE.HIGH)&&checkSpan.TotalSeconds>2)
{ {
int currPos = ACServerManager.GetActualtPosition(PortName, SlvAddr); IO_VALUE currValue = GetSingleValue();
txtActualPosition.Text = currPos.ToString(); TimeSpan checkSpan = DateTime.Now - LastGetPTime;
PositionList.Add(currPos); if (LastValue.Equals(IO_VALUE.LOW) && currValue.Equals(IO_VALUE.HIGH) && checkSpan.TotalSeconds > 2)
int num = PositionList.Count;
int preValue = 0;
if (PositionList.Count > 1)
{
preValue = PositionList[num - 2];
}
LogUtil.info(LogName + "【"+ num + "】【" + currPos+"】【"+Math.Abs(currPos-preValue)+"】");
if (LogUtil.logBox == null)
{ {
this.richTextBox1.AppendText(LogName + "【" + num + "】【" + currPos + "】【" + Math.Abs(currPos - preValue) + "】"+Environment.NewLine); int currPos = ACServerManager.GetActualtPosition(PortName, SlvAddr);
txtActualPosition.Text = currPos.ToString();
PositionList.Add(currPos);
int num = PositionList.Count;
int preValue = 0;
if (PositionList.Count > 1)
{
preValue = PositionList[num - 2];
}
LogUtil.info(LogName + "【" + num + "】【" + currPos + "】【" + Math.Abs(currPos - preValue) + "】");
if (LogUtil.logBox == null)
{
this.richTextBox1.AppendText(LogName + "【" + num + "】【" + currPos + "】【" + Math.Abs(currPos - preValue) + "】" + Environment.NewLine);
}
LastValue = IO_VALUE.HIGH;
LastGetPTime = DateTime.Now;
} }
LastValue = IO_VALUE.HIGH;
LastGetPTime = DateTime.Now;
}
LastValue = currValue; LastValue = currValue;
}
else if (moveS.Equals(0))
{
StopTimer();
}
else
{
LogUtil.error(LogName + "伺服GetBusyStatus=" + moveS);
}
} }
else catch (Exception ex)
{ {
StopTimer(); LogUtil.error(LogName + "ToolTimer_Elapsed" + ex.ToString());
} }
}catch(Exception ex) finally
{
Monitor.Exit(timerLock);
isInProcesss = false;
}
}
else
{ {
LogUtil.error(LogName+"ToolTimer_Elapsed" + ex.ToString()); LogUtil.debug ("ToolTimer_Elapsed Monitor.TryEnter(timerLock, 2) 失败");
} }
isInProcesss = false;
} }
private void StopTimer() private void StopTimer()
......
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位 类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
AXIS,,L1_旋转轴,Middle_Axis,1,COM1,,250,1000,1000,80,60,50,10,1000,0,0 AXIS,,L1_旋转轴,Middle_Axis,1,COM1,,150,1000,1000,80,60,50,10,1000,0,0
AXIS,,L2_上下轴,UpDown_Axis,2,COM1,,300,400,400,400,400,400,10,1000,0,0 AXIS,,L2_上下轴,UpDown_Axis,2,COM1,,300,400,400,400,400,400,10,1000,0,0
AXIS,,L3_进出轴,InOut_Axis,3,COM1,,100,300,300,20,60,200,10,1000,0,0 AXIS,,L3_进出轴,InOut_Axis,3,COM1,,100,300,300,20,60,200,10,1000,0,0
AXIS,,L4_压紧轴,Comp_Axis,4,COM1,,100,300,300,20,60,200,10,1000,0,0 AXIS,,L4_压紧轴,Comp_Axis,4,COM1,,100,300,300,20,60,200,10,1000,0,0
......
...@@ -392,7 +392,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -392,7 +392,14 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(" 第【" + i + "】次 GetDIValue [" + ioIP + "] [" + StartAddress + "] 出错:" + ex.ToString()); if (i <= 1)
{
LogUtil.debug (" 第【" + i + "】次 GetDIValue [" + ioIP + "] [" + StartAddress + "] 出错:" + ex.ToString());
}
else
{
LogUtil.error(" 第【" + i + "】次 GetDIValue [" + ioIP + "] [" + StartAddress + "] 出错:" + ex.ToString());
}
} }
} }
return value; return value;
......
...@@ -155,7 +155,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -155,7 +155,7 @@ namespace OnlineStore.DeviceLibrary
//位置配置到文件中 //位置配置到文件中
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
string configFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_ConfigPath); string configFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_ConfigPath);
if (!Directory.Exists(configFile)) if (!File.Exists(configFile))
{ {
configFile = configFile.Replace(".csv", "_" + storeConfig.Id + ".csv"); configFile = configFile.Replace(".csv", "_" + storeConfig.Id + ".csv");
} }
......
...@@ -209,19 +209,23 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -209,19 +209,23 @@ namespace OnlineStore.LoadCSVLibrary
if (array.Length > 0 && array[0].ToString().Equals(ConfigItemType.PRO)) if (array.Length > 0 && array[0].ToString().Equals(ConfigItemType.PRO))
{ {
string[] newArray = array; string[] newArray = array;
string proName = array[2]; string proName = array[3];
string proValue = array[3]; string proValue = array[4];
if (proName.ToUpper().Contains(BaseConfig.IOIP_Str.ToUpper()))
{
continue;
}
try try
{ {
PropertyInfo prop = props.First(c => c.Name == proName);//获取同名属性 PropertyInfo prop = props.First(c => c.Name == proName);//获取同名属性
if (prop != null) if (prop != null)
{ {
string newValue = prop.GetValue(newConfig, null).ToString(); string newValue = prop.GetValue(newConfig, null).ToString();
newArray[3] = newValue; newArray[4] = newValue;
} }
} }
catch (Exception e) { catch (Exception e) {
LogUtil.error("出错:" + e.ToString()); LogUtil.error("SaveBoxPosition[" + filePath+ "]出错:" + e.ToString());
} }
string newLine = ""; string newLine = "";
foreach (string s in newArray) foreach (string s in newArray)
......
...@@ -187,14 +187,14 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -187,14 +187,14 @@ namespace OnlineStore.LoadCSVLibrary
LogUtil.error("解析配置【" + con.ConfigStr + "】出错:" + ex.ToString()); LogUtil.error("解析配置【" + con.ConfigStr + "】出错:" + ex.ToString());
} }
} }
if (String.IsNullOrEmpty(proBuilder.ToString()).Equals(false) && proBuilder.ToString().Equals("\r\n").Equals(false)) //if (String.IsNullOrEmpty(proBuilder.ToString()).Equals(false) && proBuilder.ToString().Equals("\r\n").Equals(false))
{ //{
LogUtil.error(proBuilder.ToString()); // LogUtil.error(proBuilder.ToString());
} //}
if (String.IsNullOrEmpty(builder.ToString()).Equals(false) && builder.ToString().Equals("\r\n").Equals(false)) //if (String.IsNullOrEmpty(builder.ToString()).Equals(false) && builder.ToString().Equals("\r\n").Equals(false))
{ //{
LogUtil.error(builder.ToString()); // LogUtil.error(builder.ToString());
} //}
if (checkProList.Count >= 0) if (checkProList.Count >= 0)
{ {
//常规属性检测 //常规属性检测
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!