| | |
| | | #endregion << ç æ¬ 注 é >> |
| | | |
| | | using AutoMapper; |
| | | using Dm; |
| | | using SqlSugar; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_BasicInfoService; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.LocationEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_DTO.AGV.HIKROBOT; |
| | | using WIDESEAWCS_DTO.RGV.FOURBOT; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_DTO.WMS; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | |
| | | { |
| | | public partial class TaskService : ServiceBase<Dt_Task, IRepository<Dt_Task>>, ITaskService |
| | | { |
| | | private readonly ITrackloginfoService _trackloginfoService; |
| | | private readonly IRouterService _routerService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly IHKLocationInfoService _hKLocationInfoService; |
| | |
| | | /// </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) : 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) : base(BaseDal) |
| | | { |
| | | _routerService = routerService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _kLSLocationInfoService = kLSLocationInfoService; |
| | | _rGVLocationInfoService = rGVLocationInfoService; |
| | | _hKLocationInfoService = hKLocationInfoService; |
| | | _apiInfoService = apiInfoService; |
| | | _apiInfoService = apiInfoService; |
| | | _trackloginfoService = trackloginfoService; |
| | | } |
| | | public WebResponseContent ReceiveWMSTask([NotNull] List<WMSTasksDTO> taskDTOs) |
| | | { |
| | |
| | | bool isHK = dt_Task.TaskType == (int)TaskTypeEnum.Carry || dt_Task.TaskType == (int)TaskTypeEnum.CJInbound || dt_Task.TaskType == (int)TaskTypeEnum.CJInbound || dt_Task.TaskType == (int)TaskTypeEnum.CJOutbound; |
| | | //è¿éå°ç¶ææ¹åäº198åæ¶ä»»å¡ |
| | | dt_Task.TaskType = TaskStatusEnum.WMSCancel.ObjToInt(); |
| | | #region å¯ä¹å£« |
| | | if (isGALAXISTask) |
| | | { |
| | | var KLS = new CancelGALAXISTask |
| | |
| | | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region åå车 |
| | | if (isAGV) |
| | | { |
| | | CancelSXCTake cancelSXCTake = new CancelSXCTake |
| | | { |
| | | taskID = dt_Task.RGVTaskId |
| | | }; |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(CancelSXCTake)); |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°åå车AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, cancelSXCTake.Serialize()); |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn.returnUserMsg == "æå") |
| | | { |
| | | //ç´æ¥ç§»å
¥åå² |
| | | BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.èªå¨å®æ); |
| | | return content.OK("忶任塿å", dt_Task); |
| | | } |
| | | else |
| | | { |
| | | return content.Error($"ä»»å¡å¤±è´¥{fOURBOTReturn.data}"); |
| | | } |
| | | } |
| | | #endregion |
| | | #region 海康 |
| | | if (isHK) |
| | | { |
| | | CancelHIKROBOTTask cancelHIKROBOTTask = new CancelHIKROBOTTask |
| | | { |
| | | robotTaskCode = dt_Task.WMSTaskNum, |
| | | cancelType = "CANCEL"//åè½¯åæ¶ï¼DROP人工ä»å
¥ï¼åç¡¬åæ¶ï¼ |
| | | }; |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(CancelHIKROBOTTask)); |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°åå车AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, cancelHIKROBOTTask.Serialize()); |
| | | HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>(); |
| | | if (hIKROBOTReturn.code == "SUCCESS" && hIKROBOTReturn.message == "æå") |
| | | { |
| | | //ç´æ¥ç§»å
¥åå² |
| | | BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.èªå¨å®æ); |
| | | return content.OK("忶任塿å", dt_Task); |
| | | } |
| | | else |
| | | { |
| | | return content.Error($"ä»»å¡å¤±è´¥{hIKROBOTReturn.data}"); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | var updateGALAXISTaskGrade = new UpdateGALAXISTaskGrade |
| | | { |
| | | taskId = dt_Task.TaskNum.ToString(), |
| | | taskId = dt_Task.WMSTaskNum, |
| | | reportTime = DateTime.Now.ToString(), |
| | | district = dt_Task.Roadway,//ä»»å¡åºåº |
| | | priorityCode = updateTaskPriority.taskPriority, |
| | |
| | | if (agvContent.success == true && agvContent.code == 0) |
| | | { |
| | | |
| | | BaseDal.UpdateData(dt_Task); |
| | | return content.OK("ä¿®æ¹ä»»å¡ä¼å
级æå", dt_Task); |
| | | } |
| | | else { |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region åå车 |
| | | if (isAGV) |
| | | { |
| | | var request = new UpdateAgvSXCTake |
| | | { |
| | | taskID = dt_Task.RGVTaskId, |
| | | priority = updateTaskPriority.taskPriority |
| | | }; |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(UpdateAgvSXCTake)); |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°åå车AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, request.Serialize()); |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn .returnUserMsg== "æå") |
| | | { |
| | | BaseDal.UpdateData(dt_Task); |
| | | return content.OK("ä¿®æ¹ä»»å¡ä¼å
级æå", dt_Task); |
| | | } |
| | | else |
| | | { |
| | | return content.Error($"ä»»å¡å¤±è´¥{fOURBOTReturn.data}"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | #region 海康 |
| | | if (isHK) |
| | | { |
| | | var request = new HIKROBOTTaskGrade |
| | | { |
| | | robotTaskCode = dt_Task.WMSTaskNum,//ä»»å¡å· |
| | | initPriority = updateTaskPriority.taskPriority//ä¼å
级 |
| | | }; |
| | | 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=="æå") |
| | | { |
| | | BaseDal.UpdateData(dt_Task); |
| | | return content.OK("ä¿®æ¹ä»»å¡ä¼å
级æå", dt_Task); |
| | | } |
| | | else |
| | | { |
| | | return content.Error($"ä»»å¡å¤±è´¥{hIKROBOTReturn.data}"); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | |
| | | public WebResponseContent ContainerRequest(WMSContainerFlow wMSContainerFlow) |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | |
| | | public WebResponseContent IQCResult(IQCResultDTO iQC) |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¹éæ´æ°å¨ä½ç¶æ |
| | | /// </summary> |
| | | /// <param name="fOURBOTStorageStatusNotify"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | public WebResponseContent multiSetNodeStatus(FOURBOTStorageStatusNotify fOURBOTStorageStatusNotify) |
| | | { |
| | | try |
| | | { |
| | | 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); |
| | | } |
| | | _rGVLocationInfoService.UpdateData(Agvlocation); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |