This commit is contained in:
alex
2023-08-15 14:53:19 +08:00
parent 386dd57782
commit 6efbf6f066
8 changed files with 72 additions and 50 deletions

View File

@@ -61,8 +61,9 @@ namespace Tnb.WarehouseMgr
IUserManager userManager,
IBillRullService billRullService,
IWmsCarryService carryService,
ICacheManager cacheManager
)
ICacheManager cacheManager,
ITaskMessageNotify taskMessageNotify
) : base(taskMessageNotify.Writer)
{
_db = repository.AsSugarClient();
_warehouseService = warehouseService;
@@ -70,6 +71,7 @@ namespace Tnb.WarehouseMgr
_billRullService = billRullService;
_carryService = carryService;
_cacheManager = cacheManager;
}
/// <summary>
/// 齐套出库(新增状态)
@@ -78,10 +80,6 @@ namespace Tnb.WarehouseMgr
[HttpPost, Timed(Name = nameof(KittingOutByAdd))]
public async Task KittingOutByAdd(CancellationTokenSource? cts = default)
{
var aToken = await _cacheManager.GetAsync("AsscessToken");
if (aToken.IsNullOrWhiteSpace()) return;
var curUser = await GetUserIdentity(aToken);
var curDb = _db.CopyNew();
try
{
@@ -135,8 +133,8 @@ namespace Tnb.WarehouseMgr
setSortingH.id = SnowflakeIdHelper.NextId();
setSortingH.kittingout_id = ko.id;
setSortingH.seq = ko.seq;
setSortingH.org_id = curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value;
setSortingH.create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value!;
setSortingH.org_id = _userManager.User.OrganizeId;
setSortingH.create_id = _userManager.UserId;
setSortingH.create_time = DateTime.Now;
await curDb.Insertable(setSortingH).ExecuteCommandAsync();
@@ -164,20 +162,12 @@ namespace Tnb.WarehouseMgr
catch (Exception ex)
{
Log.Error("齐套出库,新增时出现错误", ex);
await curDb.Ado.RollbackTranAsync();
TimedTaskErrorInfo ei = new()
{
RequestURL = App.HttpContext?.Request?.Path,
RequestMethod = App.HttpContext?.Request?.Method,
userIdentity = curUser,
};
var timedTaskEx = ex.ToTimedTaskException(ei);
cts?.Cancel();
throw timedTaskEx;
throw;
}
finally
finally
{
await Publish(nameof(IWareHouseService.GenTaskExecute));
}
}
/// <summary>
@@ -187,10 +177,6 @@ namespace Tnb.WarehouseMgr
[HttpPost, Timed(Name = nameof(KittingOutByIsToBeShipped))]
public async Task KittingOutByIsToBeShipped(CancellationTokenSource? cts = default)
{
var aToken = await _cacheManager.GetAsync("AsscessToken");
if (aToken.IsNullOrWhiteSpace()) return;
var curUser = await GetUserIdentity(aToken);
var curDb = _db.CopyNew();
try
{
@@ -229,7 +215,7 @@ namespace Tnb.WarehouseMgr
WmsPretaskH preTask = new()
{
org_id = curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value,
org_id = _userManager.User.OrganizeId,
startlocation_id = sPoint?.location_id!,
startlocation_code = sPoint?.location_code!,
endlocation_id = ePoint?.location_id!,
@@ -250,7 +236,7 @@ namespace Tnb.WarehouseMgr
area_code = it.Key,
require_id = ko.id,
require_code = ko.bill_code,
create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value!,
create_id = _userManager.UserId,
create_time = DateTime.Now,
source_id = ko.source_id,
source_code = ko.source_code
@@ -277,15 +263,12 @@ namespace Tnb.WarehouseMgr
catch (Exception ex)
{
Log.Error("齐套出库,待配送时出现错误", ex);
TimedTaskErrorInfo ei = new()
{
RequestURL = App.HttpContext?.Request?.Path,
RequestMethod = App.HttpContext?.Request?.Method,
userIdentity = curUser,
};
var timedTaskEx = ex.ToTimedTaskException(ei);
cts?.Cancel();
throw timedTaskEx;
throw;
}
finally
{
await Publish(nameof(IWareHouseService.GenTaskExecute));
}
}