From bf1c96db2dee38b55b6132e1495d05371d7f3e3c Mon Sep 17 00:00:00 2001 From: cjy Date: Sat, 12 Oct 2024 11:44:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E8=88=B1=E5=85=A5=E6=B1=A0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Op/Interface/ISeaExportRefundService.cs | 10 ++++ .../Op/Method/SeaExportRefundService.cs | 53 +++++++++++++++++++ .../Controllers/SeaExportRefundController.cs | 13 ++++- 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportRefundService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportRefundService.cs index 77066561..f0131b78 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportRefundService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportRefundService.cs @@ -1,4 +1,5 @@ using DS.Module.Core; +using DS.Module.Core.Data; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Op.Dtos; using System; @@ -53,5 +54,14 @@ namespace DS.WMS.Core.Op.Interface /// /// public Task CreateChangeTaskAsync(ChangeTaskReq req); + + + /// + /// 退舱入池 + /// + /// + /// + + public Task RefundPoolAsync(IdModel req); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportRefundService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportRefundService.cs index 84e1bdce..b5a46698 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportRefundService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportRefundService.cs @@ -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; + /// /// /// @@ -62,6 +64,7 @@ namespace DS.WMS.Core.Op.Method saasService = _serviceProvider.GetRequiredService(); seaComService = _serviceProvider.GetRequiredService(); taskService = serviceProvider.GetRequiredService(); + bookSlotService = serviceProvider.GetRequiredService(); } @@ -556,5 +559,55 @@ namespace DS.WMS.Core.Op.Method //return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); } + + + /// + /// 退舱入池 + /// + /// + /// + + public async Task RefundPoolAsync(IdModel req) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var info = await tenantDb.Queryable().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().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().Where(x => x.BSNO == req.Id).ToListAsync(); + if (ctnList.Count == 0) + return await Task.FromResult(DataResult.Failed("集装箱列表不能为空!")); + + + var ctns = ctnList.Adapt>(); + + + //调用退舱入池接口 + 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; + + } } } diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportRefundController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportRefundController.cs index dbbf73a1..0b382965 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportRefundController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportRefundController.cs @@ -1,4 +1,5 @@ using DS.Module.Core; +using DS.Module.Core.Data; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Interface; @@ -97,6 +98,16 @@ namespace DS.WMS.OpApi.Controllers { return await _invokeService.CreateChangeTaskAsync(req); } - + /// + /// 退舱入池 + /// + /// + /// + [HttpPost] + [Route("RefundPool")] + public async Task RefundPool([FromBody] IdModel req) + { + return await _invokeService.RefundPoolAsync(req); + } } } \ No newline at end of file