|
|
|
@ -49,6 +49,8 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
private readonly ICommonService commonService;
|
|
|
|
|
readonly ITaskService taskService;
|
|
|
|
|
private readonly ISeaExportCommonService seaComService;
|
|
|
|
|
private readonly IBookingSlotService bookSlotService;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
@ -62,6 +64,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
|
|
|
|
seaComService = _serviceProvider.GetRequiredService<ISeaExportCommonService>();
|
|
|
|
|
taskService = serviceProvider.GetRequiredService<ITaskService>();
|
|
|
|
|
bookSlotService = serviceProvider.GetRequiredService<IBookingSlotService>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -556,5 +559,55 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
|
|
|
|
|
//return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 退舱入池
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
|
|
public async Task<DataResult> RefundPoolAsync(IdModel req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var info = await tenantDb.Queryable<SeaExport>().Where(x => x.Id == long.Parse(req.Id)).FirstAsync();
|
|
|
|
|
if (info.IsNull())
|
|
|
|
|
return await Task.FromResult(DataResult.Failed("不存在的海运出口信息!", MultiLanguageConst.SeaExportExist));
|
|
|
|
|
if (info.IsRefund == false)
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult(DataResult.Failed("订单状态必须为退舱标识!"));
|
|
|
|
|
}
|
|
|
|
|
var task = await tenantDb.Queryable<BusinessTask>().Where(x => x.BusinessId == long.Parse(req.Id) && x.TaskType == TaskBaseTypeEnum.RETURN_CABIN_POOL).FirstAsync();
|
|
|
|
|
|
|
|
|
|
if (task.IsNotNull() && task.TaskStatus == TaskStatusEnum.Complete)
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult(DataResult.Failed("退舱入池任务已完成!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ctnList = await tenantDb.Queryable<OpCtn>().Where(x => x.BSNO == req.Id).ToListAsync();
|
|
|
|
|
if (ctnList.Count == 0)
|
|
|
|
|
return await Task.FromResult(DataResult.Failed("集装箱列表不能为空!"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ctns = ctnList.Adapt<List<BookingSlotCtnSaveInput>>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//调用退舱入池接口
|
|
|
|
|
var postData = new BookingSlotBaseApiDto()
|
|
|
|
|
{
|
|
|
|
|
OpType = "del",
|
|
|
|
|
DataObj = new BookingSlotBaseApiSaveDto()
|
|
|
|
|
{
|
|
|
|
|
CtnList = ctns,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
var res = await bookSlotService.InnerApiReceive(postData);
|
|
|
|
|
|
|
|
|
|
if (!res.Succeeded)
|
|
|
|
|
return await Task.FromResult(DataResult.Failed(res.Message));
|
|
|
|
|
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|