Commit 93747bd6 LN

测高计算修改。 进入IO界面需要一直读取测高值。

1 个父辈 a9caaaa9
......@@ -95,6 +95,7 @@ namespace OnlineStore.ACSingleStore
private void FrmTest_FormClosing(object sender, FormClosingEventArgs e)
{
KNDAIManager.NeedShow = false;
try
{
if (this.timer1.Enabled)
......@@ -155,6 +156,7 @@ namespace OnlineStore.ACSingleStore
private void FrmStoreIOStatus_Load(object sender, EventArgs e)
{
KNDAIManager.NeedShow = true;
}
private void cmbWriteIO_DrawItem(object sender, DrawItemEventArgs e)
......
......@@ -76,7 +76,9 @@ statusBean.addServerData("needInAfterOut",needInAfterOut);
20190606
进入IO界面需要一直读取测高值。
......
......@@ -40,7 +40,7 @@
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>C:\Program Files\MVTec\HALCON-12.0\bin\dotnet35\halcondotnet.dll</HintPath>
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
......
......@@ -116,6 +116,7 @@ namespace OnlineStore.DeviceLibrary
}
private static DateTime PreCheckTime = DateTime.Now;
private static bool isProcess = false;
public static bool NeedShow = false;
private static void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (isProcess)
......@@ -125,14 +126,14 @@ namespace OnlineStore.DeviceLibrary
try
{
isProcess = true;
bool IsNeedReadAI = StoreManager.Store.KNDIOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH);
bool IsNeedReadAI = StoreManager.Store.KNDIOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH) || NeedShow;
TimeSpan span = DateTime.Now - PreCheckTime;
List<string> list = new List<string>(mastMap.Keys);
foreach (string IP in list)
{
//判断是否连接,如果没有连接自动重连
AITcpClient clinet = mastMap[IP];
if (!IsNeedReadAI)
if (!IsNeedReadAI )
{
ClearAIData(IP);
continue;
......
using HalconDotNet;

using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
......@@ -1603,11 +1603,22 @@ namespace OnlineStore.DeviceLibrary
{
return result;
}
double ai1Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, Config.AIDI1_Addr), Config.AIDI1_DefaultPosition);
double ai2Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, Config.AIDI2_Addr), Config.AIDI2_DefaultPosition);
double Value = Math.Round((ai1Value + ai2Value) / 2, 1);
if (Value > 14)
if (Value > 18)
{
if ((Value % 4).Equals(0))
{
result = (int)Value;
}
else
{
result = ((int)Value / 4 * 4) + 4;
}
}
else if (Value > 14)
{
result = 16;
}
......@@ -1669,9 +1680,20 @@ namespace OnlineStore.DeviceLibrary
return result;
}
double ai1Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, Config.AIDI3_Addr), Config.AIDI3_DefaultPosition);
double ai2Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, Config.AIDI4_Addr), Config.AIDI4_DefaultPosition);
double Value = Math.Round((ai1Value + ai2Value ) / 2, 1);
if (Value > 14)
double ai2Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, Config.AIDI4_Addr), Config.AIDI4_DefaultPosition);
double Value = Math.Round((ai1Value + ai2Value) / 2, 1);
if (Value > 18)
{
if ((Value % 4).Equals(0))
{
result = (int)Value;
}
else
{
result = ((int)Value / 4 * 4) + 4;
}
}
else if (Value > 14)
{
result = 16;
}
......@@ -1681,7 +1703,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (Value >= 4)
{
if (ai1Value >= 9 || ai2Value >= 9 )
if (ai1Value >= 9 || ai2Value >= 9)
{
result = 12;
}
......@@ -1695,7 +1717,7 @@ namespace OnlineStore.DeviceLibrary
result = 0;
}
return result;
return result;
}
#endregion
......@@ -1850,7 +1872,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LOGGER.Error("定时给服务器发送消息出错:", ex);
LOGGER.Error("定时给服务器发送消息出错:"+ ex.ToString());
}
}
HumitureController.QueryData();
......@@ -1964,30 +1986,15 @@ namespace OnlineStore.DeviceLibrary
}
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), lineOperation, false);
//增加报警处理
if (resultOperation.data != null && resultOperation.data.ContainsKey(ParamDefine.inTimeout) && resultOperation.data[ParamDefine.inTimeout].ToLower().Equals("alarm"))
{
WarnMsg = "盘点入库超时报警";
LogUtil.error(LOGGER, "收到服务器端报警:盘点入库超时报警", 1000);
Alarm(StoreAlarmType.CheckInStoreTimeOut, StoreAlarmType.CheckInStoreTimeOut.ToString(), WarnMsg, StoreMoveType.None);
}
else
{
if (alarmType.Equals(StoreAlarmType.CheckInStoreTimeOut))
{
LogUtil.error("之前有报警:盘点入库超时报警,现在已经无报警,清理盘点入库报警");
WarnMsg = "";
alarmType = StoreAlarmType.None;
}
}
//发送状态信息到服务器
if (resultOperation == null )
{
//判断服务端是否返回出库操作
if (resultOperation == null)
{
return;
}
if (resultOperation.data != null)
{
ProcessInStoreTimeOut(resultOperation);
ProcessHumidityCMD(resultOperation);
}
......@@ -2016,6 +2023,35 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(StoreName + "执行TimerProcess 共处理了【" + span.TotalMilliseconds + "】毫秒");
}
}
private void ProcessInStoreTimeOut(Operation resultOperation)
{
try
{
Dictionary<string, string> data = resultOperation.data;
//增加报警处理
if (data != null && data.ContainsKey(ParamDefine.inTimeout) &&( data[ParamDefine.inTimeout].ToLower().Equals("alarm")))
{
WarnMsg = "盘点入库超时报警";
LogUtil.error(LOGGER, "收到服务器端报警:盘点入库超时报警", 1000);
Alarm(StoreAlarmType.CheckInStoreTimeOut, StoreAlarmType.CheckInStoreTimeOut.ToString(), WarnMsg, StoreMoveType.None);
}
else
{
if (alarmType.Equals(StoreAlarmType.CheckInStoreTimeOut))
{
LogUtil.error("之前有报警:盘点入库超时报警,现在已经无报警,清理盘点入库报警");
WarnMsg = "";
alarmType = StoreAlarmType.None;
}
}
}catch(Exception ex)
{
LogUtil.error("ProcessInStoreTimeOut出错:"+ex.ToString());
}
}
private void ProcessHumidityCMD(Operation resultOperation)
{
Dictionary<string, string> data = resultOperation.data;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!