Commit 8d7a5970 几米阳光

定义UR机器人接口,去掉epson代码

1 个父辈 34145f02
......@@ -23,11 +23,7 @@ namespace URSoldering.Common
}
return false;
}
public static string GetValue(object shuoKe_Control_SerialPort)
{
throw new NotImplementedException();
}
private static int seq = 1;
......
......@@ -86,20 +86,19 @@
<Compile Include="bean\RobotBean.cs" />
<Compile Include="bean\RobotManager.cs" />
<Compile Include="bean\WorkCountManager.cs" />
<Compile Include="deviceLibrary\epson\EpsonControl.cs" />
<Compile Include="deviceLibrary\epson\EpsonRobotDevice.cs" />
<Compile Include="deviceLibrary\halcon\HDevelopCodeLearn.cs" />
<Compile Include="deviceLibrary\halcon\HDevelopExport.cs" />
<Compile Include="deviceLibrary\halcon\UsbCameraHDevelop.cs" />
<Compile Include="deviceLibrary\jbc\SendWireManager.cs" />
<Compile Include="deviceLibrary\jbc\SolderingManager.cs" />
<Compile Include="deviceLibrary\kangnaide\KNDManager.cs" />
<Compile Include="deviceLibrary\kangnaide\MasterTcpClient.cs" />
<Compile Include="deviceLibrary\shuoke\ShuoKeControls.cs" />
<Compile Include="deviceLibrary\urRobot\URRobotControl.cs" />
<Compile Include="deviceLibrary\urRobot\URRobotManager.cs" />
<Compile Include="Robot\MoveType.cs" />
<Compile Include="Robot\soldering\AlarmType.cs" />
<Compile Include="bean\BoardManager.cs" />
<Compile Include="deviceLibrary\kangnaide\KNDManager.cs" />
<Compile Include="deviceLibrary\kangnaide\MasterTcpClient.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Robot\LineSolderingRobot.cs" />
<Compile Include="Robot\LineSolderingRobot_Partial.cs" />
......
......@@ -24,11 +24,8 @@ namespace URSoldering.DeviceLibrary
this.Config = config;
WeldRobotBean.InitData(config);
InitTimer();
EpsonDevice.Init(config.Epson_IP);
////初始化摄像机
//string nameStr = ConfigAppSettings.GetValue(Setting_Init.CameraName);
//string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType);
//HDevelopExport.LoadConfig(nameStr, codeStr);
URRobotControl.InitConfig(config.UR_IP);
}
public bool StartRun()
{
......
......@@ -96,11 +96,14 @@ namespace URSoldering.DeviceLibrary
/// </summary>
public static void Init()
{
//EpsonDevice.InitEpson();
//URRobotControl.InitEpson();
Task.Factory.StartNew(delegate ()
{
string warnMsg = EpsonDevice.Start();
WarnMsg = warnMsg;
bool result = URRobotControl.StartRobot();
if (!result)
{
WarnMsg = "连接UR机器人失败";
}
});
//SendWireManager.Init();
SolderingManager.Init(RobotConfig.JBC_SerialPort, RobotConfig.JBC_EquipmentPort);
......@@ -111,13 +114,17 @@ namespace URSoldering.DeviceLibrary
public static void ResetInit()
{
if (!EpsonDevice.IsRun)
if (!URRobotControl.IsRun)
{
//EpsonDevice.InitEpson();
//URRobotControl.InitEpson();
Task.Factory.StartNew(delegate ()
{
string warnMsg = EpsonDevice.Start();
WarnMsg = warnMsg;
bool result = URRobotControl.StartRobot();
if(!result)
{
WarnMsg = "连接UR机器人失败";
}
});
}
SendWireManager.Init(RobotConfig.JBC_SendWire_Port);
......@@ -147,7 +154,7 @@ namespace URSoldering.DeviceLibrary
ResetInit();
}
Thread.Sleep(1000);
if (!EpsonDevice.IsRun)
if (!URRobotControl.IsRun)
{
Thread.Sleep(2000);
......@@ -165,15 +172,13 @@ namespace URSoldering.DeviceLibrary
LogUtil.info(RobotName + "开始启动:JBC送丝器没有连接上");
return "JBC送丝器没有连接上!";
}
if (EpsonDevice.IsRun)
if (URRobotControl.IsRun)
{
//验证位置
EpsonDevice.GetPosition(AfterGet);
Thread.Sleep(200);
TimeSpan span = EpsonDevice.LastPoint.UpdateTime - DateTime.Now; ;
if (span.TotalSeconds <= 60 && (EpsonDevice.LastPoint.U != 0) && (EpsonDevice.LastPoint.X != 0))
URPointValue lastPoint = URRobotControl.GetLastPosition();
TimeSpan span = lastPoint.UpdateTime - DateTime.Now; ;
if (span.TotalSeconds <= 60 && (lastPoint.Z != 0) && (lastPoint.X != 0))
{
string msg = CheckEpsonPoint(EpsonDevice.LastPoint);
string msg = CheckEpsonPoint(lastPoint);
if (!msg.Equals(""))
{
return msg;
......@@ -185,7 +190,7 @@ namespace URSoldering.DeviceLibrary
//开始运行
alarmType = AlarmType.None;
//锁定轴
EpsonDevice.LockAxis();
URRobotControl.LockAxis();
//InitSendWireSpeed();
......@@ -304,8 +309,7 @@ namespace URSoldering.DeviceLibrary
}
private static DateTime preCheckSendWireTime = DateTime.Now;
private static DateTime lastSendWireOkTime = DateTime.Now;
private static bool ISAlarmAndOk = false;
private static DateTime lastSendWireOkTime = DateTime.Now;
/// <summary>
/// 检测送丝错误
/// </summary>
......@@ -373,8 +377,7 @@ namespace URSoldering.DeviceLibrary
{
LogUtil.info(RobotName + "开始卡丝恢复,重新此焊点的焊接 !");
WeldMoveStep.NextMoveStep(MoveStep.Wait);
}
ISAlarmAndOk = true;
}
lastSendWireOkTime = DateTime.Now;
LogUtil.info(RobotName + "开始卡丝恢复!");
return true;
......@@ -493,7 +496,7 @@ namespace URSoldering.DeviceLibrary
IsNoAir = true;
}
//急停之后需要机械臂重连
EpsonDevice.Stop();
URRobotControl.StopRobot();
//停止所有运行
StopMove();
}
......@@ -529,10 +532,10 @@ namespace URSoldering.DeviceLibrary
{
WeldMoveStep.NextMoveStep(MoveStep.Home_1_RobotMove);
//验证位置
TimeSpan span = EpsonDevice.LastPoint.UpdateTime - DateTime.Now; ;
if (span.TotalSeconds <= 60 && (EpsonDevice.LastPoint.U != 0) && (EpsonDevice.LastPoint.X != 0))
TimeSpan span = URRobotControl.GetLastPosition().UpdateTime - DateTime.Now; ;
if (span.TotalSeconds <= 60 && (URRobotControl.GetLastPosition().Y != 0) && (URRobotControl.GetLastPosition().X != 0))
{
string msg = CheckEpsonPoint(EpsonDevice.LastPoint);
string msg = CheckEpsonPoint(URRobotControl.GetLastPosition());
if (!msg.Equals(""))
{
WarnMsg = msg;
......@@ -593,13 +596,13 @@ namespace URSoldering.DeviceLibrary
{
//SendWireDown();
////判断需要抬起的高度
//double limZ = EpsonDevice.Robot_LIM_Z;
//double limZ = URRobotControl.Robot_LIM_Z;
//double ZValue = p.PositionZ;
//string gaoStr = IsHigh ? "高" : "低";
////WeldLog("移动到焊点【" + WeldMoveStep.CurrPoint.pointName + "】: X:" + p.PositionX + " Y: " + p.PositionY + " U:" + p.PositionU + " Z: " + ZValue + " ,limitZ: " + limZ);
//EpsonDevice.MoveTo(p.PositionX, p.PositionY, ZValue, p.PositionU, isHighSpeed, p.HandDirection, limZ,AfterMove);
//URRobotControl.MoveTo(p.PositionX, p.PositionY, ZValue, p.PositionU, isHighSpeed, p.HandDirection, limZ,AfterMove);
//WeldMoveStep.WaitList.Add(WaitResultInfo.WaitEpson());
}
......@@ -634,18 +637,18 @@ namespace URSoldering.DeviceLibrary
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTime(mSenconds));
if (Clear2Point.X != 0 && Clear2Point.Y != 0 && Clear2Point.Z != 0)
{
double limZ = EpsonDevice.Robot_LIM_Z;
double preZValue = EpsonDevice.LastSendPoint.Z;
if (EpsonDevice.LastSendPoint.UpdateTime < EpsonDevice.LastPoint.UpdateTime)
{
preZValue = EpsonDevice.LastPoint.Z;
}
//double limZ = URRobotControl.Robot_LIM_Z;
//double preZValue = URRobotControl.LastSendPoint.Z;
//if (URRobotControl.LastSendPoint.UpdateTime < URRobotControl.GetLastPosition().UpdateTime)
//{
// preZValue = URRobotControl.GetLastPosition().Z;
//}
//if (preZValue < EpsonClearZ2)
//{
// preZValue = EpsonClearZ2;
//}
limZ = preZValue + 1;
//limZ = preZValue + 1;
WeldLog("机械臂走到清洗点2 ,打开清洗装置,清洗时间:"+mSenconds+" ");
//WeldLog("机械臂走到清洗点2 : X:" + EpsonClearX2 + " Y: " + EpsonClearY2 + " U:" + EpsonClearU2 + " Z: " + EpsonClearZ2 + " ");
URRobotControl.MoveTo(Clear2Point);
......@@ -679,7 +682,7 @@ namespace URSoldering.DeviceLibrary
/// </summary>
/// <param name="point"></param>
/// <returns></returns>
public static string CheckEpsonPoint(PointValue point)
public static string CheckEpsonPoint(URPointValue point)
{
//if (EpsonXMin < EpsonXMax)
//{
......
......@@ -34,7 +34,7 @@ namespace URSoldering.DeviceLibrary
{
return "开始焊接失败:" + WarnMsg;
}
if (EpsonDevice.IsRun == false)
if (URRobotControl.IsRun == false)
{
return "机器人未连接,无法开始焊接";
}
......@@ -406,17 +406,17 @@ namespace URSoldering.DeviceLibrary
}
else if (wait.WaitType == 3)
{
if (EpsonDevice.MoveOKTime() < WeldMoveStep.LastSetpTime)
{
NotOkMsg = "机械臂移动到位";
isOk = false;
break;
}
else if (WeldMoveStep.OneWaitOk)
{
isOk = true;
break;
}
//if (URRobotControl.MoveOKTime() < WeldMoveStep.LastSetpTime)
//{
// NotOkMsg = "机械臂移动到位";
// isOk = false;
// break;
//}
//else if (WeldMoveStep.OneWaitOk)
//{
// isOk = true;
// break;
//}
}
else if (wait.WaitType == 4)
{
......@@ -550,7 +550,7 @@ namespace URSoldering.DeviceLibrary
}
else if (wait.WaitType == 6)
{
if (!EpsonDevice.IsRun)
if (!URRobotControl.IsRun)
{
NotOkMsg = "机器人连接";
isOk = false;
......
{"WorkLogList":[{"WeldCount":0,"WeldPointCount":0,"DayTime":"2018-06-06T23:59:59"},{"WeldCount":129,"WeldPointCount":610,"DayTime":"2018-06-05T23:59:59"},{"WeldCount":155,"WeldPointCount":782,"DayTime":"2018-06-04T23:59:59"},{"WeldCount":151,"WeldPointCount":607,"DayTime":"2018-06-03T23:59:59"},{"WeldCount":126,"WeldPointCount":557,"DayTime":"2018-06-02T23:59:59"},{"WeldCount":118,"WeldPointCount":750,"DayTime":"2018-06-01T23:59:59"},{"WeldCount":133,"WeldPointCount":571,"DayTime":"2018-05-31T23:59:59"},{"WeldCount":202,"WeldPointCount":703,"DayTime":"2018-05-30T23:59:59"},{"WeldCount":188,"WeldPointCount":627,"DayTime":"2018-05-29T23:59:59"},{"WeldCount":156,"WeldPointCount":507,"DayTime":"2018-05-28T23:59:59"},{"WeldCount":239,"WeldPointCount":786,"DayTime":"2018-05-27T23:59:59"},{"WeldCount":167,"WeldPointCount":511,"DayTime":"2018-05-26T23:59:59"},{"WeldCount":139,"WeldPointCount":610,"DayTime":"2018-05-25T23:59:59"},{"WeldCount":110,"WeldPointCount":685,"DayTime":"2018-05-24T23:59:59"},{"WeldCount":134,"WeldPointCount":613,"DayTime":"2018-05-23T23:59:59"},{"WeldCount":120,"WeldPointCount":602,"DayTime":"2018-05-22T23:59:59"},{"WeldCount":201,"WeldPointCount":690,"DayTime":"2018-05-21T23:59:59"},{"WeldCount":208,"WeldPointCount":742,"DayTime":"2018-05-20T23:59:59"},{"WeldCount":100,"WeldPointCount":716,"DayTime":"2018-05-19T23:59:59"},{"WeldCount":160,"WeldPointCount":737,"DayTime":"2018-05-18T23:59:59"},{"WeldCount":113,"WeldPointCount":674,"DayTime":"2018-05-17T23:59:59"},{"WeldCount":233,"WeldPointCount":694,"DayTime":"2018-05-16T23:59:59"},{"WeldCount":209,"WeldPointCount":517,"DayTime":"2018-05-15T23:59:59"},{"WeldCount":123,"WeldPointCount":724,"DayTime":"2018-05-14T23:59:59"},{"WeldCount":142,"WeldPointCount":586,"DayTime":"2018-05-13T23:59:59"},{"WeldCount":210,"WeldPointCount":717,"DayTime":"2018-05-12T23:59:59"},{"WeldCount":210,"WeldPointCount":706,"DayTime":"2018-05-11T23:59:59"},{"WeldCount":197,"WeldPointCount":780,"DayTime":"2018-05-10T23:59:59"},{"WeldCount":228,"WeldPointCount":730,"DayTime":"2018-05-09T23:59:59"},{"WeldCount":242,"WeldPointCount":517,"DayTime":"2018-05-08T23:59:59"},{"WeldCount":225,"WeldPointCount":618,"DayTime":"2018-05-07T23:59:59"},{"WeldCount":218,"WeldPointCount":608,"DayTime":"2018-05-06T23:59:59"},{"WeldCount":218,"WeldPointCount":700,"DayTime":"2018-05-05T23:59:59"},{"WeldCount":216,"WeldPointCount":788,"DayTime":"2018-05-04T23:59:59"},{"WeldCount":176,"WeldPointCount":736,"DayTime":"2018-05-03T23:59:59"},{"WeldCount":209,"WeldPointCount":526,"DayTime":"2018-05-02T23:59:59"},{"WeldCount":172,"WeldPointCount":577,"DayTime":"2018-05-01T23:59:59"},{"WeldCount":123,"WeldPointCount":580,"DayTime":"2018-04-30T23:59:59"},{"WeldCount":225,"WeldPointCount":504,"DayTime":"2018-04-29T23:59:59"},{"WeldCount":190,"WeldPointCount":540,"DayTime":"2018-04-28T23:59:59"},{"WeldCount":117,"WeldPointCount":594,"DayTime":"2018-04-27T23:59:59"},{"WeldCount":104,"WeldPointCount":595,"DayTime":"2018-04-26T23:59:59"},{"WeldCount":129,"WeldPointCount":650,"DayTime":"2018-04-25T23:59:59"},{"WeldCount":160,"WeldPointCount":685,"DayTime":"2018-04-24T23:59:59"},{"WeldCount":142,"WeldPointCount":504,"DayTime":"2018-04-23T23:59:59"},{"WeldCount":171,"WeldPointCount":614,"DayTime":"2018-04-22T23:59:59"},{"WeldCount":129,"WeldPointCount":651,"DayTime":"2018-04-21T23:59:59"},{"WeldCount":121,"WeldPointCount":699,"DayTime":"2018-04-20T23:59:59"},{"WeldCount":203,"WeldPointCount":601,"DayTime":"2018-04-19T23:59:59"},{"WeldCount":194,"WeldPointCount":719,"DayTime":"2018-04-18T23:59:59"},{"WeldCount":211,"WeldPointCount":607,"DayTime":"2018-04-17T23:59:59"},{"WeldCount":206,"WeldPointCount":559,"DayTime":"2018-04-16T23:59:59"},{"WeldCount":223,"WeldPointCount":799,"DayTime":"2018-04-15T23:59:59"},{"WeldCount":194,"WeldPointCount":562,"DayTime":"2018-04-14T23:59:59"},{"WeldCount":154,"WeldPointCount":593,"DayTime":"2018-04-13T23:59:59"},{"WeldCount":219,"WeldPointCount":610,"DayTime":"2018-04-12T23:59:59"},{"WeldCount":242,"WeldPointCount":535,"DayTime":"2018-04-11T23:59:59"},{"WeldCount":190,"WeldPointCount":767,"DayTime":"2018-04-10T23:59:59"},{"WeldCount":198,"WeldPointCount":597,"DayTime":"2018-04-09T23:59:59"},{"WeldCount":205,"WeldPointCount":617,"DayTime":"2018-04-08T23:59:59"},{"WeldCount":134,"WeldPointCount":782,"DayTime":"2018-04-07T23:59:59"},{"WeldCount":248,"WeldPointCount":648,"DayTime":"2018-04-06T23:59:59"},{"WeldCount":187,"WeldPointCount":582,"DayTime":"2018-04-05T23:59:59"},{"WeldCount":205,"WeldPointCount":629,"DayTime":"2018-04-04T23:59:59"},{"WeldCount":160,"WeldPointCount":718,"DayTime":"2018-04-03T23:59:59"},{"WeldCount":159,"WeldPointCount":577,"DayTime":"2018-04-02T23:59:59"},{"WeldCount":142,"WeldPointCount":783,"DayTime":"2018-04-01T23:59:59"},{"WeldCount":161,"WeldPointCount":751,"DayTime":"2018-03-31T23:59:59"},{"WeldCount":249,"WeldPointCount":775,"DayTime":"2018-03-30T23:59:59"},{"WeldCount":249,"WeldPointCount":683,"DayTime":"2018-03-29T23:59:59"},{"WeldCount":217,"WeldPointCount":636,"DayTime":"2018-03-28T23:59:59"},{"WeldCount":169,"WeldPointCount":559,"DayTime":"2018-03-27T23:59:59"},{"WeldCount":166,"WeldPointCount":745,"DayTime":"2018-03-26T23:59:59"},{"WeldCount":105,"WeldPointCount":763,"DayTime":"2018-03-25T23:59:59"},{"WeldCount":121,"WeldPointCount":533,"DayTime":"2018-03-24T23:59:59"},{"WeldCount":116,"WeldPointCount":632,"DayTime":"2018-03-23T23:59:59"},{"WeldCount":171,"WeldPointCount":783,"DayTime":"2018-03-22T23:59:59"},{"WeldCount":211,"WeldPointCount":719,"DayTime":"2018-03-21T23:59:59"},{"WeldCount":182,"WeldPointCount":701,"DayTime":"2018-03-20T23:59:59"},{"WeldCount":163,"WeldPointCount":736,"DayTime":"2018-03-19T23:59:59"},{"WeldCount":173,"WeldPointCount":665,"DayTime":"2018-03-18T23:59:59"},{"WeldCount":152,"WeldPointCount":527,"DayTime":"2018-03-17T23:59:59"},{"WeldCount":161,"WeldPointCount":730,"DayTime":"2018-03-16T23:59:59"},{"WeldCount":154,"WeldPointCount":501,"DayTime":"2018-03-15T23:59:59"},{"WeldCount":221,"WeldPointCount":730,"DayTime":"2018-03-14T23:59:59"},{"WeldCount":167,"WeldPointCount":758,"DayTime":"2018-03-13T23:59:59"},{"WeldCount":112,"WeldPointCount":763,"DayTime":"2018-03-12T23:59:59"},{"WeldCount":205,"WeldPointCount":503,"DayTime":"2018-03-11T23:59:59"},{"WeldCount":145,"WeldPointCount":773,"DayTime":"2018-03-10T23:59:59"},{"WeldCount":193,"WeldPointCount":541,"DayTime":"2018-03-09T23:59:59"},{"WeldCount":149,"WeldPointCount":620,"DayTime":"2018-03-08T23:59:59"},{"WeldCount":182,"WeldPointCount":711,"DayTime":"2018-03-07T23:59:59"},{"WeldCount":222,"WeldPointCount":577,"DayTime":"2018-03-06T23:59:59"},{"WeldCount":128,"WeldPointCount":556,"DayTime":"2018-03-05T23:59:59"},{"WeldCount":199,"WeldPointCount":611,"DayTime":"2018-03-04T23:59:59"},{"WeldCount":134,"WeldPointCount":512,"DayTime":"2018-03-03T23:59:59"},{"WeldCount":206,"WeldPointCount":798,"DayTime":"2018-03-02T23:59:59"},{"WeldCount":109,"WeldPointCount":508,"DayTime":"2018-03-01T23:59:59"},{"WeldCount":167,"WeldPointCount":573,"DayTime":"2018-02-28T23:59:59"},{"WeldCount":191,"WeldPointCount":770,"DayTime":"2018-02-27T23:59:59"}],"OKCount":1681,"NGCount":125,"StartTime":"2018-04-12T14:31:25.9111109+08:00","TodayOKCount":2,"TodayNGCount":1,"TodayTime":"2018-06-01T11:26:54.2115483+08:00","WeldStartTime":"2018-04-12T14:31:25.9121111+08:00","WeldPointCount":12376,"AlarmCount":600000}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LineSoldering.DeviceLibrary
{
public class ComponentInfo
{
public int id { get; set; }
/// <summary>
/// 名字
/// </summary>
public string name { get; set; }
/// <summary>
/// 预热温度
/// </summary>
public int preheatTemperature { get; set; }
/// <summary>
/// 预热温度上限
/// </summary>
public int preheatTemperatureMax { get; set; }
/// <summary>
/// 预热温度下限
/// </summary>
public int preheatTemperatureMin { get; set; }
/// <summary>
/// 预热时间(秒)
/// </summary>
public double preheatTime { get; set; }
/// <summary>
/// 焊接温度
/// </summary>
public int weldTemperature { get; set; }
/// <summary>
/// 焊接温度上限
/// </summary>
public int weldTemperatureMax { get; set; }
/// <summary>
/// 焊接温度下限
/// </summary>
public int weldTemperatureMin { get; set; }
/// <summary>
/// 焊接时间(秒)
/// </summary>
public double weldTime { get; set; }
/// <summary>
/// 起始送丝速度
/// </summary>
public double startSendWireSpeed { get; set; }
/// <summary>
/// 起始送丝时间(秒)
/// </summary>
public double startSendWireTime { get; set; }
/// <summary>
/// 送丝速度
/// </summary>
public double sendWireSpeed { get; set; }
/// <summary>
/// 送丝时间(秒)
/// </summary>
public double sendWireTime { get; set; }
}
}
using LineSoldering.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace LineSoldering.DeviceLibrary
{
public class LogAnalyzeManager
{
public static List<TempLog> getWeldLog(DateTime startTime, DateTime endTime)
{
//查找文件夹
string dic = Application.StartupPath + @"\logs\temp\";
string[] files = Directory.GetFiles(dic);
List<TempLog> tempList = new List<TempLog>();
List<string> lines = new List<string>();
foreach (string f in files)
{
DateTime time = LogUtil.GetFileTime(f);
DateTime logEndTime = time.AddDays(1);
if (time != null && ((startTime <= time && time <= endTime) || (time <= startTime && startTime <= logEndTime)))
{
//读取文件内容
string[] fileValue = File.ReadAllLines(f);
foreach (string s in fileValue)
{
TempLog log = TempLog.GetLog(s);
if (log != null)
{
if (log.LogTime >= startTime && log.LogTime <= endTime)
{
tempList.Add(log);
lines.Add(s);
}
}
}
}
}
LogUtil.info("查询结果:共【" + tempList.Count + "】条记录");
int i = 1;
return tempList;
}
public static List<BoardLog> getBoardLogList(DateTime startTime, DateTime endTime, BoardInfo board, out List<string> lines)
{
if (board.boardId <= 0)
{
board = null;
}
//查找文件夹
string dic = Application.StartupPath + @"\logs\soldering\";
List<BoardLog> boardLogList = new List<BoardLog>();
string[] files = Directory.GetFiles(dic);
lines = new List<string>();
foreach (string f in files)
{
DateTime time = LogUtil.GetFileTime(f);
DateTime logEndTime = time.AddDays(1);
if (time != null && ((startTime <= time && time <= endTime)||(time<=startTime&&startTime<=logEndTime)))
{
//读取文件内容
string[] fileValue = File.ReadAllLines(f);
foreach (string s in fileValue)
{
BoardLog log = BoardLog.GetLog(s);
if (log != null)
{
if (log.LogTime >= startTime && log.LogTime <= endTime && (board == null || board.boardId <= 0 || log.BoardName.Equals(board.boardName)))
{
List<WeldPointInfo> list = new List<WeldPointInfo>();
if (board == null || board.boardId <= 0)
{
BoardInfo theBorad = BoardManager.getBoardByName(log.BoardName);
if (theBorad != null)
{
list = (from m in theBorad.pointList where m.pointName.Equals(log.BoardPoint) select m).ToList<WeldPointInfo>();
}
}
else
{
list = (from m in board.pointList where m.pointName.Equals(log.BoardPoint) select m).ToList<WeldPointInfo>();
}
if (list != null && list.Count > 0)
{
WeldPointInfo point = list[0];
if (log.PreTemp <= 0)
{
log.PreTemp = point.preheatTemperature;
} if (log.WeldTemp <= 0)
{
log.WeldTemp = point.weldTemperature;
}
if (log.PreSendWire <= 0)
{
log.PreSendWire = point.startSendWireSpeed * point.startSendWireTime;
} if (log.SendWire <= 0)
{
log.SendWire = point.sendWireSpeed * point.sendWireTime;
}
boardLogList.Add(log);
lines.Add(log.ToCSVString());
}
}
}
}
}
}
lines.Insert(0, BoardLog.CSVTitleString());
return boardLogList;
}
}
}
......@@ -53,7 +53,16 @@ namespace URSoldering.DeviceLibrary
public static string WarnMsg = "";
private static System.Timers.Timer reconnectTimer = new System.Timers.Timer();
public static bool InitRobot()
public static void InitConfig(string ip)
{
RobotIp = ip;
}
/// <summary>
/// 开始启动连接机器人
/// </summary>
/// <returns></returns>
public static bool StartRobot()
{
if (reconnectTimer == null)
{
......@@ -70,17 +79,18 @@ namespace URSoldering.DeviceLibrary
}
return StartConnect();
}
public static string Start()
{
return "";
}
private static bool StartConnect()
{
try
{
WarnMsg = "";
if (RobotIp.Equals(""))
{
LogUtil.info("未初始化UR机械臂的IP地址");
return false;
}
if (startCount > 0)
{
TimeSpan span = DateTime.Now - PreStartTime;
......@@ -228,6 +238,9 @@ namespace URSoldering.DeviceLibrary
LogUtil.error("stopTcp出错啦" + ex.ToString());
}
}
/// <summary>
/// 停止机器人,断开连接
/// </summary>
public static void StopRobot()
{
try
......@@ -240,26 +253,31 @@ namespace URSoldering.DeviceLibrary
{
LogUtil.error("StopEpson出错啦" + ex.ToString());
}
}
public static void GetPosition(Action<double, double, double, double, int> afterGet)
{
}
}
/// <summary>
/// 释放所有轴,切换为手移方式
/// </summary>
public static void FreeAxis()
{
}
public static void MoveTo(URPointValue point)
{
}
public static void MoveTo(double x, double y, double z, double rx, double ry, double rz)
/// <summary>
/// 锁定轴,改为程序模式
/// </summary>
public static void LockAxis()
{
}
public static void LockAxis()
/// <summary>
/// 移动到指定的坐标
/// </summary>
/// <param name="point"></param>
public static void MoveTo(URPointValue point)
{
}
/// <summary>
/// 获取机器人最后一次获取的坐标
/// </summary>
/// <returns></returns>
public static URPointValue GetLastPosition()
{
return new URPointValue();
......
此文件类型无法预览
此文件的差异太大,无法显示。
......@@ -29,8 +29,7 @@ namespace URSoldering.Client
private bool isSave = false;
private bool isNew = false;
private BoardInfo updateBoardInfo = null;
private bool isAuto = false;
private bool isConnect = false;
private bool isAuto = false;
private bool isFinishLoad = false;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FrmBoardInfo(BoardInfo board)
......@@ -92,8 +91,7 @@ namespace URSoldering.Client
}
if (URRobotControl.IsRun)
{
URRobotControl.FreeAxis();
isConnect = true;
URRobotControl.FreeAxis();
btnChange.Text = "切换到自动模式(&M)(当前手动)";
RobotStatus(true);
......@@ -267,32 +265,12 @@ namespace URSoldering.Client
private bool isRun = false;
private void timer_Elapsed(object sender, EventArgs e)
{
////判断是否开急停
//if (IOManager.ISConnection().Equals(false))
//{
// lblMsg.Text = "获取不到急停信号";
// if (this.btnSDown.Enabled == true)
// {
// this.btnSDown.Enabled = false;
// this.btnSUp.Enabled = false;
// this.btnWDown.Enabled = false;
// this.btnWUp.Enabled = false;
// }
//}
//else if (IOManager.ShuddenOK().Equals(false))
//{
// lblMsg.Text = "急停未开";
// if (this.btnSDown.Enabled == true)
// {
// this.btnSDown.Enabled = false;
// this.btnSUp.Enabled = false;
// this.btnWDown.Enabled = false;
// this.btnWUp.Enabled = false;
// }
//}
//else
//判断是否开急停
if (RobotBean.KNDIOValue(IO_Type.SuddenStop_Single).Equals(IO_VALUE.LOW))
{
lblMsg.Text = "急停未开";
}
else
{
lblMsg.Text = "";
if (this.btnWUp.Enabled == false)
......@@ -304,8 +282,8 @@ namespace URSoldering.Client
{
Task.Factory.StartNew(delegate ()
{
string result = URRobotControl.Start();
if (result != "")
bool result = URRobotControl.StartRobot();
if (!result)
{
LogUtil.info("连接失败:" + result);
}
......@@ -320,7 +298,7 @@ namespace URSoldering.Client
}
else
{
EpsonControl.FreeAxis();
URRobotControl.FreeAxis();
UpdateRobotPosition();
}
}
......
......@@ -26,12 +26,7 @@ namespace URSoldering.Client
}
private void FrmBoard_Load(object sender, EventArgs e)
{
//if (SProgramManager.programList.Count <= 0)
//{
// MessageBox.Show("请先配置程序!");
// this.Close();
//}
{
LoadCom();
}
private void LoadCom()
......@@ -160,12 +155,7 @@ namespace URSoldering.Client
if (cmbBoardList.Text != "" && cmbBoardList.SelectedIndex >= 0)
{
BoardInfo board = (BoardInfo)cmbBoardList.SelectedItem;
////如果是当前默认程序,不能删除
//if (BoardManager.CurrBoard != null && board.boardId.Equals(BoardManager.CurrBoardId))
//{
// MessageBox.Show("【" + board.boardName + "】是默认焊接程序,不能删除!");
// return;
//}
if (MessageBox.Show("确认要删除程序【" + board.boardName + "】吗?", "删除确认",
MessageBoxButtons.OKCancel,
MessageBoxIcon.Question).Equals(DialogResult.OK))
......
......@@ -41,10 +41,10 @@ namespace URSoldering.Client
private void btnSendWireDebug_Click(object sender, EventArgs e)
{
//FrmShuoKeDebug shuoke = new FrmShuoKeDebug();
//this.Visible = false;
//shuoke.ShowDialog();
//this.Visible = true;
FrmSendWire shuoke = new FrmSendWire();
this.Visible = false;
shuoke.ShowDialog();
this.Visible = true;
}
private void btnConfig_Click(object sender, EventArgs e)
......
......@@ -35,13 +35,13 @@ namespace URSoldering.Client
this.btnProduct = new System.Windows.Forms.Button();
this.btnWelding = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.button2 = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.btnStart = new System.Windows.Forms.Button();
this.btnAutoEdit = new System.Windows.Forms.Button();
this.btnTongji = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.btnCom = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
......@@ -132,6 +132,17 @@ namespace URSoldering.Client
this.panel1.Size = new System.Drawing.Size(861, 453);
this.panel1.TabIndex = 15;
//
// button2
//
this.button2.Location = new System.Drawing.Point(67, 238);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(85, 28);
this.button2.TabIndex = 17;
this.button2.Text = "状态";
this.button2.UseVisualStyleBackColor = true;
this.button2.Visible = false;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// btnStop
//
this.btnStop.Location = new System.Drawing.Point(67, 204);
......@@ -140,6 +151,7 @@ namespace URSoldering.Client
this.btnStop.TabIndex = 16;
this.btnStop.Text = "停止";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Visible = false;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// btnStart
......@@ -150,6 +162,7 @@ namespace URSoldering.Client
this.btnStart.TabIndex = 15;
this.btnStart.Text = "开始";
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Visible = false;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// btnAutoEdit
......@@ -215,16 +228,6 @@ namespace URSoldering.Client
this.btnCom.TabIndex = 5;
this.btnCom.UseVisualStyleBackColor = false;
//
// button2
//
this.button2.Location = new System.Drawing.Point(67, 238);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(85, 28);
this.button2.TabIndex = 17;
this.button2.Text = "状态";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// FrmMenu
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......
......@@ -85,7 +85,7 @@ namespace URSoldering.Client
{
isClick = true;
EpsonDevice.Stop();
URRobotControl.StopRobot();
KNDManager.CloseAllDO();
KNDManager.CloseAllConnection();
SolderingManager.Release();
......@@ -118,7 +118,7 @@ namespace URSoldering.Client
private void btnStart_Click(object sender, EventArgs e)
{
URRobotControl.InitRobot();
URRobotControl.StartRobot();
//URRobotManager.StartListen();
}
......
......@@ -26,8 +26,7 @@ namespace URSoldering.Client
{
public partial class FrmOrgConfig : FrmBase
{
private bool isAuto = false;
private bool isConnect = false;
private bool isAuto = false;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FrmOrgConfig( )
......@@ -72,8 +71,8 @@ namespace URSoldering.Client
{
Task.Factory.StartNew(delegate ()
{
string result = URRobotControl.Start();
if (result != "")
bool result = URRobotControl.StartRobot();
if (!result)
{
LogUtil.info("连接失败:" + result);
}
......
using log4net;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using URSoldering.Common;
using URSoldering.DeviceLibrary;
using URSoldering.LoadCSVLibrary;
namespace URSoldering.Client
{
public partial class FrmSendWire : FrmBase
{
public FrmSendWire()
{
CheckForIllegalCrossThreadCalls = false;
InitializeComponent();
}
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
{
}
private void btnStopSend_Click(object sender, EventArgs e)
{
SendWireManager.StopSend();
}
protected override void OnVisibleChanged(EventArgs e)
{
base.OnVisibleChanged(e);
if (!IsHandleCreated)
{
this.Close();
}
}
private void formStatus(bool isOpen)
{
btnSetSold.Enabled = isOpen;
btnOpenSold.Enabled = !isOpen;
btnCloseSold.Enabled = isOpen;
btnStartSend.Enabled = isOpen;
btnStartSend.Enabled = isOpen;
btnStartBack.Enabled = isOpen;
btnReadError.Enabled = isOpen;
}
private void btnOpenSold_Click(object sender, EventArgs e)
{
if (SendWireManager.Init(WeldRobotBean.RobotConfig.JBC_SendWire_Port))
{
formStatus(true);
}
else
{
MessageBox.Show("打开送丝机失败!");
}
}
private void btnCloseSold_Click(object sender, EventArgs e)
{
SendWireManager.Release();
formStatus(false);
}
private void btnSetSold_Click(object sender, EventArgs e)
{
int speed = FormUtil.GetIntValue(txtSpeed);
int length = FormUtil.GetIntValue(txtLength);
SendWireManager.setLength(length);
SendWireManager.setSpeed(speed);
}
private void btnCloseForm_Click(object sender, EventArgs e)
{
this.Close();
}
private void timer2_Tick(object sender, EventArgs e)
{
if (RobotBean.KNDIOValue(IO_Type.SuddenStop_Single).Equals(IO_VALUE.LOW))
{
lblMsg.Text = "急停未开";
}
else
{
lblMsg.Text = "";
}
}
private void btnReadError_Click(object sender, EventArgs e)
{
int error = SendWireManager.ReadPortError();
txtPortError.Text = error.ToString();
}
private void btnStartSend_Click(object sender, EventArgs e)
{
SendWireManager.StartFSend();
}
private void btnStartBack_Click(object sender, EventArgs e)
{
SendWireManager.StartBSend();
}
private void btnStop_Click(object sender, EventArgs e)
{
SendWireManager.StopSend();
}
private void FrmSendWire_Load(object sender, EventArgs e)
{
txtSoldingCom.Text = WeldRobotBean.RobotConfig.JBC_SendWire_Port;
if (SendWireManager.IsRun)
{
formStatus(true);
}
else
{
formStatus(false);
}
}
private void btnReadError_Click_1(object sender, EventArgs e)
{
int value = SendWireManager.ReadPortError();
txtPortError.Text = value.ToString();
}
private void btnReset_Click(object sender, EventArgs e)
{
SendWireManager.Reset();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -152,7 +152,7 @@ namespace URSoldering.Client
WeldRobotBean.UpdateClear2Point(clear2P);
ConfigAppSettings.SaveValue(Setting_Init.Soldering_LIM_Z, limz.ToString());
EpsonDevice.Robot_LIM_Z = limz;
URRobotControl.Robot_LIM_Z = limz;
ConfigAppSettings.SaveValue(Setting_Init.Default_BoardID, boardId);
BoardManager.UpdateCurrBoard(boardId);
......
......@@ -252,9 +252,9 @@ namespace URSoldering.Client
URPointValue point = URRobotControl.GetLastPosition();
//判断原点的Z轴
if (point.Z > EpsonDevice.Robot_LIM_Z)
if (point.Z > URRobotControl.Robot_LIM_Z)
{
MessageBox.Show("保存失败,焊点Z坐标(" + point.Z + ")不能高于最高Z点(" + EpsonDevice.Robot_LIM_Z + ")");
MessageBox.Show("保存失败,焊点Z坐标(" + point.Z + ")不能高于最高Z点(" + URRobotControl.Robot_LIM_Z + ")");
return;
}
DialogResult result = MessageBox.Show("当前坐标:" +point.ToShowStr()+ ",是否确定更新?", "提示", MessageBoxButtons.YesNo);
......
......@@ -497,14 +497,14 @@ namespace URSoldering.Client
}
return;
}
//如果报警,需要显示报警
bool epsonIsAlarm = EpsonDevice.HasError();
if ((!WeldRobotBean.WarnMsg.Equals("")) || (!epsonIsAlarm))
{
string epsonAlarm = epsonIsAlarm ? "机械臂报警" : "";
lblMsg.ForeColor = Color.Red;
lblMsg.Text = WeldRobotBean.WarnMsg + " " + epsonAlarm;
}
////如果报警,需要显示报警
//bool epsonIsAlarm = URRobotControl.HasError();
//if ((!WeldRobotBean.WarnMsg.Equals("")) || (!epsonIsAlarm))
//{
// string epsonAlarm = epsonIsAlarm ? "机械臂报警" : "";
// lblMsg.ForeColor = Color.Red;
// lblMsg.Text = WeldRobotBean.WarnMsg + " " + epsonAlarm;
//}
if (WeldRobotBean.WeldMoveStep.moveType.Equals(MoveType.GoHome))
{
lblMsg.ForeColor = Color.Green;
......
......@@ -145,6 +145,12 @@
<Compile Include="FrmPwd.Designer.cs">
<DependentUpon>FrmPwd.cs</DependentUpon>
</Compile>
<Compile Include="FrmSendWire.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmSendWire.Designer.cs">
<DependentUpon>FrmSendWire.cs</DependentUpon>
</Compile>
<Compile Include="FrmSolderingSetting.cs">
<SubType>Form</SubType>
</Compile>
......@@ -213,6 +219,9 @@
<EmbeddedResource Include="FrmPwd.resx">
<DependentUpon>FrmPwd.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmSendWire.resx">
<DependentUpon>FrmSendWire.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmSolderingSetting.resx">
<DependentUpon>FrmSolderingSetting.cs</DependentUpon>
</EmbeddedResource>
......@@ -306,8 +315,6 @@
</COMReference>
</ItemGroup>
<ItemGroup>
<Content Include="box_vista_business_disc_128px_544092_easyicon.net.ico" />
<Content Include="DfIcon.ico" />
<Content Include="robot.ico" />
<Content Include="记录.txt" />
</ItemGroup>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!