EDI参数设置修改

booking_auth_dev
wanghaomei 2 years ago
parent 68eb2101a1
commit 45f81cf835

@ -692,6 +692,11 @@
EDI映射
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.DJY_CONST">
<summary>
系统配置
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.ENTITY_ASSEMBLY_NAME">
<summary>
程序集
@ -7912,12 +7917,10 @@
<param name="code"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysConfigService.UpdateConfigCache(System.String,System.Object)">
<member name="M:Myshipping.Core.Service.SysConfigService.GetAllSysConfig">
<summary>
更新配置缓存
</summary>
<param name="code"></param>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysConfigService.GetDemoEnvFlag">
@ -9295,7 +9298,7 @@
</member>
<member name="M:Myshipping.Core.Service.DjyEdiSettingService.Add(Myshipping.Core.AddDjyEdiSettingInput)">
<summary>
增加EDI参数设置(同一租户、同一代码的会更新)
增加EDI参数设置
</summary>
<param name="input"></param>
<returns></returns>

@ -9,6 +9,7 @@ using System.Threading.Tasks;
using Furion.Logging;
using Microsoft.Extensions.Logging;
using Myshipping.Core.Entity;
using Furion.FriendlyException;
namespace Myshipping.Core.Service
{
@ -69,25 +70,21 @@ namespace Myshipping.Core.Service
}
/// <summary>
/// 增加EDI参数设置(同一租户、同一代码的会更新)
/// 增加EDI参数设置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/DjyEdiSetting/add")]
public async Task Add(AddDjyEdiSettingInput input)
{
_rep.Context.QueryFilter.Clear();
var entity = _rep.FirstOrDefault(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId);
if (entity == null)
{
entity = input.Adapt<DjyEdiSetting>();
await _rep.InsertAsync(entity);
}
else
var cc = _rep.Count(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId);
if (cc > 0)
{
entity = input.Adapt(entity);
await _rep.UpdateAsync(entity);
throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE})的参数设置");
}
var entity = input.Adapt<DjyEdiSetting>();
await _rep.InsertAsync(entity);
await CacheData();
}
@ -99,8 +96,15 @@ namespace Myshipping.Core.Service
[HttpPost("/DjyEdiSetting/edit")]
public async Task Update(UpdateDjyEdiSettingInput input)
{
var entity = input.Adapt<DjyEdiSetting>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
var entity = _rep.FirstOrDefault(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId);
if (entity == null)
{
throw Oops.Bah($"未找到数据");
}
entity = input.Adapt(entity);
await _rep.UpdateAsync(entity);
await CacheData();
}
@ -113,6 +117,10 @@ namespace Myshipping.Core.Service
public async Task Delete(GetDjyEdiSettingInput input)
{
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
if (entity == null)
{
throw Oops.Bah($"未找到数据");
}
await _rep.DeleteAsync(entity);
await CacheData();
}

Loading…
Cancel
Save