Commit e1da6358 几米阳光

1

1 个父辈 06f42489
...@@ -32,6 +32,11 @@ ...@@ -32,6 +32,11 @@
<add key ="OutStoreWaitSeconds" value ="600"/> <add key ="OutStoreWaitSeconds" value ="600"/>
20181204
在原来认为高度是8的基础上,再判断三个测高如果有一个高度>=9,则认定为12的料盘。
......
...@@ -34,7 +34,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -34,7 +34,7 @@ namespace OnlineStore.DeviceLibrary
if (timer == null) if (timer == null)
{ {
timer = new System.Timers.Timer(); timer = new System.Timers.Timer();
timer.Interval = 100; timer.Interval = 500;
timer.AutoReset = true; timer.AutoReset = true;
timer.Elapsed += timer_Elapsed; timer.Elapsed += timer_Elapsed;
timer.Enabled = true; timer.Enabled = true;
...@@ -281,6 +281,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -281,6 +281,23 @@ namespace OnlineStore.DeviceLibrary
} }
AIValueMap.Add(ioIp, kndList); AIValueMap.Add(ioIp, kndList);
} }
try
{
//每次上传后验证下
int v1 = (int)GetAIValue(ioIp, 1);
int v2 = (int)GetAIValue(ioIp, 2);
int v3 = (int)GetAIValue(ioIp, 3);
if (v1.Equals(0) && v2.Equals(0) && v3.Equals(0))
{
string value = AcSerialBean.ByteToString(values);
LogUtil.error("收到【" + ioIp + "】的数据【" + value + "】,三个高度都为0,断开重新连接");
ConnectionIP(ioIp);
}
}
catch (Exception ex)
{
LogUtil.error("验证数据出错:" + ex.StackTrace);
}
} }
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -1554,75 +1554,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -1554,75 +1554,21 @@ namespace OnlineStore.DeviceLibrary
} }
else if (Value >= 4) else if (Value >= 4)
{ {
result = 8; if (ai1Value >= 9 || ai2Value >= 9 || ai3Value >= 9)
{
result = 12;
}
else
{
result = 8;
}
} }
else else
{ {
result = 0; result = 0;
} }
return result; return result;
//List<double> list = new List<double>() { ai1Value,ai2Value,ai3Value};
//double pingjValue = (ai3Value + ai2Value + ai1Value) / 3;
//// ,8-11为第0区间,11-14 为第1区间,14-15为第2区间,>=15为第3区间
//List<int> qujianList = new List<int>() {0,0,0,0,0,0 };
//foreach (double d in list)
//{
// if (d < 11)
// {
// qujianList[0]++;
// } else if (d <= 14)
// {
// qujianList[1]++;
// } else if (d <= 15)
// {
// qujianList[2]++;
// } else
// {
// qujianList[3]++;
// }
//}
//if (qujianList[0] >= 2)
//{
// result = 0;
//}
//else if (qujianList[1].Equals(3))
//{
// result = 8;
//}
//else if (qujianList[1] >= 1 && (qujianList[1] + qujianList[2] + qujianList[3] >= 3))
//{
// result = 12;
//}
//else
//{
// if (pingjValue < 10)
// {
// result = 0;
// }
// else if (pingjValue > 18)
// {
// result = 16;
// }
// else
// {
// result = 12;
// }
//}
//return result;
//int radValue =(int) ( Value / 4);
//double mValue = (Value % 4);
//if (mValue > 1)
//{
// result = radValue * 4 + 4;
//}
//else
//{
// result = radValue * 4;
//}
} }
#endregion #endregion
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!