This commit is contained in:
2025-04-29 10:51:23 +08:00
parent b64bbdc582
commit 99ab5b79d0
4 changed files with 38 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ using MyCode.Project.Domain.Message.Common;
using MyCode.Project.Domain.Message.Request.PurchaseOrder;
using MyCode.Project.Domain.Message.Request.User;
using MyCode.Project.Domain.Message.Response.PurchaseOrder;
using MyCode.Project.Infrastructure.Cache;
using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Infrastructure.Exceptions;
using MyCode.Project.Infrastructure.Extensions;
@@ -19,6 +20,7 @@ namespace MyCode.Project.WebApi.Areas.Admin.Controllers
public class PurchaseOrderController : BaseAdminController
{
private IPurchaseOrderService _purchaseOrderService;
/// <summary>
///
@@ -104,5 +106,36 @@ namespace MyCode.Project.WebApi.Areas.Admin.Controllers
return _purchaseOrderService.BatchAddInvoiceOrder(act, this.CurrentLogin);
}
#endregion
#region AddOrderFromKingDee
/// <summary>
/// 抓取金蝶采购订单
/// </summary>
/// <exception cref="BaseException"></exception>
[HttpGet]
public void AddOrderFromKingDee()
{
if (this.CurrentLogin.RoleType == 0)
{
SystemCache systemCache = new SystemCache();
string key = "AddOrderFromKingDee" + this.CurrentLogin.SupplierId;
var kk = systemCache.Exists(key);
if (!kk)
{
systemCache.Set(key, 1, new System.TimeSpan(0, 5, 0));
_purchaseOrderService.AddOrderFromKingDee(this.CurrentLogin.SupplierId);
}
else
{
throw new BaseException("每获取一次数据需要间隔5分钟");
}
}
else
{
throw new BaseException("管理员只能查看数据");
}
}
#endregion
}
}