diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs index 73cf8aaa..0a09805c 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs @@ -600,10 +600,9 @@ public class ClientCommonService : IClientCommonService .Where(x => x.Status == StatusEnum.Enable) .Select() .ToList(); - - var clientList = tenantDb.Queryable() - .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()); - var carrier = await clientList.Where(a=> SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsCarrier == true).Any()) + + var carrier = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a=> SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsCarrier == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -619,7 +618,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("carrier", carrier)); - var yard = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsYard == true).Any()) + var yard = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsYard == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -635,7 +635,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("yard", yard)); - var booking = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsBooking == true).Any()) + var booking = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsBooking == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -651,7 +652,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("booking", booking)); - var truck = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsTruck == true).Any()) + var truck = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsTruck == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -667,7 +669,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("truck", truck)); - var controller = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsController == true).Any()) + var controller = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsController == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -683,7 +686,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("controller", controller)); - var custom = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsCustom == true).Any()) + var custom = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsCustom == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -699,7 +703,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("custom", custom)); - var agent = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsAgent == true).Any()) + var agent = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsAgent == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -715,7 +720,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("agent", agent)); - var agentcn = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsAgentCn == true).Any()) + var agentcn = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsAgentCn == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -731,7 +737,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("agentcn", agentcn)); - var express = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsExpress == true).Any()) + var express = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsExpress == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -747,7 +754,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("express", express)); - var airlines = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsAirLines == true).Any()) + var airlines = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsAirLines == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -763,7 +771,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("airlines", airlines)); - var shipper = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsShipper == true).Any()) + var shipper = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsShipper == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -779,7 +788,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("shipper", shipper)); - var shippercn = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsShipperCn == true).Any()) + var shippercn = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsShipperCn == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -795,7 +805,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("shippercn", shippercn)); - var notifyparty = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsNotifyParty == true).Any()) + var notifyparty = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsNotifyParty == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -812,7 +823,8 @@ public class ClientCommonService : IClientCommonService data.Add(new ClientSelectMultiRes("notifyparty", notifyparty)); - var warehouse = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsWareHouse == true).Any()) + var warehouse = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsWareHouse == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -829,7 +841,8 @@ public class ClientCommonService : IClientCommonService data.Add(new ClientSelectMultiRes("warehouse", warehouse)); - var wharf = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsWharf == true).Any()) + var wharf = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsWharf == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -845,7 +858,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("wharf", wharf)); - var insurer = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsInsurer == true).Any()) + var insurer = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsInsurer == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -861,7 +875,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("insurer", insurer)); - var leasing = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsLeasing == true).Any()) + var leasing = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsLeasing == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -877,7 +892,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("leasing", leasing)); - var tradingagency = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsTradingAgency == true).Any()) + var tradingagency = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsTradingAgency == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -893,7 +909,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("tradingagency", tradingagency)); - var shipagency = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsShipAgency == true).Any()) + var shipagency = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsShipAgency == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id, @@ -909,7 +926,8 @@ public class ClientCommonService : IClientCommonService .ToListAsync(); data.Add(new ClientSelectMultiRes("shipagency", shipagency)); - var enterprise = await clientList.Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsEnterprise == true).Any()) + var enterprise = await tenantDb.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable().Where(s => s.ClientId == a.Id && s.IsEnterprise == true).Any()) .Select(a => new ClientSelectRes { Id = a.Id,