|
|
@ -596,410 +596,333 @@ public class ClientCommonService : IClientCommonService
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
|
|
var data = new List<ClientSelectMultiRes>();
|
|
|
|
var data = new List<ClientSelectMultiRes>();
|
|
|
|
|
|
|
|
var parList = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
|
|
|
|
.Where(x => x.Status == StatusEnum.Enable)
|
|
|
|
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
var carrier = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var clientList = tenantDb.Queryable<InfoClient>()
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt());
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsCarrier == true)
|
|
|
|
var carrier = await clientList.Where(a=> SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsCarrier == true).Any())
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Id = a.Id,
|
|
|
|
Id = a.Id,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
BLContent = a.BLContent
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.Mapper(it =>
|
|
|
|
.Mapper(it =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.ToListAsync();
|
|
|
|
.ToListAsync();
|
|
|
|
data.Add(new ClientSelectMultiRes("carrier", carrier));
|
|
|
|
data.Add(new ClientSelectMultiRes("carrier", carrier));
|
|
|
|
|
|
|
|
|
|
|
|
var yard = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var yard = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsYard == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsYard == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
)
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Mapper(it =>
|
|
|
|
})
|
|
|
|
{
|
|
|
|
.ToListAsync();
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("yard", yard));
|
|
|
|
data.Add(new ClientSelectMultiRes("yard", yard));
|
|
|
|
|
|
|
|
|
|
|
|
var booking = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var booking = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsBooking == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsBooking == true)
|
|
|
|
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Id = a.Id,
|
|
|
|
Id = a.Id,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
BLContent = a.BLContent
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
).Mapper(it =>
|
|
|
|
.Mapper(it =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
})
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
.ToListAsync();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("booking", booking));
|
|
|
|
data.Add(new ClientSelectMultiRes("booking", booking));
|
|
|
|
|
|
|
|
|
|
|
|
var truck = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var truck = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsTruck == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsTruck == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
).Mapper(it =>
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
{
|
|
|
|
})
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
.ToListAsync();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("truck", truck));
|
|
|
|
data.Add(new ClientSelectMultiRes("truck", truck));
|
|
|
|
|
|
|
|
|
|
|
|
var controller = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var controller = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsController == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsController == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
).Mapper(it =>
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
{
|
|
|
|
})
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
.ToListAsync();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("controller", controller));
|
|
|
|
data.Add(new ClientSelectMultiRes("controller", controller));
|
|
|
|
|
|
|
|
|
|
|
|
var custom = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var custom = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsCustom == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsCustom == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
).Mapper(it =>
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
{
|
|
|
|
})
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
.ToListAsync();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("custom", custom));
|
|
|
|
data.Add(new ClientSelectMultiRes("custom", custom));
|
|
|
|
|
|
|
|
|
|
|
|
var agent = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var agent = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsAgent == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsAgent == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
).Mapper(it =>
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
{
|
|
|
|
})
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
.ToListAsync();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("agent", agent));
|
|
|
|
data.Add(new ClientSelectMultiRes("agent", agent));
|
|
|
|
|
|
|
|
|
|
|
|
var agentcn = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var agentcn = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsAgentCn == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsAgentCn == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
).Mapper(it =>
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
{
|
|
|
|
})
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
.ToListAsync();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("agentcn", agentcn));
|
|
|
|
data.Add(new ClientSelectMultiRes("agentcn", agentcn));
|
|
|
|
|
|
|
|
|
|
|
|
var express = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var express = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsExpress == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsExpress == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
).Mapper(it =>
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
{
|
|
|
|
})
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
.ToListAsync();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("express", express));
|
|
|
|
data.Add(new ClientSelectMultiRes("express", express));
|
|
|
|
|
|
|
|
|
|
|
|
var airlines = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var airlines = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsAirLines == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsAirLines == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
|
|
|
|
).Mapper(it =>
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
})
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
.ToListAsync();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("airlines", airlines));
|
|
|
|
data.Add(new ClientSelectMultiRes("airlines", airlines));
|
|
|
|
|
|
|
|
|
|
|
|
var shipper = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var shipper = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsShipper == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsShipper == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
).Mapper(it =>
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
{
|
|
|
|
})
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
.ToListAsync();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("shipper", shipper));
|
|
|
|
data.Add(new ClientSelectMultiRes("shipper", shipper));
|
|
|
|
|
|
|
|
|
|
|
|
var shippercn = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var shippercn = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsShipperCn == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsShipperCn == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
).Mapper(it =>
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
{
|
|
|
|
})
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
.ToListAsync();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("shippercn", shippercn));
|
|
|
|
data.Add(new ClientSelectMultiRes("shippercn", shippercn));
|
|
|
|
|
|
|
|
|
|
|
|
var notifyparty = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var notifyparty = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsNotifyParty == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsNotifyParty == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
|
|
|
|
).Mapper(it =>
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
})
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
.ToListAsync();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("notifyparty", notifyparty));
|
|
|
|
data.Add(new ClientSelectMultiRes("notifyparty", notifyparty));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var warehouse = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var warehouse = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsWareHouse == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsWareHouse == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
|
|
|
|
).Mapper(it =>
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
})
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
.ToListAsync();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("warehouse", warehouse));
|
|
|
|
data.Add(new ClientSelectMultiRes("warehouse", warehouse));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var wharf = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var wharf = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsWharf == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsWharf == true)
|
|
|
|
{
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
Id = a.Id,
|
|
|
|
{
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
Id = a.Id,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
})
|
|
|
|
BLContent = a.BLContent
|
|
|
|
.Mapper(it =>
|
|
|
|
}
|
|
|
|
|
|
|
|
).Mapper(it =>
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
})
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
.ToListAsync();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("wharf", wharf));
|
|
|
|
data.Add(new ClientSelectMultiRes("wharf", wharf));
|
|
|
|
|
|
|
|
|
|
|
|
var insurer = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var insurer = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsInsurer == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsInsurer == true)
|
|
|
|
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Id = a.Id,
|
|
|
|
Id = a.Id,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
BLContent = a.BLContent
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
).Mapper(it =>
|
|
|
|
.Mapper(it =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
})
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
.ToListAsync();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("insurer", insurer));
|
|
|
|
data.Add(new ClientSelectMultiRes("insurer", insurer));
|
|
|
|
|
|
|
|
|
|
|
|
var leasing = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var leasing = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsLeasing == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsLeasing == true)
|
|
|
|
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Id = a.Id,
|
|
|
|
Id = a.Id,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
BLContent = a.BLContent
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
).Mapper(it =>
|
|
|
|
.Mapper(it =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
})
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
.ToListAsync();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("leasing", leasing));
|
|
|
|
data.Add(new ClientSelectMultiRes("leasing", leasing));
|
|
|
|
|
|
|
|
|
|
|
|
var tradingagency = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var tradingagency = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsTradingAgency == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsTradingAgency == true)
|
|
|
|
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Id = a.Id,
|
|
|
|
Id = a.Id,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
BLContent = a.BLContent
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
).Mapper(it =>
|
|
|
|
.Mapper(it =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
})
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
.ToListAsync();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("tradingagency", tradingagency));
|
|
|
|
data.Add(new ClientSelectMultiRes("tradingagency", tradingagency));
|
|
|
|
|
|
|
|
|
|
|
|
var shipagency = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var shipagency = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsShipAgency == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsShipAgency == true)
|
|
|
|
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Id = a.Id,
|
|
|
|
Id = a.Id,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
BLContent = a.BLContent
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
).Mapper(it =>
|
|
|
|
.Mapper(it =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
})
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
.ToListAsync();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("shipagency", shipagency));
|
|
|
|
data.Add(new ClientSelectMultiRes("shipagency", shipagency));
|
|
|
|
|
|
|
|
|
|
|
|
var enterprise = await tenantDb.Queryable<InfoClient>()
|
|
|
|
var enterprise = await clientList.Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsEnterprise == true).Any())
|
|
|
|
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
|
|
|
|
.Select(a => new ClientSelectRes
|
|
|
|
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsEnterprise == true)
|
|
|
|
|
|
|
|
.Select((a, b) => new ClientSelectRes
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Id = a.Id,
|
|
|
|
Id = a.Id,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
CodeName = a.CodeName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
ShortName = a.ShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
EnShortName = a.EnShortName,
|
|
|
|
BLContent = a.BLContent
|
|
|
|
BLContent = a.BLContent,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
).Mapper(it =>
|
|
|
|
.Mapper(it =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.ClientParams = tenantDb.Queryable<InfoClientParam>()
|
|
|
|
it.ClientParams = parList.Where(x => x.CustomerId == it.Id).ToList();
|
|
|
|
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
|
|
|
|
})
|
|
|
|
.Select<ClientParamRes>()
|
|
|
|
.ToListAsync();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
data.Add(new ClientSelectMultiRes("enterprise", enterprise));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return await Task.FromResult(DataResult<List<ClientSelectMultiRes>>.Success(data));
|
|
|
|
return await Task.FromResult(DataResult<List<ClientSelectMultiRes>>.Success(data));
|
|
|
|
}
|
|
|
|
}
|
|
|
|