| | |
| | | |
| | | using AutoMapper; |
| | | using HslCommunication; |
| | | using Mapster; |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using SqlSugar; |
| | | using System.Diagnostics.CodeAnalysis; |
| | |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | |
| | | } |
| | | |
| | | var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); |
| | | return ReceiveWMSTask(new List<WMSTaskDTO> { task }); |
| | | if (task.TaskType == (int)TaskInboundTypeEnum.InNG) |
| | | { |
| | | var station = await _stationManagerRepository.QueryFirstAsync(x => x.stationChildCode == task.SourceAddress); |
| | | Dt_Task _Task = _mapper.Map<Dt_Task>(task); |
| | | _Task.TaskState = (int)TaskInStatusEnum.InNew; |
| | | _Task.CurrentAddress = task.SourceAddress; |
| | | _Task.NextAddress = station.stationNGChildCode; |
| | | _Task.TargetAddress = station.stationNGLocation; |
| | | _Task.Roadway = station.Roadway; |
| | | |
| | | BaseDal.AddData(_Task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(_Task.TaskNum, "接收WMS任务"); |
| | | return content.OK(); |
| | | } |
| | | else |
| | | { |
| | | return ReceiveWMSTask(new List<WMSTaskDTO> { task }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | else |
| | | { |
| | | task.TaskState = (int)TaskOutStatusEnum.OutFinish; |
| | | BaseDal.UpdateData(task); |
| | | //如高温出库后 NG 则将任务标记为NG 并在出库申请后将任务出至NG口 |
| | | if (task.Remark == "NG") |
| | | { |
| | | BaseDal.UpdateData(task); |
| | | } |
| | | else |
| | | { |
| | | BaseDal.DeleteData(task); |
| | | ConsoleHelper.WriteWarningLine($"高温出库目的地址{task.TargetAddress}"); |
| | | } |
| | | |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | _taskHtyRepository.AddData(taskHty); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"堆垛机出库完成"); |
| | | } |
| | | |
| | |
| | | |
| | | #region 更新任务状态 |
| | | |
| | | var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.UpdateTask)?.ConfigValue; |
| | | if (wmsBase == null || updateTask == null) |
| | | { |
| | | throw new InvalidOperationException("WMS IP 未配置"); |
| | | } |
| | | wmsIpAddress = wmsBase + updateTask; |
| | | //var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.UpdateTask)?.ConfigValue; |
| | | //if (wmsBase == null || updateTask == null) |
| | | //{ |
| | | // throw new InvalidOperationException("WMS IP 未配置"); |
| | | //} |
| | | //wmsIpAddress = wmsBase + updateTask; |
| | | |
| | | result = HttpHelper.PostAsync(wmsIpAddress, new { TaskNum = task.TaskNum, TaskState = task.TaskState }.ToJsonString()).Result; |
| | | content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | //result = HttpHelper.PostAsync(wmsIpAddress, new { TaskNum = task.TaskNum, TaskState = task.TaskState }.ToJsonString()).Result; |
| | | //content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | #endregion |
| | | //content = WebResponseContent.Instance.OK(); |
| | | } |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public Dt_Task QueryRelocationTask(string deviceNo) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskType == (int)TaskRelocationTypeEnum.Relocation && x.TaskState == (int)TaskStatus.Created); |
| | | } |
| | | |
| | | public Dt_Task QueryExecutingTaskByBarcode(string barcode, string nextAddress) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.PalletCode == barcode && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy); |
| | | } |
| | | } |
| | | } |