| | |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.Telescopic; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | |
| | | namespace WIDESEAWCS_TelescopicService |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="entity"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent AddAlarmHsy(string alarmContent, bool resetStatus) |
| | | public WebResponseContent AddAlarmHsy(int deptid, string alarmContent, bool resetStatus) |
| | | { |
| | | var alarm = new Dt_AlarmResetHsy |
| | | { |
| | | Deptid = deptid, |
| | | AlarmContent= alarmContent, |
| | | ResetStatus= resetStatus, |
| | | AlarmTime=DateTime.Now, |
| | |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "没æè¦å¤ä½æ°æ®" }; |
| | | } |
| | | // è·åææä¸åç DeptIdï¼æ¯ä¸ªä»£è¡¨ä¸ä¸ªPLCï¼ |
| | | var deptIds = query.Select(x => x.Deptid).Distinct(); |
| | | |
| | | foreach (var deptId in deptIds) |
| | | { |
| | | try |
| | | { |
| | | var devices = GetDevicesByDeptId(deptId); |
| | | |
| | | try |
| | | { |
| | | devices.Value.left.Communicator.Write<bool>("M105", true); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | |
| | | } |
| | | try |
| | | { |
| | | devices.Value.right.Communicator.Write<bool>("M105", true); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine($"å DeptId={deptId} çPLCåå
¥å¤±è´¥ï¼" + ex.Message); |
| | | // å¯ä»¥éæ©ç»§ç»æä¸æ |
| | | } |
| | | } |
| | | foreach (var item in query) |
| | | { |
| | | item.ResetStatus = false; |
| | |
| | | return new WebResponseContent { Status = false, Message = "æ¨é失败ï¼" + ex.Message }; |
| | | } |
| | | } |
| | | public WebResponseContent DeleteAllinform() |
| | | { |
| | | try |
| | | { |
| | | |
| | | |
| | | |
| | | //æ¾å°è¯¥è½¨éç«çå
¨é¨ä¿¡æ¯ |
| | | var alarm = BaseDal.QueryData().ToList(); |
| | | if (alarm.Count < 0) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = $"没æè¦å é¤çæ¥è¦ä¿¡æ¯" }; |
| | | } |
| | | //æ¾å°åå
¨é¨å é¤ |
| | | var reslut = BaseDal.DeleteData(alarm); |
| | | return new WebResponseContent { Status = true, Message = "å 餿å", Data = reslut }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status = false, Message = ex.Message }; |
| | | } |
| | | } |
| | | public (OtherDevice left, OtherDevice right)? GetDevicesByDeptId(int deptId) |
| | | { |
| | | // 左设å¤å·ï¼1 -> 001ï¼2 -> 003ï¼3 -> 005... |
| | | int baseCode = 1 + (deptId - 1) * 2; |
| | | string leftCode = $"SSG{baseCode.ToString("D3")}"; |
| | | string rightCode = $"SSG{(baseCode + 1).ToString("D3")}"; |
| | | |
| | | var left = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == leftCode); |
| | | var right = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == rightCode); |
| | | |
| | | |
| | | //if (left == null || right == null) |
| | | // return null; |
| | | |
| | | return (left, right); |
| | | } |
| | | } |
| | | } |