| | |
| | | private readonly IMapper _mapper; |
| | | private readonly IDt_DeviceInfoRepository _deviceInfoRepository; |
| | | private readonly IDt_HandAutomaticRepository _handAutomaticRepository; |
| | | private readonly IDt_ErrorDescriptionRepository _descriptionRepository; |
| | | |
| | | public AGVService(ILocationInfoRepository locationRepository, IDt_TaskRepository taskRepository, IDt_StationManagerRepository stationManagerRepository, IDt_DeviceInfoRepository deviceInfoRepository, IMapper mapper, SocketClientService socketClientService, IDt_TaskService taskService, IDt_HandAutomaticRepository handAutomaticRepository) |
| | | public AGVService(ILocationInfoRepository locationRepository, IDt_TaskRepository taskRepository, IDt_StationManagerRepository stationManagerRepository, IDt_DeviceInfoRepository deviceInfoRepository, IMapper mapper, SocketClientService socketClientService, IDt_TaskService taskService, IDt_HandAutomaticRepository handAutomaticRepository, IDt_ErrorDescriptionRepository descriptionRepository) |
| | | { |
| | | _locationRepository = locationRepository; |
| | | BaseDal = taskRepository; |
| | |
| | | _Socket = socketClientService; |
| | | _taskService = taskService; |
| | | _handAutomaticRepository = handAutomaticRepository; |
| | | _descriptionRepository = descriptionRepository; |
| | | } |
| | | #region å¤é¨æ¥å£æ¹æ³ |
| | | |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var location = _locationRepository.QueryData(x => x.LocationStatus==(int)LocationEnum.Free).ToList(); |
| | | var location = _locationRepository.QueryData(x => x.LocationStatus == (int)LocationEnum.Free).ToList(); |
| | | if (location.Count == 0) |
| | | { |
| | | return content.Error("åºå
æ å¯ç¨åºä½"); |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = BaseDal.QueryFirst(x => x.TaskNum ==Convert.ToInt32( aGVDTO.TaskNum)); |
| | | LogFactory.GetLog("AGVå¼å¸¸ä¿¡æ¯").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(aGVDTO)}", ""); |
| | | var task = BaseDal.QueryFirst(x => x.TaskNum == Convert.ToInt32(aGVDTO.TaskNum)); |
| | | if (task != null) |
| | | { |
| | | |
| | |
| | | default: break; |
| | | } |
| | | } |
| | | LogFactory.GetLog("AGVå¼å¸¸ä¿¡æ¯").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(aGVDTO)}", ""); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogFactory.GetLog("AGVå¼å¸¸ä¿¡æ¯").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(ex.Message)}", ""); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | return ""; |
| | | } |
| | | } |
| | | private static readonly SemaphoreSlim _semaphoreUpdate = new SemaphoreSlim(1, 1); |
| | | public async Task<WebResponseContent> DeviceWarning(AGVDTO DTO) |
| | | { |
| | | await _semaphoreUpdate.WaitAsync(); |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | LogFactory.GetLog("AGä¸ä¼ æ¥è¦ä¿¡æ¯").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(DTO)}", ""); |
| | | if (DTO.Message != null) |
| | | { |
| | | Dt_ErrorDescription description = _descriptionRepository.QueryFirst(x => x.Type == DTO.Message); |
| | | if (description != null) |
| | | { |
| | | _Socket.ErrorReport(description.ErrorCode, "A", "00"); |
| | | _Socket.AddErrorMessage(description.ErrorCode, "AGV", ""); |
| | | return content.OK(); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("æªè¯å«æ¥è¦æº"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content.Error("æªæ¥æ¶å°å¼å¸¸ä¿¡æ¯"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogFactory.GetLog("AGä¸ä¼ æ¥è¦ä¿¡æ¯").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(ex.Message)}", ""); |
| | | return content.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | _semaphoreUpdate.Release(); |
| | | } |
| | | |
| | | } |
| | | #endregion å¤é¨æ¥å£æ¹æ³ |
| | | } |
| | | } |