From 9d3c09b3f201a88b548d8168ec4faf47ff877755 Mon Sep 17 00:00:00 2001 From: hao <86whm@163.com> Date: Tue, 9 Jan 2024 09:02:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=88=B1=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingSlot/BookingSlotAllocation.cs | 255 ++++++++++++++++++ .../BookingSlot/BookingSlotAllocationCtn.cs | 111 ++++++++ .../Entity/BookingSlot/BookingSlotStock.cs | 4 +- .../Event/BookingSlotStockSubscriber.cs | 126 +++++++++ .../Service/BookingSlot/BookingSlotService.cs | 2 +- .../BookingSlot/Dto/BookingSlotBaseDto.cs | 21 ++ 6 files changed, 516 insertions(+), 3 deletions(-) create mode 100644 Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs create mode 100644 Myshipping.Application/Entity/BookingSlot/BookingSlotAllocationCtn.cs create mode 100644 Myshipping.Application/Event/BookingSlotStockSubscriber.cs diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs new file mode 100644 index 00000000..449a1efd --- /dev/null +++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs @@ -0,0 +1,255 @@ +using System; +using System.Collections.Generic; +using SqlSugar; +using Myshipping.Core.Entity; + +/* + * @author : whm + * @date : 2024-1-5 + * @desc : 舱位分配表 + */ +namespace Myshipping.Application +{ + /// + /// 舱位分配表 + /// + [SugarTable("booking_slot_allocation", TableDescription = "舱位分配表")] + public class BookingSlotAllocation : DBEntityTenant + { + /// + /// 舱位主键 + /// + [SugarColumn(ColumnName = "BOOKING_SLOT_ID")] + public long BOOKING_SLOT_ID{ get; set; } + + /// + /// 订舱主键,关联订舱主表ID + /// + [SugarColumn(ColumnName = "BOOKING_ID")] + public long BOOKING_ID{ get; set; } + + /// + /// 舱位提单号 + /// + [SugarColumn(ColumnName = "SLOT_BOOKING_NO")] + public string SLOT_BOOKING_NO{ get; set; } + + /// + /// 分配提单号 + /// + [SugarColumn(ColumnName = "ALLO_BILL_NO")] + public string ALLO_BILL_NO{ get; set; } + + /// + /// 最终提单号,分票后船公司重新分配提单号 + /// + [SugarColumn(ColumnName = "FINAL_BILL_NO")] + public string FINAL_BILL_NO{ get; set; } + + /// + /// 合约号 + /// + [SugarColumn(ColumnName = "CONTRACT_NO")] + public string CONTRACT_NO{ get; set; } + + /// + /// 订舱抬头 + /// + [SugarColumn(ColumnName = "BOOKING_PARTY")] + public string BOOKING_PARTY{ get; set; } + + /// + /// 船名 + /// + [SugarColumn(ColumnName = "VESSEL")] + public string VESSEL{ get; set; } + + /// + /// 航次号 + /// + [SugarColumn(ColumnName = "VOYNO")] + public string VOYNO{ get; set; } + + /// + /// 预计开船日期 + /// + [SugarColumn(ColumnName = "ETD")] + public DateTime ETD{ get; set; } + + /// + /// 预计到港日期 + /// + [SugarColumn(ColumnName = "ETA")] + public DateTime ETA{ get; set; } + + /// + /// 收货地代码 + /// + [SugarColumn(ColumnName = "PLACERECEIPTID")] + public string PLACERECEIPTID{ get; set; } + + /// + /// 收货地 + /// + [SugarColumn(ColumnName = "PLACERECEIPT")] + public string PLACERECEIPT{ get; set; } + + /// + /// 交货地代码 + /// + [SugarColumn(ColumnName = "PLACEDELIVERYID")] + public string PLACEDELIVERYID{ get; set; } + + /// + /// 交货地 + /// + [SugarColumn(ColumnName = "PLACEDELIVERY")] + public string PLACEDELIVERY{ get; set; } + + /// + /// 装货港代码 + /// + [SugarColumn(ColumnName = "PORTLOADID")] + public string PORTLOADID{ get; set; } + + /// + /// 装货港 + /// + [SugarColumn(ColumnName = "PORTLOAD")] + public string PORTLOAD{ get; set; } + + /// + /// 卸货港代码 + /// + [SugarColumn(ColumnName = "PORTDISCHARGEID")] + public string PORTDISCHARGEID{ get; set; } + + /// + /// 卸货港 + /// + [SugarColumn(ColumnName = "PORTDISCHARGE")] + public string PORTDISCHARGE{ get; set; } + + /// + /// 中转港1 + /// + [SugarColumn(ColumnName = "TRANSFER_PORT_1")] + public string TRANSFER_PORT_1{ get; set; } + + /// + /// 中转港2 + /// + [SugarColumn(ColumnName = "TRANSFER_PORT_2")] + public string TRANSFER_PORT_2{ get; set; } + + /// + /// 船公司代号 + /// + [SugarColumn(ColumnName = "CARRIERID")] + public string CARRIERID{ get; set; } + + /// + /// 船公司 + /// + [SugarColumn(ColumnName = "CARRIER")] + public string CARRIER{ get; set; } + + /// + /// 航线代码(船公司) + /// + [SugarColumn(ColumnName = "LANECODE")] + public string LANECODE{ get; set; } + + /// + /// 航线名称(船公司) + /// + [SugarColumn(ColumnName = "LANENAME")] + public string LANENAME{ get; set; } + + /// + /// 承运方式 DIRECT_SHIP-直达;TRANSFER_SHIP-中转 + /// + [SugarColumn(ColumnName = "CARRIAGE_TYPE")] + public string CARRIAGE_TYPE{ get; set; } + + /// + /// 承运方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 + /// + [SugarColumn(ColumnName = "CARRIAGE_TYPE_NAME")] + public string CARRIAGE_TYPE_NAME{ get; set; } + + /// + /// 订舱方式 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 + /// + [SugarColumn(ColumnName = "BOOKING_SLOT_TYPE")] + public string BOOKING_SLOT_TYPE{ get; set; } + + /// + /// 订舱方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 + /// + [SugarColumn(ColumnName = "BOOKING_SLOT_TYPE_NAME")] + public string BOOKING_SLOT_TYPE_NAME{ get; set; } + + /// + /// 签单方式 ORIGINAL-正本;TELEX-电放;SEAWAY BILL-海运单; + /// + [SugarColumn(ColumnName = "ISSUETYPE")] + public string ISSUETYPE{ get; set; } + + /// + /// 箱型箱量 + /// + [SugarColumn(ColumnName = "CTN_STAT")] + public string CTN_STAT{ get; set; } + + /// + /// 所在周数 + /// + [SugarColumn(ColumnName = "WEEK_AT")] + public string WEEK_AT{ get; set; } + + /// + /// 箱使天数 + /// + [SugarColumn(ColumnName = "DETENSION_FREE_DAYS")] + public int DETENSION_FREE_DAYS{ get; set; } + + /// + /// 样单截止日期 + /// + [SugarColumn(ColumnName = "SI_CUT_DATE")] + public DateTime SI_CUT_DATE{ get; set; } + + /// + /// 截港时间 + /// + [SugarColumn(ColumnName = "CY_CUT_DATE")] + public DateTime CY_CUT_DATE{ get; set; } + + /// + /// VGM截止日期 + /// + [SugarColumn(ColumnName = "VGM_SUBMISSION_CUT_DATE")] + public DateTime VGM_SUBMISSION_CUT_DATE{ get; set; } + + /// + /// MDGF提交截止时间 + /// + [SugarColumn(ColumnName = "MDGF_CUT_DATE")] + public DateTime MDGF_CUT_DATE{ get; set; } + + /// + /// 舱单截止时间 + /// + [SugarColumn(ColumnName = "MANIFEST_CUT_DATE")] + public DateTime MANIFEST_CUT_DATE{ get; set; } + + + /// + /// 租户名称 + /// + [SugarColumn(ColumnName = "TenantName")] + public string TenantName{ get; set; } + + } +} \ No newline at end of file diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocationCtn.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocationCtn.cs new file mode 100644 index 00000000..a5896dd3 --- /dev/null +++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocationCtn.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using SqlSugar; +using Myshipping.Core.Entity; + +/* + * @author : whm + * @date : 2024-1-5 + * @desc : 舱位分配集装箱表 + */ +namespace Myshipping.Application +{ + /// + /// 舱位分配集装箱表 + /// + [SugarTable("booking_slot_allocation_ctn", TableDescription = "舱位分配集装箱表")] + public class BookingSlotAllocationCtn : DBEntityTenant + { + /// + /// 舱位分配主键 + /// + [SugarColumn(ColumnName = "SLOT_ALLOC_ID")] + public long SLOT_ALLOC_ID{ get; set; } + + /// + /// 箱型代码 + /// + [SugarColumn(ColumnName = "CTNCODE")] + public string CTNCODE{ get; set; } + + /// + /// 箱型名称 + /// + [SugarColumn(ColumnName = "CTNALL")] + public string CTNALL{ get; set; } + + /// + /// 箱量 + /// + [SugarColumn(ColumnName = "CTNNUM")] + public int CTNNUM{ get; set; } + + /// + /// 箱号 + /// + [SugarColumn(ColumnName = "CNTRNO")] + public string CNTRNO{ get; set; } + + /// + /// 箱封号 + /// + [SugarColumn(ColumnName = "SEALNO")] + public string SEALNO{ get; set; } + + /// + /// 件数 + /// + [SugarColumn(ColumnName = "PKGS")] + public int PKGS{ get; set; } + + /// + /// 包装 + /// + [SugarColumn(ColumnName = "KINDPKGS")] + public string KINDPKGS{ get; set; } + + /// + /// 毛重 + /// + [SugarColumn(ColumnName = "KGS")] + public decimal KGS{ get; set; } + + /// + /// 尺码 + /// + [SugarColumn(ColumnName = "CBM")] + public decimal CBM{ get; set; } + + /// + /// 皮重 + /// + [SugarColumn(ColumnName = "TAREWEIGHT")] + public decimal TAREWEIGHT{ get; set; } + + /// + /// 箱状态 + /// + [SugarColumn(ColumnName = "CTNSTATUS")] + public string CTNSTATUS{ get; set; } + + /// + /// 称重方式 + /// + [SugarColumn(ColumnName = "WEIGHTYPE")] + public string WEIGHTYPE{ get; set; } + + /// + /// 称重重量 + /// + [SugarColumn(ColumnName = "WEIGHKGS")] + public decimal WEIGHKGS{ get; set; } + + /// + /// 称重联系人 + /// + [SugarColumn(ColumnName = "WEIGHATTN")] + public string WEIGHATTN{ get; set; } + + + } +} \ No newline at end of file diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotStock.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotStock.cs index 4f5dd479..eee45bce 100644 --- a/Myshipping.Application/Entity/BookingSlot/BookingSlotStock.cs +++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotStock.cs @@ -68,13 +68,13 @@ namespace Myshipping.Application /// 预计开船日期 /// [SugarColumn(ColumnName = "ETD")] - public DateTime ETD{ get; set; } + public DateTime? ETD{ get; set; } /// /// 预计到港日期 /// [SugarColumn(ColumnName = "ETA")] - public DateTime ETA{ get; set; } + public DateTime? ETA{ get; set; } /// /// 航线代码(船公司) diff --git a/Myshipping.Application/Event/BookingSlotStockSubscriber.cs b/Myshipping.Application/Event/BookingSlotStockSubscriber.cs new file mode 100644 index 00000000..1073d9ec --- /dev/null +++ b/Myshipping.Application/Event/BookingSlotStockSubscriber.cs @@ -0,0 +1,126 @@ +using Furion; +using Furion.EventBus; +using Furion.FriendlyException; +using Furion.RemoteRequest.Extensions; +using Mapster; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Myshipping.Application.ConfigOption; +using Myshipping.Application.Entity; +using Myshipping.Application.Service.BookingOrder.Dto; +using Myshipping.Core; +using Myshipping.Core.Entity; +using Myshipping.Core.Service; +using Newtonsoft.Json.Linq; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application.Event +{ + /// + /// 运踪 + /// + public class BookingSlotStockSubscriber : IEventSubscriber + { + private readonly SqlSugarRepository _repBase; + private readonly SqlSugarRepository _repCtn; + private readonly SqlSugarRepository _repStock; + + private readonly ILogger _logger; + + public BookingSlotStockSubscriber(SqlSugarRepository repBase, + SqlSugarRepository repCtn, + SqlSugarRepository repStock, + ILogger logger) + { + _repBase = repBase; + _repCtn = repCtn; + _repStock = repStock; + _logger = logger; + } + + //更新库存 + [EventSubscribe("BookingSlotStock:Update")] + public async Task BookingSlotStock(EventHandlerExecutingContext context) + { + _logger.LogInformation($"收到更新库存订阅请求:{context.Source.Payload}"); + + var paraObj = context.Source.Payload as BookingSlotStockUpdateModel; + + var baseList = await _repBase.AsQueryable().Filter(null, true) + .Where(x => !x.IsDeleted + && x.VESSEL == paraObj.VESSEL + && x.VOYNO == paraObj.VOYNO + && x.CONTRACT_NO == paraObj.CONTRACT_NO + && x.BOOKING_SLOT_TYPE == paraObj.BOOKING_SLOT_TYPE + && x.CARRIERID == paraObj.CARRIERID) + .ToListAsync(); + + var stockObj = await _repStock.AsQueryable() + .Filter(null, true) + .FirstAsync(x => !x.IsDeleted + && x.VESSEL == paraObj.VESSEL + && x.VOYNO == paraObj.VOYNO + && x.CONTRACT_NO == paraObj.CONTRACT_NO + && x.BOOKING_SLOT_TYPE == paraObj.BOOKING_SLOT_TYPE + && x.CARRIERID == paraObj.CARRIERID); + if (stockObj == null) + { + stockObj = new BookingSlotStock(); + stockObj.VESSEL= baseList[0].VESSEL; + stockObj.VOYNO= baseList[0].VOYNO; + stockObj.CONTRACT_NO= baseList[0].CONTRACT_NO; + stockObj.BOOKING_SLOT_TYPE= baseList[0].BOOKING_SLOT_TYPE; + stockObj.BOOKING_SLOT_TYPE_NAME = baseList[0].BOOKING_SLOT_TYPE_NAME; + stockObj.BOOKING_PARTY = baseList[0].BOOKING_PARTY; + stockObj.CARRIERID = baseList[0].CARRIERID; + stockObj.CARRIER = baseList[0].CARRIER; + stockObj.ETD = baseList[0].ETD; + stockObj.ETA = baseList[0].ETA; + stockObj.LANECODE = baseList[0].LANECODE; + stockObj.LANENAME = baseList[0].LANENAME; + stockObj.WEEK_AT= baseList[0].WEEK_AT; + stockObj.TenantId = baseList[0].TenantId; + await _repStock.InsertAsync(stockObj); + } + + stockObj.TOTAL_ORDERS = baseList.Count; + + } + } + + public class BookingSlotStockUpdateModel + { + + /// + /// 船名 + /// + public string VESSEL { get; set; } + + /// + /// 航次号 + /// + public string VOYNO { get; set; } + + /// + /// 合约号 + /// + public string CONTRACT_NO { get; set; } + + /// + /// 订舱方式 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 + /// + public string BOOKING_SLOT_TYPE { get; set; } + + /// + /// 船公司代号 + /// + public string CARRIERID { get; set; } + } +} diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 8f4b0c65..c52601c3 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -60,7 +60,7 @@ namespace Myshipping.Application /// /// [HttpGet("/BookingSlot/page")] - public async Task Page([FromQuery] BookingSlotBasePageInput input) + public async Task> Page([FromQuery] BookingSlotBasePageInput input) { var entities = await _repBase.AsQueryable() .WhereIF(!string.IsNullOrEmpty(input.SLOT_BOOKING_NO), u => u.SLOT_BOOKING_NO.Contains(input.SLOT_BOOKING_NO)) diff --git a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs index 3e7edf85..96117f33 100644 --- a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs +++ b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs @@ -130,6 +130,17 @@ namespace Myshipping.Application.Service.BookingSlot.Dto /// public string CONTRACT_NO { get; set; } + + /// + /// 承运方式 DIRECT_SHIP-直达;TRANSFER_SHIP-中转 + /// + public string CARRIAGE_TYPE { get; set; } + + /// + /// 承运方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 + /// + public string CARRIAGE_TYPE_NAME { get; set; } + /// /// 订舱方式 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 /// @@ -140,6 +151,11 @@ namespace Myshipping.Application.Service.BookingSlot.Dto /// public string BOOKING_SLOT_TYPE_NAME { get; set; } + /// + /// 签单方式 ORIGINAL-正本;TELEX-电放;SEAWAY BILL-海运单; + /// + public string ISSUETYPE { get; set; } + /// /// 订舱抬头 /// @@ -211,6 +227,11 @@ namespace Myshipping.Application.Service.BookingSlot.Dto /// public string WEEK_AT { get; set; } + /// + /// 箱使天数 + /// + public int DETENSION_FREE_DAYS { get; set; } + /// /// 箱型箱量 ///