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;
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
namespace LineSoldering.Common
{
/// <summary>
/// 与Mes连接类
/// </summary>
public class MesUtil
{
/// <summary>
/// 是否需要连接MES
/// </summary>
public static bool NeedConnect = ConfigAppSettings.GetBoolValue(Setting_Init.Mes_IsConnect);
public class MES_RESULT_CODE
{
/// <summary>
/// 正常完成
/// </summary>
public static int OK = 0;
/// <summary>
/// 焊点未达到要求
/// </summary>
public static int Solder_Error = 201;
/// <summary>
/// 铆接压⼒未达到要求
/// </summary>
public static int Rivet_Error = 202;
/// <summary>
/// 锁付扭距未达到要求
/// </summary>
public static int Screw_Error = 203;
}
//Keep Alive 间隔
private static int ALIVE_INTERVAL = 60000;
/// <summary>
/// 接收到MES反馈的二维码结果
/// </summary>
/// <param name="code">二维码</param>
/// <param name="result">为空时表示OK,其他情况为异常(可直接展示到界面上),焊接时所有字段都有值,铆接和锁付时只使用code1</param>
public delegate void CodeResult(string code1, string result1, string code2, string result2);
private static event CodeResult OnCodeResult;
public static void SolderInit(string ip, int port)
{
connect(ip, port, STEP_SOLDER);
}
public static void RivetInit(string ip, int port)
{
connect(ip, port, STEP_RIVET);
}
public static void ScrewInit(string ip, int port)
{
connect(ip, port, STEP_SCREW);
}
public static void Close()
{
timer.Enabled = false;
isStop = true;
if (mesClient != null)
{
//关闭socket
mesClient.close();
}
}
/// <summary>
/// 铆压工艺结果上传
/// </summary>
/// <param name="code">二维码</param>
/// <param name="result">结果,见MesUtil.MES_RESULT_CODE</param>
/// <param name="pressure">扭距值</param>
public static bool UploadScrewResult(string code, RESULT result, List<double> torques)
{
int toMesResult = MES_RESULT_CODE.Screw_Error;
if (RESULT.OK == result)
{
toMesResult = MES_RESULT_CODE.OK;
}
OpData opData = getOpData(code, toMesResult);
int i = 1;
foreach(var torque in torques)
{
opData.addData("TORQUE_" + i, torque);
i++;
}
return sendData(opData);
}
/// <summary>
/// 铆压工艺结果上传
/// </summary>
/// <param name="code">二维码</param>
/// <param name="result">结果,见MesUtil.MES_RESULT_CODE</param>
/// <param name="pressure">压力值</param>
public static bool UploadRivetResult(string code, int result, double pressure)
{
OpData opData = getOpData(code, result);
opData.addData("PRESSURE", pressure);
return sendData(opData);
}
/// <summary>
/// 焊接工艺结果上传
/// </summary>
/// <param name="code">二维码</param>
/// <param name="result">结果,见MesUtil.MES_RESULT_CODE</param>
public static bool UploadSolderResult(string codeLeft, string codeRight, int result)
{
OpData opData = new OpData();
opData.seq = NextSeq();
opData.step = STEP;
opData.op = OP_RESULT;
opData.addData("CODE_C", codeLeft);
opData.addData("CODE_B", codeRight);
opData.addData("RESULT", result);
return sendData(opData);
//OpData opData = getOpData(code,result);
//return sendData(opData);
}
/// <summary>
/// PCB连接板焊接结果上传
/// </summary>
public static bool UploadPCBResult(string code, int result)
{
OpData opData = getOpData(OP_PCB, code, result);
return sendData(opData);
}
/// <summary>
/// 小弹片焊接结果上传
/// </summary>
public static bool UploadSmallPieceResult(string code, int result)
{
OpData opData = getOpData(OP_SmallPiece, code, result);
return sendData(opData);
}
private static OpData getOpData(int op, string code, int result)
{
OpData opData = new OpData();
opData.seq = NextSeq();
opData.step = STEP;
opData.op = op;
opData.addData("CODE", code);
opData.addData("RESULT", result);
return opData;
}
private static OpData getOpData(string code, int result)
{
OpData opData = new OpData();
opData.seq = NextSeq();
opData.step = STEP;
opData.op = OP_RESULT;
opData.addData("CODE", code);
opData.addData("RESULT", result);
return opData;
}
/// <summary>
/// 将二维码发送到MES进行验证(返回结果只表示发送成功与否,具体结果要看回调里面的数据)
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public static bool ConfirmCode(string code, CodeResult OnCodeResult)
{
if (!NeedConnect)
{
OnCodeResult?.Invoke(code, "", "", "");
return true ;
}
MesUtil.OnCodeResult = OnCodeResult;
OpData opData = new OpData();
opData.seq = NextSeq();
opData.step = STEP;
opData.op = OP_CODE;
opData.addData("CODE", code);
return sendData(opData);
//OnCodeResult?.Invoke(code, "", "", "");
//return true;
}
/// <summary>
/// 将二维码发送到MES进行验证(返回结果只表示发送成功与否,具体结果要看回调里面的数据)
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public static bool ConfirmSolderCode(string codeLeft, string codeRight, CodeResult OnCodeResult)
{
if (!NeedConnect)
{
OnCodeResult?.Invoke(codeLeft, "", codeRight, "");
return true;
}
MesUtil.OnCodeResult = OnCodeResult;
OpData opData = new OpData();
opData.seq = NextSeq();
opData.step = STEP;
opData.op = OP_CODE;
opData.addData("CODE_C", codeLeft);
opData.addData("CODE_B", codeRight);
return sendData(opData);
}
private static void OnMessage(string message)
{
try
{
if (message.Contains("op"))
{
LogUtil.info("MES返回数据:" + message);
OpData opData = JsonHelper.DeserializeJsonToObject<OpData>(message);
//条码结果返回
if (OP_CODE == opData.op)
{
string code1 = "";
string code2 = "";
string result1 = "";
string result2 = "";
foreach (KeyValuePair<string, Object> kv in opData.data)
{
if (code1 == "")
{
code1 = kv.Key;
result1 = codeToShowStr(kv.Value.ToString());
}
else if (code2 == "")
{
code2 = kv.Key;
result2 = codeToShowStr(kv.Value.ToString());
}
}
OnCodeResult?.Invoke(code1, result1, code2, result2);
}
}
}catch(Exception ex)
{
LogUtil.error("MES返回结果解析出错:" + message);
}
}
/// <summary>
/// MES返回码转展示字串
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
private static string codeToShowStr(string code)
{
string showStr = code;
switch (code)
{
case "0":
showStr = "";
break;
case "101":
showStr = "条码在MES系统中不存在";
break;
case "102":
showStr = "未完成焊接工艺";
break;
case "103":
showStr = "未完成铆接工艺";
break;
case "104":
showStr = "未完成冲压工艺";
break;
case "1001":
showStr = "已过站";
break;
case "1002":
showStr = "未过站";
break;
case "1003":
showStr = "不在此站";
break;
case "1004":
showStr = "已组装";
break;
case "1005":
showStr = "需要维修";
break;
case "1006":
showStr = "已报废";
break;
case "1007":
showStr = "产品流程异常";
break;
}
return showStr;
}
/// <summary>
/// ⼯艺流程,1=焊接,2=铆接,3=锁付
/// </summary>
private static int STEP_SOLDER = 1;
private static int STEP_RIVET = 2;
private static int STEP_SCREW = 3;
/// <summary>
/// 操作类型,1=条码合法性验证; 2=操作结果上传
/// </summary>
private static int OP_CODE = 1;
private static int OP_RESULT = 2;
/// <summary>
/// PBC连接板焊接结果上传
/// </summary>
private static int OP_PCB= 3;
/// <summary>
/// 小弹片焊接结果上传
/// </summary>
private static int OP_SmallPiece= 4;
class OpData
{
public int seq { get; set; }
public int op { get; set; }
public int step { get; set; }
public Dictionary<string,Object> data { get; set; }
public void addData(string key, Object value)
{
if(data == null)
{
data = new Dictionary<string, object>();
}
data.Add(key, value);
}
}
private static int nextSeq = 100;
/// <summary>
/// 下一个序列号
/// </summary>
/// <returns></returns>
private static int NextSeq()
{
nextSeq = nextSeq + 1;
if (nextSeq >= int.MaxValue)
{
nextSeq = 100;
}
return nextSeq;
}
private static bool sendData(OpData opData)
{
if (!NeedConnect)
{
return true;
}
string json = JsonHelper.SerializeObject(opData);
LogUtil.info("给MES发送数据:" + json);
return sendMsg(json);
}
private static bool sendMsg(string msg)
{
try
{
LogUtil.debug("给MES发送数据:" + msg);
byte[] sendBuffer = new byte[1024];
sendBuffer = Encoding.UTF8.GetBytes(msg + "\r\n");
mesClient.send(msg);
return true;
}
catch(Exception ex)
{
LogUtil.error("给MES发送数据[" + msg+"]出错"+ ex.Message);
Task.Factory.StartNew(delegate() { Reconnect(); });
}
return false;
}
private static int lastAliveTime = 0;
private static void KeepAlive()
{
if (mesClient.IsConnected())
{
if (lastAliveTime % ALIVE_INTERVAL == 0)
{
sendMsg("STEP:"+STEP);
}
}
lastAliveTime = lastAliveTime + 1000;
if (lastAliveTime >= int.MaxValue)
{
lastAliveTime = 0;
}
}
private static void connect(string ip, int port, int step)
{
if(timer!=null&& timer.Enabled)
{
//已经初始化,直接返回
return;
}
if (!NeedConnect)
{
//不需要连接,直接返回
LogUtil.info("Mes不需要连接,直接返回");
return;
}
STEP = step;
IP = ip;
PORT = port;
mesClient = new TcpClient();
mesClient.TimeOutTime = 2000;
mesClient.connect(ip, port, OnMessage);
if (!timer.Enabled)
{
timer.Interval = 1000;
timer.Elapsed += TimerElapsed;
timer.Enabled = true;
}
}
private static void TimerElapsed(object sender, ElapsedEventArgs e)
{
KeepAlive();
if (!mesClient.IsConnected())
{
Reconnect();
}
}
//⼯艺流程,1=焊接,2=铆接,3=锁付
private static int STEP = 0;
private static string IP;
private static int PORT;
private static System.Timers.Timer timer = new System.Timers.Timer();
private static TcpClient mesClient;
/// <summary>
/// 停止连接,并且不再重连
/// </summary>
private static bool isStop = false;
/// <summary>
/// 是否正在连接
/// </summary>
private static bool IsConnecting = false;
/// <summary>
/// 断线重连函数
/// </summary>
private static void Reconnect()
{
if (isStop || IsConnecting)
{
return;
}
IsConnecting = true;
LogUtil.debug("3秒后,关闭连接,进行重连");
Thread.Sleep(3000);
//关闭socket
mesClient.close();
//创建socket
connect(IP, PORT, STEP);
IsConnecting = false;
}
}
}
......@@ -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);
}
......
namespace URSoldering.Client
{
partial class FrmSendWire
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnReset = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.txtPortError = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.btnReadError = new System.Windows.Forms.Button();
this.lblMsg = new System.Windows.Forms.Label();
this.btnCloseForm = new System.Windows.Forms.Button();
this.btnStartBack = new System.Windows.Forms.Button();
this.txtLength = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.btnStartSend = new System.Windows.Forms.Button();
this.txtSpeed = new System.Windows.Forms.TextBox();
this.lblTemp = new System.Windows.Forms.Label();
this.btnSetSold = new System.Windows.Forms.Button();
this.btnCloseSold = new System.Windows.Forms.Button();
this.txtSoldingCom = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.btnOpenSold = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnReset);
this.groupBox1.Controls.Add(this.btnStop);
this.groupBox1.Controls.Add(this.txtPortError);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.btnReadError);
this.groupBox1.Controls.Add(this.lblMsg);
this.groupBox1.Controls.Add(this.btnCloseForm);
this.groupBox1.Controls.Add(this.btnStartBack);
this.groupBox1.Controls.Add(this.txtLength);
this.groupBox1.Controls.Add(this.label10);
this.groupBox1.Controls.Add(this.btnStartSend);
this.groupBox1.Controls.Add(this.txtSpeed);
this.groupBox1.Controls.Add(this.lblTemp);
this.groupBox1.Controls.Add(this.btnSetSold);
this.groupBox1.Controls.Add(this.btnCloseSold);
this.groupBox1.Controls.Add(this.txtSoldingCom);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.btnOpenSold);
this.groupBox1.Location = new System.Drawing.Point(36, 63);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(678, 364);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "送丝测试";
//
// btnReset
//
this.btnReset.Location = new System.Drawing.Point(432, 252);
this.btnReset.Name = "btnReset";
this.btnReset.Size = new System.Drawing.Size(117, 23);
this.btnReset.TabIndex = 299;
this.btnReset.Text = "重置";
this.btnReset.UseVisualStyleBackColor = true;
this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
//
// btnStop
//
this.btnStop.Location = new System.Drawing.Point(392, 198);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(117, 23);
this.btnStop.TabIndex = 298;
this.btnStop.Text = "停止送丝";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// txtPortError
//
this.txtPortError.Location = new System.Drawing.Point(135, 252);
this.txtPortError.Name = "txtPortError";
this.txtPortError.Size = new System.Drawing.Size(142, 21);
this.txtPortError.TabIndex = 297;
this.txtPortError.Text = "0";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(62, 255);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 296;
this.label2.Text = "端口错误:";
//
// btnReadError
//
this.btnReadError.Location = new System.Drawing.Point(296, 252);
this.btnReadError.Name = "btnReadError";
this.btnReadError.Size = new System.Drawing.Size(117, 23);
this.btnReadError.TabIndex = 295;
this.btnReadError.Text = "查询";
this.btnReadError.UseVisualStyleBackColor = true;
this.btnReadError.Click += new System.EventHandler(this.btnReadError_Click_1);
//
// lblMsg
//
this.lblMsg.AutoSize = true;
this.lblMsg.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMsg.ForeColor = System.Drawing.Color.Red;
this.lblMsg.Location = new System.Drawing.Point(65, 315);
this.lblMsg.Name = "lblMsg";
this.lblMsg.Size = new System.Drawing.Size(65, 19);
this.lblMsg.TabIndex = 283;
this.lblMsg.Text = "急停未开";
//
// btnCloseForm
//
this.btnCloseForm.Location = new System.Drawing.Point(449, 315);
this.btnCloseForm.Name = "btnCloseForm";
this.btnCloseForm.Size = new System.Drawing.Size(117, 23);
this.btnCloseForm.TabIndex = 294;
this.btnCloseForm.Text = "返回(&B)";
this.btnCloseForm.UseVisualStyleBackColor = true;
this.btnCloseForm.Click += new System.EventHandler(this.btnCloseForm_Click);
//
// btnStartBack
//
this.btnStartBack.Location = new System.Drawing.Point(392, 149);
this.btnStartBack.Name = "btnStartBack";
this.btnStartBack.Size = new System.Drawing.Size(117, 23);
this.btnStartBack.TabIndex = 291;
this.btnStartBack.Text = "开始向后送丝";
this.btnStartBack.UseVisualStyleBackColor = true;
this.btnStartBack.Click += new System.EventHandler(this.btnStartBack_Click);
//
// txtLength
//
this.txtLength.Location = new System.Drawing.Point(135, 151);
this.txtLength.Name = "txtLength";
this.txtLength.Size = new System.Drawing.Size(101, 21);
this.txtLength.TabIndex = 290;
this.txtLength.Text = "10";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(62, 154);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(65, 12);
this.label10.TabIndex = 289;
this.label10.Text = "设置长度:";
//
// btnStartSend
//
this.btnStartSend.Location = new System.Drawing.Point(392, 97);
this.btnStartSend.Name = "btnStartSend";
this.btnStartSend.Size = new System.Drawing.Size(117, 23);
this.btnStartSend.TabIndex = 288;
this.btnStartSend.Text = "开始向前送丝";
this.btnStartSend.UseVisualStyleBackColor = true;
this.btnStartSend.Click += new System.EventHandler(this.btnStartSend_Click);
//
// txtSpeed
//
this.txtSpeed.Location = new System.Drawing.Point(135, 93);
this.txtSpeed.Name = "txtSpeed";
this.txtSpeed.Size = new System.Drawing.Size(101, 21);
this.txtSpeed.TabIndex = 287;
this.txtSpeed.Text = "10";
//
// lblTemp
//
this.lblTemp.AutoSize = true;
this.lblTemp.Location = new System.Drawing.Point(62, 97);
this.lblTemp.Name = "lblTemp";
this.lblTemp.Size = new System.Drawing.Size(65, 12);
this.lblTemp.TabIndex = 286;
this.lblTemp.Text = "设置速度:";
//
// btnSetSold
//
this.btnSetSold.Location = new System.Drawing.Point(119, 198);
this.btnSetSold.Name = "btnSetSold";
this.btnSetSold.Size = new System.Drawing.Size(117, 23);
this.btnSetSold.TabIndex = 285;
this.btnSetSold.Text = "设置";
this.btnSetSold.UseVisualStyleBackColor = true;
this.btnSetSold.Click += new System.EventHandler(this.btnSetSold_Click);
//
// btnCloseSold
//
this.btnCloseSold.Location = new System.Drawing.Point(449, 40);
this.btnCloseSold.Name = "btnCloseSold";
this.btnCloseSold.Size = new System.Drawing.Size(117, 23);
this.btnCloseSold.TabIndex = 284;
this.btnCloseSold.Text = "关闭";
this.btnCloseSold.UseVisualStyleBackColor = true;
this.btnCloseSold.Click += new System.EventHandler(this.btnCloseSold_Click);
//
// txtSoldingCom
//
this.txtSoldingCom.Location = new System.Drawing.Point(135, 40);
this.txtSoldingCom.Name = "txtSoldingCom";
this.txtSoldingCom.Size = new System.Drawing.Size(101, 21);
this.txtSoldingCom.TabIndex = 282;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(74, 45);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(53, 12);
this.label8.TabIndex = 281;
this.label8.Text = "串口号:";
//
// btnOpenSold
//
this.btnOpenSold.Location = new System.Drawing.Point(296, 39);
this.btnOpenSold.Name = "btnOpenSold";
this.btnOpenSold.Size = new System.Drawing.Size(117, 23);
this.btnOpenSold.TabIndex = 280;
this.btnOpenSold.Text = "打开";
this.btnOpenSold.UseVisualStyleBackColor = true;
this.btnOpenSold.Click += new System.EventHandler(this.btnOpenSold_Click);
//
// FrmSendWire
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(750, 450);
this.Controls.Add(this.groupBox1);
this.Name = "FrmSendWire";
this.Text = "送丝机调试";
this.Load += new System.EventHandler(this.FrmSendWire_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox txtPortError;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnReadError;
private System.Windows.Forms.Label lblMsg;
private System.Windows.Forms.Button btnCloseForm;
private System.Windows.Forms.Button btnStartBack;
private System.Windows.Forms.TextBox txtLength;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Button btnStartSend;
private System.Windows.Forms.TextBox txtSpeed;
private System.Windows.Forms.Label lblTemp;
private System.Windows.Forms.Button btnSetSold;
private System.Windows.Forms.Button btnCloseSold;
private System.Windows.Forms.TextBox txtSoldingCom;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Button btnOpenSold;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btnReset;
}
}
\ No newline at end of file
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!