diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryCode.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryCode.part.cs
index c41af99e..698881c0 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryCode.part.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryCode.part.cs
@@ -40,5 +40,10 @@ public partial class WmsCarryCode
///
[SugarColumn(IsIgnore = true)]
public int check_conclusion { get; set; }
+ ///
+ /// 出库需求量(临时)
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public decimal pr_qty { get; set; }
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
index a1f5809b..a4166499 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
@@ -28,6 +28,7 @@ using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.HSSF.UserModel;
+using NPOI.OpenXmlFormats.Dml;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using SqlSugar;
@@ -47,7 +48,7 @@ namespace Tnb.WarehouseMgr
[Route("api/[area]/[controller]/[action]")]
public class BaseWareHouseService : IOverideVisualDevService, IDynamicApiController, ITransient
{
- private static Dictionary _stroageMap = new(StringComparer.OrdinalIgnoreCase);
+ private static Lazy> _stroageMap;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
private readonly ChannelWriter _channelWriter;
@@ -58,24 +59,29 @@ namespace Tnb.WarehouseMgr
static BaseWareHouseService()
{
- var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IWHStorageService).IsAssignableFrom(u)).ToList();
- foreach (var serviceType in serviceTypes)
+ _stroageMap = new Lazy>(() =>
{
- var callerName = serviceType.GetCustomAttribute()?.Name ?? string.Empty;
- if (!callerName.IsNullOrEmpty())
+ Dictionary map = new(StringComparer.OrdinalIgnoreCase);
+ var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IWHStorageService).IsAssignableFrom(u)).ToList();
+ foreach (var serviceType in serviceTypes)
{
- var obj = Activator.CreateInstance(serviceType) as IWHStorageService;
- if (obj == null) continue;
- _stroageMap[callerName] = obj;
+ var callerName = serviceType.GetCustomAttribute()?.Name ?? string.Empty;
+ if (!callerName.IsNullOrEmpty())
+ {
+ var obj = Activator.CreateInstance(serviceType) as IWHStorageService;
+ if (obj == null) continue;
+ map[callerName] = obj;
+ }
}
- }
+ return map;
+ });
+
+
}
- protected Task GetUserIdentity(string? sToken = null)
+ protected Task GetUserIdentity()
{
- var at = sToken ?? UserManager.AsscessToken;
- at = at.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase) ? at.TrimStart("Bearer ") : at;
- var claims = JWTEncryption.ReadJwtToken(at)?.Claims;
+ var claims = JWTEncryption.ReadJwtToken(UserManager.AsscessToken)?.Claims;
ClaimsIdentity toKen = new ClaimsIdentity();
foreach (Claim item in claims)
{
@@ -115,6 +121,9 @@ namespace Tnb.WarehouseMgr
}
return Task.FromResult(isMatch);
}
+
+
+
///
/// 发布消息
///
@@ -131,9 +140,9 @@ namespace Tnb.WarehouseMgr
[NonAction]
protected async Task DoUpdate(WareHouseUpInput input)
{
- if (_stroageMap.ContainsKey(input.loginType))
+ if (_stroageMap.Value.ContainsKey(input.loginType))
{
- await _stroageMap[input.loginType].Do(input);
+ await _stroageMap.Value[input.loginType].Do(input);
}
}
[NonAction]
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs
index b9906be2..817be66e 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs
@@ -92,14 +92,6 @@ namespace Tnb.WarehouseMgr
if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500);
ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id);
}
- var ui = await GetUserIdentity(_userManager.ToKen);
- if (_userManager.User == null)
- {
-
- var curUid = ui.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
- _userManager.User = await _db.Queryable().SingleAsync(it => it.Id == curUid);
- }
-
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_CARRYMOVEINSTOCK_ID, true);
await _runService.Create(templateEntity, input);
@@ -139,7 +131,7 @@ namespace Tnb.WarehouseMgr
preTask.area_code = it.Key;
preTask.require_id = input.data["ReturnIdentity"].ToString();
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
- preTask.create_id = _userManager.UserId ?? ui.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
+ preTask.create_id = _userManager.UserId;
preTask.create_time = DateTime.Now;
return preTask;
}).ToList();
@@ -163,7 +155,7 @@ namespace Tnb.WarehouseMgr
handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!;
handleH.require_id = input.data["ReturnIdentity"].ToString();
handleH.require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!;
- handleH.create_id = _userManager.UserId ?? ui.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
+ handleH.create_id = _userManager.UserId;
handleH.create_time = DateTime.Now;
preTaskUpInput.PreTaskRecord = handleH;
//根据载具移入Id,回更单据状态
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
index 2351170b..00ee9dfe 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
@@ -32,6 +32,7 @@ using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces;
+using System.Reflection;
namespace Tnb.WarehouseMgr
{
@@ -145,6 +146,7 @@ namespace Tnb.WarehouseMgr
{
List carryMats = new();
List carryCodes = new();
+ List carryCodesPart = new();
foreach (var os in outStockDList)
{
var OutStockStrategyInput = new OutStockStrategyQuery
@@ -159,9 +161,11 @@ namespace Tnb.WarehouseMgr
? (a, b) => a.id == input.data[nameof(WmsOutstockH.carry_id)].ToString()
: (a, b) => outStkCarrys.Select(x => x.id).Contains(b.carry_id);
- List? carryCodesPart = await _db.Queryable().InnerJoin((a, b) => a.id == b.carry_id).InnerJoin((a, b, c) => a.location_id == c.id)
+ carryCodesPart = await _db.Queryable().InnerJoin((a, b) => a.id == b.carry_id).InnerJoin((a, b, c) => a.location_id == c.id)
.Where(whereExp)
.Select()
+ .MergeTable()
+ .OrderBy(it=>it.create_time)
.ToListAsync();
if (carryCodesPart?.Count > 0)
@@ -214,7 +218,7 @@ namespace Tnb.WarehouseMgr
var sortingOutIds = new List();
foreach (var pair in dic)
{
- var codes = carryCodes.FindAll(x => x.carry_id == pair.Key);
+ var codes = carryCodesPart.FindAll(x => x.carry_id == pair.Key);
if (codes?.Count > 0)
{
if (pair.Value == codes.Sum(d => d.codeqty))
@@ -644,12 +648,12 @@ namespace Tnb.WarehouseMgr
{
await _db.Ado.BeginTranAsync();
- var curUser = await GetUserIdentity();
+
var carryId = input.carryIds[^input.carryIds.Count];
var carry = await _db.Queryable().SingleAsync(it => it.id == carryId);
if (carry != null)
{
-
+
var otds = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync();
var outStatus = carry.out_status.ToEnum();
if (outStatus == EnumOutStatus.全部出)
@@ -658,7 +662,7 @@ namespace Tnb.WarehouseMgr
var carryCodes = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync();
var outStockCodes = carryCodes.Adapt>();
-
+
outStockCodes.ForEach(x =>
{
var billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id;
@@ -669,8 +673,8 @@ namespace Tnb.WarehouseMgr
x.id = SnowflakeIdHelper.NextId();
x.bill_id = input.requireId;
x.bill_d_id = billDId!;
- x.org_id = _userManager.User?.OrganizeId ?? curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value ?? string.Empty;
- x.create_id = _userManager.UserId ?? curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value ?? string.Empty; ;
+ x.org_id = _userManager.User.OrganizeId;
+ x.create_id = _userManager.UserId;
x.create_time = DateTime.Now;
});
await _db.Insertable(outStockCodes).ExecuteCommandAsync();
@@ -721,8 +725,8 @@ namespace Tnb.WarehouseMgr
x.id = SnowflakeIdHelper.NextId();
x.bill_id = input.requireId;
x.bill_d_id = billDId!;
- x.org_id = _userManager.User?.OrganizeId ?? curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value ?? string.Empty;
- x.create_id = _userManager.UserId?? curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value ?? string.Empty;
+ x.org_id = _userManager.User?.OrganizeId;
+ x.create_id = _userManager.UserId;
x.create_time = DateTime.Now;
});
await _db.Insertable(osCodes).ExecuteCommandAsync();
@@ -787,13 +791,13 @@ namespace Tnb.WarehouseMgr
await _db.Updateable(carryCode).UpdateColumns(it => it.codeqty).ExecuteCommandAsync();
}
}
- var row = await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.正常).ToString() }).Where(it => input.carryIds.Contains(it.id)).ExecuteCommandAsync();
- await _db.Deleteable().Where(it => input.carryIds.Contains(it.carry_id)).ExecuteCommandAsync();
}
if (delBarcodes.Count > 0)
{
await _db.Deleteable().Where(it => delBarcodes.Contains(it.barcode)).ExecuteCommandAsync();
}
+ var row = await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.正常).ToString() }).Where(it => input.carryIds.Contains(it.id)).ExecuteCommandAsync();
+ await _db.Deleteable().Where(it => input.carryIds.Contains(it.carry_id)).ExecuteCommandAsync();
//载具移入
var outStockH = await _db.Queryable().SingleAsync(it => it.id == input.requireId);
var visulDevInput = new VisualDevModelDataCrInput();
@@ -804,11 +808,12 @@ namespace Tnb.WarehouseMgr
[nameof(WmsCarryD.carry_id)] = input.carryIds.First(),
[nameof(WmsCarryH.carry_code)] = carry.carry_code,
[nameof(WmsHandleH.biz_type)] = input.bizTypeId,
- [nameof(WmsHandleH.create_id)] = _userManager.UserId ?? curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value ?? string.Empty,
+ [nameof(WmsHandleH.create_id)] = _userManager.UserId,
[nameof(WmsHandleH.create_time)] = DateTime.Now,
[nameof(WmsMoveInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID,
[nameof(WmsHandleH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_CARRYMOINSTK_ENCODE).GetAwaiter().GetResult(),
};
+
await _wmsCarryMoveInStockService.CarryMoveIn(visulDevInput);
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs
index 0dd8a177..96211641 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs
@@ -3,12 +3,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using JNPF.Common.Const;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Enums;
using JNPF.Common.Extension;
using JNPF.Common.Security;
using JNPF.FriendlyException;
+using JNPF.Systems.Entitys.Permission;
using JNPF.Systems.Interfaces.System;
using JNPF.VisualDev;
using JNPF.VisualDev.Entitys;
@@ -63,6 +65,107 @@ namespace Tnb.WarehouseMgr
private async Task PDACarryMoveIn(VisualDevModelDataCrInput input)
{
+ #region old
+ //try
+ //{
+ // await _db.Ado.BeginTranAsync();
+
+ // //入库取终点 //出库起点
+ // var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 };
+ // var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
+ // WmsPointH sPoint = null!;
+ // WmsPointH ePoint = null!;
+ // if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
+ // {
+ // sPoint = await _db.Queryable().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
+ // }
+ // if (endLocations?.Count > 0)
+ // {
+ // var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString());
+ // var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id);
+ // var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc);
+ // if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500);
+ // ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id);
+ // }
+
+ // VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
+ // await _runService.Create(templateEntity, input);
+
+ // if (sPoint != null && ePoint != null)
+ // {
+ // var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
+ // //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
+ // if (points?.Count > 0)
+ // {
+ // if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
+ // var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
+ // {
+ // var sPoint = it.FirstOrDefault();
+ // var ePoint = it.LastOrDefault();
+
+ // WmsPretaskH preTask = new();
+ // preTask.org_id = _userManager.User.OrganizeId;
+ // preTask.startlocation_id = sPoint?.location_id!;
+ // preTask.startlocation_code = sPoint?.location_code!;
+ // preTask.endlocation_id = ePoint?.location_id!;
+ // preTask.endlocation_code = ePoint?.location_code!;
+ // preTask.start_floor = sPoint?.floor.ToString();
+ // preTask.end_floor = ePoint?.floor.ToString();
+ // preTask.startpoint_id = sPoint?.id!;
+ // preTask.startpoint_code = sPoint?.point_code!;
+ // preTask.endpoint_id = ePoint?.id!;
+ // preTask.endpoint_code = ePoint?.point_code!;
+ // preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
+ // preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
+ // preTask.biz_type = WmsWareHouseConst.BIZTYPE_CARRYMOVEINSTOCK_ID;
+ // preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
+ // preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!;
+ // preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!;
+ // preTask.area_id = sPoint?.area_id!;
+ // preTask.area_code = it.Key;
+ // preTask.require_id = input.data["ReturnIdentity"].ToString();
+ // preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
+ // preTask.create_id = _userManager.UserId;
+ // preTask.create_time = DateTime.Now;
+ // return preTask;
+ // }).ToList();
+ // var isOk = await _wareHouseService.GenPreTask(preTasks, null!);
+ // if (isOk)
+ // {
+ // var preTaskUpInput = new GenPreTaskUpInput();
+ // preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString()!;
+ // preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
+ // preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!;
+ // preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!;
+ // preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!;
+ // preTaskUpInput.PreTaskRecords = preTasks.Adapt>();
+ // preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
+ // //根据载具移入Id,回更单据状态
+ // await _db.Updateable().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
+
+ // await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
+ // it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
+ // it => new BasLocation { is_lock = 1 });
+
+ // }
+ // }
+
+ // }
+
+ // await _db.Ado.CommitTranAsync();
+ //}
+ //catch (Exception)
+ //{
+ // await _db.Ado.RollbackTranAsync();
+ // throw;
+ //}
+ //finally
+ //{
+ // await Publish(nameof(IWareHouseService.GenTaskExecute));
+ //}
+ //return Task.FromResult(true);
+ #endregion
+
try
{
await _db.Ado.BeginTranAsync();
@@ -85,9 +188,11 @@ namespace Tnb.WarehouseMgr
ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id);
}
- VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
+
+ VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_CARRYMOVEINSTOCK_ID, true);
await _runService.Create(templateEntity, input);
+
if (sPoint != null && ePoint != null)
{
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
@@ -101,7 +206,7 @@ namespace Tnb.WarehouseMgr
var ePoint = it.LastOrDefault();
WmsPretaskH preTask = new();
- preTask.org_id = _userManager.User.OrganizeId;
+ preTask.org_id = _userManager.User.OrganizeId!;
preTask.startlocation_id = sPoint?.location_id!;
preTask.startlocation_code = sPoint?.location_code!;
preTask.endlocation_id = ePoint?.location_id!;
@@ -135,18 +240,28 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!;
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!;
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!;
- preTaskUpInput.PreTaskRecords = preTasks.Adapt>();
- preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
+
+ WmsHandleH handleH = new();
+ handleH.org_id = _userManager.User.OrganizeId;
+ handleH.startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!;
+ handleH.endlocation_id = endLocations![0].id;
+ handleH.bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!;
+ handleH.biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!;
+ handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!;
+ handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!;
+ handleH.require_id = input.data["ReturnIdentity"].ToString();
+ handleH.require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!;
+ handleH.create_id = _userManager.UserId ;
+ handleH.create_time = DateTime.Now;
+ preTaskUpInput.PreTaskRecord = handleH;
//根据载具移入Id,回更单据状态
await _db.Updateable().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
it => new BasLocation { is_lock = 1 });
-
}
}
-
}
await _db.Ado.CommitTranAsync();
@@ -158,9 +273,11 @@ namespace Tnb.WarehouseMgr
}
finally
{
+ //向队列写入消息
await Publish(nameof(IWareHouseService.GenTaskExecute));
}
return Task.FromResult(true);
+
}
public override async Task ModifyAsync(WareHouseUpInput input)
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs
index 1281bcf7..aa2258b8 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs
@@ -5,6 +5,7 @@ using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using JNPF.Common.Contracts;
+using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.Common.Extension;
using JNPF.FriendlyException;
@@ -33,12 +34,14 @@ namespace Tnb.WarehouseMgr
private readonly IDictionaryDataService _dictionaryDataService;
private readonly IWmsCarryMoveInStockService _wmsCarryMoveInStockService;
private static Dictionary _dicBizType = new();
- public WmsSignForDeliveryService(ISqlSugarRepository repository, IWmsCarryService wareCarryService, IDictionaryDataService dictionaryDataService, IWmsCarryMoveInStockService wmsCarryMoveInStockService)
+ private readonly IUserManager _userManager;
+ public WmsSignForDeliveryService(ISqlSugarRepository repository, IWmsCarryService wareCarryService, IDictionaryDataService dictionaryDataService, IWmsCarryMoveInStockService wmsCarryMoveInStockService, IUserManager userManager)
{
_db = repository.AsSugarClient();
_wareCarryService = wareCarryService;
_dictionaryDataService = dictionaryDataService;
_wmsCarryMoveInStockService = wmsCarryMoveInStockService;
+ _userManager = userManager;
}
///
/// 根据载具ID获取,对应的执行任务记录
diff --git a/apihost/Tnb.API.Entry/Startup.cs b/apihost/Tnb.API.Entry/Startup.cs
index 5f8b9d74..2d5ed531 100644
--- a/apihost/Tnb.API.Entry/Startup.cs
+++ b/apihost/Tnb.API.Entry/Startup.cs
@@ -115,8 +115,8 @@ public class Startup : AppStartup
SnowflakeIdHelper.InitYitIdWorker();
- //bool isStartTimeJob = App.GetConfig("IsStartTimeJob");
- //if (isStartTimeJob)
- // serviceProvider.GetRequiredService().StartTimerJob();
+ bool isStartTimeJob = App.GetConfig("IsStartTimeJob");
+ if (isStartTimeJob)
+ serviceProvider.GetRequiredService().StartTimerJob();
}
}
\ No newline at end of file
diff --git a/common/Tnb.Common.Core/Manager/User/IUserManager.cs b/common/Tnb.Common.Core/Manager/User/IUserManager.cs
index fca33168..c1804ac7 100644
--- a/common/Tnb.Common.Core/Manager/User/IUserManager.cs
+++ b/common/Tnb.Common.Core/Manager/User/IUserManager.cs
@@ -82,7 +82,7 @@ public interface IUserManager
///
/// 用户信息.
///
- UserEntity User { get; set; }
+ UserEntity User { get; }
///
/// 获取用户登录信息.
diff --git a/common/Tnb.Common.Core/Manager/User/UserManager.cs b/common/Tnb.Common.Core/Manager/User/UserManager.cs
index 226c147a..72cfb692 100644
--- a/common/Tnb.Common.Core/Manager/User/UserManager.cs
+++ b/common/Tnb.Common.Core/Manager/User/UserManager.cs
@@ -71,19 +71,12 @@ public partial class UserManager : IUserManager, IScoped
}
- private UserEntity _curUser;
///
/// 用户信息.
///
public UserEntity User
{
- get
- {
- if(_curUser == null)
- _curUser= _repository.GetSingle(u => u.Id == UserId);
- return _curUser;
- }
- set => _curUser = value;
+ get =>_repository.GetSingle(u => u.Id == UserId);
}
///
diff --git a/common/Tnb.Common.Core/Manager/User/UserManager.part.cs b/common/Tnb.Common.Core/Manager/User/UserManager.part.cs
index 75597582..18b70051 100644
--- a/common/Tnb.Common.Core/Manager/User/UserManager.part.cs
+++ b/common/Tnb.Common.Core/Manager/User/UserManager.part.cs
@@ -21,7 +21,8 @@ namespace JNPF.Common.Core.Manager;
///
/// 用户管理 .
///
-public partial class UserManager
+public partial class UserManager
{
public static string AsscessToken { get; set; }
+
}
\ No newline at end of file