diff --git a/Myshipping.Application/Event/BookingSyncSubscriber.cs b/Myshipping.Application/Event/BookingSyncSubscriber.cs index 309f3347..adc989b9 100644 --- a/Myshipping.Application/Event/BookingSyncSubscriber.cs +++ b/Myshipping.Application/Event/BookingSyncSubscriber.cs @@ -518,11 +518,14 @@ namespace Myshipping.Application.Event _logger.LogInformation($"根据客户订舱反馈数据 {custOrder.BSNO} 生成了相同的数据 {custOrder.Id}"); //插入订舱台账 - var ordId = await servCustOrder.CustomerToOrder(custOrder); - custOrder.BookingId = ordId; + var ord = await servCustOrder.CustomerToOrder(custOrder); + custOrder.BookingId = ord.Id; await repoCutomerOrder.AsUpdateable(custOrder).UpdateColumns(x => new { x.BookingId }).ExecuteCommandAsync(); - _logger.LogInformation($"生成了订舱台账数据 {ordId}"); + ord.BSNO = item.GetStringValue("OrderId"); + await repoOrder.AsUpdateable(ord).UpdateColumns(x => new { x.BSNO }).ExecuteCommandAsync(); + + _logger.LogInformation($"生成了订舱台账数据 {ord.Id}"); } } diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs index 310ba26b..282ed4a9 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs @@ -1180,7 +1180,8 @@ namespace Myshipping.Application //进入客户订舱系统的订舱台账 if (recModel.Accept) { - bookingId = await CustomerToOrder(model); + var ord = await CustomerToOrder(model); + bookingId = ord.Id; model.BookingId = bookingId; //客户订舱数据与订舱台账数据关联 await _rep.UpdateAsync(model); @@ -1360,6 +1361,7 @@ namespace Myshipping.Application { "BC" => BookingOrderSyncTypeEnum.BC, "CC" => BookingOrderSyncTypeEnum.CC, + "REJECT" => BookingOrderSyncTypeEnum.REJECT, //"FILE" => BookingOrderSyncTypeEnum.FILE, _ => null, }; @@ -1673,10 +1675,13 @@ namespace Myshipping.Application _logger.LogInformation($"根据客户订舱 {recModel.Id} 生成了相同的数据 {model.Id}"); //插入订舱台账 - var ordId = await CustomerToOrder(model); - respDtO.OrderId = ordId; + var ord = await CustomerToOrder(model); + model.BookingId = ord.Id; + await _rep.AsUpdateable(model).UpdateColumns(x => new { x.BookingId }).ExecuteCommandAsync(); - _logger.LogInformation($"生成了订舱台账数据 {ordId}"); + respDtO.OrderId = ord.Id; + + _logger.LogInformation($"生成了订舱台账数据 {ord.Id}"); } @@ -1693,7 +1698,7 @@ namespace Myshipping.Application /// /// [NonAction] - public async Task CustomerToOrder(BookingCustomerOrder custOrd) + public async Task CustomerToOrder(BookingCustomerOrder custOrd) { var bkOrder = custOrd.Adapt(); bkOrder.Id = YitIdHelper.NextId(); @@ -1738,7 +1743,7 @@ namespace Myshipping.Application await _repFile.InsertAsync(file); } - return bkOrder.Id; + return bkOrder; } /// diff --git a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs index 116db433..0acd53b1 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs @@ -534,6 +534,7 @@ namespace Myshipping.Application /// /// 通知人联系人姓 /// + public string NotifypartLastName { get; set; } /// /// 通知人电话国家代码 diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 231b28f3..fdf6fbd2 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -10350,7 +10350,7 @@ namespace Myshipping.Application } } - + var ctn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == item.Id && x.IsDeleted == false).ToListAsync(); dto.ctnInputs = ctn.Adapt>(); foreach (var it in dto.ctnInputs) @@ -10368,7 +10368,7 @@ namespace Myshipping.Application if (item.SPLIT_OR_MERGE_FLAG.Value == 2) { //如果当前是主票 - if(dto.CUSTNO.Equals(dto.HBLNO,StringComparison.OrdinalIgnoreCase)) + if (dto.CUSTNO.Equals(dto.HBLNO, StringComparison.OrdinalIgnoreCase)) { var allOrderList = await _rep.AsQueryable().Filter(null, true).Where(x => dto.HBLNO == x.HBLNO && (x.SPLIT_OR_MERGE_FLAG != null && x.SPLIT_OR_MERGE_FLAG == 2) && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); @@ -10376,7 +10376,7 @@ namespace Myshipping.Application if (allOrderList.Count > 0) { var allOrderIds = allOrderList.Select(x => x.Id).ToList(); - var currCtn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID != null && allOrderIds.Contains(x.BILLID.Value) + var currCtn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID != null && allOrderIds.Contains(x.BILLID.Value) && x.IsDeleted == false).ToListAsync(); dto.ctnInputs = currCtn.Adapt>(); @@ -12892,6 +12892,39 @@ namespace Myshipping.Application /// 接收BC信息更新订舱 /// [AllowAnonymous] + [HttpPost("/BookingOrder/ReceiveBookingReject")] + [ApiUser(ApiCode = "ReceiveBookingReject")] + public async Task ReceiveBookingReject(ReceiveBookingRejectInputDto input) + { + // 客户订舱:运营端发送订舱数据给客户端 + if (App.Configuration["RunType"] == CommonConst.RUN_TYPE_DJY) + { + return new ReceiveBcInfoResultDto(false, "非运营端,接收失败"); + } + if (string.IsNullOrWhiteSpace(input.CUSTNO)) + { + return new ReceiveBcInfoResultDto(false, "CUSTNO不能为空"); + } + var list = await _rep.AsQueryable().Filter(null, true).Where(x => x.CUSTNO == input.CUSTNO) + .ToListAsync(); + + if (list.Count == 0) + { + string msg = $"通过CUSTNO查询订舱用于推送拒绝请求时,未查询到数据,CUSTNO:【{input.CUSTNO}】,结束"; + _logger.LogInformation(msg); + return new ReceiveBcInfoResultDto(false, msg); + } + _logger.LogInformation($"通过CUSTNO查询订舱用于推送拒绝请求时,查询到{list.Count}条数据,CUSTNO:【{input.CUSTNO}】,开始推送客户端"); + foreach (var item in list) + { + CustomerBookingSyncHelper.SendCustomerBookingSync(item.Id, BookingOrderSyncTypeEnum.REJECT.ToString()); + } + return new ReceiveBcInfoResultDto(true, $"接收成功,共匹配到{list.Count}条订舱记录"); + } + /// + /// 接收BC信息更新订舱 + /// + [AllowAnonymous] [HttpPost("/BookingOrder/ReceiveBcInfo")] [ApiUser(ApiCode = "ReceiveBcInfo")] public async Task ReceiveBcInfo(ReceiveBcInfoDto input) diff --git a/Myshipping.Application/Service/BookingOrder/Dto/ReceiveBookingRejectInputDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/ReceiveBookingRejectInputDto.cs new file mode 100644 index 00000000..0bb00638 --- /dev/null +++ b/Myshipping.Application/Service/BookingOrder/Dto/ReceiveBookingRejectInputDto.cs @@ -0,0 +1,7 @@ +namespace Myshipping.Application.Service.BookingOrder.Dto +{ + public class ReceiveBookingRejectInputDto + { + public string CUSTNO { get; set; } + } +} diff --git a/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs b/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs index 4ba54da2..052da67d 100644 --- a/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs +++ b/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs @@ -6,13 +6,17 @@ public enum BookingOrderSyncTypeEnum { /// - /// 只同步BC+文件相关字段 + /// 只用于同步BC及文件相关字段 /// BC = 1, /// - /// 只同步CC号 + /// 只用于同步CC号 /// CC = 2, + /// + /// 只用于推送订舱拒绝消息 + /// + REJECT = 3, ///// ///// 只同步文件相关字段 /////