diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs index 85de4fdd..a28a89a8 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs @@ -854,7 +854,7 @@ namespace Myshipping.Application } /// - /// 查询船期数据EMC + /// 查询船期数据EMC(即将作废,用QueryShipInfo接口替代) /// /// [HttpGet("/BookingCustomerOrder/QueryShipInfoEMC")] @@ -967,6 +967,144 @@ namespace Myshipping.Application } } + /// + /// 查询船期数据 + /// + /// + [HttpGet("/BookingCustomerOrder/QueryShipInfo")] + public async Task QueryShipInfo(long custOrdId, string carr = "EMC") + { + var allSysConfig = await _cache.GetAllSysConfig(); + var sCfgSpiderUrl = allSysConfig.FirstOrDefault(x => x.Code == "BookingPostApiServerAddr" && x.GroupCode == "DJY_CONST"); + if (sCfgSpiderUrl == null) + { + throw Oops.Bah("订舱API的爬虫URL地址未配置,请联系管理员"); + } + + var sCfgUserKey = allSysConfig.FirstOrDefault(x => x.Code == "BookingPostApiKey" && x.GroupCode == "DJY_CONST"); + var sCfgUserSecret = allSysConfig.FirstOrDefault(x => x.Code == "BookingPostApiSecret" && x.GroupCode == "DJY_CONST"); + if (sCfgUserKey == null || sCfgUserSecret == null) + { + throw Oops.Bah("订舱API的KEY和密钥未配置,请联系管理员"); + } + + #region EMC + if (carr == "EMC") + { + var apiUrl = sCfgSpiderUrl.Value; + if (!apiUrl.EndsWith("/")) + { + apiUrl += "/"; + } + apiUrl += "v1/emc/ship/query"; + + var custOrder = await _rep.AsQueryable().FirstAsync(x => x.Id == custOrdId); + var ctns = await _repCtn.AsQueryable().Where(x => x.BILLID == custOrdId).ToListAsync(); + + var mappingCtn = await _cache.GetAllMappingCtn(); + var mappingPortLoad = await _cache.GetAllMappingPortLoad(); + var mappingPort = await _cache.GetAllMappingPort(); + + //收货地 + var mapPlaceReceipt = mappingPortLoad.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.PLACERECEIPTCODE); + if (mapPlaceReceipt == null) + { + throw Oops.Bah($"未找到收货地映射信息:{custOrder.PLACERECEIPTCODE}"); + } + + //起运港 + var mapPortLoad = mappingPortLoad.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.PORTLOADCODE); + if (mapPortLoad == null) + { + throw Oops.Bah($"未找到起运港映射信息:{custOrder.PORTLOADCODE}"); + } + + //卸货港 + var mapPort = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.PORTDISCHARGECODE); + if (mapPort == null) + { + throw Oops.Bah($"未找到卸货港映射信息:{custOrder.PORTDISCHARGECODE}"); + } + + //目的地 + var mapDestination = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.DESTINATIONCODE); + if (mapDestination == null) + { + throw Oops.Bah($"未找到目的地映射信息:{custOrder.DESTINATIONCODE}"); + } + + //箱型转换 + var disCtnCode = ctns.Select(x => x.CTNCODE).Distinct().ToList(); + var mapCtnCode = new List(); + foreach (var ctnall in disCtnCode) + { + var mapCtn = mappingCtn.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == ctnall); + if (mapCtn == null) + { + throw Oops.Bah($"未找到箱型映射信息:{ctnall}"); + } + + mapCtnCode.Add(mapCtn.MapName); + } + + var postModel = new + { + userKey = sCfgUserKey.Value, + userSecret = sCfgUserSecret.Value, + webAccount = custOrder.BookingAccount, + webPassword = custOrder.BookingPassword, + searchConditionDate = custOrder.ETD.Value.AddDays(-7).ToString("yyyy-MM-dd"), + originName = mapPlaceReceipt.MapName, + destinationName = mapDestination.MapName, + polPortName = mapPortLoad.MapName, + podPortName = mapPort.MapName, + serviceType = custOrder.ServiceType, + serviceMode = custOrder.ServiceMode, + bookingOffice = custOrder.BookingAddr, + isReefer = "N", + contractType = custOrder.ContractType, + contractNo = custOrder.CONTRACTNO, + containerTypeList = mapCtnCode + }; + + _logger.LogInformation($"发送查询API数据给爬虫({apiUrl}):{postModel.ToJsonString()}"); + var rtnQuery = await apiUrl.SetBody(postModel) + .PostAsStringAsync(); + + _logger.LogInformation($"爬虫返回:{rtnQuery}"); + var jobjRtnQuery = JObject.Parse(rtnQuery); + if (jobjRtnQuery.GetIntValue("code") != 200) + { + throw Oops.Bah($"查询船期数据出错:{jobjRtnQuery.GetStringValue("msg")}"); + } + else + { + var jarrVessel = jobjRtnQuery.GetJArrayValue("data"); + return jarrVessel; + } + } + #endregion + + #region COSCO + //else if (carr == "COSCO") + //{ + // var apiUrl = sCfgSpiderUrl.Value; + // if (!apiUrl.EndsWith("/")) + // { + // apiUrl += "/"; + // } + // apiUrl += "v1/cosco/ship/schedule"; + + + //} + #endregion + else + { + throw Oops.Bah("不支持的船公司"); + } + + } + /// /// 保存船期数据EMC /// diff --git a/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs b/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs index 59d14bee..b88de866 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs @@ -920,181 +920,6 @@ namespace Myshipping.Application.Service.BookingOrder } #endregion - #region 马士基API订舱台账 - /// - /// 马士基API订舱台账 - /// - /// 查询条件 - /// 返回台账列表 - [HttpPost("/BookingMSKSPOTAPI/GetPage")] - public async Task> GetPageAsync([FromBody] QueryBookingDeliveryRecordDto QuerySearch) - { - - //制单日期 - DateTime createBegin = DateTime.MinValue; - DateTime createEnd = DateTime.MinValue; - //更新日期 - DateTime updateBegin = DateTime.MinValue; - DateTime updateEnd = DateTime.MinValue; - //预计离港日期 - DateTime edepartureBegin = DateTime.MinValue; - DateTime edepartureEnd = DateTime.MinValue; - //ETD日期 - DateTime etdBegin = DateTime.MinValue; - DateTime etdEnd = DateTime.MinValue; - //ETA时间 - DateTime etaBegin = DateTime.MinValue; - DateTime etaEnd = DateTime.MinValue; - - //定时 - DateTime jobBegin = DateTime.MinValue; - DateTime jobEnd = DateTime.MinValue; - - #region 查询条件 - - //制单日期 - if (!string.IsNullOrWhiteSpace(QuerySearch.CreateBegin)) - { - if (!DateTime.TryParse(QuerySearch.CreateBegin, out createBegin)) - throw Oops.Oh($"创建起始日期格式错误,{QuerySearch.CreateBegin}"); - } - - if (!string.IsNullOrWhiteSpace(QuerySearch.CreateEnd)) - { - if (!DateTime.TryParse(QuerySearch.CreateEnd, out createEnd)) - throw Oops.Oh($"创建结束日期格式错误,{QuerySearch.CreateEnd}"); - - createEnd = createEnd.AddDays(1); - } - //更新日期 - if (!string.IsNullOrWhiteSpace(QuerySearch.UpdateBegin)) - { - if (!DateTime.TryParse(QuerySearch.UpdateBegin, out updateBegin)) - throw Oops.Oh($"更新起始日期开始格式错误,{QuerySearch.UpdateBegin}"); - } - - if (!string.IsNullOrWhiteSpace(QuerySearch.UpdateEnd)) - { - if (!DateTime.TryParse(QuerySearch.UpdateEnd, out updateEnd)) - throw Oops.Oh($"更新结束日期格式错误,{QuerySearch.UpdateEnd}"); - - updateEnd = updateEnd.AddDays(1); - } - //预计离港日期 - if (!string.IsNullOrWhiteSpace(QuerySearch.EDepartureBegin)) - { - if (!DateTime.TryParse(QuerySearch.EDepartureBegin, out edepartureBegin)) - throw Oops.Oh($"预计离港日期起始格式错误,{QuerySearch.EDepartureBegin}"); - } - - if (!string.IsNullOrWhiteSpace(QuerySearch.EDepartureEnd)) - { - if (!DateTime.TryParse(QuerySearch.EDepartureEnd, out edepartureEnd)) - throw Oops.Oh($"预计离港日期结束格式错误,{QuerySearch.EDepartureEnd}"); - - edepartureEnd = edepartureEnd.AddDays(1); - } - - //ETD - if (!string.IsNullOrWhiteSpace(QuerySearch.ETDBegin)) - { - if (!DateTime.TryParse(QuerySearch.ETDBegin, out etdBegin)) - throw Oops.Oh($"ETD起始日期格式错误,{QuerySearch.ETDBegin}"); - } - - if (!string.IsNullOrWhiteSpace(QuerySearch.ETDEnd)) - { - if (!DateTime.TryParse(QuerySearch.ETDEnd, out etdEnd)) - throw Oops.Oh($"ETD结束日期格式错误,{QuerySearch.ETDEnd}"); - - etdEnd = etdEnd.AddDays(1); - } - //ETA - if (!string.IsNullOrWhiteSpace(QuerySearch.ETDBegin)) - { - if (!DateTime.TryParse(QuerySearch.ETDBegin, out etaBegin)) - throw Oops.Oh($"ETA起始日期格式错误,{QuerySearch.ETDBegin}"); - } - - if (!string.IsNullOrWhiteSpace(QuerySearch.ETAEnd)) - { - if (!DateTime.TryParse(QuerySearch.ETAEnd, out etaEnd)) - throw Oops.Oh($"ETA结束日期格式错误,{QuerySearch.ETAEnd}"); - - etaEnd = etaEnd.AddDays(1); - } - - //定时 - if (!string.IsNullOrWhiteSpace(QuerySearch.JOBBegin)) - { - if (!DateTime.TryParse(QuerySearch.JOBBegin, out jobBegin)) - throw Oops.Oh($"返场起始日期格式错误,{QuerySearch.JOBBegin}"); - } - - if (!string.IsNullOrWhiteSpace(QuerySearch.JOBEnd)) - { - if (!DateTime.TryParse(QuerySearch.JOBEnd, out jobEnd)) - throw Oops.Oh($"返场结束日期格式错误,{QuerySearch.JOBEnd}"); - - jobEnd = jobEnd.AddDays(1); - } - #endregion - - string entityOrderCol = "CreatedTime"; - - //这里因为返回给前端的台账数据是DTO,所以这里排序时候需要转换成Entity对应的字段 - if (!string.IsNullOrWhiteSpace(QuerySearch.SortField)) - entityOrderCol = MapsterExtHelper.GetAdaptProperty(QuerySearch.SortField); - - //菜单375504048771141=我的任务台账 - List userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuMSKApi); - - bool isAdmin = false; - - if (userlist == null) - { - isAdmin = true; - userlist = new List(); - } - else if (userlist != null && userlist.Count > 0) - { - userlist.Add(UserManager.UserId); - userlist = userlist.Distinct().ToList(); - } - - _logger.LogInformation("任务台账权限范围 {list}", userlist); - - var entities = await _bookingDeliveryRecordRep.AsQueryable() - .Where(t => isAdmin || 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) - .WhereIF(updateEnd != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value < updateEnd) - .WhereIF(edepartureBegin != DateTime.MinValue, t => t.EARLIEST_DEPARTURE_DATE.HasValue && t.EARLIEST_DEPARTURE_DATE.Value >= edepartureBegin) - .WhereIF(edepartureEnd != DateTime.MinValue, t => t.EARLIEST_DEPARTURE_DATE.HasValue && t.EARLIEST_DEPARTURE_DATE.Value < edepartureEnd) - .WhereIF(etdBegin != DateTime.MinValue, t => t.ETD.HasValue && t.ETD.Value >= etdBegin) - .WhereIF(etdEnd != DateTime.MinValue, t => t.ETD.HasValue && t.ETA.Value < etdEnd) - .WhereIF(etaBegin != DateTime.MinValue, t => t.ETA.HasValue && t.ETA.Value >= etaBegin) - .WhereIF(etaEnd != DateTime.MinValue, t => t.ETA.HasValue && t.ETA.Value < etaEnd) - .WhereIF(jobBegin != DateTime.MinValue, t => t.JOB_TIME.HasValue && t.JOB_TIME.Value >= jobBegin) - .WhereIF(jobEnd != DateTime.MinValue, t => t.JOB_TIME.HasValue && t.JOB_TIME.Value < jobEnd) - .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PriceReference), t => t.PRICE_REFERENCE.Contains(QuerySearch.PriceReference)) - .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.BookedByCompanyName), t => t.BOOKEDBY_COMPANY_NAME.Contains(QuerySearch.BookedByCompanyName)) - .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.BookedByCompanyPartyCode), t => t.BOOKEDBY_COMPANY_PARTYCODE.Contains(QuerySearch.BookedByCompanyPartyCode)) - .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PriceOwnerCompanyName), t => t.PRICE_OWNER_COMPANY_NAME.Contains(QuerySearch.PriceOwnerCompanyName)) - .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PriceOwnerCompanyPartyCode), t => t.PRICE_OWNER_COMPANY_PARTYCODE.Contains(QuerySearch.PriceOwnerCompanyPartyCode)) - .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PlaceReceiptCity), t => t.PLACERECEIPT_CITY.Contains(QuerySearch.PlaceReceiptCity) || t.PLACERECEIPT_UNLOC_CODE.Contains(QuerySearch.PlaceReceiptCity)) - .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PlaceDeliveryCity), t => t.PLACEDELIVERY_CITY.Contains(QuerySearch.PlaceDeliveryCity) || t.PLACEDELIVERY_UNLOC_CODE.Contains(QuerySearch.PlaceDeliveryCity)) - .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.BookingReference), t => t.BOOKING_REFERENCE.Contains(QuerySearch.BookingReference)) - .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.BookingCreator), t => t.CreatedUserName.Contains(QuerySearch.BookingCreator) || t.UpdatedUserName.Contains(QuerySearch.BookingCreator)) - .OrderBy(entityOrderCol + (QuerySearch.descSort ? " desc " : " asc ")) - .ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize); - - - return entities.Adapt>(); - } - #endregion - #region 获取马士基API订舱详情 /// /// 获取马士基API订舱详情 diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index abbefd89..f7a3d4b7 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -10349,11 +10349,7 @@ namespace Myshipping.Application } } - //2024-06-20 这里如果遇到拆票情况需要重新组织提单号 - if (item.SPLIT_OR_MERGE_FLAG.HasValue && (item.SPLIT_OR_MERGE_FLAG.Value == 1 || item.SPLIT_OR_MERGE_FLAG.Value == 2)) - { - dto.MBLNO = $"{item.MBLNO}-{item.HBLNO}"; - } + 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) @@ -10361,6 +10357,45 @@ namespace Myshipping.Application var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync(); it.ctnDetailInputs = ctnDetailInputs.Adapt>(); } + + //2024-06-20 这里如果遇到拆票情况需要重新组织提单号 + if (item.SPLIT_OR_MERGE_FLAG.HasValue && (item.SPLIT_OR_MERGE_FLAG.Value == 1 || item.SPLIT_OR_MERGE_FLAG.Value == 2)) + { + dto.MBLNO = $"{item.MBLNO}-{item.HBLNO}"; + + //如果当前是合票时,需要所有子票的箱型箱量合并到主票同步到东胜,子票的箱型箱量不同步东胜 + if (item.SPLIT_OR_MERGE_FLAG.Value == 2) + { + //如果当前是主票 + 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(); + + 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) + && x.IsDeleted == false).ToListAsync(); + + dto.ctnInputs = currCtn.Adapt>(); + foreach (var it in dto.ctnInputs) + { + var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync(); + it.ctnDetailInputs = ctnDetailInputs.Adapt>(); + } + + dto.CNTRTOTAL = string.Join(",", dto.ctnInputs.GroupBy(x => x.CTNALL).Select(x => $"{x.Key}*{x.Sum(b => b.CTNNUM)}").ToArray()); + } + } + else + { + dto.ctnInputs = new List(); + dto.CNTRTOTAL = string.Empty; + } + } + } + //EDI var BookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id && x.IsDeleted == false).FirstAsync(); if (BookingEDIExt != null) @@ -10405,7 +10440,7 @@ namespace Myshipping.Application } //提箱返场 - var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id && (x.Status == "提箱" || x.Status == "返场") && x.IsDeleted == false).ToList(); + var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id && x.IsDeleted == false).ToList(); var statuslogId = statusloglist.Select(x => x.Id).ToList(); //运踪状态详情 var statuslogdetaillist = _statuslogdetail.AsQueryable().Where(x => statuslogId.Contains(x.PId)).ToList(); @@ -11703,7 +11738,7 @@ namespace Myshipping.Application if (!string.IsNullOrWhiteSpace(order.HSCODE)) { //如果录的HS CODE符合海领要求,直接用HS CODE - if (Regex.IsMatch(order.HSCODE, "[0-9]{2}\\.[0-9]{2}\\.[0-9]{2}\\.[0-9]{2}") && order.HSCODE.Length == 12) + if (Regex.IsMatch(order.HSCODE, "[0-9]{4}\\.[0-9]{2}\\.[0-9]{2}\\.[0-9]{2}") && order.HSCODE.Length == 13) { voltaModel.HSCode = order.HSCODE; } @@ -11733,7 +11768,7 @@ namespace Myshipping.Application { s4 = voltaModel.HSCode.Substring(8, 2); } - + //0000.00.00.00 voltaModel.HSCode = $"{s1}.{(s2.Length == 2 ? s2 : "00")}.{(s3.Length == 2 ? s3 : "00")}.{(s4.Length == 2 ? s4 : "00")}"; } else diff --git a/Myshipping.Application/Service/BookingOrder/IBookingMSKSPOTAPIService.cs b/Myshipping.Application/Service/BookingOrder/IBookingMSKSPOTAPIService.cs index 104bce24..1c00f7f1 100644 --- a/Myshipping.Application/Service/BookingOrder/IBookingMSKSPOTAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/IBookingMSKSPOTAPIService.cs @@ -42,14 +42,6 @@ namespace Myshipping.Application.Service.BookingOrder /// 返回检索结果 Task> SearchCommodities(QueryCommoditiesDto model); - - /// - /// 马士基API订舱台账 - /// - /// 查询条件 - /// 返回台账列表 - Task> GetPageAsync(QueryBookingDeliveryRecordDto QuerySearch); - /// /// 获取马士基API订舱详情 /// diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index c95b40e3..7b3130b0 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -3784,7 +3784,7 @@ namespace Myshipping.Application cautionNoticeTaskWholeShipDto.VoynoNewVal = bcTargetDto.VoyNo; cautionNoticeTaskWholeShipDto.IsVesselChange = true; - isNeedWholeShip = true; + //isNeedWholeShip = true; } else { @@ -3860,6 +3860,26 @@ namespace Myshipping.Application _logger.LogInformation($"触发整船提醒完成,结果={JSON.Serialize(wholeShipRlt)}"); } + else + { + if (cautionNoticeTaskWholeShipDto.IsVesselChange) + { + if (bookingSlotAllocList.Count > 0) + { + bookingSlotAllocList.ForEach(async ca => + { + var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false + && x.TenantId == UserManager.TENANT_ID); + + CreateTask(CautionNoticeTaskEnum.ChangeVesselVoyno, bcSrcDto, userList, bookingInfo, slotInfo, srcVesselVoyno, targetVesselVoyno, $"提单号:{bcSrcDto.MBLNo} \r\n船名航次变更了 \r\n原:{srcVesselVoyno} \r\n新:{targetVesselVoyno}", true); + }); + } + else if (slotInfo != null) + { + CreateTask(CautionNoticeTaskEnum.ChangeVesselVoyno, bcSrcDto, userList, null, slotInfo, srcVesselVoyno, targetVesselVoyno, $"提单号:{bcSrcDto.MBLNo} \r\n船名航次变更了 \r\n原:{srcVesselVoyno} \r\n新:{targetVesselVoyno}", true); + } + } + } } } diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index e1bf97dc..0d1cc8f4 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -2300,7 +2300,8 @@ namespace Myshipping.Application Code = t.Code, Value = t.Value }).ToListAsync(); - bool flag = false; + + var sendDsList = new List(); foreach (var item in all) { // 当BusinessId不为空时,将BusinessId的值转为订舱主键;否则仍然使用BookingId作为订舱记录主键 @@ -2377,7 +2378,7 @@ namespace Myshipping.Application if (item.Status == "提箱" || item.Status == "返场") { - flag = true; + sendDsList.Add(item.BookingId); } #endregion @@ -2409,7 +2410,7 @@ namespace Myshipping.Application bookingStatus.StaCate = "book_sta_cate_billtrace"; await _repBookingStatus.InsertAsync(bookingStatus); await _bookingorderservice.SetGoodsStatus("BG", item.BookingId); - flag = true; + sendDsList.Add(item.BookingId); } } if (item.Status == "装载") @@ -2424,7 +2425,7 @@ namespace Myshipping.Application bookingStatus.StaCate = "book_sta_cate_billtrace"; await _repBookingStatus.InsertAsync(bookingStatus); await _bookingorderservice.SetGoodsStatus("ZZFX", item.BookingId); - flag = true; + sendDsList.Add(item.BookingId); } } if (item.Status == "码放") @@ -2439,7 +2440,7 @@ namespace Myshipping.Application bookingStatus.StaCate = "book_sta_cate_billtrace"; await _repBookingStatus.InsertAsync(bookingStatus); await _bookingorderservice.SetGoodsStatus("MTFX", item.BookingId); - flag = true; + sendDsList.Add(item.BookingId); } } if (item.Status == "装船") @@ -2510,7 +2511,7 @@ namespace Myshipping.Application bookingStatus.StaCate = "book_sta_cate_billtrace"; await _repBookingStatus.InsertAsync(bookingStatus); await _bookingorderservice.SetGoodsStatus("YRG", item.BookingId); - flag = true; + sendDsList.Add(item.BookingId); } @@ -2547,7 +2548,7 @@ namespace Myshipping.Application x.UpdatedUserId, x.UpdatedUserName }).ExecuteCommandAsync(); - flag = true; + sendDsList.Add(item.BookingId); await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); } @@ -2591,7 +2592,7 @@ namespace Myshipping.Application x.UpdatedUserId, x.UpdatedUserName }).ExecuteCommandAsync(); - flag = true; + sendDsList.Add(item.BookingId); await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); } } @@ -2611,7 +2612,7 @@ namespace Myshipping.Application x.UpdatedUserId, x.UpdatedUserName }).ExecuteCommandAsync(); - flag = true; + sendDsList.Add(item.BookingId); await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); } } @@ -2631,7 +2632,7 @@ namespace Myshipping.Application x.UpdatedUserId, x.UpdatedUserName }).ExecuteCommandAsync(); - flag = true; + sendDsList.Add(item.BookingId); await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); } } @@ -2651,7 +2652,7 @@ namespace Myshipping.Application x.UpdatedUserId, x.UpdatedUserName }).ExecuteCommandAsync(); - flag = true; + sendDsList.Add(item.BookingId); await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); } @@ -2688,7 +2689,7 @@ namespace Myshipping.Application x.UpdatedUserId, x.UpdatedUserName }).ExecuteCommandAsync(); - flag = true; + sendDsList.Add(item.BookingId); await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); } @@ -2715,9 +2716,9 @@ namespace Myshipping.Application } - if (flag) + if (sendDsList.Count > 0) { - await _bookingorderservice.SendBookingOrder(new long[] { all[0].BookingId }); + await _bookingorderservice.SendBookingOrder(sendDsList.ToArray()); }