EDI设置修改

optimize
wanghaomei 2 years ago
parent 8a03945837
commit 9a5681151c

@ -111,5 +111,13 @@ namespace Myshipping.Core.Entity
/// 租户名称 /// 租户名称
/// </summary> /// </summary>
public string TenantName { get; set; } public string TenantName { get; set; }
/// <summary>
/// 发送类型
/// </summary>
public string SendType { get; set; }
/// <summary>
/// 启用标志
/// </summary>
public bool EnableFlag { get; set; } = true;
} }
} }

@ -2034,6 +2034,16 @@
租户名称 租户名称
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.Entity.DjyEdiSetting.SendType">
<summary>
发送类型
</summary>
</member>
<member name="P:Myshipping.Core.Entity.DjyEdiSetting.EnableFlag">
<summary>
启用标志
</summary>
</member>
<member name="T:Myshipping.Core.Entity.DjyTenantConfig"> <member name="T:Myshipping.Core.Entity.DjyTenantConfig">
<summary> <summary>
@ -10766,18 +10776,32 @@
</member> </member>
<member name="M:Myshipping.Core.Service.DjyEdiSettingService.Add(Myshipping.Core.AddDjyEdiSettingInput)"> <member name="M:Myshipping.Core.Service.DjyEdiSettingService.Add(Myshipping.Core.AddDjyEdiSettingInput)">
<summary> <summary>
增加EDI参数设置 增加EDI参数设置准备作废使用save接口代替
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.DjyEdiSettingService.Save(Myshipping.Core.UpdateDjyEdiSettingInput)">
<summary>
保存EDI参数设置
</summary> </summary>
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.DjyEdiSettingService.Update(Myshipping.Core.UpdateDjyEdiSettingInput)"> <member name="M:Myshipping.Core.Service.DjyEdiSettingService.Update(Myshipping.Core.UpdateDjyEdiSettingInput)">
<summary> <summary>
更新EDI参数设置 更新EDI参数设置准备作废使用save接口代替
</summary> </summary>
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.DjyEdiSettingService.SetEnable(System.Int64)">
<summary>
设置启用启用后同船司、同发送类型的其他EDI通道会被取消启用
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.DjyEdiSettingService.Delete(Myshipping.Core.GetDjyEdiSettingInput)"> <member name="M:Myshipping.Core.Service.DjyEdiSettingService.Delete(Myshipping.Core.GetDjyEdiSettingInput)">
<summary> <summary>
删除EDI参数设置 删除EDI参数设置
@ -15474,6 +15498,11 @@
租户名称 租户名称
</summary> </summary>
</member> </member>
<member name="P:Myshipping.Core.DjyEdiSettingInput.SendType">
<summary>
发送类型
</summary>
</member>
<member name="T:Myshipping.Core.AddDjyEdiSettingInput"> <member name="T:Myshipping.Core.AddDjyEdiSettingInput">
<summary> <summary>
EDI参数设置新增输入参数 EDI参数设置新增输入参数

@ -49,7 +49,7 @@ namespace Myshipping.Core.Service
} }
/// <summary> /// <summary>
/// 增加EDI参数设置 /// 增加EDI参数设置准备作废使用save接口代替
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
@ -58,20 +58,80 @@ namespace Myshipping.Core.Service
{ {
var cc = _rep.AsQueryable() var cc = _rep.AsQueryable()
.Filter(null, true) .Filter(null, true)
.Count(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId && x.CARRIERID == input.CARRIERID); .Count(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId && x.CARRIERID == input.CARRIERID && x.SendType == input.SendType);
if (cc > 0) if (cc > 0)
{ {
throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE}相同船司({input.CARRIERID})的参数设置"); throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE}相同船司({input.CARRIERID})、相同发送类型({input.SendType})的参数设置");
} }
var entity = input.Adapt<DjyEdiSetting>(); var entity = input.Adapt<DjyEdiSetting>();
await _rep.InsertAsync(entity); await _rep.InsertAsync(entity);
await CacheData(); await CacheData();
return entity.Id; return entity.Id;
} }
/// <summary> /// <summary>
/// 更新EDI参数设置 /// 保存EDI参数设置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/DjyEdiSetting/save")]
public async Task<long> Save(UpdateDjyEdiSettingInput input)
{
DjyEdiSetting entity = null;
if (input.Id == 0) //新增
{
var cc = _rep.AsQueryable()
.Filter(null, true)
.Count(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId && x.CARRIERID == input.CARRIERID && x.SendType == input.SendType);
if (cc > 0)
{
throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE})、相同船司({input.CARRIERID})、相同发送类型({input.SendType})的参数设置");
}
entity = input.Adapt<DjyEdiSetting>();
await _rep.InsertAsync(entity);
//其他同船司、同发送类型的都禁用
var otherList = _rep.Where(x => x.TenantId == input.TenantId && x.CARRIERID == input.CARRIERID && x.Id != entity.Id).ToList();
foreach (var item in otherList)
{
item.EnableFlag = false;
await _rep.UpdateAsync(item);
}
}
else
{
entity = _rep.AsQueryable()
.Filter(null, true)
.First(x => x.Id == input.Id);
if (entity == null)
{
throw Oops.Bah($"未找到数据");
}
var cc = _rep.AsQueryable().Filter(null, true)
.Count(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId && x.CARRIERID == input.CARRIERID && x.SendType == input.SendType && x.Id != input.Id);
if (cc > 0)
{
throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE})、相同船司({input.CARRIERID})、相同发送类型({input.SendType})的参数设置");
}
entity = input.Adapt(entity);
await _rep.UpdateAsync(entity);
}
await CacheData();
return entity.Id;
}
/// <summary>
/// 更新EDI参数设置准备作废使用save接口代替
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
@ -87,10 +147,10 @@ namespace Myshipping.Core.Service
} }
var cc = _rep.AsQueryable().Filter(null, true) var cc = _rep.AsQueryable().Filter(null, true)
.Count(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId && x.CARRIERID == input.CARRIERID && x.Id != input.Id); .Count(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId && x.CARRIERID == input.CARRIERID && x.SendType == input.SendType && x.Id != input.Id);
if (cc > 0) if (cc > 0)
{ {
throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE}相同船司({input.CARRIERID})的参数设置"); throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE}相同船司({input.CARRIERID})、相同发送类型({input.SendType})的参数设置");
} }
entity = input.Adapt(entity); entity = input.Adapt(entity);
@ -100,6 +160,35 @@ namespace Myshipping.Core.Service
return entity.Id; return entity.Id;
} }
/// <summary>
/// 设置启用启用后同船司、同发送类型的其他EDI通道会被取消启用
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("/DjyEdiSetting/SetEnable")]
public async Task SetEnable(long id)
{
var entity = _rep.AsQueryable()
.Filter(null, true)
.First(x => x.Id == id);
if (entity == null)
{
throw Oops.Bah($"未找到数据");
}
entity.EnableFlag = true;
await _rep.UpdateAsync(entity);
//其他同船司、同发送类型的都禁用
var otherList = _rep.Where(x => x.TenantId == entity.TenantId && x.CARRIERID == entity.CARRIERID && x.Id != entity.Id).ToList();
foreach (var item in otherList)
{
item.EnableFlag = false;
await _rep.UpdateAsync(item);
}
}
/// <summary> /// <summary>
/// 删除EDI参数设置 /// 删除EDI参数设置
/// </summary> /// </summary>
@ -141,7 +230,7 @@ namespace Myshipping.Core.Service
{ {
if (!_cacheService.Exists(CommonConst.CACHE_KEY_DJY_EDI_SETTING)) if (!_cacheService.Exists(CommonConst.CACHE_KEY_DJY_EDI_SETTING))
{ {
var list = _rep.AsQueryable().Filter(null, true).OrderBy(x=>x.EDINAME).ToList(); var list = _rep.AsQueryable().Filter(null, true).OrderBy(x => x.EDINAME).ToList();
await _cacheService.SetAllEdiSetting(list); await _cacheService.SetAllEdiSetting(list);
} }
} }

@ -13,132 +13,136 @@ namespace Myshipping.Core
/// EDI类型代码 /// EDI类型代码
/// </summary> /// </summary>
public virtual string EDICODE { get; set; } public virtual string EDICODE { get; set; }
/// <summary> /// <summary>
/// EDI类型名称 /// EDI类型名称
/// </summary> /// </summary>
public virtual string EDINAME { get; set; } public virtual string EDINAME { get; set; }
/// <summary> /// <summary>
/// 服务器IP /// 服务器IP
/// </summary> /// </summary>
public virtual string SERVERIP { get; set; } public virtual string SERVERIP { get; set; }
/// <summary> /// <summary>
/// 文件夹 /// 文件夹
/// </summary> /// </summary>
public virtual string FOLDERNAME { get; set; } public virtual string FOLDERNAME { get; set; }
/// <summary> /// <summary>
/// 用户名 /// 用户名
/// </summary> /// </summary>
public virtual string USERNAME { get; set; } public virtual string USERNAME { get; set; }
/// <summary> /// <summary>
/// 密码 /// 密码
/// </summary> /// </summary>
public virtual string PASSWORD { get; set; } public virtual string PASSWORD { get; set; }
/// <summary> /// <summary>
/// 发送方代码 /// 发送方代码
/// </summary> /// </summary>
public virtual string SENDCODE { get; set; } public virtual string SENDCODE { get; set; }
/// <summary> /// <summary>
/// 接收方代码 /// 接收方代码
/// </summary> /// </summary>
public virtual string RECEIVECODE { get; set; } public virtual string RECEIVECODE { get; set; }
/// <summary> /// <summary>
/// 发送方名称 /// 发送方名称
/// </summary> /// </summary>
public virtual string SENDNAME { get; set; } public virtual string SENDNAME { get; set; }
/// <summary> /// <summary>
/// 发送方联系人 /// 发送方联系人
/// </summary> /// </summary>
public virtual string SENDATTN { get; set; } public virtual string SENDATTN { get; set; }
/// <summary> /// <summary>
/// 发送方邮箱 /// 发送方邮箱
/// </summary> /// </summary>
public virtual string SENDTEL { get; set; } public virtual string SENDTEL { get; set; }
/// <summary> /// <summary>
/// 发送方电话 /// 发送方电话
/// </summary> /// </summary>
public virtual string SENDEMAIL { get; set; } public virtual string SENDEMAIL { get; set; }
/// <summary> /// <summary>
/// 发送方公司代码 /// 发送方公司代码
/// </summary> /// </summary>
public virtual string SENDCOMPANYCODE { get; set; } public virtual string SENDCOMPANYCODE { get; set; }
/// <summary> /// <summary>
/// 发送方部门代码 /// 发送方部门代码
/// </summary> /// </summary>
public virtual string SENDSUBCOMPANYCODE { get; set; } public virtual string SENDSUBCOMPANYCODE { get; set; }
/// <summary> /// <summary>
/// 船公司代码 /// 船公司代码
/// </summary> /// </summary>
public virtual string CARRIERID { get; set; } public virtual string CARRIERID { get; set; }
/// <summary> /// <summary>
/// 接收方邮箱 /// 接收方邮箱
/// </summary> /// </summary>
public virtual string RECEIVEEMAIL { get; set; } public virtual string RECEIVEEMAIL { get; set; }
/// <summary> /// <summary>
/// 接收方SI邮箱 /// 接收方SI邮箱
/// </summary> /// </summary>
public virtual string RECEIVESIEMAIL { get; set; } public virtual string RECEIVESIEMAIL { get; set; }
/// <summary> /// <summary>
/// 接收方操作 /// 接收方操作
/// </summary> /// </summary>
public virtual string RECEIVEOP { get; set; } public virtual string RECEIVEOP { get; set; }
/// <summary> /// <summary>
/// 接收方销售 /// 接收方销售
/// </summary> /// </summary>
public virtual string RECEIVESALE { get; set; } public virtual string RECEIVESALE { get; set; }
/// <summary> /// <summary>
/// 接收方部门 /// 接收方部门
/// </summary> /// </summary>
public virtual string RECEIVEDEPT { get; set; } public virtual string RECEIVEDEPT { get; set; }
/// <summary> /// <summary>
/// 发送人电话 /// 发送人电话
/// </summary> /// </summary>
public virtual string SHIPPERTEL { get; set; } public virtual string SHIPPERTEL { get; set; }
/// <summary> /// <summary>
/// 收货人电话 /// 收货人电话
/// </summary> /// </summary>
public virtual string CONSIGNEETEL { get; set; } public virtual string CONSIGNEETEL { get; set; }
/// <summary> /// <summary>
/// 通知人电话 /// 通知人电话
/// </summary> /// </summary>
public virtual string NOTIFYPARTYTEL { get; set; } public virtual string NOTIFYPARTYTEL { get; set; }
/// <summary> /// <summary>
/// 是否设置TEL /// 是否设置TEL
/// </summary> /// </summary>
public virtual string ISUSETEL { get; set; } public virtual string ISUSETEL { get; set; }
/// <summary> /// <summary>
/// 租户ID /// 租户ID
/// </summary> /// </summary>
public virtual long TenantId { get; set; } public virtual long TenantId { get; set; }
/// <summary> /// <summary>
/// 租户名称 /// 租户名称
/// </summary> /// </summary>
public virtual string TenantName { get; set; } public virtual string TenantName { get; set; }
/// <summary>
/// 发送类型
/// </summary>
public string SendType { get; set; } = string.Empty;
} }
/// <summary> /// <summary>
@ -158,7 +162,7 @@ namespace Myshipping.Core
/// </summary> /// </summary>
[Required(ErrorMessage = "主键不能为空")] [Required(ErrorMessage = "主键不能为空")]
public long Id { get; set; } public long Id { get; set; }
} }
/// <summary> /// <summary>
@ -171,7 +175,7 @@ namespace Myshipping.Core
/// </summary> /// </summary>
[Required(ErrorMessage = "主键不能为空")] [Required(ErrorMessage = "主键不能为空")]
public long Id { get; set; } public long Id { get; set; }
} }
/// <summary> /// <summary>
@ -183,31 +187,31 @@ namespace Myshipping.Core
/// 主键 /// 主键
/// </summary> /// </summary>
public virtual long Id { get; set; } public virtual long Id { get; set; }
/// <summary> /// <summary>
/// EDI类型代码 /// EDI类型代码
/// </summary> /// </summary>
public virtual string EDICODE { get; set; } public virtual string EDICODE { get; set; }
/// <summary> /// <summary>
/// EDI类型名称 /// EDI类型名称
/// </summary> /// </summary>
public virtual string EDINAME { get; set; } public virtual string EDINAME { get; set; }
/// <summary> /// <summary>
/// 船公司代码 /// 船公司代码
/// </summary> /// </summary>
public virtual string CARRIERID { get; set; } public virtual string CARRIERID { get; set; }
/// <summary> /// <summary>
/// 租户ID /// 租户ID
/// </summary> /// </summary>
public virtual long TenantId { get; set; } public virtual long TenantId { get; set; }
/// <summary> /// <summary>
/// 租户名称 /// 租户名称
/// </summary> /// </summary>
public virtual string TenantName { get; set; } public virtual string TenantName { get; set; }
} }
} }

@ -10,11 +10,14 @@ namespace Myshipping.Core.Service
Task<dynamic> Page([FromQuery] QueryDjyEdiSettingInput input); Task<dynamic> Page([FromQuery] QueryDjyEdiSettingInput input);
Task<long> Add(AddDjyEdiSettingInput input); Task<long> Add(AddDjyEdiSettingInput input);
Task<long> Update(UpdateDjyEdiSettingInput input); Task<long> Update(UpdateDjyEdiSettingInput input);
Task<long> Save(UpdateDjyEdiSettingInput input);
Task Delete(GetDjyEdiSettingInput input); Task Delete(GetDjyEdiSettingInput input);
Task<DjyEdiSetting> Get([FromQuery] GetDjyEdiSettingInput input); Task<DjyEdiSetting> Get([FromQuery] GetDjyEdiSettingInput input);
//Task<dynamic> List([FromQuery] QueryDjyEdiSettingInput input); //Task<dynamic> List([FromQuery] QueryDjyEdiSettingInput input);
Task SetEnable(long id);
Task CacheData(bool flag); Task CacheData(bool flag);
} }
} }
Loading…
Cancel
Save