还原定时任务
This commit is contained in:
@@ -22,6 +22,7 @@ using JNPF.FriendlyException;
|
|||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using JNPF.VisualDev;
|
using JNPF.VisualDev;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NPOI.HSSF.UserModel;
|
using NPOI.HSSF.UserModel;
|
||||||
@@ -68,9 +69,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Task<ClaimsPrincipal> GetUserIdentity(string aToken)
|
protected Task<ClaimsPrincipal> GetUserIdentity()
|
||||||
{
|
{
|
||||||
var claims = JWTEncryption.ReadJwtToken(aToken)?.Claims;
|
var claims = JWTEncryption.ReadJwtToken(UserManager.AsscessToken)?.Claims;
|
||||||
ClaimsIdentity toKen = new ClaimsIdentity();
|
ClaimsIdentity toKen = new ClaimsIdentity();
|
||||||
foreach (Claim item in claims)
|
foreach (Claim item in claims)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,9 +61,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpPost, Timed(Name = nameof(PackSortingByAdd))]
|
[HttpPost, Timed(Name = nameof(PackSortingByAdd))]
|
||||||
public async Task PackSortingByAdd(CancellationTokenSource? cts = default)
|
public async Task PackSortingByAdd(CancellationTokenSource? cts = default)
|
||||||
{
|
{
|
||||||
var aToken = await _cacheManager.GetAsync("AccessToken");
|
if (UserManager.AsscessToken.IsNullOrWhiteSpace()) return;
|
||||||
if (aToken.IsNullOrWhiteSpace()) return;
|
var curUser = await GetUserIdentity();
|
||||||
var curUser = await GetUserIdentity(aToken);
|
|
||||||
|
|
||||||
var curDb = _db.CopyNew();
|
var curDb = _db.CopyNew();
|
||||||
string firstLocationId = "27010980724501", secondLocationId = "27010987857941";
|
string firstLocationId = "27010980724501", secondLocationId = "27010987857941";
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpPost, Timed(Name = nameof(KittingOutByAdd))]
|
[HttpPost, Timed(Name = nameof(KittingOutByAdd))]
|
||||||
public async Task KittingOutByAdd(CancellationTokenSource? cts = default)
|
public async Task KittingOutByAdd(CancellationTokenSource? cts = default)
|
||||||
{
|
{
|
||||||
|
if (UserManager.AsscessToken.IsNullOrWhiteSpace()) return;
|
||||||
|
var curUser = await GetUserIdentity();
|
||||||
var curDb = _db.CopyNew();
|
var curDb = _db.CopyNew();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -133,8 +135,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
setSortingH.id = SnowflakeIdHelper.NextId();
|
setSortingH.id = SnowflakeIdHelper.NextId();
|
||||||
setSortingH.kittingout_id = ko.id;
|
setSortingH.kittingout_id = ko.id;
|
||||||
setSortingH.seq = ko.seq;
|
setSortingH.seq = ko.seq;
|
||||||
setSortingH.org_id = _userManager.User.OrganizeId;
|
setSortingH.org_id = curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value;
|
||||||
setSortingH.create_id = _userManager.UserId;
|
setSortingH.create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)!.Value;
|
||||||
setSortingH.create_time = DateTime.Now;
|
setSortingH.create_time = DateTime.Now;
|
||||||
await curDb.Insertable(setSortingH).ExecuteCommandAsync();
|
await curDb.Insertable(setSortingH).ExecuteCommandAsync();
|
||||||
|
|
||||||
@@ -145,8 +147,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
x.id = SnowflakeIdHelper.NextId();
|
x.id = SnowflakeIdHelper.NextId();
|
||||||
x.bill_id = setSortingH.id;
|
x.bill_id = setSortingH.id;
|
||||||
x.warehouse_id = setSortingH.warehouse_id;
|
x.warehouse_id = setSortingH.warehouse_id;
|
||||||
x.org_id = _userManager.User.OrganizeId;
|
x.org_id = curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value;
|
||||||
x.create_id = _userManager.UserId;
|
x.create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)!.Value;
|
||||||
x.create_time = DateTime.Now;
|
x.create_time = DateTime.Now;
|
||||||
});
|
});
|
||||||
await curDb.Insertable(setSortDetails).ExecuteCommandAsync();
|
await curDb.Insertable(setSortDetails).ExecuteCommandAsync();
|
||||||
@@ -173,6 +175,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpPost, Timed(Name = nameof(KittingOutByIsToBeShipped))]
|
[HttpPost, Timed(Name = nameof(KittingOutByIsToBeShipped))]
|
||||||
public async Task KittingOutByIsToBeShipped(CancellationTokenSource? cts = default)
|
public async Task KittingOutByIsToBeShipped(CancellationTokenSource? cts = default)
|
||||||
{
|
{
|
||||||
|
if (UserManager.AsscessToken.IsNullOrWhiteSpace()) return;
|
||||||
|
var curUser = await GetUserIdentity();
|
||||||
var curDb = _db.CopyNew();
|
var curDb = _db.CopyNew();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -211,7 +215,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
WmsPretaskH preTask = new()
|
WmsPretaskH preTask = new()
|
||||||
{
|
{
|
||||||
org_id = _userManager.User.OrganizeId,
|
org_id = curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value,
|
||||||
startlocation_id = sPoint?.location_id!,
|
startlocation_id = sPoint?.location_id!,
|
||||||
startlocation_code = sPoint?.location_code!,
|
startlocation_code = sPoint?.location_code!,
|
||||||
endlocation_id = ePoint?.location_id!,
|
endlocation_id = ePoint?.location_id!,
|
||||||
@@ -232,7 +236,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
area_code = it.Key,
|
area_code = it.Key,
|
||||||
require_id = ko.id,
|
require_id = ko.id,
|
||||||
require_code = ko.bill_code,
|
require_code = ko.bill_code,
|
||||||
create_id = _userManager.UserId,
|
create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)!.Value,
|
||||||
create_time = DateTime.Now,
|
create_time = DateTime.Now,
|
||||||
source_id = ko.source_id,
|
source_id = ko.source_id,
|
||||||
source_code = ko.source_code
|
source_code = ko.source_code
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ public class OAuthService : IDynamicApiController, ITransient
|
|||||||
[HttpGet("Logout")]
|
[HttpGet("Logout")]
|
||||||
public async Task Logout([FromQuery] string ticket)
|
public async Task Logout([FromQuery] string ticket)
|
||||||
{
|
{
|
||||||
await _cacheManager.DelAsync("AsscessToken");
|
//await _cacheManager.DelAsync("AsscessToken");
|
||||||
|
|
||||||
var tenantId = _userManager.TenantId ?? "default";
|
var tenantId = _userManager.TenantId ?? "default";
|
||||||
var userId = _userManager.UserId ?? "admim";
|
var userId = _userManager.UserId ?? "admim";
|
||||||
@@ -607,7 +607,8 @@ public class OAuthService : IDynamicApiController, ITransient
|
|||||||
}, tokenTimeout);
|
}, tokenTimeout);
|
||||||
|
|
||||||
//modify by ly on 20230804
|
//modify by ly on 20230804
|
||||||
await _cacheManager.SetAsync("AsscessToken", accessToken, TimeSpan.FromMinutes(-1));
|
UserManager.AsscessToken = accessToken;
|
||||||
|
//await _cacheManager.SetAsync("AsscessToken", accessToken, TimeSpan.FromMinutes(-1));
|
||||||
|
|
||||||
// 单点登录标识缓存
|
// 单点登录标识缓存
|
||||||
if (_oauthOptions.Enabled) _cacheManager.Set("OnlineTicket_" + input.online_ticket, options.ConfigId);
|
if (_oauthOptions.Enabled) _cacheManager.Set("OnlineTicket_" + input.online_ticket, options.ConfigId);
|
||||||
|
|||||||
Reference in New Issue
Block a user