From 18029a5771d12ccd60b128041415ba170731171d Mon Sep 17 00:00:00 2001 From: zhangxiaofeng Date: Thu, 11 Jan 2024 10:24:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=BC=95=E5=85=A5=E8=AE=A2=E8=88=B1?= =?UTF-8?q?=EF=BC=9A=E6=9F=A5=E8=AF=A2=E5=8F=AF=E7=94=A8=E7=9A=84=E8=88=B1?= =?UTF-8?q?=E4=BD=8D=E5=8F=8A=E7=AE=B1=E5=AD=90=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingSlot/BookingSlotService.cs | 90 +++++++++++++++++++ .../BookingSlot/Dto/BookingSlotBaseDto.cs | 11 +++ 2 files changed, 101 insertions(+) diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 497b8e6a..30d621bf 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -226,6 +226,96 @@ namespace Myshipping.Application //更新库存 await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", input)); } + + /// + /// 查询可用的舱位及箱子 + /// + [HttpGet("/BookingSlot/getAvailableSlots")] + public async Task> GetAvailableSlots([FromQuery] BookingSlotBaseDto input) + { + string[] ctnCodeList = null; + if (!string.IsNullOrEmpty(input.CTN_STAT)) + { + ctnCodeList = input.CTN_STAT.Split(','); + } + + // 1. 【舱位基础表】与【箱子表】做关联,并根据【舱位主键】、【箱型】做分组,统计出【总的箱量】,作为queryable1 + var queryable1 = _repBase.Context.Queryable((bas, ctn) => bas.Id == ctn.SLOT_ID) + .WhereIF(!string.IsNullOrEmpty(input.PORTLOAD), bas => bas.PORTLOAD.Contains(input.PORTLOAD)) + .WhereIF(!string.IsNullOrEmpty(input.PORTDISCHARGE), bas => bas.PORTLOAD.Contains(input.PORTLOAD)) + .WhereIF(!string.IsNullOrEmpty(input.VESSEL), bas => bas.VESSEL.Contains(input.VESSEL)) + .WhereIF(!string.IsNullOrEmpty(input.VOYNO), bas => bas.VOYNO.Contains(input.VOYNO)) + .WhereIF(!string.IsNullOrEmpty(input.CARRIAGE_TYPE), bas => bas.CARRIAGE_TYPE == input.CARRIAGE_TYPE) + .WhereIF(!string.IsNullOrEmpty(input.BOOKING_SLOT_TYPE), bas => bas.BOOKING_SLOT_TYPE == input.BOOKING_SLOT_TYPE) + .WhereIF(ctnCodeList != null, (bas, ctn) => ctnCodeList.Contains(ctn.CTNCODE)) + .GroupBy((bas, ctn) => new + { + bas.Id, + ctn.CTNCODE + }) + .Select((bas, ctn) => new + { + id = bas.Id, + ctnCode = ctn.CTNCODE, + numAll = SqlFunc.AggregateSum(ctn.CTNNUM) + }) + .MergeTable(); + + // 2. 【已引入舱位表】与【已使用的箱子表】做关联,并根据【舱位主键】、【箱型】做分组,统计出【已使用的箱量】,作为queryable2 + var queryable2 = _repBase.Context.Queryable((alc, ctn) => alc.Id == ctn.SLOT_ALLOC_ID) + .GroupBy((alc, ctn) => new + { + alc.BOOKING_SLOT_ID, + ctn.CTNCODE + }) + .Select((alc, ctn) => new + { + id = alc.BOOKING_SLOT_ID, + ctnCode = ctn.CTNCODE, + numUse = SqlFunc.AggregateSum(ctn.CTNNUM) + }) + .MergeTable(); + + // 3. 将queryable1 左连接 queryable2,使用【总的箱量】减去【已使用的箱量】,得到【剩余的箱量】,添加【剩余的箱量】> 0 的条件,作为queryable3 + var queryable3 = queryable1.LeftJoin(queryable2, (q1, q2) => q1.id == q2.id && q1.ctnCode == q2.ctnCode) + .Select((q1, q2) => new + { + q1.id, + q1.ctnCode, + numResidue = SqlFunc.IsNull(q1.numAll - q2.numUse, q1.numAll) + }) + .MergeTable() + .Where(r => r.numResidue > 0); + + // 4. 执行ToList(),得到可用的【舱位主键】、【箱型】、【箱量】列表 + var canUselist = await queryable3.ToListAsync(); + + // 查询舱位列表 + var baseIdList = canUselist.Select(c => c.id); + List baseList = await _repBase.AsQueryable() + .Where(u => baseIdList.Contains(u.Id)) + .ToListAsync(); + + List ctnCodeCache = await _cache.GetAllCodeCtn(); + + // 构建结果 + List result = baseList.Adapt>(); + foreach (var item in result) + { + var ctnList = canUselist.Where(c => c.id == item.Id).ToList(); + if (ctnList?.Any() == true) + { + item.CtnList = ctnList.Select(c => new BookingSlotCtnDto() + { + CTNCODE = c.ctnCode, + CTNNUM = c.numResidue, + CTNALL = ctnCodeCache.FirstOrDefault(e => e.Code == c.ctnCode)?.Name ?? throw new Exception($"舱位信息中存在未收录的箱型:{c.ctnCode},需要在箱型字典中补充"), + }).ToList(); + } + } + + return result; + } #endregion } } diff --git a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs index 96117f33..fc87d325 100644 --- a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs +++ b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs @@ -298,4 +298,15 @@ namespace Myshipping.Application.Service.BookingSlot.Dto /// public string UpdatedUserName { get; set; } } + + /// + /// 查询可用舱位信息Dto + /// + public class BookingSlotAvailableDto: BookingSlotBaseDto + { + /// + /// 舱位箱信息 + /// + public List CtnList { get; set; } + } } From 012fbc8849f89cd9b7962a94c8e8c8f54e2e35d9 Mon Sep 17 00:00:00 2001 From: hao <86whm@163.com> Date: Thu, 11 Jan 2024 11:09:07 +0800 Subject: [PATCH 2/3] merge --- Myshipping.Application/Entity/BookingLog.cs | 4 + .../Entity/BookingSlot/BookingSlotBase.cs | 81 ++++++-- .../Service/BookingSlot/BookingSlotService.cs | 134 ++++++++++++ .../BookingSlot/Dto/BookingSlotBaseDto.cs | 192 ++++++++++++++---- 4 files changed, 356 insertions(+), 55 deletions(-) diff --git a/Myshipping.Application/Entity/BookingLog.cs b/Myshipping.Application/Entity/BookingLog.cs index 3fc1b732..06189206 100644 --- a/Myshipping.Application/Entity/BookingLog.cs +++ b/Myshipping.Application/Entity/BookingLog.cs @@ -19,5 +19,9 @@ namespace Myshipping.Application.Entity /// 业务id /// public long? BookingId { get; set; } + /// + /// 模块 + /// + public string Module { get; set; } = "Order"; } } \ No newline at end of file diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs index 8ba645f7..04170dd9 100644 --- a/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs +++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs @@ -2,10 +2,11 @@ using System; using System.Collections.Generic; using SqlSugar; using Myshipping.Core.Entity; +using System.ComponentModel; /* * @author : whm - * @date : 2024-1-2 + * @date : 2024-1-11 * @desc : 舱位管理主信息 */ namespace Myshipping.Application @@ -20,271 +21,323 @@ namespace Myshipping.Application /// 舱位提单号 /// [SugarColumn(ColumnName = "SLOT_BOOKING_NO")] + [Description("舱位提单号")] public string SLOT_BOOKING_NO{ get; set; } /// /// 合约号 /// [SugarColumn(ColumnName = "CONTRACT_NO")] + [Description("合约号")] public string CONTRACT_NO{ get; set; } /// /// 订舱抬头 /// [SugarColumn(ColumnName = "BOOKING_PARTY")] + [Description("订舱抬头")] public string BOOKING_PARTY{ get; set; } /// /// 船名 /// [SugarColumn(ColumnName = "VESSEL")] + [Description("船名")] public string VESSEL{ get; set; } /// /// 航次号 /// [SugarColumn(ColumnName = "VOYNO")] + [Description("航次号")] public string VOYNO{ get; set; } /// /// 预计开船日期 /// [SugarColumn(ColumnName = "ETD")] + [Description("预计开船日期")] public DateTime? ETD{ get; set; } /// /// 预计到港日期 /// [SugarColumn(ColumnName = "ETA")] + [Description("预计到港日期")] public DateTime? ETA{ get; set; } /// /// 收货地代码 /// [SugarColumn(ColumnName = "PLACERECEIPTID")] + [Description("收货地代码")] public string PLACERECEIPTID{ get; set; } /// /// 收货地 /// [SugarColumn(ColumnName = "PLACERECEIPT")] + [Description("收货地")] public string PLACERECEIPT{ get; set; } /// /// 交货地代码 /// [SugarColumn(ColumnName = "PLACEDELIVERYID")] + [Description("交货地代码")] public string PLACEDELIVERYID{ get; set; } /// /// 交货地 /// [SugarColumn(ColumnName = "PLACEDELIVERY")] + [Description("交货地")] public string PLACEDELIVERY{ get; set; } - + /// /// 装货港代码 /// [SugarColumn(ColumnName = "PORTLOADID")] - public string PORTLOADID { get; set; } - + [Description("装货港代码")] + public string PORTLOADID{ get; set; } + /// /// 装货港 /// [SugarColumn(ColumnName = "PORTLOAD")] - public string PORTLOAD { get; set; } - + [Description("装货港")] + public string PORTLOAD{ get; set; } + /// /// 卸货港代码 /// [SugarColumn(ColumnName = "PORTDISCHARGEID")] - public string PORTDISCHARGEID { get; set; } - + [Description("卸货港代码")] + public string PORTDISCHARGEID{ get; set; } + /// /// 卸货港 /// [SugarColumn(ColumnName = "PORTDISCHARGE")] - public string PORTDISCHARGE { get; set; } - + [Description("卸货港")] + public string PORTDISCHARGE{ get; set; } + /// /// 中转港1 /// [SugarColumn(ColumnName = "TRANSFER_PORT_1")] + [Description("中转港1")] public string TRANSFER_PORT_1{ get; set; } /// /// 中转港2 /// [SugarColumn(ColumnName = "TRANSFER_PORT_2")] + [Description("中转港2")] public string TRANSFER_PORT_2{ get; set; } /// /// 船公司代号 /// [SugarColumn(ColumnName = "CARRIERID")] + [Description("船公司代号")] public string CARRIERID{ get; set; } /// /// 船公司 /// [SugarColumn(ColumnName = "CARRIER")] + [Description("船公司")] public string CARRIER{ get; set; } /// /// 航线代码(船公司) /// [SugarColumn(ColumnName = "LANECODE")] + [Description("航线代码(船公司)")] public string LANECODE{ get; set; } /// /// 航线名称(船公司) /// [SugarColumn(ColumnName = "LANENAME")] + [Description("航线名称(船公司)")] public string LANENAME{ get; set; } /// /// 承运方式 DIRECT_SHIP-直达;TRANSFER_SHIP-中转 /// [SugarColumn(ColumnName = "CARRIAGE_TYPE")] + [Description("承运方式 DIRECT_SHIP-直达;TRANSFER_SHIP-中转")] public string CARRIAGE_TYPE{ get; set; } /// /// 承运方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 /// [SugarColumn(ColumnName = "CARRIAGE_TYPE_NAME")] + [Description("承运方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱")] public string CARRIAGE_TYPE_NAME{ get; set; } /// /// 订舱方式 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 /// [SugarColumn(ColumnName = "BOOKING_SLOT_TYPE")] + [Description("订舱方式 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱")] public string BOOKING_SLOT_TYPE{ get; set; } /// /// 订舱方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 /// [SugarColumn(ColumnName = "BOOKING_SLOT_TYPE_NAME")] + [Description("订舱方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱")] public string BOOKING_SLOT_TYPE_NAME{ get; set; } /// /// 签单方式 ORIGINAL-正本;TELEX-电放;SEAWAY BILL-海运单; /// [SugarColumn(ColumnName = "ISSUETYPE")] + [Description("签单方式 ORIGINAL-正本;TELEX-电放;SEAWAY BILL-海运单;")] public string ISSUETYPE{ get; set; } /// /// 箱型箱量 /// [SugarColumn(ColumnName = "CTN_STAT")] + [Description("箱型箱量")] public string CTN_STAT{ get; set; } /// /// 所在周数 /// [SugarColumn(ColumnName = "WEEK_AT")] + [Description("所在周数")] public string WEEK_AT{ get; set; } /// /// 箱使天数 /// [SugarColumn(ColumnName = "DETENSION_FREE_DAYS")] + [Description("箱使天数")] public int DETENSION_FREE_DAYS{ get; set; } /// /// 样单截止日期 /// [SugarColumn(ColumnName = "SI_CUT_DATE")] + [Description("样单截止日期")] public DateTime? SI_CUT_DATE{ get; set; } /// - /// + /// 截港时间 /// [SugarColumn(ColumnName = "CY_CUT_DATE")] + [Description("截港时间")] public DateTime? CY_CUT_DATE{ get; set; } /// /// VGM截止日期 /// [SugarColumn(ColumnName = "VGM_SUBMISSION_CUT_DATE")] + [Description("VGM截止日期")] public DateTime? VGM_SUBMISSION_CUT_DATE{ get; set; } /// - /// + /// MDGF提交截止时间 /// [SugarColumn(ColumnName = "MDGF_CUT_DATE")] + [Description("MDGF提交截止时间")] public DateTime? MDGF_CUT_DATE{ get; set; } /// /// 舱单截止时间 /// [SugarColumn(ColumnName = "MANIFEST_CUT_DATE")] + [Description("舱单截止时间")] public DateTime? MANIFEST_CUT_DATE{ get; set; } /// /// 多状态标记,按预设的状态标记顺序二进制转数值,查询时用与或查询 /// [SugarColumn(ColumnName = "MORE_FLAG_STATUS")] + [Description("多状态标记,按预设的状态标记顺序二进制转数值,查询时用与或查询")] public int MORE_FLAG_STATUS{ get; set; } /// /// VGM回执 /// [SugarColumn(ColumnName = "VGM_RLT_STAT")] + [Description("VGM回执")] public string VGM_RLT_STAT{ get; set; } /// - /// + /// SI回执 /// [SugarColumn(ColumnName = "SI_RLT_STAT")] + [Description("SI回执")] public string SI_RLT_STAT{ get; set; } /// /// 提箱回执 /// [SugarColumn(ColumnName = "TAKE_CTN_RLT_STAT")] + [Description("提箱回执")] public string TAKE_CTN_RLT_STAT{ get; set; } /// /// 还箱回执 /// [SugarColumn(ColumnName = "RETURN_CTN_RLT_STAT")] + [Description("还箱回执")] public string RETURN_CTN_RLT_STAT{ get; set; } /// /// 预甩回执 /// [SugarColumn(ColumnName = "NOMINATION_RLT_STAT")] + [Description("预甩回执")] public string NOMINATION_RLT_STAT{ get; set; } /// /// 舱位变更回执 /// [SugarColumn(ColumnName = "AMENDMENT_RLT_STAT")] + [Description("舱位变更回执")] public string AMENDMENT_RLT_STAT{ get; set; } /// /// 舱位取消回执 /// [SugarColumn(ColumnName = "CANCELLATION_RLT_STAT")] + [Description("舱位取消回执")] public string CANCELLATION_RLT_STAT{ get; set; } /// /// 目的港卸船未提货回执 /// [SugarColumn(ColumnName = "DISCHARGE_FULL_RLT_STAT")] + [Description("目的港卸船未提货回执")] public string DISCHARGE_FULL_RLT_STAT{ get; set; } /// - /// + /// 目的港提箱未还空箱回执 /// [SugarColumn(ColumnName = "GATE_OUTFULL_RLT_STAT")] + [Description("目的港提箱未还空箱回执")] public string GATE_OUTFULL_RLT_STAT{ get; set; } /// /// 租户名称 /// [SugarColumn(ColumnName = "TenantName")] + [Description("租户名称")] public string TenantName{ get; set; } + /// + /// 舱位来源 EMAIL-邮件导入 MANUAL-手工 + /// + [SugarColumn(ColumnName = "SLOT_SOURCE")] + [Description("舱位来源 EMAIL-邮件导入 MANUAL-手工")] + public string SLOT_SOURCE{ get; set; } + } } \ No newline at end of file diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 678dd202..d9bfedd3 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -29,6 +29,7 @@ using Furion.EventBus; using Myshipping.Application.Event; using Microsoft.AspNetCore.Authorization; using Furion.DatabaseAccessor; +using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData; namespace Myshipping.Application @@ -42,6 +43,10 @@ namespace Myshipping.Application private readonly SqlSugarRepository _repBase; private readonly SqlSugarRepository _repCtn; private readonly SqlSugarRepository _repStock; + + private readonly SqlSugarRepository _repBookingLog; + private readonly SqlSugarRepository _repBookingLogDetail; + private readonly ILogger _logger; private readonly ISysCacheService _cache; @@ -50,6 +55,8 @@ namespace Myshipping.Application public BookingSlotService(SqlSugarRepository repBase, SqlSugarRepository repCtn, SqlSugarRepository repStock, + SqlSugarRepository repBookingLog, + SqlSugarRepository repBookingLogDetail, ILogger logger, ISysCacheService cache, IEventPublisher publisher) @@ -57,6 +64,10 @@ namespace Myshipping.Application _repBase = repBase; _repCtn = repCtn; _repStock = repStock; + _repBookingLog = repBookingLog; + _repBookingLogDetail = repBookingLogDetail; + + _logger = logger; _cache = cache; @@ -143,6 +154,8 @@ namespace Myshipping.Application newCtn.SLOT_ID = model.Id; await _repCtn.InsertAsync(newCtn); } + + await InsLog("Add", model.Id, "新增舱位"); } //更新库存 @@ -178,6 +191,8 @@ namespace Myshipping.Application } await _repCtn.UpdateAsync(ctns); + await InsLog("Del", entity.Id, "取消舱位"); + //更新库存 await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel { @@ -234,6 +249,8 @@ namespace Myshipping.Application newCtn.SLOT_ID = model.Id; await _repCtn.InsertAsync(newCtn); } + + await InsLog("Add", model.Id, "新增舱位"); } else if (dto.OpType == "update") { @@ -243,6 +260,7 @@ namespace Myshipping.Application throw Oops.Bah($"未找到订舱编号为 {dto.DataObj.SLOT_BOOKING_NO} 的数据"); } + var oldObj = model.Adapt(); dto.DataObj.Adapt(model); await _repBase.UpdateAsync(model); @@ -253,6 +271,8 @@ namespace Myshipping.Application newCtn.SLOT_ID = model.Id; await _repCtn.InsertAsync(newCtn); } + + await InsLog("update", model.Id, typeof(BookingSlotBaseApiSaveDto), oldObj, dto.DataObj, "CtnList"); } else if (dto.OpType == "del") { @@ -271,6 +291,8 @@ namespace Myshipping.Application ctn.IsDeleted = true; await _repCtn.UpdateAsync(ctn); } + + await InsLog("Del", model.Id, "取消舱位"); } //更新库存 @@ -290,6 +312,118 @@ namespace Myshipping.Application } #endregion + + /// + /// 插入日志(仅显示一条文本信息) + /// + /// + /// + /// + /// + [NonAction] + private async Task InsLog(string type, long slotId, string status) + { + var bid = await _repBookingLog.InsertReturnSnowflakeIdAsync(new BookingLog + { + Type = type, + BookingId = slotId, + TenantId = Convert.ToInt64(UserManager.TENANT_ID), + CreatedTime = DateTime.Now, + CreatedUserId = UserManager.UserId, + CreatedUserName = UserManager.Name, + Module = "Slot" + }); + + if (!string.IsNullOrEmpty(status)) + { + await _repBookingLogDetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail + { + PId = bid, + Field = "", + OldValue = "", + NewValue = status, + }); + } + } + + /// + /// 插入日志(比对修改内容) + /// + /// + /// + /// + /// + /// + /// + /// + [NonAction] + private async Task InsLog(string type, long id, Type objType, object objOld, object objNew, params string[] excepProp) + { + var bid = await _repBookingLog.InsertReturnSnowflakeIdAsync(new BookingLog + { + Type = type, + BookingId = id, + TenantId = Convert.ToInt64(UserManager.TENANT_ID), + CreatedTime = DateTime.Now, + CreatedUserId = UserManager.UserId, + CreatedUserName = UserManager.Name, + Module = "Slot" + }); + + foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(objType)) + { + if (excepProp.Contains(descriptor.Name)) + { + continue; + } + + var compResult = false; + var oldValue = descriptor.GetValue(objOld); + var newValue = descriptor.GetValue(objNew); + if (oldValue != null && newValue != null) + { + if (descriptor.PropertyType == typeof(string)) + { + compResult = oldValue.ToString() == newValue.ToString(); + } + else if (descriptor.PropertyType == typeof(DateTime) || descriptor.PropertyType == typeof(DateTime?)) + { + compResult = Convert.ToDateTime(oldValue) == Convert.ToDateTime(newValue); + } + else if (descriptor.PropertyType == typeof(decimal) || descriptor.PropertyType == typeof(float) || descriptor.PropertyType == typeof(double) + || descriptor.PropertyType == typeof(decimal?) || descriptor.PropertyType == typeof(float?) || descriptor.PropertyType == typeof(double?)) + { + compResult = Convert.ToDecimal(oldValue) == Convert.ToDecimal(newValue); + } + else if (descriptor.PropertyType == typeof(int) || descriptor.PropertyType == typeof(long) + || descriptor.PropertyType == typeof(int?) || descriptor.PropertyType == typeof(long?)) + { + compResult = Convert.ToInt64(oldValue) == Convert.ToInt64(newValue); + } + } + else + { + compResult = oldValue == newValue; + } + + if (!compResult) + { + var fieldName = descriptor.Name; + if (!string.IsNullOrWhiteSpace(descriptor.Description)) + { + fieldName = descriptor.Description; + } + + await _repBookingLogDetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail + { + PId = bid, + Field = fieldName, + OldValue = $"{oldValue}", + NewValue = $"{newValue}", + }); + } + } + } #endregion #region 库存 diff --git a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs index 1c321f92..b06955f4 100644 --- a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs +++ b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs @@ -2,6 +2,7 @@ using SqlSugar; using System; using System.Collections.Generic; +using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; @@ -108,154 +109,208 @@ namespace Myshipping.Application.Service.BookingSlot.Dto /// /// 舱位提单号 /// + [Description("舱位提单号")] public string SLOT_BOOKING_NO { get; set; } - /// - /// 船名 - /// - public string VESSEL { get; set; } - - /// - /// 航次号 - /// - public string VOYNO { get; set; } - /// /// 合约号 /// + [Description("合约号")] 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; } + [Description("订舱抬头")] + public string BOOKING_PARTY { get; set; } /// - /// 订舱方式 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 + /// 船名 /// - public string BOOKING_SLOT_TYPE { get; set; } + [Description("船名")] + public string VESSEL { get; set; } /// - /// 订舱方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 + /// 航次号 /// - public string BOOKING_SLOT_TYPE_NAME { get; set; } + [Description("航次号")] + public string VOYNO { get; set; } /// - /// 签单方式 ORIGINAL-正本;TELEX-电放;SEAWAY BILL-海运单; + /// 预计开船日期 /// - public string ISSUETYPE { get; set; } + [Description("预计开船日期")] + public DateTime? ETD { get; set; } /// - /// 订舱抬头 + /// 预计到港日期 /// - public string BOOKING_PARTY { get; set; } + [Description("预计到港日期")] + public DateTime? ETA { get; set; } /// - /// 船公司代号 + /// 收货地代码 /// - public string CARRIERID { get; set; } + [Description("收货地代码")] + public string PLACERECEIPTID { get; set; } /// - /// 船公司 + /// 收货地 /// - public string CARRIER { get; set; } + [Description("收货地")] + public string PLACERECEIPT { get; set; } /// - /// 预计开船日期 + /// 交货地代码 /// - public DateTime? ETD { get; set; } + [Description("交货地代码")] + public string PLACEDELIVERYID { get; set; } /// - /// 预计到港日期 + /// 交货地 /// - public DateTime? ETA { get; set; } + [Description("交货地")] + public string PLACEDELIVERY { get; set; } /// /// 装货港代码 /// + [Description("装货港代码")] public string PORTLOADID { get; set; } /// /// 装货港 /// + [Description("装货港")] public string PORTLOAD { get; set; } /// /// 卸货港代码 /// + [Description("卸货港代码")] public string PORTDISCHARGEID { get; set; } /// /// 卸货港 /// + [Description("卸货港")] public string PORTDISCHARGE { get; set; } /// /// 中转港1 /// + [Description("中转港1")] public string TRANSFER_PORT_1 { get; set; } /// /// 中转港2 /// + [Description("中转港2")] public string TRANSFER_PORT_2 { get; set; } + /// + /// 船公司代号 + /// + [Description("船公司代号")] + public string CARRIERID { get; set; } + + /// + /// 船公司 + /// + [Description("船公司")] + public string CARRIER { get; set; } /// /// 航线代码(船公司) /// + [Description("航线代码(船公司)")] public string LANECODE { get; set; } /// /// 航线名称(船公司) /// + [Description("航线名称(船公司)")] public string LANENAME { get; set; } /// - /// 所在周数 + /// 承运方式 DIRECT_SHIP-直达;TRANSFER_SHIP-中转 /// - public string WEEK_AT { get; set; } + [Description("承运方式 DIRECT_SHIP-直达;TRANSFER_SHIP-中转")] + public string CARRIAGE_TYPE { get; set; } /// - /// 箱使天数 + /// 承运方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 /// - public int DETENSION_FREE_DAYS { get; set; } + [Description("承运方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱")] + public string CARRIAGE_TYPE_NAME { get; set; } + + /// + /// 订舱方式 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 + /// + [Description("订舱方式 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱")] + public string BOOKING_SLOT_TYPE { get; set; } + + /// + /// 订舱方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱 + /// + [Description("订舱方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱")] + public string BOOKING_SLOT_TYPE_NAME { get; set; } + + /// + /// 签单方式 ORIGINAL-正本;TELEX-电放;SEAWAY BILL-海运单; + /// + [Description("签单方式 ORIGINAL-正本;TELEX-电放;SEAWAY BILL-海运单;")] + public string ISSUETYPE { get; set; } /// /// 箱型箱量 /// + [Description("箱型箱量")] public string CTN_STAT { get; set; } + /// + /// 所在周数 + /// + [Description("所在周数")] + public string WEEK_AT { get; set; } + + /// + /// 箱使天数 + /// + [Description("箱使天数")] + public int DETENSION_FREE_DAYS { get; set; } + /// /// 样单截止日期 /// + [Description("样单截止日期")] public DateTime? SI_CUT_DATE { get; set; } /// - /// 截港截止日期 + /// 截港时间 /// + [Description("截港时间")] public DateTime? CY_CUT_DATE { get; set; } /// /// VGM截止日期 /// + [Description("VGM截止日期")] public DateTime? VGM_SUBMISSION_CUT_DATE { get; set; } /// - /// MDGF截止 + /// MDGF提交截止时间 /// + [Description("MDGF提交截止时间")] public DateTime? MDGF_CUT_DATE { get; set; } /// - /// 舱单(入港)截止时间 + /// 舱单截止时间 /// + [Description("舱单截止时间")] public DateTime? MANIFEST_CUT_DATE { get; set; } + + } /// @@ -283,6 +338,61 @@ namespace Myshipping.Application.Service.BookingSlot.Dto public long Id { get; set; } + /// + /// VGM回执 + /// + [Description("VGM回执")] + public string VGM_RLT_STAT { get; set; } + + /// + /// SI回执 + /// + [Description("SI回执")] + public string SI_RLT_STAT { get; set; } + + /// + /// 提箱回执 + /// + [Description("提箱回执")] + public string TAKE_CTN_RLT_STAT { get; set; } + + /// + /// 还箱回执 + /// + [Description("还箱回执")] + public string RETURN_CTN_RLT_STAT { get; set; } + + /// + /// 预甩回执 + /// + [Description("预甩回执")] + public string NOMINATION_RLT_STAT { get; set; } + + /// + /// 舱位变更回执 + /// + [Description("舱位变更回执")] + public string AMENDMENT_RLT_STAT { get; set; } + + /// + /// 舱位取消回执 + /// + [Description("舱位取消回执")] + public string CANCELLATION_RLT_STAT { get; set; } + + /// + /// 目的港卸船未提货回执 + /// + [Description("目的港卸船未提货回执")] + public string DISCHARGE_FULL_RLT_STAT { get; set; } + + /// + /// 目的港提箱未还空箱回执 + /// + [Description("目的港提箱未还空箱回执")] + public string GATE_OUTFULL_RLT_STAT { get; set; } + + /// /// 创建时间 /// From 30cc0c39d25fd6a49972c5781a104aa874d2923d Mon Sep 17 00:00:00 2001 From: hao <86whm@163.com> Date: Thu, 11 Jan 2024 11:36:06 +0800 Subject: [PATCH 3/3] log --- .../Service/BookingSlot/BookingSlotService.cs | 29 ++++++++++++++++--- .../BookingSlot/Dto/BookingSlotBaseDto.cs | 18 ++++++++++-- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 363d40ed..141142b9 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -30,6 +30,7 @@ using Myshipping.Application.Event; using Microsoft.AspNetCore.Authorization; using Furion.DatabaseAccessor; using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData; +using Myshipping.Application.Service.BookingOrder.Dto; namespace Myshipping.Application @@ -113,7 +114,7 @@ namespace Myshipping.Application /// /// [HttpPost("/BookingSlot/save")] - public async Task Save(BookingSlotBaseSaveDto input) + public async Task Save(BookingSlotBaseSaveInput input) { BookingSlotBase model = null; if (input.Id > 0) //修改 @@ -125,6 +126,7 @@ namespace Myshipping.Application } model = _repBase.FirstOrDefault(x => x.Id == input.Id); + var oldObj = model.Adapt(); input.Adapt(model); @@ -137,6 +139,8 @@ namespace Myshipping.Application newCtn.SLOT_ID = model.Id; await _repCtn.InsertAsync(newCtn); } + + await InsLog("Update", model.Id, typeof(BookingSlotBaseSaveInput), oldObj, input, "CtnList"); } else { @@ -210,13 +214,30 @@ namespace Myshipping.Application /// /// [HttpGet("/BookingSlot/detail")] - public async Task Detail(long id) + public async Task Detail(long id) { var slotBase = await _repBase.FirstOrDefaultAsync(u => u.Id == id); var ctns = await _repCtn.Where(x => x.SLOT_ID == id).ToListAsync(); - var rtn = slotBase.Adapt(); + var rtn = slotBase.Adapt(); rtn.CtnList = ctns.Adapt>(); + + List list = new List(); + var main = await _repBookingLog.AsQueryable().Where(u => u.BookingId == slotBase.Id).ToListAsync(); + var mailidlist = main.Select(x => x.Id).ToList(); + list = main.Adapt>(); + if (list != null) + { + var bookinglogdetail = await _repBookingLogDetail.AsQueryable().Where(x => mailidlist.Contains(x.PId)).ToListAsync(); + foreach (var item in list) + { + var details = bookinglogdetail.Where(x => x.PId == item.Id).ToList(); + item.details = details; + } + } + + rtn.LogList = list; + return rtn; } @@ -272,7 +293,7 @@ namespace Myshipping.Application await _repCtn.InsertAsync(newCtn); } - await InsLog("update", model.Id, typeof(BookingSlotBaseApiSaveDto), oldObj, dto.DataObj, "CtnList"); + await InsLog("Update", model.Id, typeof(BookingSlotBaseApiSaveDto), oldObj, dto.DataObj, "CtnList"); } else if (dto.OpType == "del") { diff --git a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs index ea4eb3aa..02e7ca0e 100644 --- a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs +++ b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs @@ -1,4 +1,5 @@ -using Myshipping.Core; +using Myshipping.Application.Service.BookingOrder.Dto; +using Myshipping.Core; using SqlSugar; using System; using System.Collections.Generic; @@ -314,9 +315,9 @@ namespace Myshipping.Application.Service.BookingSlot.Dto } /// - /// 保存舱位dto + /// 保存舱位输入 /// - public class BookingSlotBaseSaveDto : BookingSlotBaseDto + public class BookingSlotBaseSaveInput : BookingSlotBaseDto { /// /// Id @@ -330,6 +331,17 @@ namespace Myshipping.Application.Service.BookingSlot.Dto public List CtnList { get; set; } } + /// + /// 保存舱位输出 + /// + public class BookingSlotBaseSaveOutput : BookingSlotBaseSaveInput + { + /// + /// 日志 + /// + public List LogList { get; set; } + } + public class BookingSlotBaseListOutput : BookingSlotBaseDto { ///