|
|
@ -181,43 +181,22 @@ namespace Myshipping.Application
|
|
|
|
var wfList = skuList.Select(a => a.WF)
|
|
|
|
var wfList = skuList.Select(a => a.WF)
|
|
|
|
.Distinct().ToList();
|
|
|
|
.Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
//var ddd = wfList.GroupJoin(runList, l => l.PK_ID,
|
|
|
|
var checkList = wfList.GroupJoin(runList, l => l.PK_ID,
|
|
|
|
// r => r.main.SERVICE_WF_ID,
|
|
|
|
r => r.main.SERVICE_WF_ID,
|
|
|
|
// (l, r) => {
|
|
|
|
(l, r) =>
|
|
|
|
// var currList = r.ToList();
|
|
|
|
{
|
|
|
|
|
|
|
|
var currList = r.ToList();
|
|
|
|
// if (currList.Count > 0)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// return new { Exists = true, WF = l };
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// return { Exists = true, WF = l };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//状态关联的服务流程与运行表中的服务流程对应,对已经有的进行更新,对未进入运行表的进行写入
|
|
|
|
|
|
|
|
var actArg = reqStatusList.Select(a => a.Act.PK_ID).ToArray();
|
|
|
|
|
|
|
|
//根据服务流程活动获取所有相关的服务流程
|
|
|
|
|
|
|
|
var wfRlt = _serviceWorkFlowBaseService.GetServiceWorkFlowListByActivities(actArg).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
if (!wfRlt.succ)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
string errMsg = $"获取服务流程失败,原因:{wfRlt.msg}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} {msg}", batchNo, errMsg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Oh(errMsg, typeof(InvalidOperationException));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var list = JSON.Deserialize<List<ServiceWorkFlowBaseShowDto>>(JSON.Serialize(wfRlt.ext));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return new { Exists = true, WF = l };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new { Exists = true, WF = l };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
//list.GroupJoin(runList,l=>l.)
|
|
|
|
if(checkList.Any(a=>a.Exists))
|
|
|
|
//如果有已经运行的业务主键则只补充对应的活动表
|
|
|
|
|
|
|
|
if (runList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
reqStatusList.ForEach(async reqMd =>
|
|
|
|
reqStatusList.ForEach(async reqMd =>
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -236,19 +215,36 @@ namespace Myshipping.Application
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (checkList.Any(a => !a.Exists))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
var noExistsList = checkList.Where(l => !l.Exists).Select(a=>a.WF.PK_ID).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//状态关联的服务流程与运行表中的服务流程对应,对已经有的进行更新,对未进入运行表的进行写入
|
|
|
|
|
|
|
|
var actArg = reqStatusList.Select(a => a.Act.PK_ID).ToArray();
|
|
|
|
|
|
|
|
//根据服务流程活动获取所有相关的服务流程
|
|
|
|
|
|
|
|
var wfRlt = _serviceWorkFlowBaseService.GetServiceWorkFlowListByActivities(actArg).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
if (!wfRlt.succ)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
string errMsg = $"获取服务流程失败,原因:{wfRlt.msg}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} {msg}", batchNo, errMsg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Oh(errMsg, typeof(InvalidOperationException));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DateTime nowDate = DateTime.Now;
|
|
|
|
var list = JSON.Deserialize<List<ServiceWorkFlowBaseShowDto>>(JSON.Serialize(wfRlt.ext));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(list.Count > 0)
|
|
|
|
|
|
|
|
list = list.Where(a=> noExistsList.Contains( a.PKId)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DateTime nowDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
list.ForEach(async wf =>
|
|
|
|
list.ForEach(async wf =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ServiceWorkFlowRunInfo serviceWorkFlowRunInfo = new ServiceWorkFlowRunInfo {
|
|
|
|
ServiceWorkFlowRunInfo serviceWorkFlowRunInfo = new ServiceWorkFlowRunInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
PK_ID = IDGen.NextID().ToString(),
|
|
|
|
PK_ID = IDGen.NextID().ToString(),
|
|
|
|
SERVICE_WF_ID = wf.PKId,
|
|
|
|
SERVICE_WF_ID = wf.PKId,
|
|
|
|
BUSI_SYSTEM_CODE = info.Main.BusiSystemCode.ToUpper(),
|
|
|
|
BUSI_SYSTEM_CODE = info.Main.BusiSystemCode.ToUpper(),
|
|
|
@ -304,7 +300,7 @@ namespace Myshipping.Application
|
|
|
|
SOURCE_TYPE = "AUTO"
|
|
|
|
SOURCE_TYPE = "AUTO"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if(currReq != null)
|
|
|
|
if (currReq != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
activitiesRunInfo.ACT_DATE = currReq.Req.StatusDate;
|
|
|
|
activitiesRunInfo.ACT_DATE = currReq.Req.StatusDate;
|
|
|
|
activitiesRunInfo.ACT_VAL = currReq.Req.StatusVal;
|
|
|
|
activitiesRunInfo.ACT_VAL = currReq.Req.StatusVal;
|
|
|
@ -353,7 +349,7 @@ namespace Myshipping.Application
|
|
|
|
PARENT_ID = activitiesRunInfo.PK_ID
|
|
|
|
PARENT_ID = activitiesRunInfo.PK_ID
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if(currSubReq != null)
|
|
|
|
if (currSubReq != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
activitiesSubRunInfo.ACT_DATE = currSubReq.Req.StatusDate;
|
|
|
|
activitiesSubRunInfo.ACT_DATE = currSubReq.Req.StatusDate;
|
|
|
|
activitiesSubRunInfo.ACT_VAL = currSubReq.Req.StatusVal;
|
|
|
|
activitiesSubRunInfo.ACT_VAL = currSubReq.Req.StatusVal;
|
|
|
|