diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs
index c18d91db..03704ca2 100644
--- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs
+++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs
@@ -1,6 +1,7 @@
using Furion.DistributedIDGenerator;
using Myshipping.Application.Entity.TrackingSystem;
using Myshipping.Core;
+using NPOI.HSSF.Record.AutoFilter;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -19,13 +20,6 @@ namespace Myshipping.Application.Entity
[Tenant(CommonConst.MasterDb)]
public class ServiceWorkFlowRunLogInfo
{
- public ServiceWorkFlowRunLogInfo()
- {
- PK_ID = IDGen.NextID().ToString();
-
- CreatedTime = DateTime.Now;
- }
-
///
/// 主键
///
@@ -37,6 +31,11 @@ namespace Myshipping.Application.Entity
///
public string BATCH_NO { get; set; }
+ ///
+ /// 操作类型 PUSH_PROJECT 推送服务;CANCEL_PROJECT 取消服务;PUSH_STATUS 推送状态;CANCEL_STATUS 取消状态
+ ///
+ public string OPER_TYPE { get; set; }
+
///
/// 服务流程运行主表ID
///
@@ -107,6 +106,11 @@ namespace Myshipping.Application.Entity
///
public Nullable ACT_DATE { get; set; }
+ ///
+ /// 活动备注
+ ///
+ public string ACT_REMARK { get; set; }
+
///
/// 下一个活动ID
///
diff --git a/Myshipping.Application/Enum/TrackingRunOperTypeEnum.cs b/Myshipping.Application/Enum/TrackingRunOperTypeEnum.cs
new file mode 100644
index 00000000..a859a0dc
--- /dev/null
+++ b/Myshipping.Application/Enum/TrackingRunOperTypeEnum.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Myshipping.Application
+{
+ ///
+ /// 服务项目运行操作枚举
+ ///
+ public enum TrackingRunOperTypeEnum
+ {
+ ///
+ /// 推送服务
+ ///
+ [Description("推送服务")]
+ PUSH_PROJECT,
+ ///
+ /// 取消服务
+ ///
+ [Description("取消服务")]
+ CANCEL_PROJECT,
+ ///
+ /// 推送状态
+ ///
+ [Description("推送状态")]
+ PUSH_STATUS,
+ ///
+ /// 取消状态
+ ///
+ [Description("取消状态")]
+ CANCEL_STATUS
+ }
+}
diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs
index 1afd351f..160b59d7 100644
--- a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs
+++ b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs
@@ -178,5 +178,10 @@ namespace Myshipping.Application
/// 计算排序值
///
public decimal CalcSortNo { get; set; }
+
+ ///
+ /// 是否结束
+ ///
+ public bool IsEnd { get; set; }
}
}
diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs
index dc8fe111..76980611 100644
--- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs
+++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs
@@ -12,6 +12,7 @@ using Microsoft.Extensions.Options;
using Myshipping.Application.Entity;
using Myshipping.Core;
using Myshipping.Core.Entity;
+using Npoi.Mapper;
using NPOI.OpenXmlFormats.Vml;
using NPOI.SS.Formula.Functions;
using NPOI.SS.Formula.PTG;
@@ -202,6 +203,18 @@ namespace Myshipping.Application
};
await _serviceWorkFlowRunInfoRepository.InsertAsync(serviceWorkFlowRunInfo);
+
+ #region 写入运行日志
+ var runLog = serviceWorkFlowRunInfo.Adapt();
+ runLog.PK_ID = IDGen.NextID().ToString();
+ runLog.RUN_ID = serviceWorkFlowRunInfo.PK_ID;
+ runLog.BATCH_NO = batchNo;
+ runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_PROJECT.ToString();
+ runLog.EXEC_RESULT = "SUCC";
+ runLog.EXEC_NOTE = "Insert";
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
}
else if (tsk.OperType == "Update")
{
@@ -216,6 +229,18 @@ namespace Myshipping.Application
it.ACT_DATE,
it.IS_YIELD,
}).ExecuteCommandAsync();
+
+ #region 写入运行日志
+ var runLog = runInfo.Adapt();
+ runLog.PK_ID = IDGen.NextID().ToString();
+ runLog.RUN_ID = runInfo.PK_ID;
+ runLog.BATCH_NO = batchNo;
+ runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_PROJECT.ToString();
+ runLog.EXEC_RESULT = "SUCC";
+ runLog.EXEC_NOTE = "Update";
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
}
});
@@ -326,6 +351,18 @@ namespace Myshipping.Application
//写入run主表
await _serviceWorkFlowRunInfoRepository.InsertAsync(serviceWorkFlowRunInfo);
+ #region 写入运行日志
+ var runLog = serviceWorkFlowRunInfo.Adapt();
+ runLog.PK_ID = IDGen.NextID().ToString();
+ runLog.RUN_ID = serviceWorkFlowRunInfo.PK_ID;
+ runLog.BATCH_NO = batchNo;
+ runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString();
+ runLog.EXEC_RESULT = "SUCC";
+ runLog.EXEC_NOTE = "Insert";
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
+
//获取状态最大数
int endNum = rt.StatusList.Max(sku => sku.ActSortNo);
@@ -388,6 +425,19 @@ namespace Myshipping.Application
//写入run活动表
await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesRunInfo);
+ #region 写入运行日志
+ var runLog = activitiesRunInfo.Adapt();
+ runLog.PK_ID = IDGen.NextID().ToString();
+ runLog.RUN_ID = activitiesRunInfo.RUN_ID;
+ runLog.RUN_DETAIL_ID = activitiesRunInfo.PK_ID;
+ runLog.BATCH_NO = batchNo;
+ runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString();
+ runLog.EXEC_RESULT = "SUCC";
+ runLog.EXEC_NOTE = "Insert";
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
+
if (sku.SubStatusList != null && sku.SubStatusList.Count > 0)
{
string lastSubActId = string.Empty;
@@ -451,6 +501,19 @@ namespace Myshipping.Application
await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesSubRunInfo);
+ #region 写入运行日志
+ var runLog = activitiesSubRunInfo.Adapt();
+ runLog.PK_ID = IDGen.NextID().ToString();
+ runLog.RUN_ID = activitiesSubRunInfo.RUN_ID;
+ runLog.RUN_DETAIL_ID = activitiesSubRunInfo.PK_ID;
+ runLog.BATCH_NO = batchNo;
+ runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString();
+ runLog.EXEC_RESULT = "SUCC";
+ runLog.EXEC_NOTE = "Insert";
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
+
lastSubActId = activitiesSubRunInfo.PK_ID;
});
@@ -484,6 +547,18 @@ namespace Myshipping.Application
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
+
+ #region 写入运行日志
+ var runLog = runEntity.Adapt();
+ runLog.PK_ID = IDGen.NextID().ToString();
+ runLog.RUN_ID = runEntity.PK_ID;
+ runLog.BATCH_NO = batchNo;
+ runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString();
+ runLog.EXEC_RESULT = "SUCC";
+ runLog.EXEC_NOTE = "Update";
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
}
//批量写入活动表
@@ -550,6 +625,19 @@ namespace Myshipping.Application
//写入run活动表
await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesRunInfo);
+ #region 写入运行日志
+ var runLog = activitiesRunInfo.Adapt();
+ runLog.PK_ID = IDGen.NextID().ToString();
+ runLog.RUN_ID = activitiesRunInfo.RUN_ID;
+ runLog.RUN_DETAIL_ID = activitiesRunInfo.PK_ID;
+ runLog.BATCH_NO = batchNo;
+ runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString();
+ runLog.EXEC_RESULT = "SUCC";
+ runLog.EXEC_NOTE = "Insert";
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
+
if (sku.SubStatusList != null && sku.SubStatusList.Count > 0)
{
string lastSubActId = string.Empty;
@@ -614,6 +702,19 @@ namespace Myshipping.Application
await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesSubRunInfo);
+ #region 写入运行日志
+ var runLog = activitiesSubRunInfo.Adapt();
+ runLog.PK_ID = IDGen.NextID().ToString();
+ runLog.RUN_ID = activitiesSubRunInfo.RUN_ID;
+ runLog.RUN_DETAIL_ID = activitiesSubRunInfo.PK_ID;
+ runLog.BATCH_NO = batchNo;
+ runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString();
+ runLog.EXEC_RESULT = "SUCC";
+ runLog.EXEC_NOTE = "Insert";
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
+
lastSubActId = activitiesSubRunInfo.PK_ID;
});
@@ -644,6 +745,18 @@ namespace Myshipping.Application
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
+
+ #region 写入运行日志
+ var runLog = runEntity.Adapt();
+ runLog.PK_ID = IDGen.NextID().ToString();
+ runLog.RUN_ID = runEntity.PK_ID;
+ runLog.BATCH_NO = batchNo;
+ runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString();
+ runLog.EXEC_RESULT = "SUCC";
+ runLog.EXEC_NOTE = "Update";
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
}
//只需要更新完成标记和完成时间
rt.StatusList.ForEach(async sku =>
@@ -694,6 +807,19 @@ namespace Myshipping.Application
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
+
+ #region 写入运行日志
+ var runLog = activitiesRunInfo.Adapt();
+ runLog.PK_ID = IDGen.NextID().ToString();
+ runLog.RUN_ID = activitiesRunInfo.RUN_ID;
+ runLog.RUN_DETAIL_ID = activitiesRunInfo.PK_ID;
+ runLog.BATCH_NO = batchNo;
+ runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString();
+ runLog.EXEC_RESULT = "SUCC";
+ runLog.EXEC_NOTE = "Update";
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
}
if (sku.SubStatusList != null && sku.SubStatusList.Count > 0)
@@ -747,6 +873,19 @@ namespace Myshipping.Application
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
+
+ #region 写入运行日志
+ var runLog = activitiesSubRunInfo.Adapt();
+ runLog.PK_ID = IDGen.NextID().ToString();
+ runLog.RUN_ID = activitiesSubRunInfo.RUN_ID;
+ runLog.RUN_DETAIL_ID = activitiesSubRunInfo.PK_ID;
+ runLog.BATCH_NO = batchNo;
+ runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString();
+ runLog.EXEC_RESULT = "SUCC";
+ runLog.EXEC_NOTE = "Update";
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
}
});
}
@@ -1533,6 +1672,7 @@ namespace Myshipping.Application
int lastWFSortNo = 0;
int calcNum = 1;
+
var resultList = statuList.Join(runList, l => l.WFPKId, r => r.WFPKId,
(l, r) => {
@@ -1609,7 +1749,12 @@ namespace Myshipping.Application
});
}
}
-
+
+ if (rltList != null && rltList.Count > 0)
+ {
+ var maxSort = rltList.Max(t => t.CalcSortNo);
+ rltList.FirstOrDefault(t => t.CalcSortNo == maxSort).IsEnd = true;
+ }
return rltList;
}).SelectMany(b => b).OrderBy(b => b.WFSortNo).Select(b => {
if(lastWFSortNo == 0)