| | |
| | | int ret = (int)para.RetractionSpeed;//右PLC自动伸出缩回速度 |
| | | int liftPosition= (int)para.LeftPosition;//左伸出位置 |
| | | int rigtpostition= (int)para.RightPosition;//右伸出位置 |
| | | var leftorigin = devices.Value.left.Communicator.Read<bool>("M115");//左plc到原点位置信号 |
| | | var rightorigin = devices.Value.right.Communicator.Read<bool>("M115");//右plc到达原点位置信号 |
| | | var lefttarget = devices.Value.left.Communicator.Read<bool>("M116");//左plc到达目标位置 |
| | | var righttarget = devices.Value.right.Communicator.Read<bool>("M116");//右plc到达目标位置 |
| | | |
| | | if (leftorigin == true || rightorigin == true) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "已到原始点" }; |
| | | } |
| | | if (lefttarget == true || righttarget == true) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "已到最大值" }; |
| | | } |
| | | |
| | | if (ExtendedState == "伸出") |
| | | { |
| | |
| | | var para = BaseDal.QueryData().Where(x => x.Deptid == deid).OrderByDescending(x => x.CreateDate).FirstOrDefault(); |
| | | int ext = (int)para.ManualExtend;//左PLC手动伸出缩回速度 |
| | | int ret = (int)para.ManualRetraction;//右PLC手动伸出缩回速度 |
| | | |
| | | var leftorigin = devices.Value.left.Communicator.Read<bool>("M115");//左plc到原点位置信号 |
| | | var rightorigin = devices.Value.right.Communicator.Read<bool>("M115");//右plc到达原点位置信号 |
| | | var lefttarget = devices.Value.left.Communicator.Read<bool>("M116");//左plc到达目标位置 |
| | | var righttarget = devices.Value.right.Communicator.Read<bool>("M116");//右plc到达目标位置 |
| | | |
| | | if (leftorigin==true|| rightorigin==true) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "已到原始点" }; |
| | | } |
| | | if(lefttarget==true|| righttarget == true) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "已到最大值" }; |
| | | } |
| | | |
| | | |
| | | if (position == "左" && ExtendedState == "伸出") |
| | | { |
| | | devices.Value.left.Communicator.Write<int>("D1000", ext);//左PLC手动伸出缩回速度 |
| | | devices.Value.left.Communicator.Write<bool>("M100", true);//伸出按钮 |
| | | Console.WriteLine($"{position}伸缩杆手动伸出缩回{ext}"); |
| | | Console.WriteLine($"{position}伸缩杆手动伸出{ext}"); |
| | | } |
| | | else if (position == "左" && ExtendedState == "缩回") |
| | | { |
| | | devices.Value.left.Communicator.Write<int>("D1000", ext);//左PLC手动伸出缩回速度 |
| | | devices.Value.left.Communicator.Write<bool>("M101", true); |
| | | |
| | | Console.WriteLine($"{position}伸缩杆手动伸出缩回{ext}"); |
| | | Console.WriteLine($"{position}伸缩杆手动缩回{ext}"); |
| | | } |
| | | else if (position == "右" && ExtendedState == "伸出") |
| | | { |
| | |
| | | ManualExtend = ext, |
| | | ManualRetraction = ret |
| | | } |
| | | };//这里要加返回速度 |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | |
| | | } |
| | | try |
| | | { |
| | |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | |
| | | } |
| | | |
| | | |