船司、场站映射配置重复项可以添加,但只提示

master
wanghaomei 1 year ago
parent 438b4cb9d8
commit 5dcd5fa14a

@ -194,10 +194,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
{ {
var list = await _sysCacheService.GetAllMappingCarrier(); var list = await _sysCacheService.GetAllMappingCarrier();
var count = list.Where(x => x.Module == dto.Module && x.Code == dto.Code && x.GID != dto.GID).Count(); var count = list.Where(x => x.Module == dto.Module && x.Code == dto.Code && x.GID != dto.GID).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
var entity = dto.Adapt<MappingCarrier>(); var entity = dto.Adapt<MappingCarrier>();
if (string.IsNullOrWhiteSpace(dto.GID)) if (string.IsNullOrWhiteSpace(dto.GID))
{ {
@ -216,6 +213,11 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
} }
await GetAllMappingCarrier(); await GetAllMappingCarrier();
if (count > 0) //提醒有相同配置项
{
throw Oops.Bah("操作成功,但需注意存在多个相同模块和船司代码的映射配置");
}
} }
@ -535,10 +537,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
var list = await _sysCacheService.GetAllMappingYard(); var list = await _sysCacheService.GetAllMappingYard();
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.CarrierCode == dto.CarrierCode && x.GID != dto.GID).Count(); var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.CarrierCode == dto.CarrierCode && x.GID != dto.GID).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
var entity = dto.Adapt<MappingYard>(); var entity = dto.Adapt<MappingYard>();
if (string.IsNullOrWhiteSpace(dto.GID)) if (string.IsNullOrWhiteSpace(dto.GID))
{ {
@ -556,6 +555,11 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
await _mappingYardRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); await _mappingYardRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
} }
await GetAllMappingYard(); await GetAllMappingYard();
if (count > 0) //提醒有相同配置项
{
throw Oops.Bah("操作成功,但需注意存在多个相同模块、船司代码和场站代码的映射配置");
}
} }

Loading…
Cancel
Save