wet 1 year ago
commit bd8c12642c

@ -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
{
/// <summary>
/// 主键
/// </summary>
[SugarColumn(IsIdentity = true, ColumnDescription = "Id主键", IsPrimaryKey = true)] //通过特性设置主键和自增列
public long Id { get; set; }
/// <summary>
/// 状态:引入成功、比对失败
/// </summary>
public string Status { get; set; }
/// <summary>
/// 比对结果内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreatedTime { get; set; }
}
}

@ -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
{
/// <summary>
///
/// </summary>
[SugarTable("booking_auto_yard_import")]
[Description("场站自动引入信息")]
public class Booking_AutoYardImport
{
/// <summary>
/// 主键
/// </summary>
[SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)] //通过特性设置主键和自增列
public long Id { get; set; }
/// <summary>
/// 状态:引入成功、比对失败
/// </summary>
public string Status { get; set; }
/// <summary>
/// 比对结果内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreatedTime { get; set; }
/// <summary>
/// 场站数据JSON
/// </summary>
public string YardJson { get; set; }
/// <summary>
/// 比对数据时填写的箱信息JSON
/// </summary>
public string CtnJson { get; set; }
}
}

@ -17,13 +17,6 @@ namespace Myshipping.Application.Entity
[Description("服务流程主表")] [Description("服务流程主表")]
public class ServiceWorkFlowRunInfo : TrackingSystemDbEntity public class ServiceWorkFlowRunInfo : TrackingSystemDbEntity
{ {
public ServiceWorkFlowRunInfo()
{
PK_ID = IDGen.NextID().ToString();
CreatedTime = DateTime.Now;
}
/// <summary> /// <summary>
/// 服务流程主键 /// 服务流程主键
/// </summary> /// </summary>

@ -1,6 +1,7 @@
using Furion.DistributedIDGenerator; using Furion.DistributedIDGenerator;
using Myshipping.Application.Entity.TrackingSystem; using Myshipping.Application.Entity.TrackingSystem;
using Myshipping.Core; using Myshipping.Core;
using NPOI.HSSF.Record.AutoFilter;
using SqlSugar; using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -19,13 +20,6 @@ namespace Myshipping.Application.Entity
[Tenant(CommonConst.MasterDb)] [Tenant(CommonConst.MasterDb)]
public class ServiceWorkFlowRunLogInfo public class ServiceWorkFlowRunLogInfo
{ {
public ServiceWorkFlowRunLogInfo()
{
PK_ID = IDGen.NextID().ToString();
CreatedTime = DateTime.Now;
}
/// <summary> /// <summary>
/// 主键 /// 主键
/// </summary> /// </summary>
@ -37,6 +31,11 @@ namespace Myshipping.Application.Entity
/// </summary> /// </summary>
public string BATCH_NO { get; set; } public string BATCH_NO { get; set; }
/// <summary>
/// 操作类型 PUSH_PROJECT 推送服务CANCEL_PROJECT 取消服务PUSH_STATUS 推送状态CANCEL_STATUS 取消状态
/// </summary>
public string OPER_TYPE { get; set; }
/// <summary> /// <summary>
/// 服务流程运行主表ID /// 服务流程运行主表ID
/// </summary> /// </summary>
@ -52,11 +51,20 @@ namespace Myshipping.Application.Entity
/// </summary> /// </summary>
public string BUSI_SYSTEM_CODE { get; set; } public string BUSI_SYSTEM_CODE { get; set; }
/// <summary>
/// 请求来源
/// </summary>
public string SOURCE_TYPE { get; set; }
/// <summary> /// <summary>
/// 业务主键 /// 业务主键
/// </summary> /// </summary>
public string BUSI_ID { get; set; } public string BUSI_ID { get; set; }
/// <summary>
/// 提单号
/// </summary>
public string MBL_NO { get; set; }
/// <summary> /// <summary>
/// 船名航次 /// 船名航次
/// </summary> /// </summary>
@ -72,6 +80,11 @@ namespace Myshipping.Application.Entity
/// </summary> /// </summary>
public string SERVICE_WF_ID { get; set; } public string SERVICE_WF_ID { get; set; }
/// <summary>
/// 发布版本
/// </summary>
public string RELEASE_VERSION { get; set; }
/// <summary> /// <summary>
/// 服务项代码 /// 服务项代码
/// </summary> /// </summary>
@ -107,6 +120,11 @@ namespace Myshipping.Application.Entity
/// </summary> /// </summary>
public Nullable<DateTime> ACT_DATE { get; set; } public Nullable<DateTime> ACT_DATE { get; set; }
/// <summary>
/// 活动备注
/// </summary>
public string ACT_REMARK { get; set; }
/// <summary> /// <summary>
/// 下一个活动ID /// 下一个活动ID
/// </summary> /// </summary>

@ -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
{
/// <summary>
/// 服务项目运行操作枚举
/// </summary>
public enum TrackingRunOperTypeEnum
{
/// <summary>
/// 推送服务
/// </summary>
[Description("推送服务")]
PUSH_PROJECT,
/// <summary>
/// 取消服务
/// </summary>
[Description("取消服务")]
CANCEL_PROJECT,
/// <summary>
/// 推送状态
/// </summary>
[Description("推送状态")]
PUSH_STATUS,
/// <summary>
/// 取消状态
/// </summary>
[Description("取消状态")]
CANCEL_STATUS
}
}

@ -129,6 +129,7 @@ namespace Myshipping.Application
private readonly IBookingGoodsStatusConfigService _GoodsConfig; private readonly IBookingGoodsStatusConfigService _GoodsConfig;
private readonly SqlSugarRepository<BookingLineOpMgrConfig> _repLineOpMgrConfig; private readonly SqlSugarRepository<BookingLineOpMgrConfig> _repLineOpMgrConfig;
private readonly SqlSugarRepository<SysEmp> _repSysEmp; private readonly SqlSugarRepository<SysEmp> _repSysEmp;
private readonly SqlSugarRepository<Booking_AutoYardImport> _repAutoYard;
const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING"; const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING";
@ -151,7 +152,7 @@ namespace Myshipping.Application
SqlSugarRepository<BookingExcelTemplate> excelrep, SqlSugarRepository<DjyUserMailAccount> repUserMail, SqlSugarRepository<BookingGoodsStatus> goodsStatus, SqlSugarRepository<BookingGoodsStatusConfig> goodsStatusConfig, SqlSugarRepository<BookingExcelTemplate> excelrep, SqlSugarRepository<DjyUserMailAccount> repUserMail, SqlSugarRepository<BookingGoodsStatus> goodsStatus, SqlSugarRepository<BookingGoodsStatusConfig> goodsStatusConfig,
SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<BookingStatus> repBookingStatus, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingServiceItem> serviceItem, SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<BookingStatus> repBookingStatus, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingServiceItem> serviceItem,
SqlSugarRepository<ParaContractNoInfo> paraContractNoInfoRepository, IHttpContextAccessor httpContextAccessor, IBookingGoodsStatusConfigService GoodsConfig, SqlSugarRepository<DjyWebsiteAccountConfig> djyWebsiteAccountConfigRepository, SqlSugarRepository<ParaContractNoInfo> paraContractNoInfoRepository, IHttpContextAccessor httpContextAccessor, IBookingGoodsStatusConfigService GoodsConfig, SqlSugarRepository<DjyWebsiteAccountConfig> djyWebsiteAccountConfigRepository,
ISysOrgService orgService, SqlSugarRepository<BookingLineOpMgrConfig> repLineOpMgrConfig, SqlSugarRepository<SysEmp> repSysEmp) ISysOrgService orgService, SqlSugarRepository<BookingLineOpMgrConfig> repLineOpMgrConfig, SqlSugarRepository<SysEmp> repSysEmp, SqlSugarRepository<Booking_AutoYardImport> repAutoYard)
{ {
this._logger = logger; this._logger = logger;
this._rep = rep; this._rep = rep;
@ -196,6 +197,7 @@ namespace Myshipping.Application
this._repLineOpMgrConfig = repLineOpMgrConfig; this._repLineOpMgrConfig = repLineOpMgrConfig;
this._repSysEmp = repSysEmp; this._repSysEmp = repSysEmp;
this._repAutoYard = repAutoYard;
} }
#region 主表和箱信息 #region 主表和箱信息
@ -7596,41 +7598,193 @@ namespace Myshipping.Application
return; 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 match = true;
var ctnKindPkg = ctns.FirstOrDefault(x => !string.IsNullOrEmpty(x.KINDPKGS)); var rtn = await GetYardDataAndMappingSystem(order, false); //拉取场站的数据
var kindPkg = order.KINDPKGS; var groupYardList = rtn.GroupBy(x => x.CTNALL).Select(x => new { CTNALL = x.Key, COUNT = x.Count() }).ToList(); //按箱型分组计算箱量(场站)
if (string.IsNullOrEmpty(kindPkg) && ctnKindPkg != null) 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(); var listPKGS = ctns.Where(x => x.PKGS > 0).ToList(); //填写了件数
ctn.BILLID = order.Id; foreach (var item in listPKGS)
ctn.CTNCODE = item.CtnCode; {
ctn.CTNALL = item.CTNALL; var sumPkgs = rtn.Where(x => x.CTNALL == item.CTNALL).Sum(x => x.PKGS);
ctn.CTNNUM = 1; if (sumPkgs != item.PKGS)
ctn.CNTRNO = item.CNTRNO; {
ctn.SEALNO = item.SEALNO; //件数不一致
ctn.KINDPKGS = string.IsNullOrEmpty(item.KINDPKGS) ? kindPkg : item.KINDPKGS; match = false;
ctn.PKGS = item.PKGS;
ctn.KGS = Convert.ToDecimal(item.KGS); //写入提示
ctn.CBM = Convert.ToDecimal(item.CBM); await SaveAutoYardData(bookId, false,
ctn.TAREWEIGHT = Convert.ToDecimal(item.TAREWEIGHT); $"件数不一致,场站:{sumPkgs},填写:{item.PKGS}",
ctn.TenantId = order.TenantId; ctns.ToJson(), rtn.ToJson());
ctn.CreatedUserId = order.CreatedUserId; break;
ctn.CreatedUserName = "系统"; }
await _repCtn.InsertAsync(ctn); }
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());
}
}
/// <summary>
/// 写入自动引入场站数据信息数据
/// </summary>
/// <returns></returns>
[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);
} }
/// <summary> /// <summary>

@ -163,5 +163,25 @@ namespace Myshipping.Application
/// 触发器列表 /// 触发器列表
/// </summary> /// </summary>
public List<string> TriggerList { get; set; } public List<string> TriggerList { get; set; }
/// <summary>
/// 分组名称
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// 服务流程排序值
/// </summary>
public int WFSortNo { get; set; }
/// <summary>
/// 计算排序值
/// </summary>
public decimal CalcSortNo { get; set; }
/// <summary>
/// 是否结束
/// </summary>
public bool IsEnd { get; set; }
} }
} }

@ -12,6 +12,7 @@ using Microsoft.Extensions.Options;
using Myshipping.Application.Entity; using Myshipping.Application.Entity;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Entity; using Myshipping.Core.Entity;
using Npoi.Mapper;
using NPOI.OpenXmlFormats.Vml; using NPOI.OpenXmlFormats.Vml;
using NPOI.SS.Formula.Functions; using NPOI.SS.Formula.Functions;
using NPOI.SS.Formula.PTG; using NPOI.SS.Formula.PTG;
@ -202,6 +203,19 @@ namespace Myshipping.Application
}; };
await _serviceWorkFlowRunInfoRepository.InsertAsync(serviceWorkFlowRunInfo); await _serviceWorkFlowRunInfoRepository.InsertAsync(serviceWorkFlowRunInfo);
#region 写入运行日志
var runLog = serviceWorkFlowRunInfo.Adapt<ServiceWorkFlowRunLogInfo>();
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") else if (tsk.OperType == "Update")
{ {
@ -210,12 +224,31 @@ namespace Myshipping.Application
runInfo.IS_YIELD = 1; runInfo.IS_YIELD = 1;
runInfo.ACT_DATE = nowDate; 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 await _serviceWorkFlowRunInfoRepository.AsUpdateable(runInfo).UpdateColumns(it => new
{ {
it.ACT_DATE, it.ACT_DATE,
it.IS_YIELD, it.IS_YIELD,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
#region 写入运行日志
var runLog = runInfo.Adapt<ServiceWorkFlowRunLogInfo>();
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主表 //写入run主表
await _serviceWorkFlowRunInfoRepository.InsertAsync(serviceWorkFlowRunInfo); await _serviceWorkFlowRunInfoRepository.InsertAsync(serviceWorkFlowRunInfo);
#region 写入运行日志
var runLog = serviceWorkFlowRunInfo.Adapt<ServiceWorkFlowRunLogInfo>();
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); int endNum = rt.StatusList.Max(sku => sku.ActSortNo);
@ -359,15 +410,26 @@ namespace Myshipping.Application
if (st.StatusCode.Equals(sku.StatusSKUCode,StringComparison.OrdinalIgnoreCase)) 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_VAL = st.StatusVal;
@ -377,6 +439,29 @@ namespace Myshipping.Application
//写入run活动表 //写入run活动表
await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesRunInfo); await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesRunInfo);
#region 写入运行日志
var runLog = activitiesRunInfo.Adapt<ServiceWorkFlowRunLogInfo>();
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) if (sku.SubStatusList != null && sku.SubStatusList.Count > 0)
{ {
string lastSubActId = string.Empty; string lastSubActId = string.Empty;
@ -410,17 +495,27 @@ namespace Myshipping.Application
if (st.StatusCode.Equals(sub.StatusSKUCode, StringComparison.OrdinalIgnoreCase)) 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_VAL = st.StatusVal;
activitiesSubRunInfo.ACT_REMARK = st.Remark; activitiesSubRunInfo.ACT_REMARK = st.Remark;
} }
@ -430,6 +525,29 @@ namespace Myshipping.Application
await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesSubRunInfo); await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesSubRunInfo);
#region 写入运行日志
var runLog = activitiesSubRunInfo.Adapt<ServiceWorkFlowRunLogInfo>();
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; lastSubActId = activitiesSubRunInfo.PK_ID;
}); });
@ -463,6 +581,19 @@ namespace Myshipping.Application
it.UpdatedUserId, it.UpdatedUserId,
it.UpdatedUserName it.UpdatedUserName
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
#region 写入运行日志
var runLog = runEntity.Adapt<ServiceWorkFlowRunLogInfo>();
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)) 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_VAL = st.StatusVal;
@ -518,6 +660,28 @@ namespace Myshipping.Application
//写入run活动表 //写入run活动表
await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesRunInfo); await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesRunInfo);
#region 写入运行日志
var runLog = activitiesRunInfo.Adapt<ServiceWorkFlowRunLogInfo>();
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) if (sku.SubStatusList != null && sku.SubStatusList.Count > 0)
{ {
string lastSubActId = string.Empty; string lastSubActId = string.Empty;
@ -551,15 +715,26 @@ namespace Myshipping.Application
if (st.StatusCode.Equals(sub.StatusSKUCode, StringComparison.OrdinalIgnoreCase)) 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_VAL = st.StatusVal;
@ -571,6 +746,28 @@ namespace Myshipping.Application
await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesSubRunInfo); await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesSubRunInfo);
#region 写入运行日志
var runLog = activitiesSubRunInfo.Adapt<ServiceWorkFlowRunLogInfo>();
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; lastSubActId = activitiesSubRunInfo.PK_ID;
}); });
@ -601,6 +798,19 @@ namespace Myshipping.Application
it.UpdatedUserId, it.UpdatedUserId,
it.UpdatedUserName it.UpdatedUserName
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
#region 写入运行日志
var runLog = runEntity.Adapt<ServiceWorkFlowRunLogInfo>();
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 => rt.StatusList.ForEach(async sku =>
@ -613,17 +823,37 @@ namespace Myshipping.Application
if (st.StatusCode.Equals(sku.StatusSKUCode, StringComparison.OrdinalIgnoreCase)) 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_VAL = st.StatusVal;
activitiesRunInfo.ACT_REMARK = st.Remark; activitiesRunInfo.ACT_REMARK = st.Remark;
@ -641,6 +871,33 @@ namespace Myshipping.Application
it.UpdatedUserId, it.UpdatedUserId,
it.UpdatedUserName it.UpdatedUserName
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
#region 写入运行日志
var runLog = activitiesRunInfo.Adapt<ServiceWorkFlowRunLogInfo>();
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) if (sku.SubStatusList != null && sku.SubStatusList.Count > 0)
@ -655,15 +912,36 @@ namespace Myshipping.Application
if (st.StatusCode.Equals(sub.StatusSKUCode, StringComparison.OrdinalIgnoreCase)) 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; activitiesSubRunInfo.ACT_VAL = st.StatusVal;
@ -683,6 +961,35 @@ namespace Myshipping.Application
it.UpdatedUserId, it.UpdatedUserId,
it.UpdatedUserName it.UpdatedUserName
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
#region 写入运行日志
var runLog = activitiesSubRunInfo.Adapt<ServiceWorkFlowRunLogInfo>();
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.IS_YIELD = 0;
runInfo.ACT_DATE = null; 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 await _serviceWorkFlowRunInfoRepository.AsUpdateable(runInfo).UpdateColumns(it => new
{ {
it.ACT_DATE, it.ACT_DATE,
it.IS_YIELD, it.IS_YIELD,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
#region 写入运行日志
var runLog = runInfo.Adapt<ServiceWorkFlowRunLogInfo>();
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)) && wfArgs.Contains(main.SERVICE_WF_ID))
.Select((main, detail) => new { Main = main, Detail = detail }).ToList(); .Select((main, detail) => new { Main = main, Detail = detail }).ToList();
//按照请求的状态列表轮询 //按照请求的状态列表轮询
info.Main.StatusList.ForEach(async st => info.Main.StatusList.ForEach(async st =>
{ {
@ -1130,6 +1454,16 @@ namespace Myshipping.Application
var activitiesRunInfo = _serviceWorkFlowRunActivitiesInfoRepository var activitiesRunInfo = _serviceWorkFlowRunActivitiesInfoRepository
.AsQueryable().First(b => b.PK_ID == detail.Detail.PK_ID); .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_VAL = null;
activitiesRunInfo.ACT_REMARK = null; activitiesRunInfo.ACT_REMARK = null;
activitiesRunInfo.ACT_DATE = null; activitiesRunInfo.ACT_DATE = null;
@ -1150,6 +1484,33 @@ namespace Myshipping.Application
it.UpdatedUserId, it.UpdatedUserId,
it.UpdatedUserName it.UpdatedUserName
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
#region 写入运行日志
var runLog = activitiesRunInfo.Adapt<ServiceWorkFlowRunLogInfo>();
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); var runList = InnerGetRunListBySingleBusiness(messageInfo);
int lastWFSortNo = 0;
int calcNum = 1;
var resultList = statuList.Join(runList, l => l.WFPKId, r => r.WFPKId, var resultList = statuList.Join(runList, l => l.WFPKId, r => r.WFPKId,
(l, r) => { (l, r) => {
@ -1486,7 +1850,9 @@ namespace Myshipping.Application
ShowName = b.ShowName, ShowName = b.ShowName,
IsYield = false, IsYield = false,
StatusSKUCode = b.StatusSKUCode, StatusSKUCode = b.StatusSKUCode,
ActRemark = b.ActRemark ActRemark = b.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ActSortNo,
}); });
if(b.SubStatusList != null && b.SubStatusList.Count > 0) if(b.SubStatusList != null && b.SubStatusList.Count > 0)
@ -1498,29 +1864,75 @@ namespace Myshipping.Application
ShowName = c.ShowName, ShowName = c.ShowName,
IsYield = false, IsYield = false,
StatusSKUCode = b.StatusSKUCode, StatusSKUCode = b.StatusSKUCode,
ActRemark = b.ActRemark ActRemark = b.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ActSortNo + (c.ActSortNo * 0.001m)
}).ToList()); }).ToList());
} }
}); });
} }
else else
{ {
rltList = runInfo.ActivitiesList.Select(b => new ServiceProjectStatusDto runInfo.ActivitiesList.ForEach(b => {
{ rltList.Add(new ServiceProjectStatusDto
ActPKId = b.ActId, {
ActSortNo = b.ExecSortNo, ActPKId = b.ActId,
ShowName = b.ShowName, ActSortNo = b.ExecSortNo,
IsYield = b.IsYield == 1 ? true : false, ShowName = b.ShowName,
ActDate = b.ActDate, IsYield = b.IsYield == 1 ? true : false,
ActVal = b.ActVal, ActDate = b.ActDate,
StatusSKUCode = b.StatusSKUCode, ActVal = b.ActVal,
ActRemark = b.ActRemark StatusSKUCode = b.StatusSKUCode,
}).ToList(); 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; 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; result.succ = true;

Loading…
Cancel
Save