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/WmsBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsBindService.cs new file mode 100644 index 00000000..b01e963b --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsBindService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr +{ + internal class WmsBindService + { + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs index a30a0206..69ae0583 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs @@ -65,8 +65,8 @@ namespace Tnb.WarehouseMgr if (input == null) throw new ArgumentNullException(nameof(input)); var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; var subCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : ""; - var carry = await _db.Queryable().FirstAsync(it => it.id == carryId); - var subCarry = await _db.Queryable().FirstAsync(it => it.id == subCarryId); + var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); + var subCarry = await _db.Queryable().SingleAsync(it => it.id == subCarryId); WmsCarrybindH wmsCarrybindH = carry.Adapt(); if (carry != null && subCarry != null) { @@ -83,9 +83,28 @@ namespace Tnb.WarehouseMgr row = await _db.Updateable(carry).ExecuteCommandAsync(); subCarry.carry_status = "1"; row = await _db.Updateable(subCarry).ExecuteCommandAsync(); + var items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); + for (int i = 0; i < items.Count; i++) + { + WmsCarrybindCode wmsCarrybindCode = new(); + wmsCarrybindCode.id = SnowflakeIdHelper.NextId(); + wmsCarrybindCode.org_id = subCarry.id; + wmsCarrybindCode.carrybind_id = wmsCarrybindH.id; + wmsCarrybindCode.material_id = items[i].material_id; + wmsCarrybindCode.material_code = items[i].material_code; + wmsCarrybindCode.barcode = items[i].barcode; + wmsCarrybindCode.code_batch = items[i].code_batch; + wmsCarrybindCode.codeqty = items[i].codeqty; + wmsCarrybindCode.membercarry_id = subCarry.id; + wmsCarrybindCode.membercarry_code = subCarry.carry_code; + wmsCarrybindCode.unit_id = items[i].unit_id; + wmsCarrybindCode.unit_code = items[i].unit_code; + wmsCarrybindCode.create_id = _userManager.UserId; + wmsCarrybindCode.create_time = DateTime.Now; + row = await _db.Insertable(wmsCarrybindCode).ExecuteCommandAsync(); + } isOk = (row > 0); if (!isOk) throw Oops.Oh(ErrorCode.COM1001); - } else { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs index 4def37fe..1f742be8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs @@ -148,7 +148,7 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsMoveOutstock { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + var isOk = await _db.Updateable().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); if (!isOk) throw Oops.Oh(ErrorCode.COM1001); } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs index a36a1dd7..94c43365 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs @@ -182,7 +182,7 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsDelivery { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + var isOk = await _db.Updateable().SetColumns(it => new WmsDelivery { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); if (!isOk) throw Oops.Oh(ErrorCode.COM1001); } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs index 883caf0e..8f2eca3b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs @@ -15,6 +15,7 @@ using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; using Microsoft.AspNetCore.Mvc; +using Spire.Doc.Formatting; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -104,6 +105,7 @@ namespace Tnb.WarehouseMgr 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_WMSEMPTYINSTOCK_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; @@ -160,10 +162,10 @@ namespace Tnb.WarehouseMgr return Task.FromResult(true); } - public async Task ModifyAsync(WareHouseUpInput input) + public async override Task ModifyAsync(WareHouseUpInput input) { if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsEmptyInstock { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + var isOk = await _db.Updateable().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); if (!isOk) throw Oops.Oh(ErrorCode.COM1001); } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs index e8fd09c8..21ac9ced 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs @@ -87,7 +87,7 @@ namespace Tnb.WarehouseMgr ePoint = await _db.Queryable().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString()); } int i = 0; - var isOk = false; + //根据每个载具的起始库位做路径运算 for (i = 0; i < setQty.qty; i++) @@ -95,7 +95,7 @@ namespace Tnb.WarehouseMgr if (carrys?.Count > 0) sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carrys[i].location_id); - + var isOk = false; if (sPoint != null && ePoint != null) { var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); @@ -157,19 +157,6 @@ namespace Tnb.WarehouseMgr await _db.Insertable(wmsEmptyOutstockD) .ExecuteCommandAsync(); - WmsHandleH handleH = new(); - handleH.org_id = _userManager.User.OrganizeId; - handleH.startlocation_id = carrys?[i].location_id!; - handleH.endlocation_id = ePoint.location_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 WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); @@ -191,7 +178,7 @@ namespace Tnb.WarehouseMgr return Task.FromResult(true); } - public async Task ModifyAsync(WareHouseUpInput input) + public async override Task ModifyAsync(WareHouseUpInput input) { if (input == null) throw new ArgumentNullException(nameof(input)); var isOk = await _db.Updateable().SetColumns(it => new WmsEmptyInstock { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index 4b3db4c6..478c3f0d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -106,7 +106,7 @@ namespace Tnb.WarehouseMgr /// /// [HttpPost] - public async Task SacnBarCodeInStock() + public async Task SacnBarCodeInStock() { } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index 9cc3b3c3..0e7bfa06 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -3,7 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using JNPF.Common.Dtos.VisualDev; using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.WarehouseMgr.Entities; @@ -15,6 +17,7 @@ namespace Tnb.WarehouseMgr /// /// 出库申请业务类 /// + [OverideVisualDev(ModuleConsts.MODULE_WMSOUTSTOCK_ID)] public class WmsOutStockService : BaseWareHouseService, IWmsOutStockService { private readonly ISqlSugarClient _db; @@ -23,6 +26,13 @@ namespace Tnb.WarehouseMgr { _db = repository.AsSugarClient(); _dictionaryDataService = dictionaryDataService; + OverideFuncs.CreateAsync = OutStockApplyFor; + } + + + private async Task OutStockApplyFor(VisualDevModelDataCrInput input) + { + return Task.FromResult(0); } /// 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..0c34399a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs @@ -21,6 +21,7 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -29,12 +30,11 @@ namespace Tnb.WarehouseMgr /// /// 空载具出库 /// - [OverideVisualDev(ModuleConsts.MODULE_WMSEMPTYOUTSTKPDA_ID)] - [ServiceModule(BizTypeId)] + [OverideVisualDev(ModuleConsts.MODULE_WMSEMPTYOUTSTK_ID)] - 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; @@ -65,11 +65,7 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - - - - - VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSEMPTYOUTSTKPDA_ID, true); + VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSEMPTYOUTSTK_ID, true); await _runService.Create(templateEntity, input); /*//入库取终点 @@ -77,33 +73,27 @@ namespace Tnb.WarehouseMgr var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);*/ //出库取起点,获取所有符合输入的载具规格的载具 - var setQty = await _db.Queryable().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)]); + var setQty = await _db.Queryable().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString()); var carrys = await _db.Queryable().LeftJoin((a, b) => a.location_id == b.id) - .Select((a,b) => new - { - carry_id = a.id, - carrystd_id = a.id, - location_id = b.id, - carry_status = a.carry_status, - c_is_lock = a.is_lock, - l_is_lock = b.is_lock, - l_is_use = b.is_use, - l_is_type = b.is_type - }) - .Where(it => it.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString() - && it.carry_status == "0"&& it.c_is_lock == 0 && it.l_is_lock == 0 && it.l_is_use == "0" && it.l_is_type == "0") + .Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString() + && a.carry_status == "0" && a.is_lock == 0 && b.is_lock == 0) .ToListAsync(); - + WmsPointH sPoint = null; WmsPointH ePoint = null; if (input.data.ContainsKey(nameof(WmsPointH.location_id))) { ePoint = await _db.Queryable().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString()); } + int i = 0; + var isOk = false; + //根据每个载具的起始库位做路径运算 - for(int i =0; i< setQty.qty ;i++) + for (i = 0; i < setQty.qty; i++) { - sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carrys[i].location_id); + + if (carrys?.Count > 0) + sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carrys[i].location_id); if (sPoint != null && ePoint != null) { @@ -119,18 +109,19 @@ namespace Tnb.WarehouseMgr 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.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.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSEMPTYINSTOCK_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.biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID; + preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID; + preTask.carry_id = carrys![i].id; + preTask.carry_code = carrys![i].carry_code; + 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()!; @@ -138,20 +129,55 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks,null); - if (isOk) - { - //所有载具加锁 - var ids = carrys.Select(x => x.carry_id).ToList(); - await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); - //所有库位加锁 - var loc = carrys.Select(x => x.location_id).ToList(); - await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => loc.Contains(it.id)).ExecuteCommandAsync(); + //更新页面 + isOk = await _wareHouseService.GenPreTask(preTasks, null); + } + if (isOk) + { + var preTaskUpInput = new GenPreTaskUpInput(); + preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString(); + preTaskUpInput.CarryId = carrys![i].id; + preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id; + preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code; + preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList(); - } + //更新明细表 + WmsEmptyOutstockD wmsEmptyOutstockD = new(); + wmsEmptyOutstockD.id = SnowflakeIdHelper.NextId(); + wmsEmptyOutstockD.bill_id = input.data[nameof(WmsEmptyOutstockH.bill_code)]?.ToString()!; + wmsEmptyOutstockD.biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID; + wmsEmptyOutstockD.location_id = ePoint.location_id; + wmsEmptyOutstockD.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID; + wmsEmptyOutstockD.carry_id = carrys[i].id; + wmsEmptyOutstockD.carry_code = carrys[i].carry_code; + wmsEmptyOutstockD.create_id = _userManager.UserId; + wmsEmptyOutstockD.create_time = DateTime.Now; + await _db.Insertable(wmsEmptyOutstockD) + .ExecuteCommandAsync(); + + WmsHandleH handleH = new(); + handleH.org_id = _userManager.User.OrganizeId; + handleH.startlocation_id = carrys?[i].location_id!; + handleH.endlocation_id = ePoint.location_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 WmsEmptyOutstockH { 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(); 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); // 单点登录标识缓存