diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotBaseSaveOutput.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotBaseSaveOutput.cs index 3d072175..762100a3 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotBaseSaveOutput.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotBaseSaveOutput.cs @@ -351,6 +351,12 @@ namespace DS.WMS.Core.Op.Dtos /// 更新时间 /// public DateTime UpdateTime { get; set; } + + /// + /// 标签列表 + /// + public List LabelList { get; set; } + } /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs index b41a6eba..af9147df 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs @@ -109,6 +109,13 @@ namespace DS.WMS.Core.Op.Method //船公司基础映射模块 const string CONST_MAPPING_CARRIER_MODULE = "CarrierBaseMapping"; + /* + * 是否启用委托单位权限显示控制 + 开启此参数后,在部分接口查询数据时会根据当前登陆人的权限范围来决定返回哪些委托单位, + 如委托单位管理台账查询接口、委托单位下拉查询接口、舱位管理台账查询接口、舱位管理详情查询接口等 + */ + const string IS_ENABLE_CUSTOMER_AUTHORITY = "IS_ENABLE_CUSTOMER_AUTHORITY"; + public BookingSlotService(IServiceProvider serviceProvider) { @@ -3470,14 +3477,176 @@ namespace DS.WMS.Core.Op.Method var tenantDb = saasService.GetBizDbScopeById(user.TenantId); //序列化查询条件 var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(querySearch.QueryCondition); + + List ctnCodeArr = new List(); + List labelIdArray = new List(); + + if (whereList.Any(t => ((ConditionalModel)t).FieldName.Equals("ctnStat", StringComparison.OrdinalIgnoreCase))) + { + var codList = whereList.Where(t => ((ConditionalModel)t).FieldName.Equals("ctnStat", StringComparison.OrdinalIgnoreCase)).ToList(); + + ctnCodeArr = codList.Select(t => ((ConditionalModel)t).FieldValue).ToList(); + + codList.ForEach(t => + { + whereList.Remove(t); + }); + } + + if (whereList.Any(t => ((ConditionalModel)t).FieldName.Equals("labelIdArray", StringComparison.OrdinalIgnoreCase))) + { + var codList = whereList.Where(t => ((ConditionalModel)t).FieldName.Equals("labelIdArray", StringComparison.OrdinalIgnoreCase)).ToList(); + + labelIdArray = codList.Select(t => long.Parse(((ConditionalModel)t).FieldValue)).ToList(); + + codList.ForEach(t => + { + whereList.Remove(t); + }); + } + var result = tenantDb.Queryable() - .InnerJoin((a, b) => a.Id == b.SlotId) - .Select() - .Where(whereList); - //.ToQueryPageAsync(request.PageCondition); - var list = result.ToList(); + .LeftJoin((a, b) => a.Id == b.SlotId) + .Where(whereList) + .WhereIF(ctnCodeArr != null && ctnCodeArr.Count > 0, (a, b) => b != null + && !string.IsNullOrWhiteSpace(b.CtnCode) + && ctnCodeArr.Contains(b.CtnCode) && b.Deleted == false) + .WhereIF(labelIdArray != null && labelIdArray.Count > 0, + a => SqlFunc.Subqueryable() + .Where(x => x.BusinessId == a.Id && labelIdArray.Contains(x.LabelId)) + .Any()) + .Select(); + var data = await result.ToQueryPageAsync(querySearch.PageCondition); + var slotIds = data.Data.Select(x => x.Id); + if (slotIds.Any()) + { + // 查询舱位绑定的销售信息,赋值到舱位对象中 + List allocationInfoList = await tenantDb.Queryable() + .Where(x => slotIds.Contains(x.BookingSlotId)) + .Select(x => new BookingSlotSaleInfoDto + { + Id = x.Id, + BookingId = x.BookingId, + BookingSlotId = x.BookingSlotId, + CustomerId = x.CustomerId, + CustomerName = x.CustomerName, + CustServiceId = x.CustServiceId, + CustService = x.CustService, + SaleId = x.SaleId, + Sale = x.Sale, + OpId = x.OpId, + Op = x.Op, + DocId = x.DocId, + Doc = x.Doc, + Business = x.Business, + BusinessId = x.BusinessId, + SaleTime = x.SaleTime, + Shipper = x.Shipper, + GoodsName = x.GoodsName, + SellingPrice = x.SellingPrice, + CreateBy = x.CreateBy + }).ToListAsync(); + + if (allocationInfoList.Any()) + { + var paramConfig = _configService.GetConfig(IS_ENABLE_CUSTOMER_AUTHORITY, long.Parse(user.TenantId), false).GetAwaiter().GetResult()?.Data?.Value; + + // 判断是否启用了委托单位查看控制权限 + bool isEnableCustomerAuthority = false; + + if(paramConfig.Equals("ENABLE",StringComparison.OrdinalIgnoreCase)) + { + isEnableCustomerAuthority = true; + } + + List userList = null; + List userListStr = null; + //if (isEnableCustomerAuthority) + //{ + // userList = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuDjyCustomer); + // if (userList == null || userList.Count == 0) + // { + // isEnableCustomerAuthority = false; + // } + // else + // { + // userListStr = userList.Select(x => x.ToString()).ToList(); + // } + //} + var saleInfoGroup = allocationInfoList.GroupBy(x => x.BookingSlotId); + foreach (var item in saleInfoGroup) + { + if (isEnableCustomerAuthority) + { + // 遍历销售信息,如果销售信息中的“销售、操作、单证、客服、创建人”中不在当前登陆人的权限范围,则隐藏客户信息 + foreach (BookingSlotSaleInfoDto saleInfoItem in item) + { + if (!userList.Contains(saleInfoItem.CreateBy) + && !userListStr.Contains(saleInfoItem.OpId) + && !userListStr.Contains(saleInfoItem.DocId) + && !userListStr.Contains(saleInfoItem.SaleId) + && !userListStr.Contains(saleInfoItem.CustServiceId)) + { + saleInfoItem.CustomerId = 0; + saleInfoItem.CustomerName = "--"; + saleInfoItem.OpId = ""; + saleInfoItem.Op = "--"; + saleInfoItem.DocId = ""; + saleInfoItem.Doc = "--"; + saleInfoItem.SaleId = ""; + saleInfoItem.Sale = "--"; + saleInfoItem.Shipper = "--"; + saleInfoItem.GoodsName = "--"; + saleInfoItem.CustServiceId = ""; + saleInfoItem.CustService = "--"; + } + } + } + + var slot = data.Data.FirstOrDefault(x => x.Id == item.Key); + if (slot != null) + { + slot.BookingSlotSaleInfoList = item.ToList(); + } + } + } + + // 查询舱位绑定的标签信息,赋值到舱位对象中 + var labelCacheList = await _bookingLabelService.List(1); + var labelAllocationList = await tenantDb.Queryable() + .Where(x => slotIds.Contains(x.BusinessId)) + .ToListAsync(); + if (labelAllocationList.Any()) + { + var labelInfoGroup = labelAllocationList.GroupBy(x => x.BusinessId); + foreach (var item in labelInfoGroup) + { + var slot = data.Data.FirstOrDefault(x => x.Id == item.Key); + if (slot != null) + { + slot.LabelList = item.Select(x => + { + var labelCache = labelCacheList.Data.FirstOrDefault(l => l.Id == x.LabelId); + if (labelCache != null) + { + return new BookingLabelBaseDto + { + Id = x.LabelId, + Name = labelCache.Name, + Color = labelCache.Color, + Scope = labelCache.Scope + }; + } + return null; + }).ToList(); + slot.LabelList.RemoveAll(x => x == null); + } + } + } + } + return data; } diff --git a/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile.pubxml.user b/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile.pubxml.user index c2b160b0..32aadbb0 100644 --- a/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -6,7 +6,7 @@ <_PublishTargetUrl>D:\Code\PublishCopy\ds8-mainapi - True|2024-07-24T01:32:35.6165520Z||;True|2024-07-19T12:03:03.1399057+08:00||;True|2024-07-19T11:47:36.2698405+08:00||;True|2024-07-18T15:59:36.7010783+08:00||;True|2024-07-16T18:17:43.9220347+08:00||;True|2024-06-18T17:36:34.9035076+08:00||;True|2024-06-18T16:25:54.2461596+08:00||;True|2024-06-18T10:09:37.3872162+08:00||;True|2024-06-18T10:00:43.4402179+08:00||;True|2024-06-18T08:55:07.3014083+08:00||;True|2024-06-18T08:40:51.6182342+08:00||;True|2024-06-13T19:48:34.0429148+08:00||;True|2024-06-13T19:09:39.6804400+08:00||;True|2024-06-13T15:41:56.9502735+08:00||;True|2024-06-13T15:23:59.4555910+08:00||;True|2024-06-13T15:12:55.6093356+08:00||;True|2024-06-11T17:08:01.8930314+08:00||;True|2024-06-07T15:23:11.1389680+08:00||;True|2024-06-07T10:23:59.6079620+08:00||;True|2024-06-06T17:42:56.1843783+08:00||;True|2024-06-04T14:20:46.7742295+08:00||;True|2024-05-31T17:57:35.6858600+08:00||;True|2024-05-31T15:25:20.8503086+08:00||;True|2024-05-30T17:22:52.2563382+08:00||;True|2024-05-30T17:05:35.7504154+08:00||;True|2024-05-29T17:17:39.6966826+08:00||; + True|2024-07-24T01:40:52.9333341Z||;True|2024-07-24T09:32:35.6165520+08:00||;True|2024-07-19T12:03:03.1399057+08:00||;True|2024-07-19T11:47:36.2698405+08:00||;True|2024-07-18T15:59:36.7010783+08:00||;True|2024-07-16T18:17:43.9220347+08:00||;True|2024-06-18T17:36:34.9035076+08:00||;True|2024-06-18T16:25:54.2461596+08:00||;True|2024-06-18T10:09:37.3872162+08:00||;True|2024-06-18T10:00:43.4402179+08:00||;True|2024-06-18T08:55:07.3014083+08:00||;True|2024-06-18T08:40:51.6182342+08:00||;True|2024-06-13T19:48:34.0429148+08:00||;True|2024-06-13T19:09:39.6804400+08:00||;True|2024-06-13T15:41:56.9502735+08:00||;True|2024-06-13T15:23:59.4555910+08:00||;True|2024-06-13T15:12:55.6093356+08:00||;True|2024-06-11T17:08:01.8930314+08:00||;True|2024-06-07T15:23:11.1389680+08:00||;True|2024-06-07T10:23:59.6079620+08:00||;True|2024-06-06T17:42:56.1843783+08:00||;True|2024-06-04T14:20:46.7742295+08:00||;True|2024-05-31T17:57:35.6858600+08:00||;True|2024-05-31T15:25:20.8503086+08:00||;True|2024-05-30T17:22:52.2563382+08:00||;True|2024-05-30T17:05:35.7504154+08:00||;True|2024-05-29T17:17:39.6966826+08:00||; \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.OpApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.OpApi/Logs/internal-nlog.txt index 8cfac7ae..5b386a42 100644 --- a/ds-wms-service/DS.WMS.OpApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.OpApi/Logs/internal-nlog.txt @@ -705,3 +705,52 @@ 2024-07-22 18:36:53.5029 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config 2024-07-22 18:36:53.5029 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-07-22 18:36:53.5029 Info Configuration initialized. +2024-07-24 10:39:33.3284 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-24 10:39:33.3499 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-24 10:39:33.3562 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-24 10:39:33.3735 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-24 10:39:33.3842 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-07-24 10:39:33.3842 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-24 10:39:33.4009 Info Configuration initialized. +2024-07-24 11:42:53.2416 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-24 11:42:53.2594 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-24 11:42:53.2594 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-24 11:42:53.2853 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-24 11:42:53.2981 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-07-24 11:42:53.3046 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-24 11:42:53.3046 Info Configuration initialized. +2024-07-24 11:53:04.9564 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-24 11:53:04.9683 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-24 11:53:04.9683 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-24 11:53:04.9813 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-24 11:53:04.9813 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-07-24 11:53:04.9813 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-24 11:53:04.9940 Info Configuration initialized. +2024-07-24 11:56:48.6539 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-24 11:56:48.6666 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-24 11:56:48.6666 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-24 11:56:48.6812 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-24 11:56:48.6812 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-07-24 11:56:48.6812 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-24 11:56:48.6977 Info Configuration initialized. +2024-07-24 12:13:15.7940 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-24 12:13:15.8109 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-24 12:13:15.8109 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-24 12:13:15.8289 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-24 12:13:15.8361 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-07-24 12:13:15.8361 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-24 12:13:15.8361 Info Configuration initialized. +2024-07-24 12:46:02.1315 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-24 12:46:02.1542 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-24 12:46:02.1542 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-24 12:46:02.1817 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-24 12:46:02.1817 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-07-24 12:46:02.1970 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-24 12:46:02.1970 Info Configuration initialized. +2024-07-24 12:55:07.1127 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-24 12:55:07.1250 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-24 12:55:07.1250 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-24 12:55:07.1385 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-24 12:55:07.1385 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-07-24 12:55:07.1473 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-24 12:55:07.1473 Info Configuration initialized.