修改服务项目保存方法

optimize
jianghaiqing 1 year ago
parent 6791c80de0
commit 1d4168d7ce

@ -62,7 +62,7 @@ namespace Myshipping.Application
catch (Exception ex)
{
result.succ = false;
result.msg = $"保存服务项目异常,原因:{ex.Message}";
result.msg = $"保存服务项目失败,原因:{ex.Message}";
}
return result;
@ -103,7 +103,9 @@ namespace Myshipping.Application
if (!string.IsNullOrWhiteSpace(info.ServiceProjectCode))
{
if (_serviceProjectBaseInfoRepository.AsQueryable().Any(a => a.SERVICE_PROJECT_CODE.Equals(info.ServiceProjectCode) && a.PK_ID != info.PKId))
string pkId = !string.IsNullOrWhiteSpace(info.PKId) ? info.PKId : string.Empty;
if (_serviceProjectBaseInfoRepository.AsQueryable().Any(a => a.SERVICE_PROJECT_CODE.Equals(info.ServiceProjectCode) && a.PK_ID != pkId))
{
_logger.LogInformation($"服务项目代码已存在不能重复保存");
@ -207,13 +209,13 @@ namespace Myshipping.Application
var id = await InnerSave(info,true);
result.succ = true;
result.msg = "保存成功";
result.msg = "保存并启用成功";
result.ext = id;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"保存并启用服务项目异常,原因:{ex.Message}";
result.msg = $"保存并启用服务项目失败,原因:{ex.Message}";
}
return result;

@ -60,7 +60,7 @@ namespace Myshipping.Application
catch (Exception ex)
{
result.succ = false;
result.msg = $"保存服务项目异常,原因:{ex.Message}";
result.msg = $"保存服务状态失败,原因:{ex.Message}";
}
return result;
@ -101,7 +101,9 @@ namespace Myshipping.Application
if (!string.IsNullOrWhiteSpace(info.StatusSKUCode))
{
if (_statusSkuBaseInfoRepository.AsQueryable().Any(a => a.STATUS_SKU_CODE.Equals(info.StatusSKUCode) && a.PK_ID != info.PKId))
string pkId = !string.IsNullOrWhiteSpace(info.PKId) ? info.PKId : string.Empty;
if (_statusSkuBaseInfoRepository.AsQueryable().Any(a => a.STATUS_SKU_CODE.Equals(info.StatusSKUCode) && a.PK_ID != pkId))
{
_logger.LogInformation($"状态代码已存在不能重复保存");
@ -217,13 +219,13 @@ namespace Myshipping.Application
var id = await InnerSave(info, true);
result.succ = true;
result.msg = "执行成功";
result.msg = "保存并启用成功";
result.ext = id;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"保存并启用状态异常,原因:{ex.Message}";
result.msg = $"保存并启用状态失败,原因:{ex.Message}";
}
return result;
@ -313,7 +315,7 @@ namespace Myshipping.Application
catch (Exception ex)
{
result.succ = false;
result.msg = $"执行状态异常,原因:{ex.Message}";
result.msg = $"执行失败,原因:{ex.Message}";
}
return result;

@ -62,7 +62,7 @@ namespace Myshipping.Application
catch (Exception ex)
{
result.succ = false;
result.msg = $"保存触发器异常,原因:{ex.Message}";
result.msg = $"保存触发器失败,原因:{ex.Message}";
}
return result;
@ -83,13 +83,13 @@ namespace Myshipping.Application
var id = await InnerSave(info, true);
result.succ = true;
result.msg = "保存成功";
result.msg = "保存并启用成功";
result.ext = id;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"保存触发器异常,原因:{ex.Message}";
result.msg = $"保存并启用触发器失败,原因:{ex.Message}";
}
return result;
@ -109,6 +109,11 @@ namespace Myshipping.Application
if (isSetEnable)
{
if (string.IsNullOrWhiteSpace(entity.STATUS_TRIGGER_CODE) || string.IsNullOrWhiteSpace(entity.STATUS_TRIGGER_NAME))
{
throw Oops.Oh($"触发器代码或名称不能为空", typeof(InvalidOperationException));
}
entity.IS_ENABLE = 1;
}
@ -119,7 +124,9 @@ namespace Myshipping.Application
if (string.IsNullOrWhiteSpace(info.StatusTriggerCode))
{
if (_statusTriggerBaseInfoRepository.AsQueryable().Any(a => a.STATUS_TRIGGER_CODE.Equals(info.StatusTriggerCode) && a.PK_ID != info.PKId))
string pkId = !string.IsNullOrWhiteSpace(info.PKId) ? info.PKId : string.Empty;
if (_statusTriggerBaseInfoRepository.AsQueryable().Any(a => a.STATUS_TRIGGER_CODE.Equals(info.StatusTriggerCode) && a.PK_ID != pkId))
{
_logger.LogInformation($"服务流程触发器代码已存在不能重复保存");
@ -356,6 +363,9 @@ namespace Myshipping.Application
if (opTypeEnum == OperateTypeEnum.SetEnable)
{
if (string.IsNullOrWhiteSpace(model.STATUS_TRIGGER_CODE) || string.IsNullOrWhiteSpace(model.STATUS_TRIGGER_NAME))
throw Oops.Oh($"触发器代码或名称不能为空", typeof(InvalidOperationException));
model.IS_ENABLE = 1;
await _statusTriggerBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new

Loading…
Cancel
Save