|
|
|
@ -1184,7 +1184,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
SeaExport = seaExport,
|
|
|
|
|
OpCtnList = seaExportCtnList
|
|
|
|
|
};
|
|
|
|
|
var result = await CompareBcWithSeaExport(compareDto);
|
|
|
|
|
CompareResultInfo result = await CompareBcWithSeaExport(compareDto);
|
|
|
|
|
|
|
|
|
|
dataContext.Set(TaskFlowDataNameConst.BcCompareWithSeaExportResult, result);
|
|
|
|
|
|
|
|
|
@ -1345,14 +1345,23 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
var taskBcInfo = dataContext.Get<TaskBCInfo?>(TaskFlowDataNameConst.TaskBCInfo) ?? throw new ArgumentException($"缺少参数:{nameof(TaskFlowDataNameConst.TaskBCInfo)}");
|
|
|
|
|
|
|
|
|
|
var result = await BcMatchSeaExport(taskBcInfo);
|
|
|
|
|
if (result.Succeeded && result.Data != null)
|
|
|
|
|
if (result.Succeeded && result.Data != null && result.Data.Id != 0)
|
|
|
|
|
{
|
|
|
|
|
dataContext.Set(TaskFlowDataNameConst.BusinessId, result.Data.Id!);
|
|
|
|
|
// BC是否匹配到了海运出口订单=>true
|
|
|
|
|
dataContext.Set(TaskFlowDataNameConst.BcIsMatchSeaExport, true);
|
|
|
|
|
|
|
|
|
|
// 订单Id
|
|
|
|
|
dataContext.Set(TaskFlowDataNameConst.BusinessId, result.Data.Id);
|
|
|
|
|
|
|
|
|
|
await tenantDb.Updateable<TaskBCInfo>()
|
|
|
|
|
.SetColumns(x => x.BOOKING_ORDER_ID == result.Data.Id)
|
|
|
|
|
.Where(x => x.Id == taskBcInfo.Id)
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await tenantDb.Updateable<TaskBaseInfo>()
|
|
|
|
|
.SetColumns(x => x.OUT_BS_NO == result.Data.Id)
|
|
|
|
|
.Where(x => x.Id == taskBcInfo.TASK_ID)
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
@ -1362,6 +1371,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
private async Task<DataResult<SeaExportRes?>> BcMatchSeaExport(TaskBCInfo taskBcInfo)
|
|
|
|
|
{
|
|
|
|
|
var queryable = tenantDb.Queryable<SeaExport>();
|
|
|
|
|
|
|
|
|
|
if (taskBcInfo.BOOKING_ORDER_ID is not null or 0)
|
|
|
|
|
{
|
|
|
|
|
queryable.Where(x => x.Id == taskBcInfo.BOOKING_ORDER_ID);
|
|
|
|
@ -1402,7 +1412,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
|
// 更新订单
|
|
|
|
|
await tenantDb.Updateable<SeaExport>().SetColumns(x => x.MBLNO == taskBcInfo.MBL_NO).Where(x => x.Id == seaExport.Id).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 赋值
|
|
|
|
|
seaExport.MBLNO = taskBcInfo.MBL_NO;
|
|
|
|
|
|
|
|
|
@ -2592,6 +2602,10 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed("未执行:当前任务状态为已完成,请重新查询");
|
|
|
|
|
}
|
|
|
|
|
if (waitBcTask.OUT_BS_NO == null)
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed("未执行:当前任务的业务主键为null");
|
|
|
|
|
}
|
|
|
|
|
taskBcInfo.BOOKING_ORDER_ID = waitBcTask.OUT_BS_NO;
|
|
|
|
|
|
|
|
|
|
// 获取订单信息
|
|
|
|
@ -2738,6 +2752,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.EnumDescription()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 存库
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -2757,6 +2772,20 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var taskService = serviceProvider.GetRequiredService<ITaskService>();
|
|
|
|
|
var rlt = await taskService.SetTaskStatusAsync(new TaskUpdateRequest()
|
|
|
|
|
{
|
|
|
|
|
AutoCreateNext = false,
|
|
|
|
|
BusinessId = (long)waitBcTask.OUT_BS_NO,
|
|
|
|
|
BusinessType = BusinessType.OceanShippingExport,
|
|
|
|
|
TaskStatus = TaskStatusEnum.Complete,
|
|
|
|
|
TaskTypeName = TaskBaseTypeEnum.WAIT_BC.ToString()
|
|
|
|
|
});
|
|
|
|
|
if (!rlt.Succeeded)
|
|
|
|
|
{
|
|
|
|
|
logger.LogError("手动上传BC:设置收BC任务完成时失败,message:" + rlt.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 触发BC任务,执行自动化操作
|
|
|
|
|
TaskManageOrderBCInfo messageBcInfo = taskBcInfo.Adapt<TaskManageOrderBCInfo>();
|
|
|
|
|
messageBcInfo.CtnList = ctnList.Adapt<List<TaskManageOrderBCCTNInfo>>();
|
|
|
|
@ -2801,32 +2830,70 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
/// <param name="dataContext">数据上下文</param>
|
|
|
|
|
public async Task<DataResult> BCTaskCompleteThenNext(TaskFlowDataContext dataContext)
|
|
|
|
|
{
|
|
|
|
|
var businessId = dataContext.Get<long?>(TaskFlowDataNameConst.BusinessId);
|
|
|
|
|
if (businessId == null || businessId == 0)
|
|
|
|
|
// 这里获取到的是获取BC任务的基础任务
|
|
|
|
|
var taskBaseInfo = dataContext.Get<TaskBaseInfo>(TaskFlowDataNameConst.TaskBaseInfo);
|
|
|
|
|
if (taskBaseInfo == null)
|
|
|
|
|
{
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info, $"执行BCTaskCompleteThenNext时,未获取到businessId:{businessId}");
|
|
|
|
|
return DataResult.Failed("未获取到订单Id");
|
|
|
|
|
return DataResult.Failed("未获取到BC任务对象TaskBaseInfo");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await SetTaskStatus(taskBaseInfo, TaskStatusEnum.Complete, DateTime.Now);
|
|
|
|
|
|
|
|
|
|
if (taskBaseInfo.OUT_BS_NO is null or 0)
|
|
|
|
|
{
|
|
|
|
|
logger.LogError("BCTaskCompleteThenNext:BC任务对象TaskBaseInfo的OUT_BS_NO为空或0");
|
|
|
|
|
return DataResult.Failed("任务对象的业务主键为空");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var taskService = serviceProvider.GetRequiredService<ITaskService>();
|
|
|
|
|
var rlt = await taskService.SetTaskStatusAsync(new TaskUpdateRequest()
|
|
|
|
|
var req = new TaskCreationRequest
|
|
|
|
|
{
|
|
|
|
|
AutoCreateNext = true,
|
|
|
|
|
BusinessId = (long)businessId,
|
|
|
|
|
BusinessId = (long)taskBaseInfo.OUT_BS_NO,
|
|
|
|
|
BusinessType = BusinessType.OceanShippingExport,
|
|
|
|
|
TaskStatus = TaskStatusEnum.Complete,
|
|
|
|
|
TaskTypeName = TaskBaseTypeEnum.WAIT_BC.ToString()
|
|
|
|
|
});
|
|
|
|
|
if (rlt.Succeeded)
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Successed("BC任务已完成,并创建下一步任务");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
TaskTypeName = TaskBaseTypeEnum.WAIT_SPACE_RELEASE.ToString(),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CompareResultInfo? compareResult = dataContext.Get<CompareResultInfo>(TaskFlowDataNameConst.BcCompareWithSeaExportResult);
|
|
|
|
|
if (compareResult != null && compareResult.IsExistsDiff)
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed(rlt.Message);
|
|
|
|
|
req.TaskDescription = "未放舱原因:BC对比存在差异";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var taskService = serviceProvider.GetRequiredService<ITaskService>();
|
|
|
|
|
var result = await taskService.CreateTaskAsync(req, false);
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return DataResult.Failed("创建下一任务时返回错误:" + result.Message, result.MultiCode);
|
|
|
|
|
}
|
|
|
|
|
return DataResult.Successed("BC任务已完成,并创建下一步任务");
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
//之前这里结束的待收BC任务,后面改为结束BC任务
|
|
|
|
|
//var businessId = dataContext.Get<long?>(TaskFlowDataNameConst.BusinessId);
|
|
|
|
|
//if (businessId == null || businessId == 0)
|
|
|
|
|
//{
|
|
|
|
|
// Logger.Log(NLog.LogLevel.Info, $"执行BCTaskCompleteThenNext时,未获取到businessId:{businessId}");
|
|
|
|
|
// return DataResult.Failed("未获取到订单Id");
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
//var taskService = serviceProvider.GetRequiredService<ITaskService>();
|
|
|
|
|
//var rlt = await taskService.SetTaskStatusAsync(new TaskUpdateRequest()
|
|
|
|
|
// {
|
|
|
|
|
// AutoCreateNext = false,
|
|
|
|
|
// BusinessId = (long)businessId,
|
|
|
|
|
// BusinessType = BusinessType.OceanShippingExport,
|
|
|
|
|
// TaskStatus = TaskStatusEnum.Complete,
|
|
|
|
|
// TaskTypeName = TaskBaseTypeEnum.WAIT_BC.ToString()
|
|
|
|
|
// });
|
|
|
|
|
// if (rlt.Succeeded)
|
|
|
|
|
// {
|
|
|
|
|
// return DataResult.Successed("BC任务已完成,并创建下一步任务");
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// return DataResult.Failed(rlt.Message);
|
|
|
|
|
// }
|
|
|
|
|
//} */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|