From ae6749ace1e2eef1731b793f5938e5c9f3cc084d Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Fri, 25 Oct 2024 16:24:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=90=8C=E6=AD=A5=E8=88=B1=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/BookingSlot/BookingOrderToSlotDto.cs | 69 +++++++++++++++++ .../BookingSlot/IBookingSlotService.cs | 6 ++ .../Method/BookingSlot/BookingSlotService.cs | 77 ++++++++++++++++++- .../DS.WMS.Core/Op/Method/SeaExportService.cs | 18 +++++ 4 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingOrderToSlotDto.cs diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingOrderToSlotDto.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingOrderToSlotDto.cs new file mode 100644 index 00000000..c1af9334 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingOrderToSlotDto.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Op.Dtos +{ + /// + /// + /// + public class BookingOrderToSlotDto + { + /// + /// 提单号 + /// + public string SlotBookingNo { get; set; } + + /// + /// 订单ID + /// + public long BookingId { get; set; } + + /// + /// 委托客户ID + /// + public Nullable CustomerId { get; set; } + + /// + /// 委托客户名称 + /// + public string CustomerName { get; set; } + + /// + /// 销售ID + /// + public Nullable SaleId { get; set; } + + /// + /// 销售名称 + /// + public string SaleName { get; set; } + + /// + /// 操作ID + /// + public Nullable OpId { get; set; } + + /// + /// 操作名称 + /// + public string OpName { get; set; } + + /// + /// 单证ID + /// + public Nullable DocId { get; set; } + + /// + /// 单证名称 + /// + public string DocName { get; set; } + + /// + /// 委托编号 + /// + public string CustomerNo { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs index 8930660e..6d0ba84e 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs @@ -271,5 +271,11 @@ namespace DS.WMS.Core.Op.Interface /// 返回回执 Task BookingSlotOpenEdit(BookingSlotOpenEditReq req); + /// + /// 同步订单更新舱位 + /// + /// 同步订单更新舱位请求 + /// 返回回执 + Task SyncBookingOrderToSlot(BookingOrderToSlotDto req); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs index a9110ef2..631acd54 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs @@ -63,6 +63,7 @@ using System.ComponentModel; using Masuit.Tools.Systems; using System.Threading; using NPOI.OpenXmlFormats.Wordprocessing; +using DS.WMS.Core.Invoice.Dtos; namespace DS.WMS.Core.Op.Method { @@ -4864,7 +4865,81 @@ namespace DS.WMS.Core.Op.Method } #endregion - #region 同步 + #region 同步订单更新舱位 + /// + /// 同步订单更新舱位 + /// + /// 同步订单更新舱位请求 + /// 返回回执 + public async Task SyncBookingOrderToSlot(BookingOrderToSlotDto req) + { + try + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + + /* + 1、检索出所有订单相关的舱位。 + 2、将订单信息更新到舱位 + */ + + var allocList = await tenantDb.Queryable().Where(a => a.BookingId == req.BookingId && a.Deleted == false).ToListAsync(); + + if (allocList.Count > 0) + { + foreach (var alloc in allocList) + { + alloc.CustomerId = req.CustomerId; + + alloc.CustomerName = req.CustomerName; + + if (req.SaleId.HasValue) + alloc.SaleId = req.SaleId.Value.ToString(); + + alloc.Sale = req.SaleName; + + if (req.OpId.HasValue) + alloc.OpId = req.OpId.Value.ToString(); + + alloc.Op = req.OpName; + + if (req.DocId.HasValue) + alloc.DocId = req.DocId.Value.ToString(); + + alloc.Doc = req.DocName; + + await tenantDb.Updateable(alloc).UpdateColumns(x => new + { + x.CustomerId, + x.CustomerName, + x.SaleId, + x.Sale, + x.OpId, + x.Op, + x.DocId, + x.Doc + }).ExecuteCommandAsync(); + + var slot = await tenantDb.Queryable().FirstAsync(b => b.Id == alloc.BookingSlotId); + + if (slot != null) + { + slot.CustomerNo = req.CustomerNo; + + await tenantDb.Updateable(slot).UpdateColumns(x => new + { + x.CustomerNo, + }).ExecuteCommandAsync(); + } + } + } + } + catch(Exception ex) + { + + } + + return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess)); + } #endregion } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index 5bb3d754..32ed5c8c 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -50,6 +50,7 @@ public partial class SeaExportService : ISeaExportService private readonly ISysCacheService _sysCacheService; private readonly IRabbitMQService _rabbitMQService; private readonly IRedisService _redisBaseService; + private readonly IBookingSlotService _bookingSlotService; private readonly Lazy _taskManageBaseService; @@ -87,6 +88,8 @@ public partial class SeaExportService : ISeaExportService _configService = _serviceProvider.GetRequiredService(); _rabbitMQService = _serviceProvider.GetRequiredService(); _redisBaseService = _serviceProvider.GetRequiredService(); + _bookingSlotService = _serviceProvider.GetRequiredService(); + _taskManageBaseService = _serviceProvider.GetRequiredService>(); } @@ -499,6 +502,21 @@ public partial class SeaExportService : ISeaExportService //return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); await tenantDb.Ado.CommitTranAsync(); + + //保存会同步舱位 + await _bookingSlotService.SyncBookingOrderToSlot(new BookingOrderToSlotDto { + BookingId = info.Id, + CustomerId = info.CustomerId, + CustomerName = info.CustomerName, + CustomerNo = info.CustomerNo, + DocId = info.Doc, + DocName = info.DocName, + SaleId = info.SaleId, + SaleName = info.Sale, + OpId = info.OperatorId, + OpName = info.OperatorName + }); + return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess)); } catch (Exception ex)