| | |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using WIDESEAWCS_BasicInfoService; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.LocationEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | |
| | | /// </summary> |
| | | public IRepository<Dt_Task> Repository => BaseDal; |
| | | |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, IRepository<Dt_TaskExecuteDetail> taskExecuteDetailRepository, IMapper mapper, IKLSLocationInfoService kLSLocationInfoService, IRGVLocationInfoService rGVLocationInfoService, IHKLocationInfoService hKLocationInfoService, IApiInfoService apiInfoService, ITrackloginfoService trackloginfoService) : base(BaseDal) |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, IRepository<Dt_TaskExecuteDetail> taskExecuteDetailRepository, IMapper mapper, IKLSLocationInfoService kLSLocationInfoService, IRGVLocationInfoService rGVLocationInfoService, IHKLocationInfoService hKLocationInfoService, IApiInfoService apiInfoService, ITrackloginfoService trackloginfoService, IStationMangerService stationMangerService) : base(BaseDal) |
| | | { |
| | | _routerService = routerService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _hKLocationInfoService = hKLocationInfoService; |
| | | _apiInfoService = apiInfoService; |
| | | _trackloginfoService = trackloginfoService; |
| | | _stationMangerService = stationMangerService; |
| | | } |
| | | public WebResponseContent ReceiveWMSTask([NotNull] List<WMSTasksDTO> taskDTOs) |
| | | { |
| | |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode || x.PalletCode == task.containerCode) != null) |
| | | { |
| | | continue; |
| | | throw new Exception($"ä»»å¡å·ã{task.taskCode}ã/æçå·ã{task.containerCode}ãå·²åå¨ä»»å¡"); |
| | | //continue; |
| | | } |
| | | switch (item.taskType) |
| | | { |
| | |
| | | { |
| | | CancelSXCTake cancelSXCTake = new CancelSXCTake |
| | | { |
| | | taskID = dt_Task.RGVTaskId |
| | | taskID = dt_Task.RGVTaskId, |
| | | withoutRunning = 1 |
| | | }; |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(CancelSXCTake)); |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°åå车AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | |
| | | { |
| | | //ç´æ¥ç§»å
¥åå² |
| | | BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.èªå¨å®æ); |
| | | return content.OK("忶任塿å", dt_Task); |
| | | return content.OK($"åæ¶ä»»å¡ã{dt_Task.WMSTaskNum}ãæå", dt_Task); |
| | | } |
| | | else |
| | | { |
| | | return content.Error($"ä»»å¡å¤±è´¥{fOURBOTReturn.data}"); |
| | | return content.Error($"ä»»å¡åæ¶å¤±è´¥ã{dt_Task.WMSTaskNum}ã{fOURBOTReturn.returnUserMsg}"); |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | priority = updateTaskPriority.taskPriority |
| | | }; |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(UpdateAgvSXCTake)); |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°åå车AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°æ´æ°åå车任å¡ä¼å
级æ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, request.Serialize()); |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn.returnUserMsg == "æå") |
| | |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(HIKROBOTTaskGrade)); |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°åå车AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, request.Serialize()); |
| | | HIKROBOTReturn hIKROBOTReturn=response.DeserializeObject<HIKROBOTReturn>(); |
| | | if (hIKROBOTReturn.code == "SUCCESS0"&&hIKROBOTReturn.message=="æå") |
| | | HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>(); |
| | | if (hIKROBOTReturn.code == "SUCCESS0" && hIKROBOTReturn.message == "æå") |
| | | { |
| | | BaseDal.UpdateData(dt_Task); |
| | | return content.OK("ä¿®æ¹ä»»å¡ä¼å
级æå", dt_Task); |
| | |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | public WebResponseContent IQCResult(IQCResultDTO iQC) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | #region 容å¨ä¸æ¶ |
| | | Dt_StationManger stationManger = _stationMangerService.Repository.QueryFirst(x => x.StationCode == iQC.StationCode) ?? throw new Exception($"æªæ¾å°ç«å°ã{iQC.StationCode}ãä¿¡æ¯"); |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(FOURBOToccupyStation)) ?? throw new Exception("æªæ¾å°ç«ç¹å®¹å¨ä¸æ¶æ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | FOURBOToccupyStation fOURBOToccupyStation = new FOURBOToccupyStation() |
| | |
| | | }; |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOToccupyStation.Serialize()); |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | if (fOURBOTReturn.returnCode != 0 && fOURBOTReturn.returnUserMsg != $"ç«ç¹å·²è¢«å ç¨,(podID={iQC.ContainerCode})") |
| | | throw new Exception(fOURBOTReturn.returnUserMsg); |
| | | #endregion |
| | | |
| | | #region å建ååè½¦ä»»å¡ |
| | | var task = BaseDal.QueryFirst(x => x.PalletCode == iQC.ContainerCode && x.SourceAddress == iQC.StationCode && x.TaskState == (int)TaskStatusEnum.New); |
| | | #endregion |
| | | #region å¼å«åå车 |
| | | apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(FOURBOTnewMovePodTask)) ?? throw new Exception("æªæ¾å°åå车任å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | FOURBOTnewMovePodTask fOURBOTnewMovePodTask = new() |
| | | { |
| | | priority = task.Grade, |
| | | podID = task.PalletCode, |
| | | //desNodeID = task.SourceAddress, |
| | | desExt = new |
| | | { |
| | | unload = 0//æ¯å¦æ¾ä¸å®¹å¨,0å¦1æ¯ |
| | | }, |
| | | desStationCodes = task.SourceAddress, |
| | | desType = 5 |
| | | }; |
| | | response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize()); |
| | | fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | content.Data = fOURBOTReturn; |
| | | if (fOURBOTReturn.returnCode != 0) throw new Exception(fOURBOTReturn.returnUserMsg); |
| | | task.TaskState = (int)TaskStatusEnum.Execut; |
| | | BaseDal.UpdateData(task); |
| | | #endregion |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | try |
| | | { |
| | | var Agvlocation = _rGVLocationInfoService.Repository.QueryData(x=> fOURBOTStorageStatusNotify.storageCode.Contains(x.LocationCode)); |
| | | var Agvlocation = _rGVLocationInfoService.Repository.QueryData(x => fOURBOTStorageStatusNotify.storageCode.Contains(x.LocationCode)); |
| | | foreach (var item in Agvlocation) |
| | | { |
| | | item.LocationStatus = (int)(fOURBOTStorageStatusNotify.disable==0?EnableStatusEnum.Normal:EnableStatusEnum.Disable); |
| | | item.EnableStatus = (int)(fOURBOTStorageStatusNotify.disable == 0 ? EnableStatusEnum.Normal : EnableStatusEnum.Disable); |
| | | } |
| | | _rGVLocationInfoService.UpdateData(Agvlocation); |
| | | return WebResponseContent.Instance.OK(); |