diff --git a/src/BRS.Common.Model/Helper/EnumHelper.cs b/src/BRS.Common.Model/Helper/EnumHelper.cs index 4b669b2..6b21514 100644 --- a/src/BRS.Common.Model/Helper/EnumHelper.cs +++ b/src/BRS.Common.Model/Helper/EnumHelper.cs @@ -739,6 +739,22 @@ namespace BRS.Common.Model.Helper /// RobotFinish, /// + /// 拧紧轴拧紧运动 + /// + ShaftToughRunning, + /// + /// 拧紧轴拧紧运动 + /// + ShaftLoosenRunning, + /// + /// 判断是否拧紧 + /// + Judge, + /// + /// 到位后退出拧紧轴 + /// + UpShaft, + /// /// 机器人下电 所有第七轴回归初始位置 /// RobotPLCInit, diff --git a/src/BRS.Common.Model/Model/CustomizedPoint.cs b/src/BRS.Common.Model/Model/CustomizedPoint.cs index eb0a9a5..41a05fb 100644 --- a/src/BRS.Common.Model/Model/CustomizedPoint.cs +++ b/src/BRS.Common.Model/Model/CustomizedPoint.cs @@ -835,32 +835,32 @@ namespace BRS.Common.Model [Description("坐标Z")] public float Z { get; set; } - [Category("第七轴")] - [Description("第七轴")] - public float SevenDis { get; set; } + //[Category("第七轴")] + //[Description("第七轴")] + //public float SevenDis { get; set; } - [Category("是否启动第七轴配置")] - [Description("是否启用")] - [DisplayName("是否启用")] - public bool SevenDisIsLSEnabled { get; set; } = false; + //[Category("是否启动第七轴配置")] + //[Description("是否启用")] + //[DisplayName("是否启用")] + //public bool SevenDisIsLSEnabled { get; set; } = false; - [Category("是否是两端特殊螺丝")] - [Description("是否启用")] - [DisplayName("是否启用")] - public bool SpecialIsLSEnabled { get; set; } = false; + //[Category("是否是两端特殊螺丝")] + //[Description("是否启用")] + //[DisplayName("是否启用")] + //public bool SpecialIsLSEnabled { get; set; } = false; - [Category("特别螺丝配置")] - [Description("是否启用")] - [DisplayName("是否启用")] - public bool IsLSEnabled { get; set; } = false; + //[Category("特别螺丝配置")] + //[Description("是否启用")] + //[DisplayName("是否启用")] + //public bool IsLSEnabled { get; set; } = false; - [Category("特别螺丝配置")] - [Description("特别螺丝配置")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - [DisplayName("特别螺丝配置")] - public List CVCalibrationConfig { get; set; } = new List(); + //[Category("特别螺丝配置")] + //[Description("特别螺丝配置")] + //[TypeConverter(typeof(CollectionCountConvert))] + //[Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] + //[DisplayName("特别螺丝配置")] + //public List CVCalibrationConfig { get; set; } = new List(); public string GetDisplayText() { return $"X:{X.ToString()} Y:{Y.ToString()} Z:{Z.ToString()}"; diff --git a/src/BRS.Common.Model/Model/DeviceOpBind.cs b/src/BRS.Common.Model/Model/DeviceOpBind.cs index a25c220..2f84632 100644 --- a/src/BRS.Common.Model/Model/DeviceOpBind.cs +++ b/src/BRS.Common.Model/Model/DeviceOpBind.cs @@ -54,7 +54,7 @@ namespace BRS.Common.Model } } - public class DeviceModel : IComplexDisplay + public class DeviceModel : IComplexDisplay { [Category("模具类型")] [Description("模具类型")] @@ -70,13 +70,18 @@ namespace BRS.Common.Model public List CVCalibrationConfig { get; set; } = new List(); - [Category("机械臂A配置项")] + [Category("机械臂配置项")] [Description("偏移量:标定点减去拍摄点的坐标是偏移量")] [DisplayName("偏移量")] [TypeConverter(typeof(CollectionCountConvert))] [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] //[TypeConverter(typeof(SimpleCollectionConvert))] - public List A_deviation { get; set; } = new List(); + public List Deviation { get; set; } = new List(); + + [Category("机械臂配置项")] + [Description("拧紧轴推进距离")] + [DisplayName("拧紧轴推进距离")] + public float NIJ_DisD { get; set; } = -99; public string GetDisplayText() { diff --git a/src/BRS.Process.A020/A020Process_MachineState.cs b/src/BRS.Process.A020/A020Process_MachineState.cs index bf9e6e8..d203e0c 100644 --- a/src/BRS.Process.A020/A020Process_MachineState.cs +++ b/src/BRS.Process.A020/A020Process_MachineState.cs @@ -354,6 +354,14 @@ namespace BRS.Process.A020 } #endregion + public string MoveRobot(StrRobotPoint strPoint) + { + string pointsStr = Convert.ToString(strPoint.X) + "," + Convert.ToString(strPoint.Y) + "," + Convert.ToString(strPoint.Z) + "," + + Convert.ToString(strPoint.A) + "," + Convert.ToString(strPoint.B) + "," + Convert.ToString(strPoint.C); + string STRMove = "MoveLine_NULL_1_" + pointsStr + "_"; + //string PointInit1 = "MoveLine_NULL_1_462.915,1119.150,1530.227,90.043,90.003,0.040_"; + return STRMove; + } public string MoveMoreNContinueRobot(List strPoints, ref StrRobotPoint CurrentPoint) { string strPointsStr = null; diff --git a/src/BRS.Process.A020/A020Process_Operation.cs b/src/BRS.Process.A020/A020Process_Operation.cs index 7d1ba30..95079eb 100644 --- a/src/BRS.Process.A020/A020Process_Operation.cs +++ b/src/BRS.Process.A020/A020Process_Operation.cs @@ -20,12 +20,18 @@ namespace BRS.Process.A020 { public partial class A020Process { - private bool IsTesting { get; set; } = false; + private bool IsTesting { get; set; } = true; public bool IsSingleStepOperating { get; set; } = false; + public bool IsArrive { get; set; } = false;//判断机械臂携带拧紧轴是否到位 - int ShiJiaoVecCountFlag1 = 0;// 相机1的示教点索引 - float A_Distance_DisD = 0;//拧紧轴推进距离100 + private bool IsShaftOpen { get; set; } = false;//拧紧轴是否启动 + private bool IsTough { get; set; } = false;//是否拧紧 + + int ShiJiaoVecCountFlag1 = 0;// 相机的示教点索引 + float Distance_DisD = 0;//拧紧轴推进距离100 + + DeviceModel AModeTypeRun = new DeviceModel();//相机机械臂全局配置(务必要有) private void StopMachineClosing(PLCBase MelsecPlc, TCPSeverBase TcpSeverBase1) @@ -73,8 +79,6 @@ namespace BRS.Process.A020 // m_dev = Enumerator.GetDeviceByIndex(0); m_dev = Enumerator.GetDeviceByGigeIP(IP); - - /* 打开设备 */ if (!m_dev.Open()) { @@ -143,7 +147,6 @@ namespace BRS.Process.A020 m_frameList.Add(e.GrabResult.Clone()); m_mutex.ReleaseMutex(); - IGrabbedRawData frame = m_frameList.ElementAt(m_frameList.Count - 1); var bitmap = frame.ToBitmap(false); Bit_Image = bitmap; @@ -154,11 +157,11 @@ namespace BRS.Process.A020 // Mat ss = Mat_CamA.Clone(); // Cv2.ImWrite("D",ss); - } #endregion + public Mat AloghitomMat(Mat mat, ref MyPoint myPoint) { @@ -232,13 +235,92 @@ namespace BRS.Process.A020 return src; + } + + /// + /// 获取区域轮廓 已过滤区域的边长 + /// + /// + /// + public static void Contour_Get(Mat mat, List Lastcontours) + { + //高斯模糊 + Mat dst = new Mat(); + OpenCvSharp.Size ksize = new OpenCvSharp.Size(3, 3); + Cv2.GaussianBlur(mat, dst, ksize, 0); + Mat gray = new Mat(); + Cv2.CvtColor(dst, gray, ColorConversionCodes.BGR2GRAY); + Mat binary = new Mat(); + Cv2.Threshold(gray, binary, 0, 255, ThresholdTypes.BinaryInv | ThresholdTypes.Otsu); + //查找轮廓 + //List> contours = new List>(); + OpenCvSharp.Point[][] contours = null; + HierarchyIndex[] hierarchly; + Cv2.FindContours(binary, out contours, out hierarchly, RetrievalModes.Tree, ContourApproximationModes.ApproxSimple, new OpenCvSharp.Point(0, 0)); + + for (int i = 0; i < contours.Length; i++) + { + double length = Cv2.ArcLength(contours[i], true); + if (length > 300 && length < 400) + { + Lastcontours.Add(contours[i]); + } + + } + } + + /// + /// 螺丝位置确定 + /// + /// + /// + public void GetScrew(Mat image, List ResultPoint) + { + Mat SrcImage = image.Clone(); + // 固定路径的模板图像 + Mat Image = Cv2.ImRead(@"D:\MelsecPLCReadWrite\Bk\Image\1.png"); + Mat TempleteImage = Image.Clone(); + + // Point[][] contours1 = new Point[][] { }; + // Point[][] contours2 = null; + List contours1 = new List(); + List contours2 = new List(); + + Contour_Get(SrcImage, contours1); + Contour_Get(TempleteImage, contours2); + + // Hu矩计算 + //Moments mm2 = Cv2.Moments(contours2[0]); // 先计算几何矩 + //Mat hu2 = new Mat(); + double[] hu2 = Cv2.Moments(contours2[0]).HuMoments(); + //Cv2.HuMoments(mm2, hu2); + for (int t = 0; t < contours1.Count(); t++) + { + Moments mm = Cv2.Moments(contours1[t]); // 先计算几何矩 + //Mat hu = new Mat(); + //Cv2.HuMoments(mm, hu); + double[] hu = Cv2.Moments(contours1[t]).HuMoments(); + double sim_value = Cv2.MatchShapes(hu[t], hu2[0], ShapeMatchModes.I1, 0); + if ((1 - sim_value) > 0.7) + { + // 获取图像1轮廓的中心位置 + double cx = mm.M10 / mm.M00; + double cy = mm.M01 / mm.M00; + MyPoint Mypoints = new MyPoint(); + Mypoints.dX = cx; + Mypoints.dY = cy; + + ResultPoint.Add(Mypoints); + } + } + } void genCalibratePts1() { try { CVCalibrationConfig AcVCalibrationConfig = new CVCalibrationConfig(); //每一组的标定配置务必要有 - DiffVPVRPoint A_ShiJIaoPoint = AModeTypeRun.A_deviation[ShiJiaoVecCountFlag1]; + DiffVPVRPoint A_ShiJIaoPoint = AModeTypeRun.Deviation[ShiJiaoVecCountFlag1]; //CVCalibrationConfig cVCalibrationConfig = ModeTypeRun.CVCalibrationConfig; foreach (var CalNum in AModeTypeRun.CVCalibrationConfig) { @@ -254,7 +336,7 @@ namespace BRS.Process.A020 current_P.Y = A_ShiJIaoPoint.Y; current_P.Z = A_ShiJIaoPoint.Z; float PYliangx = current_P.X; - float PYliangy = current_P.Z; + float PYliangy = current_P.Y; VP.Clear(); VR.Clear(); @@ -313,8 +395,6 @@ namespace BRS.Process.A020 tp.dY = VPList[11].Y;// 1727; VP.Add(tp); - - /*************生成三维数据*********************/ MyPoint tr; @@ -386,19 +466,26 @@ namespace BRS.Process.A020 Stopwatch stopWatch = new Stopwatch(); stopWatch.Restart(); - + Mat Image = Cv2.ImRead(@"D:\MelsecPLCReadWrite\Bk\Image\1.png"); #if true genCalibratePts1(); stopWatch2.Stop(); Console.WriteLine(DateTime.Now + "==========配置=================" + stopWatch2.ElapsedMilliseconds + "==========================="); - MyPoint ssw = new MyPoint(); + //MyPoint ssw = new MyPoint(); + List resultPoint = new List(); + Mat _mat = dd.Clone(); string ss = "D:\\QT1\\" + DateTime.Now.ToString("HHmmssfff") + ".jpg"; Cv2.ImWrite(ss, _mat); - Mat _mat2 = AloghitomMat(_mat, ref ssw);//根据拍摄的白纸定标图片确定二维到三维转换的关系 - ssw1 = Interpolation(VP, VR, ssw, true);//实际坐标值 + + GetScrew(Image, resultPoint); + + MyPoint ssw3 = resultPoint[0]; + Mat _mat2 = AloghitomMat(_mat, ref ssw3);//根据拍摄的白纸定标图片确定二维到三维转换的关系 + + ssw1 = Interpolation(VP, VR, ssw3, true);//实际坐标值 string ss2 = "D:\\QT\\" + DateTime.Now.ToString("HHmmssfff") + ".jpg"; Cv2.ImWrite(ss2, _mat2); @@ -440,11 +527,13 @@ namespace BRS.Process.A020 return new ProcessResponse(false); } LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候..."); + PrepareBatchNO(); - + ProcessStatus = ProcessStatus.Unknown; var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; var KawasakiRobot = DeviceCollection.Find(d => d is KawasakiTCPSeverRobotDriver) as KawasakiTCPSeverRobotDriver; - StrRobotPoint strPointInitA; + + StrRobotPoint strPointInitA;//示教点位 strPointInitA.X = 847.462F; strPointInitA.Y = 891.623F; strPointInitA.Z = 803.067F; @@ -452,24 +541,25 @@ namespace BRS.Process.A020 strPointInitA.B = 180F; strPointInitA.C = 90F; - RobotPoint robotInitPoint = KawasakiRobot.IIConfig.RobotInitPosition;//机械臂初始点位 - #region 驱动委托 if (KawasakiRobot != null) { KawasakiRobot.OnTcpDataReceived -= TCPseverDriver_OnDataReceived; KawasakiRobot.OnTcpDataReceived += TCPseverDriver_OnDataReceived; } + KawasakiRobot.SendMessage("PowerON_"); #endregion var sw = A020Config.ProcessInitialOps[0]; + InitialOEEStatistic(); MachineState = MachineState.Running; - ProcessStatus = ProcessStatus.ALLFinish; - - //OpenCam1(); + ProcessStatus = ProcessStatus.Init; + RobotsStatus = RobotsStatus.Release; + KawasakiRobotInit(KawasakiRobot);//机械臂移动到初始位置 + OpenCam1(); Task.Run(() => { @@ -479,16 +569,31 @@ namespace BRS.Process.A020 { case ProcessStatus.Init: { + string ALLShePinChar = "11 00 EE 00 AA 05 68 94 00 00 50 15 49 34 7C 55 4E 6C"; + //从json配置中选择是某种模型 取出他们的配置 + //等待光电触发来电信号 + foreach (var sgepin in A020Config.ProcessInitialOps) + { + // foreach (var sp in sgepin.ShePinConfig) + { + // if (sp.ShePinConfig == ALLShePinChar) + // { + + AModeTypeRun = sgepin;//模型型号匹配 + + // } + } + } if (RobotsStatus.Release == RobotsStatus)//机器人复位,初始状态 { - //========移动到示教点(初始点)========== - int ShiJiaoVecCount = AModeTypeRun.A_deviation.Count;//相机1的偏移点组 + int ShiJiaoVecCount = AModeTypeRun.Deviation.Count;//相机的偏移点组 + //int ShiJiaoVecCount =2; if (ShiJiaoVecCountFlag1 < ShiJiaoVecCount) { CQRobotPoint cQRobotPoint = new CQRobotPoint();//示教拍摄点 - - DiffVPVRPoint A_ShiJIaoPoint = AModeTypeRun.A_deviation[ShiJiaoVecCountFlag1]; + + DiffVPVRPoint A_ShiJIaoPoint = AModeTypeRun.Deviation[ShiJiaoVecCountFlag1]; //CVCalibrationConfig cVCalibrationConfig = ModeTypeRun.CVCalibrationConfig; foreach (var CalNum in AModeTypeRun.CVCalibrationConfig) { @@ -502,7 +607,7 @@ namespace BRS.Process.A020 current_P.X = A_ShiJIaoPoint.X; current_P.Y = A_ShiJIaoPoint.Y; current_P.Z = A_ShiJIaoPoint.Z; - + //当前拍摄点 StrRobotPoint CurrentPointInit = CQRobotPointChangeStrRobotPoint(cQRobotPoint, current_P); strPointInitA.X = CurrentPointInit.X; strPointInitA.Y = CurrentPointInit.Y; @@ -511,19 +616,20 @@ namespace BRS.Process.A020 strPointInitA.B = CurrentPointInit.B; strPointInitA.C = CurrentPointInit.C; - //string PointInitMove = KawasakiRobotMove(KawasakiRobot, strPointInitA); - //KawasakiRobot.SendMessage(PointInitMove); - //LogAsync(DateTime.Now, LogLevel.Assist, $"机械臂A移动到示教点"); - //RobotsStatus = RobotsStatus.Runing; - //DownCirce = DownCirce.DownCirce; - //while (true) - //{ - // if (DownCirce == DownCirce.DownCirceRuning) - // break; - // else - // Thread.Sleep(10); - //} - KawasakiRobotInit(KawasakiRobot); + string PointInitMove = MoveRobot(strPointInitA); + KawasakiRobot.SendMessage(PointInitMove); + LogAsync(DateTime.Now, LogLevel.Assist, $"机械臂A移动到示教点"); + RobotsStatus = RobotsStatus.Runing; + DownCirce = DownCirce.DownCirce;//标志机械臂的运动状态 + while (true) + { + if (DownCirce == DownCirce.DownCirceRuning) + break; + else + Thread.Sleep(10); + } + ProcessStatus = ProcessStatus.OpenLight; + //KawasakiRobotInit(KawasakiRobot); } } } @@ -548,6 +654,7 @@ namespace BRS.Process.A020 Console.WriteLine(DateTime.Now + "=========拍照==================" + stopWatch.ElapsedMilliseconds + "==========================="); CamA = false; } + ProcessStatus = ProcessStatus.CVLocation; #endregion } break; @@ -567,8 +674,8 @@ namespace BRS.Process.A020 #region 机械臂移动视觉定位点 strPointInitA.X = (float)sswF.dX; - strPointInitA.Z = (float)sswF.dY; - if (Math.Abs((float)strPointInitA.X) <= 100 || Math.Abs((float)strPointInitA.Z) <= 0) + strPointInitA.Y = (float)sswF.dY;//相机坐标赋值给机械臂坐标 + if (Math.Abs((float)strPointInitA.X) <= 100 || Math.Abs((float)strPointInitA.Y) <= 0) { StopMachineClosing(MelsecPLC, KawasakiRobot); @@ -576,7 +683,6 @@ namespace BRS.Process.A020 LogAsync(DateTime.Now, LogLevel.Assist, $"计算定位失败"); break; - } // //==========平滑移动 @@ -585,7 +691,7 @@ namespace BRS.Process.A020 strPointInitA1 = strPointInitA; StrRobotPoint strPointInitA2 = new StrRobotPoint(); strPointInitA2 = strPointInitA; - strPointInitA2.Y += A_Distance_DisD; + strPointInitA2.Z += Distance_DisD;//XYZ是毫米 _strRobotPointAs.Add(strPointInitA1); _strRobotPointAs.Add(strPointInitA2); //KawasakiRobotMoves(KawasakiRobot, _strRobotPointAs, false); @@ -593,8 +699,8 @@ namespace BRS.Process.A020 DownCirce = DownCirce.DownCirce; KawasakiRobot.SendMessage(TestPoint);//机械臂移动视觉定位点 - LogAsync(DateTime.Now, LogLevel.Assist, $"机械臂A移动视觉定位点完成"); + LogAsync(DateTime.Now, LogLevel.Assist, $"机械臂A移动视觉定位点完成"); RobotsStatus = RobotsStatus.Runing; while (true) @@ -604,20 +710,245 @@ namespace BRS.Process.A020 else Thread.Sleep(10); } + IsArrive = true; #endregion + if (IsTough == true) + { + ProcessStatus = ProcessStatus.ShaftLoosenRunning; + ShaftOperateOnce(MelsecPLC, "D1", 500);//D1置1延时500后置0 + ShaftOperateOnce(MelsecPLC, "D55", 500);//自动拧紧螺丝标志位先置1,0.5s后置0 + Thread.Sleep(20); + } + else + { + ProcessStatus = ProcessStatus.ShaftToughRunning; + ShaftOperateOnce(MelsecPLC, "D1", 500);//D1置1延时500后置0 + ShaftOperateOnce(MelsecPLC, "D57", 500);//自动拧紧螺丝标志位先置1,0.5s后置0 + Thread.Sleep(20); + } + } else { Thread.Sleep(10); } } + break; + case ProcessStatus.ShaftToughRunning: + { + string ShaftCommunication = ProcessReadInt(MelsecPLC, "D201", "int");//通讯 + if (ShaftCommunication == "111")//如果等于111,流程启动 + { + string ShaftEmergencyStop = ProcessReadInt(MelsecPLC, "D19", "int");//急停 + if (ShaftEmergencyStop != "0")//判断是否急停,0不急停,1急停 + { + LogAsync(DateTime.Now, LogLevel.Warning, "设备急停!"); + //Thread.Sleep(2000); + return; + } + else + { + + //ProcessWriteInt(MelsecPLC, "D3", "int", "0");//D3置0 + //ProcessWriteInt(MelsecPLC, "D7", "int", "1");//手动/自动,置1自动 + //ProcessWriteInt(MelsecPLC, "D161", "int", "5");//旋转所需最小圈数 + //ProcessWriteInt(MelsecPLC, "D163", "int", "15");//最大圈数 + //ProcessWriteInt(MelsecPLC, "D151", "int", "3000");//超时停止设置值 + //ProcessWriteInt(MelsecPLC, "D173", "int", "200");//目标扭矩 + //ProcessWriteInt(MelsecPLC, "D171", "int", "2000");//最大扭矩3000 + //ProcessWriteInt(MelsecPLC, "D55", "int", "1");//自动拧紧螺丝D55置1 + ProcessWriteInt(MelsecPLC, "D155", "int", "10");//扭矩到目标设定值计时设定值,设为1秒 + ShaftOperateOnce(MelsecPLC, "D55", 500);//自动拧紧螺丝标志位先置1,0.5s后置0 + + //machineState = MachineState.Waiting;//设备启动完成后保持状态 + LogAsync(DateTime.Now, LogLevel.Detail, "设备已启动,请勿其他操作!!"); + IsShaftOpen = true; + RobotsStatus = RobotsStatus.Runing; + // DownCirce = DownCirce.DownCirce; + } + //while (true) + //{ + // if (DownCirce == DownCirce.DownCirceRuning) + // break; + // else + // Thread.Sleep(10); + //} + IsTough = true; + ProcessStatus = ProcessStatus.Judge; + } + else + { + LogAsync(DateTime.Now, LogLevel.Warning, "通讯故障!"); + + return; + } + + } + break; + case ProcessStatus.ShaftLoosenRunning: + { + string ShaftCommunication = ProcessReadInt(MelsecPLC, "D201", "int");//通讯 + if (ShaftCommunication == "111")//如果等于111,流程启动 + { + string ShaftEmergencyStop = ProcessReadInt(MelsecPLC, "D19", "int");//急停 + if (ShaftEmergencyStop != "0")//判断是否急停,0不急停,1急停 + { + LogAsync(DateTime.Now, LogLevel.Warning, "设备急停!"); + //Thread.Sleep(2000); + return; + } + else + { + //ProcessWriteInt(MelsecPLC, "D3", "int", "0");//D3置0 + //ProcessWriteInt(MelsecPLC, "D7", "int", "1");//手动/自动,置1自动 + //ProcessWriteInt(MelsecPLC, "D161", "int", "5");//旋转所需最小圈数 + //ProcessWriteInt(MelsecPLC, "D163", "int", "15");//最大圈数 + //ProcessWriteInt(MelsecPLC, "D151", "int", "3000");//超时停止设置值 + //ProcessWriteInt(MelsecPLC, "D173", "int", "200");//目标扭矩 + ProcessWriteInt(MelsecPLC, "D171", "int", "2000");//最大扭矩3000 + //ProcessWriteInt(MelsecPLC, "D55", "int", "1");//自动拧紧螺丝D55置1 + ProcessWriteInt(MelsecPLC, "D155", "int", "20");//扭矩到目标设定值计时设定值,设为1秒 + + + //machineState = MachineState.Waiting;//设备启动完成后保持状态 + LogAsync(DateTime.Now, LogLevel.Detail, "设备已启动,请勿其他操作!!"); + IsShaftOpen = true; + RobotsStatus = RobotsStatus.Runing; + DownCirce = DownCirce.DownCirce; + } + while (true) + { + if (DownCirce == DownCirce.DownCirceRuning) + break; + else + Thread.Sleep(10); + } + IsTough = true; + ProcessStatus = ProcessStatus.Judge; + } + else + { + LogAsync(DateTime.Now, LogLevel.Warning, "通讯故障!"); + return; + } + } + break; + case ProcessStatus.Judge: + { + int resValue1; + int resValue2; + string torsionValue = ProcessReadInt(MelsecPLC, "D251", "int"); + string angleValue = ProcessReadInt(MelsecPLC, "D351", "int"); + resValue1 = Convert.ToInt32(torsionValue);//将接收到的返回值转为int类型 + resValue2 = Convert.ToInt32(angleValue) / 200000; + + int MaxAngleValue = Convert.ToInt32(ProcessReadInt(MelsecPLC, "D163", "int"));//读取旋转所需圈数的最大值 + int MinAngleValue = Convert.ToInt32(ProcessReadInt(MelsecPLC, "D161", "int"));//最小值 + int overtime = Convert.ToInt32(ProcessReadInt(MelsecPLC, "D151", "int"));//拧紧超时设定值,当空转达到设定的值时会停止 + int MaxSettingTorsionValue = Convert.ToInt32(ProcessReadInt(MelsecPLC, "D173", "int"));//最大扭矩设定值,当达到这一个值时会停止 + int torsionTime = Convert.ToInt32(ProcessReadInt(MelsecPLC, "D155", "int"));//扭矩到目标设定值计时设定值 + if (resValue1 >= MaxSettingTorsionValue) + { + LogAsync(DateTime.Now, LogLevel.Information, "已完成"); + //ProcessWriteInt(MelsecPLC, "D171", "int", "0"); + + if (MinAngleValue <= resValue2 && resValue2 <= MaxAngleValue) + { + + LogAsync(DateTime.Now, LogLevel.Information, "产品合格"); + + //机械手控制螺丝机退出螺丝, + return; + } + else if (resValue2 < MinAngleValue) + { + //ProcessWriteInt(MelsecPLC, "D171", "int", "0"); + LogAsync(DateTime.Now, LogLevel.Error, "螺丝卡丝"); + + return; + } + //else if (resValue2 > MaxAngleValue) + //{ + // LogAsync(DateTime.Now, LogLevel.Error, "螺丝滑丝"); + // isOpenAuto = false; + // break; + //} + } + else if (resValue2 > MaxAngleValue) + { + Thread.Sleep(100); + + LogAsync(DateTime.Now, LogLevel.Error, "螺丝滑丝"); + + return; + } + while (true) + { + if ("0" == ProcessReadInt(MelsecPLC, "D65", "int")) + break; + else + Thread.Sleep(10); + } + ShaftOperateOnce(MelsecPLC, "D57", 500);//自动拧紧螺丝标志位先置1,0.5s后置0 + ProcessWriteInt(MelsecPLC, "D171", "int", "200"); + ProcessWriteInt(MelsecPLC, "D167", "int", "50000"); + + Thread.Sleep(1000); + + ProcessStatus = ProcessStatus.UpShaft; + } + break; + case ProcessStatus.UpShaft: + { + RobotPoint robotInitPoint1 = KawasakiRobot.IIConfig.RobotInitPosition;//机器人初始点 + StrRobotPoint initPoint = ClassChangeStruct(robotInitPoint); + + List _strRobotPointAup = new List(); + StrRobotPoint strPointInitA3 = new StrRobotPoint(); + strPointInitA3 = strPointInitA; + StrRobotPoint strPointInitA4 = new StrRobotPoint(); + strPointInitA4 = strPointInitA; + StrRobotPoint strPointInitA5 = new StrRobotPoint(); + strPointInitA5 = initPoint; + strPointInitA4.Z -= Distance_DisD;//XYZ是毫米 + _strRobotPointAup.Add(strPointInitA4); + _strRobotPointAup.Add(strPointInitA3); + _strRobotPointAup.Add(strPointInitA5); + //KawasakiRobotMoves(KawasakiRobot, _strRobotPointAs, false); + string TestPoint1 = MoveMoreNContinueRobot(_strRobotPointAup, ref strPointInitA); + + DownCirce = DownCirce.DownCirce; + KawasakiRobot.SendMessage(TestPoint1);//机械臂移动视觉定位点 + + RobotsStatus = RobotsStatus.Runing; + + while (true) + { + if (DownCirce == DownCirce.DownCirceRuning) + break; + else + Thread.Sleep(10); + } + Thread.Sleep(3000); + ProcessStatus = ProcessStatus.Init; + + } + break; + case ProcessStatus.Warning: + { + + } + break; } + Thread.Sleep(20); } }); - - - + + Task.Run(() => + { + + }); LogAsync(DateTime.Now, LogLevel.Action, "流程启动完成!"); PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.IsProcessOpened.ToString(), true, null); return new ProcessResponse(true); @@ -1047,6 +1378,8 @@ namespace BRS.Process.A020 /// 进入自动化控制进程,完成系列动作 /// /// + /// +#if false public ProcessResponse StartProcess() { if (MachineState != MachineState.Ready) @@ -1111,7 +1444,7 @@ namespace BRS.Process.A020 return new ProcessResponse(true); } - +#endif /// /// 使机器人回到初始位置 @@ -1291,7 +1624,7 @@ namespace BRS.Process.A020 ProcessWriteInt(PLC, Address, "int", "1"); Thread.Sleep(Duration); ProcessWriteInt(PLC, Address, "int", "0"); - Thread.Sleep(500); + //Thread.Sleep(500); } /// diff --git a/src/BRS.Process.A020/A020Process_VisionProcessor.cs b/src/BRS.Process.A020/A020Process_VisionProcessor.cs index 994414f..2bccf17 100644 --- a/src/BRS.Process.A020/A020Process_VisionProcessor.cs +++ b/src/BRS.Process.A020/A020Process_VisionProcessor.cs @@ -350,7 +350,7 @@ namespace BRS.Process.A020 if (ProcessStatus == ProcessStatus.Init && RobotsStatus == RobotsStatus.Runing && msg == "wanbi") { msg = string.Empty; - ProcessStatus = ProcessStatus.InitPlc; + RobotsStatus = RobotsStatus.Release; DownCirce = DownCirce.DownCirceRuning; @@ -399,7 +399,34 @@ namespace BRS.Process.A020 RobotsStatus = RobotsStatus.Release; } #endregion - + #region 拧紧轴拧紧到位 + if(ProcessStatus == ProcessStatus.ShaftToughRunning && RobotsStatus == RobotsStatus.Runing && IsShaftOpen==true) + { + msg = string.Empty; + RobotsStatus = RobotsStatus.Release; + DownCirce = DownCirce.DownCirceRuning; + } + + #region 判断拧紧后是否拧松 + if (ProcessStatus == ProcessStatus.Judge && RobotsStatus == RobotsStatus.Runing) + { + msg = string.Empty; + RobotsStatus = RobotsStatus.Release; + DownCirce = DownCirce.DownCirceRuning; + } + + #endregion + + #endregion + #region 拧紧或拧松回原点 + if (ProcessStatus == ProcessStatus.UpShaft && RobotsStatus == RobotsStatus.Runing && msg=="wanbi") + { + msg = string.Empty; + RobotsStatus = RobotsStatus.Release; + DownCirce = DownCirce.DownCirceRuning; + } + + #endregion } /// diff --git a/src/BRS.Process.A020/UI/ContorlShaft.Designer.cs b/src/BRS.Process.A020/UI/ContorlShaft.Designer.cs index 12af6d6..6cec8f3 100644 --- a/src/BRS.Process.A020/UI/ContorlShaft.Designer.cs +++ b/src/BRS.Process.A020/UI/ContorlShaft.Designer.cs @@ -46,6 +46,9 @@ namespace BRS.Process.A020.UI this.StopStateLabel = new Sunny.UI.UILabel(); this.chart2 = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.uiPanel1 = new Sunny.UI.UIPanel(); + this.uiPanel3 = new Sunny.UI.UIPanel(); + this.StartBtn1 = new Sunny.UI.UIButton(); + this.StopBtn2 = new Sunny.UI.UIButton(); this.BtnSeries = new Sunny.UI.UIPanel(); this.label13 = new System.Windows.Forms.Label(); this.ManualLoosenBtn = new Sunny.UI.UIButton(); @@ -67,26 +70,16 @@ namespace BRS.Process.A020.UI this.textBox3 = new System.Windows.Forms.TextBox(); this.label8 = new System.Windows.Forms.Label(); this.LightSeries = new Sunny.UI.UIPanel(); + this.label15 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); - this.ManualLight = new BRS.Process.A020.UI.CircleButton(); - this.AutoLight = new BRS.Process.A020.UI.CircleButton(); - this.MoveStateLight1 = new BRS.Process.A020.UI.CircleButton(); - this.StopStateLight1 = new BRS.Process.A020.UI.CircleButton(); - this.ToughLight1 = new BRS.Process.A020.UI.CircleButton(); - this.LoosenLight1 = new BRS.Process.A020.UI.CircleButton(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.uiPanel2 = new Sunny.UI.UIPanel(); this.label14 = new System.Windows.Forms.Label(); - this.AutoBtn1 = new BRS.Process.A020.UI.CircleButton(); - this.ManualBtn1 = new BRS.Process.A020.UI.CircleButton(); - this.ESBtn = new BRS.Process.A020.UI.CircleButton(); this.TestBtn = new Sunny.UI.UIButton(); - this.StopBtn2 = new Sunny.UI.UIButton(); - this.StartBtn1 = new Sunny.UI.UIButton(); this.AutoLoosenBtn = new Sunny.UI.UIButton(); this.AutoToughBtn = new Sunny.UI.UIButton(); this.uiLabel2 = new Sunny.UI.UILabel(); @@ -95,8 +88,19 @@ namespace BRS.Process.A020.UI this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.uiButton1 = new Sunny.UI.UIButton(); this.timer2 = new System.Windows.Forms.Timer(this.components); + this.RobotAStatus = new BRS.Process.A020.UI.CircleButton(); + this.ManualLight = new BRS.Process.A020.UI.CircleButton(); + this.AutoLight = new BRS.Process.A020.UI.CircleButton(); + this.MoveStateLight1 = new BRS.Process.A020.UI.CircleButton(); + this.StopStateLight1 = new BRS.Process.A020.UI.CircleButton(); + this.ToughLight1 = new BRS.Process.A020.UI.CircleButton(); + this.LoosenLight1 = new BRS.Process.A020.UI.CircleButton(); + this.AutoBtn1 = new BRS.Process.A020.UI.CircleButton(); + this.ManualBtn1 = new BRS.Process.A020.UI.CircleButton(); + this.ESBtn = new BRS.Process.A020.UI.CircleButton(); ((System.ComponentModel.ISupportInitialize)(this.chart2)).BeginInit(); this.uiPanel1.SuspendLayout(); + this.uiPanel3.SuspendLayout(); this.BtnSeries.SuspendLayout(); this.ParameterSetting.SuspendLayout(); this.LightSeries.SuspendLayout(); @@ -230,13 +234,12 @@ namespace BRS.Process.A020.UI // // uiPanel1 // + this.uiPanel1.Controls.Add(this.uiPanel3); this.uiPanel1.Controls.Add(this.BtnSeries); this.uiPanel1.Controls.Add(this.ParameterSetting); this.uiPanel1.Controls.Add(this.LightSeries); this.uiPanel1.Controls.Add(this.uiPanel2); this.uiPanel1.Controls.Add(this.TestBtn); - this.uiPanel1.Controls.Add(this.StopBtn2); - this.uiPanel1.Controls.Add(this.StartBtn1); this.uiPanel1.Dock = System.Windows.Forms.DockStyle.Left; this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiPanel1.Location = new System.Drawing.Point(0, 0); @@ -250,6 +253,51 @@ namespace BRS.Process.A020.UI this.uiPanel1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); this.uiPanel1.Load += new System.EventHandler(this.uiPanel1_Load); // + // uiPanel3 + // + this.uiPanel3.Controls.Add(this.StartBtn1); + this.uiPanel3.Controls.Add(this.StopBtn2); + this.uiPanel3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiPanel3.Location = new System.Drawing.Point(12, 0); + this.uiPanel3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiPanel3.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPanel3.Name = "uiPanel3"; + this.uiPanel3.Size = new System.Drawing.Size(204, 153); + this.uiPanel3.TabIndex = 41; + this.uiPanel3.Text = null; + this.uiPanel3.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; + this.uiPanel3.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); + // + // StartBtn1 + // + this.StartBtn1.Cursor = System.Windows.Forms.Cursors.Hand; + this.StartBtn1.Dock = System.Windows.Forms.DockStyle.Left; + this.StartBtn1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.StartBtn1.Location = new System.Drawing.Point(0, 0); + this.StartBtn1.MinimumSize = new System.Drawing.Size(1, 1); + this.StartBtn1.Name = "StartBtn1"; + this.StartBtn1.Size = new System.Drawing.Size(97, 153); + this.StartBtn1.TabIndex = 7; + this.StartBtn1.Text = "开始"; + this.StartBtn1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.StartBtn1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); + this.StartBtn1.Click += new System.EventHandler(this.StartBtn1_Click); + // + // StopBtn2 + // + this.StopBtn2.Cursor = System.Windows.Forms.Cursors.Hand; + this.StopBtn2.Dock = System.Windows.Forms.DockStyle.Right; + this.StopBtn2.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.StopBtn2.Location = new System.Drawing.Point(107, 0); + this.StopBtn2.MinimumSize = new System.Drawing.Size(1, 1); + this.StopBtn2.Name = "StopBtn2"; + this.StopBtn2.Size = new System.Drawing.Size(97, 153); + this.StopBtn2.TabIndex = 8; + this.StopBtn2.Text = "停止"; + this.StopBtn2.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.StopBtn2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); + this.StopBtn2.Click += new System.EventHandler(this.StopBtn2_Click); + // // BtnSeries // this.BtnSeries.Controls.Add(this.label13); @@ -258,11 +306,11 @@ namespace BRS.Process.A020.UI this.BtnSeries.Controls.Add(this.AutoLoosenBtn1); this.BtnSeries.Controls.Add(this.ManualToughBtn); this.BtnSeries.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.BtnSeries.Location = new System.Drawing.Point(352, 155); + this.BtnSeries.Location = new System.Drawing.Point(352, 152); this.BtnSeries.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.BtnSeries.MinimumSize = new System.Drawing.Size(1, 1); this.BtnSeries.Name = "BtnSeries"; - this.BtnSeries.Size = new System.Drawing.Size(367, 391); + this.BtnSeries.Size = new System.Drawing.Size(367, 394); this.BtnSeries.TabIndex = 40; this.BtnSeries.Text = null; this.BtnSeries.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; @@ -271,10 +319,11 @@ namespace BRS.Process.A020.UI // label13 // this.label13.BackColor = System.Drawing.Color.Transparent; + this.label13.Dock = System.Windows.Forms.DockStyle.Top; this.label13.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label13.Location = new System.Drawing.Point(1, 3); + this.label13.Location = new System.Drawing.Point(0, 0); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(123, 47); + this.label13.Size = new System.Drawing.Size(367, 47); this.label13.TabIndex = 37; this.label13.Text = "操作按钮"; this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -282,11 +331,11 @@ namespace BRS.Process.A020.UI // ManualLoosenBtn // this.ManualLoosenBtn.Cursor = System.Windows.Forms.Cursors.Hand; - this.ManualLoosenBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.ManualLoosenBtn.Location = new System.Drawing.Point(3, 206); + this.ManualLoosenBtn.Font = new System.Drawing.Font("微软雅黑", 18F); + this.ManualLoosenBtn.Location = new System.Drawing.Point(2, 223); this.ManualLoosenBtn.MinimumSize = new System.Drawing.Size(1, 1); this.ManualLoosenBtn.Name = "ManualLoosenBtn"; - this.ManualLoosenBtn.Size = new System.Drawing.Size(150, 75); + this.ManualLoosenBtn.Size = new System.Drawing.Size(170, 110); this.ManualLoosenBtn.TabIndex = 10; this.ManualLoosenBtn.Text = "手动拧松"; this.ManualLoosenBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -297,11 +346,11 @@ namespace BRS.Process.A020.UI // AutoToughBtn1 // this.AutoToughBtn1.Cursor = System.Windows.Forms.Cursors.Hand; - this.AutoToughBtn1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.AutoToughBtn1.Location = new System.Drawing.Point(212, 85); + this.AutoToughBtn1.Font = new System.Drawing.Font("微软雅黑", 18F); + this.AutoToughBtn1.Location = new System.Drawing.Point(192, 85); this.AutoToughBtn1.MinimumSize = new System.Drawing.Size(1, 1); this.AutoToughBtn1.Name = "AutoToughBtn1"; - this.AutoToughBtn1.Size = new System.Drawing.Size(150, 75); + this.AutoToughBtn1.Size = new System.Drawing.Size(170, 110); this.AutoToughBtn1.TabIndex = 11; this.AutoToughBtn1.Text = "自动拧紧"; this.AutoToughBtn1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -311,11 +360,11 @@ namespace BRS.Process.A020.UI // AutoLoosenBtn1 // this.AutoLoosenBtn1.Cursor = System.Windows.Forms.Cursors.Hand; - this.AutoLoosenBtn1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.AutoLoosenBtn1.Location = new System.Drawing.Point(212, 206); + this.AutoLoosenBtn1.Font = new System.Drawing.Font("微软雅黑", 18F); + this.AutoLoosenBtn1.Location = new System.Drawing.Point(192, 223); this.AutoLoosenBtn1.MinimumSize = new System.Drawing.Size(1, 1); this.AutoLoosenBtn1.Name = "AutoLoosenBtn1"; - this.AutoLoosenBtn1.Size = new System.Drawing.Size(150, 75); + this.AutoLoosenBtn1.Size = new System.Drawing.Size(170, 110); this.AutoLoosenBtn1.TabIndex = 12; this.AutoLoosenBtn1.Text = "自动拧松"; this.AutoLoosenBtn1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -325,11 +374,11 @@ namespace BRS.Process.A020.UI // ManualToughBtn // this.ManualToughBtn.Cursor = System.Windows.Forms.Cursors.Hand; - this.ManualToughBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.ManualToughBtn.Font = new System.Drawing.Font("微软雅黑", 18F); this.ManualToughBtn.Location = new System.Drawing.Point(3, 85); this.ManualToughBtn.MinimumSize = new System.Drawing.Size(1, 1); this.ManualToughBtn.Name = "ManualToughBtn"; - this.ManualToughBtn.Size = new System.Drawing.Size(150, 75); + this.ManualToughBtn.Size = new System.Drawing.Size(170, 110); this.ManualToughBtn.TabIndex = 9; this.ManualToughBtn.Text = "手动拧紧"; this.ManualToughBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -357,7 +406,7 @@ namespace BRS.Process.A020.UI this.ParameterSetting.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.ParameterSetting.MinimumSize = new System.Drawing.Size(1, 1); this.ParameterSetting.Name = "ParameterSetting"; - this.ParameterSetting.Size = new System.Drawing.Size(332, 394); + this.ParameterSetting.Size = new System.Drawing.Size(338, 394); this.ParameterSetting.TabIndex = 39; this.ParameterSetting.Text = null; this.ParameterSetting.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; @@ -366,10 +415,11 @@ namespace BRS.Process.A020.UI // label10 // this.label10.BackColor = System.Drawing.Color.Transparent; + this.label10.Dock = System.Windows.Forms.DockStyle.Top; this.label10.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label10.Location = new System.Drawing.Point(3, 3); + this.label10.Location = new System.Drawing.Point(0, 0); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(123, 47); + this.label10.Size = new System.Drawing.Size(338, 47); this.label10.TabIndex = 36; this.label10.Text = "参数设置"; this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -378,7 +428,7 @@ namespace BRS.Process.A020.UI // this.OKBtn.Cursor = System.Windows.Forms.Cursors.Hand; this.OKBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.OKBtn.Location = new System.Drawing.Point(226, 250); + this.OKBtn.Location = new System.Drawing.Point(263, 324); this.OKBtn.MinimumSize = new System.Drawing.Size(1, 1); this.OKBtn.Name = "OKBtn"; this.OKBtn.Size = new System.Drawing.Size(70, 31); @@ -395,7 +445,7 @@ namespace BRS.Process.A020.UI this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(134, 30); this.textBox1.TabIndex = 24; - this.textBox1.Text = "2000"; + this.textBox1.Text = "200"; this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // label5 @@ -413,7 +463,7 @@ namespace BRS.Process.A020.UI // this.ResettingBtn.Cursor = System.Windows.Forms.Cursors.Hand; this.ResettingBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.ResettingBtn.Location = new System.Drawing.Point(150, 250); + this.ResettingBtn.Location = new System.Drawing.Point(187, 324); this.ResettingBtn.MinimumSize = new System.Drawing.Size(1, 1); this.ResettingBtn.Name = "ResettingBtn"; this.ResettingBtn.Size = new System.Drawing.Size(70, 31); @@ -427,7 +477,7 @@ namespace BRS.Process.A020.UI // this.label6.BackColor = System.Drawing.Color.Transparent; this.label6.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label6.Location = new System.Drawing.Point(6, 112); + this.label6.Location = new System.Drawing.Point(6, 125); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(150, 30); this.label6.TabIndex = 27; @@ -436,7 +486,7 @@ namespace BRS.Process.A020.UI // // textBox5 // - this.textBox5.Location = new System.Drawing.Point(162, 214); + this.textBox5.Location = new System.Drawing.Point(162, 260); this.textBox5.Multiline = true; this.textBox5.Name = "textBox5"; this.textBox5.Size = new System.Drawing.Size(134, 30); @@ -446,7 +496,7 @@ namespace BRS.Process.A020.UI // // textBox2 // - this.textBox2.Location = new System.Drawing.Point(162, 114); + this.textBox2.Location = new System.Drawing.Point(162, 127); this.textBox2.Multiline = true; this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(134, 30); @@ -458,7 +508,7 @@ namespace BRS.Process.A020.UI // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label9.Location = new System.Drawing.Point(6, 214); + this.label9.Location = new System.Drawing.Point(6, 260); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(150, 30); this.label9.TabIndex = 33; @@ -469,7 +519,7 @@ namespace BRS.Process.A020.UI // this.label7.BackColor = System.Drawing.Color.Transparent; this.label7.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label7.Location = new System.Drawing.Point(6, 147); + this.label7.Location = new System.Drawing.Point(6, 172); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(150, 30); this.label7.TabIndex = 29; @@ -478,7 +528,7 @@ namespace BRS.Process.A020.UI // // textBox4 // - this.textBox4.Location = new System.Drawing.Point(162, 181); + this.textBox4.Location = new System.Drawing.Point(162, 217); this.textBox4.Multiline = true; this.textBox4.Name = "textBox4"; this.textBox4.Size = new System.Drawing.Size(134, 30); @@ -488,7 +538,7 @@ namespace BRS.Process.A020.UI // // textBox3 // - this.textBox3.Location = new System.Drawing.Point(162, 147); + this.textBox3.Location = new System.Drawing.Point(162, 172); this.textBox3.Multiline = true; this.textBox3.Name = "textBox3"; this.textBox3.Size = new System.Drawing.Size(134, 30); @@ -500,7 +550,7 @@ namespace BRS.Process.A020.UI // this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label8.Location = new System.Drawing.Point(26, 181); + this.label8.Location = new System.Drawing.Point(26, 217); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(114, 30); this.label8.TabIndex = 31; @@ -509,6 +559,8 @@ namespace BRS.Process.A020.UI // // LightSeries // + this.LightSeries.Controls.Add(this.label15); + this.LightSeries.Controls.Add(this.RobotAStatus); this.LightSeries.Controls.Add(this.label12); this.LightSeries.Controls.Add(this.label11); this.LightSeries.Controls.Add(this.ManualLight); @@ -522,21 +574,32 @@ namespace BRS.Process.A020.UI this.LightSeries.Controls.Add(this.label3); this.LightSeries.Controls.Add(this.label4); this.LightSeries.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.LightSeries.Location = new System.Drawing.Point(219, 5); + this.LightSeries.Location = new System.Drawing.Point(219, 0); this.LightSeries.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.LightSeries.MinimumSize = new System.Drawing.Size(1, 1); this.LightSeries.Name = "LightSeries"; - this.LightSeries.Size = new System.Drawing.Size(812, 148); + this.LightSeries.Size = new System.Drawing.Size(819, 153); this.LightSeries.TabIndex = 38; this.LightSeries.Text = null; this.LightSeries.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; this.LightSeries.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); // + // label15 + // + this.label15.AutoSize = true; + this.label15.BackColor = System.Drawing.Color.Silver; + this.label15.Location = new System.Drawing.Point(713, 100); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(74, 42); + this.label15.TabIndex = 29; + this.label15.Text = "机械臂\r\n连接状态"; + this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // // label12 // this.label12.AutoSize = true; this.label12.BackColor = System.Drawing.Color.Silver; - this.label12.Location = new System.Drawing.Point(668, 100); + this.label12.Location = new System.Drawing.Point(545, 100); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(106, 42); this.label12.TabIndex = 27; @@ -547,71 +610,13 @@ namespace BRS.Process.A020.UI // this.label11.AutoSize = true; this.label11.BackColor = System.Drawing.Color.Silver; - this.label11.Location = new System.Drawing.Point(537, 100); + this.label11.Location = new System.Drawing.Point(433, 100); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(106, 42); this.label11.TabIndex = 26; this.label11.Text = "自动拧紧状态\r\n指示灯"; this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // ManualLight - // - this.ManualLight.BackColor = System.Drawing.Color.Gray; - this.ManualLight.Cursor = System.Windows.Forms.Cursors.Hand; - this.ManualLight.Enabled = false; - this.ManualLight.Location = new System.Drawing.Point(672, 7); - this.ManualLight.Name = "ManualLight"; - this.ManualLight.Size = new System.Drawing.Size(90, 90); - this.ManualLight.TabIndex = 25; - this.ManualLight.UseVisualStyleBackColor = false; - // - // AutoLight - // - this.AutoLight.BackColor = System.Drawing.Color.Gray; - this.AutoLight.Cursor = System.Windows.Forms.Cursors.Hand; - this.AutoLight.Enabled = false; - this.AutoLight.Location = new System.Drawing.Point(541, 7); - this.AutoLight.Name = "AutoLight"; - this.AutoLight.Size = new System.Drawing.Size(90, 90); - this.AutoLight.TabIndex = 24; - this.AutoLight.UseVisualStyleBackColor = false; - // - // MoveStateLight1 - // - this.MoveStateLight1.BackColor = System.Drawing.Color.Gray; - this.MoveStateLight1.Location = new System.Drawing.Point(17, 7); - this.MoveStateLight1.Name = "MoveStateLight1"; - this.MoveStateLight1.Size = new System.Drawing.Size(90, 90); - this.MoveStateLight1.TabIndex = 3; - this.MoveStateLight1.UseVisualStyleBackColor = false; - // - // StopStateLight1 - // - this.StopStateLight1.BackColor = System.Drawing.Color.Gray; - this.StopStateLight1.Location = new System.Drawing.Point(148, 7); - this.StopStateLight1.Name = "StopStateLight1"; - this.StopStateLight1.Size = new System.Drawing.Size(90, 90); - this.StopStateLight1.TabIndex = 15; - this.StopStateLight1.UseVisualStyleBackColor = false; - // - // ToughLight1 - // - this.ToughLight1.BackColor = System.Drawing.Color.Gray; - this.ToughLight1.Location = new System.Drawing.Point(279, 7); - this.ToughLight1.Name = "ToughLight1"; - this.ToughLight1.Size = new System.Drawing.Size(90, 90); - this.ToughLight1.TabIndex = 16; - this.ToughLight1.UseVisualStyleBackColor = false; - // - // LoosenLight1 - // - this.LoosenLight1.BackColor = System.Drawing.Color.Gray; - this.LoosenLight1.Location = new System.Drawing.Point(410, 7); - this.LoosenLight1.Name = "LoosenLight1"; - this.LoosenLight1.Size = new System.Drawing.Size(90, 90); - this.LoosenLight1.TabIndex = 17; - this.LoosenLight1.UseVisualStyleBackColor = false; - // // label1 // this.label1.AutoSize = true; @@ -627,7 +632,7 @@ namespace BRS.Process.A020.UI // this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.Color.Silver; - this.label2.Location = new System.Drawing.Point(155, 100); + this.label2.Location = new System.Drawing.Point(121, 100); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(74, 42); this.label2.TabIndex = 21; @@ -638,7 +643,7 @@ namespace BRS.Process.A020.UI // this.label3.AutoSize = true; this.label3.BackColor = System.Drawing.Color.Silver; - this.label3.Location = new System.Drawing.Point(271, 100); + this.label3.Location = new System.Drawing.Point(209, 100); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(106, 42); this.label3.TabIndex = 22; @@ -649,7 +654,7 @@ namespace BRS.Process.A020.UI // this.label4.AutoSize = true; this.label4.BackColor = System.Drawing.Color.Silver; - this.label4.Location = new System.Drawing.Point(405, 100); + this.label4.Location = new System.Drawing.Point(321, 100); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(106, 42); this.label4.TabIndex = 23; @@ -663,11 +668,11 @@ namespace BRS.Process.A020.UI this.uiPanel2.Controls.Add(this.ManualBtn1); this.uiPanel2.Controls.Add(this.ESBtn); this.uiPanel2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiPanel2.Location = new System.Drawing.Point(728, 155); + this.uiPanel2.Location = new System.Drawing.Point(721, 152); this.uiPanel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiPanel2.MinimumSize = new System.Drawing.Size(1, 1); this.uiPanel2.Name = "uiPanel2"; - this.uiPanel2.Size = new System.Drawing.Size(303, 391); + this.uiPanel2.Size = new System.Drawing.Size(317, 394); this.uiPanel2.TabIndex = 37; this.uiPanel2.Text = null; this.uiPanel2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; @@ -676,50 +681,15 @@ namespace BRS.Process.A020.UI // label14 // this.label14.BackColor = System.Drawing.Color.Transparent; + this.label14.Dock = System.Windows.Forms.DockStyle.Top; this.label14.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label14.Location = new System.Drawing.Point(3, 3); + this.label14.Location = new System.Drawing.Point(0, 0); this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(123, 47); + this.label14.Size = new System.Drawing.Size(317, 47); this.label14.TabIndex = 38; this.label14.Text = "操作按钮"; this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // AutoBtn1 - // - this.AutoBtn1.BackColor = System.Drawing.Color.Gray; - this.AutoBtn1.Cursor = System.Windows.Forms.Cursors.Hand; - this.AutoBtn1.Location = new System.Drawing.Point(3, 73); - this.AutoBtn1.Name = "AutoBtn1"; - this.AutoBtn1.Size = new System.Drawing.Size(104, 104); - this.AutoBtn1.TabIndex = 18; - this.AutoBtn1.Text = "自动按钮"; - this.AutoBtn1.UseVisualStyleBackColor = false; - this.AutoBtn1.Click += new System.EventHandler(this.AutoBtn1_Click); - // - // ManualBtn1 - // - this.ManualBtn1.BackColor = System.Drawing.Color.Gray; - this.ManualBtn1.Cursor = System.Windows.Forms.Cursors.Hand; - this.ManualBtn1.Location = new System.Drawing.Point(3, 183); - this.ManualBtn1.Name = "ManualBtn1"; - this.ManualBtn1.Size = new System.Drawing.Size(104, 104); - this.ManualBtn1.TabIndex = 19; - this.ManualBtn1.Text = "手动按钮"; - this.ManualBtn1.UseVisualStyleBackColor = false; - this.ManualBtn1.Click += new System.EventHandler(this.ManualBtn1_Click); - // - // ESBtn - // - this.ESBtn.BackColor = System.Drawing.Color.Red; - this.ESBtn.Cursor = System.Windows.Forms.Cursors.Hand; - this.ESBtn.Location = new System.Drawing.Point(150, 107); - this.ESBtn.Name = "ESBtn"; - this.ESBtn.Size = new System.Drawing.Size(137, 137); - this.ESBtn.TabIndex = 0; - this.ESBtn.Text = "急停"; - this.ESBtn.UseVisualStyleBackColor = false; - this.ESBtn.Click += new System.EventHandler(this.ESBtn_Click); - // // TestBtn // this.TestBtn.Cursor = System.Windows.Forms.Cursors.Hand; @@ -733,34 +703,6 @@ namespace BRS.Process.A020.UI this.TestBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.TestBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); // - // StopBtn2 - // - this.StopBtn2.Cursor = System.Windows.Forms.Cursors.Hand; - this.StopBtn2.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.StopBtn2.Location = new System.Drawing.Point(116, 12); - this.StopBtn2.MinimumSize = new System.Drawing.Size(1, 1); - this.StopBtn2.Name = "StopBtn2"; - this.StopBtn2.Size = new System.Drawing.Size(96, 141); - this.StopBtn2.TabIndex = 8; - this.StopBtn2.Text = "停止"; - this.StopBtn2.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.StopBtn2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.StopBtn2.Click += new System.EventHandler(this.StopBtn2_Click); - // - // StartBtn1 - // - this.StartBtn1.Cursor = System.Windows.Forms.Cursors.Hand; - this.StartBtn1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.StartBtn1.Location = new System.Drawing.Point(12, 12); - this.StartBtn1.MinimumSize = new System.Drawing.Size(1, 1); - this.StartBtn1.Name = "StartBtn1"; - this.StartBtn1.Size = new System.Drawing.Size(96, 141); - this.StartBtn1.TabIndex = 7; - this.StartBtn1.Text = "开始"; - this.StartBtn1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.StartBtn1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.StartBtn1.Click += new System.EventHandler(this.StartBtn1_Click); - // // AutoLoosenBtn // this.AutoLoosenBtn.Cursor = System.Windows.Forms.Cursors.Hand; @@ -852,6 +794,111 @@ namespace BRS.Process.A020.UI this.timer2.Interval = 1000; this.timer2.Tick += new System.EventHandler(this.timer2_Tick); // + // RobotAStatus + // + this.RobotAStatus.BackColor = System.Drawing.Color.Gray; + this.RobotAStatus.Cursor = System.Windows.Forms.Cursors.Hand; + this.RobotAStatus.Enabled = false; + this.RobotAStatus.Location = new System.Drawing.Point(706, 7); + this.RobotAStatus.Name = "RobotAStatus"; + this.RobotAStatus.Size = new System.Drawing.Size(90, 90); + this.RobotAStatus.TabIndex = 28; + this.RobotAStatus.UseVisualStyleBackColor = false; + // + // ManualLight + // + this.ManualLight.BackColor = System.Drawing.Color.Gray; + this.ManualLight.Cursor = System.Windows.Forms.Cursors.Hand; + this.ManualLight.Enabled = false; + this.ManualLight.Location = new System.Drawing.Point(549, 7); + this.ManualLight.Name = "ManualLight"; + this.ManualLight.Size = new System.Drawing.Size(90, 90); + this.ManualLight.TabIndex = 25; + this.ManualLight.UseVisualStyleBackColor = false; + // + // AutoLight + // + this.AutoLight.BackColor = System.Drawing.Color.Gray; + this.AutoLight.Cursor = System.Windows.Forms.Cursors.Hand; + this.AutoLight.Enabled = false; + this.AutoLight.Location = new System.Drawing.Point(437, 7); + this.AutoLight.Name = "AutoLight"; + this.AutoLight.Size = new System.Drawing.Size(90, 90); + this.AutoLight.TabIndex = 24; + this.AutoLight.UseVisualStyleBackColor = false; + // + // MoveStateLight1 + // + this.MoveStateLight1.BackColor = System.Drawing.Color.Gray; + this.MoveStateLight1.Location = new System.Drawing.Point(17, 7); + this.MoveStateLight1.Name = "MoveStateLight1"; + this.MoveStateLight1.Size = new System.Drawing.Size(90, 90); + this.MoveStateLight1.TabIndex = 3; + this.MoveStateLight1.UseVisualStyleBackColor = false; + // + // StopStateLight1 + // + this.StopStateLight1.BackColor = System.Drawing.Color.Gray; + this.StopStateLight1.Location = new System.Drawing.Point(117, 7); + this.StopStateLight1.Name = "StopStateLight1"; + this.StopStateLight1.Size = new System.Drawing.Size(90, 90); + this.StopStateLight1.TabIndex = 15; + this.StopStateLight1.UseVisualStyleBackColor = false; + // + // ToughLight1 + // + this.ToughLight1.BackColor = System.Drawing.Color.Gray; + this.ToughLight1.Location = new System.Drawing.Point(217, 7); + this.ToughLight1.Name = "ToughLight1"; + this.ToughLight1.Size = new System.Drawing.Size(90, 90); + this.ToughLight1.TabIndex = 16; + this.ToughLight1.UseVisualStyleBackColor = false; + // + // LoosenLight1 + // + this.LoosenLight1.BackColor = System.Drawing.Color.Gray; + this.LoosenLight1.Location = new System.Drawing.Point(326, 7); + this.LoosenLight1.Name = "LoosenLight1"; + this.LoosenLight1.Size = new System.Drawing.Size(90, 90); + this.LoosenLight1.TabIndex = 17; + this.LoosenLight1.UseVisualStyleBackColor = false; + // + // AutoBtn1 + // + this.AutoBtn1.BackColor = System.Drawing.Color.Gray; + this.AutoBtn1.Cursor = System.Windows.Forms.Cursors.Hand; + this.AutoBtn1.Location = new System.Drawing.Point(5, 85); + this.AutoBtn1.Name = "AutoBtn1"; + this.AutoBtn1.Size = new System.Drawing.Size(112, 112); + this.AutoBtn1.TabIndex = 18; + this.AutoBtn1.Text = "自动按钮"; + this.AutoBtn1.UseVisualStyleBackColor = false; + this.AutoBtn1.Click += new System.EventHandler(this.AutoBtn1_Click); + // + // ManualBtn1 + // + this.ManualBtn1.BackColor = System.Drawing.Color.Gray; + this.ManualBtn1.Cursor = System.Windows.Forms.Cursors.Hand; + this.ManualBtn1.Location = new System.Drawing.Point(5, 221); + this.ManualBtn1.Name = "ManualBtn1"; + this.ManualBtn1.Size = new System.Drawing.Size(112, 112); + this.ManualBtn1.TabIndex = 19; + this.ManualBtn1.Text = "手动按钮"; + this.ManualBtn1.UseVisualStyleBackColor = false; + this.ManualBtn1.Click += new System.EventHandler(this.ManualBtn1_Click); + // + // ESBtn + // + this.ESBtn.BackColor = System.Drawing.Color.Red; + this.ESBtn.Cursor = System.Windows.Forms.Cursors.Hand; + this.ESBtn.Location = new System.Drawing.Point(157, 144); + this.ESBtn.Name = "ESBtn"; + this.ESBtn.Size = new System.Drawing.Size(137, 137); + this.ESBtn.TabIndex = 0; + this.ESBtn.Text = "急停"; + this.ESBtn.UseVisualStyleBackColor = false; + this.ESBtn.Click += new System.EventHandler(this.ESBtn_Click); + // // 扭矩轴控制 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -866,6 +913,7 @@ namespace BRS.Process.A020.UI this.Load += new System.EventHandler(this.扭矩轴控制_Load); ((System.ComponentModel.ISupportInitialize)(this.chart2)).EndInit(); this.uiPanel1.ResumeLayout(false); + this.uiPanel3.ResumeLayout(false); this.BtnSeries.ResumeLayout(false); this.ParameterSetting.ResumeLayout(false); this.ParameterSetting.PerformLayout(); @@ -944,5 +992,8 @@ namespace BRS.Process.A020.UI private CircleButton ManualLight; private CircleButton AutoLight; private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label15; + private CircleButton RobotAStatus; + private Sunny.UI.UIPanel uiPanel3; } } \ No newline at end of file diff --git a/src/BRS.Process.A020/UI/ContorlShaft.cs b/src/BRS.Process.A020/UI/ContorlShaft.cs index db11d28..9e6424b 100644 --- a/src/BRS.Process.A020/UI/ContorlShaft.cs +++ b/src/BRS.Process.A020/UI/ContorlShaft.cs @@ -40,6 +40,7 @@ namespace BRS.Process.A020.UI { InitializeComponent(); } + public IDevice Device { get; set; } protected PLCBase PLC { @@ -52,6 +53,72 @@ namespace BRS.Process.A020.UI Device = device; + } + PLCBase pLCBase = null; + TCPSeverBase TcpListerWrapBase1 = null; + string Message1 = null; + public override void OnProcessUpdated() + { + base.OnProcessUpdated(); + //ProcessA020.OnPLCStateChanged -= Test; + //ProcessA020.OnPLCStateChanged += Test; + + //ProcessA020.OnBitmapChanged -= BitMapTest; + //ProcessA020.OnBitmapChanged += BitMapTest; + pLCBase = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; + TcpListerWrapBase1 = ProcessA020.DeviceCollection.Find(d => d is TCPSeverBase && d.InitialConfig.Name == "ListenerA") as TCPSeverBase; + if (TcpListerWrapBase1 != null) + { + TcpListerWrapBase1.OnTcpDataReceived -= NbtRobotDriver_OnDataReceived; + TcpListerWrapBase1.OnTcpDataReceived += NbtRobotDriver_OnDataReceived; + TcpListerWrapBase1.OnTirggeredConnectClose -= NbtRobotDriver_OnTirggeredConnectClose; + TcpListerWrapBase1.OnTirggeredConnectClose += NbtRobotDriver_OnTirggeredConnectClose; + TcpListerWrapBase1.OnTirggeredConnectOpen -= NbtRobotDriver_OnTirggeredConnectOpen; + TcpListerWrapBase1.OnTirggeredConnectOpen += NbtRobotDriver_OnTirggeredConnectOpen; + } + } + private void NbtRobotDriver_OnTirggeredConnectClose() + { + RobotAStatus.BackColor = Color.Red; + } + private void NbtRobotDriver_OnTirggeredConnectOpen() + { + RobotAStatus.BackColor = Color.Green; + } + private void NbtRobotDriver_OnDataReceived(byte[] obj) + { + string msg = string.Empty; + msg = Encoding.Default.GetString(obj); + Message1 = msg; + //} + //else if (rbHexData.Checked) + //{ + // //msg = ToHexStrFromByte(obj); + // msg = BitConverter.ToString(obj).Replace('-', ' '); + + //} + bool Bmsg = msg.Contains("Status_"); + if (Bmsg) + { + + string[] arr = msg.Split('_'); + if (arr.Count() > 6) + { + if (arr[1] == "TEACH") + MessageBox.Show("当前属于示教模式,请选择自动模式"); + if (arr[2] == "ON") + MessageBox.Show("当前属于示教锁定,请选择自动模式"); + if (arr[3] == "HOLD") + MessageBox.Show("当前系统状态异常,请检查"); + if (arr[4] == "OFF") + MessageBox.Show("当前属于断电模式,请上电"); + if (arr[6] == "ERROR") + MessageBox.Show("当前系统状态异常,请检查"); + + } + + } + } private async void StartBtn_Click(object sender, EventArgs e) { diff --git a/src/BRS.Process.A020/UI/OperationFrm.cs b/src/BRS.Process.A020/UI/OperationFrm.cs index f886e2b..f553daf 100644 --- a/src/BRS.Process.A020/UI/OperationFrm.cs +++ b/src/BRS.Process.A020/UI/OperationFrm.cs @@ -183,7 +183,7 @@ namespace BRS.Process.A020.UI else { Process_A020.BatchNO = textBoxBatchNO.Text; - Process_A020.StartProcess(); + Process_A020.StartProcess(null, null, null); PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.ClearData.ToString(), null, null); btnProcessStart.Text = "流程停止"; btnProcessStart.ImageIndex = 3; diff --git a/src/BRS.Process.A020/UI/OperationFrm.resx b/src/BRS.Process.A020/UI/OperationFrm.resx index 66bbe7f..dce32a8 100644 --- a/src/BRS.Process.A020/UI/OperationFrm.resx +++ b/src/BRS.Process.A020/UI/OperationFrm.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAy - CwAAAk1TRnQBSQFMAgEBBAEAAQgBBQEIAQUBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CwAAAk1TRnQBSQFMAgEBBAEAARABBQEQAQUBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/src/BRS.Process/ProcessConfig.cs b/src/BRS.Process/ProcessConfig.cs index 65ddd91..841f39a 100644 --- a/src/BRS.Process/ProcessConfig.cs +++ b/src/BRS.Process/ProcessConfig.cs @@ -238,7 +238,7 @@ namespace BRS.Process configs.AddRange(CameraConfigCollection); configs.AddRange(PLCConfigCollection); configs.AddRange(DeviceConfigs); - //configs.AddRange(RobotConfigCollection); + configs.AddRange(KawasakiRobotConfigCollection); return configs; diff --git a/src/BRS.UI.Main/MenuForms/FrmOperation.resx b/src/BRS.UI.Main/MenuForms/FrmOperation.resx index 015821a..8dc5a46 100644 --- a/src/BRS.UI.Main/MenuForms/FrmOperation.resx +++ b/src/BRS.UI.Main/MenuForms/FrmOperation.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADm - CgAAAk1TRnQBSQFMAgEBAgEAAegBAgHoAQIBGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CgAAAk1TRnQBSQFMAgEBAgEAAfgBAgH4AQIBGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABYAMAARgDAAEBAQABCAYAAQkYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -182,7 +182,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD4 - CAAAAk1TRnQBSQFMAwEBAAHoAQIB6AECARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA + CAAAAk1TRnQBSQFMAwEBAAH4AQIB+AECARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA AWADAAEYAwABAQEAAQgGAAEJGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm diff --git a/src/XKRS.Device.TCPSever/TCPSeverForm.cs b/src/XKRS.Device.TCPSever/TCPSeverForm.cs index d45067f..d45ed01 100644 --- a/src/XKRS.Device.TCPSever/TCPSeverForm.cs +++ b/src/XKRS.Device.TCPSever/TCPSeverForm.cs @@ -12,7 +12,7 @@ using System.Windows.Forms; namespace XKRS.Device.TCPSever { - [Device("TCPSever", "TCP服务器", EnumHelper.DeviceAttributeType.RunCtrl)] + [Device("KawasakiRobot", "川崎Robot", EnumHelper.DeviceAttributeType.RunCtrl)] public partial class TCPSeverForm : UserControl, IRunCtrl { #region 控件大小随窗体大小等比例缩放