diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/CallerAttribute.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/CallerAttribute.cs new file mode 100644 index 00000000..46153ecd --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/CallerAttribute.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Attributes +{ + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] + public class CallerAttribute : Attribute + { + public string Name { get; set; } + public CallerAttribute(string name) + { + Name = name; + } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs index cb1d601e..881ad64b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs @@ -11,6 +11,11 @@ namespace Tnb.WarehouseMgr.Entities.Dto /// public class WareHouseUpInput { + + /// + /// 登录类型 + /// + public string loginType { get; set; } /// /// 需求来源单据Id,对应业务主表Id /// @@ -25,5 +30,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto public List distaskCodes { get; set; } + + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs new file mode 100644 index 00000000..1dfaecff --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs @@ -0,0 +1,13 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.WarehouseMgr.Entities; + +/// +/// 任务执行主表 +/// +public partial class WmsDistaskH +{ + +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IPdaStroage.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IPdaStroage.cs new file mode 100644 index 00000000..f260b905 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IPdaStroage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Interfaces +{ + public interface IPdaStroage + { + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWHStorageService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWHStorageService.cs new file mode 100644 index 00000000..70965b9a --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWHStorageService.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tnb.WarehouseMgr.Entities.Dto; + +namespace Tnb.WarehouseMgr.Interfaces +{ + public interface IWHStorageService + { + Task Do(WareHouseUpInput input); + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPdaWHService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPdaWHService.cs new file mode 100644 index 00000000..c10e4bb1 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPdaWHService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Interfaces +{ + public interface IWmsPdaWHService + { + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs index 23db5be9..d71a69a9 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs @@ -13,6 +13,7 @@ using JNPF.VisualDev; using Microsoft.AspNetCore.Mvc; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr { @@ -20,29 +21,27 @@ namespace Tnb.WarehouseMgr [Route("api/[area]/[controller]/[action]")] public class BaseWareHouseService : IOverideVisualDevService, IDynamicApiController, ITransient { - private static Dictionary _serviceMap = new Dictionary(StringComparer.OrdinalIgnoreCase); + private static Dictionary _stroageMap = new Dictionary(StringComparer.OrdinalIgnoreCase); public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); static BaseWareHouseService() { - var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && u.IsSubclassOf(typeof(BaseWareHouseService))).ToList(); + var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IWHStorageService).IsAssignableFrom(u)).ToList(); foreach (var serviceType in serviceTypes) { - var bizTypeId = serviceType.GetCustomAttribute()?.BizTypeId; - if (!bizTypeId.IsNullOrEmpty()) + var callerName = serviceType.GetCustomAttribute()?.Name; + if (!callerName.IsNullOrEmpty()) { - _serviceMap[bizTypeId!] = (BaseWareHouseService)App.GetService(serviceType)!; + _stroageMap[callerName!] = (IWHStorageService)Activator.CreateInstance(serviceType)!; } } } - - protected async Task DoUpdate(WareHouseUpInput input) { - if (_serviceMap.ContainsKey(input.bizTypeId)) + if (_stroageMap.ContainsKey(input.loginType)) { - await _serviceMap[input.bizTypeId].ModifyAsync(input); + await _stroageMap[input.loginType].Do(input); } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs b/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs new file mode 100644 index 00000000..ae18e09f --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using JNPF; +using JNPF.Common.Extension; +using Tnb.WarehouseMgr.Entities.Attributes; +using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Interfaces; + +namespace Tnb.WarehouseMgr +{ + [Caller("web")] + public class PcStroageService : IWHStorageService + { + private static Dictionary _serviceMap = new Dictionary(StringComparer.OrdinalIgnoreCase); + static PcStroageService() + { + var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && !typeof(IPdaStroage).IsAssignableFrom(u) && u.IsSubclassOf(typeof(BaseWareHouseService))).ToList(); + foreach (var serviceType in serviceTypes) + { + var bizTypeId = serviceType.GetCustomAttribute()?.BizTypeId; + if (!bizTypeId.IsNullOrEmpty()) + { + _serviceMap[bizTypeId!] = (BaseWareHouseService)App.GetService(serviceType)!; + } + } + } + + public async Task Do(WareHouseUpInput input) + { + if (_serviceMap.ContainsKey(input.bizTypeId)) + { + await _serviceMap[input.bizTypeId].ModifyAsync(input); + } + } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs b/WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs new file mode 100644 index 00000000..4c840d73 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using JNPF; +using JNPF.Common.Extension; +using Tnb.WarehouseMgr.Entities.Attributes; +using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Interfaces; + +namespace Tnb.WarehouseMgr +{ + [Caller("app")] + public class PdaStroageService : IWHStorageService + { + private static Dictionary _serviceMap = new Dictionary(StringComparer.OrdinalIgnoreCase); + static PdaStroageService() + { + var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IPdaStroage).IsAssignableFrom(u) && u.IsSubclassOf(typeof(BaseWareHouseService))).ToList(); + foreach (var serviceType in serviceTypes) + { + var bizTypeId = serviceType.GetCustomAttribute()?.BizTypeId; + if (!bizTypeId.IsNullOrEmpty()) + { + _serviceMap[bizTypeId!] = (BaseWareHouseService)App.GetService(serviceType)!; + } + } + } + + public async Task Do(WareHouseUpInput input) + { + if (_serviceMap.ContainsKey(input.bizTypeId)) + { + await _serviceMap[input.bizTypeId].ModifyAsync(input); + } + } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 106fe397..14515a5c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -352,7 +352,16 @@ namespace Tnb.WarehouseMgr //更任务执行 for (int i = 0, cnt = input.disTaskIds.Count; i < cnt; i++) { - await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID, device_id = input.EqpIds[i] }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); + if (input.EqpIds?.Count > 0) + { + await _db.Updateable().SetColumns(it => new WmsDistaskH { status= WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID, device_id = input.EqpIds[i] }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); + } + else + { + await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); + + } + //await _db.Updateable().SetColumns(it => setColVal).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); } var preTaskIds = await _db.Queryable().Where(it => input.disTaskIds.Contains(it.id)).Select(it => it.pretask_id).ToListAsync(); if (preTaskIds.Count > 0) @@ -366,6 +375,7 @@ namespace Tnb.WarehouseMgr catch (Exception) { await _db.Ado.RollbackTranAsync(); + throw; } } /// @@ -441,20 +451,21 @@ namespace Tnb.WarehouseMgr { foreach (var dt in disTasks) { - if (_userManager.User.LoginType.Equals("app", StringComparison.OrdinalIgnoreCase)) - { - dt.biz_type = $"pda{dt.biz_type}"; - } var disTaskCodes = await _db.Queryable().Where(it => it.bill_id == dt.id).ToListAsync(); var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id, distaskCodes = disTaskCodes }; - if (dt.is_chain == 0) + upInput.loginType = !_userManager.LoginType.IsNullOrEmpty() ? "app" : "web"; + if (dt.is_sign == 1) //区分出入库操作 { - await DoUpdate(upInput); - } - else if (dt.is_chain == 1 && dt.chain_type == "3") - { - await DoUpdate(upInput); + if (dt.is_chain == 0) + { + await DoUpdate(upInput); + } + else if (dt.is_chain == 1 && dt.chain_type == "3") + { + await DoUpdate(upInput); + } } + } } @@ -465,6 +476,9 @@ namespace Tnb.WarehouseMgr await _db.Ado.RollbackTranAsync(); } } + + + /// /// 生成预任务 /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs index 58127d6d..0864585c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs @@ -30,9 +30,9 @@ namespace Tnb.WarehouseMgr /// [OverideVisualDev(ModuleId)] [ServiceModule(BizTypeId)] - public class WmsPDACarryMoveInStockService : BaseWareHouseService + public class WmsPDACarryMoveInStockService : BaseWareHouseService,IPdaStroage { - private const string BizTypeId = "pda26121988909861"; + private const string BizTypeId = "26121988909861"; private const string ModuleId = "26476127634469"; private readonly ISqlSugarClient _db; private readonly IRunService _runService; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs index 3995219f..38682c85 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs @@ -30,7 +30,7 @@ namespace Tnb.WarehouseMgr /// [OverideVisualDev(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID)] [ServiceModule(BizTypeId)] - public class WmsPDACarryMoveOutStockService : BaseWareHouseService + public class WmsPDACarryMoveOutStockService : BaseWareHouseService, IPdaStroage { private const string BizTypeId = "26122271183141"; private readonly ISqlSugarClient _db; @@ -133,7 +133,6 @@ namespace Tnb.WarehouseMgr it => new BasLocation { is_lock = 1 }); } } - } await _db.Ado.CommitTranAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs index e8b7e20a..9ada5a0b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs @@ -26,7 +26,7 @@ namespace Tnb.WarehouseMgr /// 载具服务 /// [OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACEPDA_ID)] - public class WmsPDACarryReplaceService : BaseWareHouseService, IWmsCarryService + public class WmsPDACarryReplaceService : BaseWareHouseService, IWmsCarryService, IPdaStroage { //private const string ModuleId = "26188532491557"; private readonly ISqlSugarClient _db; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs index 30292a99..86dac091 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs @@ -30,11 +30,9 @@ namespace Tnb.WarehouseMgr /// /// 配送申请服务 /// - [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] - [Route("api/[area]/[controller]/[action]")] [OverideVisualDev(ModuleConsts.MODULE_WMSDELIVERYPDA_ID)] [ServiceModule(BizTypeId)] - public class WmsPDADeliveryService : IOverideVisualDevService, IWmsDeliveryService, IDynamicApiController, ITransient + public class WmsPDADeliveryService : BaseWareHouseService, IPdaStroage { private const string BizTypeId = "26125644258853"; private readonly ISqlSugarClient _db; @@ -148,10 +146,10 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks,null); + var isOk = await _wareHouseService.GenPreTask(preTasks, null); if (isOk) { - if(input.data.ContainsKey(nameof(WmsDelivery.startlocation_id)) && input.data.ContainsKey(nameof(WmsDelivery.endlocation_id)) && input.data[nameof(WmsDelivery.endlocation_id)] != null && input.data[nameof(WmsDelivery.endlocation_id)] != null) + if (input.data.ContainsKey(nameof(WmsDelivery.startlocation_id)) && input.data.ContainsKey(nameof(WmsDelivery.endlocation_id)) && input.data[nameof(WmsDelivery.endlocation_id)] != null && input.data[nameof(WmsDelivery.endlocation_id)] != null) { //查询库位表 var location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString()); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs index 195c4813..f457bce2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs @@ -32,9 +32,9 @@ namespace Tnb.WarehouseMgr [OverideVisualDev(ModuleConsts.MODULE_WMSEMPTYINSTKPDA_ID)] [ServiceModule(BizTypeId)] - public class WmsPDAEmptyInstockService : BaseWareHouseService + public class WmsPDAEmptyInstockService : BaseWareHouseService, IPdaStroage { - private const string BizTypeId = "pda26121986416677"; + private const string BizTypeId = "26121986416677"; private readonly ISqlSugarClient _db; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs index f6086b8d..164fb05c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs @@ -32,9 +32,9 @@ namespace Tnb.WarehouseMgr [OverideVisualDev(ModuleConsts.MODULE_WMSEMPTYOUTSTKPDA_ID)] [ServiceModule(BizTypeId)] - public class WmsPDAEmptyOutstockService : BaseWareHouseService + public class WmsPDAEmptyOutstockService : BaseWareHouseService, IPdaStroage { - private const string BizTypeId = "pda26121986416677"; + private const string BizTypeId = "26121986416677"; private readonly ISqlSugarClient _db; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs index 28fb5180..bb3519c0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs @@ -30,7 +30,7 @@ namespace Tnb.WarehouseMgr /// 异常取消 /// [OverideVisualDev(ModuleConsts.MODULE_WMSEXCEPTIONCANCELPDA_ID)] - public class WmsPDAExceptionCancelService : BaseWareHouseService + public class WmsPDAExceptionCancelService : BaseWareHouseService, IPdaStroage { private readonly ISqlSugarClient _db; private readonly IRunService _runService; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs index 1bfe6b43..2fc1896c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs @@ -31,7 +31,7 @@ namespace Tnb.WarehouseMgr /// 异常取消 /// [OverideVisualDev(ModuleConsts.MODULE_WMSEXCPTIONCOMPLETEPDA_ID)] - public class WmsPDAExceptionCompleteService : BaseWareHouseService + public class WmsPDAExceptionCompleteService : BaseWareHouseService, IPdaStroage { private readonly ISqlSugarClient _db; private readonly IRunService _runService; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs index 0ce755de..6f528490 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs @@ -30,7 +30,7 @@ namespace Tnb.WarehouseMgr /// 异常取消 /// [OverideVisualDev(ModuleConsts.MODULE_WMSEXCPTIONREEXCUTEPDA_ID)] - public class WmsPDAExceptionReexcuteService : BaseWareHouseService + public class WmsPDAExceptionReexcuteService : BaseWareHouseService, IPdaStroage { private readonly ISqlSugarClient _db; private readonly IRunService _runService; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs index 73103c43..5220668d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs @@ -34,9 +34,9 @@ namespace Tnb.WarehouseMgr /// [OverideVisualDev(ModuleConsts.MODULE_WMSINSTOCKPDA_ID)] [ServiceModule(BizTypeId)] - public class WmsPDAInStockService : BaseWareHouseService + public class WmsPDAInStockService : BaseWareHouseService, IPdaStroage { - private const string BizTypeId = "pda26191496816421"; + private const string BizTypeId = "26191496816421"; private readonly ISqlSugarClient _db; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs index 6a4766df..d4e7769f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs @@ -32,7 +32,7 @@ namespace Tnb.WarehouseMgr /// [OverideVisualDev(ModuleConsts.MODULE_WMSTRANSFER_ID)] [ServiceModule(BizTypeId)] - public class WmsPDATransferService : BaseWareHouseService + public class WmsPDATransferService : BaseWareHouseService, IPdaStroage { private const string BizTypeId = "26585291847957"; private readonly ISqlSugarClient _db; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs index d9479ae2..3c806096 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs @@ -25,7 +25,7 @@ namespace Tnb.WarehouseMgr /// [OverideVisualDev(ModuleId)] - public class WmsRouteMgrService : BaseWareHouseService, IWmsRouteMgrService + public class WmsRouteMgrService : BaseWareHouseService, IWmsRouteMgrService,IPdaStroage { private const string ModuleId = "26100621140773"; private readonly ISqlSugarClient _db; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs index 844c41c6..0934c673 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs @@ -32,7 +32,7 @@ namespace Tnb.WarehouseMgr /// [OverideVisualDev(ModuleConsts.MODULE_WMSTRANSFERPDA_ID)] [ServiceModule(BizTypeId)] - public class WmsTransferService : BaseWareHouseService + public class WmsTransferService : BaseWareHouseService, IPdaStroage { private const string BizTypeId = "26585291847957"; private readonly ISqlSugarClient _db; @@ -113,7 +113,7 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks,null); + var isOk = await _wareHouseService.GenPreTask(preTasks, null); if (isOk) { //查询库位表 diff --git a/common/Tnb.Common.Core/Manager/User/IUserManager.cs b/common/Tnb.Common.Core/Manager/User/IUserManager.cs index 639ff2f8..c1804ac7 100644 --- a/common/Tnb.Common.Core/Manager/User/IUserManager.cs +++ b/common/Tnb.Common.Core/Manager/User/IUserManager.cs @@ -14,6 +14,10 @@ public interface IUserManager /// 用户编号. /// string UserId { get; } + /// + /// 登录类型 + /// + string LoginType { get; } /// /// 用户角色. diff --git a/common/Tnb.Common.Core/Manager/User/UserManager.cs b/common/Tnb.Common.Core/Manager/User/UserManager.cs index 53f1c0e2..d9c865ee 100644 --- a/common/Tnb.Common.Core/Manager/User/UserManager.cs +++ b/common/Tnb.Common.Core/Manager/User/UserManager.cs @@ -76,7 +76,7 @@ public class UserManager : IUserManager, IScoped public UserEntity User { get => _repository.GetSingle(u => u.Id == UserId); - + } /// @@ -154,6 +154,13 @@ public class UserManager : IUserManager, IScoped { get => _user.FindFirst(ClaimConst.CLAINMADMINISTRATOR)?.Value == ((int)AccountType.Administrator).ToString(); } + /// + /// 登录类型,区分Pc、Pda added by ly on 20230619 + /// + public string LoginType + { + get => _user.FindFirst(ClaimConst.LOGINTYPE)?.Value; + } /// /// 获取用户的数据范围. diff --git a/common/Tnb.Common/Const/ClaimConst.cs b/common/Tnb.Common/Const/ClaimConst.cs index da5ac70b..e4d72ef9 100644 --- a/common/Tnb.Common/Const/ClaimConst.cs +++ b/common/Tnb.Common/Const/ClaimConst.cs @@ -47,4 +47,8 @@ public class ClaimConst /// 单点登录标识. /// public const string OnlineTicket = "OnlineTicket"; + /// + /// 登录类型用于区分Pc或Pda端 + /// + public const string LOGINTYPE = "LoginType"; } \ No newline at end of file diff --git a/system/Tnb.OAuth/Dto/LoginInput.cs b/system/Tnb.OAuth/Dto/LoginInput.cs index 45c3dcea..2ba45843 100644 --- a/system/Tnb.OAuth/Dto/LoginInput.cs +++ b/system/Tnb.OAuth/Dto/LoginInput.cs @@ -58,4 +58,8 @@ public class LoginInput /// 单点登录票据. /// public string online_ticket { get; set; } + /// + /// 登录类型用于区分Pc Pda + /// + public string login_type { get; set; } } \ No newline at end of file diff --git a/system/Tnb.OAuth/OAuthService.cs b/system/Tnb.OAuth/OAuthService.cs index 6768be09..29b31528 100644 --- a/system/Tnb.OAuth/OAuthService.cs +++ b/system/Tnb.OAuth/OAuthService.cs @@ -279,8 +279,7 @@ public class OAuthService : IDynamicApiController, ITransient public async Task GetCurrentUser(string type) { if (type.IsNullOrEmpty()) type = "Web"; // 默认为Web端菜单目录 - //modify by ly on 20230616 用于区分pc与 pda - _userManager.User.LoginType = "fadsfadsfadsfasd"; + var userId = _userManager.UserId; @@ -596,7 +595,8 @@ public class OAuthService : IDynamicApiController, ITransient { ClaimConst.TENANTID, options.ConfigId }, { ClaimConst.CONNECTIONCONFIG, options}, { ClaimConst.SINGLELOGIN, (int)sysConfig.singleLogin }, - { ClaimConst.OnlineTicket, input.online_ticket } + { ClaimConst.OnlineTicket, input.online_ticket }, + { ClaimConst.LOGINTYPE,input.login_type} }, tokenTimeout); // 单点登录标识缓存