Commit 915db7af LN

IO_Value增加None

1 个父辈 732606eb
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<add key="OpenRFIDWrite" value="1" /> <add key="OpenRFIDWrite" value="1" />
<add key="DefaultPWD" value="123456" /> <add key="DefaultPWD" value="123456" />
<!--当前调试的设备ID,分号分割--> <!--当前调试的设备ID,分号分割-->
<add key="DebugDeviceId" value="0" /> <add key="DebugDeviceId" value="301" />
<add key="Server_Log_Open" value="0" /> <add key="Server_Log_Open" value="0" />
<add key="CodeCount" value="3" /> <add key="CodeCount" value="3" />
<add key="DefaultTrayNum" value="0" /> <add key="DefaultTrayNum" value="0" />
......
...@@ -419,7 +419,7 @@ ...@@ -419,7 +419,7 @@
this.lblThisSta.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblThisSta.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblThisSta.ForeColor = System.Drawing.Color.Red; this.lblThisSta.ForeColor = System.Drawing.Color.Red;
this.lblThisSta.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.lblThisSta.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblThisSta.Location = new System.Drawing.Point(274, 48); this.lblThisSta.Location = new System.Drawing.Point(274, 64);
this.lblThisSta.Name = "lblThisSta"; this.lblThisSta.Name = "lblThisSta";
this.lblThisSta.Size = new System.Drawing.Size(528, 132); this.lblThisSta.Size = new System.Drawing.Size(528, 132);
this.lblThisSta.TabIndex = 246; this.lblThisSta.TabIndex = 246;
...@@ -551,11 +551,10 @@ ...@@ -551,11 +551,10 @@
// //
// lblInoutInfo // lblInoutInfo
// //
this.lblInoutInfo.AutoSize = true;
this.lblInoutInfo.ForeColor = System.Drawing.Color.Green; this.lblInoutInfo.ForeColor = System.Drawing.Color.Green;
this.lblInoutInfo.Location = new System.Drawing.Point(14, 22); this.lblInoutInfo.Location = new System.Drawing.Point(13, 16);
this.lblInoutInfo.Name = "lblInoutInfo"; this.lblInoutInfo.Name = "lblInoutInfo";
this.lblInoutInfo.Size = new System.Drawing.Size(80, 17); this.lblInoutInfo.Size = new System.Drawing.Size(788, 42);
this.lblInoutInfo.TabIndex = 281; this.lblInoutInfo.TabIndex = 281;
this.lblInoutInfo.Text = "当前出入库:"; this.lblInoutInfo.Text = "当前出入库:";
// //
...@@ -564,7 +563,7 @@ ...@@ -564,7 +563,7 @@
this.lblMoveInfo.AutoSize = true; this.lblMoveInfo.AutoSize = true;
this.lblMoveInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblMoveInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMoveInfo.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.lblMoveInfo.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblMoveInfo.Location = new System.Drawing.Point(11, 46); this.lblMoveInfo.Location = new System.Drawing.Point(11, 62);
this.lblMoveInfo.Name = "lblMoveInfo"; this.lblMoveInfo.Name = "lblMoveInfo";
this.lblMoveInfo.Size = new System.Drawing.Size(68, 17); this.lblMoveInfo.Size = new System.Drawing.Size(68, 17);
this.lblMoveInfo.TabIndex = 280; this.lblMoveInfo.TabIndex = 280;
......
...@@ -125,7 +125,7 @@ namespace OnlineStore.AssemblyLine ...@@ -125,7 +125,7 @@ namespace OnlineStore.AssemblyLine
} }
if (equipBean.MoveInfo.MoveType.Equals(LineMoveType.InStore) || equipBean.MoveInfo.MoveType.Equals(LineMoveType.OutStore)) if (equipBean.MoveInfo.MoveType.Equals(LineMoveType.InStore) || equipBean.MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{ {
lblInoutInfo.Text = equipBean.MoveInfo.MoveParam.ToStr(); lblInoutInfo.Text = (equipBean.MoveInfo.MoveType.Equals(LineMoveType.InStore) ? "入库:" : "出库") + equipBean.MoveInfo.MoveParam.ToStr();
} }
else else
{ {
......
...@@ -282,7 +282,7 @@ PRO,0,移栽上下轴流水线取放料详细位置P2,UpDownP2DetialList,0X0=800 ...@@ -282,7 +282,7 @@ PRO,0,移栽上下轴流水线取放料详细位置P2,UpDownP2DetialList,0X0=800
移栽模块流程优化。 移栽模块流程优化。
上料模块出料架口收到ready信号后,先把状态设置为None。 上料模块出料架口收到ready信号后,先把状态设置为None。
IO_Value增加None的定义,防止误操作
......
...@@ -244,7 +244,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -244,7 +244,7 @@ namespace OnlineStore.DeviceLibrary
Sw23TrayNum = trayNum; Sw23TrayNum = trayNum;
SW23_MoveInfo.NewMove(LineMoveType.InStore); SW23_MoveInfo.NewMove(LineMoveType.InStore);
SW23_MoveInfo.NextMoveStep(LineMoveStep.SW03_WaitTime); SW23_MoveInfo.NextMoveStep(LineMoveStep.SW03_WaitTime);
//SW23WaitTrayNum = -1; SW23WaitTrayNum = -1;
//SWLog("横移轨道23:检测到SW2_TrayCheck,等待SW3_TrayCheck=0, 托盘号 [" + Sw23TrayNum + "] ,清空 SW23WaitTrayNum=" + SW23WaitTrayNum); //SWLog("横移轨道23:检测到SW2_TrayCheck,等待SW3_TrayCheck=0, 托盘号 [" + Sw23TrayNum + "] ,清空 SW23WaitTrayNum=" + SW23WaitTrayNum);
//SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW2_TrayCheck, IO_VALUE.HIGH)); //SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW2_TrayCheck, IO_VALUE.HIGH));
//SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW3_TrayCheck, IO_VALUE.LOW)); //SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW3_TrayCheck, IO_VALUE.LOW));
......
...@@ -60,7 +60,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -60,7 +60,7 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveStep.Equals(LineMoveStep.MO_50_StartOutProcess)) if (MoveInfo.MoveStep.Equals(LineMoveStep.MO_50_StartOutProcess))
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_51_CylinderBefore); MoveInfo.NextMoveStep(LineMoveStep.MO_51_CylinderBefore);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
OutLog("出库 " + MoveInfo.MoveStep + ": 前后气缸前进"); OutLog("出库 " + MoveInfo.MoveStep + ": 前后气缸前进");
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before); CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before);
} }
...@@ -76,6 +76,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -76,6 +76,7 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_51_CylinderBefore); MoveInfo.NextMoveStep(LineMoveStep.MO_51_CylinderBefore);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
OutLog("出库 " + MoveInfo.MoveStep + ": 前后气缸前进"); OutLog("出库 " + MoveInfo.MoveStep + ": 前后气缸前进");
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before); CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before);
} }
......
...@@ -28,83 +28,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -28,83 +28,19 @@ namespace OnlineStore.DeviceLibrary
private object DILock = ""; private object DILock = "";
private object DOLock = ""; private object DOLock = "";
// private List<string> IoIPLIst = new List<string>();
// private System.Timers.Timer conTimer = null;
public override void ConnectionIOList(List<string> DIONameList) public override void ConnectionIOList(List<string> DIONameList)
{ {
//if (conTimer == null)
//{
// conTimer = new System.Timers.Timer();
// conTimer.AutoReset = true;
// conTimer.Interval = 10000;
// conTimer.Elapsed += ConTimer_Elapsed;
//}
//conTimer.Enabled = false;
// IoIPLIst = new List<string>(DIONameList);
// conCount = 3;
foreach (string ip in DIONameList) foreach (string ip in DIONameList)
{ {
ConnectionIP(ip); ConnectionIP(ip);
} }
//if (IoIPLIst.Count > 0)
//{
// //启动定时器,1一分钟重连一次
// conTimer.Start();
//}
} }
private bool isProcess = false; private bool isProcess = false;
private DateTime lastTime = DateTime.Now; private DateTime lastTime = DateTime.Now;
//private void ConTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
//{
// TimeSpan span = DateTime.Now - lastTime;
// if(span.TotalMinutes< IoIPLIst .Count&& isProcess)
// {
// return;
// }
// isProcess = true;
// lastTime = DateTime.Now;
// try
// {
// //判断是否还在连接
// foreach(AIOBOX box in AIOMap.Values)
// {
// if (!box.IsConn)
// {
// if (IoIPLIst.Contains(box.IP).Equals(false))
// {
// LogUtil.info("IO模块【"+box.IP+"】已断开,加入集合等待重连");
// IoIPLIst.Add(box.IP);
// }
// }
// }
// }catch(Exception ex)
// {
// LogUtil.error("AOI 判断是否需要重连 出错",ex);
// }
// try
// {
// List<string> list = new List<string>(IoIPLIst);
// if (list.Count > 0)
// {
// LogUtil.info("开始重连IO模块 ------------" );
// conCount = 1;
// foreach (string ip in list)
// {
// ConnectionIP(ip);
// }
// LogUtil.info("结束重连IO模块 ------------");
// }
// GC.Collect();
// }catch(Exception ex)
// {
// LogUtil.error("AOI ConTimer_Elapsed 出错: ",ex);
// }
// isProcess = false;
//}
// private int conCount = 3;
public void ConnectionIP(string ioIp) public void ConnectionIP(string ioIp)
{ {
AIOBOX aioBox = null; AIOBOX aioBox = null;
...@@ -147,15 +83,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -147,15 +83,12 @@ namespace OnlineStore.DeviceLibrary
int DOLength = LineManager.Config.GetDOLength(ioIp); int DOLength = LineManager.Config.GetDOLength(ioIp);
string logName = "IO模块[" + ioIp + "] DI[" + DILength + "] DO[" + DOLength + "],[" + DIMS + "] [" + DOMS + "]"; string logName = "IO模块[" + ioIp + "] DI[" + DILength + "] DO[" + DOLength + "],[" + DIMS + "] [" + DOMS + "]";
try try
{ {
// Create new modbus master and add event functions
aioBox = new AIOBOX(); aioBox = new AIOBOX();
aioBox.LogPath(Application.StartupPath + @"\logs\aio\", LogType.OnlyError); aioBox.LogPath(Application.StartupPath + @"\logs\aio\", LogType.OnlyError);
aioBox.IP = ioIp; aioBox.IP = ioIp;
// bool rtn = aioBox.AutoIP(ioIp);
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主动上传
...@@ -165,60 +98,25 @@ namespace OnlineStore.DeviceLibrary ...@@ -165,60 +98,25 @@ namespace OnlineStore.DeviceLibrary
aioBox.DI_Changed_Event += AioBox_DI_Changed_Event; ; aioBox.DI_Changed_Event += AioBox_DI_Changed_Event; ;
aioBox.DO_Changed_Event += AioBox_DO_Changed_Event; aioBox.DO_Changed_Event += AioBox_DO_Changed_Event;
// aioBox.Log_Out_Event += AioBox_Log_Out_Event;
//aioBox.Log_RxTx_Event += AioBox_Log_RxTx_Event;
// LogUtil.debug("开始连接" + logName + ",尝试重连3次");
// for (int i = 1; i <= conCount; i++)
//{
LogUtil.info("开始连接:" + logName + ":" + aioBox.ErrInfo); LogUtil.info("开始连接:" + logName + ":" + aioBox.ErrInfo);
aioBox.Connect(); aioBox.Connect();
//bool result = aioBox.Connect();
//if (result)
//{
// LogUtil.info("第【" + i + "】次连接 " + logName + " 成功:" + aioBox.ErrInfo);
//if (IoIPLIst.Contains(ioIp))
//{
// IoIPLIst.Remove(ioIp);
//}
AIOMap.Add(ioIp, aioBox); AIOMap.Add(ioIp, aioBox);
Thread.Sleep(5); Thread.Sleep(5);
//读取所有的DO //读取所有的DO
ReadAllDI(ioIp, 0); ReadAllDI(ioIp, 0);
// break;
//}
//else
//{
// LogUtil.error("第【" + i + "】次连接 " + logName + " 失败:" + aioBox.ErrInfo + "");
//}
Thread.Sleep(5); Thread.Sleep(5);
GC.Collect(); GC.Collect();
// }
} }
catch (Exception error) catch (Exception error)
{ {
LogUtil.error(LOGGER, "连接IO模块 " + logName + " 出错:" + error.ToString()); LogUtil.error(LOGGER, "连接IO模块 " + logName + " 出错:" + error.ToString());
} }
} }
//private void AioBox_Reconnect_Event(AIOBOX box, int times, ref bool conn, Dictionary<string, string> dict)
//{
// conn = true;
// string msg = "重连AIO块【" + box.IP + "】次数:" + times + "【" + box.ErrInfo + "】,连接信息如下\r\n";
// foreach (string key in dict.Keys)
// {
// msg = msg + "\t" + "[" + key + "]=[" + dict[key] + "],";
// }
// LogUtil.error(msg);
//}
private DateTime lastLogTime = DateTime.Now; private DateTime lastLogTime = DateTime.Now;
private void AioBox_Log_Out_Event(AIOBOX box, string[] s) private void AioBox_Log_Out_Event(AIOBOX box, string[] s)
{ {
foreach (string str in s) foreach (string str in s)
...@@ -266,15 +164,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -266,15 +164,7 @@ namespace OnlineStore.DeviceLibrary
needUpdate = true; needUpdate = true;
} }
else else
{ {
//foreach(Box_Sta s in sta)
//{
// updateDi += s.ToString() + ",";
//}
//if (ip.Equals("192.168.201.61"))
//{
// LogUtil.info(updateDi);
//}
for (int i = 0; i < newList.Count; i++) for (int i = 0; i < newList.Count; i++)
{ {
if (!(oldList[i].Equals(newList[i]))) if (!(oldList[i].Equals(newList[i])))
...@@ -307,12 +197,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -307,12 +197,7 @@ namespace OnlineStore.DeviceLibrary
newList.AddRange(sta); newList.AddRange(sta);
List<Box_Sta> oldList = null; List<Box_Sta> oldList = null;
DOValueMap.TryGetValue(ip, out oldList); DOValueMap.TryGetValue(ip, out oldList);
//string result = "UpdateAllDO ip[" + ip + "], sta :";
//for (int i = 0; i < newList.Count; i++)
//{
// result += newList[i] + ",";
//}
//LogUtil.info(result);
if (oldList == null || oldList.Count.Equals(newList.Count).Equals(false)) if (oldList == null || oldList.Count.Equals(newList.Count).Equals(false))
{ {
needUpdate = true; needUpdate = true;
...@@ -469,7 +354,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -469,7 +354,7 @@ namespace OnlineStore.DeviceLibrary
} }
public override IO_VALUE GetDOValue(string ioIP, byte slaveId, ushort StartAddress) public override IO_VALUE GetDOValue(string ioIP, byte slaveId, ushort StartAddress)
{ {
IO_VALUE value = IO_VALUE.LOW; IO_VALUE value = IO_VALUE.None;
try try
{ {
AIOBOX aioBox = getAIO(ioIP); AIOBOX aioBox = getAIO(ioIP);
...@@ -486,6 +371,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -486,6 +371,10 @@ namespace OnlineStore.DeviceLibrary
{ {
value = IO_VALUE.HIGH; value = IO_VALUE.HIGH;
} }
else
{
value = IO_VALUE.LOW;
}
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -497,7 +386,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -497,7 +386,7 @@ namespace OnlineStore.DeviceLibrary
public override IO_VALUE GetDIValue(string ioIP, byte slaveId, ushort StartAddress) public override IO_VALUE GetDIValue(string ioIP, byte slaveId, ushort StartAddress)
{ {
IO_VALUE value = IO_VALUE.LOW; IO_VALUE value = IO_VALUE.None;
for (int i = 1; i <= 3; i++) for (int i = 1; i <= 3; i++)
{ {
try try
...@@ -519,6 +408,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -519,6 +408,9 @@ namespace OnlineStore.DeviceLibrary
if (sta.Equals(Box_Sta.On)) if (sta.Equals(Box_Sta.On))
{ {
value = IO_VALUE.HIGH; value = IO_VALUE.HIGH;
}else
{
value = IO_VALUE.LOW;
} }
} }
break; break;
...@@ -532,7 +424,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -532,7 +424,7 @@ namespace OnlineStore.DeviceLibrary
} }
public override IO_VALUE GetIOValue(ConfigIO configIO) public override IO_VALUE GetIOValue(ConfigIO configIO)
{ {
IO_VALUE value = IO_VALUE.LOW; IO_VALUE value = IO_VALUE.None;
try try
{ {
if (configIO.ProType.Equals(ConfigItemType.DI)) if (configIO.ProType.Equals(ConfigItemType.DI))
......
...@@ -51,7 +51,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -51,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
public static IO_VALUE IOValue(string ioType,int subType ) public static IO_VALUE IOValue(string ioType,int subType )
{ {
IO_VALUE ioValue = IO_VALUE.LOW; IO_VALUE ioValue = IO_VALUE.None;
ConfigIO configIo = GetDI(ioType,subType ); ConfigIO configIo = GetDI(ioType,subType );
if (configIo == null) if (configIo == null)
{ {
...@@ -78,7 +78,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -78,7 +78,7 @@ namespace OnlineStore.DeviceLibrary
} }
public static IO_VALUE DOValue(string ioType, int subType = 0) public static IO_VALUE DOValue(string ioType, int subType = 0)
{ {
IO_VALUE ioValue = IO_VALUE.LOW; IO_VALUE ioValue = IO_VALUE.None;
ConfigIO configIo = GetDO(ioType, subType); ConfigIO configIo = GetDO(ioType, subType);
if (configIo != null) if (configIo != null)
...@@ -91,6 +91,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -91,6 +91,20 @@ namespace OnlineStore.DeviceLibrary
} }
return ioValue; return ioValue;
} }
public static IO_VALUE DIValue(string ioType, int subType)
{
IO_VALUE ioValue = IO_VALUE.None;
ConfigIO configIo = GetDI(ioType, subType);
if (configIo != null)
{
ioValue = instance.GetDIValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr());
}
else
{
LogUtil.error("未找到 DI [" + ioType + "][" + subType + "]");
}
return ioValue;
}
private static ConfigIO GetDI(string ioType, int subType) private static ConfigIO GetDI(string ioType, int subType)
{ {
ConfigIO configIo = null; ConfigIO configIo = null;
......
...@@ -332,7 +332,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -332,7 +332,7 @@ namespace OnlineStore.DeviceLibrary
} }
public override IO_VALUE GetDOValue(string ioIP, byte slaveId, ushort StartAddress) public override IO_VALUE GetDOValue(string ioIP, byte slaveId, ushort StartAddress)
{ {
IO_VALUE value = IO_VALUE.LOW; IO_VALUE value = IO_VALUE.None;
if (DOValueMap.ContainsKey(ioIP)) if (DOValueMap.ContainsKey(ioIP))
{ {
...@@ -348,7 +348,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -348,7 +348,7 @@ namespace OnlineStore.DeviceLibrary
public override IO_VALUE GetDIValue(string ioIP, byte slaveId, ushort StartAddress) public override IO_VALUE GetDIValue(string ioIP, byte slaveId, ushort StartAddress)
{ {
IO_VALUE value = IO_VALUE.LOW; IO_VALUE value = IO_VALUE.None;
if (DIValueMap.ContainsKey(ioIP)) if (DIValueMap.ContainsKey(ioIP))
{ {
List<KNDIO> allIo = new List<KNDIO>(DIValueMap[ioIP]); List<KNDIO> allIo = new List<KNDIO>(DIValueMap[ioIP]);
...@@ -362,7 +362,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -362,7 +362,7 @@ namespace OnlineStore.DeviceLibrary
} }
public override IO_VALUE GetIOValue(ConfigIO configIO) public override IO_VALUE GetIOValue(ConfigIO configIO)
{ {
IO_VALUE value = IO_VALUE.LOW; IO_VALUE value = IO_VALUE.None;
try try
{ {
if (configIO.ProType.Equals(ConfigItemType.DI)) if (configIO.ProType.Equals(ConfigItemType.DI))
......
...@@ -376,7 +376,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -376,7 +376,7 @@ namespace OnlineStore.DeviceLibrary
} }
public bool CylinderIsOk(string IoLowType, string IoHighType) public bool CylinderIsOk(string IoLowType, string IoHighType)
{ {
if (IOValue(IoLowType).Equals(IO_VALUE.LOW) && IOValue(IoHighType).Equals(IO_VALUE.HIGH)){ if (IOManager.DIValue(IoLowType,DeviceID).Equals(IO_VALUE.LOW) && IOManager.DIValue(IoHighType, DeviceID).Equals(IO_VALUE.HIGH)){
return true; return true;
} }
return false; return false;
...@@ -402,11 +402,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -402,11 +402,14 @@ namespace OnlineStore.DeviceLibrary
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoLowType, IO_VALUE.LOW)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoLowType, IO_VALUE.LOW));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH));
if (IoHighType.Equals(IO_Type.ClampCylinder_Slack) || IoHighType.Equals(IO_Type.ClampCylinder_Tighten) || if (IoHighType.Equals(IO_Type.ClampCylinder_Slack) || IoHighType.Equals(IO_Type.ClampCylinder_Tighten) ||
IoHighType.Equals(IO_Type.UpDownCylinder_Down) || IoHighType.Equals(IO_Type.UpDownCylinder_Up) || IoHighType.Equals(IO_Type.UpDownCylinder_Down) || IoHighType.Equals(IO_Type.UpDownCylinder_Up)
IoHighType.Equals(IO_Type.BeforeAfterCylinder_After) || IoHighType.Equals(IO_Type.BeforeAfterCylinder_Before) // IoHighType.Equals(IO_Type.BeforeAfterCylinder_After) || IoHighType.Equals(IO_Type.BeforeAfterCylinder_Before)
) )
{ {
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(300)); moveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
}else if(IoHighType.Equals(IO_Type.BeforeAfterCylinder_After) || IoHighType.Equals(IO_Type.BeforeAfterCylinder_Before)){
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(800));
} }
} }
if (isCheckMove) if (isCheckMove)
......
...@@ -183,13 +183,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -183,13 +183,15 @@ namespace OnlineStore.DeviceLibrary
{ {
} }
public static WaitResultInfo WaitIO(string ioType, IO_VALUE ioValue) public static WaitResultInfo WaitIO(string ioType, IO_VALUE ioValue,int targetP=0)
{ {
//targetP=0表示默认,=1必须检测DI,=2必须检测DO
WaitResultInfo wait = new WaitResultInfo(); WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount = 0; wait.CanWhileMoveCount = 0;
wait.WaitType = WaitEnum.W002_IOValue; wait.WaitType = WaitEnum.W002_IOValue;
wait.IoType = ioType; wait.IoType = ioType;
wait.IoValue = ioValue; wait.IoValue = ioValue;
wait.TargetPosition = targetP;
wait.IsEnd = false; wait.IsEnd = false;
return wait; return wait;
} }
......
...@@ -681,6 +681,10 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -681,6 +681,10 @@ namespace OnlineStore.LoadCSVLibrary
public enum IO_VALUE public enum IO_VALUE
{ {
/// <summary> /// <summary>
/// 未知
/// </summary>
None = -1,
/// <summary>
/// 低位 /// 低位
/// </summary> /// </summary>
LOW = 0, LOW = 0,
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
this.pictureBox1.Size = new System.Drawing.Size(25, 27); this.pictureBox1.Size = new System.Drawing.Size(25, 27);
this.pictureBox1.TabIndex = 1; this.pictureBox1.TabIndex = 1;
this.pictureBox1.TabStop = false; this.pictureBox1.TabStop = false;
this.pictureBox1.Visible = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
// //
// pictureBox2 // pictureBox2
...@@ -68,6 +69,7 @@ ...@@ -68,6 +69,7 @@
this.pictureBox2.Size = new System.Drawing.Size(25, 27); this.pictureBox2.Size = new System.Drawing.Size(25, 27);
this.pictureBox2.TabIndex = 2; this.pictureBox2.TabIndex = 2;
this.pictureBox2.TabStop = false; this.pictureBox2.TabStop = false;
this.pictureBox2.Visible = false;
this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click); this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
// //
// IOTextControl // IOTextControl
......
...@@ -32,7 +32,7 @@ namespace UserFromControl ...@@ -32,7 +32,7 @@ namespace UserFromControl
isCanClick = false; isCanClick = false;
} }
public IOTextControl(string ioName,string name,int widht=220,int height=25, int ioValue=0, bool canClick=false, int tabIndex=0) public IOTextControl(string ioName,string name,int widht=220,int height=25, int ioValue=-1, bool canClick=false, int tabIndex=0)
{ {
InitializeComponent(); InitializeComponent();
if (ImageManager.IsInit == false) if (ImageManager.IsInit == false)
...@@ -46,7 +46,7 @@ namespace UserFromControl ...@@ -46,7 +46,7 @@ namespace UserFromControl
isCanClick = false; isCanClick = false;
IOName =ioName; IOName =ioName;
IOValue = IOValue; IOValue = ioValue;
isCanClick = canClick; isCanClick = canClick;
Name = "IO_" + name; Name = "IO_" + name;
Size = new System.Drawing.Size(widht, height); Size = new System.Drawing.Size(widht, height);
...@@ -55,8 +55,13 @@ namespace UserFromControl ...@@ -55,8 +55,13 @@ namespace UserFromControl
public void ShowData() public void ShowData()
{ {
label1.Text = IOName; label1.Text = IOName;
if (IOValue == 0) if (IOValue.Equals(1))
{
pictureBox1.Visible = false;
pictureBox2.Visible = true;
}
else if (IOValue.Equals(0))
{ {
pictureBox1.Visible = true; pictureBox1.Visible = true;
pictureBox2.Visible = false; pictureBox2.Visible = false;
...@@ -64,7 +69,8 @@ namespace UserFromControl ...@@ -64,7 +69,8 @@ namespace UserFromControl
else else
{ {
pictureBox1.Visible = false; pictureBox1.Visible = false;
pictureBox2.Visible = true; pictureBox2.Visible = false;
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!