|
|
@ -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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 保存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;
|
|
|
|
return entity.Id;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 更新EDI参数设置
|
|
|
|
/// 更新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>
|
|
|
|