| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// 澶勭悊鍐欏叆璁惧淇″彿寮傚父浠诲姟 |
| | | /// </summary> |
| | | public void HandleTasks() |
| | | { |
| | | #region |
| | | var tasks = _taskService.Repository.QueryData(x => x.TaskState == TaskStatusEnum.Finish.ObjToInt() && !string.IsNullOrEmpty(x.Remark)); |
| | | if (tasks.Count > 0) |
| | | { |
| | | List<Dt_Task> list = new List<Dt_Task>(); |
| | | foreach (var item in tasks) |
| | | { |
| | | var infos = item.Remark.Split("_"); |
| | | var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == infos[0]) as OtherDevice; |
| | | if (device != null && device.IsConnected) |
| | | { |
| | | DeviceProDTO? devicePro = device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == infos[1] && x.DeviceChildCode == infos[3]); |
| | | if (devicePro != null) |
| | | { |
| | | var W = device.Communicator.WriteObj(devicePro.DeviceProAddress, devicePro.DeviceDataType, infos[2]); |
| | | if (W) list.Add(item); |
| | | } |
| | | } |
| | | } |
| | | _taskService.Repository.DeleteAndMoveIntoHty(list, OperateTypeEnum.鑷姩鍒犻櫎); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | | } |