diff --git a/Model/StationMessage.cs b/Model/StationMessage.cs index 4195b45..03e6025 100644 --- a/Model/StationMessage.cs +++ b/Model/StationMessage.cs @@ -51,5 +51,6 @@ namespace Model /// 多个产品时,用;号分割 /// public string ProductSN { get; set; } + public int Number { get; set; } } } diff --git a/ViewModel/MainWindowVM.cs b/ViewModel/MainWindowVM.cs index 21ac3cf..d585fe5 100644 --- a/ViewModel/MainWindowVM.cs +++ b/ViewModel/MainWindowVM.cs @@ -42,102 +42,104 @@ namespace ViewModel { public partial class MainWindowVM : NotificationObject { - #region IO - int X0启动按钮 = 0; - int X1停止按钮 = 1; - int X2急停按钮 = 2; - int X3气压检知 = 3; - int X4 = 4; - int X5 = 5; - int X6 = 6; - int X7 = 7; - int X8安全门1 = 8; - int X9安全门2 = 9; - int X10安全门3 = 10; - int X11安全门4 = 11; - int X12 = 12; - int X13来料缓存位检知 = 13; - int X14左工位检知 = 14; - int X15右工位检知 = 15; - int X100流线皮带1检知1 = 16; - int X101流线皮带1检知2 = 17; - int X102流线皮带2检知1 = 18; - int X103流线皮带2检知2 = 19; - int X104NG皮带检知1 = 20; - int X105NG皮带检知2 = 21; - int X106NG皮带检知3 = 22; - int X107机械手真空检知 = 23; - int X108左笔形气缸伸出 = 24; - int X109左笔形气缸缩回 = 25; - int X110左顶升气缸下位 = 26; - int X111左顶升气缸上位 = 27; - int X112右笔形气缸伸出 = 28; - int X113右笔形气缸缩回 = 29; - int X114右顶升气缸下位 = 30; - int X115右顶升气缸上位 = 31; - int X200搬运气缸上位 = 32; - int X201搬运气缸下位 = 33; - int X202搬运真空检知 = 34; - int X203 = 35; - int X204 = 36; - int X205机械手真空检知2 = 37; - int X206机械手气缸上位1 = 38; - int X207机械手气缸下位1 = 39; - int X208机械手气缸上位2 = 40; - int X209机械手气缸下位2 = 41; - int X210 = 42; - int X211左顶升气缸下位2 = 43; - int X212左顶升气缸上位2 = 44; - int X213右顶升气缸下位2 = 45; - int X214右顶升气缸上位2 = 46; - int X215 = 47; - - int Y0绿灯 = 0; - int Y1红灯 = 1; - int Y2黄灯 = 2; - int Y3蜂鸣器 = 3; - int Y4 = 4; - int Y5 = 5; - int Y6 = 6; - int Y7 = 7; - int Y8 = 8; - int Y9 = 9; - int Y10上光源控制 = 10; - int Y11下光源控制 = 11; - int Y100流线皮带1 = 12; - int Y101流线皮带2 = 13; - int Y102NG皮带 = 14; - int Y103机械手真空吸 = 15; - int Y104机械手真空破 = 16; - int Y105左笔形气缸伸出 = 17; - int Y106左笔形气缸缩回 = 18; - int Y107左顶升气缸下位 = 19; - int Y108左顶升气缸上位 = 20; - int Y109右笔形气缸伸出 = 21; - int Y110右笔形气缸缩回 = 22; - int Y111右顶升气缸下位 = 23; - int Y112右顶升气缸上位 = 24; - int Y113 = 25; - int Y114 = 26; - int Y115 = 27; - int Y200搬运气缸上位 = 28; - int Y201搬运气缸下位 = 29; - int Y202搬运真空吸 = 30; - int Y203搬运真空破 = 31; - int Y204机械手真空吸2 = 32; - int Y205机械手真空破2 = 33; - int Y206机械手气缸上位1 = 34; - int Y207机械手气缸下位1 = 35; - int Y208机械手气缸上位2 = 36; - int Y209机械手气缸下位2 = 37; - int Y210左顶升气缸下位2 = 38; - int Y211左顶升气缸上位2 = 39; - int Y212右顶升气缸下位2 = 40; - int Y213右顶升气缸上位2 = 41; - int Y214 = 42; - int Y215 = 43; - #endregion +const int I00启动 = 0; +const int I01停止 = 1; +const int I02急停 = 2; +const int I03气压检知 = 3; +const int I04_ = 4; +const int I05_ = 5; +const int I06左测试完成 = 6; +const int I07右测试完成 = 7; +const int I08门禁1 = 8; +const int I09门禁2 = 9; +const int I10门禁3 = 10; +const int I11门禁4 = 11; +const int I12光幕检测 = 12; +const int I13_ = 13; +const int I14左投料完成 = 14; +const int I15右投料完成 = 15; +const int I16左伸缩气缸伸出 = 16; +const int I17左伸缩气缸缩回 = 17; +const int I18左顶升气缸1下位 = 18; +const int I19左顶升气缸1上位 = 19; +const int I20左顶升气缸2下位 = 20; +const int I21左顶升气缸2上位 = 21; +const int I22右伸缩气缸伸出 = 22; +const int I23右伸缩气缸缩回 = 23; +const int I24右顶升气缸1下位 = 24; +const int I25右顶升气缸1上位 = 25; +const int I26右顶升气缸2下位 = 26; +const int I27右顶升气缸2上位 = 27; +const int I28_ = 28; +const int I29_ = 29; +const int I30_ = 30; +const int I31_ = 31; +const int I32机械手真空检1 = 32; +const int I33机械手真空检2 = 33; +const int I34机械手上下气缸1上位 = 34; +const int I35机械手上下气缸1下位 = 35; +const int I36机械手上下气缸2上位 = 36; +const int I37机械手上下气缸2下位 = 37; +const int I38NG皮带检知1 = 38; +const int I39NG皮带检知2 = 39; +const int I40NG皮带检知3 = 40; +const int I41流线1皮带检知1 = 41; +const int I42流线1皮带检知2 = 42; +const int I43流线2皮带检知1 = 43; +const int I44流线2皮带检知2 = 44; +const int I45_ = 45; +const int I46_ = 46; +const int I47_ = 47; +const int O00红灯 = 0; +const int O01黄灯 = 1; +const int O02绿灯 = 2; +const int O03蜂鸣器 = 3; +const int O04_ = 4; +const int O05_ = 5; +const int O06_ = 6; +const int O07_ = 7; +const int O08左触发 = 8; +const int O09右触发 = 9; +const int O10_ = 10; +const int O11_ = 11; +const int O12_ = 12; +const int O13_ = 13; +const int O14上光源控制 = 14; +const int O15下光源控制 = 15; +const int O16左伸缩气缸伸出 = 16; +const int O17左伸缩气缸缩回 = 17; +const int O18左顶升气缸1下位 = 18; +const int O19左顶升气缸1上位 = 19; +const int O20左顶升气缸2下位 = 20; +const int O21左顶升气缸2上位 = 21; +const int O22右伸缩气缸伸出 = 22; +const int O23右伸缩气缸缩回 = 23; +const int O24右顶升气缸1下位 = 24; +const int O25右顶升气缸1上位 = 25; +const int O26右顶升气缸2下位 = 26; +const int O27右顶升气缸2上位 = 27; +const int O28_ = 28; +const int O29NG皮带控制 = 29; +const int O30流线1皮带控制 = 30; +const int O31流线2皮带控制 = 31; +const int O32机械手真空吸1 = 32; +const int O33机械手真空破1 = 33; +const int O34机械手真空吸2 = 34; +const int O35机械手真空破2 = 35; +const int O36机械手上下气缸1上位 = 36; +const int O37机械手上下气缸1下位 = 37; +const int O38机械手上下气缸2上位 = 38; +const int O39机械手上下气缸2下位 = 39; +const int O40_ = 40; +const int O41_ = 41; +const int O42_ = 42; +const int O43_ = 43; +const int O44_ = 44; +const int O45_ = 45; +const int O46_ = 46; +const int O47_ = 47; +#endregion #region 生产的Grid状态 private string gridWidth; @@ -1640,52 +1642,7 @@ namespace ViewModel DualControlRun();//双控运行 GoHome(); //回原点 - - //将输入信号集合付给每一个点位,防止撞机 - //foreach (MotionPointModel item in MCVM.TrajListL[0].PointList) - //{ - // item.InputList = this.InputList; - //} - - - //前后站物料状态 - if (FrontStationReceive != null) - { - StationProduceList[0].State.StatusBackground = FrontStationReceive.ProductState; - if (FrontStationReceive.Safe) - { - StationProduceList[0].State.StatuInfo = "安全"; - } - else - { - StationProduceList[0].State.StatuInfo = "不安全"; - } - } - - if (NextStationReceive != null) - { - StationProduceList[1].State.StatusBackground = NextStationReceive.ProductState; - if (NextStationReceive != null && NextStationReceive.Safe) - { - StationProduceList[1].State.StatuInfo = "安全"; - } - else - { - StationProduceList[1].State.StatuInfo = "不安全"; - } - } - - //检查后站连接 - //if (NextStation.Showmsg.StatusBackground != ColorStr.Green) - //{ - // ExcepStop("后站断开"); - //} - - if (!PutOk) - { - NextStationSend.Request = false; - } - + SendFrontStation();//发送信息给前站 SendNextStation();//发送消息给下一站 @@ -1770,8 +1727,11 @@ namespace ViewModel { LogicDispatch(LogicDispatchFlow);//逻辑总管 //CarryPutOutRun(CarryPutOutFlow); //机台搬运 - //ProLineRun(ProLineFlow);//良品皮带 + } + + ProLineRun(ProLineFlow);//良品皮带 + TestBoxRun(TestBoxFlow);//测试平台 //CheckXizui(); //BadRun(); //不良皮带 @@ -2553,7 +2513,7 @@ namespace ViewModel //获取下视觉模板 RM = VisualB.VisualEngineeringList[0].VisualEngineeringItemsList[2].MyRectangleModel; VisonCount = 0; - OutputList[Y11下光源控制].Switchs = true;//光源 + OutputList[O15下光源控制].Switchs = true;//光源 MyFlow.RunStep++; MyFlow.RunTime = DateTime.Now; break; @@ -2572,7 +2532,7 @@ namespace ViewModel ExcepStop("下视觉扫码失败"); MyFlow.RunStep--; MyFlow.RunTime = DateTime.Now; - OutputList[Y11下光源控制].Switchs = false;//光源 + OutputList[O15下光源控制].Switchs = false;//光源 } } break; @@ -2607,7 +2567,7 @@ namespace ViewModel //获取下视觉模板 RM = VisualB.VisualEngineeringList[0].VisualEngineeringItemsList[0].MyRectangleModel; VisonCount = 0; - OutputList[Y11下光源控制].Switchs = true;//光源 + OutputList[O15下光源控制].Switchs = true;//光源 MyFlow.RunStep++; MyFlow.RunTime = DateTime.Now; break; @@ -2618,7 +2578,7 @@ namespace ViewModel //空跑不二次定位 if (CurrentMachine.RunningMode) { - OutputList[Y11下光源控制].Switchs = false;//光源 + OutputList[O15下光源控制].Switchs = false;//光源 CurrXizui.State.StatusBackground = ColorStr.Green; MyFlow.RunStep = GengralProcessEnum.Start; MyFlow.RunTime = DateTime.Now; @@ -2661,7 +2621,7 @@ namespace ViewModel ExcepStop("下视觉定位失败"); MyFlow.RunStep = GengralProcessEnum.Start; MyFlow.RunTime = DateTime.Now; - OutputList[Y11下光源控制].Switchs = false;//光源 + OutputList[O15下光源控制].Switchs = false;//光源 } } break; @@ -2699,7 +2659,7 @@ namespace ViewModel MyFlow.RunStep = GengralProcessEnum.Start; MyFlow.RunTime = DateTime.Now; - OutputList[Y11下光源控制].Switchs = false;//光源 + OutputList[O15下光源控制].Switchs = false;//光源 //记录补偿值 if (Math.Abs(RM.MyROI.ModelFeaturePiont.DeviationX) < 10 && Math.Abs(RM.MyROI.ModelFeaturePiont.DeviationY) < 10) @@ -2719,7 +2679,7 @@ namespace ViewModel ExcepStop("下视觉定位失败"); MyFlow.RunStep = GengralProcessEnum.Start; MyFlow.RunTime = DateTime.Now; - OutputList[Y11下光源控制].Switchs = false;//光源 + OutputList[O15下光源控制].Switchs = false;//光源 } } break; @@ -3053,273 +3013,7 @@ namespace ViewModel /// bool RobotSafe { get; set; } - /// - /// 搬运出料运行 - /// - /// - private void CarryPutOutRun(FlowModel MyFlow) - { - switch (MyFlow.RunStep) - { - case GengralProcessEnum.Start: - FrontStationSend.Safe = false; //本站安全状态 - CarryAxisSafe = false; - //搬运气缸上位 - OutputList[Y201搬运气缸下位].Switchs = false; - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - break; - case GengralProcessEnum.Step1: - FrontStationSend.Safe = false; //本站安全状态 - //搬运气缸上位到位 - if (InputList[X200搬运气缸上位].LightUp) - { - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 3000, InputList[X200搬运气缸上位].InputMeaning + "异常")) - { - OutputList[Y201搬运气缸下位].Switchs = false; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step2: - FrontStationSend.Safe = false; //本站安全状态 - CarryAxisSafe = false; - //先运行到搬运待机点 - CarryPutOutMotionPoint = Coper(CurrentMachine.MotionPointList.Where(w => w.PointType == 1).FirstOrDefault()); - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - break; - case GengralProcessEnum.Step3: - FrontStationSend.Safe = false; //本站安全状态 - //运行到待机点 - if (CarryPutOutMotionPoint.PointRun(MCVM.AllShaftList)) - { - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 10000, CarryPutOutMotionPoint.PointName + "运行超时")) - { - CarryPutOutMotionPoint.PointRunStep = GengralProcessEnum.Start; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step4: - FrontStationSend.Safe = true; //本站安全状态 - CarryAxisSafe = true; - //查看前站物料状态&安全状态 - if (FrontStationReceive.ProductState == ColorStr.Green && FrontStationReceive.Safe) - { - //获取前站取料点 - CarryPutOutMotionPoint = Coper(CurrentMachine.MotionPointList.Where(w => w.PointType == 2).FirstOrDefault()); - FrontStationSend.Safe = false; //本站安全状态 - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step5: - FrontStationSend.Safe = false; //本站安全状态 - CarryAxisSafe = true; - //运行到平台下料点 - if (CarryPutOutMotionPoint.PointRun(MCVM.AllShaftList)) - { - //气缸下降 - OutputList[Y201搬运气缸下位].Switchs = true; - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 10000, CarryPutOutMotionPoint.PointName + "运行超时")) - { - CarryPutOutMotionPoint.PointRunStep = GengralProcessEnum.Start; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step6: - FrontStationSend.Safe = false; //本站安全状态 - CarryAxisSafe = true; - //气缸下降到位 - if (InputList[X201搬运气缸下位].LightUp) - { - if (!CurrentMachine.RunningMode) - { - OutputList[Y202搬运真空吸].Switchs = true;//真空吸开 - } - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 3000, InputList[X201搬运气缸下位].InputMeaning + "异常")) - { - //气缸下降 - OutputList[Y201搬运气缸下位].Switchs = true; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step7: - FrontStationSend.Safe = false; //本站安全状态 - CarryAxisSafe = true; - //真空检知有 - if (InputList[X202搬运真空检知].LightUp || CurrentMachine.RunningMode) - { - OutputList[Y201搬运气缸下位].Switchs = false; //气缸上升 - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 3000, InputList[X202搬运真空检知].InputMeaning + "异常")) - { - OutputList[Y202搬运真空吸].Switchs = true;//真空吸开 - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step8: - FrontStationSend.Safe = false; //本站安全状态 - CarryAxisSafe = true; - //搬运气缸上位到位 - if (InputList[X200搬运气缸上位].LightUp) - { - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 3000, InputList[X200搬运气缸上位].InputMeaning + "异常")) - { - OutputList[Y201搬运气缸下位].Switchs = false; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step9: - FrontStationSend.Safe = false; //本站安全状态 - CarryAxisSafe = true; - //再次检查真空 - if (InputList[X202搬运真空检知].LightUp || CurrentMachine.RunningMode) - { - FrontStationSend.GetDone = true; //给前站传输取料完成 - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 3000, InputList[X202搬运真空检知].InputMeaning + "异常")) - { - MyFlow.RunStep = GengralProcessEnum.Step5; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step10: - FrontStationSend.Safe = false; //本站安全状态 - CarryAxisSafe = true; - //等待前站产品变颜色 - if (FrontStationReceive.ProductState == ColorStr.White) - { - FrontStationSend.GetDone = false; //撤销取料完成信号 - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (MyFlow.RunTime.AddMilliseconds(10000) <= DateTime.Now) - { - ExcepStop("前站回复信号超时"); - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step11: - FrontStationSend.Safe = false; //本站安全状态 - //先回待机点等待,避让前站机械手 - CarryPutOutMotionPoint = Coper(CurrentMachine.MotionPointList.Where(w => w.PointType == 1).FirstOrDefault()); - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - break; - case GengralProcessEnum.Step12: - FrontStationSend.Safe = false; //本站安全状态 - //运行到待机点 - if (CarryPutOutMotionPoint.PointRun(MCVM.AllShaftList)) - { - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 10000, CarryPutOutMotionPoint.PointName + "运行超时")) - { - CarryPutOutMotionPoint.PointRunStep = GengralProcessEnum.Start; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step13: - CarryAxisSafe = true; - FrontStationSend.Safe = true; //本站安全状态 - //判断本站是否可以放料&&机械手安全状态 - if (InCacheList[0].State.StatusBackground == ColorStr.White && RobotSafe) - { - //获取本站放料点 - CarryPutOutMotionPoint = Coper(CurrentMachine.MotionPointList.Where(w => w.PointType == 3).FirstOrDefault()); - CarryAxisSafe = false; - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step14: - FrontStationSend.Safe = true; //本站安全状态 - CarryAxisSafe = false; - //运行到后站放料点 - if (CarryPutOutMotionPoint.PointRun(MCVM.AllShaftList)) - { - //气缸下降 - OutputList[Y201搬运气缸下位].Switchs = true; - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 10000, CarryPutOutMotionPoint.PointName + "运行超时")) - { - CarryPutOutMotionPoint.PointRunStep = GengralProcessEnum.Start; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step15: - FrontStationSend.Safe = true; //本站安全状态 - CarryAxisSafe = false; - //气缸下降到位 - if (InputList[X201搬运气缸下位].LightUp) - { - OutputList[Y202搬运真空吸].Switchs = false; //真空吸关 - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 3000, InputList[X201搬运气缸下位].InputMeaning + "异常")) - { - //气缸下降 - OutputList[Y201搬运气缸下位].Switchs = true; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step16: - FrontStationSend.Safe = true; //本站安全状态 - CarryAxisSafe = false; - //延时0.2秒 真空破作用时间 - if (!InputList[X202搬运真空检知].LightUp) - { - OutputList[Y201搬运气缸下位].Switchs = false; //气缸上升 - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 3000, InputList[X202搬运真空检知].InputMeaning + "关闭异常")) - { - MyFlow.RunStep--; - MyFlow.RunTime = DateTime.Now; - } - break; - case GengralProcessEnum.Step17: - FrontStationSend.Safe = true; //本站安全状态 - CarryAxisSafe = false; - //搬运气缸上位到位 - if (InputList[X200搬运气缸上位].LightUp) - { - InCacheList[0].State.StatusBackground = ColorStr.Green; - MyFlow.RunStep = GengralProcessEnum.Start; - MyFlow.RunTime = DateTime.Now; - } - else if (TimeOutValidation(MyFlow.RunTime, 3000, InputList[X200搬运气缸上位].InputMeaning + "异常")) - { - OutputList[Y201搬运气缸下位].Switchs = false; - MyFlow.RunTime = DateTime.Now; - } - break; - } - } + #endregion #region 出料运行 @@ -3341,91 +3035,18 @@ namespace ViewModel switch (MyFlow.RunStep) { case GengralProcessEnum.Start: - OutputList[Y100流线皮带1].Switchs = false; + OutputList[O30流线1皮带控制].Switchs = false; MyFlow.RunStep++; MyFlow.RunTime = DateTime.Now; break; case GengralProcessEnum.Step1: - ////皮带检知是否有料 - //if (InputList[X101流线皮带1检知2].LightUp && PutOk) - //{ - // //出料 - // MyFlow.RunStep = GengralProcessEnum.Step10; - // MyFlow.RunTime = DateTime.Now; - //} - //else if (InputList[X101流线皮带1检知2].LightUp && !PutOk) - //{ - // ExcepStop("请取走出料口产品"); - //} - //else - //{ - // //上料 - // PutOk = false; - // MyFlow.RunStep++; - // MyFlow.RunTime = DateTime.Now; - //} - //上料 + PutOk = false; MyFlow.RunStep++; MyFlow.RunTime = DateTime.Now; break; - case GengralProcessEnum.Step2: - //放料完成 - if (PutOk) - { - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - OutputList[Y100流线皮带1].Switchs = false; - break; - case GengralProcessEnum.Step3: - //后站无料 - if (NextStationReceive.ProductState == ColorStr.White && MyFlow.RunTime.AddMilliseconds(500) <= DateTime.Now) - { - NextStationSend.Request = true; //送料信号 - OutputList[Y100流线皮带1].Switchs = true; - MyFlow.RunStep++; - MyFlow.RunTime = DateTime.Now; - } - break; - //case GengralProcessEnum.Step11: - // //产品流出 - // if (!InputList[X101流线皮带1检知2].LightUp) - // { - // MyFlow.RunStep++; - // MyFlow.RunTime = DateTime.Now; - // } - // else if (MyFlow.RunTime.AddSeconds(10) <= DateTime.Now) - // { - // ExcepStop("产品流出超时"); - // } - // else - // { - // NextStationSend.Request = true; - // OutputList[Y100流线皮带1].Switchs = true; - // } - // break; - case GengralProcessEnum.Step4: - //产品流到后站,后站撤销请求 - if (NextStationReceive.ProductState != ColorStr.White) - { - NextStationSend.Request = false; - OutputList[Y100流线皮带1].Switchs = false; - MyFlow.RunStep = GengralProcessEnum.Start; - MyFlow.RunTime = DateTime.Now; - } - //后站10秒未恢复,报警 - else if (MyFlow.RunTime.AddSeconds(10) <= DateTime.Now) - { - ExcepNoStop("产品流出超时"); - MyFlow.RunTime = DateTime.Now; - } - else - { - NextStationSend.Request = true; - OutputList[Y100流线皮带1].Switchs = true; - } - break; + + } } #endregion @@ -3905,7 +3526,7 @@ namespace ViewModel private void BadRun() { //NG满料检知 - if (!InputList[X106NG皮带检知3].LightUp) + if (!InputList[I39NG皮带检知2].LightUp) { //不良运行信号 if (BadLineRun) @@ -3913,17 +3534,17 @@ namespace ViewModel //NG皮带转1S if (BadLineRunTime.AddMilliseconds(700) >= DateTime.Now) { - OutputList[Y102NG皮带].Switchs = true; //左ng皮带 + OutputList[O29NG皮带控制].Switchs = true; //左ng皮带 } else { BadLineRun = false; - OutputList[Y102NG皮带].Switchs = false; + OutputList[O29NG皮带控制].Switchs = false; } } else { - OutputList[Y102NG皮带].Switchs = false; + OutputList[O29NG皮带控制].Switchs = false; BadLineRunTime = DateTime.Now; } } @@ -4131,7 +3752,7 @@ namespace ViewModel } else { - NextStationSend.Safe = false; + NextStation.ConnectSwitch = !NextStation.ConnectSwitch; } SendNextStationTime = DateTime.Now; @@ -4157,7 +3778,7 @@ namespace ViewModel } else { - FrontStationSend.Safe = false; + FrontStation.ConnectSwitch = !FrontStation.ConnectSwitch; } @@ -4215,50 +3836,7 @@ namespace ViewModel } #endregion - #region 后站消息 - StationMessage _NextStationReceive = new StationMessage(); - /// - /// 从后站收到的消息 - /// - StationMessage NextStationReceive - { - get - { - return _NextStationReceive; - } - set - { - if (value != null) - { - _NextStationReceive = value; - } - else - { - _NextStationReceive.Safe = false; - } - } - } - /// - /// 发送给后站的消息 - /// - StationMessage NextStationSend = new StationMessage(); - - /// - /// 后站回调函数 - /// - /// - private void NextStation_ReceiveCallback(string str) - { - try - { - NextStationReceive = ShareHelp.JsonToObj(str); - } - catch (Exception) - { - NextStationReceive = new StationMessage(); - } - } - #endregion + #endregion #region 4、加载功能界面 @@ -5286,6 +4864,58 @@ namespace ViewModel InCacheGrid = gd; } #endregion + + + + #region 连线 + + #region 后站消息 + List _NextStationReceive = new List { new StationMessage { Number = 1 }, new StationMessage { Number = 2 } }; + /// + /// 从后站收到的消息 + /// + List NextStationReceive + { + get + { + return _NextStationReceive; + } + set + { + if (value != null && value.Count == 2) + { + _NextStationReceive = value; + } + + } + } + + /// + /// 发送给后站的消息 + /// + + public List NextStationSend { get; set; } = new List { new StationMessage { Number = 1 }, new StationMessage { Number = 2 } }; + /// + /// 后站回调函数 + /// + /// + private void NextStation_ReceiveCallback(string str) + { + try + { + + NextStationReceive = ShareHelp.JsonToObj>(str); + } + catch (Exception) + { + + } + } + #endregion + #endregion + + + } #region 自定义Label控件类