Commit 0c4b4886 几米阳光

修改AIO

1 个父辈 8e192785
此文件类型无法预览
此文件类型无法预览
......@@ -36,9 +36,6 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
......@@ -66,6 +63,8 @@
<Compile Include="acSingleStore\AutomaticBaiting.cs" />
<Compile Include="DeviceLibrary\halcon\CodeManager.cs" />
<Compile Include="DeviceLibrary\IO\AIOBOX\AIOBOXManager.cs" />
<Compile Include="DeviceLibrary\IO\AIOBOX\BLL.cs" />
<Compile Include="DeviceLibrary\IO\AIOBOX\Common.cs" />
<Compile Include="DeviceLibrary\IO\IOManager.cs" />
<Compile Include="DeviceLibrary\IO\KangNaiDe\KNDManager.cs" />
<Compile Include="DeviceLibrary\IO\KangNaiDe\MasterTcpClient.cs" />
......
......@@ -69,6 +69,7 @@ namespace OnlineStore.DeviceLibrary
aioBox.AutoReadDO (true, DOMS);
aioBox.LogOut = true;
aioBox.Reconnect_Event += AioBox_Reconnect_Event;
if (StoreManager.Config.GetDILength(ioIp).Equals(8))
{
aioBox.Type = Box_Type.DIO_16;
......@@ -82,7 +83,7 @@ namespace OnlineStore.DeviceLibrary
aioBox.Log_Out_Event += AioBox_Log_Out_Event;
aioBox.Log_RxTx_Event += AioBox_Log_RxTx_Event;
AIOMap.Add(ioIp, aioBox);
LogUtil.info("开始连接IO模块[" + ioIp + "["+DIMS+"]["+DOMS+"],尝试重连三次");
LogUtil.info("开始连接IO模块[" + ioIp + "]["+DIMS+"]["+DOMS+"],尝试重连三次");
for (int i = 1; i <= 3; i++)
{
bool result = aioBox.Connect();
......@@ -115,10 +116,16 @@ namespace OnlineStore.DeviceLibrary
}
}
private void AioBox_Reconnect_Event(AIOBOX box, int times, ref bool conn)
private void AioBox_Reconnect_Event(AIOBOX box, int times, ref bool conn, Dictionary<string, string> dict)
{
conn = true;
LogUtil.error("重连AIO模块【" + box.IP + "】次数:" + times+"【"+box.ErrInfo+"】");
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;
......

namespace Asa.IOModule
{
/// <summary>
/// IO模块寄存器
/// </summary>
public class Reg
{
/// <summary>
/// 标识
/// </summary>
public int ID;
/// <summary>
/// 文本,仅用于显示
/// </summary>
public string Text;
/// <summary>
/// 寄存器地址
/// </summary>
public Box_Addr Address;
/// <summary>
/// 当前的状态
/// </summary>
public Box_Sta Status;
/// <summary>
/// 寄存器,文本空,状态OFF
/// </summary>
/// <param name="address">地址</param>
public Reg(Box_Addr address) : this(0, "", address, Box_Sta.Off)
{
}
/// <summary>
/// 寄存器,状态OFF
/// </summary>
/// <param name="text">文本</param>
/// <param name="addr">地址</param>
public Reg(string text, Box_Addr addr) : this(0, text, addr, Box_Sta.Off)
{
}
/// <summary>
/// 寄存器,状态OFF
/// </summary>
/// <param name="id">标志</param>
/// <param name="text">文本</param>
/// <param name="addr">地址</param>
public Reg(int id, string text, Box_Addr addr) : this(id, text, addr, Box_Sta.Off)
{
}
/// <summary>
/// 寄存器
/// </summary>
/// <param name="text">文本</param>
/// <param name="addr">地址</param>
/// <param name="status">状态</param>
public Reg(string text, Box_Addr addr, Box_Sta status) : this(0, text, addr, status)
{
}
/// <summary>
/// 寄存器
/// </summary>
/// <param name="id">标志</param>
/// <param name="text">文本</param>
/// <param name="address">地址</param>
/// <param name="status">状态</param>
public Reg(int id, string text, Box_Addr address, Box_Sta status)
{
ID = id;
Text = text;
Address = address;
Status = status;
}
}
/// <summary>
/// IO模块寄存器地址
/// </summary>
public enum Box_Addr : int
{
/// <summary>
/// 输入点,DI01
/// </summary>
DI_1,
/// <summary>
/// 输入点,DI02
/// </summary>
DI_2,
/// <summary>
/// 输入点,DI03
/// </summary>
DI_3,
/// <summary>
/// 输入点,DI04
/// </summary>
DI_4,
/// <summary>
/// 输入点,DI05
/// </summary>
DI_5,
/// <summary>
/// 输入点,DI06
/// </summary>
DI_6,
/// <summary>
/// 输入点,DI07
/// </summary>
DI_7,
/// <summary>
/// 输入点,DI08
/// </summary>
DI_8,
/// <summary>
/// 输入点,DI09
/// </summary>
DI_9,
/// <summary>
/// 输入点,DI10
/// </summary>
DI_10,
/// <summary>
/// 输入点,DI11
/// </summary>
DI_11,
/// <summary>
/// 输入点,DI12
/// </summary>
DI_12,
/// <summary>
/// 输入点,DI13
/// </summary>
DI_13,
/// <summary>
/// 输入点,DI14
/// </summary>
DI_14,
/// <summary>
/// 输入点,DI15
/// </summary>
DI_15,
/// <summary>
/// 输入点,DI16
/// </summary>
DI_16,
/// <summary>
/// 输出点,DO01
/// </summary>
DO_1,
/// <summary>
/// 输出点,DO02
/// </summary>
DO_2,
/// <summary>
/// 输出点,DO03
/// </summary>
DO_3,
/// <summary>
/// 输出点,DO04
/// </summary>
DO_4,
/// <summary>
/// 输出点,DO05
/// </summary>
DO_5,
/// <summary>
/// 输出点,DO06
/// </summary>
DO_6,
/// <summary>
/// 输出点,DO07
/// </summary>
DO_7,
/// <summary>
/// 输出点,DO08
/// </summary>
DO_8,
/// <summary>
/// 输出点,DO09
/// </summary>
DO_9,
/// <summary>
/// 输出点,DO10
/// </summary>
DO_10,
/// <summary>
/// 输出点,DO11
/// </summary>
DO_11,
/// <summary>
/// 输出点,DO12
/// </summary>
DO_12,
/// <summary>
/// 输出点,DO13
/// </summary>
DO_13,
/// <summary>
/// 输出点,DO14
/// </summary>
DO_14,
/// <summary>
/// 输出点,DO15
/// </summary>
DO_15,
/// <summary>
/// 输出点,DO16
/// </summary>
DO_16,
/// <summary>
/// 无
/// </summary>
NONE = 255
}
/// <summary>
/// IO模块类型
/// </summary>
public enum Box_Type : int
{
/// <summary>
/// 16位,8DI + 8DO
/// </summary>
DIO_16,
/// <summary>
/// 32位,16DI + 16DO
/// </summary>
DIO_32,
/// <summary>
/// 16位DO
/// </summary>
DO_16
}
/// <summary>
/// IO模块寄存器状态
/// </summary>
public enum Box_Sta : int
{
/// <summary>
/// 断开,关闭,低电平
/// </summary>
Off = 0,
/// <summary>
/// 闭合,打开,高电平
/// </summary>
On = 255
}
}
\ No newline at end of file
......@@ -49,15 +49,15 @@ AXIS,(轴三)进出轴,InOut_Axis,3,COM1,0,,,,,
AXIS,(轴五)批量上下料轴,Batch_Axis,4,COM1,0,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,升降轴 仓门位置P7(人工拿走盘的位置),UpDownAxis_Door_P7,347550,,,,,,,
PRO,升降轴 仓门位置P7(人工拿走盘的位置),UpDownAxis_Door_P7,345000,,,,,,,
PRO,升降轴 出库高点P2,UpDownAxis_OutHigh_P2,247000,,,,,,,
PRO,升降轴 出库低点P8,UpDownAxis_OutLow_P8,230000,,,,,,,
PRO,升降轴从吸盘下方接料后下降的高度,UpDownAxis_DownValue,10000,,,,,,,
PRO,升降轴 入库P1点集合,UpDownAxis_P1_List,8#398000;12#398000;16#393000;20#393000;24#390500;28#390500;32#390500;36#390500;40#390500;52#390500;,,,,,,,
PRO,旋转轴(轴一)P1 待机原位点,MiddleAxis_P1_Position,217400,,,,,,,
PRO,旋转轴(轴一)P1 待机原位点,MiddleAxis_P1_Position,218900,,,,,,,
PRO,进出轴(轴三)P1待机原位点,InOutAxis_P1_Position,1000,,,,,,,
PRO,压紧轴(轴4)P1待机原位点,CompressAxis_P1_Position,-25000,,,,,,,
PRO,压紧轴(轴4)P2压紧点集合,CompressAxis_P2_List,8#-110000;12#-110000;16#-90000;20#-90000;24#-110000;28#-70000;32#-70000;36#-70000;40#-70000;44#-70000;48#-70000;52#-70000;,,,,,,,
PRO,压紧轴(轴4)P2压紧点集合,CompressAxis_P2_List,8#-135000;12#-135000;16#-125000;20#-120000;24#-115000;28#-90000;32#-80000;36#-70000;40#-70000;44#-70000;48#-70000;52#-70000;,,,,,,,
PRO,是否使用定位气缸,IsHasLocationCylinder,0,,,,,,,
PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,,
PRO,是否使用压紧轴(1=使用),IsHasCompress_Axis,1,,,,,,,
......@@ -74,8 +74,8 @@ PRO,(轴一)旋转轴原点低速度,MiddleAxis_HomeLowSpeed,1000,,,,,,,
PRO,(轴一)旋转轴原点高速,MiddleAxis_HomeHighSpeed,1000,,,,,,,
PRO,(轴一)旋转轴原点加速度,MiddleAxis_HomeAddSpeed,1000,,,,,,,
PRO,(轴二)升降轴轴目标速度,UpdownAxis_TargetSpeed,200,,,,,,,
PRO,(轴二)升降轴轴加速度,UpdownAxis_AddSpeed,200,,,,,,,
PRO,(轴二)升降轴轴减速度,UpdownAxis_DelSpeed,200,,,,,,,
PRO,(轴二)升降轴轴加速度,UpdownAxis_AddSpeed,150,,,,,,,
PRO,(轴二)升降轴轴减速度,UpdownAxis_DelSpeed,150,,,,,,,
PRO,(轴二)升降轴轴原点低速度,UpdownAxis_HomeLowSpeed,200,,,,,,,
PRO,(轴二)升降轴轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,,,,
PRO,(轴二)升降轴轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,,,,
......@@ -85,20 +85,20 @@ PRO,(轴三)进出轴减速度,InoutAxis_DelSpeed,200,,,,,,,
PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,200,,,,,,,
PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,200,,,,,,,
PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,200,,,,,,,
PRO,升降轴(轴二)到仓门速度,UpDownAxis_Door_Speed,250,,,,,,,
PRO,升降轴(轴二)P1速度,UpDownAxis_P1_Speed,1000,,,,,,,
PRO,升降轴(轴二)P2速度,UpDownAxis_P2_Speed,1000,,,,,,,
PRO,升降轴(轴二)P3速度,UpDownAxis_P3_Speed,1000,,,,,,,
PRO,升降轴(轴二)P4速度,UpDownAxis_P4_Speed,500,,,,,,,
PRO,升降轴(轴二)P5速度,UpDownAxis_P5_Speed,1000,,,,,,,
PRO,升降轴(轴二)P6速度,UpDownAxis_P6_Speed,500,,,,,,,
PRO,升降轴(轴二)到仓门P7速度,UpDownAxis_P7_Speed,1000,,,,,,,
PRO,升降轴(轴二)P8速度,UpDownAxis_P8_Speed,500,,,,,,,
PRO,旋转轴(轴一)P1速度,MiddleAxis_P1_Speed,500,,,,,,,
PRO,旋转轴(轴一)P2速度,MiddleAxis_P2_Speed,500,,,,,,,
PRO,进出轴(轴三)P1速度,InOutAxis_P1_Speed,500,,,,,,,
PRO,进出轴(轴三)P2速度,InOutAxis_P2_Speed,500,,,,,,,
PRO,进出轴(轴三)P3速度,InOutAxis_P3_Speed,500,,,,,,,
PRO,升降轴(轴二)到仓门速度,UpDownAxis_Door_Speed,300,,,,,,,
PRO,升降轴(轴二)P1速度,UpDownAxis_P1_Speed,2200,,,,,,,
PRO,升降轴(轴二)P2速度,UpDownAxis_P2_Speed,2200,,,,,,,
PRO,升降轴(轴二)P3速度,UpDownAxis_P3_Speed,2200,,,,,,,
PRO,升降轴(轴二)P4速度,UpDownAxis_P4_Speed,400,,,,,,,
PRO,升降轴(轴二)P5速度,UpDownAxis_P5_Speed,2200,,,,,,,
PRO,升降轴(轴二)P6速度,UpDownAxis_P6_Speed,400,,,,,,,
PRO,升降轴(轴二)到仓门P7速度,UpDownAxis_P7_Speed,2000,,,,,,,
PRO,升降轴(轴二)P8速度,UpDownAxis_P8_Speed,400,,,,,,,
PRO,旋转轴(轴一)P1速度,MiddleAxis_P1_Speed,800,,,,,,,
PRO,旋转轴(轴一)P2速度,MiddleAxis_P2_Speed,800,,,,,,,
PRO,进出轴(轴三)P1速度,InOutAxis_P1_Speed,800,,,,,,,
PRO,进出轴(轴三)P2速度,InOutAxis_P2_Speed,800,,,,,,,
PRO,进出轴(轴三)P3速度,InOutAxis_P3_Speed,800,,,,,,,
PRO,(轴一)旋转轴最小误差脉冲值,MiddleAxis_ErrorCountMin,10,,,,,, ,
PRO,(轴二)升降轴轴最小误差脉冲值,UpdownAxis_ErrorCountMin,10,,,,,,,
PRO,(轴三)进出轴最小误差脉冲值,InoutAxis_ErrorCountMin,10,,,,,,,
......@@ -125,12 +125,12 @@ PRO,硕科步进电机(压紧轴)控制端口号,CompressAxis_PortName,COM6,,,,,,,
PRO,硕科步进电机(压紧轴)控制波特率,CompressAxis_PortBaudrate,9600,,,,,,,
PRO,硕科步进电机(压紧轴)控制奇偶校验,CompressAxis_PortParity,0,,,,,,,
PRO,硕科步进电机(压紧轴)控制停止位,CompressAxis_StopBits,1,,,,,,,
PRO,硕科步进电机(压紧轴)控制初速度,CompressAxis_StartSpeed,30000,,,,,,,
PRO,硕科步进电机(压紧轴)控制最大速度,CompressAxis_MaxSpeed,40000,,,,,,,
PRO,硕科步进电机(压紧轴)控制末速度,CompressAxis_EndSpeed,40000,,,,,,,
PRO,硕科步进电机(压紧轴)控制加速度,CompressAxis_AddSpeed,4000,,,,,,,
PRO,硕科步进电机(压紧轴)控制减速度,CompressAxis_DelSpeed,4000,,,,,,,
PRO,硕科步进电机(压紧轴)原点返回速度,CompressAxis_HomeSpeed,4000,,,,,,,
PRO,硕科步进电机(压紧轴)控制初速度,CompressAxis_StartSpeed,60000,,,,,,,
PRO,硕科步进电机(压紧轴)控制最大速度,CompressAxis_MaxSpeed,100000,,,,,,,
PRO,硕科步进电机(压紧轴)控制末速度,CompressAxis_EndSpeed,100000,,,,,,,
PRO,硕科步进电机(压紧轴)控制加速度,CompressAxis_AddSpeed,40000,,,,,,,
PRO,硕科步进电机(压紧轴)控制减速度,CompressAxis_DelSpeed,40000,,,,,,,
PRO,硕科步进电机(压紧轴)原点返回速度,CompressAxis_HomeSpeed,10000,,,,,,,
PRO,硕科步进电机轴地址(压紧轴),CompressAxis_Slv,1,,,,,, ,
,,,,,,,,,,
PRO,(轴五)上料轴目标速度,BatchAxis_TargetSpeed,800,,,,,,,
......@@ -142,16 +142,16 @@ PRO,(轴五)上料轴原点高速,BatchAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴五)上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,,,
PRO,(轴五)上料轴P1点(出库时接料盘的位置),BatchAxis_P1,1750000,,,,,, ,
PRO,(轴五)上料轴P2点(待机点),BatchAxis_P2,30000,,,,,, ,
PRO,(轴五)上料轴P2速度,BatchAxis_P2_Speed,2500,,,,,,,
PRO,(轴五)上料轴P2速度,BatchAxis_P2_Speed,2800,,,,,,,
PRO,(轴五)上料轴最小误差脉冲值,BatchAxis_ErrorCountMin,10,,,,,,,
PRO,(轴五)上料轴最大误差脉冲值,BatchAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴五)上料轴最小限位,BatchAxis_PositionMin,0,,,,,,,
PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,2000,,,,,,,
PRO,(轴五)上料轴出料时距离检测信号需要下降的高度,BatchAxis_OutDownPosition,80000,,,,,,,
PRO,(轴五)上料轴最最大料盘高度,到达后无法批量出库,BatchAxis_MaxHeight,360,,,,,,,
PRO,最后一盘料需要补充的高度,LastTrayAddHeight,12,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,2800,,,,,,,
PRO,(轴五)上料轴出料时距离检测信号需要下降的高度,BatchAxis_OutDownPosition,100000,,,,,,,
PRO,(轴五)上料轴最最大料盘高度,到达后无法批量出库,BatchAxis_MaxHeight,250,,,,,,,
PRO,最后一盘料需要补充的高度,LastTrayAddHeight,4,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,192.168.200.11#16;192.168.200.12#4,,,,,, ,
PRO,模块对应的DO数量,IO_DOLength,192.168.200.11#16;192.168.200.12#4,,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,192.168.200.21#16;192.168.200.22#4,,,,,, ,
PRO,模块对应的DO数量,IO_DOLength,192.168.200.21#16;192.168.200.22#4,,,,,,,
......@@ -866,7 +866,7 @@ namespace OnlineStore.DeviceLibrary
//如果批量能未检测到料盘,需要把批量轴走到能检测到料盘的位置
if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW))
{
StoreMove.TimeOutSeconds = 120;
StoreMove.TimeOutSeconds = 120;
//ACAxisMove(Config.Batch_Axis, Config.BatchAxis_P1, Config.BatchAxis_P1_Speed);
StoreMove.WaitList.Add(WaitResultInfo.WaitBatchAxisStop(Config.Batch_Axis, Config.BatchAxis_P1, IO_Type.TrayCheck_LoadMaterial));
BatchAxisController.StartCheck(IO_Type.TrayCheck_LoadMaterial);
......@@ -874,10 +874,10 @@ namespace OnlineStore.DeviceLibrary
int speed = Config.BatchAxis_P1_Speed;
if (AutomaticBaiting.BatchOutStoreHeight > 0)
{
speed = Config.BatchAxis_P1_Speed / 2;
speed = Config.BatchAxis_SlowSpeed * 2;
}
ACServerManager.AbsMove(Config.Batch_Axis.DeviceName, Config.Batch_Axis.GetAxisValue(), Config.BatchAxis_P1, speed);
OutStoreLog("出库:SO_02 批量上下料轴到P1点【"+Config.BatchAxis_P1+"】 ");
ACServerManager.AbsMove(Config.Batch_Axis.DeviceName, Config.Batch_Axis.GetAxisValue(), Config.BatchAxis_P1, speed);
OutStoreLog("出库:SO_02 批量上下料轴到P1点【" + Config.BatchAxis_P1 + "】速度【" + speed + "】 ");
}
}
}
......
......@@ -255,8 +255,9 @@ namespace OnlineStore.DeviceLibrary
if (IsNeedStartInout)
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R03_AutoAxisHome);
LogUtil.info(Name + "复位中:检测是否有料盘,批量轴匀速上升【" + StoreManager.Config.Batch_Axis.TargetSpeed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed,IO_Type.TrayCheck_LoadMaterial);
int speed = StoreManager.Config.BatchAxis_SlowSpeed * 2;
LogUtil.info(Name + "复位中:检测是否有料盘,批量轴匀速上升【" + speed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, speed, IO_Type.TrayCheck_LoadMaterial);
}
else
{
......
......@@ -91,7 +91,7 @@ namespace OnlineStore.DeviceLibrary
if (wait.WaitType == (int)Wait_Type.AxisMove_1)
{
bool isAlarm = false;
wait.IsEnd = AxisMoveISEnd(wait,ref isAlarm);
wait.IsEnd = AxisMoveISEnd(wait, ref isAlarm);
if (isAlarm)
{
return;
......@@ -112,14 +112,14 @@ namespace OnlineStore.DeviceLibrary
// break;
//}
//如果是气缸动作,若Do未输出,重新写一遍
if (!wait.IsEnd&&span.TotalSeconds>1 && (wait.IoType.Equals(IO_Type.SuckingDisc_Down) || wait.IoType.Equals(IO_Type.SuckingDisc_Up)))
{
if (!wait.IsEnd && span.TotalSeconds > 1 && (wait.IoType.Equals(IO_Type.SuckingDisc_Down) || wait.IoType.Equals(IO_Type.SuckingDisc_Up)))
{
IO_VALUE doValue = IOManager.DOValue(wait.IoType);
if (!doValue.Equals(wait.IoValue))
{
LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + wait.IoType + "=" + wait.IoValue + ")");
IOManager.IOMove(wait.IoType, wait.IoValue);
}
}
}
}
else if (wait.WaitType == (int)Wait_Type.Time_3)
......@@ -134,7 +134,7 @@ namespace OnlineStore.DeviceLibrary
IO_VALUE value = (IO_VALUE)ACServerManager.GetHomeSingle(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
wait.IsEnd = wait.IoValue.Equals(value);
}
else if (wait.WaitType == (int)Wait_Type.BatchAxisMove_10)
{
wait.IsEnd = BatchAxisIsEnd(wait);
......@@ -146,7 +146,8 @@ namespace OnlineStore.DeviceLibrary
else if (wait.WaitType == (int)Wait_Type.ScanCode_11)
{
wait.IsEnd = (LastCode.Equals("").Equals(false));
}else if (wait.WaitType == (int)Wait_Type.StoreRuning_13)
}
else if (wait.WaitType == (int)Wait_Type.StoreRuning_13)
{
wait.IsEnd = (StoreManager.Store.storeRunStatus.Equals(StoreRunStatus.Runing) && StoreManager.Store.StoreMove.MoveType.Equals(StoreMoveType.None));
}
......@@ -171,12 +172,39 @@ namespace OnlineStore.DeviceLibrary
{
StoreMove.EndStepWait();
}
else if (span.TotalSeconds > StoreMove.TimeOutSeconds )
else if (span.TotalSeconds > StoreMove.TimeOutSeconds)
{
WarnMsg = "[" + StoreMove.MoveStep + "]" + ResourceControl.GetString(ResourceControl.TimeOut, "超时") + " [" + NotOkMsg + "][" + Math.Round(span.TotalSeconds, 0) + "秒]";
LogUtil.error(WarnMsg,102);
LogUtil.error(WarnMsg, 102);
StoreManager.Store.Alarm(StoreAlarmType.BatchIoTimeOut, "", WarnMsg, StoreMove.MoveType);
}
if (!isOk)
{
//重写气缸
foreach (WaitResultInfo wait in list)
{
if (wait.IsEnd.Equals(false) && (wait.WaitType == (int)Wait_Type.IOMove_2))
{
if (!wait.IsEnd && span.TotalSeconds > 1 &&
(wait.IoType.Equals(IO_Type.SuckingDisc_Down) || wait.IoType.Equals(IO_Type.SuckingDisc_Up)))
{
IO_VALUE doValue = IOManager.DOValue(wait.IoType);
if (!doValue.Equals(wait.IoValue))
{
LogUtil.error("等待[" + wait.ToStr() + "],重写DO(" + wait.IoType + "=" + wait.IoValue + ")");
IOManager.IOMove(wait.IoType, wait.IoValue);
string ioType = wait.IoType.Equals(IO_Type.SuckingDisc_Down) ? IO_Type.SuckingDisc_Up : IO_Type.SuckingDisc_Down;
IO_VALUE ioValue = wait.IoValue.Equals(IO_VALUE.LOW) ? IO_VALUE.HIGH : IO_VALUE.LOW;
LogUtil.error("等待[" + wait.ToStr() + "],重写DO(" + ioType + "=" + ioValue + ")");
IOManager.IOMove(ioType, ioValue);
}
}
}
}
}
}
catch (Exception ex)
{
......@@ -261,20 +289,26 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if (AutoBaitingStatus.Equals(StoreRunStatus.Busy) && StoreMove.CanWhileCount > 0)
TimeSpan span = DateTime.Now - AxisResetMoveTime;
if (AutoBaitingStatus.Equals(StoreRunStatus.Busy) && span.TotalSeconds > 3)
//if (AutoBaitingStatus.Equals(StoreRunStatus.Busy) && StoreMove.CanWhileCount > 0)
{
AxisResetMoveTime = DateTime.Now;
//如果批量轴已经停止运动,重新开始
bool isEnd = ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(0);
if (isEnd)
{ //判断是否需要重新运动
StoreMove.CanWhileCount--;
LogUtil.error(wait.ToStr() + "未收到信号且停止运动,重新匀速"+ StoreManager.Config.BatchAxis_SlowSpeed + "运动,剩余[" + StoreMove.CanWhileCount + "]次");
StoreMove.CanWhileCount--;
LogUtil.error(wait.ToStr() + "未收到信号且停止运动,重新匀速" + StoreManager.Config.BatchAxis_SlowSpeed + "运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.SuddenStop(wait.AxisInfo);
Thread.Sleep(300);
ACServerManager.SpeedMove(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue(), StoreManager.Config.BatchAxis_SlowSpeed);
}
}
}
return result;
}
private static DateTime AxisResetMoveTime = DateTime.Now;
#region Halcon扫码枪代码
public bool IsTestCamera = false;
......
......@@ -375,6 +375,8 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(LOGGER, moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大,重新开始运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.SuddenStop(moveAxis);
Thread.Sleep(300);
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
StoreMove.CanWhileCount--;
return false;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!