| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string requestKey = JsonConvert.SerializeObject(taskDTO); |
| | | // 检查请求次数和时间限制 |
| | | if (requestTrackerToCW.TryGetValue(requestKey, out var requestInfo)) |
| | | { |
| | | if (requestInfo.Count > 5 && DateTime.Now < requestInfo.LastRequestTime.AddMinutes(2)) |
| | | { |
| | | // 如果请求次数超过限制且未超过10分钟,抛出异常 |
| | | throw new InvalidOperationException("请求次数已达到限制,请稍后再试。"); |
| | | } |
| | | } |
| | | //string requestKey = JsonConvert.SerializeObject(taskDTO); |
| | | //// 检查请求次数和时间限制 |
| | | //if (requestTrackerToCW.TryGetValue(requestKey, out var requestInfo)) |
| | | //{ |
| | | // if (requestInfo.Count > 5 && DateTime.Now < requestInfo.LastRequestTime.AddMinutes(2)) |
| | | // { |
| | | // // 如果请求次数超过限制且未超过10分钟,抛出异常 |
| | | // throw new InvalidOperationException("请求次数已达到限制,请稍后再试。"); |
| | | // } |
| | | //} |
| | | |
| | | // 更新请求跟踪信息 |
| | | if (requestTrackerToCW.ContainsKey(requestKey)) |
| | | { |
| | | requestTrackerToCW[requestKey] = (requestInfo.Count + 1, DateTime.Now); |
| | | } |
| | | else |
| | | { |
| | | requestTrackerToCW[requestKey] = (1, DateTime.Now); |
| | | } |
| | | //// 更新请求跟踪信息 |
| | | //if (requestTrackerToCW.ContainsKey(requestKey)) |
| | | //{ |
| | | // requestTrackerToCW[requestKey] = (requestInfo.Count + 1, DateTime.Now); |
| | | //} |
| | | //else |
| | | //{ |
| | | // requestTrackerToCW[requestKey] = (1, DateTime.Now); |
| | | //} |
| | | |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == taskDTO.Position && x.stationStatus == "1"); |
| | | var locations = _locationRepository.QueryData(x => x.RoadwayNo == station.Roadway && x.LocationStatus == (int)LocationEnum.Free && x.LocationType == 1); |
| | |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); |
| | | |
| | | // 返回成功响应 |
| | | requestTrackerToCW.Remove(requestKey); |
| | | //requestTrackerToCW.Remove(requestKey); |
| | | |
| | | return content.OK(data: wmsTask); |
| | | } |