From a4d852fb257b1160c3307c0f9eb2ea91b4a292d3 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 8 Aug 2023 14:47:08 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=BF=9D=E5=AD=98=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=97=B6=E9=97=B4=E4=B8=BA=E7=A9=BA=E5=B9=B6?= =?UTF-8?q?=E4=B8=94=E5=A4=87=E6=B3=A8=E4=B8=8D=E4=B8=BA=E7=A9=BA=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E6=A0=87=E6=B3=A8=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceWorkFlowManageService.cs | 128 +++++++++++++----- 1 file changed, 96 insertions(+), 32 deletions(-) diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs index 48be3504..e0f55070 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs @@ -359,15 +359,26 @@ namespace Myshipping.Application if (st.StatusCode.Equals(sku.StatusSKUCode,StringComparison.OrdinalIgnoreCase)) { - activitiesRunInfo.IS_YIELD = 1; + bool currIsYield = true; - if(st.StatusDate.HasValue) + //完成时间为空,备注不为空只保存备注信息,不标记完成 + if(st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { - activitiesRunInfo.ACT_DATE = st.StatusDate.Value; + currIsYield = false; } - else + + if (currIsYield) { - activitiesRunInfo.ACT_DATE = nowDate; + activitiesRunInfo.IS_YIELD = 1; + + if (st.StatusDate.HasValue) + { + activitiesRunInfo.ACT_DATE = st.StatusDate.Value; + } + else + { + activitiesRunInfo.ACT_DATE = nowDate; + } } activitiesRunInfo.ACT_VAL = st.StatusVal; @@ -410,17 +421,27 @@ namespace Myshipping.Application if (st.StatusCode.Equals(sub.StatusSKUCode, StringComparison.OrdinalIgnoreCase)) { - activitiesSubRunInfo.IS_YIELD = 1; + bool currIsYield = true; - if (st.StatusDate.HasValue) + //完成时间为空,备注不为空只保存备注信息,不标记完成 + if (st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { - activitiesSubRunInfo.ACT_DATE = st.StatusDate.Value; + currIsYield = false; } - else + + if (currIsYield) { - activitiesSubRunInfo.ACT_DATE = nowDate; - } + activitiesSubRunInfo.IS_YIELD = 1; + if (st.StatusDate.HasValue) + { + activitiesSubRunInfo.ACT_DATE = st.StatusDate.Value; + } + else + { + activitiesSubRunInfo.ACT_DATE = nowDate; + } + } activitiesSubRunInfo.ACT_VAL = st.StatusVal; activitiesSubRunInfo.ACT_REMARK = st.Remark; } @@ -500,15 +521,26 @@ namespace Myshipping.Application if (st.StatusCode.Equals(sku.StatusSKUCode, StringComparison.OrdinalIgnoreCase)) { - activitiesRunInfo.IS_YIELD = 1; + bool currIsYield = true; - if (st.StatusDate.HasValue) + //完成时间为空,备注不为空只保存备注信息,不标记完成 + if (st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { - activitiesRunInfo.ACT_DATE = st.StatusDate.Value; + currIsYield = false; } - else + + if (currIsYield) { - activitiesRunInfo.ACT_DATE = nowDate; + activitiesRunInfo.IS_YIELD = 1; + + if (st.StatusDate.HasValue) + { + activitiesRunInfo.ACT_DATE = st.StatusDate.Value; + } + else + { + activitiesRunInfo.ACT_DATE = nowDate; + } } activitiesRunInfo.ACT_VAL = st.StatusVal; @@ -551,15 +583,26 @@ namespace Myshipping.Application if (st.StatusCode.Equals(sub.StatusSKUCode, StringComparison.OrdinalIgnoreCase)) { - activitiesSubRunInfo.IS_YIELD = 1; + bool currIsYield = true; - if (st.StatusDate.HasValue) + //完成时间为空,备注不为空只保存备注信息,不标记完成 + if (st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { - activitiesSubRunInfo.ACT_DATE = st.StatusDate.Value; + currIsYield = false; } - else + + if (currIsYield) { - activitiesSubRunInfo.ACT_DATE = nowDate; + activitiesSubRunInfo.IS_YIELD = 1; + + if (st.StatusDate.HasValue) + { + activitiesSubRunInfo.ACT_DATE = st.StatusDate.Value; + } + else + { + activitiesSubRunInfo.ACT_DATE = nowDate; + } } activitiesSubRunInfo.ACT_VAL = st.StatusVal; @@ -613,17 +656,27 @@ namespace Myshipping.Application if (st.StatusCode.Equals(sku.StatusSKUCode, StringComparison.OrdinalIgnoreCase)) { - activitiesRunInfo.IS_YIELD = 1; + bool currIsYield = true; - if (st.StatusDate.HasValue) + //完成时间为空,备注不为空只保存备注信息,不标记完成 + if (st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { - activitiesRunInfo.ACT_DATE = st.StatusDate.Value; + currIsYield = false; } - else + + if (currIsYield) { - activitiesRunInfo.ACT_DATE = nowDate; - } + activitiesRunInfo.IS_YIELD = 1; + if (st.StatusDate.HasValue) + { + activitiesRunInfo.ACT_DATE = st.StatusDate.Value; + } + else + { + activitiesRunInfo.ACT_DATE = nowDate; + } + } activitiesRunInfo.ACT_VAL = st.StatusVal; activitiesRunInfo.ACT_REMARK = st.Remark; @@ -655,15 +708,26 @@ namespace Myshipping.Application if (st.StatusCode.Equals(sub.StatusSKUCode, StringComparison.OrdinalIgnoreCase)) { - activitiesSubRunInfo.IS_YIELD = 1; + bool currIsYield = true; - if (st.StatusDate.HasValue) + //完成时间为空,备注不为空只保存备注信息,不标记完成 + if (st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { - activitiesSubRunInfo.ACT_DATE = st.StatusDate.Value; + currIsYield = false; } - else + + if (currIsYield) { - activitiesSubRunInfo.ACT_DATE = nowDate; + activitiesSubRunInfo.IS_YIELD = 1; + + if (st.StatusDate.HasValue) + { + activitiesSubRunInfo.ACT_DATE = st.StatusDate.Value; + } + else + { + activitiesSubRunInfo.ACT_DATE = nowDate; + } } activitiesSubRunInfo.ACT_VAL = st.StatusVal; From 79ce8d382bcacfcc9beaa81b3f7351bd258dac88 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 8 Aug 2023 14:55:14 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackingSystem/ServiceWorkFlowManageService.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs index e0f55070..edd4ce2d 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs @@ -362,7 +362,7 @@ namespace Myshipping.Application bool currIsYield = true; //完成时间为空,备注不为空只保存备注信息,不标记完成 - if(st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) + if(!st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { currIsYield = false; } @@ -424,7 +424,7 @@ namespace Myshipping.Application bool currIsYield = true; //完成时间为空,备注不为空只保存备注信息,不标记完成 - if (st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) + if (!st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { currIsYield = false; } @@ -524,7 +524,7 @@ namespace Myshipping.Application bool currIsYield = true; //完成时间为空,备注不为空只保存备注信息,不标记完成 - if (st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) + if (!st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { currIsYield = false; } @@ -586,7 +586,7 @@ namespace Myshipping.Application bool currIsYield = true; //完成时间为空,备注不为空只保存备注信息,不标记完成 - if (st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) + if (!st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { currIsYield = false; } @@ -659,7 +659,7 @@ namespace Myshipping.Application bool currIsYield = true; //完成时间为空,备注不为空只保存备注信息,不标记完成 - if (st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) + if (!st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { currIsYield = false; } @@ -711,7 +711,7 @@ namespace Myshipping.Application bool currIsYield = true; //完成时间为空,备注不为空只保存备注信息,不标记完成 - if (st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) + if (!st.StatusDate.HasValue && !string.IsNullOrWhiteSpace(st.Remark)) { currIsYield = false; } From 131fe767b944c547d68bcb1a186c3f63726f5e21 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 8 Aug 2023 15:36:17 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ServiceProjectWithStatusDto.cs | 10 ++++++ .../ServiceWorkFlowManageService.cs | 35 +++++++++++++++---- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs index 74edb012..3f602305 100644 --- a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs +++ b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs @@ -163,5 +163,15 @@ namespace Myshipping.Application /// 触发器列表 /// public List TriggerList { get; set; } + + /// + /// 分组名称 + /// + public string GroupName { get; set; } + + /// + /// 服务流程排序值 + /// + public int WFSortNo { get; set; } } } diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs index edd4ce2d..04fcb895 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs @@ -1530,7 +1530,9 @@ namespace Myshipping.Application //在获取运行表已有的记录 var runList = InnerGetRunListBySingleBusiness(messageInfo); - + + int lastWFSortNo = 0; + int calcNum = 1; var resultList = statuList.Join(runList, l => l.WFPKId, r => r.WFPKId, (l, r) => { @@ -1550,7 +1552,8 @@ namespace Myshipping.Application ShowName = b.ShowName, IsYield = false, StatusSKUCode = b.StatusSKUCode, - ActRemark = b.ActRemark + ActRemark = b.ActRemark, + WFSortNo = l.SortNo }); if(b.SubStatusList != null && b.SubStatusList.Count > 0) @@ -1562,7 +1565,8 @@ namespace Myshipping.Application ShowName = c.ShowName, IsYield = false, StatusSKUCode = b.StatusSKUCode, - ActRemark = b.ActRemark + ActRemark = b.ActRemark, + WFSortNo = l.SortNo }).ToList()); } }); @@ -1578,13 +1582,32 @@ namespace Myshipping.Application ActDate = b.ActDate, ActVal = b.ActVal, StatusSKUCode = b.StatusSKUCode, - ActRemark = b.ActRemark + ActRemark = b.ActRemark, + WFSortNo = l.SortNo }).ToList(); } } - + return rltList; - }).SelectMany(b=>b).ToList(); + }).SelectMany(b => b).OrderBy(b => b.WFSortNo).Select(b => { + if(lastWFSortNo == 0) + { + b.GroupName = calcNum.ToString(); + lastWFSortNo = b.WFSortNo; + } + else if(b.WFSortNo == lastWFSortNo) + { + b.GroupName = calcNum.ToString(); + } + else + { + ++calcNum; + lastWFSortNo = b.WFSortNo; + b.GroupName = calcNum.ToString(); + } + + return b; + }).OrderBy(b => b.WFSortNo).ThenBy(b=>b.ActSortNo).ToList(); result.succ = true; From 16904ad985977f8007386a23741018dedc964256 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 8 Aug 2023 16:02:06 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ServiceProjectWithStatusDto.cs | 5 ++ .../ServiceWorkFlowManageService.cs | 52 +++++++++++++------ 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs index 3f602305..1afd351f 100644 --- a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs +++ b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs @@ -173,5 +173,10 @@ namespace Myshipping.Application /// 服务流程排序值 /// public int WFSortNo { get; set; } + + /// + /// 计算排序值 + /// + public decimal CalcSortNo { get; set; } } } diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs index 04fcb895..dc8fe111 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs @@ -1553,7 +1553,8 @@ namespace Myshipping.Application IsYield = false, StatusSKUCode = b.StatusSKUCode, ActRemark = b.ActRemark, - WFSortNo = l.SortNo + WFSortNo = l.SortNo, + CalcSortNo = (decimal)b.ActSortNo, }); if(b.SubStatusList != null && b.SubStatusList.Count > 0) @@ -1566,25 +1567,46 @@ namespace Myshipping.Application IsYield = false, StatusSKUCode = b.StatusSKUCode, ActRemark = b.ActRemark, - WFSortNo = l.SortNo + WFSortNo = l.SortNo, + CalcSortNo = (decimal)b.ActSortNo + (c.ActSortNo * 0.001m) }).ToList()); } }); } else { - rltList = runInfo.ActivitiesList.Select(b => new ServiceProjectStatusDto - { - ActPKId = b.ActId, - ActSortNo = b.ExecSortNo, - ShowName = b.ShowName, - IsYield = b.IsYield == 1 ? true : false, - ActDate = b.ActDate, - ActVal = b.ActVal, - StatusSKUCode = b.StatusSKUCode, - ActRemark = b.ActRemark, - WFSortNo = l.SortNo - }).ToList(); + runInfo.ActivitiesList.ForEach(b => { + rltList.Add(new ServiceProjectStatusDto + { + ActPKId = b.ActId, + ActSortNo = b.ExecSortNo, + ShowName = b.ShowName, + IsYield = b.IsYield == 1 ? true : false, + ActDate = b.ActDate, + ActVal = b.ActVal, + StatusSKUCode = b.StatusSKUCode, + ActRemark = b.ActRemark, + WFSortNo = l.SortNo, + CalcSortNo = (decimal)b.ExecSortNo + }); + + if (b.SubList != null && b.SubList.Count > 0) + { + rltList.AddRange(b.SubList.Select(c => new ServiceProjectStatusDto + { + ActPKId = c.ActId, + ActSortNo = c.ExecSortNo, + ShowName = c.ShowName, + IsYield = c.IsYield == 1 ? true : false, + ActDate = c.ActDate, + ActVal = c.ActVal, + StatusSKUCode = c.StatusSKUCode, + ActRemark = c.ActRemark, + WFSortNo = l.SortNo, + CalcSortNo = (decimal)b.ExecSortNo + (c.ExecSortNo * 0.001m) + }).ToList()); + } + }); } } @@ -1607,7 +1629,7 @@ namespace Myshipping.Application } return b; - }).OrderBy(b => b.WFSortNo).ThenBy(b=>b.ActSortNo).ToList(); + }).OrderBy(b => b.WFSortNo).ThenBy(b=>b.CalcSortNo).ToList(); result.succ = true; From a0f68015f4a5a43f60cb8185ed630017c0463c57 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 8 Aug 2023 17:16:30 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceWorkFlowRunLogInfo.cs | 18 ++- .../Enum/TrackingRunOperTypeEnum.cs | 36 +++++ .../Dtos/ServiceProjectWithStatusDto.cs | 5 + .../ServiceWorkFlowManageService.cs | 147 +++++++++++++++++- 4 files changed, 198 insertions(+), 8 deletions(-) create mode 100644 Myshipping.Application/Enum/TrackingRunOperTypeEnum.cs 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) From 010fa5f26de3ad5a2a4ecf2a11b84455f07efcb4 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 8 Aug 2023 18:00:59 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackingSystem/ServiceWorkFlowRunInfo.cs | 7 -- .../ServiceWorkFlowRunLogInfo.cs | 9 +++ .../ServiceWorkFlowManageService.cs | 67 ++++++++++++++++++- 3 files changed, 74 insertions(+), 9 deletions(-) diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunInfo.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunInfo.cs index 243d62c6..f7ade46a 100644 --- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunInfo.cs +++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunInfo.cs @@ -17,13 +17,6 @@ namespace Myshipping.Application.Entity [Description("服务流程主表")] public class ServiceWorkFlowRunInfo : TrackingSystemDbEntity { - public ServiceWorkFlowRunInfo() - { - PK_ID = IDGen.NextID().ToString(); - - CreatedTime = DateTime.Now; - } - /// /// 服务流程主键 /// diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs index 03704ca2..d44b0ccf 100644 --- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs +++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs @@ -56,6 +56,10 @@ namespace Myshipping.Application.Entity /// public string BUSI_ID { get; set; } + /// + /// 提单号 + /// + public string MBL_NO { get; set; } /// /// 船名航次 /// @@ -71,6 +75,11 @@ namespace Myshipping.Application.Entity /// public string SERVICE_WF_ID { get; set; } + /// + /// 发布版本 + /// + public string RELEASE_VERSION { get; set; } + /// /// 服务项代码 /// diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs index 76980611..801d8262 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs @@ -223,11 +223,17 @@ namespace Myshipping.Application runInfo.IS_YIELD = 1; runInfo.ACT_DATE = nowDate; + runInfo.UpdatedTime = nowDate; + runInfo.UpdatedUserId = long.Parse(info.Main.OperUserId); + runInfo.UpdatedUserName = info.Main.OperUserName; await _serviceWorkFlowRunInfoRepository.AsUpdateable(runInfo).UpdateColumns(it => new { it.ACT_DATE, it.IS_YIELD, + it.UpdatedTime, + it.UpdatedUserId, + it.UpdatedUserName }).ExecuteCommandAsync(); #region 写入运行日志 @@ -434,6 +440,10 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Insert"; + runLog.MBL_NO = info.Main?.MBlNo.ToUpper(); + runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); + runLog.ORDER_NO = info.Main?.OrderNo; + runLog.RELEASE_VERSION = rt.ReleaseVersion; await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -510,6 +520,10 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Insert"; + runLog.MBL_NO = info.Main?.MBlNo.ToUpper(); + runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); + runLog.ORDER_NO = info.Main?.OrderNo; + runLog.RELEASE_VERSION = rt.ReleaseVersion; await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -634,6 +648,10 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Insert"; + runLog.MBL_NO = info.Main?.MBlNo.ToUpper(); + runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); + runLog.ORDER_NO = info.Main?.OrderNo; + runLog.RELEASE_VERSION = rt.ReleaseVersion; await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -711,6 +729,10 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Insert"; + runLog.MBL_NO = info.Main?.MBlNo.ToUpper(); + runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); + runLog.ORDER_NO = info.Main?.OrderNo; + runLog.RELEASE_VERSION = rt.ReleaseVersion; await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -817,6 +839,10 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Update"; + runLog.MBL_NO = info.Main?.MBlNo.ToUpper(); + runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); + runLog.ORDER_NO = info.Main?.OrderNo; + runLog.RELEASE_VERSION = rt.ReleaseVersion; await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -883,6 +909,10 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Update"; + runLog.MBL_NO = info.Main?.MBlNo.ToUpper(); + runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); + runLog.ORDER_NO = info.Main?.OrderNo; + runLog.RELEASE_VERSION = rt.ReleaseVersion; await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -1246,12 +1276,30 @@ namespace Myshipping.Application runInfo.IS_YIELD = 0; runInfo.ACT_DATE = null; + runInfo.UpdatedTime = nowDate; + runInfo.UpdatedUserId = long.Parse(info.Main.OperUserId); + runInfo.UpdatedUserName = info.Main.OperUserName; await _serviceWorkFlowRunInfoRepository.AsUpdateable(runInfo).UpdateColumns(it => new { it.ACT_DATE, it.IS_YIELD, + it.UpdatedTime, + it.UpdatedUserId, + it.UpdatedUserName }).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.CANCEL_PROJECT.ToString(); + runLog.EXEC_RESULT = "SUCC"; + runLog.EXEC_NOTE = "Update"; + + await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); + #endregion } }); @@ -1301,8 +1349,6 @@ namespace Myshipping.Application && wfArgs.Contains(main.SERVICE_WF_ID)) .Select((main, detail) => new { Main = main, Detail = detail }).ToList(); - - //按照请求的状态列表轮询 info.Main.StatusList.ForEach(async st => { @@ -1353,6 +1399,23 @@ 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.CANCEL_STATUS.ToString(); + runLog.EXEC_RESULT = "SUCC"; + runLog.EXEC_NOTE = "Update"; + runLog.MBL_NO = info.Main?.MBlNo.ToUpper(); + runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); + runLog.ORDER_NO = info.Main?.OrderNo; + runLog.RELEASE_VERSION = detail.Main.RELEASE_VERSION; + + await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); + #endregion } }); }); From c89b85ae2acadc221d6d4510971a138ba68e5d04 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Wed, 9 Aug 2023 08:44:41 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=BF=90=E8=A1=8C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceWorkFlowRunLogInfo.cs | 5 + .../ServiceWorkFlowManageService.cs | 95 +++++++++++++++++++ 2 files changed, 100 insertions(+) diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs index d44b0ccf..affe427b 100644 --- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs +++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunLogInfo.cs @@ -51,6 +51,11 @@ namespace Myshipping.Application.Entity /// public string BUSI_SYSTEM_CODE { get; set; } + /// + /// 请求来源 + /// + public string SOURCE_TYPE { get; set; } + /// /// 业务主键 /// diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs index 801d8262..008f9ecd 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs @@ -212,6 +212,7 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_PROJECT.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Insert"; + runLog.SOURCE_TYPE = info.Main.SourceType.ToString(); await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -244,6 +245,7 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_PROJECT.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Update"; + runLog.SOURCE_TYPE = info.Main.SourceType.ToString(); await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -365,6 +367,12 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Insert"; + runLog.BUSI_SYSTEM_CODE = info.Main.BusiSystemCode.ToUpper(); + runLog.BUSI_ID = info.Main.BusiId.ToUpper(); + runLog.SERVICE_WF_ID = rt.WFPKId; + runLog.SERVICE_PROJECT_CODE = rt.ProjectCode; + runLog.SERVICE_PROJECT_NAME = rt.ProjectName; + runLog.SOURCE_TYPE = info.Main.SourceType.ToString(); await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -444,6 +452,12 @@ namespace Myshipping.Application runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); runLog.ORDER_NO = info.Main?.OrderNo; runLog.RELEASE_VERSION = rt.ReleaseVersion; + runLog.BUSI_SYSTEM_CODE = info.Main.BusiSystemCode.ToUpper(); + runLog.BUSI_ID = info.Main.BusiId.ToUpper(); + runLog.SERVICE_WF_ID = rt.WFPKId; + runLog.SERVICE_PROJECT_CODE = rt.ProjectCode; + runLog.SERVICE_PROJECT_NAME = rt.ProjectName; + runLog.SOURCE_TYPE = info.Main.SourceType.ToString(); await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -524,6 +538,12 @@ namespace Myshipping.Application runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); runLog.ORDER_NO = info.Main?.OrderNo; runLog.RELEASE_VERSION = rt.ReleaseVersion; + runLog.BUSI_SYSTEM_CODE = info.Main.BusiSystemCode.ToUpper(); + runLog.BUSI_ID = info.Main.BusiId.ToUpper(); + runLog.SERVICE_WF_ID = rt.WFPKId; + runLog.SERVICE_PROJECT_CODE = rt.ProjectCode; + runLog.SERVICE_PROJECT_NAME = rt.ProjectName; + runLog.SOURCE_TYPE = info.Main.SourceType.ToString(); await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -570,6 +590,7 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Update"; + runLog.SOURCE_TYPE = info.Main.SourceType.ToString(); await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -652,6 +673,11 @@ namespace Myshipping.Application runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); runLog.ORDER_NO = info.Main?.OrderNo; runLog.RELEASE_VERSION = rt.ReleaseVersion; + runLog.BUSI_SYSTEM_CODE = info.Main.BusiSystemCode.ToUpper(); + runLog.BUSI_ID = info.Main.BusiId.ToUpper(); + runLog.SERVICE_WF_ID = rt.WFPKId; + runLog.SERVICE_PROJECT_CODE = rt.ProjectCode; + runLog.SERVICE_PROJECT_NAME = rt.ProjectName; await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -733,6 +759,11 @@ namespace Myshipping.Application runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); runLog.ORDER_NO = info.Main?.OrderNo; runLog.RELEASE_VERSION = rt.ReleaseVersion; + runLog.BUSI_SYSTEM_CODE = info.Main.BusiSystemCode.ToUpper(); + runLog.BUSI_ID = info.Main.BusiId.ToUpper(); + runLog.SERVICE_WF_ID = rt.WFPKId; + runLog.SERVICE_PROJECT_CODE = rt.ProjectCode; + runLog.SERVICE_PROJECT_NAME = rt.ProjectName; await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -776,6 +807,7 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.PUSH_STATUS.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Update"; + runLog.SOURCE_TYPE = info.Main.SourceType.ToString(); await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -799,6 +831,16 @@ namespace Myshipping.Application currIsYield = false; } + var beforeObj = new + { + ACT_VAL = activitiesRunInfo.ACT_VAL, + ACT_REMARK = activitiesRunInfo.ACT_REMARK, + ACT_DATE = activitiesRunInfo.ACT_DATE, + IS_YIELD = activitiesRunInfo.IS_YIELD + }; + + _logger.LogInformation("批次={no} 取消状态前记录 msg={msg}", batchNo, JSON.Serialize(beforeObj)); + if (currIsYield) { activitiesRunInfo.IS_YIELD = 1; @@ -843,6 +885,16 @@ namespace Myshipping.Application runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); runLog.ORDER_NO = info.Main?.OrderNo; runLog.RELEASE_VERSION = rt.ReleaseVersion; + runLog.BUSI_SYSTEM_CODE = info.Main.BusiSystemCode.ToUpper(); + runLog.BUSI_ID = info.Main.BusiId.ToUpper(); + runLog.SERVICE_WF_ID = rt.WFPKId; + runLog.SERVICE_PROJECT_CODE = rt.ProjectCode; + runLog.SERVICE_PROJECT_NAME = rt.ProjectName; + runLog.ACT_VAL = beforeObj.ACT_VAL; + runLog.ACT_DATE = beforeObj.ACT_DATE; + runLog.ACT_REMARK = beforeObj.ACT_REMARK; + runLog.IS_YIELD = beforeObj.IS_YIELD; + runLog.SOURCE_TYPE = info.Main.SourceType.ToString(); await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -868,6 +920,16 @@ namespace Myshipping.Application currIsYield = false; } + var beforeObj = new + { + ACT_VAL = activitiesRunInfo.ACT_VAL, + ACT_REMARK = activitiesRunInfo.ACT_REMARK, + ACT_DATE = activitiesRunInfo.ACT_DATE, + IS_YIELD = activitiesRunInfo.IS_YIELD + }; + + _logger.LogInformation("批次={no} 取消状态前记录 msg={msg}", batchNo, JSON.Serialize(beforeObj)); + if (currIsYield) { activitiesSubRunInfo.IS_YIELD = 1; @@ -913,6 +975,18 @@ namespace Myshipping.Application runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); runLog.ORDER_NO = info.Main?.OrderNo; runLog.RELEASE_VERSION = rt.ReleaseVersion; + runLog.ORDER_NO = info.Main?.OrderNo; + runLog.RELEASE_VERSION = rt.ReleaseVersion; + runLog.BUSI_SYSTEM_CODE = info.Main.BusiSystemCode.ToUpper(); + runLog.BUSI_ID = info.Main.BusiId.ToUpper(); + runLog.SERVICE_WF_ID = rt.WFPKId; + runLog.SERVICE_PROJECT_CODE = rt.ProjectCode; + runLog.SERVICE_PROJECT_NAME = rt.ProjectName; + runLog.ACT_VAL = beforeObj.ACT_VAL; + runLog.ACT_DATE = beforeObj.ACT_DATE; + runLog.ACT_REMARK = beforeObj.ACT_REMARK; + runLog.IS_YIELD = beforeObj.IS_YIELD; + runLog.SOURCE_TYPE = info.Main.SourceType.ToString(); await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -1297,6 +1371,7 @@ namespace Myshipping.Application runLog.OPER_TYPE = TrackingRunOperTypeEnum.CANCEL_PROJECT.ToString(); runLog.EXEC_RESULT = "SUCC"; runLog.EXEC_NOTE = "Update"; + runLog.SOURCE_TYPE = info.Main.SourceType.ToString(); await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion @@ -1379,6 +1454,16 @@ namespace Myshipping.Application var activitiesRunInfo = _serviceWorkFlowRunActivitiesInfoRepository .AsQueryable().First(b => b.PK_ID == detail.Detail.PK_ID); + var beforeObj = new + { + ACT_VAL = activitiesRunInfo.ACT_VAL, + ACT_REMARK = activitiesRunInfo.ACT_REMARK, + ACT_DATE = activitiesRunInfo.ACT_DATE, + IS_YIELD = activitiesRunInfo.IS_YIELD + }; + + _logger.LogInformation("批次={no} 取消状态前记录 msg={msg}", batchNo,JSON.Serialize(beforeObj)); + activitiesRunInfo.ACT_VAL = null; activitiesRunInfo.ACT_REMARK = null; activitiesRunInfo.ACT_DATE = null; @@ -1413,6 +1498,16 @@ namespace Myshipping.Application runLog.VESSEL_VOYNO = info.Main?.VesselVoyno.ToUpper(); runLog.ORDER_NO = info.Main?.OrderNo; runLog.RELEASE_VERSION = detail.Main.RELEASE_VERSION; + runLog.BUSI_SYSTEM_CODE = info.Main.BusiSystemCode.ToUpper(); + runLog.BUSI_ID = info.Main.BusiId.ToUpper(); + runLog.SERVICE_WF_ID = detail.Main.SERVICE_WF_ID.ToUpper(); + runLog.SERVICE_PROJECT_CODE = detail.Main.SERVICE_PROJECT_CODE.ToUpper(); + runLog.SERVICE_PROJECT_NAME = detail.Main.SERVICE_PROJECT_NAME.ToUpper(); + runLog.ACT_VAL = beforeObj.ACT_VAL; + runLog.ACT_DATE = beforeObj.ACT_DATE; + runLog.ACT_REMARK = beforeObj.ACT_REMARK; + runLog.IS_YIELD = beforeObj.IS_YIELD; + runLog.SOURCE_TYPE = info.Main.SourceType.ToString(); await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog); #endregion From 2eb352d78783853fba200aba54d2a25d59ca0c67 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Wed, 9 Aug 2023 13:47:31 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=BC=95=E5=85=A5?= =?UTF-8?q?=E5=9C=BA=E7=AB=99=E6=95=B0=E6=8D=AE=E6=8F=90=E7=A4=BA=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/BookingYardDataAuto.cs | 33 +++ .../Entity/Booking_AutoYardImport.cs | 44 ++++ .../BookingOrder/BookingOrderService.cs | 208 +++++++++++++++--- 3 files changed, 258 insertions(+), 27 deletions(-) create mode 100644 Myshipping.Application/Entity/BookingYardDataAuto.cs create mode 100644 Myshipping.Application/Entity/Booking_AutoYardImport.cs diff --git a/Myshipping.Application/Entity/BookingYardDataAuto.cs b/Myshipping.Application/Entity/BookingYardDataAuto.cs new file mode 100644 index 00000000..31984631 --- /dev/null +++ b/Myshipping.Application/Entity/BookingYardDataAuto.cs @@ -0,0 +1,33 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application.Entity +{ + [SugarTable("booking_auto_yard_import")] + [Description("场站数据自动引入状态")] + public class BookingYardDataAuto + { + /// + /// 主键 + /// + [SugarColumn(IsIdentity = true, ColumnDescription = "Id主键", IsPrimaryKey = true)] //通过特性设置主键和自增列 + public long Id { get; set; } + /// + /// 状态:引入成功、比对失败 + /// + public string Status { get; set; } + /// + /// 比对结果内容 + /// + public string Content { get; set; } + /// + /// 创建时间 + /// + public DateTime? CreatedTime { get; set; } + } +} diff --git a/Myshipping.Application/Entity/Booking_AutoYardImport.cs b/Myshipping.Application/Entity/Booking_AutoYardImport.cs new file mode 100644 index 00000000..df376573 --- /dev/null +++ b/Myshipping.Application/Entity/Booking_AutoYardImport.cs @@ -0,0 +1,44 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application.Entity +{ + /// + /// + /// + [SugarTable("booking_auto_yard_import")] + [Description("场站自动引入信息")] + public class Booking_AutoYardImport + { + /// + /// 主键 + /// + [SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)] //通过特性设置主键和自增列 + public long Id { get; set; } + /// + /// 状态:引入成功、比对失败 + /// + public string Status { get; set; } + /// + /// 比对结果内容 + /// + public string Content { get; set; } + /// + /// 创建时间 + /// + public DateTime? CreatedTime { get; set; } + /// + /// 场站数据JSON + /// + public string YardJson { get; set; } + /// + /// 比对数据时填写的箱信息JSON + /// + public string CtnJson { get; set; } + } +} diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index f1b1c412..06dd8e4d 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -129,6 +129,7 @@ namespace Myshipping.Application private readonly IBookingGoodsStatusConfigService _GoodsConfig; private readonly SqlSugarRepository _repLineOpMgrConfig; private readonly SqlSugarRepository _repSysEmp; + private readonly SqlSugarRepository _repAutoYard; const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING"; @@ -151,7 +152,7 @@ namespace Myshipping.Application SqlSugarRepository excelrep, SqlSugarRepository repUserMail, SqlSugarRepository goodsStatus, SqlSugarRepository goodsStatusConfig, SqlSugarRepository repTenant, SqlSugarRepository repBookingStatus, SqlSugarRepository bookingEDIExt, SqlSugarRepository serviceItem, SqlSugarRepository paraContractNoInfoRepository, IHttpContextAccessor httpContextAccessor, IBookingGoodsStatusConfigService GoodsConfig, SqlSugarRepository djyWebsiteAccountConfigRepository, - ISysOrgService orgService, SqlSugarRepository repLineOpMgrConfig, SqlSugarRepository repSysEmp) + ISysOrgService orgService, SqlSugarRepository repLineOpMgrConfig, SqlSugarRepository repSysEmp, SqlSugarRepository repAutoYard) { this._logger = logger; this._rep = rep; @@ -196,6 +197,7 @@ namespace Myshipping.Application this._repLineOpMgrConfig = repLineOpMgrConfig; this._repSysEmp = repSysEmp; + this._repAutoYard = repAutoYard; } #region 主表和箱信息 @@ -7596,41 +7598,193 @@ namespace Myshipping.Application return; } - var rtn = await GetYardDataAndMappingSystem(order, false); - await _repCtn.DeleteAsync(x => x.BILLID == bookId); + /* +孙晓菲: +HLCUTA12307DPXJ3 以这票为例 6个柜 +录单的时候件重尺就没填 是0 所以展开箱量的时候件重尺也都会是0 +在引入场站数据的时候,件重尺直接覆盖即可 + +另一种情况,录单的时候件重尺有填写,所以展开箱量的时候件重尺也会自动均分且有数字 +在引入场站数据的时候,件重尺可以直接覆盖或者不覆盖 但要给操作提醒 此处件重尺不一致 + */ + + /* + 分析: + 单行20GP*6这种,无件重尺,场站箱数和填写箱数一致,则自动展开覆盖 + 单行20GP*6这种,件重尺任意一个填写过,场站箱数一致,且均分后的件重尺匹配填写的件重尺,则自动展开覆盖 - _logger.LogInformation($"{bookId}({order.MBLNO})的箱封号自动引入获取场站数据:{rtn.ToJsonString()}"); + */ - //场站数据的包装经常为空,因此取场站数据时,如果包装为空,从主信息或填写过的箱信息的包装中获取 - var ctnKindPkg = ctns.FirstOrDefault(x => !string.IsNullOrEmpty(x.KINDPKGS)); - var kindPkg = order.KINDPKGS; - if (string.IsNullOrEmpty(kindPkg) && ctnKindPkg != null) + var match = true; + var rtn = await GetYardDataAndMappingSystem(order, false); //拉取场站的数据 + var groupYardList = rtn.GroupBy(x => x.CTNALL).Select(x => new { CTNALL = x.Key, COUNT = x.Count() }).ToList(); //按箱型分组计算箱量(场站) + var groupCtnDist = ctns.Select(x => x.CTNALL).Distinct().ToList(); + if (groupYardList.Count != groupCtnDist.Count) { - kindPkg = ctnKindPkg.KINDPKGS; + //箱型不匹配 + match = false; + + //写入提示 + await SaveAutoYardData(bookId, false, + $"箱型不匹配,场站:{string.Join("、", groupCtnDist)},填写:{string.Join("、", groupYardList.Select(x => x.CTNALL))}", + ctns.ToJson(), rtn.ToJson()); + } + else + { + foreach (var item in groupYardList) + { + var find = ctns.FirstOrDefault(x => x.CTNALL == item.CTNALL); + if (find == null) + { + //箱型不匹配 + match = false; - foreach (var item in rtn) + //写入提示 + await SaveAutoYardData(bookId, false, + $"箱型不匹配,场站:{item.CTNALL},填写:未找到", + ctns.ToJson(), rtn.ToJson()); + + break; + } + + if (find.CTNNUM.Value != item.COUNT) + { + //item.CTNALL 箱数不匹配 + match = false; + + //写入提示 + await SaveAutoYardData(bookId, false, + $"箱型箱量不匹配,场站:{item.CTNALL}*{item.COUNT},填写:{find.CTNALL}*{find.CTNNUM}", + ctns.ToJson(), rtn.ToJson()); + + break; + } + } + } + + //箱型 箱量都校验过了,校验件重尺 + if (match) { - var ctn = new BookingCtn(); - ctn.BILLID = order.Id; - ctn.CTNCODE = item.CtnCode; - ctn.CTNALL = item.CTNALL; - ctn.CTNNUM = 1; - ctn.CNTRNO = item.CNTRNO; - ctn.SEALNO = item.SEALNO; - ctn.KINDPKGS = string.IsNullOrEmpty(item.KINDPKGS) ? kindPkg : item.KINDPKGS; - ctn.PKGS = item.PKGS; - ctn.KGS = Convert.ToDecimal(item.KGS); - ctn.CBM = Convert.ToDecimal(item.CBM); - ctn.TAREWEIGHT = Convert.ToDecimal(item.TAREWEIGHT); - ctn.TenantId = order.TenantId; - ctn.CreatedUserId = order.CreatedUserId; - ctn.CreatedUserName = "系统"; - await _repCtn.InsertAsync(ctn); + var listPKGS = ctns.Where(x => x.PKGS > 0).ToList(); //填写了件数 + foreach (var item in listPKGS) + { + var sumPkgs = rtn.Where(x => x.CTNALL == item.CTNALL).Sum(x => x.PKGS); + if (sumPkgs != item.PKGS) + { + //件数不一致 + match = false; + + //写入提示 + await SaveAutoYardData(bookId, false, + $"件数不一致,场站:{sumPkgs},填写:{item.PKGS}", + ctns.ToJson(), rtn.ToJson()); + break; + } + } + + var listKGS = ctns.Where(x => x.KGS > 0).ToList(); //填写了重量 + foreach (var item in listKGS) + { + var sumKgs = rtn.Where(x => x.CTNALL == item.CTNALL).Sum(x => x.KGS); + if (Convert.ToDecimal(sumKgs.Value) != item.KGS.Value) + { + //重量不一致 + match = false; + + //写入提示 + await SaveAutoYardData(bookId, false, + $"重量不一致,场站:{sumKgs},填写:{item.KGS}", + ctns.ToJson(), rtn.ToJson()); + + break; + } + } + + var listCBM = ctns.Where(x => x.CBM > 0).ToList(); //填写了尺码 + foreach (var item in listCBM) + { + var sumCBM = rtn.Where(x => x.CTNALL == item.CTNALL).Sum(x => x.CBM); + if (Convert.ToDecimal(sumCBM.Value) != item.CBM.Value) + { + //尺码不一致 + match = false; + + //写入提示 + await SaveAutoYardData(bookId, false, + $"尺码不一致,场站:{sumCBM},填写:{item.CBM}", + ctns.ToJson(), rtn.ToJson()); + + break; + } + } } - _logger.LogInformation($"{bookId}({order.MBLNO})的箱封号自动引入完成"); + if (match) + { + var cfgDevSwitch = (await _cache.GetAllSysConfig()).FirstOrDefault(x => x.Name == "AutoYardDataDevSwitch"); + + if (cfgDevSwitch != null && cfgDevSwitch.Value == "0") + { + await _repCtn.DeleteAsync(x => x.BILLID == bookId); + + _logger.LogInformation($"{bookId}({order.MBLNO})的箱封号自动引入获取场站数据:{rtn.ToJsonString()}"); + //场站数据的包装经常为空,因此取场站数据时,如果包装为空,从主信息或填写过的箱信息的包装中获取 + var ctnKindPkg = ctns.FirstOrDefault(x => !string.IsNullOrEmpty(x.KINDPKGS)); + var kindPkg = order.KINDPKGS; + if (string.IsNullOrEmpty(kindPkg) && ctnKindPkg != null) + { + kindPkg = ctnKindPkg.KINDPKGS; + } + + foreach (var item in rtn) + { + var ctn = new BookingCtn(); + ctn.BILLID = order.Id; + ctn.CTNCODE = item.CtnCode; + ctn.CTNALL = item.CTNALL; + ctn.CTNNUM = 1; + ctn.CNTRNO = item.CNTRNO; + ctn.SEALNO = item.SEALNO; + ctn.KINDPKGS = string.IsNullOrEmpty(item.KINDPKGS) ? kindPkg : item.KINDPKGS; + ctn.PKGS = item.PKGS; + ctn.KGS = Convert.ToDecimal(item.KGS); + ctn.CBM = Convert.ToDecimal(item.CBM); + ctn.TAREWEIGHT = Convert.ToDecimal(item.TAREWEIGHT); + ctn.TenantId = order.TenantId; + ctn.CreatedUserId = order.CreatedUserId; + ctn.CreatedUserName = "系统"; + await _repCtn.InsertAsync(ctn); + } + + _logger.LogInformation($"{bookId}({order.MBLNO})的箱封号自动引入完成"); + } + + + //写入提示 + await SaveAutoYardData(bookId, true, $"已自动引入", ctns.ToJson(), rtn.ToJson()); + + } + } + + /// + /// 写入自动引入场站数据信息数据 + /// + /// + [NonAction] + private async Task SaveAutoYardData(long bookId, bool success, string content, string ctnJson, string yardJson) + { + await _repAutoYard.DeleteAsync(x => x.Id == bookId); + + //写入提示 + var autoYard = new Booking_AutoYardImport(); + autoYard.Id = bookId; + autoYard.Status = success ? "已导入" : "未导入"; + autoYard.Content = content; + autoYard.CtnJson = ctnJson; + autoYard.YardJson = yardJson; + await _repAutoYard.InsertAsync(autoYard); } ///