wet 1 year ago
commit 1c1507b713

@ -17,12 +17,6 @@ namespace Myshipping.Application.Entity
[Description("服务流程运行活动表")]
public class ServiceWorkFlowRunActivitiesInfo : TrackingSystemDbEntity
{
public ServiceWorkFlowRunActivitiesInfo()
{
PK_ID = IDGen.NextID().ToString();
CreatedTime = DateTime.Now;
}
/// <summary>
/// 运行主键
@ -59,6 +53,11 @@ namespace Myshipping.Application.Entity
/// </summary>
public Nullable<DateTime> ACT_DATE { get; set; }
/// <summary>
/// 活动备注
/// </summary>
public string ACT_REMARK { get; set; }
/// <summary>
/// 下一个活动ID
/// </summary>

@ -2281,7 +2281,8 @@ namespace Myshipping.Application
{
StatusCode = a.StatusCode,
StatusDate = a.SetActDate,
StatusVal = a.SetActVal
StatusVal = a.SetActVal,
Remark = a.ActRemark
}).ToList()
}
};
@ -2372,7 +2373,8 @@ namespace Myshipping.Application
{
StatusCode = a.StatusCode,
StatusDate = a.SetActDate,
StatusVal = a.SetActVal
StatusVal = a.SetActVal,
Remark = a.ActRemark
}).ToList()
}
};

@ -54,5 +54,10 @@ namespace Myshipping.Application
/// 人工设定状态值(可传箱使天数)
/// </summary>
public string SetActVal { get; set; }
/// <summary>
/// 状态备注
/// </summary>
public string ActRemark { get; set; }
}
}

@ -149,6 +149,10 @@ namespace Myshipping.Application
/// </summary>
public string ActVal { get; set; }
/// <summary>
/// 备注
/// </summary>
public string ActRemark { get; set; }
/// <summary>
/// 子状态列表

@ -76,6 +76,11 @@ namespace Myshipping.Application
/// </summary>
public string SourceType { get; set; }
/// <summary>
/// 备注
/// </summary>
public string ActRemark { get; set; }
/// <summary>
/// 子活动列表
/// </summary>
@ -148,5 +153,10 @@ namespace Myshipping.Application
/// 来源类型 AUTO-自动 MANUAL-人工
/// </summary>
public string SourceType { get; set; }
/// <summary>
/// 备注
/// </summary>
public string ActRemark { get; set; }
}
}

@ -208,6 +208,11 @@ namespace Myshipping.Application
/// 状态产生值
/// </summary>
public string StatusVal { get; set; }
/// <summary>
/// 状态备注
/// </summary>
public string Remark { get; set; }
}
/// <summary>

@ -327,7 +327,7 @@ namespace Myshipping.Application
await _serviceWorkFlowRunInfoRepository.InsertAsync(serviceWorkFlowRunInfo);
//获取状态最大数
int endNum = rt.StatusList.Max(sku => sku.SortNo);
int endNum = rt.StatusList.Max(sku => sku.ActSortNo);
string lastActId = string.Empty;
@ -337,9 +337,9 @@ namespace Myshipping.Application
{
PK_ID = IDGen.NextID().ToString(),
RUN_ID = serviceWorkFlowRunInfo.PK_ID,
EXEC_SORT_NO = sku.SortNo,
IS_START = sku.SortNo == 1 ? 1 : 0,
IS_END = sku.SortNo == endNum ? 1 : 0,
EXEC_SORT_NO = sku.ActSortNo,
IS_START = sku.ActSortNo == 1 ? 1 : 0,
IS_END = sku.ActSortNo == endNum ? 1 : 0,
ACT_ID = sku.ActPKId,
STATUS_SKU_CODE = sku.StatusSKUCode,
STATUS_SKU_ID = sku.SkuPKId,
@ -354,7 +354,7 @@ namespace Myshipping.Application
TenantId = info.Main.OperTenantId,
TenantName = info.Main.OperTenantName,
IsDeleted = false,
SOURCE_TYPE = info.Main.SourceType.ToString(),
SOURCE_TYPE = info.Main.SourceType.ToString()
};
if (st.StatusCode.Equals(sku.StatusSKUCode,StringComparison.OrdinalIgnoreCase))
@ -371,6 +371,7 @@ namespace Myshipping.Application
}
activitiesRunInfo.ACT_VAL = st.StatusVal;
activitiesRunInfo.ACT_REMARK = st.Remark;
}
//写入run活动表
@ -386,9 +387,9 @@ namespace Myshipping.Application
{
PK_ID = IDGen.NextID().ToString(),
RUN_ID = serviceWorkFlowRunInfo.PK_ID,
EXEC_SORT_NO = sub.SortNo,
IS_START = sub.SortNo == 1 ? 1 : 0,
IS_END = sub.SortNo == endNum ? 1 : 0,
EXEC_SORT_NO = sub.ActSortNo,
IS_START = sub.ActSortNo == 1 ? 1 : 0,
IS_END = sub.ActSortNo == endNum ? 1 : 0,
ACT_ID = sub.ActPKId,
STATUS_SKU_CODE = sub.StatusSKUCode,
STATUS_SKU_ID = sub.SkuPKId,
@ -421,6 +422,7 @@ namespace Myshipping.Application
}
activitiesSubRunInfo.ACT_VAL = st.StatusVal;
activitiesSubRunInfo.ACT_REMARK = st.Remark;
}
if (!string.IsNullOrWhiteSpace(lastSubActId))
@ -437,7 +439,8 @@ namespace Myshipping.Application
}
else
{
if (runList.Any(b => b.Detail == null))
if (runList.Any(b
=> b.Detail == null || (b.Detail != null && string.IsNullOrWhiteSpace(b.Detail.PK_ID))))
{
var runMain = runList.FirstOrDefault().Main;
//需要补充活动表明细
@ -465,7 +468,7 @@ namespace Myshipping.Application
//批量写入活动表
#region 批量写入活动表
//获取状态最大数
int endNum = rt.StatusList.Max(sku => sku.SortNo);
int endNum = rt.StatusList.Max(sku => sku.ActSortNo);
string lastActId = string.Empty;
@ -475,9 +478,9 @@ namespace Myshipping.Application
{
PK_ID = IDGen.NextID().ToString(),
RUN_ID = runEntity.PK_ID,
EXEC_SORT_NO = sku.SortNo,
IS_START = sku.SortNo == 1 ? 1 : 0,
IS_END = sku.SortNo == endNum ? 1 : 0,
EXEC_SORT_NO = sku.ActSortNo,
IS_START = sku.ActSortNo == 1 ? 1 : 0,
IS_END = sku.ActSortNo == endNum ? 1 : 0,
ACT_ID = sku.ActPKId,
STATUS_SKU_CODE = sku.StatusSKUCode,
STATUS_SKU_ID = sku.SkuPKId,
@ -509,6 +512,7 @@ namespace Myshipping.Application
}
activitiesRunInfo.ACT_VAL = st.StatusVal;
activitiesRunInfo.ACT_REMARK = st.Remark;
}
//写入run活动表
@ -524,9 +528,9 @@ namespace Myshipping.Application
{
PK_ID = IDGen.NextID().ToString(),
RUN_ID = runEntity.PK_ID,
EXEC_SORT_NO = sub.SortNo,
IS_START = sub.SortNo == 1 ? 1 : 0,
IS_END = sub.SortNo == endNum ? 1 : 0,
EXEC_SORT_NO = sub.ActSortNo,
IS_START = sub.ActSortNo == 1 ? 1 : 0,
IS_END = sub.ActSortNo == endNum ? 1 : 0,
ACT_ID = sub.ActPKId,
STATUS_SKU_CODE = sub.StatusSKUCode,
STATUS_SKU_ID = sub.SkuPKId,
@ -559,6 +563,7 @@ namespace Myshipping.Application
}
activitiesSubRunInfo.ACT_VAL = st.StatusVal;
activitiesSubRunInfo.ACT_REMARK = st.Remark;
}
if (!string.IsNullOrWhiteSpace(lastSubActId))
@ -576,7 +581,90 @@ namespace Myshipping.Application
else
{
//只需要更新完成标记和完成时间
rt.StatusList.ForEach(async sku =>
{
var currRunDetail = runList.FirstOrDefault(p =>
p.Detail.STATUS_SKU_CODE.Equals(sku.StatusSKUCode)).Detail;
var activitiesRunInfo = _serviceWorkFlowRunActivitiesInfoRepository.AsQueryable()
.First(p=>p.PK_ID == currRunDetail.PK_ID);
if (st.StatusCode.Equals(sku.StatusSKUCode, StringComparison.OrdinalIgnoreCase))
{
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;
activitiesRunInfo.UpdatedTime = nowDate;
activitiesRunInfo.CreatedUserId = long.Parse(info.Main.OperUserId);
activitiesRunInfo.CreatedUserName = info.Main.OperUserName;
await _serviceWorkFlowRunActivitiesInfoRepository.AsUpdateable(activitiesRunInfo)
.UpdateColumns(it => new
{
it.ACT_DATE,
it.IS_YIELD,
it.ACT_REMARK,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
if (sku.SubStatusList != null && sku.SubStatusList.Count > 0)
{
sku.SubStatusList.ForEach(async sub => {
var currRunDetailSub = runList.FirstOrDefault(p =>
p.Detail.STATUS_SKU_CODE.Equals(sub.StatusSKUCode)).Detail;
var activitiesSubRunInfo = _serviceWorkFlowRunActivitiesInfoRepository.AsQueryable()
.First(p=> currRunDetailSub.STATUS_SKU_CODE.Equals(sub.StatusSKUCode));
if (st.StatusCode.Equals(sub.StatusSKUCode, StringComparison.OrdinalIgnoreCase))
{
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;
activitiesSubRunInfo.UpdatedTime = nowDate;
activitiesSubRunInfo.CreatedUserId = long.Parse(info.Main.OperUserId);
activitiesSubRunInfo.CreatedUserName = info.Main.OperUserName;
await _serviceWorkFlowRunActivitiesInfoRepository.AsUpdateable(activitiesSubRunInfo)
.UpdateColumns(it => new
{
it.ACT_DATE,
it.IS_YIELD,
it.ACT_REMARK,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
});
}
});
}
}
});
@ -639,12 +727,13 @@ namespace Myshipping.Application
.LeftJoin<ServiceWorkFlowRunActivitiesInfo>((m, s) => m.PK_ID == s.RUN_ID)
.LeftJoin<ServiceWorkFlowProjectRelation>((m, s, rela) =>
m.SERVICE_WF_ID == rela.SERVICE_WORKFLOW_ID && m.RELEASE_VERSION == rela.WF_VERSION)
.LeftJoin<ServiceProjectBaseInfo>((m, s, rela, p) =>
.InnerJoin<ServiceProjectBaseInfo>((m, s, rela, p) =>
rela.SERVICE_PROJECT_ID == p.PK_ID)
.Where((m, s, rela, p)
=> m.BUSI_SYSTEM_CODE == info.Main.BusiSystemCode && m.BUSI_ID == info.Main.BusiId &&
(info.Main.ServiceProjectCodeList == null || info.Main.ServiceProjectCodeList.Contains(p.SERVICE_PROJECT_CODE)))
.Select((m, s) => new { Run = m, Sub = s }).ToList();
.Select((m, s,rela,p) =>
new { Run = m, Sub = s }).ToList();
var resultList = runList.GroupBy(a => a.Run.PK_ID)
.Select(a => {
@ -662,7 +751,8 @@ namespace Myshipping.Application
showModel.ActDate = runInfo.ACT_DATE;
showModel.WFPKId = runInfo.SERVICE_WF_ID;
showModel.ActivitiesList = currList.Where(t => t.Sub.IS_SUB == 0)
showModel.ActivitiesList = currList.Where(t =>
!string.IsNullOrWhiteSpace(t.Sub.PK_ID) && t.Sub.IS_SUB == 0)
.Select(t =>
{
var runModel = new ServiceWorkFlowActivitiesRunDto
@ -679,14 +769,16 @@ namespace Myshipping.Application
ShowName = t.Sub.SHOW_NAME,
SourceType = t.Sub.SOURCE_TYPE,
StatusSKUCode = t.Sub.STATUS_SKU_CODE,
StatusSKUId = t.Sub.STATUS_SKU_ID
StatusSKUId = t.Sub.STATUS_SKU_ID,
ActRemark = t.Sub.ACT_REMARK,
};
return runModel;
}).ToList();
var subList =
currList.Where(t => t.Sub.IS_SUB == 1)
currList.Where(t =>
!string.IsNullOrWhiteSpace(t.Sub.PK_ID) && t.Sub.IS_SUB == 1)
.Select(t => t.Sub).ToList();
showModel.ActivitiesList = showModel.ActivitiesList.GroupJoin(subList,
@ -713,7 +805,8 @@ namespace Myshipping.Application
ShowName = x.SHOW_NAME,
SourceType = x.SOURCE_TYPE,
StatusSKUCode = x.STATUS_SKU_CODE,
StatusSKUId = x.STATUS_SKU_ID
StatusSKUId = x.STATUS_SKU_ID,
ActRemark = x.ACT_REMARK
};
return subModel;
@ -1526,8 +1619,9 @@ namespace Myshipping.Application
ActPKId = b.ActPKId,
ActSortNo = b.ActSortNo,
ShowName = b.ShowName,
IsYield = false
IsYield = false,
StatusSKUCode = b.StatusSKUCode,
ActRemark = b.ActRemark
});
if(b.SubStatusList != null && b.SubStatusList.Count > 0)
@ -1537,8 +1631,9 @@ namespace Myshipping.Application
ActPKId = c.ActPKId,
ActSortNo = c.ActSortNo,
ShowName = c.ShowName,
IsYield = false
IsYield = false,
StatusSKUCode = b.StatusSKUCode,
ActRemark = b.ActRemark
}).ToList());
}
});
@ -1552,7 +1647,9 @@ namespace Myshipping.Application
ShowName = b.ShowName,
IsYield = b.IsYield == 1 ? true : false,
ActDate = b.ActDate,
ActVal = b.ActVal
ActVal = b.ActVal,
StatusSKUCode = b.StatusSKUCode,
ActRemark = b.ActRemark
}).ToList();
}
}

Loading…
Cancel
Save