EDI参数设置修改

booking_auth_dev
wanghaomei 2 years ago
parent 68eb2101a1
commit 45f81cf835

@ -692,6 +692,11 @@
EDI映射 EDI映射
</summary> </summary>
</member> </member>
<member name="F:Myshipping.Core.CommonConst.DJY_CONST">
<summary>
系统配置
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.ENTITY_ASSEMBLY_NAME"> <member name="F:Myshipping.Core.CommonConst.ENTITY_ASSEMBLY_NAME">
<summary> <summary>
程序集 程序集
@ -7912,12 +7917,10 @@
<param name="code"></param> <param name="code"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.SysConfigService.UpdateConfigCache(System.String,System.Object)"> <member name="M:Myshipping.Core.Service.SysConfigService.GetAllSysConfig">
<summary> <summary>
更新配置缓存 更新配置缓存
</summary> </summary>
<param name="code"></param>
<param name="value"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.SysConfigService.GetDemoEnvFlag"> <member name="M:Myshipping.Core.Service.SysConfigService.GetDemoEnvFlag">
@ -9295,7 +9298,7 @@
</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参数设置
</summary> </summary>
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>

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

Loading…
Cancel
Save