|
|
@ -1184,7 +1184,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
SeaExport = seaExport,
|
|
|
|
SeaExport = seaExport,
|
|
|
|
OpCtnList = seaExportCtnList
|
|
|
|
OpCtnList = seaExportCtnList
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var result = await CompareBcWithSeaExport(compareDto);
|
|
|
|
CompareResultInfo result = await CompareBcWithSeaExport(compareDto);
|
|
|
|
|
|
|
|
|
|
|
|
dataContext.Set(TaskFlowDataNameConst.BcCompareWithSeaExportResult, result);
|
|
|
|
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 taskBcInfo = dataContext.Get<TaskBCInfo?>(TaskFlowDataNameConst.TaskBCInfo) ?? throw new ArgumentException($"缺少参数:{nameof(TaskFlowDataNameConst.TaskBCInfo)}");
|
|
|
|
|
|
|
|
|
|
|
|
var result = await BcMatchSeaExport(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>()
|
|
|
|
await tenantDb.Updateable<TaskBCInfo>()
|
|
|
|
.SetColumns(x => x.BOOKING_ORDER_ID == result.Data.Id)
|
|
|
|
.SetColumns(x => x.BOOKING_ORDER_ID == result.Data.Id)
|
|
|
|
.Where(x => x.Id == taskBcInfo.Id)
|
|
|
|
.Where(x => x.Id == taskBcInfo.Id)
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await tenantDb.Updateable<TaskBaseInfo>()
|
|
|
|
|
|
|
|
.SetColumns(x => x.OUT_BS_NO == result.Data.Id)
|
|
|
|
|
|
|
|
.Where(x => x.Id == taskBcInfo.TASK_ID)
|
|
|
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1362,6 +1371,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
private async Task<DataResult<SeaExportRes?>> BcMatchSeaExport(TaskBCInfo taskBcInfo)
|
|
|
|
private async Task<DataResult<SeaExportRes?>> BcMatchSeaExport(TaskBCInfo taskBcInfo)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var queryable = tenantDb.Queryable<SeaExport>();
|
|
|
|
var queryable = tenantDb.Queryable<SeaExport>();
|
|
|
|
|
|
|
|
|
|
|
|
if (taskBcInfo.BOOKING_ORDER_ID is not null or 0)
|
|
|
|
if (taskBcInfo.BOOKING_ORDER_ID is not null or 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
queryable.Where(x => x.Id == taskBcInfo.BOOKING_ORDER_ID);
|
|
|
|
queryable.Where(x => x.Id == taskBcInfo.BOOKING_ORDER_ID);
|
|
|
@ -2592,6 +2602,10 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return DataResult.Failed("未执行:当前任务状态为已完成,请重新查询");
|
|
|
|
return DataResult.Failed("未执行:当前任务状态为已完成,请重新查询");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (waitBcTask.OUT_BS_NO == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return DataResult.Failed("未执行:当前任务的业务主键为null");
|
|
|
|
|
|
|
|
}
|
|
|
|
taskBcInfo.BOOKING_ORDER_ID = waitBcTask.OUT_BS_NO;
|
|
|
|
taskBcInfo.BOOKING_ORDER_ID = waitBcTask.OUT_BS_NO;
|
|
|
|
|
|
|
|
|
|
|
|
// 获取订单信息
|
|
|
|
// 获取订单信息
|
|
|
@ -2738,6 +2752,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.EnumDescription()
|
|
|
|
FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.EnumDescription()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 存库
|
|
|
|
// 存库
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2757,6 +2772,20 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
throw;
|
|
|
|
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任务,执行自动化操作
|
|
|
|
// 触发BC任务,执行自动化操作
|
|
|
|
TaskManageOrderBCInfo messageBcInfo = taskBcInfo.Adapt<TaskManageOrderBCInfo>();
|
|
|
|
TaskManageOrderBCInfo messageBcInfo = taskBcInfo.Adapt<TaskManageOrderBCInfo>();
|
|
|
|
messageBcInfo.CtnList = ctnList.Adapt<List<TaskManageOrderBCCTNInfo>>();
|
|
|
|
messageBcInfo.CtnList = ctnList.Adapt<List<TaskManageOrderBCCTNInfo>>();
|
|
|
@ -2801,32 +2830,70 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
/// <param name="dataContext">数据上下文</param>
|
|
|
|
/// <param name="dataContext">数据上下文</param>
|
|
|
|
public async Task<DataResult> BCTaskCompleteThenNext(TaskFlowDataContext dataContext)
|
|
|
|
public async Task<DataResult> BCTaskCompleteThenNext(TaskFlowDataContext dataContext)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var businessId = dataContext.Get<long?>(TaskFlowDataNameConst.BusinessId);
|
|
|
|
// 这里获取到的是获取BC任务的基础任务
|
|
|
|
if (businessId == null || businessId == 0)
|
|
|
|
var taskBaseInfo = dataContext.Get<TaskBaseInfo>(TaskFlowDataNameConst.TaskBaseInfo);
|
|
|
|
|
|
|
|
if (taskBaseInfo == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return DataResult.Failed("未获取到BC任务对象TaskBaseInfo");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await SetTaskStatus(taskBaseInfo, TaskStatusEnum.Complete, DateTime.Now);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (taskBaseInfo.OUT_BS_NO is null or 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger.Log(NLog.LogLevel.Info, $"执行BCTaskCompleteThenNext时,未获取到businessId:{businessId}");
|
|
|
|
logger.LogError("BCTaskCompleteThenNext:BC任务对象TaskBaseInfo的OUT_BS_NO为空或0");
|
|
|
|
return DataResult.Failed("未获取到订单Id");
|
|
|
|
return DataResult.Failed("任务对象的业务主键为空");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var taskService = serviceProvider.GetRequiredService<ITaskService>();
|
|
|
|
var req = new TaskCreationRequest
|
|
|
|
var rlt = await taskService.SetTaskStatusAsync(new TaskUpdateRequest()
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AutoCreateNext = true,
|
|
|
|
BusinessId = (long)taskBaseInfo.OUT_BS_NO,
|
|
|
|
BusinessId = (long)businessId,
|
|
|
|
|
|
|
|
BusinessType = BusinessType.OceanShippingExport,
|
|
|
|
BusinessType = BusinessType.OceanShippingExport,
|
|
|
|
TaskStatus = TaskStatusEnum.Complete,
|
|
|
|
TaskTypeName = TaskBaseTypeEnum.WAIT_SPACE_RELEASE.ToString(),
|
|
|
|
TaskTypeName = TaskBaseTypeEnum.WAIT_BC.ToString()
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
if (rlt.Succeeded)
|
|
|
|
CompareResultInfo? compareResult = dataContext.Get<CompareResultInfo>(TaskFlowDataNameConst.BcCompareWithSeaExportResult);
|
|
|
|
{
|
|
|
|
if (compareResult != null && compareResult.IsExistsDiff)
|
|
|
|
return DataResult.Successed("BC任务已完成,并创建下一步任务");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//} */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|