|
|
|
@ -13,6 +13,7 @@ using DS.WMS.Core.Op.Entity;
|
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Owin.Security.Provider;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Info.Method;
|
|
|
|
@ -176,4 +177,61 @@ public class ClientInfoService : IClientInfoService
|
|
|
|
|
}
|
|
|
|
|
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取往来单位详情(含有联系人列表)
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取往来单位详情(含有联系人列表)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="query">查询往来单位</param>
|
|
|
|
|
/// <returns>返回往来单位详情</returns>
|
|
|
|
|
public async Task<DataResult<ClientInfoRes>> GetClientInfoWithContact(QueryClientInfo query)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
var data = await tenantDb.Queryable<InfoClient>().InnerJoin<InfoClientTag>((c,t)=> c.Id == t.ClientId)
|
|
|
|
|
.Where((c,t)=> c.Id == query.ClientId)
|
|
|
|
|
.WhereIF(query.IsController,(c,t)=>t.IsController.HasValue && t.IsController.HasValue)
|
|
|
|
|
.WhereIF(query.IsSpecialApproval, (c, t) => t.IsSpecialApproval.HasValue && t.IsSpecialApproval.HasValue)
|
|
|
|
|
.WhereIF(query.IsCarrier, (c, t) => t.IsCarrier.HasValue && t.IsCarrier.HasValue)
|
|
|
|
|
.WhereIF(query.IsBooking, (c, t) => t.IsBooking.HasValue && t.IsBooking.HasValue)
|
|
|
|
|
.WhereIF(query.IsYard, (c, t) => t.IsYard.HasValue && t.IsYard.HasValue)
|
|
|
|
|
.WhereIF(query.IsTruck, (c, t) => t.IsTruck.HasValue && t.IsTruck.HasValue)
|
|
|
|
|
.WhereIF(query.IsController, (c, t) => t.IsController.HasValue && t.IsController.HasValue)
|
|
|
|
|
.WhereIF(query.IsCustom, (c, t) => t.IsCustom.HasValue && t.IsCustom.HasValue)
|
|
|
|
|
.WhereIF(query.IsAgent, (c, t) => t.IsAgent.HasValue && t.IsAgent.HasValue)
|
|
|
|
|
.WhereIF(query.IsAgentCn, (c, t) => t.IsAgentCn.HasValue && t.IsAgentCn.HasValue)
|
|
|
|
|
.WhereIF(query.IsExpress, (c, t) => t.IsExpress.HasValue && t.IsExpress.HasValue)
|
|
|
|
|
.WhereIF(query.IsAirLines, (c, t) => t.IsAirLines.HasValue && t.IsAirLines.HasValue)
|
|
|
|
|
.WhereIF(query.IsShipper, (c, t) => t.IsShipper.HasValue && t.IsShipper.HasValue)
|
|
|
|
|
.WhereIF(query.IsConsignee, (c, t) => t.IsConsignee.HasValue && t.IsConsignee.HasValue)
|
|
|
|
|
.WhereIF(query.IsNotifyParty, (c, t) => t.IsNotifyParty.HasValue && t.IsNotifyParty.HasValue)
|
|
|
|
|
.WhereIF(query.IsWareHouse, (c, t) => t.IsWareHouse.HasValue && t.IsWareHouse.HasValue)
|
|
|
|
|
.WhereIF(query.IsWharf, (c, t) => t.IsWharf.HasValue && t.IsWharf.HasValue)
|
|
|
|
|
.WhereIF(query.IsInsurer, (c, t) => t.IsInsurer.HasValue && t.IsInsurer.HasValue)
|
|
|
|
|
.WhereIF(query.IsLeasing, (c, t) => t.IsLeasing.HasValue && t.IsLeasing.HasValue)
|
|
|
|
|
.WhereIF(query.IsTradingAgency, (c, t) => t.IsTradingAgency.HasValue && t.IsTradingAgency.HasValue)
|
|
|
|
|
.WhereIF(query.IsOther, (c, t) => t.IsOther.HasValue && t.IsOther.HasValue)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(query.Others), (c, t) => t.Others == query.Others)
|
|
|
|
|
.WhereIF(query.IsShipAgency, (c, t) => t.IsShipAgency.HasValue && t.IsShipAgency.HasValue)
|
|
|
|
|
.WhereIF(query.IsEnterprise, (c, t) => t.IsEnterprise.HasValue && t.IsEnterprise.HasValue)
|
|
|
|
|
|
|
|
|
|
.Select((c,t)=> new { Client = c, tag = t })
|
|
|
|
|
.FirstAsync();
|
|
|
|
|
|
|
|
|
|
var clientInfo = data.Client.Adapt<ClientInfoRes>();
|
|
|
|
|
|
|
|
|
|
clientInfo.ClientTag = data.tag.Adapt<ClientTagRes>();
|
|
|
|
|
|
|
|
|
|
var contactList = tenantDb.Queryable<InfoClientContact>()
|
|
|
|
|
.Where(a => a.ClientId == clientInfo.Id && a.Status == StatusEnum.Enable).ToList();
|
|
|
|
|
|
|
|
|
|
if (contactList.Count > 0)
|
|
|
|
|
clientInfo.ClientContactList = contactList.Adapt<List<ClientContactRes>>();
|
|
|
|
|
|
|
|
|
|
if (clientInfo == null)
|
|
|
|
|
return DataResult<ClientInfoRes>.FailedData(clientInfo);
|
|
|
|
|
|
|
|
|
|
return DataResult<ClientInfoRes>.Success(clientInfo);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|