Commit 9a2c2f79 LN

宽度改为13,15,7

1 个父辈 fbd26364
......@@ -309,12 +309,19 @@ namespace OnlineStore.DeviceLibrary
public override void CloseAllConnection()
{
try
{
foreach (AIOBOX aio in AIOMap.Values)
{
aio.Close();
}
AIOMap.Clear();
}
catch (Exception ex)
{
LogUtil.error("CloseAllConnection 出错:" + ex.ToString());
}
}
public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff)
{
try
......
......@@ -1591,7 +1591,7 @@ namespace OnlineStore.DeviceLibrary
#region 高度传感器处理
private int smallWidth = 7;
// 0、1对应7寸盘,2对应13寸,3对应夹具
// 0、1对应7寸盘,2对应13寸,3对应15
public int GetSize()
{
if (Config.Default_TrayWidth > 0)
......@@ -1599,21 +1599,32 @@ namespace OnlineStore.DeviceLibrary
//如果配置了默认宽度,使用默认宽度且不能修改
return Config.Default_TrayWidth;
}
if (Config.AIDI3_Addr < 0 )
if (Config.AIDI3_Addr < 0 || Config.AIDI4_Addr <= 0)
{
return smallWidth;
}
else if (Config.AIDI1_Addr < 0 || Config.AIDI2_Addr < 0)
{
return Config.Big_TrayWidth;
if (Get15Height() > 0)
{
return 15;
}
else
else if (Get13Height() > 0)
{
if (GetBigHeight() > 0)
return 13;
}
}
if (Get15Height() > 0)
{
return Config.Big_TrayWidth;
return 15;
}
return smallWidth;
else if (Get13Height() > 0)
{
return 13;
}
else
{
return 7;
}
}
public int GetHeight()
......@@ -1622,21 +1633,19 @@ namespace OnlineStore.DeviceLibrary
{
return GetSmallHeight();
}
else if (Config.Default_TrayWidth.Equals(Config.Big_TrayWidth))
{
return GetBigHeight();
}
else
{
int value = GetBigHeight();
if (value > 0)
int h15 = Get15Height();
if (h15 > 0)
{
return value;
return h15;
}
else
int h13 = Get13Height();
if (h13 > 0)
{
return GetSmallHeight();
return h13;
}
return GetSmallHeight();
}
}
private int GetSmallHeight()
......@@ -1658,20 +1667,34 @@ namespace OnlineStore.DeviceLibrary
}
private int GetBigHeight()
private int Get13Height()
{
if (Config.AIDI3_Addr < 0||Config.AIDI4_Addr<0)
if (Config.AIDI3_Addr < 0)
{
return 0;
}
int result = 0;
if (Config.Default_TrayWidth.Equals(Config.Big_TrayWidth).Equals(false) && IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW))
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW))
{
return result;
}
double ai1Value = AIManager.ConvertAI(AIManager.Instance.GetAIValue(Config.AIDevice_IP, Config.AIDI3_Addr), Config.AIDI3_DefaultPosition);
double ai2Value = AIManager.ConvertAI(AIManager.Instance.GetAIValue(Config.AIDevice_IP, Config.AIDI4_Addr), Config.AIDI4_DefaultPosition);
double Value = Math.Round((ai1Value + ai2Value) / 2, 1);
double Value = Math.Round((ai1Value) / 1, 1);
return CalHeight(Value);
}
private int Get15Height()
{
if (Config.AIDI4_Addr < 0)
{
return 0;
}
int result = 0;
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW))
{
return result;
}
double ai1Value = AIManager.ConvertAI(AIManager.Instance.GetAIValue(Config.AIDevice_IP, Config.AIDI4_Addr), Config.AIDI4_DefaultPosition);
double Value = Math.Round((ai1Value) / 1, 1);
return CalHeight(Value);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!