| | |
| | | |
| | | if (ExtendedState == "伸出") |
| | | { |
| | | devices.Value.left.Communicator.Write<int>("D1001", ext);//左PLC自动伸出缩回速度 |
| | | devices.Value.left.Communicator.Write<bool>("M102", true);//伸出按钮 |
| | | devices.Value.left.Communicator.Write<int>("D1002", liftPosition);//左伸出位置 |
| | | devices.Value.right.Communicator.Write<int>("D1001", ret);//右PLC自动伸出缩回速度 |
| | | devices.Value.right.Communicator.Write<bool>("M102", true);//伸出按钮 |
| | | devices.Value.right.Communicator.Write<int>("D1002", rigtpostition);//右伸出位置 |
| | | try |
| | | { |
| | | devices.Value.left.Communicator.Write<int>("D1001", ext);//左PLC自动伸出缩回速度 |
| | | devices.Value.left.Communicator.Write<bool>("M102", true);//伸出按钮 |
| | | devices.Value.left.Communicator.Write<int>("D1002", liftPosition);//左伸出位置 |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | } |
| | | try |
| | | { |
| | | devices.Value.right.Communicator.Write<int>("D1001", ret);//右PLC自动伸出缩回速度 |
| | | devices.Value.right.Communicator.Write<bool>("M102", true);//伸出按钮 |
| | | devices.Value.right.Communicator.Write<int>("D1002", rigtpostition);//右伸出位置 |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | } |
| | | |
| | | Console.WriteLine($"自动伸缩杆伸出 {ext},右伸出位置{liftPosition},右伸出位置{rigtpostition}"); |
| | | } |
| | | else if (ExtendedState == "缩回") |
| | | { |
| | | devices.Value.left.Communicator.Write<int>("D1001", ext);//左PLC自动伸出缩回速度 |
| | | devices.Value.left.Communicator.Write<bool>("M103", true);//缩回按钮 |
| | | devices.Value.right.Communicator.Write<int>("D1001", ret);//右PLC自动伸出缩回速度 |
| | | devices.Value.right.Communicator.Write<bool>("M103", true);//缩回按钮 |
| | | try |
| | | { |
| | | devices.Value.left.Communicator.Write<int>("D1001", ext);//左PLC自动伸出缩回速度 |
| | | devices.Value.left.Communicator.Write<bool>("M103", true);//缩回按钮 |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | } |
| | | try |
| | | { |
| | | devices.Value.right.Communicator.Write<int>("D1001", ret);//右PLC自动伸出缩回速度 |
| | | devices.Value.right.Communicator.Write<bool>("M103", true);//缩回按钮 |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | } |
| | | |
| | | Console.WriteLine($"自动伸缩杆缩回 {ret}"); |
| | | } |
| | | |
| | | else |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "未知的操作命令" }; |
| | |
| | | return new WebResponseContent { Status = false, Message = "配置项 DepartmentID 无法转换为整数" }; |
| | | }; |
| | | var devices = GetDevicesByDeptId(deid); |
| | | devices.Value.left.Communicator.Write<bool>("M104", true); |
| | | devices.Value.right.Communicator.Write<bool>("M104", true); |
| | | try |
| | | { |
| | | devices.Value.left.Communicator.Write<bool>("M104", true); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | try |
| | | { |
| | | devices.Value.right.Communicator.Write<bool>("M104", true); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | |
| | | |
| | | return new WebResponseContent { Status =true,Message="暂停成功",Data = devices}; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | return (left, right); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |