diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunInfo.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunInfo.cs
index dd082c78..74f932e2 100644
--- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunInfo.cs
+++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunInfo.cs
@@ -64,6 +64,11 @@ namespace Myshipping.Application.Entity
///
public string STATUS { get; set; }
+ ///
+ /// 服务项主键
+ ///
+ public string SERVICE_PROJECT_ID { get; set; }
+
///
/// 服务项代码
///
diff --git a/Myshipping.Application/Enum/TrackingOperTypeEnum.cs b/Myshipping.Application/Enum/TrackingOperTypeEnum.cs
new file mode 100644
index 00000000..83774108
--- /dev/null
+++ b/Myshipping.Application/Enum/TrackingOperTypeEnum.cs
@@ -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
+{
+ ///
+ /// 状态操作类型枚举
+ ///
+ public enum TrackingOperTypeEnum
+ {
+ ///
+ /// 自动
+ ///
+ [Description("自动")]
+ AUTO,
+ ///
+ /// 手工
+ ///
+ [Description("手工")]
+ MANUAL
+ }
+}
diff --git a/Myshipping.Application/Enum/TrackingPushTypeEnum.cs b/Myshipping.Application/Enum/TrackingPushTypeEnum.cs
new file mode 100644
index 00000000..5b944af4
--- /dev/null
+++ b/Myshipping.Application/Enum/TrackingPushTypeEnum.cs
@@ -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
+{
+ ///
+ /// 状态推送类型枚举
+ ///
+ public enum TrackingPushTypeEnum
+ {
+ ///
+ /// 服务项目
+ ///
+ [Description("服务项目")]
+ Project,
+ ///
+ /// 服务状态
+ ///
+ [Description("服务状态")]
+ Status
+ }
+}
diff --git a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs
index 65063901..89039685 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs
@@ -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 _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 taskBCInfoRepository, IServiceWorkFlowBaseService serviceWorkFlowBaseService,
SqlSugarRepository statuslogRepository, SqlSugarRepository statuslogdetailRepository,
SqlSugarRepository bookinglogRepository, SqlSugarRepository bookinglogdetailRepository,
- SqlSugarRepository bookingRemarkRepository, SqlSugarRepository bookingFileRepository)
+ SqlSugarRepository bookingRemarkRepository, SqlSugarRepository 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 保存服务项目
+ ///
+ /// 保存服务项目
+ ///
+ /// 订舱ID
+ /// 服务项目代码
+ /// 返回回执
+ public async Task 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 {
+ 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 取消服务项目
+ ///
+ /// 取消服务项目
+ ///
+ /// 订舱ID
+ /// 服务项目代码
+ /// 返回回执
+ public async Task 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 {
+ 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>
diff --git a/Myshipping.Application/Service/BookingOrder/IBookingValueAddedService.cs b/Myshipping.Application/Service/BookingOrder/IBookingValueAddedService.cs
index 456e4b05..55780d58 100644
--- a/Myshipping.Application/Service/BookingOrder/IBookingValueAddedService.cs
+++ b/Myshipping.Application/Service/BookingOrder/IBookingValueAddedService.cs
@@ -87,5 +87,21 @@ namespace Myshipping.Application
/// 订舱ID
/// 返回日志详情
Task GetAllLogDataVNTWO(long bookingId);
+
+ ///
+ /// 保存服务项目
+ ///
+ /// 订舱ID
+ /// 服务项目代码
+ /// 返回回执
+ Task SaveServiceProject(long bookingId, string projectCode);
+
+ ///
+ /// 取消服务项目
+ ///
+ /// 订舱ID
+ /// 服务项目代码
+ /// 返回回执
+ Task CancelServiceProject(long bookingId, string projectCode);
}
}
diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingMessageInfo.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingMessageInfo.cs
index b62bbc5b..c7117f78 100644
--- a/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingMessageInfo.cs
+++ b/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingMessageInfo.cs
@@ -129,33 +129,69 @@ namespace Myshipping.Application
public string OrderNo { get; set; }
///
- /// 任务对应接收操作人ID
+ /// 操作触发人用户ID
///
- public string RecvUserId { get; set; }
+ public string OperUserId { get; set; }
///
- /// 任务对应接收操作人名称
+ /// 操作触发人用户名称
///
- public string RecvUserName { get; set; }
+ public string OperUserName { get; set; }
///
- /// 状态列表
+ /// 操作触发人租户ID
+ ///
+ public long OperTenantId { get; set; }
+
+ ///
+ /// 操作触发人租户名称
+ ///
+ public string OperTenantName { get; set; }
+
+ ///
+ /// 状态操作类型 MANUAL-手工 AUTO-自动
+ ///
+ public TrackingOperTypeEnum OpertType { get; set; }
+
+ ///
+ /// 推送类型
+ ///
+ public TrackingPushTypeEnum PushType { get; set; }
+
+ ///
+ /// 服务项目列表
+ ///
+ public List ProjectList { get; set; }
+
+ ///
+ /// 服务状态列表
///
public List StatusList { get; set; }
}
+ ///
+ /// 服务状态详情
+ ///
public class TrackingMessageMainStatusInfo
{
+ ///
+ /// 服务项目代码
+ ///
+ public string ServiceProjectCode { get; set; }
+
+ ///
+ /// 服务项目名称
+ ///
+ public string ServiceProjectName { get; set; }
+
///
/// 状态代码
///
- [Required(ErrorMessage = "必填")]
public string StatusCode { get; set; }
///
/// 状态名称
///
- [Required(ErrorMessage = "必填")]
public string StatusName { get; set; }
///
@@ -167,10 +203,22 @@ namespace Myshipping.Application
/// 状态产生值
///
public string StatusVal { get; set; }
+ }
+ ///
+ /// 服务详情
+ ///
+ public class TrackingMessageMainProjectInfo
+ {
///
- /// 状态操作类型 MANUAL-手工 AUTO-自动
+ /// 服务项目代码
///
- public string OpertType { get; set; }
+ public string ServiceProjectCode { get; set; }
+
+ ///
+ /// 服务项目名称
+ ///
+ public string ServiceProjectName { get; set; }
}
+
}
diff --git a/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs
index 8ac5b1bb..a6c8ff41 100644
--- a/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs
+++ b/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs
@@ -49,5 +49,20 @@ namespace Myshipping.Application
/// 返回回执
Task QueryServiceInfo(TrackingQueryMessageInfo info);
+
+ ///
+ /// 取消服务项目
+ ///
+ /// 服务流程报文详情
+ /// 返回回执
+ Task CancelProject(TrackingMessageInfo info);
+
+ ///
+ /// 校验取消状态
+ ///
+ /// 服务流程报文详情
+ /// 返回回执
+ Task ValidateCancelProject(TrackingMessageInfo info);
+
}
}
diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceProjectService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceProjectService.cs
index 18ffccce..1bb66cf7 100644
--- a/Myshipping.Application/Service/TrackingSystem/ServiceProjectService.cs
+++ b/Myshipping.Application/Service/TrackingSystem/ServiceProjectService.cs
@@ -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
diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs
index 39fc396f..df9bd1ff 100644
--- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs
+++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs
@@ -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 缓存租户下可用的服务流程详情
+ ///
+ /// 缓存租户下可用的服务流程详情
+ ///
+ /// 租户ID
+ ///
+ 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 CreateCacheInfo(string tenantId)
+ #region 提取租户下可用的服务流程详情
+ ///
+ /// 提取租户下可用的服务流程详情
+ ///
+ /// 租户ID
+ /// 返回列表
+ private List 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
}
}
diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs
index f5f36a18..1f3503cd 100644
--- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs
+++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs
@@ -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>($"{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 取消服务项目
+ ///
+ /// 取消服务项目
+ ///
+ /// 服务流程报文详情
+ /// 返回回执
+ public async Task 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 校验取消状态
+ ///
+ /// 校验取消状态
+ ///
+ /// 服务流程报文详情
+ /// 返回回执
+ public async Task ValidateCancelProject(TrackingMessageInfo info)
+ {
+ TaskManageOrderResultDto result = new TaskManageOrderResultDto();
+
+ string batchNo = IDGen.NextID().ToString();
+
+ _logger.LogInformation("批次={no} 接收推送状态 msg={msg}", batchNo, JSON.Serialize(info));
+
+ return result;
+ }
+ #endregion
}
}
diff --git a/Myshipping.Application/Service/TrackingSystem/StatusSkuBaseService.cs b/Myshipping.Application/Service/TrackingSystem/StatusSkuBaseService.cs
index b9365525..d366631f 100644
--- a/Myshipping.Application/Service/TrackingSystem/StatusSkuBaseService.cs
+++ b/Myshipping.Application/Service/TrackingSystem/StatusSkuBaseService.cs
@@ -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