| | |
| | | using LogLibrary.Log; |
| | | using Mapster; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using SqlSugar; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Threading.Tasks; |
| | |
| | | |
| | | task.NextAddress = station.stationChildCode; |
| | | |
| | | task.Floor = "1F"; |
| | | task.Floor = item.Floor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor); |
| | | |
| | | if (station != null) |
| | | { |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor); |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | task.NextAddress = next.stationChildCode; |
| | | |
| | | task.NextAddress = next.stationChildCode; |
| | | task.Floor = item.Floor; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | task.AGVSign = ""; |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup) |
| | | { |
| | |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor); |
| | | |
| | | if (station != null) |
| | | { |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor); |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | task.NextAddress = next.stationChildCode; |
| | | |
| | | task.NextAddress = next.stationChildCode; |
| | | task.Floor = item.Floor; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | task.AGVSign = ""; |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup) |
| | | { |
| | |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor); |
| | | |
| | | if (station != null) |
| | | { |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor); |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | task.NextAddress = next.stationChildCode; |
| | | |
| | | task.NextAddress = next.stationChildCode; |
| | | task.Floor = item.Floor; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | task.AGVSign = ""; |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | |
| | | task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew; |
| | | |
| | |
| | | |
| | | task.NextAddress = task.TargetAddress; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | task.Floor = item.Floor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | |
| | | { |
| | | if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor); |
| | | |
| | | if (station != null) |
| | | { |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor); |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | task.NextAddress = next.stationChildCode; |
| | | |
| | | task.NextAddress = next.stationChildCode; |
| | | task.Floor = item.Floor; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | task.AGVSign = ""; |
| | | } |
| | | |
| | | } |
| | | |
| | | // å°è½¬æ¢åç任塿·»å å°ä»»å¡åè¡¨ä¸ |
| | |
| | | /// <returns></returns> |
| | | public Dt_Task QueryRequestTSJSignalTask() |
| | | { |
| | | return BaseDal.QueryFirst(x => TaskAcrossFloorboundTypes.Contains(x.TaskType) && x.TaskState > (int)TaskAcrossFloorStatusEnum.CarryNew && (x.AGVSign == "RequestPickUp" || x.AGVSign == "RequestPut")); |
| | | return BaseDal.QueryFirst(x => x.TaskState > (int)TaskAcrossFloorStatusEnum.CarryNew && (x.AGVSign == "RequestPickUp" || x.AGVSign == "RequestPut")); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) |
| | | { |
| | | content = StackCraneTaskCompleted(task.TaskNum); |
| | | return content; |
| | | } |
| | | if (task.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress); |
| | | SendAgvTask(station.stationRemark, task.TaskNum); |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | #region å
¥åºè°ç¨æ¥å£è·åè´§ä½å°å |
| | | |
| | | var taskDto = new RequestTaskDto() |
| | | { |
| | | Position = task.NextAddress, |
| | | PalletCode = task.PalletCode, |
| | | }; |
| | | //var taskDto = new RequestTaskDto() |
| | | //{ |
| | | // Position = task.NextAddress, |
| | | // PalletCode = task.PalletCode, |
| | | //}; |
| | | |
| | | // è·åWMSipå°å |
| | | var configz = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | var wmsBasez = configz.Where(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE).FirstOrDefault()?.ConfigValue; |
| | | var requestLocation = configz.Where(x => x.ConfigKey == SysConfigKeyConst.RequestLocation).FirstOrDefault()?.ConfigValue; |
| | | if (wmsBasez == null || requestLocation == null) |
| | | { |
| | | throw new InvalidOperationException("WMS IP æªé
ç½®"); |
| | | } |
| | | var wmsIpAddrss = wmsBasez + requestLocation; |
| | | //// è·åWMSipå°å |
| | | //var configz = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | //var wmsBasez = configz.Where(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE).FirstOrDefault()?.ConfigValue; |
| | | //var requestLocation = configz.Where(x => x.ConfigKey == SysConfigKeyConst.RequestLocation).FirstOrDefault()?.ConfigValue; |
| | | //if (wmsBasez == null || requestLocation == null) |
| | | //{ |
| | | // throw new InvalidOperationException("WMS IP æªé
ç½®"); |
| | | //} |
| | | //var wmsIpAddrss = wmsBasez + requestLocation; |
| | | |
| | | // åé请æ±å¹¶çå¾
ååº |
| | | var abc = HttpHelper.PostAsync(wmsIpAddrss, taskDto.ToJsonString()).Result; |
| | | if (abc == null) |
| | | return content.Error(); |
| | | // ååºååååºå
容 |
| | | content = JsonConvert.DeserializeObject<WebResponseContent>(abc); |
| | | //// åé请æ±å¹¶çå¾
ååº |
| | | //var abc = HttpHelper.PostAsync(wmsIpAddrss, taskDto.ToJsonString()).Result; |
| | | //if (abc == null) |
| | | // return content.Error(); |
| | | //// ååºååååºå
容 |
| | | //content = JsonConvert.DeserializeObject<WebResponseContent>(abc); |
| | | |
| | | LogFactory.WriteError($"è·åè´§ä½", $"è·åè´§ä½,ä»»å¡å·:ã{task.TaskNum}ã,æçå·ï¼ã{task.PalletCode}ãè¿ååæ°ã{JsonConvert.SerializeObject(content)}ã"); |
| | | //LogFactory.WriteError($"è·åè´§ä½", $"è·åè´§ä½,ä»»å¡å·:ã{task.TaskNum}ã,æçå·ï¼ã{task.PalletCode}ãè¿ååæ°ã{JsonConvert.SerializeObject(content)}ã"); |
| | | |
| | | // æ£æ¥ç¶æå¹¶è¿å |
| | | if (!content.Status) |
| | | { |
| | | return content; |
| | | } |
| | | //// æ£æ¥ç¶æå¹¶è¿å |
| | | //if (!content.Status) |
| | | //{ |
| | | // return content; |
| | | //} |
| | | |
| | | // ååºåå任塿°æ® |
| | | var taskResult = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); |
| | | //// ååºåå任塿°æ® |
| | | //var taskResult = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); |
| | | |
| | | task.CurrentAddress = task.NextAddress; |
| | | task.NextAddress = task.TargetAddress; |
| | |
| | | |
| | | if (task.TaskState == (int)TaskAGVCarryStatusEnum.AGV_CarryFinish) |
| | | { |
| | | CompletedTask(task.TaskNum); |
| | | |
| | | task.ModifyDate = DateTime.Now; |
| | | task.Modifier = "System"; |
| | | |
| | |
| | | task.Modifier = "System"; |
| | | BaseDal.UpdateData(task); |
| | | |
| | | content.OK(data: task); |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"å åæºåºåºå®æ"); |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup && task.TaskState == (int)TaskInStatusEnum.SC_InExecuting) |