Commit 38d34e00 LN

1

1 个父辈 3547a0c6
using ABB.Robotics.Controllers;
using ABB.Robotics.Controllers.Discovery;
using ABB.Robotics.Controllers.IOSystemDomain;
using ABB.Robotics.Controllers.RapidDomain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ABBRobotTest
{
public class ABBRobotManager
{
private NetworkScanner scanner = null;
// private Controller controller = null;
private Task[] tasks = null;
private NetworkWatcher networkwatcher = null;
private Dictionary<string, Controller> controllerMap = new Dictionary<string, Controller>();
public void LoadController()
{
this.scanner = new NetworkScanner();
this.scanner.Scan();
ControllerInfoCollection controllers = scanner.Controllers;
int i = 0;
foreach (ControllerInfo controllerInfo in controllers)
{
Controller con = ControllerFactory.CreateFrom(controllerInfo);
con.Logon(UserInfo.DefaultUser);
ControllerState state = con.State;
controllerMap.Add(con.IPAddress.ToString(), con);
// controller = con;
i++;
}
this.networkwatcher = new NetworkWatcher(scanner.Controllers);
this.networkwatcher.Found += new EventHandler<NetworkWatcherEventArgs>(HandleFoundEvent);
this.networkwatcher.Lost += new EventHandler<NetworkWatcherEventArgs>(HandleLostEvent);
this.networkwatcher.EnableRaisingEvents = true;
}
private void HandleLostEvent(object sender, NetworkWatcherEventArgs e)
{
}
private void HandleFoundEvent(object sender, NetworkWatcherEventArgs e)
{
this.Invoke(new
EventHandler<NetworkWatcherEventArgs>(AddControllerToListView),
new Object[] { this, e });
}
private void Invoke(EventHandler<NetworkWatcherEventArgs> eventHandler, object[] v)
{
throw new NotImplementedException();
}
private void AddControllerToListView(object sender, NetworkWatcherEventArgs e)
{
//ControllerInfo controllerInfo = e.Controller; ListViewItem item
// = new ListViewItem(controllerInfo.IPAddress.ToString());
//item.SubItems.Add(controllerInfo.Id); item.SubItems.Add(controllerInfo.Availability.ToString()); item.SubItems.Add(controllerInfo.IsVirtual.ToString()); item.SubItems.Add(controllerInfo.SystemName); item.SubItems.Add(controllerInfo.Version.ToString()); item.SubItems.Add(controllerInfo.ControllerName); this.listView1.Items.Add(item); item.Tag
// = controllerInfo;
}
private void StartRobot(string ip)
{
try
{
Controller controller = GetControllerByIP(ip);
if (controller != null && controller.OperatingMode == ControllerOperatingMode.Auto)
{
tasks = controller.Rapid.GetTasks();
using (Mastership m = Mastership.Request(controller.Rapid))
{
tasks[0].SetProgramPointer("aaa", "main");
controller.State = ControllerState.MotorsOn;
controller.Rapid.Start();
//Perform operation
//tasks[0].Start();
m.Dispose();
}
}
else
{
Console.WriteLine("Automatic mode is required to start execution from a remote client.");
}
}
catch (System.InvalidOperationException ex)
{
Console.WriteLine("Mastership is held by another client." + ex.Message);
}
catch (System.Exception ex)
{
Console.WriteLine("Unexpected error occurred: " + ex.Message);
}
}
private void StopRobot(string ip)
{
try
{
Controller controller = GetControllerByIP(ip);
if (controller != null && controller.OperatingMode == ControllerOperatingMode.Auto)
{
tasks = controller.Rapid.GetTasks();
using (Mastership m = Mastership.Request(controller.Rapid))
{
//tasks[0].SetProgramPointer("aaa", "main");
//controller.State = ControllerState.MotorsOn;
//controller.Rapid.Start();
//Perform operation
//tasks[0].Start();
controller.Rapid.Stop();
m.Dispose();
}
}
else
{
Console.WriteLine("Automatic mode is required to start execution from a remote client.");
}
}
catch (System.InvalidOperationException ex)
{
Console.WriteLine("Mastership is held by another client." + ex.Message);
}
catch (System.Exception ex)
{
Console.WriteLine("Unexpected error occurred: " + ex.Message);
}
}
private void SetRobotSignal(string ip, string name)
{
Controller controller = GetControllerByIP(ip);
if (controller != null)
{
// string name = comboBox1.Text;
Signal singalValue = controller.IOSystem.GetSignal(name);
DigitalSignal digitalSig = (DigitalSignal)singalValue;
digitalSig.Set();
}
}
private void ResetRobotSignal(string ip, string name)
{
Controller controller = GetControllerByIP(ip);
if (controller != null)
{
//string name = comboBox1.Text;
Signal singalValue = controller.IOSystem.GetSignal(name);
DigitalSignal digitalSig = (DigitalSignal)singalValue;
digitalSig.Reset();
}
}
public string GetRobotState(string ip)
{
Controller controller = GetControllerByIP(ip);
if (controller != null)
{
ControllerState state = controller.State;
return state.ToString();
}
return "";
}
private Controller GetControllerByIP(string ip)
{
if (controllerMap.ContainsKey(ip))
{
return controllerMap[ip];
}
return null;
}
private void DisposeControllers()
{
foreach (Controller con in controllerMap.Values)
{
con.Logoff();
con.Dispose();
}
controllerMap.Clear();
}
}
}
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ABBRobotTest
{
public class ABBRobotServer
{
private static TcpServer tcpserver = null;
public static bool IsStart = false;
private static int ClientKeepSecond = 10;
private static int ServerPort = 21;
public static string ErrorInfo = "";
private static string MoveOK = "point ok";
private static string FreeOK = "free ok";
private static string LockOK = "lock ok";
private static string MoveCMD_1 = "move";
private static string MoveCMD_2 = "move2";
public static Dictionary<string, Client> ClientMap = new Dictionary<string, Client>();
//最后一次软件控制移动到的位置
public static string LastSendPoint = "";
public delegate void OpEnd(string result);
private static event OpEnd OnMoveEnd;
private static object LockObj = new object();
public static void StartServer(int port)
{
if (!IsStart)
{
ClientMap = new Dictionary<string, Client>();
if (tcpserver == null)
{
tcpserver = new TcpServer();
}
IsStart = true;
tcpserver.Start(port);
LogUtil.info( "ABBRobotServer在端口[" + port + "]监听!");
tcpserver.ReviceMsgEvent += tcp_ReviceMsgEvent;
}
}
public static void StopServer()
{
try
{
if (IsStart)
{
IsStart = false;
tcpserver.Stop();
}
}
catch (Exception ex)
{
LogUtil.error("关闭 监听出错:" + ex.ToString());
}
}
private static void tcp_ReviceMsgEvent(Client client, string msg)
{
try
{
if (String.IsNullOrEmpty(msg))
{
return;
}
ProcessMsg(client, msg);
}
catch (Exception ex)
{
LogUtil.error("处理料仓消息【" + msg + "】出错:" + ex.ToString());
}
}
private static bool ProcessMsg(Client client, string msg)
{
IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint;
string add = clientipe.Address.ToString();
// string[] msgArray = msg.Split(cmd_spilt);
msg = msg.Replace("\r", "");
LogUtil.debug("收到【" + add + "】的消息【" + msg + "】");
if (msg.ToUpper().Contains("ERROR"))
{
}else if(msg.ToUpper().Contains("MOVE")&& msg.ToUpper().Contains("OK"))
{
OnMoveEnd?.Invoke(msg);
}
else if (msg.ToUpper().Contains("MOVE2") && msg.ToUpper().Contains("OK"))
{
OnMoveEnd?.Invoke(msg);
}
return false;
}
public static void MoveTo(string robotIp, string PointName, string moveType="L" , double targetSpeed = 100, OpEnd AfterMove = null)
{
ABBRobotServer.OnMoveEnd = AfterMove;
SendMovePoint(robotIp, MoveCMD_1,PointName,moveType,targetSpeed.ToString());
}
public static void Move2To(string robotIp, string PointName, string moveType = "L", double targetSpeed = 100, OpEnd AfterMove = null)
{
ABBRobotServer.OnMoveEnd = AfterMove;
SendMovePoint(robotIp, MoveCMD_2, PointName, moveType, targetSpeed.ToString());
}
private static void SendMovePoint(string robotIp, string param1,string param2,string param3,string param4)
{
lock (LockObj)
{
if (ClientMap.ContainsKey(robotIp))
{
Client client = ClientMap[robotIp];
string str = param1 + "," + param2 + "," + param3 + "," + param4+"\r\n";
LastSendPoint = param2;
SendStrToClient(client, str);
}
}
}
private static bool SendStrToClient(Client client, string sendMsg)
{
if (client != null && client.ClientSocket.Connected)
{
byte[] sendBuffer = new byte[1024];
sendBuffer = Encoding.UTF8.GetBytes(sendMsg);
client.ClientSocket.Send(sendBuffer);
return true;
}
return false;
}
}
}
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ABBRobotServer.cs" />
<Compile Include="ABBRobotManager.cs" />
<Compile Include="FrmRobotTest.cs"> <Compile Include="FrmRobotTest.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -88,5 +90,11 @@ ...@@ -88,5 +90,11 @@
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\source\Common\Common.csproj">
<Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project>
<Name>Common</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file \ No newline at end of file
此文件类型无法预览
此文件类型无法预览
...@@ -174,26 +174,20 @@ namespace OnlineStore.AssemblyLine ...@@ -174,26 +174,20 @@ namespace OnlineStore.AssemblyLine
private void FrmStoreIOStatus_Load(object sender, EventArgs e) private void FrmStoreIOStatus_Load(object sender, EventArgs e)
{ {
chbDebug.Checked = feedEquip.IsDebug; chbDebug.Checked = feedEquip.IsDebug;
if (feedEquip.UpdownUseAxis)
{ portName = feedEquip.Config.Batch_Axis.DeviceName;
portName = feedEquip.Config.Batch_Axis.DeviceName; SlvAddr = feedEquip.Config.Batch_Axis.GetAxisValue();
SlvAddr = feedEquip.Config.Batch_Axis.GetAxisValue(); txtAxisDeviceName.Text = portName;
txtAxisDeviceName.Text = portName; txtSlaveId.Text = SlvAddr.ToString();
txtSlaveId.Text = SlvAddr.ToString(); comboBox1.Items.Clear();
comboBox1.Items.Clear(); comboBox1.Items.Add(feedEquip.Config.Batch_Axis.Explain);
comboBox1.Items.Add(feedEquip.Config.Batch_Axis.Explain); comboBox1.SelectedIndex = 0;
comboBox1.SelectedIndex = 0; txtAxisValue.Text = SlvAddr.ToString();
txtAxisValue.Text = SlvAddr.ToString();
}
else
{
tabControl1.TabPages.Remove(tabPage2);
}
cmbSizeList.Items.Clear(); cmbSizeList.Items.Clear();
cmbSizeList.Items.Add("0=默认位置"); cmbSizeList.Items.Add("0=默认位置");
for(int i = 8; i <= 48; i = i + 4) for (int i = 8; i <= 48; i = i + 4)
{ {
cmbSizeList.Items.Add(i.ToString()); cmbSizeList.Items.Add(i.ToString());
} }
...@@ -593,7 +587,7 @@ namespace OnlineStore.AssemblyLine ...@@ -593,7 +587,7 @@ namespace OnlineStore.AssemblyLine
private void btnAxisOn_Click(object sender, EventArgs e) private void btnAxisOn_Click(object sender, EventArgs e)
{ {
this.Enabled = false; this.Enabled = false;
feedEquip.RunAxis(false); feedEquip.RunAxis(false,feedEquip.Config.Batch_Axis);
this.Enabled = true; this.Enabled = true;
LogUtil.info("伺服运转ON完成"); LogUtil.info("伺服运转ON完成");
} }
......
...@@ -186,7 +186,7 @@ namespace OnlineStore.AssemblyLine ...@@ -186,7 +186,7 @@ namespace OnlineStore.AssemblyLine
private void FrmStoreIOStatus_Load(object sender, EventArgs e) private void FrmStoreIOStatus_Load(object sender, EventArgs e)
{ {
chbDebug.Checked = moveEquip.IsDebug; chbDebug.Checked = moveEquip.IsDebug;
if (moveEquip.UpdownUseAxis) if (moveEquip.UseAxis)
{ {
portName = moveEquip.Config.UpDown_Axis.DeviceName; portName = moveEquip.Config.UpDown_Axis.DeviceName;
SlvAddr = moveEquip.Config.UpDown_Axis.GetAxisValue(); SlvAddr = moveEquip.Config.UpDown_Axis.GetAxisValue();
...@@ -605,7 +605,7 @@ namespace OnlineStore.AssemblyLine ...@@ -605,7 +605,7 @@ namespace OnlineStore.AssemblyLine
private void btnAxisOn_Click(object sender, EventArgs e) private void btnAxisOn_Click(object sender, EventArgs e)
{ {
this.Enabled = false; this.Enabled = false;
moveEquip.RunAxis(false); moveEquip.RunAxis(false,moveEquip.Config.UpDown_Axis);
this.Enabled = true; this.Enabled = true;
LogUtil.info("伺服运转ON完成"); LogUtil.info("伺服运转ON完成");
} }
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
<Compile Include="deviceLibrary\PanasonicServo\ACCMDManager.cs" /> <Compile Include="deviceLibrary\PanasonicServo\ACCMDManager.cs" />
<Compile Include="deviceLibrary\PanasonicServo\ACServerManager.cs" /> <Compile Include="deviceLibrary\PanasonicServo\ACServerManager.cs" />
<Compile Include="deviceLibrary\PanasonicServo\ACServerManager_Partial.cs" /> <Compile Include="deviceLibrary\PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="model\EquipBase.cs" />
<Compile Include="model\LineAlarm.cs"> <Compile Include="model\LineAlarm.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
......
...@@ -13,13 +13,5 @@ PRO,0,批量上料轴原点低速度,BatchAxis_HomeLowSpeed,100,,,,, ...@@ -13,13 +13,5 @@ PRO,0,批量上料轴原点低速度,BatchAxis_HomeLowSpeed,100,,,,,
PRO,0,批量上料轴原点高速,BatchAxis_HomeHighSpeed,200,,,,, PRO,0,批量上料轴原点高速,BatchAxis_HomeHighSpeed,200,,,,,
PRO,0,批量上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,, PRO,0,批量上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,
,,,,,,,,, ,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,2,COM1,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,,
PRO,0,移栽上下轴减速度,UpdownAxis_DelSpeed,400,,,,,
PRO,0,移栽上下轴原点低速度,UpdownAxis_HomeLowSpeed,100,,,,,
PRO,0,移栽上下轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,,
PRO,0,移栽上下轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,,
,,,,,,,,, ,,,,,,,,,
PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,, PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义 类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,, PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,阻挡气缸控制信号(1-4分别对应夹具检测1-4),StopCylinderIOType,1,,,,, ,,,,,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,0,,,,, PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,0,,,,,
PRO,0,移栽上下移动料盘高度对应的上升位置,UpDownPositions,12=1000;16=1300;20=2000;24=2000;36=3000;,,,,,, PRO,0,移栽上下移动料盘高度对应的上升位置,UpDownPositions,12=1000;16=1300;20=2000;24=2000;36=3000;,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,2,COM1,0,,, ,,,,,,,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,, AXIS,0,批量上料轴,Batch_Axis,2,COM1,0,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,, PRO,0,批量上料轴待机点 P1,BatchAxisP1,2000,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,, PRO,0,批量上料轴目标速度,BatchAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴减速度,UpdownAxis_DelSpeed,400,,,,, PRO,0,批量上料轴加速度,BatchAxis_AddSpeed,400,,,,,
PRO,0,移栽上下轴原点低速度,UpdownAxis_HomeLowSpeed,100,,,,, PRO,0,批量上料轴减速度,BatchAxis_DelSpeed,400,,,,,
PRO,0,移栽上下轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,, PRO,0,批量上料轴原点低速度,BatchAxis_HomeLowSpeed,100,,,,,
PRO,0,移栽上下轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,, PRO,0,批量上料轴原点高速,BatchAxis_HomeHighSpeed,200,,,,,
PRO,0,批量上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,
,,,,,,,,,
,,,,,,,,,
PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义 类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,, PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,阻挡气缸控制信号(1-4分别对应夹具检测1-4),StopCylinderIOType,1,,,,, ,,,,,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,0,,,,, PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,0,,,,,
PRO,0,移栽上下移动料盘高度对应的上升位置,UpDownPositions,12=1000;16=1300;20=2000;24=2000;36=3000;,,,,,, PRO,0,移栽上下移动料盘高度对应的上升位置,UpDownPositions,12=1000;16=1300;20=2000;24=2000;36=3000;,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,2,COM1,0,,, ,,,,,,,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,, AXIS,0,批量上料轴,Batch_Axis,2,COM1,0,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,, PRO,0,批量上料轴待机点 P1,BatchAxisP1,2000,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,, PRO,0,批量上料轴目标速度,BatchAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴减速度,UpdownAxis_DelSpeed,400,,,,, PRO,0,批量上料轴加速度,BatchAxis_AddSpeed,400,,,,,
PRO,0,移栽上下轴原点低速度,UpdownAxis_HomeLowSpeed,100,,,,, PRO,0,批量上料轴减速度,BatchAxis_DelSpeed,400,,,,,
PRO,0,移栽上下轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,, PRO,0,批量上料轴原点低速度,BatchAxis_HomeLowSpeed,100,,,,,
PRO,0,移栽上下轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,, PRO,0,批量上料轴原点高速,BatchAxis_HomeHighSpeed,200,,,,,
PRO,0,批量上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,
,,,,,,,,,
,,,,,,,,,
PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义 类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,, PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,阻挡气缸控制信号(1-4分别对应夹具检测1-4),StopCylinderIOType,1,,,,, ,,,,,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,, PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,0,,,,,
PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,,, PRO,0,移栽上下移动料盘高度对应的上升位置,UpDownPositions,12=1000;16=1300;20=2000;24=2000;36=3000;,,,,,
PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,,, ,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,1,COM1,1,,, AXIS,0,批量上料轴,Batch_Axis,2,COM1,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,, PRO,0,批量上料轴待机点 P1,BatchAxisP1,2000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,, PRO,0,批量上料轴目标速度,BatchAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,, PRO,0,批量上料轴加速度,BatchAxis_AddSpeed,400,,,,,
PRO,0,移栽上下轴减速度,UpdownAxis_DelSpeed,400,,,,, PRO,0,批量上料轴减速度,BatchAxis_DelSpeed,400,,,,,
PRO,0,移栽上下轴原点低速度,UpdownAxis_HomeLowSpeed,100,,,,, PRO,0,批量上料轴原点低速度,BatchAxis_HomeLowSpeed,100,,,,,
PRO,0,移栽上下轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,, PRO,0,批量上料轴原点高速,BatchAxis_HomeHighSpeed,200,,,,,
PRO,0,移栽上下轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,, PRO,0,批量上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,
PRO,0,移栽上下轴下降速度,UpdownAxis_DownSpeed,500,,,,, ,,,,,,,,,
PRO,0,移栽上下轴走到待机点速度,UpdownAxis_P1Speed,400,,,,, ,,,,,,,,,
PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
...@@ -11,158 +11,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -11,158 +11,10 @@ namespace OnlineStore.DeviceLibrary
{ {
partial class MoveEquip partial class MoveEquip
{ {
/// <summary>
/// 上一个盘号
/// </summary>
internal int preTrayNum = 0;
/// <summary>
/// 当前正在通过的托盘号
/// </summary>
private int currMoveTrayNum = 0;
private DateTime preRWTime = DateTime.Now;
private void CheckWait(LineMoveInfo moveInfo)
{
List<WaitResultInfo> list = moveInfo.WaitList;
if (list.Count <= 0)
{
moveInfo.EndStepWait();
return;
}
//当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - moveInfo.LastSetpTime;
string NotOkMsg = "";
bool isOk = true;
if (moveInfo.OneWaitCanEndStep)
{
isOk = false;
}
foreach (WaitResultInfo wait in list)
{
if (wait.IsEnd)
{
continue;
}
NotOkMsg = wait.ToStr();
if (wait.WaitType.Equals(1))
{
string msg = "";
if (wait.IsHomeMove)
{
wait.IsEnd = ACHomeMoveIsEnd(wait.AxisInfo, out msg);
}
else
{
wait.IsEnd = ACAxisMoveIsEnd(wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
}
if (!msg.Equals(""))
{
isOk = false;
WarnMsg = msg;
Alarm(LineAlarmType.AxisMoveError, 5.ToString(), WarnMsg, moveInfo.MoveType);
break;
}
}
else if (wait.WaitType.Equals(2))
{
NotOkMsg = " (" + Config.GetDisplayName(wait.IoType) + "=" + wait.IoValue + ") ";
wait.IsEnd = IOValue(wait.IoType).Equals(wait.IoValue);
if (!wait.IsEnd)
{
//屏蔽料盘检测信号
if (wait.IoType.Equals(IO_Type.TrayCheck) && wait.IoValue.Equals(IO_VALUE.HIGH) && LineManager.Config.IsUse_Tray_Check.Equals(0))
{
LogUtil.debug(moveInfo.Name + "未检测到:IsUse_Tray_Check= " + wait.IoValue + ",直接跳过检测继续下一步");
}
//夹紧按钮若果超过一秒钟还未收到,默认成功
else if (wait.IoType.Equals(IO_Type.ClampCylinder_Slack) && wait.IoValue.Equals(IO_VALUE.HIGH) && span.TotalMilliseconds > 4000)
{
LogInfo("未检测到:ClampCylinder_Slack=HIGH,超过4秒钟,默认下一步骤");
wait.IsEnd = true;
}
else
{
TimeSpan rwSpan = DateTime.Now - preRWTime;
//一分钟还未检测到
if (span.TotalMilliseconds > LineManager.Config.IOSingle_TimerOut)
{
ConfigIO io = Config.getWaitIO(wait.IoType);
WarnMsg = Name + "等待" + NotOkMsg + " 超时";
Alarm(LineAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, MoveInfo.MoveType);
LogUtil.error(MoveInfo.Name + WarnMsg, 13);
}
else if (rwSpan.TotalSeconds > 3 && span.TotalSeconds > 3)
{
preRWTime = DateTime.Now;
string msg = moveInfo.Name + " " + NotOkMsg + "已等待 " + Math.Abs(span.TotalSeconds) + "秒,重写DO:";
bool isLog = false;
foreach (WaitResultInfo ww in list)
{
if (ww != null && ww.WaitType.Equals(2) && Config.DOList.ContainsKey(ww.IoType))
{
isLog = true;
IOMove(ww.IoType, ww.IoValue);
msg += ww.ToStr() + ",";
}
}
if (isLog)
{
LogUtil.error(msg);
}
}
isOk = false;
break;
}
}
}
else if (wait.WaitType.Equals(3))
{
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}
else if (wait.WaitType.Equals(8))
{
string posId = moveInfo.MoveParam.PosId;
int id = moveInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.RightInPosId(id, posId);
}
else if (wait.WaitType.Equals(9))
{
int storeId = moveInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.BoxCanReviceTray(storeId);
}
else if (wait.WaitType.Equals(10))
{
wait.IsEnd = LineManager.Line.SideWay34HasTray().Equals(false);
}
if (wait.IsEnd && moveInfo.OneWaitCanEndStep)
{
isOk = true;
break;
}
else if (!moveInfo.OneWaitCanEndStep)
{
isOk = false;
break;
}
}
if (isOk)
{
moveInfo.EndStepWait();
}
else if (span.TotalSeconds > moveInfo.TimeOutSeconds)
{
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待[" + NotOkMsg
+ "]超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, 18);
Alarm(LineAlarmType.IoSingleTimeOut, "", WarnMsg, moveInfo.MoveType);
}
}
#region 出库 #region 出库
public override bool StartOutStoreMove(InOutParam param) public override bool StartOutStoreMove(InOutParam param)
{ {
string posId = param != null ? param.PosId : ""; string posId = param != null ? param.PosId : "";
//调试模式移栽装置不需要有操作 //调试模式移栽装置不需要有操作
if (IsDebug) if (IsDebug)
...@@ -807,14 +659,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -807,14 +659,7 @@ namespace OnlineStore.DeviceLibrary
} }
#endregion #endregion
public override void Alarm(LineAlarmType alarmType, string alarmDetial, string alarmMsg, LineMoveType storeMoveType)
{
if (this.alarmType.Equals(alarmType))
{
return;
}
this.alarmType = alarmType;
}
private void CheckLog(string msg) private void CheckLog(string msg)
{ {
LogUtil.debug(Name + msg); LogUtil.debug(Name + msg);
...@@ -831,25 +676,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -831,25 +676,7 @@ namespace OnlineStore.DeviceLibrary
} }
public void CylinderMove(LineMoveInfo moveInfo, string IoLowType, string IoHighType)
{
IOMove(IoLowType, IO_VALUE.LOW);
IOMove(IoHighType, IO_VALUE.HIGH);
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoLowType, IO_VALUE.LOW));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH));
}
}
public void IOMove(string IoType, IO_VALUE value)
{
IOManager.IOMove(IoType, value, Config.Id);
}
public IO_VALUE IOValue(string IoType)
{
return IOManager.IOValue(IoType, Config.Id);
}
public void LogInfo(string logInfo) public void LogInfo(string logInfo)
{ {
LogUtil.info(Name + logInfo); LogUtil.info(Name + logInfo);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!