Commit 9a2c2f79 LN

宽度改为13,15,7

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