调整超时设置,简化日志,优化节流限制
在 `HttpHelper.cs` 中,将 `HttpClient` 的超时时间从 60 秒更改为 120 秒,以便在处理请求时有更长的等待时间。
在 `TaskService.cs` 中,删除了记录日志的代码行,以简化日志输出。
在 `Dt_TaskService.cs` 中,移除了对 `stockInfo` 为 `null` 的检查和对 `lastStatus` 的赋值,表明这些变量不再需要。
在 `TaskController.cs` 中,将节流过滤器的参数从 11 更改为 5,调整请求的节流限制为每 5 秒最多允许一次请求。
| | |
| | | { |
| | | httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 60); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 120); |
| | | |
| | | if (headers != null) |
| | | { |
| | |
| | | var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); |
| | | ConsoleHelper.WriteSuccessLine(content.Data.ToString()); |
| | | |
| | | QuartzLogger.WriteLogToFile($"包装出库", $"返回参数【{JsonConvert.SerializeObject(task)}】{Environment.NewLine}{Environment.NewLine}"); |
| | | //_taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO })‘ |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { task }); |
| | | |
| | | QuartzLogger.WriteLogToFile($"包装出库", $"返回参数【{JsonConvert.SerializeObject(content)}】{Environment.NewLine}{Environment.NewLine}"); |
| | |
| | | .OrderBy(x => x.OutboundTime) |
| | | .FirstAsync(); |
| | | |
| | | |
| | | if (stockInfo == null) throw new Exception($"库内{station.productLine}无满足条件的库存可出库"); |
| | | |
| | | DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.AreaId == 5 && x.LocationCode == stockInfo.LocationCode); |
| | |
| | | ProcessCode = stockInfo.ProcessCode, |
| | | }; |
| | | WMSTaskDTO taskDTO = CreateTaskDTO(task); |
| | | |
| | | int lastStatus = locationInfo.LocationStatus; |
| | | |
| | | BaseDal.AddData(task); |
| | |
| | | /// <param name="input">请求数据</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("RequestOutTaskToBZAsync")] |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 11 })] // 5秒节流 |
| | | [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5秒节流 |
| | | public async Task<WebResponseContent> RequestOutTaskToBZAsync([FromBody] RequestTaskDto input) |
| | | { |
| | | return await Service.RequestOutTaskToBZAsync(input); |