|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|