diff --git a/Myshipping.Core/Entity/DJY/DjyEdiSetting.cs b/Myshipping.Core/Entity/DJY/DjyEdiSetting.cs
index e0186db6..1baf217e 100644
--- a/Myshipping.Core/Entity/DJY/DjyEdiSetting.cs
+++ b/Myshipping.Core/Entity/DJY/DjyEdiSetting.cs
@@ -111,5 +111,13 @@ namespace Myshipping.Core.Entity
/// 租户名称
///
public string TenantName { get; set; }
+ ///
+ /// 发送类型
+ ///
+ public string SendType { get; set; }
+ ///
+ /// 启用标志
+ ///
+ public bool EnableFlag { get; set; } = true;
}
}
\ No newline at end of file
diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml
index e42bc08d..f855d73c 100644
--- a/Myshipping.Core/Myshipping.Core.xml
+++ b/Myshipping.Core/Myshipping.Core.xml
@@ -2034,6 +2034,16 @@
租户名称
+
+
+ 发送类型
+
+
+
+
+ 启用标志
+
+
@@ -10766,18 +10776,32 @@
- 增加EDI参数设置
+ 增加EDI参数设置(准备作废,使用save接口代替)
+
+
+
+
+
+
+ 保存EDI参数设置
- 更新EDI参数设置
+ 更新EDI参数设置(准备作废,使用save接口代替)
+
+
+ 设置启用(启用后,同船司、同发送类型的其他EDI通道会被取消启用)
+
+
+
+
删除EDI参数设置
@@ -15474,6 +15498,11 @@
租户名称
+
+
+ 发送类型
+
+
EDI参数设置新增输入参数
diff --git a/Myshipping.Core/Service/DjyEdiSetting/DjyEdiSettingService.cs b/Myshipping.Core/Service/DjyEdiSetting/DjyEdiSettingService.cs
index 59bc77c1..f680df21 100644
--- a/Myshipping.Core/Service/DjyEdiSetting/DjyEdiSettingService.cs
+++ b/Myshipping.Core/Service/DjyEdiSetting/DjyEdiSettingService.cs
@@ -49,7 +49,7 @@ namespace Myshipping.Core.Service
}
///
- /// 增加EDI参数设置
+ /// 增加EDI参数设置(准备作废,使用save接口代替)
///
///
///
@@ -58,20 +58,80 @@ namespace Myshipping.Core.Service
{
var cc = _rep.AsQueryable()
.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)
{
- throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE})相同船司({input.CARRIERID})的参数设置");
+ throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE})、相同船司({input.CARRIERID})、相同发送类型({input.SendType})的参数设置");
}
var entity = input.Adapt();
await _rep.InsertAsync(entity);
await CacheData();
+
+
+
return entity.Id;
}
///
- /// 更新EDI参数设置
+ /// 保存EDI参数设置
+ ///
+ ///
+ ///
+ [HttpPost("/DjyEdiSetting/save")]
+ public async Task 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();
+ 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;
+
+ }
+
+ ///
+ /// 更新EDI参数设置(准备作废,使用save接口代替)
///
///
///
@@ -87,10 +147,10 @@ namespace Myshipping.Core.Service
}
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)
{
- throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE})相同船司({input.CARRIERID})的参数设置");
+ throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE})、相同船司({input.CARRIERID})、相同发送类型({input.SendType})的参数设置");
}
entity = input.Adapt(entity);
@@ -100,6 +160,35 @@ namespace Myshipping.Core.Service
return entity.Id;
}
+ ///
+ /// 设置启用(启用后,同船司、同发送类型的其他EDI通道会被取消启用)
+ ///
+ ///
+ ///
+ [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);
+ }
+ }
+
///
/// 删除EDI参数设置
///
@@ -141,7 +230,7 @@ namespace Myshipping.Core.Service
{
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);
}
}
diff --git a/Myshipping.Core/Service/DjyEdiSetting/Dto/DjyEdiSettingInput.cs b/Myshipping.Core/Service/DjyEdiSetting/Dto/DjyEdiSettingInput.cs
index 223eeaf8..9e6e964c 100644
--- a/Myshipping.Core/Service/DjyEdiSetting/Dto/DjyEdiSettingInput.cs
+++ b/Myshipping.Core/Service/DjyEdiSetting/Dto/DjyEdiSettingInput.cs
@@ -13,132 +13,136 @@ namespace Myshipping.Core
/// EDI类型代码
///
public virtual string EDICODE { get; set; }
-
+
///
/// EDI类型名称
///
public virtual string EDINAME { get; set; }
-
+
///
/// 服务器IP
///
public virtual string SERVERIP { get; set; }
-
+
///
/// 文件夹
///
public virtual string FOLDERNAME { get; set; }
-
+
///
/// 用户名
///
public virtual string USERNAME { get; set; }
-
+
///
/// 密码
///
public virtual string PASSWORD { get; set; }
-
+
///
/// 发送方代码
///
public virtual string SENDCODE { get; set; }
-
+
///
/// 接收方代码
///
public virtual string RECEIVECODE { get; set; }
-
+
///
/// 发送方名称
///
public virtual string SENDNAME { get; set; }
-
+
///
/// 发送方联系人
///
public virtual string SENDATTN { get; set; }
-
+
///
/// 发送方邮箱
///
public virtual string SENDTEL { get; set; }
-
+
///
/// 发送方电话
///
public virtual string SENDEMAIL { get; set; }
-
+
///
/// 发送方公司代码
///
public virtual string SENDCOMPANYCODE { get; set; }
-
+
///
/// 发送方部门代码
///
public virtual string SENDSUBCOMPANYCODE { get; set; }
-
+
///
/// 船公司代码
///
public virtual string CARRIERID { get; set; }
-
+
///
/// 接收方邮箱
///
public virtual string RECEIVEEMAIL { get; set; }
-
+
///
/// 接收方SI邮箱
///
public virtual string RECEIVESIEMAIL { get; set; }
-
+
///
/// 接收方操作
///
public virtual string RECEIVEOP { get; set; }
-
+
///
/// 接收方销售
///
public virtual string RECEIVESALE { get; set; }
-
+
///
/// 接收方部门
///
public virtual string RECEIVEDEPT { get; set; }
-
+
///
/// 发送人电话
///
public virtual string SHIPPERTEL { get; set; }
-
+
///
/// 收货人电话
///
public virtual string CONSIGNEETEL { get; set; }
-
+
///
/// 通知人电话
///
public virtual string NOTIFYPARTYTEL { get; set; }
-
+
///
/// 是否设置TEL
///
public virtual string ISUSETEL { get; set; }
-
+
///
/// 租户ID
///
public virtual long TenantId { get; set; }
-
+
///
/// 租户名称
///
public virtual string TenantName { get; set; }
-
+ ///
+ /// 发送类型
+ ///
+ public string SendType { get; set; } = string.Empty;
+
}
///
@@ -158,7 +162,7 @@ namespace Myshipping.Core
///
[Required(ErrorMessage = "主键不能为空")]
public long Id { get; set; }
-
+
}
///
@@ -171,7 +175,7 @@ namespace Myshipping.Core
///
[Required(ErrorMessage = "主键不能为空")]
public long Id { get; set; }
-
+
}
///
@@ -183,31 +187,31 @@ namespace Myshipping.Core
/// 主键
///
public virtual long Id { get; set; }
-
+
///
/// EDI类型代码
///
public virtual string EDICODE { get; set; }
-
+
///
/// EDI类型名称
///
public virtual string EDINAME { get; set; }
-
+
///
/// 船公司代码
///
public virtual string CARRIERID { get; set; }
-
+
///
/// 租户ID
///
public virtual long TenantId { get; set; }
-
+
///
/// 租户名称
///
public virtual string TenantName { get; set; }
-
+
}
}
diff --git a/Myshipping.Core/Service/DjyEdiSetting/IDjyEdiSettingService.cs b/Myshipping.Core/Service/DjyEdiSetting/IDjyEdiSettingService.cs
index 0846e035..921bbb70 100644
--- a/Myshipping.Core/Service/DjyEdiSetting/IDjyEdiSettingService.cs
+++ b/Myshipping.Core/Service/DjyEdiSetting/IDjyEdiSettingService.cs
@@ -10,11 +10,14 @@ namespace Myshipping.Core.Service
Task Page([FromQuery] QueryDjyEdiSettingInput input);
Task Add(AddDjyEdiSettingInput input);
Task Update(UpdateDjyEdiSettingInput input);
+ Task Save(UpdateDjyEdiSettingInput input);
Task Delete(GetDjyEdiSettingInput input);
Task Get([FromQuery] GetDjyEdiSettingInput input);
//Task List([FromQuery] QueryDjyEdiSettingInput input);
+ Task SetEnable(long id);
+
Task CacheData(bool flag);
-
+
}
}
\ No newline at end of file