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/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 c18d91db..affe427b 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
///
@@ -52,11 +51,20 @@ namespace Myshipping.Application.Entity
///
public string BUSI_SYSTEM_CODE { get; set; }
+ ///
+ /// 请求来源
+ ///
+ public string SOURCE_TYPE { get; set; }
+
///
/// 业务主键
///
public string BUSI_ID { get; set; }
+ ///
+ /// 提单号
+ ///
+ public string MBL_NO { get; set; }
///
/// 船名航次
///
@@ -72,6 +80,11 @@ namespace Myshipping.Application.Entity
///
public string SERVICE_WF_ID { get; set; }
+ ///
+ /// 发布版本
+ ///
+ public string RELEASE_VERSION { get; set; }
+
///
/// 服务项代码
///
@@ -107,6 +120,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/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);
}
///
diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs
index 74edb012..160b59d7 100644
--- a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs
+++ b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs
@@ -163,5 +163,25 @@ namespace Myshipping.Application
/// 触发器列表
///
public List TriggerList { get; set; }
+
+ ///
+ /// 分组名称
+ ///
+ public string GroupName { get; set; }
+
+ ///
+ /// 服务流程排序值
+ ///
+ public int WFSortNo { get; set; }
+
+ ///
+ /// 计算排序值
+ ///
+ 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 48be3504..008f9ecd 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,19 @@ 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";
+ runLog.SOURCE_TYPE = info.Main.SourceType.ToString();
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
}
else if (tsk.OperType == "Update")
{
@@ -210,12 +224,31 @@ 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 写入运行日志
+ 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";
+ runLog.SOURCE_TYPE = info.Main.SourceType.ToString();
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
}
});
@@ -326,6 +359,24 @@ 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";
+ 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
+
//获取状态最大数
int endNum = rt.StatusList.Max(sku => sku.ActSortNo);
@@ -359,15 +410,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;
@@ -377,6 +439,29 @@ 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";
+ 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;
+ 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
+
if (sku.SubStatusList != null && sku.SubStatusList.Count > 0)
{
string lastSubActId = string.Empty;
@@ -410,17 +495,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;
}
@@ -430,6 +525,29 @@ 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";
+ 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;
+ 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
+
lastSubActId = activitiesSubRunInfo.PK_ID;
});
@@ -463,6 +581,19 @@ 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";
+ runLog.SOURCE_TYPE = info.Main.SourceType.ToString();
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
}
//批量写入活动表
@@ -500,15 +631,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;
@@ -518,6 +660,28 @@ 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";
+ 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;
+ 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
+
if (sku.SubStatusList != null && sku.SubStatusList.Count > 0)
{
string lastSubActId = string.Empty;
@@ -551,15 +715,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;
@@ -571,6 +746,28 @@ 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";
+ 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;
+ 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
+
lastSubActId = activitiesSubRunInfo.PK_ID;
});
@@ -601,6 +798,19 @@ 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";
+ runLog.SOURCE_TYPE = info.Main.SourceType.ToString();
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
}
//只需要更新完成标记和完成时间
rt.StatusList.ForEach(async sku =>
@@ -613,17 +823,37 @@ 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
+
+ var beforeObj = new
{
- activitiesRunInfo.ACT_DATE = nowDate;
- }
+ 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;
+ 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;
@@ -641,6 +871,33 @@ 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";
+ 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;
+ 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
}
if (sku.SubStatusList != null && sku.SubStatusList.Count > 0)
@@ -655,15 +912,36 @@ 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
+
+ var beforeObj = new
{
- activitiesSubRunInfo.ACT_DATE = nowDate;
+ 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;
+
+ if (st.StatusDate.HasValue)
+ {
+ activitiesSubRunInfo.ACT_DATE = st.StatusDate.Value;
+ }
+ else
+ {
+ activitiesSubRunInfo.ACT_DATE = nowDate;
+ }
}
activitiesSubRunInfo.ACT_VAL = st.StatusVal;
@@ -683,6 +961,35 @@ 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";
+ 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;
+ 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
}
});
}
@@ -1043,12 +1350,31 @@ 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";
+ runLog.SOURCE_TYPE = info.Main.SourceType.ToString();
+
+ await _serviceWorkFlowRunLogInfoRepository.InsertAsync(runLog);
+ #endregion
}
});
@@ -1098,8 +1424,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 =>
{
@@ -1130,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;
@@ -1150,6 +1484,33 @@ 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;
+ 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
}
});
});
@@ -1466,7 +1827,10 @@ 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) => {
@@ -1486,7 +1850,9 @@ namespace Myshipping.Application
ShowName = b.ShowName,
IsYield = false,
StatusSKUCode = b.StatusSKUCode,
- ActRemark = b.ActRemark
+ ActRemark = b.ActRemark,
+ WFSortNo = l.SortNo,
+ CalcSortNo = (decimal)b.ActSortNo,
});
if(b.SubStatusList != null && b.SubStatusList.Count > 0)
@@ -1498,29 +1864,75 @@ namespace Myshipping.Application
ShowName = c.ShowName,
IsYield = false,
StatusSKUCode = b.StatusSKUCode,
- ActRemark = b.ActRemark
+ ActRemark = b.ActRemark,
+ 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
- }).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());
+ }
+ });
}
}
+ 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).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.CalcSortNo).ToList();
result.succ = true;