diff --git a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs index beb099d0..964ea006 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs @@ -18,6 +18,7 @@ using Microsoft.Extensions.Logging; using Myshipping.Application.Helper; using System.Text.RegularExpressions; using System.Globalization; +using Myshipping.Core.Const; namespace Myshipping.Application.Service.BookingOrder { @@ -32,6 +33,7 @@ namespace Myshipping.Application.Service.BookingOrder private readonly ISysCacheService _cache; private readonly IDjyWebsiteAccountConfigService _webAccountConfig; private readonly ILogger _logger; + private readonly ISysDataUserMenu _sysDataUserMenuService; const string CONST_MSK_API_COMMODITY_URL = "MSKApiCommodity"; const string CONST_MSK_API_BOOKING_URL = "MSKApiBooking"; @@ -40,6 +42,7 @@ namespace Myshipping.Application.Service.BookingOrder public BookingMSKAPIService(ILogger logger, ISysCacheService cache, IDjyWebsiteAccountConfigService webAccountConfig, SqlSugarRepository bookingDeliveryRecordRep, + ISysDataUserMenu sysDataUserMenuService, SqlSugarRepository bookingDeliveryRecordCtnRep) { _logger = logger; @@ -47,7 +50,7 @@ namespace Myshipping.Application.Service.BookingOrder _webAccountConfig = webAccountConfig; _bookingDeliveryRecordRep = bookingDeliveryRecordRep; _bookingDeliveryRecordCtnRep = bookingDeliveryRecordCtnRep; - + _sysDataUserMenuService = sysDataUserMenuService; } #region 检索海运船期详情 @@ -327,14 +330,14 @@ namespace Myshipping.Application.Service.BookingOrder { placeOfReceipt = new MSKAPIBookingRouteDetailsBase { - UNLocationCode = model.isSendNoSchedule ? model.userPlaceOfReceiptUnLocCode - : model.placeOfReceiptUnLocCode, + UNLocationCode = model.userPlaceOfReceiptUnLocCode + //: model.placeOfReceiptUnLocCode, //cityName = model.placeOfReceiptCityName, }, placeOfDelivery = new MSKAPIBookingRouteDetailsBase { - UNLocationCode = model.isSendNoSchedule ? model.userPlaceOfDeliveryUnLocCode - : model.placeOfDeliveryUnLocCode, + UNLocationCode = model.userPlaceOfDeliveryUnLocCode + //: model.placeOfDeliveryUnLocCode, //cityName = model.placeOfDeliveryCityName, }, selectedRoute = new MSKAPIBookingRoute @@ -356,14 +359,14 @@ namespace Myshipping.Application.Service.BookingOrder startLocation = new MSKAPIBookingRouteDetailsBase { //cityName = model.placeOfReceiptCityName, - UNLocationCode = model.isSendNoSchedule ? model.userPlaceOfReceiptUnLocCode - : model.placeOfReceiptUnLocCode + UNLocationCode = model.userPlaceOfReceiptUnLocCode + //: model.placeOfReceiptUnLocCode }, endLocation = new MSKAPIBookingRouteDetailsBase { //cityName = model.placeOfDeliveryCityName, - UNLocationCode = model.isSendNoSchedule ? model.userPlaceOfDeliveryUnLocCode - : model.placeOfDeliveryUnLocCode + UNLocationCode = model.userPlaceOfDeliveryUnLocCode + //: model.placeOfDeliveryUnLocCode }, transportModeCode = model.transportMode } @@ -635,8 +638,14 @@ namespace Myshipping.Application.Service.BookingOrder if(!model.earliestDepartureDate.HasValue) throw Oops.Bah($"预计离港日期必填"); - if (!model.isSendNoSchedule && string.IsNullOrWhiteSpace(model.carrierProductId)) - throw Oops.Bah($"船期信息不能为空,请查询船期信息"); + if(string.IsNullOrWhiteSpace(model.userPlaceOfReceiptUnLocCode)) + throw Oops.Bah($"始发地必填"); + + if (string.IsNullOrWhiteSpace(model.userPlaceOfDeliveryUnLocCode)) + throw Oops.Bah($"目的地必填"); + + //if (!model.isSendNoSchedule && string.IsNullOrWhiteSpace(model.carrierProductId)) + // throw Oops.Bah($"船期信息不能为空,请查询船期信息"); if (model.isReefer) { @@ -977,8 +986,21 @@ namespace Myshipping.Application.Service.BookingOrder //这里因为返回给前端的台账数据是DTO,所以这里排序时候需要转换成Entity对应的字段 if (!string.IsNullOrWhiteSpace(QuerySearch.SortField)) entityOrderCol = MapsterExtHelper.GetAdaptProperty(QuerySearch.SortField); + + //菜单375504048771141=我的任务台账 + List userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuMSKApi); + + if (userlist == null) + userlist = new List { UserManager.UserId }; + + if (userlist.Count > 0) + userlist = userlist.Distinct().ToList(); + + _logger.LogInformation("任务台账权限范围 {list}", userlist); + var entities = await _bookingDeliveryRecordRep.AsQueryable() + .Where(t => userlist.Contains(t.CreatedUserId.Value)) .WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value >= createBegin) .WhereIF(createEnd != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value < createEnd) .WhereIF(updateBegin != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value >= updateBegin) @@ -1153,6 +1175,7 @@ namespace Myshipping.Application.Service.BookingOrder x.TenantId, x.STUFFING_MEASUREMENT_TYPE, x.STUFFING_MEASUREMENT_UNIT, + x.CTN_SUFFER_WEIGHT }).ExecuteCommand(); } else @@ -1161,7 +1184,8 @@ namespace Myshipping.Application.Service.BookingOrder { CTN_CODE = ctn.ctnCode, CTN_NAME = ctn.ctnName, - CTN_NUM = ctn.ctnNum.Value + CTN_NUM = ctn.ctnNum.Value, + CTN_SUFFER_WEIGHT = (int)ctn.ctnSufferWeight.Value, }; ctnEntity.RECORD_ID = entity.Id; @@ -1218,7 +1242,8 @@ namespace Myshipping.Application.Service.BookingOrder var ctnEntity = new BookingDeliveryRecordCtn { CTN_CODE = ctn.ctnCode, CTN_NAME = ctn.ctnName, - CTN_NUM = ctn.ctnNum.Value + CTN_NUM = ctn.ctnNum.Value, + CTN_SUFFER_WEIGHT = (int)ctn.ctnSufferWeight.Value, }; ctnEntity.RECORD_ID = entity.Id; diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingDeliveryRecordPageDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingDeliveryRecordPageDto.cs index a47f389e..74417e0f 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingDeliveryRecordPageDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingDeliveryRecordPageDto.cs @@ -433,7 +433,7 @@ namespace Myshipping.Application /// /// 最后BC接收时间 /// - public bool LstRecvBCDate { get; set; } + public Nullable LstRecvBCDate { get; set; } /// /// 是否已有BookingCancellation @@ -443,7 +443,7 @@ namespace Myshipping.Application /// /// 最后BookingCancellation接收时间 /// - public bool LstRecvBKCancelDate { get; set; } + public Nullable LstRecvBKCancelDate { get; set; } /// /// 预计航行天数 diff --git a/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs b/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs index 16aab6f2..ff0644cd 100644 --- a/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs +++ b/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs @@ -377,17 +377,29 @@ namespace Myshipping.Application // 舱单主单 var mainSeaOrder = waitCheckSeaList.FirstOrDefault(x => string.IsNullOrWhiteSpace(x.HBLNO)); + + // 是否检验舱单主单 + var isCheckMainSea = true; + if (mainSeaOrder == null) + { + isCheckMainSea = false; + mainSeaOrder = await _seaeedi.AsQueryable().Filter(null, true).Where(x => x.BookingId == bkOrderId && string.IsNullOrWhiteSpace(x.HBLNO)).FirstAsync(); + } // 舱单分单 var subSeaOrderList = waitCheckSeaList.Where(x => !string.IsNullOrWhiteSpace(x.HBLNO)).ToList(); // 校验1:船名航次,唛头,货描 ,起运港,卸货港,主单提单号 - if (bkOrder.MBLNO != mainSeaOrder.MBLNO) checkResult.Add("舱单主单与订舱【提单号】不一致"); - if (bkOrder.VESSEL != mainSeaOrder.VESSEL) checkResult.Add("舱单主单与订舱【船名】不一致"); - if (bkOrder.VOYNO != mainSeaOrder.VOYNO) checkResult.Add("舱单主单与订舱【航次】不一致"); - if (bkOrder.MARKS != mainSeaOrder.MARKS) checkResult.Add("舱单主单与订舱【唛头】不一致"); - if (bkOrder.DESCRIPTION != mainSeaOrder.DESCRIPTION) checkResult.Add("舱单主单与订舱【货描】不一致"); - if (bkOrder.PORTLOADID != mainSeaOrder.PORTLOADID || bkOrder.PORTLOAD != mainSeaOrder.PORTLOAD) checkResult.Add("舱单主单与订舱【起运港】不一致"); - if (bkOrder.PORTDISCHARGEID != mainSeaOrder.PORTDISCHARGEID || bkOrder.PORTDISCHARGE != mainSeaOrder.PORTDISCHARGE) checkResult.Add("舱单主单与订舱【卸货港】不一致"); + if (isCheckMainSea) + { + if (bkOrder.MBLNO != mainSeaOrder.MBLNO) checkResult.Add("舱单主单与订舱【提单号】不一致"); + if (bkOrder.VESSEL != mainSeaOrder.VESSEL) checkResult.Add("舱单主单与订舱【船名】不一致"); + if (bkOrder.VOYNO != mainSeaOrder.VOYNO) checkResult.Add("舱单主单与订舱【航次】不一致"); + if (bkOrder.MARKS != mainSeaOrder.MARKS) checkResult.Add("舱单主单与订舱【唛头】不一致"); + if (bkOrder.DESCRIPTION != mainSeaOrder.DESCRIPTION) checkResult.Add("舱单主单与订舱【货描】不一致"); + if (bkOrder.PORTLOADID != mainSeaOrder.PORTLOADID || bkOrder.PORTLOAD != mainSeaOrder.PORTLOAD) checkResult.Add("舱单主单与订舱【起运港】不一致"); + if (bkOrder.PORTDISCHARGEID != mainSeaOrder.PORTDISCHARGEID || bkOrder.PORTDISCHARGE != mainSeaOrder.PORTDISCHARGE) checkResult.Add("舱单主单与订舱【卸货港】不一致"); + } + subSeaOrderList.ForEach(x => { if (bkOrder.VESSEL != x.VESSEL) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【船名】不一致"); @@ -403,35 +415,38 @@ namespace Myshipping.Application var 主单箱子列表 = waitCheckSeaCtnList.Where(x => x.PId == mainSeaOrder.Id).ToList(); var 分单箱子列表 = waitCheckSeaCtnList.Where(x => x.PId != mainSeaOrder.Id).ToList(); - foreach (var item in 主单箱子列表.GroupBy(x => x.CNTRNO)) + if (isCheckMainSea) { - if (item.Sum(x => x.PKGS) != 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS)) - { - checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【件数】与订舱中同箱号箱子的【件数】不一致"); - } - if (item.Sum(x => x.KGS) != 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS)) + foreach (var item in 主单箱子列表.GroupBy(x => x.CNTRNO)) { - checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【重量】与订舱中同箱号箱子的【重量】不一致"); - } - if (item.Sum(x => x.CBM) != 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM)) - { - checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【尺码】与订舱中同箱号箱子的【尺码】不一致"); + if (item.Sum(x => x.PKGS) != 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS)) + { + checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【件数】与订舱中同箱号箱子的【件数】不一致"); + } + if (item.Sum(x => x.KGS) != 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS)) + { + checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【重量】与订舱中同箱号箱子的【重量】不一致"); + } + if (item.Sum(x => x.CBM) != 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM)) + { + checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【尺码】与订舱中同箱号箱子的【尺码】不一致"); + } } } foreach (var item in 分单箱子列表.GroupBy(x => x.CNTRNO)) { - if (item.Sum(x => x.PKGS) > 主单箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS)) + if (item.Sum(x => x.PKGS) > 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS)) { - checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总件数】大于主单中同箱号箱子的件数"); + checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总件数】大于订舱中同箱号箱子的件数"); } - if (item.Sum(x => x.KGS) > 主单箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS)) + if (item.Sum(x => x.KGS) > 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS)) { - checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总重量】大于主单中同箱号箱子的重量"); + checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总重量】大于订舱中同箱号箱子的重量"); } - if (item.Sum(x => x.CBM) > 主单箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM)) + if (item.Sum(x => x.CBM) > 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM)) { - checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总尺码】大于主单中同箱号箱子的尺码"); + checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总尺码】大于订舱中同箱号箱子的尺码"); } } @@ -440,25 +455,28 @@ namespace Myshipping.Application var 主单箱封号箱型列表 = 主单箱子列表.Select(x => $"箱号[{x.CNTRNO}] 封号[{x.SEALNO}] 箱型[{x.CTNALL.Replace("'", "")}]").ToList(); var 分单箱封号箱型列表 = 分单箱子列表.Select(x => $"箱号[{x.CNTRNO}] 封号[{x.SEALNO}] 箱型[{x.CTNALL.Replace("'", "")}]").Distinct().ToList(); - var list1 = 订舱箱封号箱型列表.Except(主单箱封号箱型列表); - if (list1.Any()) - { - checkResult.Add($"订舱中的下列箱信息在舱单主单中不存在:{string.Join(",", list1)}"); - } - else + if (isCheckMainSea) { - var list2 = 主单箱封号箱型列表.Except(订舱箱封号箱型列表); - if (list2.Any()) + var list1 = 订舱箱封号箱型列表.Except(主单箱封号箱型列表); + if (list1.Any()) { - checkResult.Add($"舱单主单中的下列箱信息在订舱中不存在:{string.Join(",", list2)}"); + checkResult.Add($"订舱中的下列箱信息在舱单主单中不存在:{string.Join(",", list1)}"); } - - var list3 = 分单箱封号箱型列表.Except(主单箱封号箱型列表); - if (list3.Any()) + else { - checkResult.Add($"舱单分单中存在未知的箱信息:{string.Join(",", list3)}"); + var list2 = 主单箱封号箱型列表.Except(订舱箱封号箱型列表); + if (list2.Any()) + { + checkResult.Add($"舱单主单中的下列箱信息在订舱中不存在:{string.Join(",", list2)}"); + } } } + var list3 = 分单箱封号箱型列表.Except(订舱箱封号箱型列表); + if (list3.Any()) + { + checkResult.Add($"舱单分单中存在未知的箱信息:{string.Join(",", list3)}"); + } + if (checkResult.Count > 0) { diff --git a/Myshipping.Core/Const/MenuConst.cs b/Myshipping.Core/Const/MenuConst.cs index 145a136c..5d3b5735 100644 --- a/Myshipping.Core/Const/MenuConst.cs +++ b/Myshipping.Core/Const/MenuConst.cs @@ -16,5 +16,10 @@ namespace Myshipping.Core.Const /// 我的任务台账 /// public const long MenuTaskManage = 375504048771141; + + /// + /// 马士基API订舱 + /// + public const long MenuMSKApi = 526643045195845; } } diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index c7412b4f..e7eb3e4d 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -842,6 +842,11 @@ 我的任务台账 + + + 马士基API订舱 + + 租户参数Code常量