防止频繁请求

This commit is contained in:
18942506660
2024-11-01 17:19:39 +08:00
parent a5b28bbb47
commit 12c37bc88f
3 changed files with 4 additions and 1 deletions

View File

@@ -125,7 +125,7 @@ namespace WMS.Web.Api.Controllers
//string codes = "AD";
//var b = await _erpInventoryService.GetInventory(new List<string>() { "111"});
//int count = 10 / 5;
//var bcd=await _productInventoryService.LingXing();
var bcd=await _productInventoryService.JuShuiTan();
//LingXingResponse<LingXingStockResponse> r = new LingXingResponse<LingXingStockResponse>();

View File

@@ -11,6 +11,7 @@ using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WMS.Web.Core.Dto.Erp;
using WMS.Web.Core.Dto.JuShuiTan;
@@ -94,6 +95,7 @@ namespace WMS.Web.Domain.Services.Public
List<JuShuiTanInventoryResponse> list = new List<JuShuiTanInventoryResponse>();
foreach (var id in StockId)
{
Thread.Sleep(1000);//不能太频繁请求
JuShuiTanInventoryRequst request = new JuShuiTanInventoryRequst();
request.wms_co_id = id;//10923342;
request.page_size = 100;
@@ -115,6 +117,7 @@ namespace WMS.Web.Domain.Services.Public
int count = Convert.ToInt32(resData["data"]["page_count"]);
for (int i = 1; i < count; i++)
{
Thread.Sleep(1000);//不能太频繁请求
request.page_index++;
resContent = PostUrl("/open/inventory/query", JsonConvert.SerializeObject(request));
resData = JObject.Parse(resContent);