diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs index 85914b90..e8e0ca89 100644 --- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs +++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs @@ -39,5 +39,10 @@ namespace Myshipping.Application /// 是否包含子状态 1-包含 0-不包含 /// public int IS_CONTAINS_SUB { get; set; } + + /// + /// 值类型 STRING-字符 DATETIME-日期 + /// + public string VAL_TYPE { get; set; } } } diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs index cb91b52d..c5a82824 100644 --- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs +++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs @@ -39,5 +39,10 @@ namespace Myshipping.Application /// 显示顺序号 /// public int SORT_NO { get; set; } + + /// + /// 值类型 STRING-字符 DATETIME-日期 + /// + public string VAL_TYPE { get; set; } } } diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunActivitiesInfo.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunActivitiesInfo.cs index c15403a2..217c42c6 100644 --- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunActivitiesInfo.cs +++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowRunActivitiesInfo.cs @@ -1,12 +1,87 @@ -using System; +using Furion.DistributedIDGenerator; +using Myshipping.Application.Entity.TrackingSystem; +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 { - public class ServiceWorkFlowRunActivitiesInfo + /// + /// 服务流程运行活动表 + /// + [SugarTable("service_workflow_run_activities")] + [Description("服务流程运行活动表")] + public class ServiceWorkFlowRunActivitiesInfo : TrackingSystemDbEntity { + public ServiceWorkFlowRunActivitiesInfo() + { + PK_ID = IDGen.NextID().ToString(); + + CreatedTime = DateTime.Now; + } + + /// + /// 运行主键 + /// + public string RUN_ID { get; set; } + + /// + /// 执行顺序号 + /// + public int EXEC_SORT_NO { get; set; } + + /// + /// 是否起始 1-是 0-否 + /// + public int IS_START { get; set; } + + /// + /// 是否结束 1-是 0-否 + /// + public int IS_END { get; set; } + + /// + /// 活动主键 + /// + public string ACT_ID { get; set; } + + /// + /// 活动值 + /// + public string ACT_VAL { get; set; } + + /// + /// 活动发生时间 + /// + public Nullable ACT_DATE { get; set; } + + /// + /// 是否已产生 1-已产生 0-未产生 + /// + public int IS_YIELD { get; set; } + + /// + /// 状态主键 + /// + public string STATUS_SKU_ID { get; set; } + + /// + /// 状态代码 + /// + public string STATUS_SKU_CODE { get; set; } + + /// + /// 状态显示名称 + /// + public string SHOW_NAME { get; set; } + + /// + /// 来源类型 AUTO-自动 MANUAL-人工 + /// + public string SOURCE_TYPE { get; set; } } } diff --git a/Myshipping.Application/Enum/StatusSKUValTypeEnum.cs b/Myshipping.Application/Enum/StatusSKUValTypeEnum.cs new file mode 100644 index 00000000..9304b99c --- /dev/null +++ b/Myshipping.Application/Enum/StatusSKUValTypeEnum.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 StatusSKUValTypeEnum + { + /// + /// 日期 + /// + [Description("日期")] + DATETIME, + /// + /// 已提交 + /// + [Description("字符")] + STRING, + } +} diff --git a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs index 72f4dfb4..7a46f465 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs @@ -1031,26 +1031,28 @@ namespace Myshipping.Application 4、请求相应的链接。 5、返回成功写入附件。 */ - if (string.IsNullOrWhiteSpace(bookingOrder.MBLNO)) + + //2023-07-06 按照最新要求,从订舱编号取单号 + if (string.IsNullOrWhiteSpace(bookingOrder.CUSTNO)) { - if (!string.IsNullOrWhiteSpace(bookingOrder.CUSTNO)) + if (!string.IsNullOrWhiteSpace(bookingOrder.MBLNO)) { - result.bno = $"订 {bookingOrder.CUSTNO}"; + result.bno = $"订 {bookingOrder.MBLNO}"; } else { result.bno = $"NO.{sortNo}"; } - throw Oops.Bah($"主提单号不能为空"); + throw Oops.Bah($"订舱编号不能为空"); } else { - if (Regex.IsMatch(bookingOrder.MBLNO, "\\bESL\\w+")) + if (Regex.IsMatch(bookingOrder.CUSTNO, "\\bESL\\w+")) { - _logger.LogInformation("批次={no} id={id} 主提单号没填写参考号,无法继续", batchNo, bookingOrder.Id); + _logger.LogInformation("批次={no} id={id} 订舱编号没填写参考号,无法继续", batchNo, bookingOrder.Id); - throw Oops.Oh($"主提单号不是有效的参考号"); + throw Oops.Oh($"订舱编号不是有效的参考号"); } } @@ -1058,13 +1060,13 @@ namespace Myshipping.Application .FirstOrDefault(t => t.Module.Equals(CONST_MAPPING_MANIALLO_CHK_MODULE_ROUTE, StringComparison.OrdinalIgnoreCase) && t.Code.Equals(bookingOrder.CARRIERID?.Trim(), StringComparison.OrdinalIgnoreCase)); - _logger.LogInformation("提单号【{mbl}】根据订舱的船公司代码{ca} 提取船公司映射完成,结果={rlt}", - bookingOrder.MBLNO, bookingOrder.CARRIERID, bcOrDraftRouteCfg); + _logger.LogInformation("订舱编号【{mbl}】根据订舱的船公司代码{ca} 提取船公司映射完成,结果={rlt}", + bookingOrder.CUSTNO, bookingOrder.CARRIERID, bcOrDraftRouteCfg); if (bcOrDraftRouteCfg == null) { - _logger.LogInformation("提单号{mbl} 根据订舱的船公司代码{ca} 提取船公司映射失败", - bookingOrder.MBLNO, bookingOrder.CARRIERID); + _logger.LogInformation("订舱编号{mbl} 根据订舱的船公司代码{ca} 提取船公司映射失败", + bookingOrder.CUSTNO, bookingOrder.CARRIERID); throw Oops.Bah($"船公司={bookingOrder.CARRIERID} 暂不支持舱位分配查询"); } @@ -1074,13 +1076,13 @@ namespace Myshipping.Application var bcUrl = _cache.GetAllDictData().GetAwaiter().GetResult() .FirstOrDefault(x => x.TypeCode == "url_set" && x.Code.Equals(urlKey, StringComparison.OrdinalIgnoreCase))?.Value; - _logger.LogInformation("提单号{mbl} 根据订舱的船公司代码{ca} 提取舱位分配查询URL完成,结果={rlt}", - bookingOrder.MBLNO, bookingOrder.CARRIERID, bcUrl); + _logger.LogInformation("订舱编号{mbl} 根据订舱的船公司代码{ca} 提取舱位分配查询URL完成,结果={rlt}", + bookingOrder.CUSTNO, bookingOrder.CARRIERID, bcUrl); if (string.IsNullOrWhiteSpace(bcUrl)) { - _logger.LogInformation("提单号{0} 根据订舱的船公司代码{1} 提取舱位分配查询URL失败,未取到配置key={key}", - bookingOrder.MBLNO, bookingOrder.CARRIERID, urlKey); + _logger.LogInformation("订舱编号{0} 根据订舱的船公司代码{1} 提取舱位分配查询URL失败,未取到配置key={key}", + bookingOrder.CUSTNO, bookingOrder.CARRIERID, urlKey); throw Oops.Bah($"船公司={bookingOrder.CARRIERID} 未配置请求地址{urlKey} 请联系管理员"); } @@ -1100,7 +1102,7 @@ namespace Myshipping.Application { u = userWebAccountConfig.Account?.Trim(), p = userWebAccountConfig.Password?.Trim(), - so_no = bookingOrder.MBLNO, + so_no = bookingOrder.CUSTNO, }; _logger.LogInformation("批次={no} json={json} 请求舱位分配查询远端下载开始", batchNo, JSON.Serialize(requestDto)); @@ -1137,18 +1139,19 @@ namespace Myshipping.Application throw Oops.Oh($"订舱信息获取失败,无法更新"); } - + + /* //2023-07-06 按照最新要求,从订舱编号取单号,所以这里不判断了 if(Regex.IsMatch(bkInfo.MBLNO,"\\bESL\\w+")) { _logger.LogInformation("批次={no} id={id} 主提单号已变更,无法更新", batchNo, bookingOrder.Id); throw Oops.Oh($"主提单号已变更,无法更新"); - } + }*/ _logger.LogInformation("批次={no} 变更前记录 id={id} MBLNO={MBLNO} CUSTNO={CUSTNO} esl_no={eslno}", batchNo, bookingOrder.Id, bkInfo.MBLNO, bkInfo.CUSTNO, rlt.data.esl_no); - bkInfo.CUSTNO = bkInfo.MBLNO; + //bkInfo.CUSTNO = bkInfo.MBLNO; bkInfo.MBLNO = rlt.data.esl_no.Trim().ToUpper(); bkInfo.UpdatedTime = DateTime.Now; bkInfo.UpdatedUserId = UserManager.UserId; @@ -1156,7 +1159,6 @@ namespace Myshipping.Application await _bookingOrderRepository.AsUpdateable(bkInfo).UpdateColumns(it => new { - it.CUSTNO, it.MBLNO, it.UpdatedTime, it.UpdatedUserId, diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowActivitiesDto.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowActivitiesDto.cs index b692a8b9..e334f857 100644 --- a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowActivitiesDto.cs +++ b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowActivitiesDto.cs @@ -36,6 +36,11 @@ namespace Myshipping.Application /// public int IsContainsSub { get; set; } + /// + /// 值类型 + /// + public string ValType { get; set; } + /// /// 子活动列表 /// diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowActivitiesRunDto.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowActivitiesRunDto.cs new file mode 100644 index 00000000..f3b169bf --- /dev/null +++ b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowActivitiesRunDto.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 服务流程运行活动表 + /// + public class ServiceWorkFlowActivitiesRunDto + { + /// + /// 主键 + /// + public string PKId { get; set; } + + /// + /// 主键 + /// + public string RunId { get; set; } + + /// + /// + /// + public int ExecSortNo { get; set; } + + /// + /// 是否起始 1-是 0-否 + /// + public int IsStart { get; set;} + + /// + /// 是否结束 1-是 0-否 + /// + public int IsEnd { get; set; } + + /// + /// 活动主键 + /// + public string ActId { get; set; } + + /// + /// 活动值 + /// + public string ActVal { get; set; } + + /// + /// 是否已产生 1-已产生 0-未产生 + /// + public int IsYield { get; set; } + + /// + /// 活动发生时间 + /// + public Nullable ActDate { get; set; } + + /// + /// 状态主键 + /// + public string StatusSKUId { get; set; } + + /// + /// 状态代码 + /// + public string StatusSKUCode { get; set; } + + /// + /// 状态显示名称 + /// + public string ShowName { get; set; } + + /// + /// 来源类型 AUTO-自动 MANUAL-人工 + /// + public string SourceType { get; set; } + + /// + /// 子活动列表 + /// + public List SubList { get; set; } + } + + public class ServiceWorkFlowActivitiesRunSubDto + { + /// + /// 主键 + /// + public string PKId { get; set; } + + /// + /// 主键 + /// + public string RunId { get; set; } + + /// + /// + /// + public int ExecSortNo { get; set; } + + /// + /// 是否起始 1-是 0-否 + /// + public int IsStart { get; set; } + + /// + /// 是否结束 1-是 0-否 + /// + public int IsEnd { get; set; } + + /// + /// 活动主键 + /// + public string ActId { get; set; } + + /// + /// 活动值 + /// + public string ActVal { get; set; } + + /// + /// 是否已产生 1-已产生 0-未产生 + /// + public int IsYield { get; set; } + + /// + /// 活动发生时间 + /// + public Nullable ActDate { get; set; } + + /// + /// 状态主键 + /// + public string StatusSKUId { get; set; } + + /// + /// 状态代码 + /// + public string StatusSKUCode { get; set; } + + /// + /// 状态显示名称 + /// + public string ShowName { get; set; } + + /// + /// 来源类型 AUTO-自动 MANUAL-人工 + /// + public string SourceType { get; set; } + } +} diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowActivitiesShowDto.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowActivitiesShowDto.cs index b8c84e9f..bf252207 100644 --- a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowActivitiesShowDto.cs +++ b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowActivitiesShowDto.cs @@ -36,6 +36,11 @@ namespace Myshipping.Application /// public int IsContainsSub { get; set; } + /// + /// 值类型 STRING-字符 DATETIME-日期 + /// + public string ValType { get; set; } + /// /// 子活动列表 /// diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowRunDto.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowRunDto.cs index eb491125..d287ad7f 100644 --- a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowRunDto.cs +++ b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowRunDto.cs @@ -29,6 +29,6 @@ namespace Myshipping.Application /// /// 状态列表 /// - public List ActivitiesList{ get; set; } + public List ActivitiesList{ get; set; } } } diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs index ee9c53d0..d726a151 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs @@ -271,7 +271,8 @@ namespace Myshipping.Application PK_ID = IDGen.NextID().ToString(), SERVICE_WORKFLOW_ID = entity.PK_ID, SERVICE_ACTIVITIES_ID = sku.PKId, - IS_CONTAINS_SUB = sku.IsContainsSub + IS_CONTAINS_SUB = sku.IsContainsSub, + VAL_TYPE = !string.IsNullOrWhiteSpace(sku.ValType)? sku.ValType: StatusSKUValTypeEnum.DATETIME.ToString() }; await _serviceWorkFlowActivitiesRelationRepository.InsertAsync(wfRelationActivities); @@ -375,7 +376,7 @@ namespace Myshipping.Application rela.SERVICE_ACTIVITIES_ID == act.PK_ID && rela.SERVICE_WORKFLOW_ID == pkId) .LeftJoin((rela, act, sku) => act.STATUS_SKU_ID == sku.PK_ID) .Select((rela, act, sku) => - new { Act = act, Sku = sku, SortNo = rela.SORT_NO, IsSub = rela.IS_CONTAINS_SUB }) + new { Act = act, Sku = sku, SortNo = rela.SORT_NO, IsSub = rela.IS_CONTAINS_SUB,ValType = rela.VAL_TYPE }) .ToList(); if (activitiesList.Count > 0) @@ -387,6 +388,7 @@ namespace Myshipping.Application actModel.SortNo = a.SortNo; actModel.IsContainsSub = a.IsSub; + actModel.ValType = a.ValType; actModel.statusSkuBase = a.Sku.Adapt(); return actModel; @@ -444,6 +446,7 @@ namespace Myshipping.Application /// /// 服务流程详情 /// 返回回执 + [HttpPost("/ServiceWorkFlowBase/SaveAndEnable")] public async Task SaveAndEnable(ServiceWorkFlowBaseDto info) { TaskManageOrderResultDto result = new TaskManageOrderResultDto(); @@ -946,17 +949,64 @@ namespace Myshipping.Application { showModel.ServiceProjectName = model.ServiceProject.ServiceProjectName; showModel.ServiceProjectCode = model.ServiceProject.ServiceProjectCode; - } if (model.StatusSkuList != null && model.StatusSkuList.Count > 0) { - //showModel.ActivitiesList = model.StatusSkuList.Select(a => { - - //}).ToList(); - } + int endSortNo = model.StatusSkuList.Max(a => a.SortNo); + DateTime startDate = DateTime.Now.AddDays(-(endSortNo + 1)); + showModel.ActivitiesList = model.StatusSkuList.Select(a => { + + var runModel = new ServiceWorkFlowActivitiesRunDto + { + PKId = Guid.NewGuid().ToString(), + ActDate = startDate.AddDays(a.SortNo), + ActId = a.PKId, + ExecSortNo = a.SortNo, + ActVal = string.Empty, + IsStart = (a.SortNo == 1) ? 1 : 0, + IsEnd = (a.SortNo == endSortNo) ? 1 : 0, + IsYield = 1, + RunId = Guid.NewGuid().ToString(), + ShowName = a.ShowName, + SourceType = "AUTO", + StatusSKUCode = a.statusSkuBase.StatusSKUCode, + StatusSKUId = a.StatusSKUId + }; + + if(a.IsContainsSub == 1) + { + int endSubSortNo = a.SubList.Max(a => a.SortNo); + + DateTime startSubDate = DateTime.Now.AddDays(-(endSubSortNo + 1)); + + runModel.SubList = a.SubList.Select(b => { + var subModel = new ServiceWorkFlowActivitiesRunSubDto { + PKId = Guid.NewGuid().ToString(), + ActDate = startSubDate.AddDays(b.SortNo), + ActId = b.PKId, + ExecSortNo = b.SortNo, + ActVal = string.Empty, + IsStart = (b.SortNo == 1) ? 1 : 0, + IsEnd = (b.SortNo == endSortNo) ? 1 : 0, + IsYield = 1, + RunId = Guid.NewGuid().ToString(), + ShowName = b.ShowName, + SourceType = "AUTO", + StatusSKUCode = b.statusSkuBase.StatusSKUCode, + StatusSKUId = b.StatusSKUId + }; + + return subModel; + }).ToList(); + } + + return runModel; + + }).ToList(); + } }