From 64fcd41ce01a758ea6d72cc5fe54869ebfa7a1c7 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 1 Aug 2023 16:05:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=BC=95=E5=85=A5?= =?UTF-8?q?=E7=AE=B1=E5=B0=81=E5=8F=B7bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 2 +- .../EventSubscriber/LogEventSubscriber.cs | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 97d7c6c0..d6d97daf 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -7606,7 +7606,7 @@ namespace Myshipping.Application ctn.BILLID = order.Id; ctn.CTNCODE = item.CtnCode; ctn.CTNALL = item.CTNALL; - ctn.CTNNUM = item.XiangLiang; + ctn.CTNNUM = 1; ctn.CNTRNO = item.CNTRNO; ctn.SEALNO = item.SEALNO; ctn.KINDPKGS = string.IsNullOrEmpty(item.KINDPKGS) ? order.KINDPKGS : item.KINDPKGS; diff --git a/Myshipping.Core/EventSubscriber/LogEventSubscriber.cs b/Myshipping.Core/EventSubscriber/LogEventSubscriber.cs index eb3ca149..530dc747 100644 --- a/Myshipping.Core/EventSubscriber/LogEventSubscriber.cs +++ b/Myshipping.Core/EventSubscriber/LogEventSubscriber.cs @@ -48,10 +48,19 @@ public class LogEventSubscriber : IEventSubscriber using var scope = Services.CreateScope(); var _repository = scope.ServiceProvider.GetRequiredService>(); var log = (SysUser)context.Source.Payload; - await _repository.UpdateAsync(a => a.Id == log.Id, a => new SysUser - { - LastLoginTime = log.LastLoginTime, - LastLoginIp = log.LastLoginIp - }); - } + await _repository.UpdateAsync(a => a.Id == log.Id, a => new SysUser + { + LastLoginTime = log.LastLoginTime, + LastLoginIp = log.LastLoginIp + }); + } + + [EventSubscribe("Delete:OpLog")] + public async Task DeleteOpLog(EventHandlerExecutingContext context) + { + using var scope = Services.CreateScope(); + var _repository = scope.ServiceProvider.GetRequiredService>(); + var dayRemain = (int)context.Source.Payload; + await _repository.DeleteAsync(x => x.OpTime < DateTime.Now.AddDays(dayRemain * -1)); + } } From 02c422c4897742c505a578802e42ed36d641c8dc Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 1 Aug 2023 16:45:55 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=BC=95=E5=85=A5?= =?UTF-8?q?=E5=9C=BA=E7=AB=99=E6=95=B0=E6=8D=AE=E6=97=B6=EF=BC=8C=E5=8C=85?= =?UTF-8?q?=E8=A3=85=E5=8F=96=E5=80=BC=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index d6d97daf..f1b1c412 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -129,7 +129,7 @@ namespace Myshipping.Application private readonly IBookingGoodsStatusConfigService _GoodsConfig; private readonly SqlSugarRepository _repLineOpMgrConfig; private readonly SqlSugarRepository _repSysEmp; - + const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING"; const string CONST_MAPPING_MODULE_ROUTE = "BOOK_OR_CLOSING_RT"; @@ -851,7 +851,8 @@ namespace Myshipping.Application entity.YgtETD = vess.YgtETD; } - else { + else + { entity.StartETA = null; entity.ATD = null; entity.YgtETD = null; @@ -7600,6 +7601,14 @@ namespace Myshipping.Application _logger.LogInformation($"{bookId}({order.MBLNO})的箱封号自动引入获取场站数据:{rtn.ToJsonString()}"); + //场站数据的包装经常为空,因此取场站数据时,如果包装为空,从主信息或填写过的箱信息的包装中获取 + var ctnKindPkg = ctns.FirstOrDefault(x => !string.IsNullOrEmpty(x.KINDPKGS)); + var kindPkg = order.KINDPKGS; + if (string.IsNullOrEmpty(kindPkg) && ctnKindPkg != null) + { + kindPkg = ctnKindPkg.KINDPKGS; + } + foreach (var item in rtn) { var ctn = new BookingCtn(); @@ -7609,7 +7618,7 @@ namespace Myshipping.Application ctn.CTNNUM = 1; ctn.CNTRNO = item.CNTRNO; ctn.SEALNO = item.SEALNO; - ctn.KINDPKGS = string.IsNullOrEmpty(item.KINDPKGS) ? order.KINDPKGS : item.KINDPKGS; + ctn.KINDPKGS = string.IsNullOrEmpty(item.KINDPKGS) ? kindPkg : item.KINDPKGS; ctn.PKGS = item.PKGS; ctn.KGS = Convert.ToDecimal(item.KGS); ctn.CBM = Convert.ToDecimal(item.CBM); @@ -8606,6 +8615,6 @@ namespace Myshipping.Application await SendBookingOrder(orderlist.ToArray()); } - + } } From e8be64b6677a9a44ae3f02d87eed7cd8891e002f Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Wed, 2 Aug 2023 11:35:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=88=B9=E6=9C=9FV.=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 3 +- .../BookingOrderSF/BookingOrderSFService.cs | 67 ++++++++++++++++--- .../Service/DataSync/DataSyncService.cs | 12 ++-- 3 files changed, 66 insertions(+), 16 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index a83face1..80b7c440 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -850,7 +850,8 @@ namespace Myshipping.Application entity.YgtETD = vess.YgtETD; } - else { + else + { entity.StartETA = null; entity.ATD = null; entity.YgtETD = null; diff --git a/Myshipping.Application/Service/BookingOrderSF/BookingOrderSFService.cs b/Myshipping.Application/Service/BookingOrderSF/BookingOrderSFService.cs index 02116bbb..7b16d423 100644 --- a/Myshipping.Application/Service/BookingOrderSF/BookingOrderSFService.cs +++ b/Myshipping.Application/Service/BookingOrderSF/BookingOrderSFService.cs @@ -115,7 +115,6 @@ namespace Myshipping.Application [HttpGet("/BookingOrderSF/Page")] public async Task Page([FromQuery] BookingOrderSFInput input) { - var entities = await _rep.AsQueryable().Filter(null, true) .Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false) .WhereIF(!string.IsNullOrWhiteSpace(input.KDNO), u => u.KDNO.Contains(input.KDNO)) @@ -134,9 +133,10 @@ namespace Myshipping.Application .ToPagedListAsync(input.PageNo, input.PageSize); var list = entities.Adapt>(); - foreach (var item in list.Items) { + foreach (var item in list.Items) + { item.Business = await _business.AsQueryable().Filter(null, true).Where(x => x.PId == item.Id).ToListAsync(); - item.detail= await _detail.AsQueryable().Filter(null, true).Where(x => x.PId == item.Id).ToListAsync(); + item.detail = await _detail.AsQueryable().Filter(null, true).Where(x => x.PId == item.Id).ToListAsync(); } return list; } @@ -147,19 +147,66 @@ namespace Myshipping.Application [HttpGet("/BookingOrderSF/Save")] public async Task Save(BookingOrderSFDto input) { + if (!string.IsNullOrEmpty(input.KDNO)) + { + throw Oops.Bah("快递单号不能为空!"); + } + if (!string.IsNullOrEmpty(input.SJPeople)) + { + throw Oops.Bah("收件人不能为空!"); + } + if (!string.IsNullOrEmpty(input.SJTel)) + { + throw Oops.Bah("收件人电话不能为空!"); + } + if (!string.IsNullOrEmpty(input.SJAddress)) + { + throw Oops.Bah("收件人地址不能为空!"); + } + if (!string.IsNullOrEmpty(input.FJPeople)) + { + throw Oops.Bah("发件人不能为空!"); + } + if (!string.IsNullOrEmpty(input.FJTel)) + { + throw Oops.Bah("发件人电话不能为空!"); + } + if (!string.IsNullOrEmpty(input.FJAddress)) + { + throw Oops.Bah("发件人地址不能为空!"); + } + + if (input.Id == 0) { + var entity = input.Adapt(); + await _rep.InsertAsync(entity); + if (input.Business != null && input.Business.Count > 0) + { + foreach (var item in input.Business) + { + var buentity = item.Adapt(); + buentity.PId = entity.Id; + await _business.InsertAsync(buentity); + } + } + if (input.detail != null && input.detail.Count > 0) + { + foreach (var item in input.detail) + { + var dentity = item.Adapt(); + dentity.PId = entity.Id; + await _detail.InsertAsync(dentity); + } + } + } + else + { + - } - else { - - - - - } return null; } diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index b145c7b4..2a130410 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -422,6 +422,7 @@ namespace Myshipping.Application { throw Oops.Bah("BSNO未录入"); } + //根据东胜bsno获取当前数据查询不到则为新增 var m = mlist.Where(x => x.BSNO == item.BSNO).FirstOrDefault(); var entity = item.Adapt(); entity.Vessel = item.Vessel.ToUpper().Trim(); @@ -454,13 +455,14 @@ namespace Myshipping.Application if (m == null) { var e = mlist.Where(x => x.CARRIERID == entity.CARRIERID && x.Vessel == entity.Vessel && x.Voyno == entity.Voyno && x.VoynoInside == entity.VoynoInside).FirstOrDefault(); + //2023年7月27日,王书岚:航次为V.开头的不查询船期 + if (!string.IsNullOrEmpty(entity.VoynoInside) && entity.VoynoInside.StartsWith("V.")) + { + entity.Sign = true; + } if (e == null) { - //2023年7月27日,王书岚:航次为V.开头的不查询船期 - if (!string.IsNullOrEmpty(entity.VoynoInside) && entity.VoynoInside.StartsWith("V.")) - { - entity.Sign = true; - } + await _vesselinfo.InsertAsync(entity); } From 34ffe0326ab82a379d9b87514881a9cc624a7412 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Wed, 2 Aug 2023 11:45:05 +0800 Subject: [PATCH 4/4] V. --- .../Service/DataSync/DataSyncService.cs | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 2a130410..bf707322 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -432,20 +432,16 @@ namespace Myshipping.Application if (string.IsNullOrEmpty(entity.CARRIERID)) { - entity.CARRIERID = mapcarrier.Where(x => x.MapName == item.CARRIER).Select(x => x.Code).FirstOrDefault(); } - if (string.IsNullOrEmpty(entity.CARRIERID)) { - throw Oops.Bah($"未找到{item.CARRIER}对应code,请联系管理员!"); } } if (!string.IsNullOrEmpty(item.CreatedUserName)) { - entity.CreatedUserId = CreatedUserId; } if (string.IsNullOrEmpty(item.Voyno)) @@ -454,6 +450,7 @@ namespace Myshipping.Application } if (m == null) { + //查询是否存在相同船名航次数据 var e = mlist.Where(x => x.CARRIERID == entity.CARRIERID && x.Vessel == entity.Vessel && x.Voyno == entity.Voyno && x.VoynoInside == entity.VoynoInside).FirstOrDefault(); //2023年7月27日,王书岚:航次为V.开头的不查询船期 if (!string.IsNullOrEmpty(entity.VoynoInside) && entity.VoynoInside.StartsWith("V.")) @@ -462,24 +459,25 @@ namespace Myshipping.Application } if (e == null) { - - await _vesselinfo.InsertAsync(entity); } else { - entity.Id = e.Id; if (e.ETA != null) { entity.ETA = e.ETA; } await _vesselinfo.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); - } } else { + //2023年7月27日,王书岚:航次为V.开头的不查询船期 + if (!string.IsNullOrEmpty(entity.VoynoInside) && entity.VoynoInside.StartsWith("V.")) + { + entity.Sign = true; + } entity.Id = m.Id; if (m.ETA != null) { @@ -1666,8 +1664,8 @@ namespace Myshipping.Application // model.UpdatedTime = DateTime.Now; // await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync(); //} - await _vesselinfo.UpdateAsync(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false&& - x.Vessel == item.Vessel && x.Voyno == item.Voyno , x => new DjyVesselInfo { ETA = item.ETA, YgtETD= item.ETD , ATD = item.ATD , UpdatedTime = DateTime.Now }); + await _vesselinfo.UpdateAsync(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false && + x.Vessel == item.Vessel && x.Voyno == item.Voyno, x => new DjyVesselInfo { ETA = item.ETA, YgtETD = item.ETD, ATD = item.ATD, UpdatedTime = DateTime.Now }); var order = orderlist.Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno).ToList(); bool issend = false; if (order != null) @@ -2105,7 +2103,7 @@ namespace Myshipping.Application bookingStatusLog.MBLNO = item.MBLNO; await _repStatuslog.InsertAsync(bookingStatusLog); - + if (item.detail != null && item.detail.Count > 0) { foreach (var dt in item.detail) @@ -2117,7 +2115,7 @@ namespace Myshipping.Application BookingStatusLogDetail.OPTime = dt.OPTime; await _statuslogdetail.InsertAsync(BookingStatusLogDetail); } - + } @@ -2360,9 +2358,9 @@ namespace Myshipping.Application } } } - #endregion + #endregion + - } if (flag) {