退舱入池接口

dev
cjy 2 months ago
parent cc7249f3f3
commit bf1c96db2d

@ -1,4 +1,5 @@
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Dtos;
using System; using System;
@ -53,5 +54,14 @@ namespace DS.WMS.Core.Op.Interface
/// <param name="req"></param> /// <param name="req"></param>
/// <returns></returns> /// <returns></returns>
public Task<DataResult> CreateChangeTaskAsync(ChangeTaskReq req); public Task<DataResult> CreateChangeTaskAsync(ChangeTaskReq req);
/// <summary>
/// 退舱入池
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public Task<DataResult> RefundPoolAsync(IdModel req);
} }
} }

@ -49,6 +49,8 @@ namespace DS.WMS.Core.Op.Method
private readonly ICommonService commonService; private readonly ICommonService commonService;
readonly ITaskService taskService; readonly ITaskService taskService;
private readonly ISeaExportCommonService seaComService; private readonly ISeaExportCommonService seaComService;
private readonly IBookingSlotService bookSlotService;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -62,6 +64,7 @@ namespace DS.WMS.Core.Op.Method
saasService = _serviceProvider.GetRequiredService<ISaasDbService>(); saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
seaComService = _serviceProvider.GetRequiredService<ISeaExportCommonService>(); seaComService = _serviceProvider.GetRequiredService<ISeaExportCommonService>();
taskService = serviceProvider.GetRequiredService<ITaskService>(); 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)); //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;
}
} }
} }

@ -1,4 +1,5 @@
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Interface; using DS.WMS.Core.Op.Interface;
@ -97,6 +98,16 @@ namespace DS.WMS.OpApi.Controllers
{ {
return await _invokeService.CreateChangeTaskAsync(req); return await _invokeService.CreateChangeTaskAsync(req);
} }
/// <summary>
/// 退舱入池
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("RefundPool")]
public async Task<DataResult> RefundPool([FromBody] IdModel req)
{
return await _invokeService.RefundPoolAsync(req);
}
} }
} }
Loading…
Cancel
Save