From 0c97c109a6a53ced6460166a930a433df992d51d Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Thu, 22 Aug 2024 17:29:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingSlot/IBookingSlotStockService.cs | 7 + .../Method/BookingSlot/BookingSlotService.cs | 2 + .../BookingSlot/BookingSlotStockService.cs | 51 ++++++ .../SpaceReleaseActionExecutor.cs | 2 +- .../Op/Templates/ContainerPickUpMSK.cshtml | 153 +++++++----------- .../TaskPOLContainerNotPickUpShowDto.cs | 10 ++ .../TaskPOLContainerNotPickUpService.cs | 29 ++++ .../BookingSlotServiceController.cs | 17 +- 8 files changed, 172 insertions(+), 99 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotStockService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotStockService.cs index 24ee9d16..0b7c7b15 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotStockService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotStockService.cs @@ -1,5 +1,6 @@ using DS.Module.Core; using DS.WMS.Core.Op.Dtos; +using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; @@ -16,5 +17,11 @@ namespace DS.WMS.Core.Op.Interface /// 请求参数 /// 返回回执 Task> BookingSlotStock(BookingSlotStockUpdateModel paraObj); + + /// + /// 重新计算某租户下面所有的库存 + /// + /// + Task RefreshAllStock(); } } 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 7b293f13..f8fda580 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 @@ -54,6 +54,7 @@ using NPOI.XSSF.UserModel; using AngleSharp.Dom; using DS.WMS.Core.TaskPlat.Entity; using Microsoft.VisualBasic.FileIO; +using Microsoft.Extensions.Logging; namespace DS.WMS.Core.Op.Method { @@ -4356,6 +4357,7 @@ namespace DS.WMS.Core.Op.Method return DataResult>.Success(data); } #endregion + } public static class LetterIndexUtil diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotStockService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotStockService.cs index 1be505b4..17f9f80c 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotStockService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotStockService.cs @@ -14,6 +14,7 @@ using System.Text; using System.Threading.Tasks; using Mapster; using DS.WMS.Core.Op.Interface; +using Microsoft.Extensions.Logging; namespace DS.WMS.Core.Op.Method { @@ -41,6 +42,7 @@ namespace DS.WMS.Core.Op.Method saasService = _serviceProvider.GetRequiredService(); } + #region 计算舱位库存 /// /// 计算舱位库存 /// @@ -247,5 +249,54 @@ namespace DS.WMS.Core.Op.Method return DataResult.Success(string.Empty); } + #endregion + + #region 重新计算某租户下面所有的库存 + /// + /// 重新计算某租户下面所有的库存 + /// + /// + public async Task RefreshAllStock() + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + + var n = await tenantDb.Deleteable().ExecuteCommandAsync(); + + var group = await tenantDb.Queryable() + .Where(x => x.Deleted == false) + .GroupBy(x => new + { + x.Vessel, + x.Voyno, + x.CarrierCode, + x.ContractNo, + x.BookingSlotType, + x.PortLoadCode, + x.PortDischargeCode, + }).Select(x => new + { + x.Vessel, + x.Voyno, + x.CarrierCode, + x.ContractNo, + x.BookingSlotType, + x.PortLoadCode, + x.PortDischargeCode, + }).ToListAsync(); + foreach (var item in group) + { + BookingSlotStockUpdateModel model = new BookingSlotStockUpdateModel { + Vessel = item.Vessel, + Voyno = item.Voyno, + CarrierCode = item.CarrierCode, + ContractNo = item.ContractNo, + BookingSlotType = item.BookingSlotType, + PortLoadId = item.PortLoadCode, + PortDischargeId = item.PortDischargeCode, + }; + await BookingSlotStock(model); + } + } + #endregion } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs index 9bad3f1e..3b0de0b3 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs @@ -101,7 +101,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease BusinessId = context.TaskInfo.BusinessId, BusinessType = context.TaskInfo.BusinessType, }; - MailService mailService = new(context.ServiceProvider); + MailService mailService = new MailService(context.ServiceProvider); var result3 = await mailService.SendAsync(mailConfig, model); if (!result3.Succeeded) { diff --git a/ds-wms-service/DS.WMS.Core/Op/Templates/ContainerPickUpMSK.cshtml b/ds-wms-service/DS.WMS.Core/Op/Templates/ContainerPickUpMSK.cshtml index 5e812f43..217cf833 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Templates/ContainerPickUpMSK.cshtml +++ b/ds-wms-service/DS.WMS.Core/Op/Templates/ContainerPickUpMSK.cshtml @@ -1,107 +1,66 @@ -@* @model DS.WMS.Core.Op.Entity.MailTemplateModel *@ +@* @model DS.WMS.Core.Op.Entity.MailTemplateModel *@ @{ var item = Model.Primary; } + + - - -*** Auto Email, please reply to all (delete sender Admin)!If only reply to sender, we will not be able to find and deal with it! *** -
-Dear @Model.Contacts - -
- RE: BOOKING - JOB NO. -
- -请查看附件中的订舱委托,请2小时内先行回复订舱号给我们,并帮忙催促船东尽快放舱,如下信息同订舱委托一致,便于您查阅! - -CARRIER:@item.Carrier -S/Q:XX -ETD : @item.ETD - -POL: @item.LoadPort -POD: @item.DischargePort -FPOD: @item.DeliveryPlace -VOL: XX -Commdity: XX(取中文品名) -HS CODE: @item.HSCode -POD FREE TIME: -REMARK: -(取供应商备注) - - -此票订舱我司对接同事的联系方式如下,任何问题请及时跟我们沟通,谢谢! - - - - - - - - - - - - + + + + + 邮件模板 + + +
CN NameNameTel No.Mobile/Wechat/QQEmailPosition
- - - - - - + - - - - - - - - - - - - - - - - -
邵 芳Candy0532-8068838713375570007 2853083550candy@sunniness.netCooperation
魏涛Wilson0532-8068835313969858993 2853083555ope@sunniness.netOP manager
徐平平Cathy0532-8068835013969662965 2853083551opg@sunniness.netDocument
+ + + + + + + + + + + +
+

尊敬的客户,

+
+ + + + + + + + + -
-
- @* Tks + B’rgds - Candy SHAO 邵芳 (此处用当票操作的信息) - General Manager | SUNNINESS LOGISTICS CO.,LTD. - TEL: +86-0532-80688387 |MB./We chat: +86-18866622731|QQ:2853083553 | Email:candy@sunniness.net *@ -
-
+
船名/航次:@item.Vessel/@item.Voyno
定舱号码:@item.MBlNo
+
+ + + + + -@* 此邮件模板是订舱委托推送的邮件模板,在商务订单审核通过后,自动生成,并推送: -1)蓝色是调取系统数据、红色是醒目提醒; -2)订舱委托PDF格式作为附件一起发出 -3)邮件发给订舱代理联系人,抄送我司销售/客服和操作/单证;未勾选推送的订舱代理,仅推送我司干系人! *@ diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/POLContainerNotPickup/TaskPOLContainerNotPickUpShowDto.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/POLContainerNotPickup/TaskPOLContainerNotPickUpShowDto.cs index 01e24be5..c68f1aaf 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/POLContainerNotPickup/TaskPOLContainerNotPickUpShowDto.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/POLContainerNotPickup/TaskPOLContainerNotPickUpShowDto.cs @@ -62,5 +62,15 @@ namespace DS.WMS.Core.TaskPlat.Dtos /// 批次号 /// public string BatchNo { get; set; } + + /// + /// 租户ID + /// + public long TenantId { get; set; } + + /// + /// 租户名称 + /// + public string TenantCompanyName { get; set; } } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/POLContainerNotPickUp/TaskPOLContainerNotPickUpService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/POLContainerNotPickUp/TaskPOLContainerNotPickUpService.cs index 411c3aef..2f6d81d7 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/POLContainerNotPickUp/TaskPOLContainerNotPickUpService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/POLContainerNotPickUp/TaskPOLContainerNotPickUpService.cs @@ -39,6 +39,9 @@ using DS.WMS.Core.Op.EDI; using DS.WMS.Core.Sys.Dtos; using DS.WMS.Core.Code.Dtos; using DS.Module.Core.Data; +using LanguageExt.Common; +using DS.WMS.Core.Op.Method.TaskInteraction; +using DS.WMS.Core.Op.Entity.TaskInteraction; namespace DS.WMS.Core.TaskPlat.Method { @@ -118,6 +121,32 @@ namespace DS.WMS.Core.TaskPlat.Method /// 返回回执 public async Task SendEmailToCustomer(long taskPKId) { + //BusinessTaskMail? mailConfig = null; + //if (context.AdditionalData.TryGetValue(nameof(BusinessTaskMail) + "." + nameof(BusinessTaskMail.Id), out var id)) + //{ + // if (id == null) + // { + // await LogService.WriteLogAsync(context.TaskInfo, $"未配置【{context.TaskInfo.TaskType.GetDescription()}】任务的邮件设置"); + // return; + // } + // var idVal = (long)Convert.ChangeType(id, typeof(long)); + // mailConfig = (await taskMailService.GetAsync(idVal)).Data; + //} + + //if (mailConfig == null) + //{ + // //await LogService.WriteLogAsync(context.TaskInfo, $"未能根据任务配置值获取邮件模板设置"); + // //return; + //} + + //MailService mailService = new(_serviceProvider); + //var result3 = await mailService.SendAsync(mailConfig, model); + //if (!result3.Succeeded) + //{ + // //await LogService.WriteLogAsync(context.TaskInfo, result.Message); + // //return; + //} + return null; } #endregion diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/BookingSlotServiceController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/BookingSlotServiceController.cs index c6e21f03..9d985d27 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/BookingSlotServiceController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/BookingSlotServiceController.cs @@ -19,14 +19,16 @@ namespace DS.WMS.OpApi.Controllers public class BookingSlotServiceController : ApiController { private readonly IBookingSlotService _bookingSlotService; + private readonly IBookingSlotStockService _bookingSlotStockService; /// /// /// /// - public BookingSlotServiceController(IBookingSlotService bookingSlotService) + public BookingSlotServiceController(IBookingSlotService bookingSlotService, IBookingSlotStockService bookingSlotStockService) { _bookingSlotService = bookingSlotService; + _bookingSlotStockService = bookingSlotStockService; } #region 舱位接收保存、取消接口 @@ -428,5 +430,18 @@ namespace DS.WMS.OpApi.Controllers return await _bookingSlotService.GetSlotUseToConfig(); } #endregion + + #region 重新计算某租户下面所有的库存 + /// + /// 重新计算某租户下面所有的库存 + /// + /// + [HttpGet] + [Route("RefreshAllStock")] + public async Task RefreshAllStock() + { + await _bookingSlotStockService.RefreshAllStock(); + } + #endregion } }