Commit 447e2211 几米阳光

机器人调试,日志分开打印

1 个父辈 1dcf046d
......@@ -106,13 +106,8 @@ namespace URSoldering.Common
/// 配置文件路径 Data Matrix ECC 200.dcm
/// </summary>
public static string CodeParamPath = "CodeParamPath";
/// <summary>
/// 是否需要连接Mes,1=需要,0不需要
/// </summary>
//public static string Mes_IsConnect = "Mes_IsConnect";
public static string VideoCameraName = "VideoCameraName";
//public static string CodeCameraName = "CodeCameraName";
#endregion
public static string AOIWaitSeconds = "AOIWaitSeconds";
......
......@@ -168,39 +168,29 @@ namespace URSoldering.Common
}
}
private static readonly ILog solderingLog = LogManager.GetLogger("weldInfoAppender");
private static readonly ILog urStatusLog = LogManager.GetLogger("RobotStatusLogAppender");
private static string split = ",";
//public static void SoldPoint(string boardName, string pointName, DateTime startPreTime,DateTime endPreTime,DateTime startWeldTime,
// DateTime endWeldTime)
//{
// solderingLog.Info(DateTime.Now.ToString() + split + boardName + split + pointName + split + startPreTime.ToString()+split+
// endPreTime.ToString()+split+startWeldTime.ToString()+split+endWeldTime.ToString());
//}
public static void SoldPoint(string boardName, string pointName, DateTime startPreTime,DateTime endPreTime,DateTime startWeldTime,
DateTime endWeldTime, int preTemp, double preTime, int weldTemp, double weldTime, double ssendSpeed, double ssendTime, double sendSpeed, double sendTime)
public static void URSInfo(string msg)
{
solderingLog.Info(DateTime.Now.ToString() + split + boardName + split + pointName + split + startPreTime.ToString() + split +
endPreTime.ToString() + split + startWeldTime.ToString() + split + endWeldTime.ToString()+split+preTemp+split+preTime+split+weldTemp+split
+weldTime+split+ssendSpeed+split+ssendTime+split+sendSpeed+split+sendTime);
urStatusLog.Info(msg);
}
private static readonly ILog tempLog = LogManager.GetLogger("tempAppender");
public static void TempLog(string msg)
public static void URSError(string msg)
{
if (msg.Equals("--"))
{
return;
urStatusLog.Error(msg);
}
tempLog.Info(DateTime.Now.ToString() + split + msg);
private static readonly ILog urListenLog = LogManager.GetLogger("RobotListenLogAppender");
public static void URLInfo(string msg)
{
urListenLog.Info(msg);
}
private static readonly ILog boardSoldLog = LogManager.GetLogger("boardSoldAppender");
public static void BoardSolderingLog(string boardName, DateTime startTime, DateTime endTime)
public static void URLError(string msg)
{
boardSoldLog.Info(DateTime.Now.ToString() + split + boardName + split + startTime + split + endTime);
urListenLog.Error(msg);
}
/// <summary>
/// 获取写文件的时间
/// </summary>
......
......@@ -225,7 +225,7 @@ namespace URSoldering.Common
}
else
{
LogUtil.info(LOGGER, "发送数据:" + strSendData);
LogUtil.debug(LOGGER, "发送数据:" + strSendData);
}
strSendData = strSendData + "\r\n";
......
......@@ -19,9 +19,9 @@ namespace URSoldering.Common
public delegate void ByteHandleMessage(byte[] data);
public int DefaultDataLength = 1024;
public int ReviceSleepMS = 100;
private Socket m_clientSocket=null;
private byte[] m_receiveBuffer = new byte[1024];
private Socket m_clientSocket = null;
private byte[] m_receiveBuffer = new byte[1078];
private string LogName = "";
private ByteHandleMessage byteOnReceived;
public int TimeOutTime = 0;
......@@ -39,14 +39,7 @@ namespace URSoldering.Common
{
return true;
}
#region remarks
/********************************************************************************************
* 当Socket.Conneted为false时, 如果您需要确定连接的当前状态,请进行非阻塞、零字节的 Send 调用。
* 如果该调用成功返回或引发 WAEWOULDBLOCK 错误代码 (10035),则该套接字仍然处于连接状态;
* 否则,该套接字不再处于连接状态。
* Depending on http://msdn.microsoft.com/zh-cn/library/system.net.sockets.socket.connected.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2
********************************************************************************************/
#endregion
try
{
#region 过程
......@@ -82,13 +75,12 @@ namespace URSoldering.Common
}
}
//Console.WriteLine("Connected: {0}", client.Connected);
return connectState;
#endregion
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "出错啦" + ex.ToString());
LogUtil.debug(LOGGER, "出错啦" + ex.ToString());
return false;
}
}
......@@ -98,6 +90,7 @@ namespace URSoldering.Common
/// </summary>
public bool connect(string serverIP, int serverPort, ByteHandleMessage byteHandle)
{
LogName = "【" + serverIP + " ," + serverPort + "】";
m_receiveBuffer = new byte[DefaultDataLength];
m_clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
if (TimeOutTime <= 0)
......@@ -113,21 +106,18 @@ namespace URSoldering.Common
if (m_clientSocket.Connected)
{
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
byteOnReceived = byteHandle;
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " success!");
LogUtil.URLInfo("Connect to " + LogName + " success");
return true;
}
else
{
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " fail!");
LogUtil.URLInfo("Connect to " + LogName + " fail");
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "Connect to " + serverIP + ":" + serverPort + " fail!" + ex.ToString(), 3);
LogUtil.URLError("Connect to " + LogName + " error :" + ex.ToString());
//m_clientSocket = null;
}
}
......@@ -139,7 +129,7 @@ namespace URSoldering.Common
connResult.AsyncWaitHandle.WaitOne(this.TimeOutTime, true); //等待2秒
if (!connResult.IsCompleted || (!m_clientSocket.Connected))
{
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " fail!");
LogUtil.URLInfo("Connect to " + LogName + " fail");
m_clientSocket.Close();
//处理连接不成功的动作
return false;
......@@ -153,7 +143,7 @@ namespace URSoldering.Common
{
byteOnReceived = byteHandle;
}
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " success!");
LogUtil.URLInfo("Connect to " + LogName + " success");
return true;
}
}
......@@ -167,20 +157,20 @@ namespace URSoldering.Common
{
try
{
if (m_clientSocket != null&&m_clientSocket.Connected)
if (m_clientSocket != null && m_clientSocket.Connected)
{
m_clientSocket.Shutdown(SocketShutdown.Both);
m_clientSocket.Close();
LogUtil.info(LOGGER, "Socket closed!");
LogUtil.URLInfo(LogName + "Socket closed!");
}
else
{
LogUtil.error(LOGGER, "No socket is running!");
LogUtil.URLInfo(LogName + "No socket is running!");
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "close error :" + ex.ToString());
LogUtil.URLError(LogName + "close error :" + ex.ToString());
}
}
......@@ -203,19 +193,10 @@ namespace URSoldering.Common
/// </summary>
public void sendLine(string strSendData)
{
if (strSendData.StartsWith("save"))
{
LogUtil.debug(LOGGER, "发送数据:" + strSendData);
}
else
{
LogUtil.debug(LOGGER, "发送数据:" + strSendData);
}
LogUtil.info(LOGGER, LogName + "发送数据:" + strSendData);
strSendData = strSendData + "\r\n";
byte[] sendBuffer = new byte[DefaultDataLength];
sendBuffer = Encoding.UTF8.GetBytes(strSendData);
if (m_clientSocket != null && m_clientSocket.Connected)
{
m_clientSocket.Send(sendBuffer);
......@@ -230,9 +211,10 @@ namespace URSoldering.Common
/// <param name="connId">每个客户的会话ID</param>
/// <param name="bytes">缓冲区数据</param>
/// <returns></returns>
private int OnReceive( byte[] bytes)
private int OnReceive(byte[] bytes)
{
try
{
try {
//bytes 为系统缓冲区数据
//bytesRead为系统缓冲区长度
int bytesRead = bytes.Length;
......@@ -270,7 +252,7 @@ namespace URSoldering.Common
int bodySize = BitConverter.ToInt32(headByte, 0);//从包头里面分析出包体的长度
if (bodySize <= 0)
{
LogUtil.error("解析错误:长度:"+bodySize);
LogUtil.error("解析错误:长度:" + bodySize);
}
//这里的 haveRead=等于N个数据包的长度 从0开始;0,1,2,3....N
//如果自定义缓冲区拆解N个包后的长度 大于 总长度,说最后一段数据不够一个完整的包了,拆出来保存
......@@ -284,14 +266,14 @@ namespace URSoldering.Common
else
{
//挨个分解每个包,解析成实际文字
byte[] endArray = surplusBuffer.Skip( haveRead ).Take( bodySize).ToArray();//
byte[] endArray = surplusBuffer.Skip(haveRead).Take(bodySize).ToArray();//
Task.Factory.StartNew(delegate ()
{
byteOnReceived?.Invoke(endArray);
});
//依次累加当前的数据包的长度
haveRead = haveRead + bodySize;
if ( bodySize == bytesRead)//如果当前接收的数据包长度正好等于缓冲区长度,则待拼接的不规则数据长度归0
if (bodySize == bytesRead)//如果当前接收的数据包长度正好等于缓冲区长度,则待拼接的不规则数据长度归0
{
surplusBuffer = null;//设置空 回到原始状态
totalLen = 0;//清0
......@@ -314,11 +296,11 @@ namespace URSoldering.Common
if (m_clientSocket != null && m_clientSocket.Connected)
{
int REnd = m_clientSocket.EndReceive(ar);
OnReceive(m_receiveBuffer);
//Task.Factory.StartNew(delegate ()
//{
// byteOnReceived(m_receiveBuffer);
//});
//OnReceive(m_receiveBuffer);
Task.Factory.StartNew(delegate ()
{
byteOnReceived(m_receiveBuffer);
});
Thread.Sleep(ReviceSleepMS);
//LOGGER.Debug("m_clientSocket:" + m_clientSocket + "\n m_receiveBuffer" + m_receiveBuffer);
//Task.Factory.StartNew(delegate ()
......@@ -329,7 +311,7 @@ namespace URSoldering.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "socket received error:" + ex.ToString(), 4);
LogUtil.URLError(LogName + " socket received error:" + ex.ToString());
}
}
}
......
......@@ -80,6 +80,9 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="URToolKit">
<HintPath>..\dll\URToolKit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="bean\BoardInfo.cs" />
......@@ -94,7 +97,7 @@
<Compile Include="deviceLibrary\kangnaide\KNDManager.cs" />
<Compile Include="deviceLibrary\kangnaide\MasterTcpClient.cs" />
<Compile Include="deviceLibrary\urRobot\URRobotControl.cs" />
<Compile Include="deviceLibrary\urRobot\URRobotManager.cs" />
<Compile Include="deviceLibrary\urRobot\URRobotClient.cs" />
<Compile Include="Robot\MoveType.cs" />
<Compile Include="Robot\soldering\AlarmType.cs" />
<Compile Include="bean\BoardManager.cs" />
......
......@@ -13,10 +13,7 @@ namespace URSoldering.DeviceLibrary
public event GetCode GetCodeFun;
public bool IsAutoRun = false;
private void LineLog(string msg)
{
LogUtil.debug(RobotName + msg);
}
private void BusyProcess()
{
if (LineStep.moveStep.Equals(MoveStep.BUSY01_Weld))
......
{"WorkLogList":[{"WeldCount":0,"WeldPointCount":0,"DayTime":"2018-07-17T23:59:59"},{"WeldCount":152,"WeldPointCount":652,"DayTime":"2018-07-16T23:59:59"},{"WeldCount":208,"WeldPointCount":663,"DayTime":"2018-07-15T23:59:59"},{"WeldCount":170,"WeldPointCount":710,"DayTime":"2018-07-14T23:59:59"},{"WeldCount":211,"WeldPointCount":662,"DayTime":"2018-07-13T23:59:59"},{"WeldCount":106,"WeldPointCount":520,"DayTime":"2018-07-12T23:59:59"},{"WeldCount":150,"WeldPointCount":594,"DayTime":"2018-07-11T23:59:59"},{"WeldCount":117,"WeldPointCount":597,"DayTime":"2018-07-10T23:59:59"},{"WeldCount":201,"WeldPointCount":505,"DayTime":"2018-07-09T23:59:59"},{"WeldCount":146,"WeldPointCount":636,"DayTime":"2018-07-08T23:59:59"},{"WeldCount":234,"WeldPointCount":526,"DayTime":"2018-07-07T23:59:59"},{"WeldCount":163,"WeldPointCount":604,"DayTime":"2018-07-06T23:59:59"},{"WeldCount":232,"WeldPointCount":612,"DayTime":"2018-07-05T23:59:59"},{"WeldCount":195,"WeldPointCount":569,"DayTime":"2018-07-04T23:59:59"},{"WeldCount":184,"WeldPointCount":514,"DayTime":"2018-07-03T23:59:59"},{"WeldCount":147,"WeldPointCount":648,"DayTime":"2018-07-02T23:59:59"},{"WeldCount":106,"WeldPointCount":686,"DayTime":"2018-07-01T23:59:59"},{"WeldCount":147,"WeldPointCount":524,"DayTime":"2018-06-30T23:59:59"},{"WeldCount":244,"WeldPointCount":712,"DayTime":"2018-06-29T23:59:59"},{"WeldCount":240,"WeldPointCount":688,"DayTime":"2018-06-28T23:59:59"},{"WeldCount":116,"WeldPointCount":583,"DayTime":"2018-06-27T23:59:59"},{"WeldCount":231,"WeldPointCount":743,"DayTime":"2018-06-26T23:59:59"},{"WeldCount":161,"WeldPointCount":620,"DayTime":"2018-06-25T23:59:59"},{"WeldCount":181,"WeldPointCount":556,"DayTime":"2018-06-24T23:59:59"},{"WeldCount":187,"WeldPointCount":595,"DayTime":"2018-06-23T23:59:59"},{"WeldCount":120,"WeldPointCount":616,"DayTime":"2018-06-22T23:59:59"},{"WeldCount":151,"WeldPointCount":587,"DayTime":"2018-06-21T23:59:59"},{"WeldCount":204,"WeldPointCount":619,"DayTime":"2018-06-20T23:59:59"},{"WeldCount":149,"WeldPointCount":685,"DayTime":"2018-06-19T23:59:59"},{"WeldCount":175,"WeldPointCount":662,"DayTime":"2018-06-18T23:59:59"},{"WeldCount":207,"WeldPointCount":617,"DayTime":"2018-06-17T23:59:59"},{"WeldCount":205,"WeldPointCount":796,"DayTime":"2018-06-16T23:59:59"},{"WeldCount":216,"WeldPointCount":572,"DayTime":"2018-06-15T23:59:59"},{"WeldCount":109,"WeldPointCount":705,"DayTime":"2018-06-14T23:59:59"},{"WeldCount":223,"WeldPointCount":687,"DayTime":"2018-06-13T23:59:59"},{"WeldCount":168,"WeldPointCount":506,"DayTime":"2018-06-12T23:59:59"},{"WeldCount":203,"WeldPointCount":542,"DayTime":"2018-06-11T23:59:59"},{"WeldCount":211,"WeldPointCount":547,"DayTime":"2018-06-10T23:59:59"},{"WeldCount":233,"WeldPointCount":532,"DayTime":"2018-06-09T23:59:59"},{"WeldCount":152,"WeldPointCount":705,"DayTime":"2018-06-08T23:59:59"},{"WeldCount":228,"WeldPointCount":797,"DayTime":"2018-06-07T23:59:59"},{"WeldCount":229,"WeldPointCount":635,"DayTime":"2018-06-06T23:59:59"},{"WeldCount":231,"WeldPointCount":640,"DayTime":"2018-06-05T23:59:59"},{"WeldCount":152,"WeldPointCount":727,"DayTime":"2018-06-04T23:59:59"},{"WeldCount":185,"WeldPointCount":558,"DayTime":"2018-06-03T23:59:59"},{"WeldCount":175,"WeldPointCount":776,"DayTime":"2018-06-02T23:59:59"},{"WeldCount":146,"WeldPointCount":592,"DayTime":"2018-06-01T23:59:59"},{"WeldCount":244,"WeldPointCount":524,"DayTime":"2018-05-31T23:59:59"},{"WeldCount":202,"WeldPointCount":602,"DayTime":"2018-05-30T23:59:59"},{"WeldCount":196,"WeldPointCount":645,"DayTime":"2018-05-29T23:59:59"},{"WeldCount":225,"WeldPointCount":704,"DayTime":"2018-05-28T23:59:59"},{"WeldCount":210,"WeldPointCount":761,"DayTime":"2018-05-27T23:59:59"},{"WeldCount":209,"WeldPointCount":725,"DayTime":"2018-05-26T23:59:59"},{"WeldCount":170,"WeldPointCount":719,"DayTime":"2018-05-25T23:59:59"},{"WeldCount":191,"WeldPointCount":590,"DayTime":"2018-05-24T23:59:59"},{"WeldCount":232,"WeldPointCount":788,"DayTime":"2018-05-23T23:59:59"},{"WeldCount":164,"WeldPointCount":629,"DayTime":"2018-05-22T23:59:59"},{"WeldCount":184,"WeldPointCount":701,"DayTime":"2018-05-21T23:59:59"},{"WeldCount":172,"WeldPointCount":519,"DayTime":"2018-05-20T23:59:59"},{"WeldCount":206,"WeldPointCount":572,"DayTime":"2018-05-19T23:59:59"},{"WeldCount":135,"WeldPointCount":787,"DayTime":"2018-05-18T23:59:59"},{"WeldCount":189,"WeldPointCount":593,"DayTime":"2018-05-17T23:59:59"},{"WeldCount":121,"WeldPointCount":785,"DayTime":"2018-05-16T23:59:59"},{"WeldCount":236,"WeldPointCount":573,"DayTime":"2018-05-15T23:59:59"},{"WeldCount":142,"WeldPointCount":632,"DayTime":"2018-05-14T23:59:59"},{"WeldCount":228,"WeldPointCount":559,"DayTime":"2018-05-13T23:59:59"},{"WeldCount":148,"WeldPointCount":517,"DayTime":"2018-05-12T23:59:59"},{"WeldCount":196,"WeldPointCount":781,"DayTime":"2018-05-11T23:59:59"},{"WeldCount":112,"WeldPointCount":715,"DayTime":"2018-05-10T23:59:59"},{"WeldCount":142,"WeldPointCount":694,"DayTime":"2018-05-09T23:59:59"},{"WeldCount":170,"WeldPointCount":594,"DayTime":"2018-05-08T23:59:59"},{"WeldCount":191,"WeldPointCount":693,"DayTime":"2018-05-07T23:59:59"},{"WeldCount":145,"WeldPointCount":559,"DayTime":"2018-05-06T23:59:59"},{"WeldCount":154,"WeldPointCount":680,"DayTime":"2018-05-05T23:59:59"},{"WeldCount":218,"WeldPointCount":611,"DayTime":"2018-05-04T23:59:59"},{"WeldCount":219,"WeldPointCount":767,"DayTime":"2018-05-03T23:59:59"},{"WeldCount":208,"WeldPointCount":527,"DayTime":"2018-05-02T23:59:59"},{"WeldCount":241,"WeldPointCount":670,"DayTime":"2018-05-01T23:59:59"},{"WeldCount":165,"WeldPointCount":600,"DayTime":"2018-04-30T23:59:59"},{"WeldCount":164,"WeldPointCount":659,"DayTime":"2018-04-29T23:59:59"},{"WeldCount":170,"WeldPointCount":606,"DayTime":"2018-04-28T23:59:59"},{"WeldCount":248,"WeldPointCount":517,"DayTime":"2018-04-27T23:59:59"},{"WeldCount":216,"WeldPointCount":728,"DayTime":"2018-04-26T23:59:59"},{"WeldCount":239,"WeldPointCount":540,"DayTime":"2018-04-25T23:59:59"},{"WeldCount":172,"WeldPointCount":797,"DayTime":"2018-04-24T23:59:59"},{"WeldCount":192,"WeldPointCount":727,"DayTime":"2018-04-23T23:59:59"},{"WeldCount":182,"WeldPointCount":602,"DayTime":"2018-04-22T23:59:59"},{"WeldCount":135,"WeldPointCount":651,"DayTime":"2018-04-21T23:59:59"},{"WeldCount":227,"WeldPointCount":782,"DayTime":"2018-04-20T23:59:59"},{"WeldCount":225,"WeldPointCount":662,"DayTime":"2018-04-19T23:59:59"},{"WeldCount":169,"WeldPointCount":624,"DayTime":"2018-04-18T23:59:59"},{"WeldCount":249,"WeldPointCount":706,"DayTime":"2018-04-17T23:59:59"},{"WeldCount":142,"WeldPointCount":714,"DayTime":"2018-04-16T23:59:59"},{"WeldCount":195,"WeldPointCount":508,"DayTime":"2018-04-15T23:59:59"},{"WeldCount":220,"WeldPointCount":781,"DayTime":"2018-04-14T23:59:59"},{"WeldCount":202,"WeldPointCount":675,"DayTime":"2018-04-13T23:59:59"},{"WeldCount":216,"WeldPointCount":687,"DayTime":"2018-04-12T23:59:59"},{"WeldCount":201,"WeldPointCount":608,"DayTime":"2018-04-11T23:59:59"},{"WeldCount":238,"WeldPointCount":798,"DayTime":"2018-04-10T23:59:59"},{"WeldCount":162,"WeldPointCount":716,"DayTime":"2018-04-09T23:59:59"}],"OKCount":0,"NGCount":0,"StartTime":"2018-07-17T17:04:19.0187074+08:00","TodayOKCount":0,"TodayNGCount":0,"TodayTime":"2018-07-17T17:04:19.0197072+08:00","WeldStartTime":"2018-07-17T17:04:19.0207121+08:00","WeldPointCount":0,"AlarmCount":600000}
类型,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义,SlaveID
DI,急停,SuddenStop_Single,200,192.168.200.11,0,急停,X01,DI-01,0
DI,气压检测,AirCheck_Single,201,192.168.200.11,0,气压检测,X02,DI-02,0
DI,自动夹具夹紧端,Fixture_Clamp,202,192.168.200.11,0,自动夹具夹紧端,X03,DI-03,0
DI,自动夹具放松端,Fixture_Relax,203,192.168.200.11,0,自动夹具放松端,X04,DI-04,0
DI,送丝气缸工作端,SendWire_Work,204,192.168.200.11,0,送丝气缸工作端,X05,DI-05,0
DI,送丝气缸清洗端,SendWire_Clear,205,192.168.200.11,0,送丝气缸清洗端,X06,DI-06,0
DI,烙铁气缸上升端,Soldering_Up,206,192.168.200.11,0,烙铁气缸上升端,X07,DI-07,0
DI,烙铁气缸下降端,Soldering_Down,207,192.168.200.11,0,烙铁气缸下降端,X08,DI-08,0
,,,208,192.168.200.11,0,,X09,DI-09,0
,,,209,192.168.200.11,0,,X10,DI-10,0
,,,210,192.168.200.11,0,,X11,DI-11,0
,,,211,192.168.200.11,0,,X12,DI-12,0
,,,212,192.168.200.11,0,,X13,DI-13,0
,,,213,192.168.200.11,0,,X14,DI-14,0
,,,214,192.168.200.11,0,,X15,DI-15,0
,,,215,192.168.200.11,0,,X16,DI-16,0
DO,自动夹具夹紧SOL,Fixture_Clamp,100,192.168.200.11,0,自动夹具夹紧SOL,Y01,DO-01,0
DO,自动夹具放松SOL,Fixture_Relax,101,192.168.200.11,0,自动夹具放松SOL,Y02,DO-02,0
DO,送丝气缸工作SOL,SendWire_Work,102,192.168.200.11,0,送丝气缸工作SOL,Y03,DO-03,0
DO,送丝气缸清洗SOL,SendWire_Clear,103,192.168.200.11,0,送丝气缸清洗SOL,Y04,DO-04,0
DO,烙铁气缸上升SOL,Soldering_Up,104,192.168.200.11,0,烙铁气缸上升SOL,Y05,DO-05,0
DO,烙铁气缸下降SOL,Soldering_Down,105,192.168.200.11,0,烙铁气缸下降SOL,Y06,DO-06,0
DO,送丝电机启动,SendWireStart,106,192.168.200.11,0,送丝电机启动,Y07,DO-07,0
,,,107,192.168.200.11,0,,Y08,DO-08,0
,,,108,192.168.200.11,0,,Y09,DO-09,0
,,,109,192.168.200.11,0,,Y10,DO-10,0
,,,110,192.168.200.11,0,,Y11,DO-11,0
,,,111,192.168.200.11,0,,Y12,DO-12,0
,,,112,192.168.200.11,0,,Y13,DO-13,0
,自动指示灯(绿色),AutoRunSingle,113,192.168.200.11,0,自动指示灯(绿色),Y14,DO-14,0
,待机指示灯(黄色),WaitSingle,114,192.168.200.11,0,待机指示灯(黄色),Y15,DO-15,0
,故障指示灯(红色),AlarmSingle,115,192.168.200.11,0,故障指示灯(红色),Y16,DO-16,0
DI,急停,SuddenStop_Single,200,192.168.10.11,0,急停,X01,DI-01,0
DI,气压检测,AirCheck_Single,201,192.168.10.11,0,气压检测,X02,DI-02,0
DI,自动夹具夹紧端,Fixture_Clamp,202,192.168.10.11,0,自动夹具夹紧端,X03,DI-03,0
DI,自动夹具放松端,Fixture_Relax,203,192.168.10.11,0,自动夹具放松端,X04,DI-04,0
DI,送丝气缸工作端,SendWire_Work,204,192.168.10.11,0,送丝气缸工作端,X05,DI-05,0
DI,送丝气缸清洗端,SendWire_Clear,205,192.168.10.11,0,送丝气缸清洗端,X06,DI-06,0
DI,烙铁气缸上升端,Soldering_Up,206,192.168.10.11,0,烙铁气缸上升端,X07,DI-07,0
DI,烙铁气缸下降端,Soldering_Down,207,192.168.10.11,0,烙铁气缸下降端,X08,DI-08,0
,,,208,192.168.10.11,0,,X09,DI-09,0
,,,209,192.168.10.11,0,,X10,DI-10,0
,,,210,192.168.10.11,0,,X11,DI-11,0
,,,211,192.168.10.11,0,,X12,DI-12,0
,,,212,192.168.10.11,0,,X13,DI-13,0
,,,213,192.168.10.11,0,,X14,DI-14,0
,,,214,192.168.10.11,0,,X15,DI-15,0
,,,215,192.168.10.11,0,,X16,DI-16,0
DO,自动夹具夹紧SOL,Fixture_Clamp,100,192.168.10.11,0,自动夹具夹紧SOL,Y01,DO-01,0
DO,自动夹具放松SOL,Fixture_Relax,101,192.168.10.11,0,自动夹具放松SOL,Y02,DO-02,0
DO,送丝气缸工作SOL,SendWire_Work,102,192.168.10.11,0,送丝气缸工作SOL,Y03,DO-03,0
DO,送丝气缸清洗SOL,SendWire_Clear,103,192.168.10.11,0,送丝气缸清洗SOL,Y04,DO-04,0
DO,烙铁气缸上升SOL,Soldering_Up,104,192.168.10.11,0,烙铁气缸上升SOL,Y05,DO-05,0
DO,烙铁气缸下降SOL,Soldering_Down,105,192.168.10.11,0,烙铁气缸下降SOL,Y06,DO-06,0
DO,送丝电机启动,SendWireStart,106,192.168.10.11,0,送丝电机启动,Y07,DO-07,0
,,,107,192.168.10.11,0,,Y08,DO-08,0
,,,108,192.168.10.11,0,,Y09,DO-09,0
,,,109,192.168.10.11,0,,Y10,DO-10,0
,,,110,192.168.10.11,0,,Y11,DO-11,0
,,,111,192.168.10.11,0,,Y12,DO-12,0
,,,112,192.168.10.11,0,,Y13,DO-13,0
,自动指示灯(绿色),AutoRunSingle,113,192.168.10.11,0,自动指示灯(绿色),Y14,DO-14,0
,待机指示灯(黄色),WaitSingle,114,192.168.10.11,0,待机指示灯(黄色),Y15,DO-15,0
,故障指示灯(红色),AlarmSingle,115,192.168.10.11,0,故障指示灯(红色),Y16,DO-16,0
,,,,,,,,,
PRO,尤傲机器人IP,UR_IP,192.168.200.13,,,,,,
PRO,尤傲机器人IP,UR_IP,192.168.10.13,,,,,,
PRO,焊接多少块板子后,清洗烙铁,ClearCount,1,,,,,,
PRO,清洗IO的毫秒数,ClearMSenconds,3000,,,,,,
PRO,JBC烙铁端口号,JBC_Soldering_Port,COM4,,,,,,
......
......@@ -256,30 +256,7 @@ namespace URSoldering.DeviceLibrary
}return null;
}
public static void UpdateTime(BoardInfo board, DateTime startTime, DateTime endTime)
{
LogUtil.BoardSolderingLog(board.boardName, startTime, endTime);
int index = 0;
foreach (BoardInfo bo in boardList)
{
if (bo.boardId.Equals(board.boardId))
{
boardList[index].solderingCount++;
double addtime = (endTime - startTime).TotalSeconds;
boardList[index].solderingTime += addtime;
boardList[index].solderTime += addtime;
boardList[index].solderCount++;
double value = boardList[index].solderingTime / boardList[index].solderingCount;
value = Math.Round(value, 1, MidpointRounding.AwayFromZero);
boardList[index].planNeedTime = value;
LogUtil.info("电路板:" + board.boardName + ",总时间" + boardList[index].solderingTime + ",总次数" + boardList[index].solderingCount + ",本次焊接时间"+addtime+",平均焊接时间:" + boardList[index].planNeedTime);
break;
}
index++;
}
SaveListToFile(boardList);
}
public static Dictionary<int, BoardInfo> GetBoardMapByPartNum(string partNum)
{
......
......@@ -126,12 +126,13 @@ namespace URSoldering.DeviceLibrary
}
}
//连接上IO模块后,夹具夹紧
KNDIOMove(IO_Type.Fixture_Clamp, IO_VALUE.HIGH);
KNDIOMove(IO_Type.Fixture_Relax, IO_VALUE.LOW);
//KNDIOMove(IO_Type.Fixture_Clamp, IO_VALUE.HIGH);
//KNDIOMove(IO_Type.Fixture_Relax, IO_VALUE.LOW);
}
public static bool ShuddenOK()
{
return true;
if (!baseConfig.RobotDIList.ContainsKey(IO_Type.SuddenStop_Single))
{
return false;
......
......@@ -7,20 +7,17 @@ using URSoldering.Common;
namespace URSoldering.DeviceLibrary
{
public class URRobotManager
public class URRobotClient
{
private static URTcpClient listenClient = null;
public static double Robot_LIM_Z { get; set; }
public static bool IsRun { get; set; }
public static void StartListen()
private static int Port = 30003;
public static string LastMoveCMD = "";
public static void StartListen(string ip)
{
listenClient = new URTcpClient();
listenClient.DefaultDataLength = 1024;
listenClient.DefaultDataLength = 1078;
listenClient.ReviceSleepMS = 5;
listenClient.connect("192.168.10.10", 30003, HandleMessage);
listenClient.connect(ip, Port, HandleMessage);
}
public static void StopListen()
{
......@@ -29,6 +26,17 @@ namespace URSoldering.DeviceLibrary
listenClient.close();
}
}
public static bool IsConnected()
{
if (listenClient != null)
{
return listenClient.IsConnected();
}return false;
}
public static string LogName
{
get { return "【UR端口:" + Port + "】"; }
}
private static double BitToDouble(byte[] data)
{
double f = BitConverter.ToDouble(data, 0);
......@@ -58,8 +66,11 @@ namespace URSoldering.DeviceLibrary
private static void HandleMessage(byte[] reviceData)
{
//StopListen();
if (LastMoveCMD.Equals("").Equals(false))
{
listenClient.sendLine(LastMoveCMD);
}
StopListen();
try
{
//string reviceMsg = ByteToStr(reviceData);
......@@ -75,8 +86,12 @@ namespace URSoldering.DeviceLibrary
int maxdouble = (messageSize - 4) / 8;
List<double> doubleList = new List<double>();
doubleList.Add(messageSize);
if (maxdouble > 61)
{
for (int i = 0; i < maxdouble; i++)
{
if (i >= 55 && i <= 61)
{
if (reviceData.Length >= (12 + i * 8))
{
byte[] data = reviceData.Skip(4 + i * 8).Take(8).ToArray().Reverse<byte>().ToArray();
......@@ -89,7 +104,12 @@ namespace URSoldering.DeviceLibrary
break;
}
}
if (doubleList.Count > 100)
else
{
doubleList.Add(0);
}
}
if (doubleList.Count > 61)
{
string spilt = ",";
double x = doubleList[56] * 1000;
......@@ -98,18 +118,23 @@ namespace URSoldering.DeviceLibrary
double rx = doubleList[59] * 1;
double ry = doubleList[60] * 1;
double rz = doubleList[61] * 1;
LogUtil.info("数据长度:"+messageSize+",data长度:"+reviceData.Length+"。实际坐标:" + x + spilt + y + spilt + z + spilt + rx + spilt + ry + spilt + rz + spilt);
URPointValue newp = new URPointValue(x, y, z, rx, ry, rz);
URRobotControl.LastPoint = newp;
string reviceMsg = ByteToStr(reviceData);
//LogUtil.info("Read data:【" + reviceMsg + "】 ");
LogUtil.URLInfo( LogName+"length[" + messageSize + "],data长[" + reviceData.Length + "]坐标"+newp.ToShowStr());
}
}
else
{
string reviceMsg = ByteToStr(reviceData);
LogUtil.info("Read data:【" + reviceMsg + "】 ");
LogUtil.info("无法获取坐标,数据长度不正确");
LogUtil.URLError(LogName + "Read data:【" + reviceMsg + "】 ");
LogUtil.URLError(LogName + "无法获取坐标,数据长度不正确");
}
}catch(Exception ex)
{
LogUtil.error("出错:" + ex.ToString());
LogUtil.URLError(LogName+ "HandleMessage出错:" + ex.ToString());
StopListen();
}
}
......
......@@ -9,28 +9,20 @@
<add key="Robot_Type" value="SolderingRobot" />
<add key="Robot_ConfigPath" value="\RobotConfig\solderingConfig\SolderingRobotConfig.csv" />
<add key="Robot_CID" value="1" />
<add key="ScanCodeConfig" value="\RobotConfig\AOIConfig\ScanCode.vscf" />
<add key="HasSoldering" value ="0"/>
<add key="HasSoldering" value="0" />
<!--AOI检测文件-->
<add key="VideoCameraName" value="[0] Integrated Camera" />
<add key="AOIFileConfig" value="\RobotConfig\AOIConfig\AOIProgram.vscf" />
<add key="AOICheckPointFile" value="\RobotConfig\AOIConfig\AOIPointProgram.vscf" />
<add key ="AOIWaitSeconds" value ="4000"/>
<add key="AOIWaitSeconds" value="4000" />
<!--送丝器消除报警需要持续的秒数-->
<add key="SendWireRecoverSeconds" value="5" />
<!--空闲多久需要休眠,=0表示不需要休眠,>0表示休眠秒数-->
<add key="SleepSeconds" value="180" />
<!--摄像机名称列表配置,用#分割-->
<add key="CameraName" value="[1] HD USB Camera" />
<add key="CodeCameraName" value="[1] HD USB Camera" />
<add key="VideoCameraName" value="[0] Integrated Webcam" />
<add key="CameraName" value="SolderingAOI" />
<!--条码类型列表配置,用#分割-->
<add key="CodeType" value="QR Code" />
<!--条码参数文件所在路径,文件名与条码类型名一样-->
<add key="CodeParamPath" value="\RobotConfig\solderingConfig\" />
<!--摄像机名称列表配置,用#分割-->
<add key ="CameraName" value ="192168024#192168025"/>
<!--条码类型列表配置,用#分割-->
<add key ="CodeType" value ="QR Code#Data Matrix ECC 200"/>
<add key="CodeType" value="QR Code#Data Matrix ECC 200" />
<!--条码参数文件所在路径,文件名与条码类型名一样-->
<add key="CodeParamPath" value="\RobotConfig\solderingConfig\" />
<!--统计文件路径-->
......@@ -39,49 +31,34 @@
<add key="Board_ConfigPath" value="\RobotConfig\config\boardData.txt" />
<add key="Program_ConfigPath" value="\RobotConfig\config\sprogram.txt" />
<add key="Default_BoardID" value="56" />
<add key="Board_Origin_X" value="-64.1489" />
<add key="Board_Origin_Y" value="119.404" />
<add key="Board_Origin_X" value="-67.29" />
<add key="Board_Origin_Y" value="-436.62" />
<!--机器人抬起高点设置-->
<add key="Soldering_LIM_Z" value="0" />
<!--机器人待机点位置-->
<add key="Soldering_Home_X" value="-57.0885" />
<add key="Soldering_Home_Y" value="218.558" />
<add key="Soldering_Home_Hand" value="2" />
<add key="Soldering_Home_U" value="4.29512" />
<add key="Soldering_Home_Z" value="-4.93001" />
<!--机器人清洗点1配置-->
<add key="Soldering_Clear_X_1" value="289.864" />
<add key="Soldering_Clear_Y_1" value="-10.0607" />
<add key="Soldering_Clear_Hand_1" value="2" />
<add key="Soldering_Clear_U_1" value="-84.4832" />
<add key="Soldering_Clear_Z_1" value="-114.909" />
<!--机器人清洗点2配置-->
<add key="Soldering_Clear_X_2" value="289.37" />
<add key="Soldering_Clear_Y_2" value="-21.5826" />
<add key="Soldering_Clear_Hand_2" value="2" />
<add key="Soldering_Clear_U_2" value="-86.7414" />
<add key="Soldering_Clear_Z_2" value="-114.907" />
<add key="Soldering_LIM_Z" value="500" />
<!--程序图片路径-->
<add key="Board_Image_Path" value="\RobotConfig\config" />
<!--程序默认图片-->
<add key="BOARD_IMAGE_DEFAULT" value="defaultBoard.jpg" />
<!--送丝1mm对应的脉冲数-->
<add key="SendWire_Change" value="-305" />
<add key="Component_ConfigPath" value="\RobotConfig\config\componentData.txt" />
<!--报警时反转送丝速度-->
<add key="ReverseSendWireSpeed" value="-10" />
<!--报警时反转送丝时间-->
<add key="ReverseSendWireTime" value="3" />
<add key="ISDebug" value="1" />
<!--机器人是否高速运行-->
<add key="Robot_IsHigh" value="1" />
<add key="Soldering_X_Min" value="0" />
<add key="Soldering_Y_Min" value="0" />
<add key="Soldering_Z_Min" value="0" />
<add key="Soldering_U_Min" value="0" />
<add key="Soldering_X_Max" value="0" />
<add key="Soldering_Y_Max" value="0" />
<add key="Soldering_Z_Max" value="0" />
<add key="Soldering_U_Max" value="0" />
<add key="Soldering_Clear1Point" value="{&quot;UpdateTime&quot;:&quot;2018-07-28T14:42:04.5888384+08:00&quot;,&quot;X&quot;:-67.28,&quot;Y&quot;:-436.62,&quot;Z&quot;:293.7,&quot;RX&quot;:2.7394,&quot;RY&quot;:0.0599,&quot;RZ&quot;:0.0708}" />
<add key="Soldering_Clear2Point" value="{&quot;UpdateTime&quot;:&quot;2018-07-28T14:42:06.1809687+08:00&quot;,&quot;X&quot;:-67.29,&quot;Y&quot;:-436.62,&quot;Z&quot;:293.68,&quot;RX&quot;:2.7394,&quot;RY&quot;:0.06,&quot;RZ&quot;:0.0708}" />
<add key="Soldering_HomePoint" value="{&quot;UpdateTime&quot;:&quot;2018-07-28T14:42:02.1180802+08:00&quot;,&quot;X&quot;:-67.29,&quot;Y&quot;:-436.62,&quot;Z&quot;:293.66,&quot;RX&quot;:2.7395,&quot;RY&quot;:0.0599,&quot;RZ&quot;:0.0707}" />
<add key="Soldering_RobotMin" value="{&quot;UpdateTime&quot;:&quot;2018-07-28T14:37:09.4700739+08:00&quot;,&quot;X&quot;:0.0,&quot;Y&quot;:0.0,&quot;Z&quot;:0.0,&quot;RX&quot;:0.0,&quot;RY&quot;:0.0,&quot;RZ&quot;:0.0}" />
<add key="Soldering_RobotMax" value="{&quot;UpdateTime&quot;:&quot;2018-07-28T14:37:09.4700739+08:00&quot;,&quot;X&quot;:0.0,&quot;Y&quot;:0.0,&quot;Z&quot;:0.0,&quot;RX&quot;:0.0,&quot;RY&quot;:0.0,&quot;RZ&quot;:0.0}" />
<add key="Config_Pwd" value="123456" />
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/URSoldering.log" />
<appender name="defaultAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/URSolderingClient.log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
......@@ -89,10 +66,37 @@
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
</appender>
<root>
<appender name="RobotStatusLogAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/UR/RobotStatus.log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date] %m%n" />
</layout>
</appender>
<appender name="RobotListenLogAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/UR/RobotListen.log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date] %m%n" />
</layout>
</appender>
<logger name="RobotStatusLogAppender">
<level value="Info" />
<appender-ref ref="RobotStatusLogAppender" />
</logger>
<logger name="RobotListenLogAppender">
<level value="Info" />
<appender-ref ref="RobotListenLogAppender" />
</logger>
<logger name="defaultAppender">
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</root>
<appender-ref ref="defaultAppender" />
</logger>
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
......
......@@ -115,7 +115,7 @@ namespace URSoldering.Client
if (!SendWireManager.IsRun)
{
SendWireManager.Init(WeldRobotBean.RobotConfig.JBC_SendWire_Port);
//SendWireManager.Init(WeldRobotBean.RobotConfig.JBC_SendWire_Port);
}
if (SendWireManager.IsRun) {
......@@ -259,7 +259,7 @@ namespace URSoldering.Client
private void timer_Elapsed(object sender, EventArgs e)
{
//判断是否开急停
if (RobotBean.KNDIOValue(IO_Type.SuddenStop_Single).Equals(IO_VALUE.LOW))
if (RobotBean.ShuddenOK().Equals(false))
{
lblMsg.Text = "急停未开";
}
......@@ -431,11 +431,11 @@ namespace URSoldering.Client
private bool isfast = false;
private void MoveTest(int rowIndex)
{
if (isAuto == false)
{
MessageBox.Show("请先切换到自动模式!");
return;
}
//if (isAuto == false)
//{
// MessageBox.Show("请先切换到自动模式!");
// return;
//}
URRobotControl.MoveTo(GetRowPoint(rowIndex));
}
......
......@@ -35,9 +35,6 @@ 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();
......@@ -116,9 +113,6 @@ namespace URSoldering.Client
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel1.BackgroundImage")));
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.panel1.Controls.Add(this.button2);
this.panel1.Controls.Add(this.btnStop);
this.panel1.Controls.Add(this.btnStart);
this.panel1.Controls.Add(this.btnAutoEdit);
this.panel1.Controls.Add(this.btnTongji);
this.panel1.Controls.Add(this.btnExit);
......@@ -132,39 +126,6 @@ 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);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(85, 28);
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
//
this.btnStart.Location = new System.Drawing.Point(67, 175);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(85, 28);
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
//
this.btnAutoEdit.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(186)))), ((int)(((byte)(118)))), ((int)(((byte)(159)))));
......@@ -179,7 +140,6 @@ namespace URSoldering.Client
this.btnAutoEdit.Size = new System.Drawing.Size(222, 81);
this.btnAutoEdit.TabIndex = 14;
this.btnAutoEdit.UseVisualStyleBackColor = false;
this.btnAutoEdit.Click += new System.EventHandler(this.btnAutoEdit_Click);
//
// btnTongji
//
......@@ -256,8 +216,5 @@ namespace URSoldering.Client
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btnCom;
private System.Windows.Forms.Button btnAutoEdit;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.Button button2;
}
}
\ No newline at end of file
......@@ -17,6 +17,16 @@ namespace URSoldering.Client
InitializeComponent();
this.MaximizeBox = false;
this.MinimizeBox = false;
}
private System.Timers.Timer timer = new System.Timers.Timer();
private void FrmMenu_Load(object sender, EventArgs e)
{
//加载板卡
WorkCountManager.LoadData();
BoardManager.LoadBoard();
RobotManager.InitRobotConfig();
RobotBean.ConnectionIO();
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
}
......@@ -59,19 +69,6 @@ namespace URSoldering.Client
frmOrgConfig.ShowDialog();
this.Visible = true;
}
private System.Timers.Timer timer = new System.Timers.Timer();
private void FrmMenu_Load(object sender, EventArgs e)
{
//加载板卡
WorkCountManager.LoadData();
//SProgramManager.LoadData();
BoardManager.LoadBoard();
//ComponentManager.LoadData();
RobotManager.InitRobotConfig();
//RobotBean.ConnectionIO();
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
}
private void FrmMenu_FormClosing(object sender, FormClosingEventArgs e)
{
......@@ -95,34 +92,5 @@ namespace URSoldering.Client
this.Close();
}
private void btnProgram_Click(object sender, EventArgs e)
{
}
private void btnAutoEdit_Click(object sender, EventArgs e)
{
//isClick = true;
//FrmAutoAddBoard info = new FrmAutoAddBoard(null);
//this.Visible = false;
//info.ShowDialog();
//this.Visible = true;
}
private void btnStart_Click(object sender, EventArgs e)
{
URRobotControl.StartRobot();
//URRobotManager.StartListen();
}
private void btnStop_Click(object sender, EventArgs e)
{
URRobotControl.StopRobot();
//URRobotManager.StopListen();
}
private void button2_Click(object sender, EventArgs e)
{
URRobotControl.GetRobotMode();
}
}
}
......@@ -28,9 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmOrgConfig));
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.dataGridViewImageColumn1 = new System.Windows.Forms.DataGridViewImageColumn();
this.dataGridViewImageColumn2 = new System.Windows.Forms.DataGridViewImageColumn();
this.panel1 = new System.Windows.Forms.Panel();
......@@ -39,21 +37,17 @@
this.btnSetClear2 = new System.Windows.Forms.Button();
this.btnSetClear1 = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.urRobotSControl1 = new UserFromControl.URRobotSControl();
this.btnSetOrigin = new System.Windows.Forms.Button();
this.btnSaveHome = new System.Windows.Forms.Button();
this.btnSStop = new System.Windows.Forms.Button();
this.btnWStop = new System.Windows.Forms.Button();
this.label14 = new System.Windows.Forms.Label();
this.urRobotSControl1 = new UserFromControl.URRobotSControl();
this.lblMsg = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// timer2
//
this.timer2.Interval = 1000;
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// dataGridViewImageColumn1
//
this.dataGridViewImageColumn1.HeaderText = "上升";
......@@ -73,6 +67,7 @@
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.lblMsg);
this.panel1.Controls.Add(this.btnMore);
this.panel1.Controls.Add(this.btnBack);
this.panel1.Controls.Add(this.btnSetClear2);
......@@ -83,13 +78,13 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(529, 318);
this.panel1.Size = new System.Drawing.Size(545, 347);
this.panel1.TabIndex = 0;
//
// btnMore
//
this.btnMore.FlatAppearance.BorderSize = 0;
this.btnMore.Location = new System.Drawing.Point(70, 260);
this.btnMore.Location = new System.Drawing.Point(80, 276);
this.btnMore.Name = "btnMore";
this.btnMore.Size = new System.Drawing.Size(159, 38);
this.btnMore.TabIndex = 261;
......@@ -100,7 +95,7 @@
// btnBack
//
this.btnBack.FlatAppearance.BorderSize = 0;
this.btnBack.Location = new System.Drawing.Point(321, 260);
this.btnBack.Location = new System.Drawing.Point(347, 276);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(159, 38);
this.btnBack.TabIndex = 260;
......@@ -111,7 +106,7 @@
// btnSetClear2
//
this.btnSetClear2.FlatAppearance.BorderSize = 0;
this.btnSetClear2.Location = new System.Drawing.Point(321, 192);
this.btnSetClear2.Location = new System.Drawing.Point(347, 192);
this.btnSetClear2.Name = "btnSetClear2";
this.btnSetClear2.Size = new System.Drawing.Size(159, 38);
this.btnSetClear2.TabIndex = 38;
......@@ -122,7 +117,7 @@
// btnSetClear1
//
this.btnSetClear1.FlatAppearance.BorderSize = 0;
this.btnSetClear1.Location = new System.Drawing.Point(321, 142);
this.btnSetClear1.Location = new System.Drawing.Point(347, 142);
this.btnSetClear1.Name = "btnSetClear1";
this.btnSetClear1.Size = new System.Drawing.Size(159, 38);
this.btnSetClear1.TabIndex = 37;
......@@ -134,17 +129,27 @@
//
this.groupBox2.Controls.Add(this.urRobotSControl1);
this.groupBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox2.Location = new System.Drawing.Point(40, 34);
this.groupBox2.Location = new System.Drawing.Point(36, 41);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(241, 192);
this.groupBox2.Size = new System.Drawing.Size(284, 206);
this.groupBox2.TabIndex = 259;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "机器人实时坐标";
//
// urRobotSControl1
//
this.urRobotSControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.urRobotSControl1.Location = new System.Drawing.Point(7, 28);
this.urRobotSControl1.Name = "urRobotSControl1";
this.urRobotSControl1.Size = new System.Drawing.Size(271, 157);
this.urRobotSControl1.TabIndex = 0;
//
// btnSetOrigin
//
this.btnSetOrigin.FlatAppearance.BorderSize = 0;
this.btnSetOrigin.Location = new System.Drawing.Point(321, 42);
this.btnSetOrigin.Location = new System.Drawing.Point(347, 42);
this.btnSetOrigin.Name = "btnSetOrigin";
this.btnSetOrigin.Size = new System.Drawing.Size(159, 38);
this.btnSetOrigin.TabIndex = 32;
......@@ -155,7 +160,7 @@
// btnSaveHome
//
this.btnSaveHome.FlatAppearance.BorderSize = 0;
this.btnSaveHome.Location = new System.Drawing.Point(321, 92);
this.btnSaveHome.Location = new System.Drawing.Point(347, 92);
this.btnSaveHome.Name = "btnSaveHome";
this.btnSaveHome.Size = new System.Drawing.Size(159, 38);
this.btnSaveHome.TabIndex = 36;
......@@ -167,7 +172,7 @@
//
this.btnSStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSStop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSStop.Location = new System.Drawing.Point(401, 9);
this.btnSStop.Location = new System.Drawing.Point(417, 9);
this.btnSStop.Name = "btnSStop";
this.btnSStop.Size = new System.Drawing.Size(117, 23);
this.btnSStop.TabIndex = 256;
......@@ -179,7 +184,7 @@
//
this.btnWStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnWStop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnWStop.Location = new System.Drawing.Point(401, 37);
this.btnWStop.Location = new System.Drawing.Point(417, 37);
this.btnWStop.Name = "btnWStop";
this.btnWStop.Size = new System.Drawing.Size(117, 23);
this.btnWStop.TabIndex = 257;
......@@ -197,18 +202,20 @@
this.label14.Text = "条形码";
this.label14.Visible = false;
//
// urRobotSControl1
// lblMsg
//
this.urRobotSControl1.Location = new System.Drawing.Point(7, 28);
this.urRobotSControl1.Name = "urRobotSControl1";
this.urRobotSControl1.Size = new System.Drawing.Size(228, 146);
this.urRobotSControl1.TabIndex = 0;
this.lblMsg.AutoSize = true;
this.lblMsg.ForeColor = System.Drawing.Color.Red;
this.lblMsg.Location = new System.Drawing.Point(33, 15);
this.lblMsg.Name = "lblMsg";
this.lblMsg.Size = new System.Drawing.Size(0, 17);
this.lblMsg.TabIndex = 262;
//
// FrmOrgConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(529, 318);
this.ClientSize = new System.Drawing.Size(545, 347);
this.Controls.Add(this.panel1);
this.Controls.Add(this.btnSStop);
this.Controls.Add(this.btnWStop);
......@@ -218,6 +225,7 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBoardInfo_FormClosing);
this.Load += new System.EventHandler(this.FrmBoardInfo_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
......@@ -228,7 +236,6 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnWStop;
private System.Windows.Forms.Button btnSStop;
private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.Button btnSetOrigin;
private System.Windows.Forms.Label label14;
......@@ -241,5 +248,6 @@
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Button btnMore;
private UserFromControl.URRobotSControl urRobotSControl1;
private System.Windows.Forms.Label lblMsg;
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ using URSoldering.DeviceLibrary;
using System;
using System.Reflection;
using System.Windows.Forms;
using System.Threading.Tasks;
namespace URSoldering.Client
{
......@@ -46,56 +47,44 @@ namespace URSoldering.Client
timer1.AutoReset = true;
timer1.Elapsed += timer_Elapsed;
timer1.Start();
timer2.Start();
}
private bool isRun = false;
private void timer_Elapsed(object sender, EventArgs e)
{
//if (!URRobotControl.IsRun && isRun.Equals(false))
//{
// Task.Factory.StartNew(delegate ()
// {
// bool result = URRobotControl.StartRobot();
// if (!result)
// {
// LogUtil.info("连接失败:" + result);
// }
// else
// {
// URRobotControl.FreeAxis();
// isAuto = false;
// }
// });
// isRun = true;
//}
//else
//{
// URPointValue lastP = URRobotControl.GetLastPosition();
// urRobotSControl1.ShowPoint(lastP);
//}
if (!URRobotControl.IsRun && isRun.Equals(false))
{
Task.Factory.StartNew(delegate ()
{
bool result = URRobotControl.StartRobot();
if (!result)
{
LogUtil.info("连接失败:" + result);
}
private void FrmBoardInfo_FormClosing(object sender, FormClosingEventArgs e)
else
{
URRobotControl.LockAxis();
timer2.Stop();
timer1.Stop();
UsbCameraHDevelop.CloseAllCamera();
URRobotControl.FreeAxis();
isAuto = false;
}
});
private void btnRead_Click(object sender, EventArgs e)
isRun = true;
}
else
{
URPointValue lastP = URRobotControl.GetLastPosition();
urRobotSControl1.ShowPoint(lastP);
}
lblMsg.Text = URRobotControl.WarnMsg;
}
private void timer2_Tick(object sender, EventArgs e)
{
if (URRobotControl.IsRun)
private void FrmBoardInfo_FormClosing(object sender, FormClosingEventArgs e)
{
}
URRobotControl.LockAxis();
timer1.Stop();
UsbCameraHDevelop.CloseAllCamera();
}
protected override void OnVisibleChanged(EventArgs e)
{
base.OnVisibleChanged(e);
......
......@@ -117,9 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="dataGridViewImageColumn1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
......
......@@ -66,13 +66,13 @@ namespace URSoldering.Client
List<string> port = new List<string>(SerialPort.GetPortNames());
if (limz > 0)
{
MessageBox.Show("请输入正确的机器人最大Z点(<=0)");
this.txtLimZ.Focus();
txtLimZ.SelectAll();
return;
}
//if (limz > 0)
//{
// MessageBox.Show("请输入正确的机器人最大Z点(<=0)");
// this.txtLimZ.Focus();
// txtLimZ.SelectAll();
// return;
//}
int sendWireSpeed = FormUtil.GetIntValue(txtsendWireSpeed);
if (sendWireSpeed >= 0)
{
......
......@@ -45,7 +45,7 @@
// lblRZ
//
this.lblRZ.AutoSize = true;
this.lblRZ.Location = new System.Drawing.Point(167, 113);
this.lblRZ.Location = new System.Drawing.Point(162, 113);
this.lblRZ.Name = "lblRZ";
this.lblRZ.Size = new System.Drawing.Size(11, 12);
this.lblRZ.TabIndex = 44;
......@@ -54,7 +54,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(133, 113);
this.label3.Location = new System.Drawing.Point(128, 113);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(29, 12);
this.label3.TabIndex = 41;
......@@ -63,7 +63,7 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(132, 9);
this.label4.Location = new System.Drawing.Point(127, 9);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(29, 12);
this.label4.TabIndex = 39;
......@@ -72,7 +72,7 @@
// lblRY
//
this.lblRY.AutoSize = true;
this.lblRY.Location = new System.Drawing.Point(167, 61);
this.lblRY.Location = new System.Drawing.Point(162, 61);
this.lblRY.Name = "lblRY";
this.lblRY.Size = new System.Drawing.Size(11, 12);
this.lblRY.TabIndex = 43;
......@@ -81,7 +81,7 @@
// lblRX
//
this.lblRX.AutoSize = true;
this.lblRX.Location = new System.Drawing.Point(167, 9);
this.lblRX.Location = new System.Drawing.Point(162, 9);
this.lblRX.Name = "lblRX";
this.lblRX.Size = new System.Drawing.Size(11, 12);
this.lblRX.TabIndex = 42;
......@@ -90,7 +90,7 @@
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(133, 61);
this.label7.Location = new System.Drawing.Point(128, 61);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(29, 12);
this.label7.TabIndex = 40;
......
此文件类型无法预览
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!