Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -137,12 +137,18 @@ }); try { using(_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) { _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { stock.PalletCode }); } } catch (Exception ex) { LogFactory.GetLog("删除缓存失败").Error(true, $"{stock.PalletCode}_删除缓存失败,异常信息:{ex.Message}"); using(_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) { _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { stock.PalletCode }); } } return content.OK("任务完成成功", task.Remark); @@ -380,7 +386,10 @@ _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(locationInf, lastStatus, (int)StatusChangeTypeEnum.AutomaticStorage, task.TaskNum); stock.StockInfoDetails = new List<DtStockInfoDetail>() { { stock.StockInfoDetails[0] } }; using(_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) { _simpleCacheService.HashAdd(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, stock.PalletCode, stock); } content.OK("入库任务完成成功"); } Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -894,26 +894,26 @@ 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); @@ -947,7 +947,7 @@ _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); // 返回成功响应 requestTrackerToCW.Remove(requestKey); //requestTrackerToCW.Remove(requestKey); return content.OK(data: wmsTask); } Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs
@@ -162,7 +162,7 @@ /// <param name="input">请求数据</param> /// <returns></returns> [HttpPost, AllowAnonymous, Route("GetFROutTrayToCW")] [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 5 })] // 5秒节流 [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 15 })] // 5秒节流 public async Task<WebResponseContent> GetFROutTrayToCW([FromBody] RequestTaskDto input) { return await Service.GetFROutTrayToCW(input);