修改服务项目

optimize
jianghaiqing 1 year ago
parent 62820a212a
commit 036b4f9470

@ -64,6 +64,11 @@ namespace Myshipping.Application.Entity
/// </summary>
public string STATUS { get; set; }
/// <summary>
/// 服务项主键
/// </summary>
public string SERVICE_PROJECT_ID { get; set; }
/// <summary>
/// 服务项代码
/// </summary>

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 状态操作类型枚举
/// </summary>
public enum TrackingOperTypeEnum
{
/// <summary>
/// 自动
/// </summary>
[Description("自动")]
AUTO,
/// <summary>
/// 手工
/// </summary>
[Description("手工")]
MANUAL
}
}

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 状态推送类型枚举
/// </summary>
public enum TrackingPushTypeEnum
{
/// <summary>
/// 服务项目
/// </summary>
[Description("服务项目")]
Project,
/// <summary>
/// 服务状态
/// </summary>
[Description("服务状态")]
Status
}
}

@ -10,6 +10,7 @@ using Mapster;
using MathNet.Numerics;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Rewrite;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Myshipping.Application.ConfigOption;
@ -31,6 +32,7 @@ using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.InteropServices;
using System.Text;
@ -41,6 +43,7 @@ using System.Threading.Tasks;
using System.Web;
using Ubiety.Dns.Core;
using Yitter.IdGenerator;
using static Aliyun.OSS.Model.CreateSelectObjectMetaInputFormatModel;
namespace Myshipping.Application
{
@ -66,6 +69,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingRemark> _bookingRemarkRepository;
private readonly IServiceWorkFlowBaseService _serviceWorkFlowBaseService;
private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService;
const string CONST_MAPPING_BC_MODULE_ROUTE = "BC_DOWN_RT";
const string CONST_MAPPING_DRAFT_MODULE_ROUTE = "DRAFT_DOWN_RT";
@ -87,7 +91,8 @@ namespace Myshipping.Application
, SqlSugarRepository<TaskBCInfo> taskBCInfoRepository, IServiceWorkFlowBaseService serviceWorkFlowBaseService,
SqlSugarRepository<BookingStatusLog> statuslogRepository, SqlSugarRepository<BookingStatusLogDetail> statuslogdetailRepository,
SqlSugarRepository<BookingLog> bookinglogRepository, SqlSugarRepository<BookingLogDetail> bookinglogdetailRepository,
SqlSugarRepository<BookingRemark> bookingRemarkRepository, SqlSugarRepository<BookingFile> bookingFileRepository)
SqlSugarRepository<BookingRemark> bookingRemarkRepository, SqlSugarRepository<BookingFile> bookingFileRepository,
IServiceWorkFlowManageService serviceWorkFlowManageService)
{
_cache = cache;
_logger = logger;
@ -107,6 +112,8 @@ namespace Myshipping.Application
_bookinglogdetailRepository = bookinglogdetailRepository;
_bookingRemarkRepository = bookingRemarkRepository;
_bookingFileRepository = bookingFileRepository;
_serviceWorkFlowManageService = serviceWorkFlowManageService;
}
@ -2037,6 +2044,186 @@ namespace Myshipping.Application
return resultDto;
}
#endregion
#region 保存服务项目
/// <summary>
/// 保存服务项目
/// </summary>
/// <param name="bookingId">订舱ID</param>
/// <param name="projectCode">服务项目代码</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SaveServiceProject(long bookingId, string projectCode)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
try
{
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null,true)
.First(a=>a.Id == bookingId);
if(bookingOrder == null)
throw Oops.Oh($"订舱信息获取失败,订舱信息不存在或已作废");
_logger.LogInformation("批次={no} 请求保存服务项目 bookingid={id} project={prj} ", batchNo, bookingId, projectCode);
TrackingMessageInfo msgInfo = new TrackingMessageInfo {
Head = new TrackingMessageHeadInfo {
GID = IDGen.NextID().ToString(),
MessageType = "PROJECT",
ReceiverId = "ServiceProjectStatus",
ReceiverName= "服务项目和状态",
SenderId = "BookingOrder",
SenderName = "海运订舱",
RequestDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
Version = "2.0",
RequestAction = "AddOrModify",
},
Main = new TrackingMessageMainInfo
{
BusiId = bookingId.ToString(),
BusiSystemCode = "BOOKING_ORDER",
MBlNo = bookingOrder.MBLNO,
VesselVoyno = $"{bookingOrder.VESSEL}/{bookingOrder.VOYNO}",
OrderNo = bookingOrder.BSNO,
PushType = TrackingPushTypeEnum.Project,
OperTenantId = bookingOrder.TenantId.Value,
OperTenantName = bookingOrder.TenantName,
OpertType = TrackingOperTypeEnum.MANUAL,
OperUserId = UserManager.UserId.ToString(),
OperUserName = UserManager.Name,
ProjectList = new List<TrackingMessageMainProjectInfo> {
new TrackingMessageMainProjectInfo{
ServiceProjectCode = projectCode,
}
}
}
};
DateTime bDate = DateTime.Now;
_logger.LogInformation("批次={no} 推送保存服务项目 msg={msg}", batchNo, JSON.Serialize(msgInfo));
var rlt = await _serviceWorkFlowManageService.PushStatus(msgInfo);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg} result={rlt}", batchNo, timeDiff, (rlt.succ ? "成功" : "失败")
,JSON.Serialize(rlt));
if (!rlt.succ)
{
result = rlt;
}
else
{
result.succ = true;
result.msg = "保存成功";
}
}
catch(Exception ex)
{
result.succ = false;
result.msg = $"服务项目保存失败,原因:{ex.Message}";
}
return result;
}
#endregion
#region 取消服务项目
/// <summary>
/// 取消服务项目
/// </summary>
/// <param name="bookingId">订舱ID</param>
/// <param name="projectCode">服务项目代码</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> CancelServiceProject(long bookingId, string projectCode)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
try
{
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null, true)
.First(a => a.Id == bookingId);
if (bookingOrder == null)
throw Oops.Oh($"订舱信息获取失败,订舱信息不存在或已作废");
_logger.LogInformation("批次={no} 请求保存服务项目 bookingid={id} project={prj} ", batchNo, bookingId, projectCode);
TrackingMessageInfo msgInfo = new TrackingMessageInfo
{
Head = new TrackingMessageHeadInfo
{
GID = IDGen.NextID().ToString(),
MessageType = "PROJECT",
ReceiverId = "ServiceProjectStatus",
ReceiverName = "服务项目和状态",
SenderId = "BookingOrder",
SenderName = "海运订舱",
RequestDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
Version = "2.0",
RequestAction = "AddOrModify",
},
Main = new TrackingMessageMainInfo
{
BusiId = bookingId.ToString(),
BusiSystemCode = "BOOKING_ORDER",
MBlNo = bookingOrder.MBLNO,
VesselVoyno = $"{bookingOrder.VESSEL}/{bookingOrder.VOYNO}",
OrderNo = bookingOrder.BSNO,
PushType = TrackingPushTypeEnum.Project,
OperTenantId = bookingOrder.TenantId.Value,
OperTenantName = bookingOrder.TenantName,
OpertType = TrackingOperTypeEnum.MANUAL,
OperUserId = UserManager.UserId.ToString(),
OperUserName = UserManager.Name,
ProjectList = new List<TrackingMessageMainProjectInfo> {
new TrackingMessageMainProjectInfo{
ServiceProjectCode = projectCode,
}
}
}
};
DateTime bDate = DateTime.Now;
_logger.LogInformation("批次={no} 推送取消服务项目 msg={msg}", batchNo, JSON.Serialize(msgInfo));
var rlt = await _serviceWorkFlowManageService.CancelProject(msgInfo);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg} result={rlt}", batchNo, timeDiff, (rlt.succ ? "成功" : "失败")
, JSON.Serialize(rlt));
if (!rlt.succ)
{
result = rlt;
}
else
{
result.succ = true;
result.msg = "取消成功";
}
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"服务项目取消失败,原因:{ex.Message}";
}
return result;
}
#endregion
}
public class DateTimeJsonConverter : System.Text.Json.Serialization.JsonConverter<Nullable<DateTime>>

@ -87,5 +87,21 @@ namespace Myshipping.Application
/// <param name="bookingId">订舱ID</param>
/// <returns>返回日志详情</returns>
Task<BookingLogDataDto> GetAllLogDataVNTWO(long bookingId);
/// <summary>
/// 保存服务项目
/// </summary>
/// <param name="bookingId">订舱ID</param>
/// <param name="projectCode">服务项目代码</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SaveServiceProject(long bookingId, string projectCode);
/// <summary>
/// 取消服务项目
/// </summary>
/// <param name="bookingId">订舱ID</param>
/// <param name="projectCode">服务项目代码</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CancelServiceProject(long bookingId, string projectCode);
}
}

@ -129,33 +129,69 @@ namespace Myshipping.Application
public string OrderNo { get; set; }
/// <summary>
/// 任务对应接收操作人ID
/// 操作触发用户ID
/// </summary>
public string RecvUserId { get; set; }
public string OperUserId { get; set; }
/// <summary>
/// 任务对应接收操作人名称
/// 操作触发用户名称
/// </summary>
public string RecvUserName { get; set; }
public string OperUserName { get; set; }
/// <summary>
/// 状态列表
/// 操作触发人租户ID
/// </summary>
public long OperTenantId { get; set; }
/// <summary>
/// 操作触发人租户名称
/// </summary>
public string OperTenantName { get; set; }
/// <summary>
/// 状态操作类型 MANUAL-手工 AUTO-自动
/// </summary>
public TrackingOperTypeEnum OpertType { get; set; }
/// <summary>
/// 推送类型
/// </summary>
public TrackingPushTypeEnum PushType { get; set; }
/// <summary>
/// 服务项目列表
/// </summary>
public List<TrackingMessageMainProjectInfo> ProjectList { get; set; }
/// <summary>
/// 服务状态列表
/// </summary>
public List<TrackingMessageMainStatusInfo> StatusList { get; set; }
}
/// <summary>
/// 服务状态详情
/// </summary>
public class TrackingMessageMainStatusInfo
{
/// <summary>
/// 服务项目代码
/// </summary>
public string ServiceProjectCode { get; set; }
/// <summary>
/// 服务项目名称
/// </summary>
public string ServiceProjectName { get; set; }
/// <summary>
/// 状态代码
/// </summary>
[Required(ErrorMessage = "必填")]
public string StatusCode { get; set; }
/// <summary>
/// 状态名称
/// </summary>
[Required(ErrorMessage = "必填")]
public string StatusName { get; set; }
/// <summary>
@ -167,10 +203,22 @@ namespace Myshipping.Application
/// 状态产生值
/// </summary>
public string StatusVal { get; set; }
}
/// <summary>
/// 服务详情
/// </summary>
public class TrackingMessageMainProjectInfo
{
/// <summary>
/// 状态操作类型 MANUAL-手工 AUTO-自动
/// 服务项目代码
/// </summary>
public string OpertType { get; set; }
public string ServiceProjectCode { get; set; }
/// <summary>
/// 服务项目名称
/// </summary>
public string ServiceProjectName { get; set; }
}
}

@ -49,5 +49,20 @@ namespace Myshipping.Application
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> QueryServiceInfo(TrackingQueryMessageInfo info);
/// <summary>
/// 取消服务项目
/// </summary>
/// <param name="info">服务流程报文详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CancelProject(TrackingMessageInfo info);
/// <summary>
/// 校验取消状态
/// </summary>
/// <param name="info">服务流程报文详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> ValidateCancelProject(TrackingMessageInfo info);
}
}

@ -83,6 +83,16 @@ namespace Myshipping.Application
if(isSetEnable)
{
if (string.IsNullOrWhiteSpace(entity.SERVICE_PROJECT_CODE) || string.IsNullOrWhiteSpace(entity.SERVICE_PROJECT_NAME))
{
throw Oops.Oh($"服务项代码或名称不能为空", typeof(InvalidOperationException));
}
if (entity.SORT_NO <= 0)
{
throw Oops.Oh($"排序值不能小于等于0", typeof(InvalidOperationException));
}
entity.IS_ENABLE = 1;
}
@ -91,7 +101,7 @@ namespace Myshipping.Application
_logger.LogInformation($"服务项目保存 JSON={JSON.Serialize(entity)} user={UserManager.UserId}");
if (string.IsNullOrWhiteSpace(info.ServiceProjectCode))
if (!string.IsNullOrWhiteSpace(info.ServiceProjectCode))
{
if (_serviceProjectBaseInfoRepository.AsQueryable().Any(a => a.SERVICE_PROJECT_CODE.Equals(info.ServiceProjectCode) && a.PK_ID != info.PKId))
{
@ -446,6 +456,16 @@ namespace Myshipping.Application
if(opTypeEnum == OperateTypeEnum.SetEnable)
{
if (string.IsNullOrWhiteSpace(model.SERVICE_PROJECT_CODE) || string.IsNullOrWhiteSpace(model.SERVICE_PROJECT_NAME))
{
throw Oops.Oh($"服务项代码或名称不能为空", typeof(InvalidOperationException));
}
if (model.SORT_NO <= 0)
{
throw Oops.Oh($"排序值不能小于等于0", typeof(InvalidOperationException));
}
model.IS_ENABLE = 1;
await _serviceProjectBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new

@ -210,6 +210,11 @@ namespace Myshipping.Application
if (isSetEnable)
{
if (string.IsNullOrWhiteSpace(entity.SERVICE_WORKFLOW_CODE) || string.IsNullOrWhiteSpace(entity.SERVICE_WORKFLOW_NAME))
{
throw Oops.Oh($"服务流程代码或名称不能为空", typeof(InvalidOperationException));
}
entity.IS_ENABLE = 1;
}
@ -881,6 +886,11 @@ namespace Myshipping.Application
if (opTypeEnum == OperateTypeEnum.SetEnable)
{
if (string.IsNullOrWhiteSpace(model.SERVICE_WORKFLOW_CODE) || string.IsNullOrWhiteSpace(model.SERVICE_WORKFLOW_NAME))
{
throw Oops.Oh($"服务流程代码或名称不能为空", typeof(InvalidOperationException));
}
model.IS_ENABLE = 1;
await _serviceWorkFlowBaseRepository.AsUpdateable(model).UpdateColumns(it => new
@ -1329,6 +1339,9 @@ namespace Myshipping.Application
rltList.Add(InnerPublishReleasServiceWF(pr).GetAwaiter().GetResult());
});
//写入缓存
await SetServiceProjectCacheInfo(list.FirstOrDefault().TenantId.ToString());
result.succ = true;
result.msg = rltList.FirstOrDefault().msg;
@ -1773,16 +1786,47 @@ namespace Myshipping.Application
if (isAvoidCache || statusList == null || statusList.Count == 0)
{
statusList = CreateCacheInfo(tenantId);
//await _cache.SetAsync($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}", statusList);
statusList = ReloadServiceProjectCacheInfo(tenantId);
await _cache.SetAsync($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}", statusList);
}
return statusList;
}
#endregion
#region 缓存租户下可用的服务流程详情
/// <summary>
/// 缓存租户下可用的服务流程详情
/// </summary>
/// <param name="tenantId">租户ID</param>
/// <returns></returns>
private async Task SetServiceProjectCacheInfo(string tenantId)
{
try
{
var statusList = ReloadServiceProjectCacheInfo(tenantId);
await _cache.SetAsync($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}", statusList);
_logger.LogInformation($"租户下可用的服务流程详情并写入缓存完成");
}
catch(Exception ex)
{
_logger.LogInformation($"租户下可用的服务流程详情并写入缓存异常,原因:{ex.Message}");
throw Oops.Oh($"租户下可用的服务流程详情并写入缓存异常,原因:{ex.Message}", typeof(InvalidOperationException));
}
}
#endregion
private List<ServiceProjectWithStatusDto> CreateCacheInfo(string tenantId)
#region 提取租户下可用的服务流程详情
/// <summary>
/// 提取租户下可用的服务流程详情
/// </summary>
/// <param name="tenantId">租户ID</param>
/// <returns>返回列表</returns>
private List<ServiceProjectWithStatusDto> ReloadServiceProjectCacheInfo(string tenantId)
{
var statusSKUList = _statusSkuBaseInfoRepository.AsQueryable().Filter(null, true)
.Where(a => !a.IsDeleted && a.IS_ENABLE == 1 && a.TenantId == long.Parse(tenantId)).ToList();
@ -1951,5 +1995,6 @@ namespace Myshipping.Application
return statusList;
}
#endregion
}
}

@ -131,18 +131,24 @@ namespace Myshipping.Application
throw Oops.Oh($"报文Main的业务主键不能为空", typeof(InvalidOperationException));
}
if (info.Head != null && (string.IsNullOrWhiteSpace(info.Head.RequestAction) || !info.Head.RequestAction.Equals("AddOrModify",StringComparison.OrdinalIgnoreCase)))
var projectList = _cache.Get<List<ServiceProjectBaseDto>>($"{CONST_CACHE_ENABLE_PROJECT}_{info.Main.OperTenantId}");
if (info.Main.PushType == TrackingPushTypeEnum.Project)
{
_logger.LogInformation("批次={no} 报文Head的请求操作类型不能为空并且必需等于AddOrModify", batchNo);
throw Oops.Oh($"报文Head的请求操作类型不能为空并且必需等于AddOrModify", typeof(InvalidOperationException));
if(info.Main.ProjectList == null || info.Main.ProjectList.Count == 0)
{
_logger.LogInformation("批次={no} 推送类型是【服务项目】,服务项目列表不能为空", batchNo);
throw Oops.Oh($"推送类型是【服务项目】,服务项目列表不能为空", typeof(InvalidOperationException));
}
//提取
var runBaseList = _serviceWorkFlowRunInfoRepository.AsQueryable().Filter(null, true)
.Where(a => a.BUSI_ID == info.Main.BusiId && a.BUSI_SYSTEM_CODE.Equals(info.Main.BusiSystemCode)
&& !a.IsDeleted && a.TenantId == info.Main.OperTenantId).ToList();
}
if (info.Main.StatusList == null || info.Main.StatusList.Count == 0)
{
_logger.LogInformation("批次={no} 接收推送状态错误 报文Main的状态列表不能为空并且至少需要提供一个以上的状态信息", batchNo);
throw Oops.Oh($"报文Main的状态列表不能为空并且至少需要提供一个以上的状态信息", typeof(InvalidOperationException));
}
//校验状态代码是否一致,不一致直接返回错误不允许推送
var statusArg = info.Main.StatusList.Select(a => a?.StatusCode.ToUpper())
.Where(a => !string.IsNullOrWhiteSpace(a)).Distinct().ToArray();
@ -153,8 +159,9 @@ namespace Myshipping.Application
throw Oops.Oh($"报文Main的状态列表至少需要提供一个以上的状态信息", typeof(InvalidOperationException));
}
UserTendDto userTendInfo = GetUserTendInfo(info.Main.RecvUserId);
UserTendDto userTendInfo = GetUserTendInfo(info.Main.OperUserId);
//检索状态对应所有的服务流程如果已经提取到的状态数量与推送的不一致提示错误不能入库s
var skuList = _statusSkuBaseInfoRepository.AsQueryable().Filter(null, true)
@ -686,6 +693,7 @@ namespace Myshipping.Application
throw Oops.Oh($"报文Main的状态列表不能为空并且至少需要提供一个以上的状态信息", typeof(InvalidOperationException));
}
//校验状态代码是否一致,不一致直接返回错误不允许推送
var statusArg = info.Main.StatusList.Select(a => a?.StatusCode.ToUpper())
.Where(a => !string.IsNullOrWhiteSpace(a)).Distinct().ToArray();
@ -697,7 +705,7 @@ namespace Myshipping.Application
throw Oops.Oh($"报文Main的状态列表至少需要提供一个以上的状态信息", typeof(InvalidOperationException));
}
UserTendDto userTendInfo = GetUserTendInfo(info.Main.RecvUserId);
UserTendDto userTendInfo = GetUserTendInfo(info.Main.OperUserId);
//检索状态对应所有的服务流程如果已经提取到的状态数量与推送的不一致提示错误不能入库s
var skuList = _statusSkuBaseInfoRepository.AsQueryable().Filter(null, true)
@ -1076,6 +1084,42 @@ namespace Myshipping.Application
return result;
}
#region 取消服务项目
/// <summary>
/// 取消服务项目
/// </summary>
/// <param name="info">服务流程报文详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> CancelProject(TrackingMessageInfo info)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
_logger.LogInformation("批次={no} 接收推送状态 msg={msg}", batchNo, JSON.Serialize(info));
return result;
}
#endregion
#region 校验取消状态
/// <summary>
/// 校验取消状态
/// </summary>
/// <param name="info">服务流程报文详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> ValidateCancelProject(TrackingMessageInfo info)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
_logger.LogInformation("批次={no} 接收推送状态 msg={msg}", batchNo, JSON.Serialize(info));
return result;
}
#endregion
}
}

@ -9,6 +9,7 @@ using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity;
using Myshipping.Application.Helper;
using Myshipping.Core;
using StackExchange.Profiling.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
@ -80,6 +81,16 @@ namespace Myshipping.Application
if (isSetEnable)
{
if (string.IsNullOrWhiteSpace(entity.STATUS_SKU_CODE) || string.IsNullOrWhiteSpace(entity.STATUS_SKU_NAME))
{
throw Oops.Oh($"状态代码或名称不能为空", typeof(InvalidOperationException));
}
if(entity.SORT_NO <= 0)
{
throw Oops.Oh($"排序值不能小于等于0", typeof(InvalidOperationException));
}
entity.IS_ENABLE = 1;
}
@ -88,7 +99,7 @@ namespace Myshipping.Application
_logger.LogInformation($"服务项目保存 JSON={JSON.Serialize(entity)} user={UserManager.UserId}");
if (string.IsNullOrWhiteSpace(info.StatusSKUCode))
if (!string.IsNullOrWhiteSpace(info.StatusSKUCode))
{
if (_statusSkuBaseInfoRepository.AsQueryable().Any(a => a.STATUS_SKU_CODE.Equals(info.StatusSKUCode) && a.PK_ID != info.PKId))
{
@ -245,6 +256,14 @@ namespace Myshipping.Application
if (opTypeEnum == OperateTypeEnum.SetEnable)
{
if (string.IsNullOrWhiteSpace(model.STATUS_SKU_CODE) || string.IsNullOrWhiteSpace(model.STATUS_SKU_NAME))
throw Oops.Oh($"状态代码或名称不能为空", typeof(InvalidOperationException));
if (model.SORT_NO <= 0)
{
throw Oops.Oh($"排序值不能小于等于0", typeof(InvalidOperationException));
}
model.IS_ENABLE = 1;
await _statusSkuBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new

Loading…
Cancel
Save