| | |
| | | using SqlSugar; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_BasicInfoService; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | |
| | | private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository; |
| | | private readonly ISys_ConfigService _sys_ConfigService; |
| | | private readonly IMapper _mapper; |
| | | private readonly IDt_StationManagerService _stationManagerService; |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | | { |
| | |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList(); |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ISys_ConfigService sys_ConfigService) : base(BaseDal) |
| | | public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository) : base(BaseDal) |
| | | { |
| | | _routerService = routerService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskExecuteDetailRepository = taskExecuteDetailRepository; |
| | | _mapper = mapper; |
| | | _sys_ConfigService = sys_ConfigService; |
| | | _stationManagerService = stationManagerService; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | task.TaskState = nextStatus; |
| | | task.ModifyDate = DateTime.Now; |
| | | task.Modifier = "System"; |
| | | BaseDal.UpdateData(task); |
| | | BaseDal.DeleteData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"堆垛机入库完成"); |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | |
| | | |
| | | #region WMS同步任务完成 |
| | | var keys = new Dictionary<string, object>() |
| | | { |
| | | {"taskNum", taskNum} |
| | | }; |
| | | { |
| | | {"taskNum", taskNum} |
| | | }; |
| | | // 获取WMSip地址 |
| | | var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue; |
| | |
| | | |
| | | var result = HttpHelper.GetAsync(wmsIpAddress, keys).Result; |
| | | content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | if (!content.Data.IsNullOrEmpty()) |
| | | { |
| | | if (content.Data.ToString() == "NG") |
| | | { |
| | | task.Remark = "NG"; |
| | | BaseDal.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"堆垛机出库完成,MOM返回NG"); |
| | | } |
| | | else if (task.Roadway.Contains("GW")) |
| | | { |
| | | BaseDal.DeleteData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"堆垛机出库完成,高温库数据删除"); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 更新任务状态 |
| | | |
| | | var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.CompleteTask)?.ConfigValue; |
| | | var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.UpdateTask)?.ConfigValue; |
| | | if (wmsBase == null || updateTask == null) |
| | | { |
| | | throw new InvalidOperationException("WMS IP 未配置"); |