| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using AutoMapper; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using SqlSugar; |
| | | using WIDESEAWCS_Core; |
| | |
| | | { |
| | | public IRepository<Dt_Parameters> Repository => BaseDal; |
| | | private readonly IRepository<Sys_User> _user; |
| | | private readonly IRepository<Dt_AlarmResetHsy> _alarm; |
| | | |
| | | public ParametersService(IRepository<Dt_Parameters> BaseDal, IRepository<Sys_User> user) : base(BaseDal) |
| | | public ParametersService(IRepository<Dt_Parameters> BaseDal, IRepository<Sys_User> user, IRepository<Dt_AlarmResetHsy> alarm) : base(BaseDal) |
| | | { |
| | | _user = user; |
| | | _user = user; |
| | | _alarm = alarm; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// èªå¨æ§å¶ä¼¸ç¼©æç伸åºå缩åé度 |
| | | /// èªå¨æ§å¶è¦ææºæç伸åºå缩åé度 |
| | | /// </summary> |
| | | /// <param name="ExtendedState">伸/åºç¶æ</param> |
| | | /// <returns></returns> |
| | |
| | | }; |
| | | var devices = GetDevicesByDeptId(deid); |
| | | |
| | | |
| | | |
| | | |
| | | //æ¾å°Dt_Parametersä¸çææ°ä¸æ¡æ°æ® |
| | | var para = BaseDal.QueryData().Where(x => x.Deptid == deid).OrderByDescending(x => x.CreateDate).FirstOrDefault(); |
| | | if (para == null) |
| | |
| | | int rigtpostition = (int)para.RightPosition;//å³ä¼¸åºä½ç½® |
| | | string message = ""; |
| | | |
| | | var alarm = _alarm.QueryData(x => x.ResetStatus == true && x.Deptid == deid && !x.AlarmContent.Contains("éç¢")); // æé¤ AlarmContent å
å« "éç¢s" çè®°å½.ToList(); |
| | | if (alarm.Count > 0) |
| | | { |
| | | return new WebResponseContent { Status = true, Message = "è¦ææºææ¥è¦ï¼è¯·å
å¤ä½" }; |
| | | } |
| | | |
| | | |
| | | try |
| | | { |
| | | |
| | | if (devices.Value.left.Communicator.Read<bool>("M117")) |
| | | { |
| | | |
| | |
| | | } |
| | | try |
| | | { |
| | | |
| | | |
| | | if (devices.Value.right.Communicator.Read<bool>("M117")) |
| | | { |
| | | return new WebResponseContent { Status = true, Message = "ç°å¨æ£å¨è¿è¡ä¸ï¼çå¾
æä½å®æ" }; |
| | |
| | | { |
| | | if (devices.Value.left.Communicator.Read<float>("D80")>= liftPosition-5)//å°è¾¾æå¤§ä½ç½®) |
| | | { |
| | | message += "左伸缩æå°è¾¾ç®æ ä½ç½®ï¼"; |
| | | message += "å·¦è¦ææºæå°è¾¾ç®æ ä½ç½®ï¼"; |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | if (devices.Value.right.Communicator.Read<float>("D80") >= rigtpostition-5) |
| | | { |
| | | message += "å³ä¼¸ç¼©æå°è¾¾ç®æ ä½ç½®ï¼"; |
| | | message += "å³è¦ææºæå°è¾¾ç®æ ä½ç½®ï¼"; |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | if (devices.Value.left.Communicator.Read<bool>("M115")) //å°è¾¾åç¹ä½ |
| | | { |
| | | message += "左伸缩æå·²å°åç¹ï¼"; |
| | | message += "å·¦è¦ææºæå·²å°åç¹ï¼"; |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | if (devices.Value.right.Communicator.Read<bool>("M115")) |
| | | { |
| | | message += "å³ä¼¸ç¼©æå·²å°åç¹ï¼"; |
| | | message += "å³è¦ææºæå·²å°åç¹ï¼"; |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | |
| | | /// <summary> |
| | | /// æå¨æ§å¶ï¼ä¼¸ç¼©æç缩åå伸åºé度 |
| | | /// æå¨æ§å¶ï¼è¦ææºæç缩åå伸åºé度 |
| | | /// </summary> |
| | | /// <param name="position">伸缩æçä½ç½®ï¼å·¦å³ï¼</param> |
| | | /// <param name="position">è¦ææºæçä½ç½®ï¼å·¦å³ï¼</param> |
| | | /// <param name="ExtendedState">伸/ç¼©ç¶æ</param> |
| | | /// <returns></returns> |
| | | /// |
| | |
| | | { |
| | | if (!int.TryParse(AppSettings.Get("DepartmentID"), out int deid)) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "é
置项 DepartmentID æ æ³è½¬æ¢ä¸ºæ´æ°" }; |
| | | return new WebResponseContent { Status = true, Message = "é
置项 DepartmentID æ æ³è½¬æ¢ä¸ºæ´æ°" }; |
| | | } |
| | | var devices = GetDevicesByDeptId(deid); |
| | | |
| | |
| | | //bool canLeft = true, |
| | | // canRight = true; |
| | | string message = ""; |
| | | var alarm = _alarm.QueryData(x => x.ResetStatus == true && x.Deptid == deid && !x.AlarmContent.Contains("éç¢")); // æé¤ AlarmContent å
å« "éç¢s" çè®°å½.ToList(); |
| | | if (alarm.Count > 0) |
| | | { |
| | | return new WebResponseContent { Status = true, Message = "è¦ææºææ¥è¦ï¼è¯·å
å¤ä½" }; |
| | | } |
| | | |
| | | try |
| | | { |
| | | |
| | | //var alarmSignals = new[] { "M109", "M111", "M110", "M120" }; |
| | | //if (alarmSignals.Any(signal => devices.Value.left.Communicator.Read<bool>(signal))) |
| | | //{ |
| | | // return new WebResponseContent { Status = true, Message = "è¦ææºææ¥è¦ï¼è¯·å
å¤ä½" }; |
| | | //} |
| | | if (devices.Value.left.Communicator.Read<bool>("M117")) //é»è®¤æ¯flase |
| | | { |
| | | |
| | |
| | | } |
| | | try |
| | | { |
| | | |
| | | |
| | | if (devices.Value.right.Communicator.Read<bool>("M117")) |
| | | { |
| | | return new WebResponseContent { Status = true, Message = "ç°å¨æ£å¨è¿è¡ä¸ï¼çå¾
æä½å®æ" }; |
| | |
| | | { |
| | | if (devices.Value.left.Communicator.Read<float>("D80") >= liftPosition - 5) //å°è¾¾ç®æ ä½ç½® |
| | | { |
| | | message += "左伸缩æå°è¾¾ç®æ ä½ç½®ï¼"; |
| | | message += "å·¦è¦ææºæå°è¾¾ç®æ ä½ç½®ï¼"; |
| | | } |
| | | else |
| | | { |
| | |
| | | devices.Value.left.Communicator.Write<bool>("M100", false); // éæ¾æé® |
| | | |
| | | |
| | | Console.WriteLine($"{position}伸缩ææå¨ä¼¸åº{ext}"); |
| | | Console.WriteLine($"{position}è¦ææºææå¨ä¼¸åº{ext}"); |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | if (devices.Value.left.Communicator.Read<bool>("M115"))//缩åçæ¶å夿) |
| | | { |
| | | message += "左伸缩æå·²å°åç¹ï¼"; |
| | | message += "å·¦è¦ææºæå·²å°åç¹ï¼"; |
| | | } |
| | | else |
| | | { |
| | | //devices.Value.left.Communicator.Write<int>("D1004", liftPosition);//伸åºä½ç½® |
| | | devices.Value.left.Communicator.Write<int>("D1004", liftPosition);//伸åºä½ç½® |
| | | devices.Value.left.Communicator.Write<int>("D1000", ext);//å·¦PLCæå¨ä¼¸åºç¼©åé度 |
| | | devices.Value.left.Communicator.Write<bool>("M101", true); |
| | | Thread.Sleep(100); // çå¾
100msï¼æ¨¡ææé®æä¸ï¼ |
| | | devices.Value.left.Communicator.Write<bool>("M101", false); // éæ¾æé® |
| | | Console.WriteLine($"{position}伸缩ææå¨ç¼©å{ext}"); |
| | | Console.WriteLine($"{position}è¦ææºææå¨ç¼©å{ext}"); |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | if (devices.Value.right.Communicator.Read<float>("D80") >= rigtpostition - 5) |
| | | { |
| | | message += "å³ä¼¸ç¼©æå°è¾¾ç®æ ä½ç½®ï¼"; |
| | | message += "å³è¦ææºæå°è¾¾ç®æ ä½ç½®ï¼"; |
| | | } |
| | | else |
| | | { |
| | |
| | | devices.Value.right.Communicator.Write<bool>("M100", true); |
| | | Thread.Sleep(100); // çå¾
100msï¼æ¨¡ææé®æä¸ï¼ |
| | | devices.Value.right.Communicator.Write<bool>("M100", false); // éæ¾æé® |
| | | Console.WriteLine($"{position}伸缩ææå¨ä¼¸åº{ret}"); |
| | | Console.WriteLine($"{position}è¦ææºææå¨ä¼¸åº{ret}"); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (devices.Value.right.Communicator.Read<bool>("M115")) |
| | | { |
| | | message += "å³ä¼¸ç¼©æå·²å°åç¹ï¼"; |
| | | message += "å³è¦ææºæå·²å°åç¹ï¼"; |
| | | } |
| | | else |
| | | { |
| | | //devices.Value.right.Communicator.Write<int>("D1004", rigtpostition);//伸åºä½ç½® |
| | | devices.Value.right.Communicator.Write<int>("D1004", rigtpostition);//伸åºä½ç½® |
| | | devices.Value.right.Communicator.Write<int>("D1000", ret);//å³PLCæå¨ä¼¸åºç¼©åé度 |
| | | devices.Value.right.Communicator.Write<bool>("M101", true); |
| | | Thread.Sleep(100); // çå¾
100msï¼æ¨¡ææé®æä¸ï¼ |
| | | devices.Value.right.Communicator.Write<bool>("M101", false); // éæ¾æé® |
| | | Console.WriteLine($"{position}伸缩ææå¨ç¼©å{ret}"); |
| | | Console.WriteLine($"{position}è¦ææºææå¨ç¼©å{ret}"); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | /// <summary> |
| | | /// è·åå½åç¨åºææ°ç伸缩æé度 |
| | | /// è·åå½åç¨åºææ°çè¦ææºæé度 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent BackfillSpeed() |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå½å伸缩æçä½ç½®(èªå¨) |
| | | /// è·åå½åè¦ææºæçä½ç½®(èªå¨) |
| | | /// </summary> |
| | | /// <param name="ExtendedState"></param> |
| | | /// <returns></returns> |
| | |
| | | |
| | | var deviceslift = devices.Value.left.Communicator.Read<float>("D80"); |
| | | var devicesright = devices.Value.right.Communicator.Read<float>("D80"); |
| | | Console.WriteLine($"å½åå·¦å³ä¼¸ç¼©æè¿åé度åå«ä¸ºä¸º{deviceslift}"); |
| | | Console.WriteLine($"å½åå·¦å³è¦ææºæè¿åé度åå«ä¸ºä¸º{deviceslift}"); |
| | | |
| | | |
| | | return new WebResponseContent |