Compare commits

...

3 Commits

Author SHA1 Message Date
嵇文龙 48aa4e3564 迁移客户属性 2 weeks ago
嵇文龙 d2b4336e8e Quartz根据配置文件注册 2 weeks ago
嵇文龙 5594d1492f ClientFlowInstanceService的bug修复 2 weeks ago

@ -52,16 +52,20 @@ namespace DS.Module.QuartzModuleInstall
});
var jobKey3 = new JobKey(nameof(FeeCustTemplateJob));
services.AddQuartz(q =>
string cron3 = configuration["JobConfig:" + jobKey3.Name];
if (!string.IsNullOrEmpty(cron3))
{
q.UseMicrosoftDependencyInjectionJobFactory();
q.AddJob<FeeCustTemplateJob>(opts => opts.WithIdentity(jobKey3));
q.AddTrigger(opts => opts
.ForJob(jobKey3)
.WithIdentity(nameof(FeeCustTemplateJob) + "-trigger")
.WithCronSchedule(configuration["JobConfig:" + jobKey3.Name])
);
});
services.AddQuartz(q =>
{
q.UseMicrosoftDependencyInjectionJobFactory();
q.AddJob<FeeCustTemplateJob>(opts => opts.WithIdentity(jobKey3));
q.AddTrigger(opts => opts
.ForJob(jobKey3)
.WithIdentity(nameof(FeeCustTemplateJob) + "-trigger")
.WithCronSchedule(cron3)
);
});
}
// 添加 Quartz 主机服务
services.AddQuartzServer(q => q.WaitForJobsToComplete = true);
@ -74,17 +78,25 @@ namespace DS.Module.QuartzModuleInstall
/// <param name="configuration"></param>
public static void AddOpQuartzModuleInstall(this IServiceCollection services, IConfiguration configuration)
{
int jobCount = 0;
var jobKey1 = new JobKey(nameof(WSLReportJob));
services.AddQuartz(q =>
string cron1 = configuration["JobConfig:" + jobKey1.Name];
if (!string.IsNullOrEmpty(cron1))
{
q.UseMicrosoftDependencyInjectionJobFactory();
q.AddJob<WSLReportJob>(opts => opts.WithIdentity(jobKey1));
q.AddTrigger(opts => opts
.ForJob(jobKey1)
.WithIdentity(nameof(WSLReportJob) + "-trigger")
.WithCronSchedule(configuration["JobConfig:" + jobKey1.Name])
);
});
services.AddQuartz(q =>
{
q.UseMicrosoftDependencyInjectionJobFactory();
q.AddJob<WSLReportJob>(opts => opts.WithIdentity(jobKey1));
q.AddTrigger(opts => opts
.ForJob(jobKey1)
.WithIdentity(nameof(WSLReportJob) + "-trigger")
.WithCronSchedule(cron1)
);
});
jobCount++;
}
//var jobKey2 = new JobKey(nameof(WSLWeeklyReportJob));
//services.AddQuartz(q =>
//{
@ -111,7 +123,8 @@ namespace DS.Module.QuartzModuleInstall
// .RepeatForever()));
//});
services.AddQuartzServer(q => q.WaitForJobsToComplete = true);
if (jobCount > 0)
services.AddQuartzServer(q => q.WaitForJobsToComplete = true);
}
}
}

@ -364,7 +364,7 @@ public class ClientFlowInstanceService : ServiceBase, IClientFlowInstanceService
Content = $"【启动】由{User.UserName}启动该流程。",
UserName = User.UserName
};
Db.Insertable(history).ExecuteCommand();
TenantDb.Insertable(history).ExecuteCommand();
return DataResult.Successed("更新成功!", instance, MultiLanguageConst.FlowInstanceUpdateSuccess);
}
@ -909,34 +909,24 @@ public class ClientFlowInstanceService : ServiceBase, IClientFlowInstanceService
internal async Task<DataResult> WithdrawCoreAsync(List<FlowInstance> instances, string? note = null)
{
ArgumentNullException.ThrowIfNull(instances, nameof(instances));
await TenantDb.Ado.BeginTranAsync();
try
{
await TenantDb.Updateable(instances).UpdateColumns(x => new
{
x.ActivityId,
x.MakerList,
x.FlowStatus,
x.Note
}).ExecuteCommandAsync();
var historys = instances.Select(x => new FlowInstanceHistory
{
InstanceId = x.Id,
Content = $"【撤销】由{User.UserName}撤销,备注:{note}",
Result = -1,
UserName = User.UserName
}).ToList();
await TenantDb.Updateable(instances).UpdateColumns(x => new
{
x.ActivityId,
x.MakerList,
x.FlowStatus,
x.Note
}).ExecuteCommandAsync();
await TenantDb.Insertable(historys).ExecuteCommandAsync();
await TenantDb.Ado.CommitTranAsync();
return DataResult.Successed("撤销成功!", MultiLanguageConst.FlowInstanceCancelSuccess);
}
catch (Exception ex)
var historys = instances.Select(x => new FlowInstanceHistory
{
await TenantDb.Ado.RollbackTranAsync();
await ex.LogAsync(Db);
return DataResult.FailedWithDesc(MultiLanguageConst.Operation_Failed);
}
InstanceId = x.Id,
Content = $"【撤销】由{User.UserName}撤销,备注:{note}",
Result = -1,
UserName = User.UserName
}).ToList();
await TenantDb.Insertable(historys).ExecuteCommandAsync();
return DataResult.Successed("撤销成功!", MultiLanguageConst.FlowInstanceCancelSuccess);
}
}

@ -1,5 +1,6 @@
using System.Runtime.Serialization;
using DS.Module.Core.Enums;
using DS.WMS.Core.Info.Entity;
using FluentValidation;
using SqlSugar;
@ -373,9 +374,9 @@ public class ClientInfoReq
public string? Note { get; set; }
/// <summary>
/// 客户标识
/// 客户属性
/// </summary>
public ClientTagReq ClientTag { get; set; }
public List<InfoClientAttribute> Attributes { get; set; } = [];
/// <summary>
/// 是否共享

@ -287,9 +287,9 @@ public class ClientInfoRes
public DateTime CreateTime { get; set; }
/// <summary>
/// 客户标识
/// 客户属性
/// </summary>
public ClientTagRes ClientTag { get; set; }
public List<InfoClientAttribute> Attributes { get; set; } = [];
/// <summary>
/// 联系人列表

@ -16,8 +16,8 @@
public bool? IsContractExpired { get; set; }
/// <summary>
/// 客户标记
/// 客户属性值
/// </summary>
public QueryClientInfo? ClientTag { get; set; }
public string[]? Attributes { get; set; }
}
}

@ -1,188 +0,0 @@
using SqlSugar;
namespace DS.WMS.Core.Info.Dtos;
/// <summary>
/// 客户标识信息请求实体
/// </summary>
public class ClientTagReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 客户Id
/// </summary>
public long? ClientId { get; set; }
/// <summary>
/// Desc:是否特批放单客户
/// </summary>
public bool? IsSpecialApproval { get; set; } = false;
/// <summary>
/// Desc:是否船公司
/// </summary>
public bool? IsCarrier { get; set; } = false;
/// <summary>
/// Desc:是否订舱公司
/// </summary>
public bool? IsBooking { get; set; } = false;
/// <summary>
/// Desc:是否场站
/// </summary>
public bool? IsYard { get; set; } = false;
/// <summary>
/// Desc:是否车队
/// </summary>
public bool? IsTruck { get; set; } = false;
/// <summary>
/// Desc:是否委托单位
/// </summary>
public bool? IsController { get; set; } = false;
/// <summary>
/// Desc:是否报关行
/// </summary>
public bool? IsCustom { get; set; } = false;
/// <summary>
/// Desc:是否代理(国外)
/// </summary>
public bool? IsAgent { get; set; } = false;
/// <summary>
/// Desc:是否代理(国内)
/// </summary>
public bool? IsAgentCn { get; set; } = false;
/// <summary>
/// Desc:是否快递公司
/// </summary>
public bool? IsExpress { get; set; } = false;
/// <summary>
/// Desc:是否航空公司
/// </summary>
public bool? IsAirLines { get; set; } = false;
/// <summary>
/// Desc:是否发货人
/// </summary>
public bool? IsShipper { get; set; } = false;
/// <summary>
/// Desc:是否收货人
/// </summary>
public bool? IsConsignee { get; set; } = false;
/// <summary>
/// Desc:是否通知人
/// </summary>
public bool? IsNotifyParty { get; set; } = false;
/// <summary>
/// Desc:是否仓库
/// </summary>
public bool? IsWareHouse { get; set; } = false;
/// <summary>
/// Desc:是否码头
/// </summary>
public bool? IsWharf { get; set; } = false;
/// <summary>
/// Desc:是否保险公司
/// </summary>
public bool? IsInsurer { get; set; } = false;
/// <summary>
/// Desc:是否租箱公司
/// </summary>
public bool? IsLeasing { get; set; } = false;
/// <summary>
/// Desc:是否贸易代理
/// </summary>
public bool? IsTradingAgency { get; set; } = false;
/// <summary>
/// Desc:是否其他
/// </summary>
public bool? IsOther { get; set; } = false;
/// <summary>
/// Desc:其他类型
/// </summary>
public string? Others { get; set; }
/// <summary>
/// Desc:是否船代
/// </summary>
public bool? IsShipAgency { get; set; }
/// <summary>
/// Desc:是否经营单位
/// </summary>
public bool? IsEnterprise { get; set; } = false;
/// <summary>
/// Desc:是否国内发货人
/// </summary>
public bool? IsShipperCn { get; set; } = false;
/// <summary>
/// Desc:是否约主
/// </summary>
public bool? IsContract { get; set; } = false;
/// <summary>
/// 是否国内同行
/// </summary>
public bool IsDomesticPeers { get; set; }
/// <summary>
/// 是否国外同行
/// </summary>
public bool IsForeignCounterparts { get; set; }
/// <summary>
/// 是否国内直客
/// </summary>
public bool IsDirectCustomerCn { get; set; }
/// <summary>
/// 是否国外直客
/// </summary>
public bool IsDirectCustomer { get; set; }
/// <summary>
/// 是否指定货发货人
/// </summary>
public bool IsShipperZDH { get; set; }
/// <summary>
/// 是否个人
/// </summary>
public bool IsPersonal { get; set; }
/// <summary>
/// 是否装箱加固
/// </summary>
public bool IsPacking { get; set; }
/// <summary>
/// 是否放箱公司
/// </summary>
public bool IsContainerCompany { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}

@ -1,193 +0,0 @@
namespace DS.WMS.Core.Info.Dtos;
/// <summary>
/// 客户标识信息返回实体
/// </summary>
public class ClientTagRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 客户Id
/// </summary>
public long ClientId { get; set; }
/// <summary>
/// Desc:是否特批放单客户
/// </summary>
public bool? IsSpecialApproval { get; set; } = false;
/// <summary>
/// Desc:是否船公司
/// </summary>
public bool? IsCarrier { get; set; } = false;
/// <summary>
/// Desc:是否订舱公司
/// </summary>
public bool? IsBooking { get; set; } = false;
/// <summary>
/// Desc:是否场站
/// </summary>
public bool? IsYard { get; set; } = false;
/// <summary>
/// Desc:是否车队
/// </summary>
public bool? IsTruck { get; set; } = false;
/// <summary>
/// Desc:是否委托单位
/// </summary>
public bool? IsController { get; set; } = false;
/// <summary>
/// Desc:是否报关行
/// </summary>
public bool? IsCustom { get; set; } = false;
/// <summary>
/// Desc:是否代理(国外)
/// </summary>
public bool? IsAgent { get; set; } = false;
/// <summary>
/// Desc:是否代理(国内)
/// </summary>
public bool? IsAgentCn { get; set; } = false;
/// <summary>
/// Desc:是否快递公司
/// </summary>
public bool? IsExpress { get; set; } = false;
/// <summary>
/// Desc:是否航空公司
/// </summary>
public bool? IsAirLines { get; set; } = false;
/// <summary>
/// Desc:是否发货人
/// </summary>
public bool? IsShipper { get; set; } = false;
/// <summary>
/// Desc:是否收货人
/// </summary>
public bool? IsConsignee { get; set; } = false;
/// <summary>
/// Desc:是否通知人
/// </summary>
public bool? IsNotifyParty { get; set; } = false;
/// <summary>
/// Desc:是否仓库
/// </summary>
public bool? IsWareHouse { get; set; } = false;
/// <summary>
/// Desc:是否码头
/// </summary>
public bool? IsWharf { get; set; } = false;
/// <summary>
/// Desc:是否保险公司
/// </summary>
public bool? IsInsurer { get; set; } = false;
/// <summary>
/// Desc:是否租箱公司
/// </summary>
public bool? IsLeasing { get; set; } = false;
/// <summary>
/// Desc:是否贸易代理
/// </summary>
public bool? IsTradingAgency { get; set; } = false;
/// <summary>
/// Desc:是否其他
/// </summary>
public bool? IsOther { get; set; } = false;
/// <summary>
/// Desc:其他类型
/// </summary>
public string Others { get; set; }
/// <summary>
/// Desc:是否船代
/// </summary>
public bool? IsShipAgency { get; set; }
/// <summary>
/// Desc:是否经营单位
/// </summary>
public bool? IsEnterprise { get; set; } = false;
/// <summary>
/// Desc:是否国内发货人
/// </summary>
public bool? IsShipperCn { get; set; } = false;
/// <summary>
/// Desc:是否约主
/// </summary>
public bool? IsContract { get; set; } = false;
/// <summary>
/// 是否国内同行
/// </summary>
public bool IsDomesticPeers { get; set; }
/// <summary>
/// 是否国外同行
/// </summary>
public bool IsForeignCounterparts { get; set; }
/// <summary>
/// 是否国内直客
/// </summary>
public bool IsDirectCustomerCn { get; set; }
/// <summary>
/// 是否国外直客
/// </summary>
public bool IsDirectCustomer { get; set; }
/// <summary>
/// 是否指定货发货人
/// </summary>
public bool IsShipperZDH { get; set; }
/// <summary>
/// 是否个人
/// </summary>
public bool IsPersonal { get; set; }
/// <summary>
/// 是否装箱加固
/// </summary>
public bool IsPacking { get; set; }
/// <summary>
/// 是否放箱公司
/// </summary>
public bool IsContainerCompany { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}

@ -1,129 +0,0 @@
namespace DS.WMS.Core.Info.Dtos
{
/// <summary>
/// 检索往来单位
/// </summary>
public class QueryClientInfo
{
/// <summary>
/// 客户Id
/// </summary>
public long ClientId { get; set; }
/// <summary>
/// Desc:是否特批放单客户
/// </summary>
public bool IsSpecialApproval { get; set; } = false;
/// <summary>
/// Desc:是否船公司
/// </summary>
public bool IsCarrier { get; set; } = false;
/// <summary>
/// Desc:是否订舱公司
/// </summary>
public bool IsBooking { get; set; } = false;
/// <summary>
/// Desc:是否场站
/// </summary>
public bool IsYard { get; set; } = false;
/// <summary>
/// Desc:是否车队
/// </summary>
public bool IsTruck { get; set; } = false;
/// <summary>
/// Desc:是否委托单位
/// </summary>
public bool IsController { get; set; } = false;
/// <summary>
/// Desc:是否报关行
/// </summary>
public bool IsCustom { get; set; } = false;
/// <summary>
/// Desc:是否代理(国外)
/// </summary>
public bool IsAgent { get; set; } = false;
/// <summary>
/// Desc:是否代理(国内)
/// </summary>
public bool IsAgentCn { get; set; } = false;
/// <summary>
/// Desc:是否快递公司
/// </summary>
public bool IsExpress { get; set; } = false;
/// <summary>
/// Desc:是否航空公司
/// </summary>
public bool IsAirLines { get; set; } = false;
/// <summary>
/// Desc:是否发货人
/// </summary>
public bool IsShipper { get; set; } = false;
/// <summary>
/// Desc:是否收货人
/// </summary>
public bool IsConsignee { get; set; } = false;
/// <summary>
/// Desc:是否通知人
/// </summary>
public bool IsNotifyParty { get; set; } = false;
/// <summary>
/// Desc:是否仓库
/// </summary>
public bool IsWareHouse { get; set; } = false;
/// <summary>
/// Desc:是否码头
/// </summary>
public bool IsWharf { get; set; } = false;
/// <summary>
/// Desc:是否保险公司
/// </summary>
public bool IsInsurer { get; set; } = false;
/// <summary>
/// Desc:是否租箱公司
/// </summary>
public bool IsLeasing { get; set; } = false;
/// <summary>
/// Desc:是否贸易代理
/// </summary>
public bool IsTradingAgency { get; set; } = false;
/// <summary>
/// Desc:是否其他
/// </summary>
public bool IsOther { get; set; } = false;
/// <summary>
/// Desc:其他类型
/// </summary>
public string Others { get; set; }
/// <summary>
/// Desc:是否船代
/// </summary>
public bool IsShipAgency { get; set; } = false;
/// <summary>
/// Desc:是否经营单位
/// </summary>
public bool IsEnterprise { get; set; } = false;
}
}

@ -491,16 +491,17 @@ public class InfoClient : SharedOrgModel<long>
/// </summary>
[SugarColumn(ColumnDescription = "银行国际代码", Length = 150, IsNullable = true)]
public string? SwiftCode { get; set; }
/// <summary>
/// 客户属性
/// </summary>
[Navigate(NavigateType.OneToOne, nameof(InfoClientContact.ClientId))]
public InfoClientTag? ClientTag { get; set; }
[Navigate(NavigateType.OneToMany, nameof(InfoClientAttribute.ClientId))]
public List<InfoClientAttribute>? Attributes { get; set; }
/// <summary>
/// 账期
/// </summary>
[Navigate(NavigateType.OneToMany, nameof(InfoClientContact.ClientId))]
[Navigate(NavigateType.OneToMany, nameof(InfoClientAccountDate.ClientId))]
public List<InfoClientAccountDate>? AccountDates { get; set; }
/// <summary>
@ -518,6 +519,6 @@ public class InfoClient : SharedOrgModel<long>
/// <summary>
/// 干系人列表
/// </summary>
[SqlSugar.SugarColumn(IsIgnore = true)]
[SugarColumn(IsIgnore = true)]
public List<long>? UserIds { get; set; }
}

@ -0,0 +1,36 @@
using DS.Module.Core.Enums;
using SqlSugar;
namespace DS.WMS.Core.Info.Entity
{
/// <summary>
/// 往来单位属性
/// </summary>
[SugarTable("info_client_attribute", "往来单位属性")]
public class InfoClientAttribute
{
/// <summary>
/// ID
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
/// <summary>
/// 往来单位ID
/// </summary>
[SugarColumn(ColumnDescription = "往来单位ID", IsNullable = false)]
public long ClientId { get; set; }
/// <summary>
/// 属性值
/// </summary>
[SugarColumn(ColumnDescription = "属性值", Length = 50, IsNullable = false)]
public string Value { get; set; }
/// <summary>
/// 属性名称
/// </summary>
[SugarColumn(ColumnDescription = "属性名称", Length = 50, IsNullable = true)]
public string? Name { get; set; }
}
}

@ -1,222 +0,0 @@
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.Info.Entity;
/// <summary>
/// 往来单位标识
/// </summary>
[SugarTable("info_client_tag", "往来单位标识")]
public class InfoClientTag : BaseModelV2<long>
{
/// <summary>
/// 往来单位id
/// </summary>
public long ClientId { get; set; }
///// <summary>
///// Desc:是否特批放单客户
///// </summary>
//[SugarColumn(ColumnDescription = "是否特批放单客户", DefaultValue = "0")]
//public bool IsSpecialApproval { get; set; }
/// <summary>
/// Desc:是否船公司
/// </summary>
[SugarColumn(ColumnDescription = "是否船公司", DefaultValue = "0")]
public bool IsCarrier { get; set; } = false;
/// <summary>
/// Desc:是否订舱公司
/// </summary>
[SugarColumn(ColumnDescription = "是否订舱公司", DefaultValue = "0")]
public bool IsBooking { get; set; } = false;
/// <summary>
/// Desc:是否场站
/// </summary>
[SugarColumn(ColumnDescription = "是否场站", DefaultValue = "0")]
public bool IsYard { get; set; } = false;
/// <summary>
/// Desc:是否车队
/// </summary>
[SugarColumn(ColumnDescription = "是否车队", DefaultValue = "0")]
public bool IsTruck { get; set; } = false;
/// <summary>
/// Desc:是否委托单位
/// </summary>
[SugarColumn(ColumnDescription = "是否委托单位", DefaultValue = "0")]
public bool IsController { get; set; } = false;
/// <summary>
/// Desc:是否报关行
/// </summary>
[SugarColumn(ColumnDescription = "是否报关行", DefaultValue = "0")]
public bool IsCustom { get; set; } = false;
/// <summary>
/// Desc:是否代理(国外)
/// </summary>
[SugarColumn(ColumnDescription = "是否代理(国外)", DefaultValue = "0")]
public bool IsAgent { get; set; } = false;
/// <summary>
/// Desc:是否代理(国内)
/// </summary>
[SugarColumn(ColumnDescription = "是否代理(国内)", DefaultValue = "0")]
public bool IsAgentCn { get; set; } = false;
/// <summary>
/// Desc:是否快递公司
/// </summary>
[SugarColumn(ColumnDescription = "是否快递公司", DefaultValue = "0")]
public bool IsExpress { get; set; } = false;
/// <summary>
/// Desc:是否航空公司
/// </summary>
[SugarColumn(ColumnDescription = "是否航空公司", DefaultValue = "0")]
public bool IsAirLines { get; set; } = false;
/// <summary>
/// Desc:是否发货人
/// </summary>
[SugarColumn(ColumnDescription = "是否发货人", DefaultValue = "0")]
public bool IsShipper { get; set; } = false;
/// <summary>
/// Desc:是否收货人
/// </summary>
[SugarColumn(ColumnDescription = "是否收货人", DefaultValue = "0")]
public bool IsConsignee { get; set; } = false;
/// <summary>
/// Desc:是否通知人
/// </summary>
[SugarColumn(ColumnDescription = "是否通知人", DefaultValue = "0")]
public bool IsNotifyParty { get; set; } = false;
/// <summary>
/// Desc:是否仓库
/// </summary>
[SugarColumn(ColumnDescription = "是否仓库", DefaultValue = "0")]
public bool IsWareHouse { get; set; }
/// <summary>
/// Desc:是否码头
/// </summary>
[SugarColumn(ColumnDescription = "是否码头", DefaultValue = "0")]
public bool IsWharf { get; set; } = false;
/// <summary>
/// Desc:是否保险公司
/// </summary>
[SugarColumn(ColumnDescription = "是否保险公司", DefaultValue = "0")]
public bool IsInsurer { get; set; } = false;
/// <summary>
/// Desc:是否租箱公司
/// </summary>
[SugarColumn(ColumnDescription = "是否租箱公司", DefaultValue = "0")]
public bool IsLeasing { get; set; } = false;
/// <summary>
/// Desc:是否贸易代理
/// </summary>
[SugarColumn(ColumnDescription = "是否贸易代理", DefaultValue = "0")]
public bool IsTradingAgency { get; set; } = false;
/// <summary>
/// Desc:是否其他
/// </summary>
[SugarColumn(ColumnDescription = "是否其他", DefaultValue = "0")]
public bool IsOther { get; set; } = false;
/// <summary>
/// Desc:其他类型
/// </summary>
[SugarColumn(ColumnDescription = "其他类型", Length = 100,IsNullable = true)]
public string Others { get; set; }
/// <summary>
/// Desc:是否船代
/// </summary>
[SugarColumn(ColumnDescription = "是否船代", DefaultValue = "0")]
public bool IsShipAgency { get; set; }
/// <summary>
/// Desc:是否经营单位
/// </summary>
[SugarColumn(ColumnDescription = "是否经营单位", DefaultValue = "0")]
public bool IsEnterprise { get; set; } = false;
/// <summary>
/// Desc:是否国内发货人
/// </summary>
[SugarColumn(ColumnDescription = "是否国内发货人", DefaultValue = "0")]
public bool IsShipperCn { get; set; } = false;
/// <summary>
/// Desc:是否约主
/// </summary>
[SugarColumn(ColumnDescription = "是否约主", DefaultValue = "0")]
public bool IsContract { get; set; } = false;
/// <summary>
/// 是否国内同行
/// </summary>
[SugarColumn(ColumnDescription = "是否国内同行", DefaultValue = "0")]
public bool IsDomesticPeers { get; set; }
/// <summary>
/// 是否国外同行
/// </summary>
[SugarColumn(ColumnDescription = "是否国外同行", DefaultValue = "0")]
public bool IsForeignCounterparts { get; set; }
/// <summary>
/// 是否国内直客
/// </summary>
[SugarColumn(ColumnDescription = "是否国内直客", DefaultValue = "0")]
public bool IsDirectCustomerCn { get; set; }
/// <summary>
/// 是否国外直客
/// </summary>
[SugarColumn(ColumnDescription = "是否国外直客", DefaultValue = "0")]
public bool IsDirectCustomer { get; set; }
/// <summary>
/// 是否指定货发货人
/// </summary>
[SugarColumn(ColumnDescription = "是否指定货发货人", DefaultValue = "0")]
public bool IsShipperZDH { get; set; }
/// <summary>
/// 是否个人
/// </summary>
[SugarColumn(ColumnDescription = "是否个人", DefaultValue = "0")]
public bool IsPersonal { get; set; }
/// <summary>
/// 是否装箱加固
/// </summary>
[SugarColumn(ColumnDescription = "是否装箱加固", DefaultValue = "0")]
public bool IsPacking { get; set; }
/// <summary>
/// 是否放箱公司
/// </summary>
[SugarColumn(ColumnDescription = "是否放箱公司", DefaultValue = "0")]
public bool IsContainerCompany { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[SugarColumn(ColumnDescription = "机构Id")]
public long OrgId { get; set; }
}

@ -3,7 +3,6 @@ using DS.Module.Core.Data;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
namespace DS.WMS.Core.Info.Interface;
@ -113,7 +112,7 @@ public interface IClientInfoService
/// <summary>
/// 获取往来单位详情(含有联系人列表)
/// </summary>
/// <param name="query">查询往来单位</param>
/// <param name="attributes">客户属性</param>
/// <returns>返回往来单位详情</returns>
Task<DataResult<ClientInfoRes>> GetClientInfoWithContact(QueryClientInfo query);
Task<DataResult<ClientInfoRes>> GetClientInfoWithContact(params string[] attributes);
}

@ -348,23 +348,23 @@ public class ClientInfoService : ServiceBase, IClientInfoService
IsOverdueDeduction = model.IsCustomer,
IsMortgageLastOrder = model.IsCustomer,
Note = "系统导入",
ClientTag = new InfoClientTag { IsController = model.IsCustomer },
//Attributes = new InfoClientTag { IsController = model.IsCustomer },
AccountDates = []
};
if (model.AttributeNames.Length == 0)
{
client.ClientTag.IsOther = model.IsSupplier;
}
else
{
var dicValues = dicList.FindAll(x => model.AttributeNames.Contains(x.Name));
foreach (var item in dicValues)
{
var dicValue = item.Value.ToUpperCamelCase();
PropertyExtensions.SetPropertyValue(client.ClientTag, dicValue, true);
}
}
//if (model.AttributeNames.Length == 0)
//{
// client.Attributes.IsOther = model.IsSupplier;
//}
//else
//{
// var dicValues = dicList.FindAll(x => model.AttributeNames.Contains(x.Name));
// foreach (var item in dicValues)
// {
// var dicValue = item.Value.ToUpperCamelCase();
// PropertyExtensions.SetPropertyValue(client.Attributes, dicValue, true);
// }
//}
client.AccountDates.Add(new InfoClientAccountDate
{
@ -388,16 +388,16 @@ public class ClientInfoService : ServiceBase, IClientInfoService
await TenantDb.Updateable(existClients).UpdateColumns(x => new { x.IsCustomer, x.IsSupplier }).ExecuteCommandAsync();
await TenantDb.Fastest<InfoClient>().RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}").BulkCopyAsync(newClients);
foreach (var client in newClients)
{
client.ClientTag.ClientId = client.Id;
//foreach (var client in newClients)
//{
// client.Attributes.ClientId = client.Id;
foreach (var item in client.AccountDates)
item.ClientId = client.Id;
}
// foreach (var item in client.AccountDates)
// item.ClientId = client.Id;
//}
var tags = newClients.Select(x => x.ClientTag).ToList();
await TenantDb.Fastest<InfoClientTag>().BulkMergeAsync(tags);
//var tags = newClients.Select(x => x.Attributes).ToList();
//await TenantDb.Fastest<InfoClientTag>().BulkMergeAsync(tags);
var accountDates = newClients.SelectMany(x => x.AccountDates).ToList();
await TenantDb.Fastest<InfoClientAccountDate>().BulkMergeAsync(accountDates);
@ -455,7 +455,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService
}
await TenantDb.Ado.BeginTranAsync();
try
try
{
await TenantDb.Fastest<InfoClient>().BulkUpdateAsync(existClients, [nameof(InfoClient.Id)],
[nameof(InfoClient.RegisteredCapital), nameof(InfoClient.RegistrationTime)]);
@ -467,7 +467,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService
await TenantDb.Ado.RollbackTranAsync();
await ex.LogAsync(Db);
return DataResult.Failed("导入失败:" + ex.Message);
}
}
}
/// <summary>
@ -512,14 +512,13 @@ public class ClientInfoService : ServiceBase, IClientInfoService
var exp = Expressionable.Create<InfoClient>();
exp = exp.And(c => SqlFunc.Subqueryable<InfoClientStakeholder>().Where("SYSDATE() BETWEEN StartDate and EndDate").Where(x => userids.Contains(x.UserId.ToString()) && x.ClientId == c.Id).Any());
var queryData1 = TenantDb.Queryable<InfoClient>().ClearFilter<ISharedOrgId>().Where(exp.ToExpression());
var queryData1 = TenantDb.Queryable<InfoClient>().Includes(x => x.Attributes).ClearFilter<ISharedOrgId>().Where(exp.ToExpression());
var queryData2 = queryData.Where(conditions);
var queryData0 = TenantDb.UnionAll(queryData1, queryData2);
var query = queryData0//.Where(c => c.Status == StatusEnum.Enable.ToEnumInt())//TenantDb.Queryable<InfoClient>()
.LeftJoin<InfoClientContact>((c, c1) => c.Id == c1.ClientId)
.LeftJoin<InfoClientContract>((c, c1, c2) => c.Id == c2.ClientId)
.InnerJoinIF<InfoClientTag>(request.OtherQueryCondition?.ClientTag != null, (c, c1, c2, ct) => c.Id == ct.ClientId)
.GroupBy((c, c1, c2) => c.Id);
if (!string.IsNullOrEmpty(request.OtherQueryCondition?.ContactInfo))
@ -529,34 +528,19 @@ public class ClientInfoService : ServiceBase, IClientInfoService
if (request.OtherQueryCondition != null && request.OtherQueryCondition.IsContractExpired.GetValueOrDefault())
query = query.Where((c, c1, c2) => SqlFunc.GetDate() > c2.EndDate);
if (request.OtherQueryCondition?.ClientTag != null)
if (request.OtherQueryCondition?.Attributes?.Length > 0)
{
//合并到主查询条件
var props = Array.FindAll(request.OtherQueryCondition.ClientTag.GetType().GetProperties(), x => x.Name.StartsWith("Is") && x.PropertyType == typeof(bool));
List<IConditionalModel> list = [];
foreach (var prop in props)
{
object val = prop.Get(request.OtherQueryCondition.ClientTag);
if (val != null && val is bool value && value)
{
list.Add(new ConditionalModel
{
ConditionalType = ConditionalType.Equal,
FieldName = "ct." + prop.Name,
FieldValue = "1"
});
}
}
query = query.Where(list);
query = query.Where((c, c1, c2) => SqlFunc.Subqueryable<InfoClientAttribute>().Where(ca =>
ca.ClientId == c.Id && request.OtherQueryCondition.Attributes.Contains(ca.Value)).Any());
}
#region 判断权限范围
if (scope == "all")
{
query = query.ClearFilter<ISharedOrgId>();
}
#endregion
var result = await query.Select((c, c1, c2, ct) => new ClientInfoRes
var result = await query.Select((c, c1, c2) => new ClientInfoRes
{
CodeName = c.CodeName,
Name = c.Name,
@ -604,7 +588,6 @@ public class ClientInfoService : ServiceBase, IClientInfoService
var query = TenantDb.Queryable<InfoClient>()
.LeftJoin<InfoClientContact>((c, c1) => c.Id == c1.ClientId)
.LeftJoin<InfoClientContract>((c, c1, c2) => c.Id == c2.ClientId)
.InnerJoinIF<InfoClientTag>(request.OtherQueryCondition?.ClientTag != null, (c, c1, c2, ct) => c.Id == ct.ClientId)
.GroupBy((c, c1, c2) => c.Id);
if (!string.IsNullOrEmpty(request.OtherQueryCondition?.ContactInfo))
@ -614,30 +597,15 @@ public class ClientInfoService : ServiceBase, IClientInfoService
if (request.OtherQueryCondition != null && request.OtherQueryCondition.IsContractExpired.GetValueOrDefault())
query = query.Where((c, c1, c2) => SqlFunc.GetDate() > c2.EndDate);
if (request.OtherQueryCondition?.ClientTag != null)
if (request.OtherQueryCondition?.Attributes?.Length > 0)
{
//合并到主查询条件
var props = Array.FindAll(request.OtherQueryCondition.ClientTag.GetType().GetProperties(), x => x.Name.StartsWith("Is") && x.PropertyType == typeof(bool));
List<IConditionalModel> list = [];
foreach (var prop in props)
{
object val = prop.Get(request.OtherQueryCondition.ClientTag);
if (val != null && val is bool value && value)
{
list.Add(new ConditionalModel
{
ConditionalType = ConditionalType.Equal,
FieldName = "ct." + prop.Name,
FieldValue = "1"
});
}
}
query = query.Where(list);
query = query.Where((c, c1, c2) => SqlFunc.Subqueryable<InfoClientAttribute>().Where(ca =>
ca.ClientId == c.Id && request.OtherQueryCondition.Attributes.Contains(ca.Value)).Any());
}
//查询所有机构
query = query.ClearFilter<ISharedOrgId>();
var result = await query.Select((c, c1, c2, ct) => new ClientInfoRes
var result = await query.Select((c, c1, c2) => new ClientInfoRes
{
CodeName = c.CodeName,
Name = c.Name,
@ -710,6 +678,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService
data.Status = (int)StatusEnum.Disable;
data.AuditStatus = AuditStatusEnum.NoAudit;
data.OrgId = User.OrgId;
data.Attributes = req.Attributes;
if (string.IsNullOrEmpty(data.CodeName))
data.CodeName = PinYinUtil.GetFristLetter(data.ShortName); //助记码
@ -721,57 +690,65 @@ public class ClientInfoService : ServiceBase, IClientInfoService
if (!result.Succeeded)
return result;
if (req.Id == 0)
await TenantDb.Ado.BeginTranAsync();
try
{
var tag = req.ClientTag.Adapt<InfoClientTag>();
var entity = await TenantDb.Insertable(data).ExecuteReturnEntityAsync();
tag.ClientId = entity.Id;
await TenantDb.Insertable(tag).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}").ExecuteCommandAsync();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
if (req.Id == 0)
{
var entity = await TenantDb.Insertable(data).ExecuteReturnEntityAsync();
foreach (var item in data.Attributes)
item.ClientId = entity.Id;
await TenantDb.Insertable(data.Attributes).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}").ExecuteCommandAsync();
req.Id = entity.Id;
}
else
{
var model = await TenantDb.Queryable<InfoClient>().ClearFilter<ISharedOrgId>().Where(x => x.Id == req.Id)
.Select(x => new
{
x.Status,
x.AuditStatus
}).FirstAsync();
if (model != null && model.AuditStatus == AuditStatusEnum.Auditing)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ItemsAreAuditing));
data.ServiceItem ??= string.Empty;
var updateable = TenantDb.Updateable(data).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}")
.IgnoreColumns(x => new
{
x.OrgId,
x.Status,
x.ETD,
x.AuditStatus,
x.AuditNote,
x.AuditTime,
x.DeleteBy,
x.Deleted,
x.DeleteTime
});
var list = (await GetUsageAsync(req.Id))?.Data;
if (list != null && list.Exists(x => x.Id == req.Id && x.IsUsed))
updateable = updateable.IgnoreColumns(x => x.ShortName);
await updateable.ExecuteCommandAsync();
if (data.Attributes?.Count > 0)
{
await TenantDb.Deleteable<InfoClientAttribute>().Where(x => x.ClientId == req.Id).ExecuteCommandAsync();
await TenantDb.Insertable(data.Attributes).ExecuteCommandAsync();
}
}
await TenantDb.Ado.CommitTranAsync();
return DataResult.Successed("提交成功", req.Id, MultiLanguageConst.DataUpdateSuccess);
}
else
catch (Exception ex)
{
var model = await TenantDb.Queryable<InfoClient>().ClearFilter<ISharedOrgId>().Where(x => x.Id == req.Id)
.Select(x => new
{
x.Status,
x.AuditStatus
}).FirstAsync();
if (model != null && model.AuditStatus == AuditStatusEnum.Auditing)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ItemsAreAuditing));
var tag = TenantDb.Queryable<InfoClientTag>().Where(x => x.ClientId == req.Id).First();
tag = req.ClientTag.Adapt(tag);
data.ServiceItem ??= string.Empty;
var updateable = TenantDb.Updateable(data).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}")
.IgnoreColumns(x => new
{
x.OrgId,
x.Status,
x.ETD,
x.AuditStatus,
x.AuditNote,
x.AuditTime,
x.DeleteBy,
x.Deleted,
x.DeleteTime
});
var list = (await GetUsageAsync(req.Id))?.Data;
if (list != null && list.Exists(x => x.Id == req.Id && x.IsUsed))
updateable = updateable.IgnoreColumns(x => x.ShortName);
await updateable.ExecuteCommandAsync();
await TenantDb.Updateable(tag).IgnoreColumns(x => new
{
x.ClientId,
x.OrgId,
x.DeleteBy,
x.Deleted,
x.DeleteTime
}).ExecuteCommandAsync();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
await TenantDb.Ado.RollbackTranAsync();
await ex.LogAsync(Db);
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
}
@ -817,13 +794,13 @@ public class ClientInfoService : ServiceBase, IClientInfoService
public async Task<DataResult<ClientInfoRes>> GetAsync(long id)
{
TenantDb.QueryFilter.Clear<ISharedOrgId>();
var entity = await TenantDb.Queryable<InfoClient>().Where(a => a.Id == id).FirstAsync();
var entity = await TenantDb.Queryable<InfoClient>().Where(a => a.Id == id).Includes(a => a.Attributes).FirstAsync();
if (entity == null)
return DataResult<ClientInfoRes>.Success(null);
var data = entity.Adapt<ClientInfoRes>();
data.ServiceItemCodes = entity.ServiceItem?.Split(',', StringSplitOptions.RemoveEmptyEntries);
data.ClientTag = await TenantDb.Queryable<InfoClientTag>().Select<ClientTagRes>().FirstAsync(a => a.ClientId == id);
data.Attributes = entity.Attributes;
data.InvoiceHeaders ??= await TenantDb.Queryable<InvoiceHeader>().Where(x => x.RelativeId == data.Id).ToListAsync();
return DataResult<ClientInfoRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
@ -864,6 +841,8 @@ public class ClientInfoService : ServiceBase, IClientInfoService
await TenantDb.Deleteable<InfoClientAccountDate>().Where(x => req.Ids.Contains(x.ClientId)).ExecuteCommandAsync();
//收发货人
await TenantDb.Deleteable<InfoClientShipper>().Where(x => req.Ids.Contains(x.ClientId)).ExecuteCommandAsync();
//属性
await TenantDb.Deleteable<InfoClientAttribute>().Where(x => req.Ids.Contains(x.ClientId)).ExecuteCommandAsync();
//删除客户信息
await TenantDb.Deleteable<InfoClient>().RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}").Where(x => req.Ids.Contains(x.Id)).ExecuteCommandAsync();
@ -883,41 +862,17 @@ public class ClientInfoService : ServiceBase, IClientInfoService
/// <summary>
/// 获取往来单位详情(含有联系人列表)
/// </summary>
/// <param name="query">查询往来单位</param>
/// <param name="attributes">客户属性</param>
/// <returns>返回往来单位详情</returns>
public async Task<DataResult<ClientInfoRes>> GetClientInfoWithContact(QueryClientInfo query)
public async Task<DataResult<ClientInfoRes>> GetClientInfoWithContact(params string[] attributes)
{
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)
.WhereIF(query.IsCarrier, (c, t) => t.IsCarrier)
.WhereIF(query.IsBooking, (c, t) => t.IsBooking)
.WhereIF(query.IsYard, (c, t) => t.IsYard)
.WhereIF(query.IsTruck, (c, t) => t.IsTruck)
.WhereIF(query.IsCustom, (c, t) => t.IsCustom)
.WhereIF(query.IsAgent, (c, t) => t.IsAgent)
.WhereIF(query.IsAgentCn, (c, t) => t.IsAgentCn)
.WhereIF(query.IsExpress, (c, t) => t.IsExpress)
.WhereIF(query.IsAirLines, (c, t) => t.IsAirLines)
.WhereIF(query.IsShipper, (c, t) => t.IsShipper)
.WhereIF(query.IsConsignee, (c, t) => t.IsConsignee)
.WhereIF(query.IsNotifyParty, (c, t) => t.IsNotifyParty)
.WhereIF(query.IsWareHouse, (c, t) => t.IsWareHouse)
.WhereIF(query.IsWharf, (c, t) => t.IsWharf)
.WhereIF(query.IsInsurer, (c, t) => t.IsInsurer)
.WhereIF(query.IsLeasing, (c, t) => t.IsLeasing)
.WhereIF(query.IsTradingAgency, (c, t) => t.IsTradingAgency)
.WhereIF(query.IsOther, (c, t) => t.IsOther)
.WhereIF(!string.IsNullOrWhiteSpace(query.Others), (c, t) => t.Others == query.Others)
.WhereIF(query.IsShipAgency, (c, t) => t.IsShipAgency)
.WhereIF(query.IsEnterprise, (c, t) => t.IsEnterprise)
.Select((c, t) => new { Client = c, tag = t })
var data = await TenantDb.Queryable<InfoClient>().Includes(c => c.Attributes)
.WhereIF(attributes.Length > 0, c => SqlFunc.Subqueryable<InfoClientAttribute>().Where(a =>
a.ClientId == c.Id && attributes.Contains(a.Value)).Any())
.FirstAsync();
var clientInfo = data.Client.Adapt<ClientInfoRes>();
clientInfo.ClientTag = data.tag.Adapt<ClientTagRes>();
var clientInfo = data.Adapt<ClientInfoRes>();
clientInfo.Attributes = data.Attributes;
var contactList = TenantDb.Queryable<InfoClientContact>()
.Where(a => a.ClientId == clientInfo.Id && a.Status == StatusEnum.Enable).ToList();

@ -2388,7 +2388,7 @@ namespace DS.WMS.Core.Op.Method
if (model.CustomerContactList != null && model.CustomerContactList.Count > 0)
{
//取委托客户下面所有的联系人列表
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact(new Info.Dtos.QueryClientInfo { ClientId = model.CustomerId.Value, IsController = true }).GetAwaiter().GetResult().Data;
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact("isController").GetAwaiter().GetResult().Data;
if (djyCustomerInfo == null)
{
@ -2724,7 +2724,7 @@ namespace DS.WMS.Core.Op.Method
var bookingContactList = tenantDb.Queryable<BusinessOrderContact>()
.Where(a => a.BusinessId == id && a.Deleted == false).ToList();
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact(new Info.Dtos.QueryClientInfo { ClientId = generateModel.CustomerId.Value, IsController = true })
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact("isController")
.GetAwaiter().GetResult().Data;

@ -501,7 +501,7 @@ namespace DS.WMS.Core.Op.Method
});
//取委托客户下面所有的联系人列表
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact(new Info.Dtos.QueryClientInfo { ClientId = order.CustomerId, IsController = true }).GetAwaiter().GetResult().Data;
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact("isController").GetAwaiter().GetResult().Data;
if (djyCustomerInfo == null)
{

@ -168,127 +168,6 @@ public interface IClientCommonService
/// <param name="type"></param>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAllClientList(long? id = null, string? type = null);
/// <summary>
/// 获取船公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetCarrierClientList();
/// <summary>
/// 获取场站下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetYardClientList();
/// <summary>
/// 获取订舱公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetBookingClientList();
/// <summary>
/// 获取车队下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetTruckClientList();
/// <summary>
/// 获取委托单位下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetControllerClientList();
/// <summary>
/// 获取报关行下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetCustomClientList();
/// <summary>
/// 获取代理(国外)下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAgentClientList();
/// <summary>
/// 获取代理(国内)下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAgentCnClientList();
/// <summary>
/// 获取快递公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetExpressClientList();
/// <summary>
/// 获取航空公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAirLinesClientList();
/// <summary>
/// 获取发货人下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetShipperClientList();
/// <summary>
/// 获取收货人下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetConsigneeClientList();
/// <summary>
/// 获取通知人下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetNotifyPartyClientList();
/// <summary>
/// 获取仓库下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetWareHouseClientList();
/// <summary>
/// 获取码头下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetWharfClientList();
/// <summary>
/// 获取保险公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetInsurerClientList();
/// <summary>
/// 获取租箱公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetLeasingClientList();
/// <summary>
/// 获取贸易代理下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetTradingAgencyClientList();
/// <summary>
/// 获取船代下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetShipAgencyClientList();
/// <summary>
/// 获取经营单位下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetEnterpriseClientList();
/// <summary>
/// 获取部门列表

@ -1,4 +1,3 @@
using Amazon.Runtime.Internal;
using DS.Module.Core;
using DS.Module.Core.Constants;
using DS.Module.Core.Data;
@ -12,10 +11,8 @@ using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Method;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
@ -25,8 +22,6 @@ using Masuit.Tools;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using System.Collections.Generic;
using System.Linq;
namespace DS.WMS.Core.Sys.Method;
@ -78,10 +73,11 @@ public class ClientCommonService : IClientCommonService
public async Task<DataResult<List<BankRes>>> GetBankListAsync(string? orgId, string? queryKey = null)
{
var list = await db.Queryable<SysBank>().Where(x => x.Status == StatusEnum.Enable)
.WhereIF(!string.IsNullOrEmpty(orgId),x => x.LinkId == long.Parse(orgId))
.WhereIF(!string.IsNullOrEmpty(queryKey), x => x.BankName.Contains(queryKey)|| x.AccountName.Contains(queryKey)|| x.BankAccountNo.Contains(queryKey))
.WhereIF(!string.IsNullOrEmpty(orgId), x => x.LinkId == long.Parse(orgId))
.WhereIF(!string.IsNullOrEmpty(queryKey), x => x.BankName.Contains(queryKey) || x.AccountName.Contains(queryKey) || x.BankAccountNo.Contains(queryKey))
.Select<BankRes>()
.Mapper(it=> {
.Mapper(it =>
{
it.PinYinCode = it.BankName + "(" + it.BankAccountNo + ")";
})
@ -252,11 +248,11 @@ public class ClientCommonService : IClientCommonService
var queryData0 = tenantDb.UnionAll(queryData1, queryData2);
//code = code.ToLower();
var data = await queryData0
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsController == true) //&& c.CreateBy == long.Parse(user.UserId) && c.StartDate <= DateTime.Now && c.EndDate >= DateTime.Now
.Where((a) => a.Status == StatusEnum.Enable.ToEnumInt() && SqlFunc.Subqueryable<InfoClientAttribute>().Where(
b => b.ClientId == a.Id && b.Value == "isController").Any()) //&& c.CreateBy == long.Parse(user.UserId) && c.StartDate <= DateTime.Now && c.EndDate >= DateTime.Now
.WhereIF(!string.IsNullOrEmpty(queryKey), (a, b) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey) || a.Description.Contains(queryKey))
.Select((a, b) => new ControllerClientRes
.WhereIF(!string.IsNullOrEmpty(queryKey), (a) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey) || a.Description.Contains(queryKey))
.Select((a) => new ControllerClientRes
{
Id = a.Id,
PinYinCode = a.ShortName + "(" + a.Description + ")" + " " + a.CodeName,
@ -301,7 +297,7 @@ public class ClientCommonService : IClientCommonService
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = await tenantDb.Queryable<CodeCarrier>()
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.Code.Contains(queryKey) || a.CnName.Contains(queryKey) || a.EnName.Contains(queryKey) || a.CnShortName.Contains(queryKey) )
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.Code.Contains(queryKey) || a.CnName.Contains(queryKey) || a.EnName.Contains(queryKey) || a.CnShortName.Contains(queryKey))
.Select(a => new CodeCarrierRes()
{
PinYinCode = a.Code + "(" + a.CnName + ")",
@ -682,7 +678,7 @@ public class ClientCommonService : IClientCommonService
.ToList();
var carrier = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsCarrier == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isCarrier").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -700,7 +696,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("carrier", carrier));
var yard = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsYard == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isYard").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -718,7 +714,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("yard", yard));
var booking = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsBooking == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isBooking").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -736,7 +732,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("booking", booking));
var truck = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsTruck == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isTruck").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -754,7 +750,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("truck", truck));
var controller = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsController == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isController").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -772,7 +768,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("controller", controller));
var custom = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsCustom == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isCustom").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -790,7 +786,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("custom", custom));
var agent = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsAgent == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isAgent").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -808,7 +804,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("agent", agent));
var agentcn = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsAgentCn == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isAgentCn").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -826,7 +822,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("agentcn", agentcn));
var express = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsExpress == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isExpress").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -844,7 +840,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("express", express));
var airlines = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsAirLines == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isAirLines").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -862,7 +858,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("airlines", airlines));
var shipper = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsShipper == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isShipper").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -880,7 +876,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("shipper", shipper));
var shippercn = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsShipperCn == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isShipperCn").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -898,7 +894,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("shippercn", shippercn));
var notifyparty = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsNotifyParty == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isNotifyParty").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -917,7 +913,7 @@ public class ClientCommonService : IClientCommonService
var warehouse = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsWareHouse == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isWareHouse").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -936,7 +932,7 @@ public class ClientCommonService : IClientCommonService
var wharf = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsWharf == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isWharf").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -954,7 +950,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("wharf", wharf));
var insurer = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsInsurer == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isInsurer").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -972,7 +968,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("insurer", insurer));
var leasing = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsLeasing == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isLeasing").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -990,7 +986,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("leasing", leasing));
var tradingagency = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsTradingAgency == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isTradingAgency").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -1008,7 +1004,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("tradingagency", tradingagency));
var shipagency = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsShipAgency == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isShipAgency").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -1026,7 +1022,7 @@ public class ClientCommonService : IClientCommonService
data.Add(new ClientSelectMultiRes("shipagency", shipagency));
var enterprise = await tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientTag>().Where(s => s.ClientId == a.Id && s.IsEnterprise == true).Any())
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt()).Where(a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(s => s.ClientId == a.Id && s.Value == "isEnterprise").Any())
.Select(a => new ClientSelectRes
{
Id = a.Id,
@ -1334,7 +1330,7 @@ public class ClientCommonService : IClientCommonService
{
foreach (var item1 in item.ConditionalList)
{
var temp = item1.Value as SqlSugar.ConditionalModel;
var temp = item1.Value as ConditionalModel;
if (temp.FieldName == "Stakeholders")
{
userids = temp.FieldValue.Split(',').ToList();
@ -1356,31 +1352,11 @@ public class ClientCommonService : IClientCommonService
var queryData0 = tenantDb.UnionAll(queryData1, queryData2);
//code = code.ToLower();
var data = await queryData0//tenantDb.Queryable<InfoClient>()//.Where(a=> tenantDb.Ado.SqlQuery<dynamic>(sql, new SugarParameter($"@ClientId", a.Id)).Contains(user.UserId))
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() || SqlFunc.Subqueryable<InfoClientStakeholder>().Where("SYSDATE() BETWEEN StartDate and EndDate").Where(c => c.ClientId == a.Id && userids.Contains(c.CreateBy.ToString())).Any())
.WhereIF(!string.IsNullOrEmpty(code) && code == "carrier", (a, b) => b.IsCarrier == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "yard", (a, b) => b.IsYard == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "booking", (a, b) => b.IsBooking == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "truck", (a, b) => b.IsTruck == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "controller", (a, b) => b.IsController == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "custom", (a, b) => b.IsCustom == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "agent", (a, b) => b.IsAgent == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "agentcn", (a, b) => b.IsAgentCn == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "express", (a, b) => b.IsExpress == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "airlines", (a, b) => b.IsAirLines == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shipper", (a, b) => b.IsShipper == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shippercn", (a, b) => b.IsShipperCn == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "notifyparty", (a, b) => b.IsNotifyParty == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "warehouse", (a, b) => b.IsWareHouse == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "wharf", (a, b) => b.IsWharf == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "insurer", (a, b) => b.IsInsurer == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "leasing", (a, b) => b.IsLeasing == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "tradingagency", (a, b) => b.IsTradingAgency == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shipagency", (a, b) => b.IsShipAgency == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "enterprise", (a, b) => b.IsEnterprise == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "contract", (a, b) => b.IsContract == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), (a, b) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey) || a.Description.Contains(queryKey))
.Select((a, b) => new ClientSelectRes
.Where((a) => a.Status == StatusEnum.Enable.ToEnumInt() || SqlFunc.Subqueryable<InfoClientStakeholder>().Where("SYSDATE() BETWEEN StartDate and EndDate").Where(c => c.ClientId == a.Id && userids.Contains(c.CreateBy.ToString())).Any())
.WhereIF(!string.IsNullOrEmpty(code), a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(
b => b.ClientId == a.Id && b.Value == code).Any())
.WhereIF(!string.IsNullOrEmpty(queryKey), (a) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey) || a.Description.Contains(queryKey))
.Select((a) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
@ -1412,7 +1388,7 @@ public class ClientCommonService : IClientCommonService
var conditions = new List<IConditionalModel>();
var otherConditions = new List<IConditionalModel>();
var queryData = tenantDb.Queryable<InfoClient>().ClearFilter<ISharedOrgId>().Where(c => c.Status == StatusEnum.Enable.ToEnumInt() && c.IsCustomer == true);
var scope = string.Empty;
(conditions, scope, otherConditions) = await commonService.GetSpecialVisibleDataRuleFilter<InfoClient>(queryData, tenantDb);
var userids = new List<string>();
@ -1425,7 +1401,7 @@ public class ClientCommonService : IClientCommonService
{
foreach (var item1 in item.ConditionalList)
{
var temp = item1.Value as SqlSugar.ConditionalModel;
var temp = item1.Value as ConditionalModel;
if (temp.FieldName == "Stakeholders")
{
userids = temp.FieldValue.Split(',').ToList();
@ -1445,34 +1421,14 @@ public class ClientCommonService : IClientCommonService
var queryData1 = tenantDb.Queryable<InfoClient>().ClearFilter<ISharedOrgId>().Where(c => c.Status == StatusEnum.Enable.ToEnumInt() && c.IsCustomer == true).Where(exp.ToExpression());
var queryData2 = queryData.Where(conditions);
var queryData3 = tenantDb.Queryable<InfoClient>().ClearFilter<ISharedOrgId>().Where(c => c.Status == StatusEnum.Enable.ToEnumInt() && c.IsSupplier == true);
var queryData0 = tenantDb.UnionAll(queryData1, queryData2, queryData3);
var queryData0 = tenantDb.UnionAll(queryData1, queryData2, queryData3);
//code = code.ToLower();
var data = await queryData0
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() || SqlFunc.Subqueryable<InfoClientStakeholder>().Where("SYSDATE() BETWEEN StartDate and EndDate").Where(c => c.ClientId == a.Id && userids.Contains(c.CreateBy.ToString())).Any())
.WhereIF(!string.IsNullOrEmpty(code) && code == "carrier", (a, b) => b.IsCarrier == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "yard", (a, b) => b.IsYard == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "booking", (a, b) => b.IsBooking == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "truck", (a, b) => b.IsTruck == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "controller", (a, b) => b.IsController == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "custom", (a, b) => b.IsCustom == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "agent", (a, b) => b.IsAgent == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "agentcn", (a, b) => b.IsAgentCn == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "express", (a, b) => b.IsExpress == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "airlines", (a, b) => b.IsAirLines == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shipper", (a, b) => b.IsShipper == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shippercn", (a, b) => b.IsShipperCn == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "notifyparty", (a, b) => b.IsNotifyParty == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "warehouse", (a, b) => b.IsWareHouse == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "wharf", (a, b) => b.IsWharf == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "insurer", (a, b) => b.IsInsurer == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "leasing", (a, b) => b.IsLeasing == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "tradingagency", (a, b) => b.IsTradingAgency == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shipagency", (a, b) => b.IsShipAgency == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "enterprise", (a, b) => b.IsEnterprise == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "contract", (a, b) => b.IsContract == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), (a, b) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey) || a.Description.Contains(queryKey))
.Select((a, b) => new ClientSelectRes
.Where((a) => a.Status == StatusEnum.Enable.ToEnumInt() || SqlFunc.Subqueryable<InfoClientStakeholder>().Where("SYSDATE() BETWEEN StartDate and EndDate").Where(c => c.ClientId == a.Id && userids.Contains(c.CreateBy.ToString())).Any())
.WhereIF(!string.IsNullOrEmpty(code), a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(
b => b.ClientId == a.Id && b.Value == code).Any())
.WhereIF(!string.IsNullOrEmpty(queryKey), (a) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey) || a.Description.Contains(queryKey))
.Select((a) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
@ -1486,8 +1442,8 @@ public class ClientCommonService : IClientCommonService
)
.ClearFilter<ISharedOrgId>().MergeTable()
.OrderBy(x => x.CodeName).Distinct().Take(20).WithCache($"{SqlSugarCacheConst.AllClient}{user.TenantId}", SqlSugarCacheConst.CacheDurationInSeconds).ToListAsync();
return await Task.FromResult(DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess));
}
/// <summary>
@ -1499,31 +1455,11 @@ public class ClientCommonService : IClientCommonService
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//code = code.ToLower();
var data = await tenantDb.Queryable<InfoClient>().ClearFilter<ISharedOrgId>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt())
.WhereIF(!string.IsNullOrEmpty(code) && code == "carrier", (a, b) => b.IsCarrier == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "yard", (a, b) => b.IsYard == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "booking", (a, b) => b.IsBooking == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "truck", (a, b) => b.IsTruck == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "controller", (a, b) => b.IsController == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "custom", (a, b) => b.IsCustom == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "agent", (a, b) => b.IsAgent == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "agentcn", (a, b) => b.IsAgentCn == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "express", (a, b) => b.IsExpress == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "airlines", (a, b) => b.IsAirLines == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shipper", (a, b) => b.IsShipper == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shippercn", (a, b) => b.IsShipperCn == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "notifyparty", (a, b) => b.IsNotifyParty == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "warehouse", (a, b) => b.IsWareHouse == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "wharf", (a, b) => b.IsWharf == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "insurer", (a, b) => b.IsInsurer == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "leasing", (a, b) => b.IsLeasing == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "tradingagency", (a, b) => b.IsTradingAgency == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shipagency", (a, b) => b.IsShipAgency == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "enterprise", (a, b) => b.IsEnterprise == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "contract", (a, b) => b.IsContract == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), (a, b) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey) || a.Description.Contains(queryKey))
.Select((a, b) => new ClientSelectRes
.Where((a) => a.Status == StatusEnum.Enable.ToEnumInt())
.WhereIF(!string.IsNullOrEmpty(code), a => SqlFunc.Subqueryable<InfoClientAttribute>().Where(
b => b.ClientId == a.Id && b.Value == code).Any())
.WhereIF(!string.IsNullOrEmpty(queryKey), (a) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey) || a.Description.Contains(queryKey))
.Select((a) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
@ -1566,7 +1502,7 @@ public class ClientCommonService : IClientCommonService
});
}
var data = tenantDb.Queryable<InfoClient>().InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
var data = tenantDb.Queryable<InfoClient>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt())
.Where(conditions)
.WhereIF(id.GetValueOrDefault() > 0, a => a.Id != id)
@ -1582,429 +1518,6 @@ public class ClientCommonService : IClientCommonService
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
#region 废弃
/// <summary>
/// 获取船公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetCarrierClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsCarrier == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取场站下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetYardClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsYard == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取订舱公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetBookingClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsBooking == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取车队下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetTruckClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsTruck == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取委托单位下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetControllerClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsController == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取报关行下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetCustomClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsCustom == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取代理(国外)下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAgentClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsAgent == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取代理(国内)下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAgentCnClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsAgentCn == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取快递公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetExpressClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsExpress == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取航空公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAirLinesClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsAirLines == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取发货人下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetShipperClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsShipper == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取收货人下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetConsigneeClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsConsignee == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取通知人下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetNotifyPartyClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsNotifyParty == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取仓库下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetWareHouseClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsWareHouse == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取码头下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetWharfClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsWharf == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取保险公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetInsurerClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsInsurer == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取租箱公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetLeasingClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsLeasing == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取贸易代理下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetTradingAgencyClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsTradingAgency == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取船代下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetShipAgencyClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsShipAgency == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取经营单位下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetEnterpriseClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsEnterprise == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
#endregion
/// <summary>
/// 获取签单方式下拉列表
/// </summary>

@ -608,7 +608,7 @@ namespace DS.WMS.Core.TaskPlat.Method
if (model.CustomerContactList != null && model.CustomerContactList.Count > 0)
{
//取委托客户下面所有的联系人列表
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact(new Info.Dtos.QueryClientInfo { ClientId = model.CustomerId.Value, IsController = true }).GetAwaiter().GetResult().Data;
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact("isController").GetAwaiter().GetResult().Data;
if (djyCustomerInfo == null)
{
@ -1047,7 +1047,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var bookingContactList = await tenantDb.Queryable<BusinessOrderContact>()
.Where(a => a.BusinessId == bookingOrderId && a.Deleted == false).ToListAsync();
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact(new Info.Dtos.QueryClientInfo { ClientId = generateModel.CustomerId.Value, IsController = true })
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact("isController")
.GetAwaiter().GetResult().Data;
generateModel.CustomerContactList.ForEach(contact =>
@ -1646,7 +1646,7 @@ namespace DS.WMS.Core.TaskPlat.Method
throw new Exception($"订舱的委托客户不能为空");
}
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact(new Info.Dtos.QueryClientInfo { ClientId = bookingOrderEntity.CustomerId })
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact()
.GetAwaiter().GetResult().Data;
if (djyCustomerInfo == null)

@ -364,226 +364,7 @@ public class ClientCommonController : ApiController
var res = _invokeService.GetAllClientList(id, type);
return res;
}
/// <summary>
/// 获取船公司下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetCarrierClientList")]
public DataResult<List<ClientSelectRes>> GetCarrierClientList()
{
var res = _invokeService.GetCarrierClientList();
return res;
}
/// <summary>
/// 获取场站下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetYardClientList")]
public DataResult<List<ClientSelectRes>> GetYardClientList()
{
var res = _invokeService.GetYardClientList();
return res;
}
/// <summary>
/// 获取订舱公司下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetBookingClientList")]
public DataResult<List<ClientSelectRes>> GetBookingClientList()
{
var res = _invokeService.GetBookingClientList();
return res;
}
/// <summary>
/// 获取车队下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetTruckClientList")]
public DataResult<List<ClientSelectRes>> GetTruckClientList()
{
var res = _invokeService.GetTruckClientList();
return res;
}
/// <summary>
/// 获取委托单位下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetControllerClientList")]
public DataResult<List<ClientSelectRes>> GetControllerClientList()
{
var res = _invokeService.GetControllerClientList();
return res;
}
/// <summary>
/// 获取报关行下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetCustomClientList")]
public DataResult<List<ClientSelectRes>> GetCustomClientList()
{
var res = _invokeService.GetCustomClientList();
return res;
}
/// <summary>
/// 获取代理(国外)下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetAgentClientList")]
public DataResult<List<ClientSelectRes>> GetAgentClientList()
{
var res = _invokeService.GetAgentClientList();
return res;
}
/// <summary>
/// 获取代理(国内)下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetAgentCnClientList")]
public DataResult<List<ClientSelectRes>> GetAgentCnClientList()
{
var res = _invokeService.GetAgentCnClientList();
return res;
}
/// <summary>
/// 获取快递公司下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetExpressClientList")]
public DataResult<List<ClientSelectRes>> GetExpressClientList()
{
var res = _invokeService.GetExpressClientList();
return res;
}
/// <summary>
/// 获取航空公司下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetAirLinesClientList")]
public DataResult<List<ClientSelectRes>> GetAirLinesClientList()
{
var res = _invokeService.GetAirLinesClientList();
return res;
}
/// <summary>
/// 获取发货人下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetShipperClientList")]
public DataResult<List<ClientSelectRes>> GetShipperClientList()
{
var res = _invokeService.GetShipperClientList();
return res;
}
/// <summary>
/// 获取收货人下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetConsigneeClientList")]
public DataResult<List<ClientSelectRes>> GetConsigneeClientList()
{
var res = _invokeService.GetConsigneeClientList();
return res;
}
/// <summary>
/// 获取通知人下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetNotifyPartyClientList")]
public DataResult<List<ClientSelectRes>> GetNotifyPartyClientList()
{
var res = _invokeService.GetNotifyPartyClientList();
return res;
}
/// <summary>
/// 获取仓库下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetWareHouseClientList")]
public DataResult<List<ClientSelectRes>> GetWareHouseClientList()
{
var res = _invokeService.GetWareHouseClientList();
return res;
}
/// <summary>
/// 获取保险公司下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetInsurerClientList")]
public DataResult<List<ClientSelectRes>> GetInsurerClientList()
{
var res = _invokeService.GetInsurerClientList();
return res;
}
/// <summary>
/// 获取租箱公司下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetLeasingClientList")]
public DataResult<List<ClientSelectRes>> GetLeasingClientList()
{
var res = _invokeService.GetLeasingClientList();
return res;
}
/// <summary>
/// 获取贸易代理下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetTradingAgencyClientList")]
public DataResult<List<ClientSelectRes>> GetTradingAgencyClientList()
{
var res = _invokeService.GetTradingAgencyClientList();
return res;
}
/// <summary>
/// 获取船代下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetShipAgencyClientList")]
public DataResult<List<ClientSelectRes>> GetShipAgencyClientList()
{
var res = _invokeService.GetShipAgencyClientList();
return res;
}
/// <summary>
/// 获取经营单位下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetEnterpriseClientList")]
public DataResult<List<ClientSelectRes>> GetEnterpriseClientList()
{
var res = _invokeService.GetEnterpriseClientList();
return res;
}
/// <summary>
/// 获取码头下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetWharfClientList")]
public DataResult<List<ClientSelectRes>> GetWharfClientList()
{
var res = _invokeService.GetWharfClientList();
return res;
}
/// <summary>
/// 获取部门列表
/// </summary>

@ -3,13 +3,19 @@ using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Enums;
using DS.Module.Core.Extensions;
using DS.WMS.Core;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Info.Interface;
using DS.WMS.Core.Sys.Entity;
using Fasterflect;
using Masuit.Tools.Systems;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using MiniExcelLibs;
using SqlSugar;
namespace DS.WMS.MainApi.Controllers;
@ -29,6 +35,80 @@ public class ClientInfoController : ApiController
_invokeService = invokeService;
}
///// <summary>
///// 迁移客户属性
///// </summary>
///// <param name="db"></param>
///// <returns></returns>
//[HttpPost, Route("MigrateAttributes"), AllowAnonymous]
//public async Task<DataResult> MigrateAttributesAsync([FromServices] ISqlSugarClient db)
//{
// var dbLinks = await db.Queryable<Module.SqlSugar.SysTenantLink>().ToListAsync();
// SqlSugarClient? tenantDb = null;
// try
// {
// var dicList = await db.Queryable<SysDictData>().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id)
// .Where((d, t) => t.Code == "infoclient-ArrclientTag")
// .Select((d, t) => new SysDictData
// {
// Name = d.Name,
// Value = d.Value,
// ArName = d.Value,
// }).ToListAsync();
// foreach (var dic in dicList)
// dic.ArName = dic.ArName.ToUpperCamelCase();
// List<InfoClientAttribute> attributes = [];
// foreach (var dbLink in dbLinks)
// {
// tenantDb = new SqlSugarClient(new ConnectionConfig
// {
// ConfigId = dbLink.Id,
// ConnectionString = dbLink.Connection,
// DbType = dbLink.DbType,
// IsAutoCloseConnection = true
// });
// var tagList = await tenantDb.Queryable<InfoClientTag>().ToListAsync();
// foreach (var tag in tagList)
// {
// foreach (var item in dicList)
// {
// object value = PropertyExtensions.GetPropertyValue(tag, item.ArName);
// if (value != null && value is bool boolVal && boolVal)
// {
// var attribute = new InfoClientAttribute
// {
// Id = SnowFlakeSingle.Instance.NextId(),
// ClientId = tag.ClientId,
// Name = item.Name,
// Value = item.Value
// };
// attributes.Add(attribute);
// }
// }
// }
// if (attributes.Count > 0)
// {
// await tenantDb.Fastest<InfoClientAttribute>().BulkCopyAsync(attributes);
// attributes.Clear();
// }
// }
// return DataResult.Success;
// }
// catch (Exception ex)
// {
// await ex.LogAsync(db);
// return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
// }
// finally
// {
// tenantDb?.Dispose();
// }
//}
/// <summary>
/// 提交审核
/// </summary>
@ -170,13 +250,13 @@ public class ClientInfoController : ApiController
/// <summary>
/// 获取往来单位详情(含有联系人列表)
/// </summary>
/// <param name="query">查询往来单位</param>
/// <param name="attributes">客户属性</param>
/// <returns>返回往来单位详情</returns>
[HttpPost]
[Route("GetClientInfoWithContact")]
public async Task<DataResult<ClientInfoRes>> GetClientInfoWithContact([FromBody] QueryClientInfo query)
public async Task<DataResult<ClientInfoRes>> GetClientInfoWithContact([FromBody] params string[] attributes)
{
return await _invokeService.GetClientInfoWithContact(query);
return await _invokeService.GetClientInfoWithContact(attributes);
}
/// <summary>

Loading…
Cancel
Save