Commit 68e56f25 LN

io修改

1 个父辈 561968aa
...@@ -1455,7 +1455,7 @@ namespace OnlineStore.ACSingleStore ...@@ -1455,7 +1455,7 @@ namespace OnlineStore.ACSingleStore
// if (store.Config.StoreDIList.ContainsKey(IO_Type.UpdownPositionSingal)) // if (store.Config.StoreDIList.ContainsKey(IO_Type.UpdownPositionSingal))
if (store.Config.StoreDIList.ContainsKey(IO_Type.TrayCheck_Fixture)) if (store.Config.StoreDIList.ContainsKey(IO_Type.TrayCheck_Fixture))
{ {
ioIP = store.Config.StoreDIList[IO_Type.TrayCheck_Fixture].DeviceName; ioIP = store.Config.StoreDIList[IO_Type.TrayCheck_Fixture].IO_IP;
ioIndex = store.Config.StoreDIList[IO_Type.TrayCheck_Fixture].GetIOAddr(); ioIndex = store.Config.StoreDIList[IO_Type.TrayCheck_Fixture].GetIOAddr();
} }
FrmPositionTool frm = new FrmPositionTool(PortName, slvAddr, ioIP, ioIndex); FrmPositionTool frm = new FrmPositionTool(PortName, slvAddr, ioIP, ioIndex);
......
...@@ -35,7 +35,7 @@ namespace OnlineStore.ACSingleStore ...@@ -35,7 +35,7 @@ namespace OnlineStore.ACSingleStore
this.IoIndex = ioIndex; this.IoIndex = ioIndex;
toolTimer.Enabled = false; toolTimer.Enabled = false;
toolTimer.Interval = 100; toolTimer.Interval = 50;
toolTimer.AutoReset = true; toolTimer.AutoReset = true;
toolTimer.Elapsed += ToolTimer_Elapsed; toolTimer.Elapsed += ToolTimer_Elapsed;
...@@ -187,7 +187,7 @@ namespace OnlineStore.ACSingleStore ...@@ -187,7 +187,7 @@ namespace OnlineStore.ACSingleStore
string filePath = Application.StartupPath + @"\logs\" + fileName; string filePath = Application.StartupPath + @"\logs\" + fileName;
if (File.Exists(filePath)) if (File.Exists(filePath))
{ {
string msg = "文件【{0}】已存在,是否确定覆盖?"; string msg = "文件【"+fileName+"】已存在,是否确定覆盖?";
DialogResult result = MessageBox.Show(msg, "", MessageBoxButtons.OKCancel,MessageBoxIcon.Question); DialogResult result = MessageBox.Show(msg, "", MessageBoxButtons.OKCancel,MessageBoxIcon.Question);
if (!result.Equals(DialogResult.OK)) if (!result.Equals(DialogResult.OK))
{ {
......
...@@ -119,7 +119,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -119,7 +119,7 @@ namespace OnlineStore.DeviceLibrary
aioBox.SetInput(Asa.IOModule.Box_Type.DI, DILength); aioBox.SetInput(Asa.IOModule.Box_Type.DI, DILength);
aioBox.SetOutput(Asa.IOModule.Box_Type.DO, DOLength); aioBox.SetOutput(Asa.IOModule.Box_Type.DO, DOLength);
//DI主动上传 //DI主动上传
aioBox.AutoReadInput(true); aioBox.AutoReadInput(true,DIMS);
aioBox.AutoReadOutput(true, DOMS); aioBox.AutoReadOutput(true, DOMS);
aioBox.LogOut = true; aioBox.LogOut = true;
......
...@@ -34,19 +34,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -34,19 +34,7 @@ namespace OnlineStore.LoadCSVLibrary
[CSVAttribute("属性值")] [CSVAttribute("属性值")]
public string ProValue { get; set; } public string ProValue { get; set; }
public ushort GetIOAddr()
{
ushort value = 0;
try
{
value = (ushort)Convert.ToInt32(ProValue);
}
catch (Exception ex)
{
LOGGER.Error("出错:", ex);
}
return value;
}
public virtual int GetValue() public virtual int GetValue()
{ {
if (ProValue.Equals("")) if (ProValue.Equals(""))
...@@ -271,49 +259,18 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -271,49 +259,18 @@ namespace OnlineStore.LoadCSVLibrary
{ {
} }
} }
public override int GetValue() public ushort GetIOAddr()
{
return GetIOValue();
}
public int GetIOValue()
{ {
if (IoValue >= -1) ushort value = 0;
{
return IoValue;
}
try try
{ {
if (ProValue.Equals("") || ProValue.Equals("-1")) value = (ushort)Convert.ToInt32(ProValue);
{
IoValue = -1;
}
else if (ProType.Equals(ConfigItemType.DI))
{
IoValue = Convert.ToInt32(ProValue, 8);
}
else if (ProType.Equals(ConfigItemType.DO))
{
if (ProValue.Length == 2)
{
int a = Convert.ToInt32(ProValue.Substring(0, 1), 16) - 8;
string str =a+ProValue.Substring(1,1);
IoValue = Convert.ToInt32( str, 8);
//IoValue = a + b;
}
else
{
IoValue = Convert.ToInt32(ProValue, 16) - Convert.ToInt32("80", 16);
}
}
//LOGGER.Info("IO转换:(" + ElectricalDefinition + ")" + ProVale + "=" + IoValue);
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("出错了:", ex); LOGGER.Error("出错:", ex);
return -1;
} }
return IoValue; return value;
} }
public override string ToString() public override string ToString()
......
...@@ -138,7 +138,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -138,7 +138,7 @@ namespace OnlineStore.LoadCSVLibrary
if (IO_Type.GetTypeList().Contains(con.ProName)) if (IO_Type.GetTypeList().Contains(con.ProName))
{ {
ConfigIO io = (ConfigIO)con; ConfigIO io = (ConfigIO)con;
if (!DIODeviceNameList.Contains(io.DeviceName) && (io.GetIOValue() >= 0 || io.GetIOAddr() >= 0)&&io.DeviceName.Contains(IOIP_Str).Equals(false)) if (!DIODeviceNameList.Contains(io.DeviceName) && (io.GetIOAddr() >= 0 || io.GetIOAddr() >= 0)&&io.DeviceName.Contains(IOIP_Str).Equals(false))
{ {
DIODeviceNameList.Add(io.DeviceName); DIODeviceNameList.Add(io.DeviceName);
} }
...@@ -154,7 +154,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -154,7 +154,7 @@ namespace OnlineStore.LoadCSVLibrary
if (IO_Type.GetTypeList().Contains(con.ProName)) if (IO_Type.GetTypeList().Contains(con.ProName))
{ {
ConfigIO io = (ConfigIO)con; ConfigIO io = (ConfigIO)con;
if (!DIODeviceNameList.Contains(io.DeviceName) && io.GetIOValue() >= 0 && io.DeviceName.Contains(IOIP_Str).Equals(false)) if (!DIODeviceNameList.Contains(io.DeviceName) && io.GetIOAddr() >= 0 && io.DeviceName.Contains(IOIP_Str).Equals(false))
{ {
DIODeviceNameList.Add(io.DeviceName); DIODeviceNameList.Add(io.DeviceName);
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!