diff --git a/ds-wms-service/DS.Module.Core/Condition/ConditionHelper.cs b/ds-wms-service/DS.Module.Core/Condition/ConditionHelper.cs index 7e51376f..82fcf105 100644 --- a/ds-wms-service/DS.Module.Core/Condition/ConditionHelper.cs +++ b/ds-wms-service/DS.Module.Core/Condition/ConditionHelper.cs @@ -140,6 +140,21 @@ namespace DS.Module.Core.Condition return thisScopeResult == true; } + /// + /// 获取指定条件的条件数量 + /// + /// + /// + public static int GetConditionCount(ConditionContent condition) + { + int n = condition.Conditions?.Count ?? 0; + if (condition.Groups != null && condition.Groups.Count > 0) + { + n += condition.Groups.Sum(x => GetConditionCount(x)); + } + return n; + } + /// /// 深度获取对象属性值 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingCtnReq.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingCtnReq.cs index 762c9e7c..0ce8fbd8 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingCtnReq.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingCtnReq.cs @@ -46,8 +46,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long CarrierId { get; set; } - + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingCtnRes.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingCtnRes.cs index 71d911bd..a6986373 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingCtnRes.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingCtnRes.cs @@ -53,8 +53,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long CarrierId { get; set; } - + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingFrtReq.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingFrtReq.cs index c8a48baf..2cf0c114 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingFrtReq.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingFrtReq.cs @@ -47,7 +47,10 @@ namespace DS.WMS.Core.Map.Dtos /// 船司Id /// public long CarrierId { get; set; } - + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingFrtRes.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingFrtRes.cs index 4805a05f..6ccc7e18 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingFrtRes.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingFrtRes.cs @@ -54,6 +54,10 @@ namespace DS.WMS.Core.Map.Dtos /// 船司Id /// public long CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingIssueTypeReq.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingIssueTypeReq.cs index e1afbf3c..31189ded 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingIssueTypeReq.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingIssueTypeReq.cs @@ -46,7 +46,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long CarrierId { get; set; } + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingIssueTypeRes.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingIssueTypeRes.cs index a94359db..c6550be6 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingIssueTypeRes.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingIssueTypeRes.cs @@ -49,7 +49,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long CarrierId { get; set; } + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPackageReq.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPackageReq.cs index 402d7a4b..f4203af9 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPackageReq.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPackageReq.cs @@ -46,7 +46,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long CarrierId { get; set; } + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPackageRes.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPackageRes.cs index abaf5dd0..2814667e 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPackageRes.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPackageRes.cs @@ -47,13 +47,13 @@ namespace DS.WMS.Core.Map.Dtos /// public string PackageName { get; set; } /// - /// 船公司名称 + /// 船司Id /// - public string CarrierName { get; set; } + public long? CarrierId { get; set; } /// - /// 船司Id + /// 船司名称 /// - public long CarrierId { get; set; } + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPortReq.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPortReq.cs index 6407678d..4152f307 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPortReq.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPortReq.cs @@ -46,7 +46,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long CarrierId { get; set; } + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPortRes.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPortRes.cs index 37957bee..70dd0cac 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPortRes.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingPortRes.cs @@ -53,7 +53,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long CarrierId { get; set; } + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingServiceReq.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingServiceReq.cs index b114d9a5..5dfaa855 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingServiceReq.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingServiceReq.cs @@ -46,7 +46,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long CarrierId { get; set; } + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingServiceRes.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingServiceRes.cs index 2dd6fabc..25ca7d88 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingServiceRes.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingServiceRes.cs @@ -53,7 +53,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long CarrierId { get; set; } + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingYardReq.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingYardReq.cs index 03f13eb2..97a66fdd 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingYardReq.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingYardReq.cs @@ -46,7 +46,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long CarrierId { get; set; } + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingYardRes.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingYardRes.cs index 0cccaf8f..fd988fe3 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingYardRes.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/MappingYardRes.cs @@ -55,7 +55,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long CarrierId { get; set; } + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 状态 0 启用 1 禁用 diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/RelationLaneAndPortReq.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/RelationLaneAndPortReq.cs index a1a1aac3..330a43cd 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/RelationLaneAndPortReq.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/RelationLaneAndPortReq.cs @@ -34,7 +34,11 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司Id /// - public long? CarrierId { get; set; } + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + public string Carrier { get; set; } /// /// 船司代码 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Dtos/RelationLaneAndPortRes.cs b/ds-wms-service/DS.WMS.Core/Map/Dtos/RelationLaneAndPortRes.cs index 8319eee3..496b39fd 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Dtos/RelationLaneAndPortRes.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Dtos/RelationLaneAndPortRes.cs @@ -45,7 +45,7 @@ namespace DS.WMS.Core.Map.Dtos /// /// 船司名称 /// - public string CarrierName { get; set; } + public string Carrier { get; set; } /// /// 港口Id /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingCtn.cs b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingCtn.cs index 6c7d7198..142bb30c 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingCtn.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingCtn.cs @@ -46,7 +46,13 @@ namespace DS.WMS.Core.Map.Entity /// 船司Id /// [SugarColumn(ColumnDescription = "船司Id", IsNullable = true,DefaultValue ="0")] - public long CarrierId { get; set; } + public long? CarrierId { get; set; } + + /// + /// 船司名称 + /// + [SugarColumn(ColumnDescription = "船司名称", Length = 100, IsNullable = true)] + public string Carrier { get; set; } /// /// 状态 0启用 1禁用 diff --git a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingFrt.cs b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingFrt.cs index ff4aad8f..2e08c3a9 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingFrt.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingFrt.cs @@ -46,8 +46,12 @@ namespace DS.WMS.Core.Map.Entity /// 船司Id /// [SugarColumn(ColumnDescription = "船司Id", IsNullable = true,DefaultValue ="0")] - public long CarrierId { get; set; } - + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + [SugarColumn(ColumnDescription = "船司名称", Length = 100, IsNullable = true)] + public string Carrier { get; set; } /// /// 状态 0启用 1禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingIssueType.cs b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingIssueType.cs index 39c856e0..436c61e9 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingIssueType.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingIssueType.cs @@ -46,7 +46,12 @@ namespace DS.WMS.Core.Map.Entity /// 船司Id /// [SugarColumn(ColumnDescription = "船司Id", IsNullable = true, DefaultValue = "0")] - public long CarrierId { get; set; } + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + [SugarColumn(ColumnDescription = "船司名称", Length = 100, IsNullable = true)] + public string Carrier { get; set; } /// /// 状态 0启用 1禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingPackage.cs b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingPackage.cs index 0884689e..1b0f54ea 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingPackage.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingPackage.cs @@ -47,7 +47,11 @@ namespace DS.WMS.Core.Map.Entity /// [SugarColumn(ColumnDescription = "船司Id", IsNullable = true, DefaultValue = "0")] public long? CarrierId { get; set; } - + /// + /// 船司名称 + /// + [SugarColumn(ColumnDescription = "船司名称", Length = 100, IsNullable = true)] + public string Carrier { get; set; } /// /// 状态 0启用 1禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingPort.cs b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingPort.cs index a2a477c1..be2c4521 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingPort.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingPort.cs @@ -46,8 +46,12 @@ namespace DS.WMS.Core.Map.Entity /// 船司Id /// [SugarColumn(ColumnDescription = "船司Id", IsNullable = true, DefaultValue = "0")] - public long CarrierId { get; set; } - + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + [SugarColumn(ColumnDescription = "船司名称", Length = 100, IsNullable = true)] + public string Carrier { get; set; } /// /// 状态 0启用 1禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingService.cs b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingService.cs index 8f1f72cc..6e0963a7 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingService.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingService.cs @@ -46,8 +46,12 @@ namespace DS.WMS.Core.Map.Entity /// 船司Id /// [SugarColumn(ColumnDescription = "船司Id", IsNullable = true, DefaultValue = "0")] - public long CarrierId { get; set; } - + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + [SugarColumn(ColumnDescription = "船司名称", Length = 100, IsNullable = true)] + public string Carrier { get; set; } /// /// 状态 0启用 1禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingYard.cs b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingYard.cs index e1ed6843..3c5066d6 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Entity/MappingYard.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Entity/MappingYard.cs @@ -48,8 +48,12 @@ namespace DS.WMS.Core.Map.Entity /// 船司Id /// [SugarColumn(ColumnDescription = "船司Id", IsNullable = true,DefaultValue ="0")] - public long CarrierId { get; set; } - + public long? CarrierId { get; set; } + /// + /// 船司名称 + /// + [SugarColumn(ColumnDescription = "船司名称", Length = 100, IsNullable = true)] + public string Carrier { get; set; } /// /// 状态 0启用 1禁用 /// diff --git a/ds-wms-service/DS.WMS.Core/Map/Entity/RelationLaneAndPort.cs b/ds-wms-service/DS.WMS.Core/Map/Entity/RelationLaneAndPort.cs index 26802a1f..2396ed70 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Entity/RelationLaneAndPort.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Entity/RelationLaneAndPort.cs @@ -39,6 +39,11 @@ namespace DS.WMS.Core.Map.Entity [SugarColumn(ColumnDescription = "船司Id", IsNullable = true, DefaultValue = "0")] public long? CarrierId { get; set; } /// + /// 船司名称 + /// + [SugarColumn(ColumnDescription = "船司名称", Length = 100, IsNullable = true)] + public string Carrier { get; set; } + /// /// 船司代码 /// [SugarColumn(ColumnDescription = "船司代码", Length = 100, IsNullable = true)] diff --git a/ds-wms-service/DS.WMS.Core/Map/Method/MappingCtnService.cs b/ds-wms-service/DS.WMS.Core/Map/Method/MappingCtnService.cs index 1985fe5e..adf6febe 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Method/MappingCtnService.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Method/MappingCtnService.cs @@ -103,7 +103,6 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); it.CtnName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.CtnName).First(); } ).ToQueryPage(request.PageCondition); @@ -118,7 +117,6 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); it.CtnName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.CtnName).First(); } ) diff --git a/ds-wms-service/DS.WMS.Core/Map/Method/MappingFrtService.cs b/ds-wms-service/DS.WMS.Core/Map/Method/MappingFrtService.cs index 7dcc052e..e20d128f 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Method/MappingFrtService.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Method/MappingFrtService.cs @@ -103,8 +103,7 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); - it.FrtName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.FrtName).First(); + it.FrtName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.FrtName).First(); } ).ToQueryPage(request.PageCondition); return data; @@ -118,7 +117,6 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); it.FrtName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.FrtName).First(); } ) diff --git a/ds-wms-service/DS.WMS.Core/Map/Method/MappingPackageService.cs b/ds-wms-service/DS.WMS.Core/Map/Method/MappingPackageService.cs index 980916df..e5e307df 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Method/MappingPackageService.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Method/MappingPackageService.cs @@ -107,7 +107,6 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); it.PackageName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.PackageName).First(); } ).ToQueryPage(request.PageCondition); @@ -122,7 +121,6 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); it.PackageName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.PackageName).First(); } ) diff --git a/ds-wms-service/DS.WMS.Core/Map/Method/MappingPortService.cs b/ds-wms-service/DS.WMS.Core/Map/Method/MappingPortService.cs index 6b3b36ec..f971e14c 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Method/MappingPortService.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Method/MappingPortService.cs @@ -110,7 +110,6 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); it.PortName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.PortName).First(); } ).ToQueryPage(request.PageCondition); @@ -125,7 +124,6 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); it.PortName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.PortName).First(); } ) diff --git a/ds-wms-service/DS.WMS.Core/Map/Method/MappingServiceService.cs b/ds-wms-service/DS.WMS.Core/Map/Method/MappingServiceService.cs index 3cf578d2..d1bb3fbf 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Method/MappingServiceService.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Method/MappingServiceService.cs @@ -103,7 +103,6 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); it.ServiceName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.CnName).First(); } ).ToQueryPage(request.PageCondition); @@ -118,7 +117,6 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); it.ServiceName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.CnName).First(); } ) diff --git a/ds-wms-service/DS.WMS.Core/Map/Method/MappingYardService.cs b/ds-wms-service/DS.WMS.Core/Map/Method/MappingYardService.cs index eaca16bb..2f88020a 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Method/MappingYardService.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Method/MappingYardService.cs @@ -110,8 +110,7 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); - it.YardName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.ShortName).First(); + it.YardName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.ShortName).First(); } ).ToQueryPage(request.PageCondition); return data; @@ -125,7 +124,6 @@ namespace DS.WMS.Core.Map.Method .Select() .Mapper(it => { - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n=>n.ShortName).First(); it.YardName = tenantDb.Queryable().Where(x => x.Id == it.LinkId).Select(n => n.ShortName).First(); } ) diff --git a/ds-wms-service/DS.WMS.Core/Map/Method/RelationLaneAndPortService.cs b/ds-wms-service/DS.WMS.Core/Map/Method/RelationLaneAndPortService.cs index e4a625e4..16799893 100644 --- a/ds-wms-service/DS.WMS.Core/Map/Method/RelationLaneAndPortService.cs +++ b/ds-wms-service/DS.WMS.Core/Map/Method/RelationLaneAndPortService.cs @@ -96,7 +96,7 @@ namespace DS.WMS.Core.Map.Method { it.LaneName = tenantDb.Queryable().Where(x => x.Id == it.LaneId).Select(n => n.LaneName).First(); it.PortName = tenantDb.Queryable().Where(x => x.Id == it.PortId).Select(n => n.CnName).First(); - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); + } ).ToQueryPage(request.PageCondition); return data; @@ -112,8 +112,7 @@ namespace DS.WMS.Core.Map.Method { it.LaneName = tenantDb.Queryable().Where(x => x.Id == it.LaneId).Select(n => n.LaneName).First(); it.PortName = tenantDb.Queryable().Where(x => x.Id == it.PortId).Select(n => n.CnName).First(); - it.CarrierName = tenantDb.Queryable().Where(x => x.Id == it.CarrierId).Select(n => n.ShortName).First(); - } + } ) .First(); return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs index bf734bf8..3c65acd8 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs @@ -848,6 +848,121 @@ public class CommonService : ICommonService #region 客户端通用 + + /// + /// 查询客户 用户拥有的菜单权限 + /// + /// + public async Task>> GetClientUserPermissions() + { + List list = new List(); + + var userId = long.Parse(user.UserId); + + var userInfo = await db.Queryable().Where(x => x.Id == userId).FirstAsync(); + + + var roleIds = await db.Queryable().Where(x => x.UserId == userId).Select(x => x.RoleId).ToListAsync(); + + var permissions = await db.Queryable().Where(x => roleIds.Contains(x.RoleId)) + .Select(x => x.PermissionId).Distinct().ToListAsync(); + + var perlist = await db.Queryable() + .Where(x => x.MenuType == 1 && x.IsHidden == false && permissions.Contains(x.PermissionId) && + (x.PermissionType == 1 || x.PermissionType == 0)) + .OrderBy(x => x.SortCode) + .Select(a => new RouteItem + { + Id = a.Id, + ParentId = a.PermissionId, + Path = a.Url, + Name = a.PermissionName, + EnName = a.PermissionEnName, + Component = a.Component, + Redirect = a.Redirect, + SortCode = a.SortCode, + Meta = new RouteMeta() + { + Title = a.Title, + Icon = a.Icon, + } + }) + .ToListAsync(); + + list.AddRange(perlist); + //去重 + list.Distinct(); + + //排序 + list = list.OrderBy(x => x.SortCode).ToList(); + + foreach (var item in list) + { + var childs = await db.Queryable().Where(x => + (x.MenuType == 1 || x.MenuType == 2) && x.ParentId == item.ParentId && x.IsHidden == false && + permissions.Contains(x.PermissionId) && + (x.PermissionType == 1 || x.PermissionType == 0) && + x.PermissionId != 1744968217220222976) //排除企业用户维护 + .OrderBy(x => x.SortCode) + .Select(a => new RouteItem + { + Id = a.Id, + ParentId = a.PermissionId, + Path = a.Url, + Name = a.PermissionName, + EnName = a.PermissionEnName, + Component = a.Component, + IsCache = a.IsCache, + Meta = new RouteMeta() + { + Title = a.Title, + Icon = a.Icon, + } + }).ToListAsync(); + + //去重 + childs.Distinct(); + //排序 + childs = childs.OrderBy(x => x.SortCode).ToList(); + + foreach (var child in childs) + { + var grandsons = await db.Queryable().Where(x => + x.MenuType == 2 && x.ParentId == child.ParentId && x.IsHidden == false && + permissions.Contains(x.PermissionId)) //获取第三层路由 + .OrderBy(x => x.SortCode) + .Select(a => new RouteItem + { + Id = a.Id, + ParentId = a.PermissionId, + Path = a.Url, + Name = a.PermissionName, + EnName = a.PermissionEnName, + Component = a.Component, + IsCache = a.IsCache, + Meta = new RouteMeta() + { + Title = a.Title, + Icon = a.Icon, + } + }).ToListAsync(); + if (grandsons.Count > 0) + { + //去重 + grandsons.Distinct(); + //排序 + grandsons = grandsons.OrderBy(x => x.SortCode).ToList(); + child.Children = grandsons; + } + + } + + item.Children = childs; + + } + // list = list.OrderBy(x => x.Id).ToList(); + return await Task.FromResult(DataResult>.Success("获取数据成功!", list)); + } /// /// 获取权限树列表-客户端 /// diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs index 46e57312..89482c76 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -2846,7 +2846,7 @@ namespace DS.WMS.Core.TaskPlat.Method ); TaskFlowRuner runer = new TaskFlowRuner(tenantDb, serviceProvider); - //var result1 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, null); // 首位 + var result1 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, null); // 首位 //var result2 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, 20001); // 正常 //var result3 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, 20002); // 分支判断 //var result4 = await runer.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, 20003); // 分支结尾判断 diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs index 6ff426f0..14aa8307 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs @@ -75,54 +75,42 @@ namespace DS.WMS.Core.TaskPlat .ToListAsync(); // 判断每项流程达成的条件数量 - Dictionary configMatchCount = allConfigList.ToDictionary(x => x.Id, x => 0); + Dictionary configMatchCount = new(allConditionList.Count); foreach (var configItem in allConfigList) { var conditionItem = allConditionList.FirstOrDefault(x => x.ConfigId == configItem.Id); - if (conditionItem != null && !string.IsNullOrEmpty(conditionItem.Content)) + if (conditionItem == null || string.IsNullOrEmpty(conditionItem.Content)) { - var contitionContent = JsonConvert.DeserializeObject(conditionItem.Content)!; - - var oldValue = configMatchCount[configItem.Id]; - if (ConditionHelper.IsPass(contitionContent, dataContext)) - { - configMatchCount[configItem.Id] = oldValue + 1; - } - else - { - configMatchCount[configItem.Id] = oldValue - 1; - } - - } - } - - // 取出最匹配的流程 - KeyValuePair? bestMatched = null!; - foreach (var item in configMatchCount) - { - if (bestMatched == null) - { - bestMatched = new KeyValuePair(item.Key, item.Value); + configMatchCount.Add(configItem.Id, 0); continue; } - - if (item.Value > bestMatched.Value.Value) + else { - bestMatched = new KeyValuePair(item.Key, item.Value); - continue; - } + var conditionContent = JsonConvert.DeserializeObject(conditionItem.Content)!; - if (item.Value == bestMatched.Value.Value) - { - // 如果达成的条件数量相等,则取最早的流程 - if (item.Key < bestMatched.Value.Key) + if (ConditionHelper.IsPass(conditionContent, dataContext)) { - bestMatched = new KeyValuePair(item.Key, item.Value); - continue; + var conditionCount = ConditionHelper.GetConditionCount(conditionContent); + configMatchCount.Add(configItem.Id, conditionCount); } } } - var targetConfig = allConfigList.First(x => x.Id == bestMatched.Value.Key); + // 取出最匹配的流程 + TaskFlowConfig? targetConfig = null; + if (configMatchCount.Count == 1) + { + targetConfig = allConfigList.First(x => x.Id == configMatchCount.First().Key); + } + else if (configMatchCount.Count > 1) + { + var maxMatchNum = configMatchCount.OrderByDescending(x => x.Value).First().Value; // 取匹配条件数最多的一条 + var temp = configMatchCount.Where(x => x.Value == maxMatchNum).OrderBy(x => x.Key).First().Key; + targetConfig = allConfigList.First(x => x.Id == temp); + } + if (targetConfig == null) + { + throw new Exception("targetConfig目标流程意外为null"); + } // 待执行的流程(节点列表) var configList = await tenantDb.Queryable().Where(x => x.MainConfigId == targetConfig.Id).ToListAsync(); @@ -169,31 +157,32 @@ namespace DS.WMS.Core.TaskPlat } // 对节点列表里面的节点进行依次判断,取出要执行的节点 - var matchedConfigList = new List<(TaskFlowConfig config, bool isHasCondition)>(); + Dictionary matchedConfigList = new(); foreach (var waitMatchConfigItem in waitMatchConfigList) { var condition = conditionList.FirstOrDefault(x => x.ConfigId == waitMatchConfigItem.Id); if (condition == null || string.IsNullOrEmpty(condition.Content)) { - matchedConfigList.Add((waitMatchConfigItem, false)); + matchedConfigList.Add(waitMatchConfigItem, 0); continue; } - var contitionContent = JsonConvert.DeserializeObject(condition.Content)!; - if (ConditionHelper.IsPass(contitionContent, dataContext)) + var conditionContent = JsonConvert.DeserializeObject(condition.Content)!; + if (ConditionHelper.IsPass(conditionContent, dataContext)) { - matchedConfigList.Add((waitMatchConfigItem, true)); + var conditionCount = ConditionHelper.GetConditionCount(conditionContent); + matchedConfigList.Add(waitMatchConfigItem, conditionCount); continue; } } if (matchedConfigList.Count == 1) { - executeConfig = matchedConfigList[0].config; + executeConfig = matchedConfigList.First().Key; } else if (matchedConfigList.Count > 1) { - var temp = matchedConfigList.OrderBy(x => x.config.Id).Where(x => x.isHasCondition).ToList(); - executeConfig = temp.FirstOrDefault().config; + var maxMatchNum = matchedConfigList.OrderByDescending(x => x.Value).First().Value; // 取匹配条件数最多的一条 + executeConfig = matchedConfigList.Where(x => x.Value == maxMatchNum).OrderBy(x => x.Key.Id).First().Key; } if (executeConfig == null) @@ -393,7 +382,7 @@ namespace DS.WMS.Core.TaskPlat /// 工作流流程类型 /// /// 当前执行的任务类型(如果为空,则返回首个任务类型) - /// (下一个任务类型,下一节点Id) + /// (下一个任务类型) public async Task GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum workFlowType, TaskFlowDataContext dataContext, TaskBaseTypeEnum? currentTaskType) { var allConfigList = await tenantDb.Queryable() @@ -432,20 +421,21 @@ namespace DS.WMS.Core.TaskPlat .Where(x => configIdList.Contains(x.ConfigId)) .ToListAsync(); - var matchedConfigList = new List(); + Dictionary matchedConfigList = new(); foreach (var item in waitMatchConfigList) { var condition = conditionList.FirstOrDefault(x => x.ConfigId == item.Id); if (condition == null || string.IsNullOrEmpty(condition.Content)) { - matchedConfigList.Add(item); + matchedConfigList.Add(item, 0); } else { - var contitionContent = JsonConvert.DeserializeObject(condition.Content)!; - if (ConditionHelper.IsPass(contitionContent, dataContext)) + var conditionContent = JsonConvert.DeserializeObject(condition.Content)!; + if (ConditionHelper.IsPass(conditionContent, dataContext)) { - matchedConfigList.Add(item); + var conditionCount = ConditionHelper.GetConditionCount(conditionContent); + matchedConfigList.Add(item, conditionCount); } } } @@ -453,11 +443,12 @@ namespace DS.WMS.Core.TaskPlat TaskFlowConfig? executeConfig = null; if (matchedConfigList.Count == 1) { - executeConfig = matchedConfigList[0]; + executeConfig = matchedConfigList.First().Key; } else if (matchedConfigList.Count > 1) { - executeConfig = matchedConfigList.FirstOrDefault(x => x.IsMoreMatchDefault); + var maxMatchNum = matchedConfigList.OrderByDescending(x => x.Value).First().Value; // 取匹配条件数最多的一条 + executeConfig = matchedConfigList.Where(x => x.Value == maxMatchNum).OrderBy(x => x.Key.Id).First().Key; } if (executeConfig == null) @@ -492,108 +483,6 @@ namespace DS.WMS.Core.TaskPlat return null; } - /// - /// 根据当前节点Id,获取工作流下一个任务类型 - /// - /// 工作流流程类型 - /// - /// 当前执行的配置Id(如果为空,则返回首个任务类型) - /// (下一个任务类型,下一节点Id) - public async Task<(TaskBaseTypeEnum taskType, long configId)?> GetWorkFlowNextConfig(TaskBaseTypeEnum workFlowType, TaskFlowDataContext dataContext, long? currentConfigId = null) - { - var allConfigList = await tenantDb.Queryable() - .Where(t => t.MainConfigId == SqlFunc.Subqueryable().Where(x => x.IsMain && x.TaskType == workFlowType.ToString()).Select(x => x.Id)) - .OrderBy(t => t.Id) - .ToListAsync(); - - if (allConfigList.Count == 0) return null; - - long configId; - if (currentConfigId == null) - { - configId = allConfigList.First(x => x.IsMain).Id; - } - else - { - configId = currentConfigId.Value; - } - - List waitMatchConfigList = new(); - for (int i = 0; i < allConfigList.Count; i++) - { - var currentConfig = allConfigList.FirstOrDefault(x => x.Id == configId); - if (currentConfig == null || string.IsNullOrEmpty(currentConfig.NextConfigId)) - return null; - - var nextIds = currentConfig.NextConfigId.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => Convert.ToInt64(x)); - waitMatchConfigList = allConfigList.Where(x => nextIds.Contains(x.Id)).ToList(); - - if (waitMatchConfigList.Count == 0) return null; // 如果走了这一步的return,说明配置有问题:配置了下一节点的id,但是却查不到 - - var configIdList = waitMatchConfigList.Select(x => x.Id); - var conditionList = await tenantDb.Queryable() - .Where(x => configIdList.Contains(x.ConfigId)) - .ToListAsync(); - - var matchedConfigList = new List(); - foreach (var item in waitMatchConfigList) - { - var condition = conditionList.FirstOrDefault(x => x.ConfigId == item.Id); - if (condition == null || string.IsNullOrEmpty(condition.Content)) - { - matchedConfigList.Add(item); - } - else - { - var contitionContent = JsonConvert.DeserializeObject(condition.Content)!; - if (ConditionHelper.IsPass(contitionContent, dataContext)) - { - matchedConfigList.Add(item); - } - } - } - - TaskFlowConfig? executeConfig = null; - if (matchedConfigList.Count == 1) - { - executeConfig = matchedConfigList[0]; - } - else if (matchedConfigList.Count > 1) - { - executeConfig = matchedConfigList.FirstOrDefault(x => x.IsMoreMatchDefault); - } - - if (executeConfig == null) - { - executeConfig = waitMatchConfigList.FirstOrDefault(x => x.IsUnMatchDefault); - } - - if (executeConfig == null) - { - // 如果最终还是没有匹配到,则需要判断情况 - // 如果待匹配的分支只有1个,则继续循环判断下一节点;否则如果待匹配的分支有多个,则无法判断下一节点 - if (waitMatchConfigList.Count == 1) - { - configId = waitMatchConfigList[0].Id; - continue; - } - else - { - return null; - } - } - else - { - var taskType = await tenantDb.Queryable().Where(x => x.Id == executeConfig.ExecuteModuleId && x.ModuleType == 2).Select(x => x.TaskType).FirstAsync(); - - if (taskType != null && Enum.TryParse(typeof(TaskBaseTypeEnum), taskType, out object? temp)) - { - return ((TaskBaseTypeEnum)temp, executeConfig.Id); - } - } - } - return null; - } static string WriteLog(string throwMsg, Exception ex) { return string.Format("【自定义错误】:{0} \r\n【异常类型】:{1} \r\n【异常信息】:{2} \r\n【堆栈调用】:{3}", new object[] diff --git a/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs b/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs index 7cad6c8a..46214d11 100644 --- a/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs +++ b/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs @@ -5,6 +5,7 @@ using DS.Module.SqlSugar; using DS.WMS.Core.Check.Entity; using DS.WMS.Core.Code.Entity; using DS.WMS.Core.Info.Entity; +using DS.WMS.Core.Map.Entity; using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity.BookingSlot; using DS.WMS.Core.Sys.Entity; @@ -54,15 +55,15 @@ public class SaasDBUpdateTest { var tenantList = db.Queryable().ToList(); var ass = Assembly.Load("DS.WMS.Core"); - //var types = ass.GetTypes().Where(it => it.FullName?.Contains("DS.WMS.Core.TaskPlat.Entity") == true).ToArray(); + var types = ass.GetTypes().Where(it => it.FullName?.Contains("DS.WMS.Core.Map.Entity") == true).ToArray(); foreach (var item in tenantList) { var tenantDb = saasService.GetBizDbScopeById(item.TenantId).CopyNew(); StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci"; //较高版本支持 //tenantDb.CodeFirst.InitTables(types); //指定表空间下的实体 - tenantDb.CodeFirst.InitTables(typeof(InfoClient));//指定更新特定实体 + tenantDb.CodeFirst.InitTables(typeof(MappingFrt));//指定更新特定实体 } - + Assert.True(true); }