From 63f8ffcc97c6feb20ebbeb0e3fb9cb27981e6b1d Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Fri, 15 Mar 2024 10:34:23 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A9=AC=E5=A3=AB?= =?UTF-8?q?=E5=9F=BAAPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/Dto/BookingEDIMapper.cs | 4 ++-- .../Service/TaskManagePlat/TaskManageService.cs | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs index 50efb201..b44218cb 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs @@ -136,8 +136,8 @@ namespace Myshipping.Application .Map(dest => dest.PRICE_REFERENCE_NAME, src => src.priceReferenceName) .Map(dest => dest.PRICE_OWNER_REFERENCE_ID, src => src.priceOwnerReferenceId) .Map(dest => dest.PRICE_OWNER_REFERENCE, src => src.priceOwnerReference) - .Map(dest => dest.PRICE_OWNER_REFERENCE_NAME, src => src.priceOwnerReferenceName); - + .Map(dest => dest.PRICE_OWNER_REFERENCE_NAME, src => src.priceOwnerReferenceName) + .Map(dest => dest.IS_REEFER, src => src.isReefer); config.ForType() .Map(dest => dest.CTN_CODE, src => src.ctnCode) diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 9fb72454..4bc5d27c 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -741,6 +741,21 @@ namespace Myshipping.Application await _taskBCCTNInfoRepository.InsertAsync(bcCtnInfo); }); + + /* + BC_MODIFY + 1、检索对应舱位,比对差异 + 2、更新舱位信息。 + 3、检索舱位对应的订舱信息,如果有则生成通知邮件 + CANCELLATION + 1、更新舱位状态。 + 2、取消舱位与订舱的关系。 + */ + + if (info.Main.TaskType == TaskBaseTypeEnum.BC_MODIFY) + { + + } } #endregion From 96bfec130bd756f0e154449985a9360af30dfd1f Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Fri, 15 Mar 2024 11:20:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A9=AC=E5=A3=AB?= =?UTF-8?q?=E5=9F=BAAPI=E8=AE=A2=E8=88=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingMSKAPIService.cs | 9 ++-- .../BookingOrder/Dto/BookingEDIMapper.cs | 48 +++++++++++++++++++ .../Service/BookingOrder/Dto/MSKBookingDto.cs | 15 ++++++ .../BookingOrder/IBookingMSKAPIService.cs | 2 +- 4 files changed, 69 insertions(+), 5 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs index 5fd74e57..0fcbe0e7 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs @@ -960,9 +960,9 @@ namespace Myshipping.Application.Service.BookingOrder /// 马士基API订舱ID /// 返回详情 [HttpGet("/BookingMSKAPI/GetInfo")] - public async Task GetInfo(long id) + public async Task GetInfo(long id) { - BookingDeliveryRecordDto model = null; + MSKBookingDto model = null; var entity = await _bookingDeliveryRecordRep.AsQueryable() .FirstAsync(a => a.Id == id); @@ -970,14 +970,15 @@ namespace Myshipping.Application.Service.BookingOrder if(entity == null) throw Oops.Oh($"获取马士基API订舱详情失败,不存在或已作废"); - model = entity.Adapt(); + model = entity.Adapt(); var ctnList = _bookingDeliveryRecordCtnRep.AsQueryable() .Where(a => a.RECORD_ID == id && a.IsDeleted == false).ToList(); if (ctnList.Count > 0) { - model.ctns = ctnList.Select(a => new BookingDeliveryRecordCtnDto { + model.ctns = ctnList.Select(a => new MSKBookingCtnInfo + { id = a.Id, ctnCode = a.CTN_CODE, carrierCtnCode = a.CARRIER_CTN_CODE, diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs index b44218cb..f45d7ab1 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs @@ -139,6 +139,54 @@ namespace Myshipping.Application .Map(dest => dest.PRICE_OWNER_REFERENCE_NAME, src => src.priceOwnerReferenceName) .Map(dest => dest.IS_REEFER, src => src.isReefer); + config.ForType() + .Map(dest => dest.id, src => src.Id) + .Map(dest => dest.carrierId, src => src.CARRIERID) + .Map(dest => dest.priceReference, src => src.PRICE_REFERENCE) + .Map(dest => dest.productCode, src => src.PRODUCT_CODE) + .Map(dest => dest.sender, src => src.SENDER) + .Map(dest => dest.bookedByCompanyName, src => src.BOOKEDBY_COMPANY_NAME) + .Map(dest => dest.bookedByMaerskPartyCode, src => src.BOOKEDBY_COMPANY_PARTYCODE) + .Map(dest => dest.bookedByCompanyContactName, src => src.BOOKEDBY_COMPANY_CONTACT) + .Map(dest => dest.bookedByCompanyContactEmail, src => src.BOOKEDBY_COMPANY_CONTACT_EMAIL) + .Map(dest => dest.isBookingPartOwnPrice, src => src.IS_BOOKING_PART_OWN_PRICE) + .Map(dest => dest.priceOwnerCompanyName, src => src.PRICE_OWNER_COMPANY_NAME) + .Map(dest => dest.priceOwnerMaerskPartyCode, src => src.PRICE_OWNER_COMPANY_PARTYCODE) + .Map(dest => dest.priceOwnerContactName, src => src.PRICE_OWNER_COMPANY_CONTACT) + .Map(dest => dest.priceOwnerContactEmail, src => src.PRICE_OWNER_COMPANY_CONTACT_EMAIL) + .Map(dest => dest.carrierCode, src => src.CARRIER_CODE) + .Map(dest => dest.earliestDepartureDate, src => src.EARLIEST_DEPARTURE_DATE) + .Map(dest => dest.exportServiceMode, src => src.EXPORT_SERVICE_MODE) + .Map(dest => dest.importServiceMode, src => src.IMPORT_SERVICE_MODE) + .Map(dest => dest.placeOfReceiptCityName, src => src.PLACERECEIPT_CITY) + .Map(dest => dest.placeOfReceiptUnLocCode, src => src.PLACERECEIPT_UNLOC_CODE) + .Map(dest => dest.placeOfDeliveryCityName, src => src.PLACEDELIVERY_CITY) + .Map(dest => dest.placeOfDeliveryUnLocCode, src => src.PLACEDELIVERY_UNLOC_CODE) + .Map(dest => dest.originDepartureDateTimeLocal, src => src.ETD) + .Map(dest => dest.destinationArrivalDateTimeLocal, src => src.ETA) + .Map(dest => dest.vesselName, src => src.VESSEL) + .Map(dest => dest.carrierVesselCode, src => src.VESSEL_CODE) + .Map(dest => dest.exportVoyageNumber, src => src.VOYNO) + .Map(dest => dest.transportMode, src => src.TRANSPORT_MODE) + .Map(dest => dest.totalCargoWeight, src => src.TOTAL_CARGO_WEIGHT) + .Map(dest => dest.noOfProbes, src => src.NO_OF_PROBES) + .Map(dest => dest.temperature, src => src.TEMPSET) + .Map(dest => dest.ventilation, src => src.VENT) + .Map(dest => dest.humidity, src => src.HUMIDITY) + .Map(dest => dest.commodityCodeType, src => src.COMMODITY_CODE_TYPE) + .Map(dest => dest.commodityCode, src => src.GOODSCODE) + .Map(dest => dest.commodityName, src => src.GOODSNAME) + .Map(dest => dest.isReefer, src => src.IS_REEFER) + .Map(dest => dest.cargoType, src => src.CARGO_TYPE) + .Map(dest => dest.placeOfReceiptCountryCode, src => src.PLACERECEIPT_COUNTRY_CODE) + .Map(dest => dest.placeOfDeliveryCountryCode, src => src.PLACEDELIVERY_COUNTRY_CODE) + .Map(dest => dest.EstSailingDays, src => src.EST_SAILING_DAYS) + .Map(dest => dest.priceReferenceId, src => src.PRICE_REFERENCE_ID) + .Map(dest => dest.priceReferenceName, src => src.PRICE_REFERENCE_NAME) + .Map(dest => dest.priceOwnerReferenceId, src => src.PRICE_OWNER_REFERENCE_ID) + .Map(dest => dest.priceOwnerReference, src => src.PRICE_OWNER_REFERENCE) + .Map(dest => dest.priceOwnerReferenceName, src => src.PRICE_OWNER_REFERENCE_NAME); + config.ForType() .Map(dest => dest.CTN_CODE, src => src.ctnCode) .Map(dest => dest.CTN_NUM, src => src.ctnNum) diff --git a/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs index f9e57d18..3ae26bb0 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs @@ -293,5 +293,20 @@ namespace Myshipping.Application /// 集装箱主键 /// public Nullable id { get; set; } + + /// + /// 对应船公司箱型 + /// + public string carrierCtnCode { get; set; } + + /// + /// 箱计量单位 + /// + public string stuffingMeasurementType { get; set; } + + /// + /// 重量或者体积的计量单位 + /// + public string stuffingMeasurementUnit { get; set; } } } diff --git a/Myshipping.Application/Service/BookingOrder/IBookingMSKAPIService.cs b/Myshipping.Application/Service/BookingOrder/IBookingMSKAPIService.cs index 7aa9d591..36e2bd49 100644 --- a/Myshipping.Application/Service/BookingOrder/IBookingMSKAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/IBookingMSKAPIService.cs @@ -50,7 +50,7 @@ namespace Myshipping.Application /// /// 马士基API订舱ID /// 返回详情 - Task GetInfo(long id); + Task GetInfo(long id); /// /// 保存 From 2a8d71478dbd1ae9288670184e8067cb13181519 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Fri, 15 Mar 2024 16:07:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A9=AC=E5=A3=AB?= =?UTF-8?q?=E5=9F=BAAPI=E8=AE=A2=E8=88=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingMSKAPIService.cs | 107 ++++++++++++------ .../Dto/MSKAPI/MSKAPIBookingDto.cs | 2 +- .../Dto/MSKAPI/MSKAPIBookingResultDto.cs | 2 +- .../Service/BookingOrder/Dto/MSKBookingDto.cs | 2 +- .../Interface/ITaskManageBCService.cs | 7 ++ .../TaskManagePlat/TaskManageBCService.cs | 52 ++++++++- 6 files changed, 134 insertions(+), 38 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs index 0fcbe0e7..259672e9 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs @@ -17,6 +17,7 @@ using Myshipping.Core.Service; using Microsoft.Extensions.Logging; using Myshipping.Application.Helper; using System.Text.RegularExpressions; +using System.Globalization; namespace Myshipping.Application.Service.BookingOrder { @@ -280,6 +281,7 @@ namespace Myshipping.Application.Service.BookingOrder userSecret = App.Configuration["MSKAPIDjyUserSecret"], operatingEnvironment = App.Configuration["MSKAPIOPEnvironment"], mskAppKey = webAccountConfig.Account, + mskAppSecret = webAccountConfig.Password, bookingBody = new MSKAPIBookingBodyDto() }; @@ -288,6 +290,7 @@ namespace Myshipping.Application.Service.BookingOrder priceReference = model.priceReference, productCode = model.productCode, sender = model.sender, + bookingOfficeUNLocationCode = "CNTAO" }; bookingDto.bookingBody.mandatoryParties = new MSKAPIBookingMandatoryParties @@ -311,7 +314,7 @@ namespace Myshipping.Application.Service.BookingOrder bookingDto.bookingBody.transport = new MSKAPIBookingTransport { carrierCode = model.carrierCode, - earliestDepartureDate = model.earliestDepartureDate, + earliestDepartureDate = model.earliestDepartureDate.Value.ToString("yyyy-MM-ddTHH:mm:ss"), exportServiceMode = model.exportServiceMode, importServiceMode = model.importServiceMode, routeDetails = new MSKAPIBookingRouteDetails @@ -328,30 +331,32 @@ namespace Myshipping.Application.Service.BookingOrder }, selectedRoute = new MSKAPIBookingRoute { - bookingSchedules = new MSKAPIBookingSchedules - { - originDepartureDateTimeLocal = model.originDepartureDateTimeLocal.Value.ToString("yyyy-MM-dd"), - destinationArrivalDateTimeLocal = model.destinationArrivalDateTimeLocal.Value.ToString("yyyy-MM-dd"), - transportMode = new MSKAPIBookingTransportMode + bookingSchedules = new List { + new MSKAPIBookingSchedules { - vessel = new MSKAPIBookingTransportModeVessel + originDepartureDateTimeLocal = model.originDepartureDateTimeLocal.Value.ToString("yyyy-MM-ddTHH:mm:ss"), + destinationArrivalDateTimeLocal = model.destinationArrivalDateTimeLocal.Value.ToString("yyyy-MM-ddTHH:mm:ss"), + transportMode = new MSKAPIBookingTransportMode { - name = model.vesselName, - maerskVesselCode = model.carrierVesselCode, + vessel = new MSKAPIBookingTransportModeVessel + { + name = model.vesselName, + maerskVesselCode = model.carrierVesselCode, + }, + exportVoyageNumber = model.exportVoyageNumber, }, - exportVoyageNumber = model.exportVoyageNumber, - }, - startLocation = new MSKAPIBookingRouteDetailsBase - { - cityName = model.placeOfReceiptCityName, - UNLocationCode = model.placeOfReceiptUnLocCode - }, - endLocation = new MSKAPIBookingRouteDetailsBase - { - cityName = model.placeOfDeliveryCityName, - UNLocationCode = model.placeOfDeliveryUnLocCode - }, - transportModeCode = model.transportMode + startLocation = new MSKAPIBookingRouteDetailsBase + { + cityName = model.placeOfReceiptCityName, + UNLocationCode = model.placeOfReceiptUnLocCode + }, + endLocation = new MSKAPIBookingRouteDetailsBase + { + cityName = model.placeOfDeliveryCityName, + UNLocationCode = model.placeOfDeliveryUnLocCode + }, + transportModeCode = model.transportMode + } } }, } @@ -412,13 +417,14 @@ namespace Myshipping.Application.Service.BookingOrder }); } - var id = await Save(model); + var id = await InnerSave(model, isSendApi: true); MSKAPIBookingResultDto resultInfo = null; _logger.LogInformation($"开始请求MSK API订舱,JSON={JSON.Serialize(bookingDto)}"); - var rlt = await sendUrl.SetBody(bookingDto) + var jsonBody = Newtonsoft.Json.JsonConvert.SerializeObject(bookingDto); + var rlt = await sendUrl.SetBody(jsonBody) .PostAsStringAsync(); _logger.LogInformation($"开始请求MSK API订舱,返回结果 JSON={JSON.Serialize(rlt)}"); @@ -437,14 +443,21 @@ namespace Myshipping.Application.Service.BookingOrder } } + MSKAPIBookingResultDataDto resultData = null; + + if(resultInfo.code == 200) + { + resultData = JSON.Deserialize(JSON.Serialize(resultInfo.data)); + } + var entity = _bookingDeliveryRecordRep .FirstOrDefault(a => a.Id == recordInfo.Id); if (resultInfo != null && resultInfo.code == 200 - && resultInfo.data != null) + && resultData != null) { - entity.REQUEST_ACKNOWLEDGEMENT_ID = resultInfo.data.requestAcknowledgementId; - entity.BOOKING_REFERENCE = resultInfo.data.bookingReference; + entity.REQUEST_ACKNOWLEDGEMENT_ID = resultData.requestAcknowledgementId; + entity.BOOKING_REFERENCE = resultData.bookingReference; entity.STATUS = "SUCC"; await _bookingDeliveryRecordRep.AsUpdateable(entity).UpdateColumns(x => new @@ -464,6 +477,9 @@ namespace Myshipping.Application.Service.BookingOrder x.STATUS, x.NOTES }).ExecuteCommandAsync(); + + + throw Oops.Bah(resultInfo.msg); } } catch (Exception ex) @@ -500,6 +516,7 @@ namespace Myshipping.Application.Service.BookingOrder 12、如果选择了冷冻处理,至少要填个温度 13、箱型、箱量、重量必填 14、总重=箱量*单箱重量 + 15、预计离港日期必填 */ if (string.IsNullOrWhiteSpace(model.priceReference)) throw Oops.Bah($"订舱合同惟一ID必填"); @@ -585,6 +602,9 @@ namespace Myshipping.Application.Service.BookingOrder if (string.IsNullOrWhiteSpace(model.cargoType)) throw Oops.Bah($"货物标志必填"); + if(!model.earliestDepartureDate.HasValue) + throw Oops.Bah($"预计离港日期必填"); + if (model.isReefer) { if (!model.temperature.HasValue) @@ -1001,6 +1021,18 @@ namespace Myshipping.Application.Service.BookingOrder /// 返回ID [HttpPost("/BookingMSKAPI/Save")] public async Task Save([FromBody] MSKBookingDto model) + { + return await InnerSave(model); + } + #endregion + + /// + /// 保存内部方法 + /// + /// API订舱详情 + /// 是否发送API,true-发送需要校验状态;false-不校验状态 + /// + private async Task InnerSave(MSKBookingDto model,bool isSendApi = false) { DateTime nowDate = DateTime.Now; @@ -1014,10 +1046,20 @@ namespace Myshipping.Application.Service.BookingOrder .Select(a => $"{a.Key}*{a.ToList().Sum(b => b.ctnNum.HasValue ? b.ctnNum.Value : 0)}").ToArray()); } - - if (model.id.HasValue && model.id.Value > 0) { + var oldInfo = _bookingDeliveryRecordRep.AsQueryable() + .First(a=>a.Id == model.id); + + if (oldInfo == null) + throw Oops.Oh("订舱数据不存在或已作废"); + + if (isSendApi) + { + if(oldInfo.STATUS == "SUCC") + throw Oops.Oh("订舱数据已发送成功,不能重复发送"); + } + BookingDeliveryRecord entity = model.Adapt(); entity.Id = model.id.Value; @@ -1061,7 +1103,7 @@ namespace Myshipping.Application.Service.BookingOrder ctnEntity.UpdatedUserId = UserManager.UserId; ctnEntity.UpdatedUserName = UserManager.Name; - _bookingDeliveryRecordCtnRep.AsUpdateable(ctnEntity).IgnoreColumns(x => new { + _bookingDeliveryRecordCtnRep.AsUpdateable(ctnEntity).IgnoreColumns(x => new { x.CreatedUserId, x.CreatedUserName, x.CreatedTime, @@ -1084,10 +1126,10 @@ namespace Myshipping.Application.Service.BookingOrder _bookingDeliveryRecordCtnRep.Insert(ctnEntity); } - + }); - if(ctnEntityList.Count > 0) + if (ctnEntityList.Count > 0) { ctnEntityList.ForEach(async ctn => { ctn.IsDeleted = true; @@ -1141,7 +1183,6 @@ namespace Myshipping.Application.Service.BookingOrder return entity.Id; } } - #endregion #region 删除 /// diff --git a/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPIBookingDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPIBookingDto.cs index b44e3f3f..3083d6ab 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPIBookingDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPIBookingDto.cs @@ -382,7 +382,7 @@ namespace Myshipping.Application /// /// /// - public MSKAPIBookingSchedules bookingSchedules { get; set; } + public List bookingSchedules { get; set; } /// /// 航行时间,分钟为单位 diff --git a/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPIBookingResultDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPIBookingResultDto.cs index e5e42f1f..9462744b 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPIBookingResultDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPIBookingResultDto.cs @@ -21,7 +21,7 @@ namespace Myshipping.Application /// /// 订舱回执详情 /// - public MSKAPIBookingResultDataDto data { get; set; } + public object data { get; set; } } /// diff --git a/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs index 3ae26bb0..3e7f63df 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs @@ -121,7 +121,7 @@ namespace Myshipping.Application /// /// 最早起运日期, 不可小于当前日期 /// - public string earliestDepartureDate { get; set; } + public Nullable earliestDepartureDate { get; set; } /// /// 出口服务类型(CY, SD, CFS) diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageBCService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageBCService.cs index 01de4889..ea91d396 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageBCService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageBCService.cs @@ -89,5 +89,12 @@ namespace Myshipping.Application /// BC任务主键 /// 返回回执 Task> GetCompareResult(string taskPKId); + + /// + /// 同步舱位变更 + /// + /// BC任务主键 + /// 返回回执 + Task SyncBookingSlotChange(string taskPKId); } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs index d049bded..b307d180 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs @@ -925,7 +925,7 @@ namespace Myshipping.Application /// BC任务集装箱列表 /// BC任务附件列表 /// 返回舱位ID - private async Task GenerateBookingSlot(TaskBCInfo taskBCInfo, List taskBCCtnList, List taskFileList) + private async Task GenerateBookingSlot(TaskBCInfo taskBCInfo, List taskBCCtnList, List taskFileList,string opType = "add") { long id = 0; @@ -972,7 +972,7 @@ namespace Myshipping.Application TRANSFER_PORT_2 = taskBCInfo.TRANSFER_PORT_2, CtnList = new List() }, - OpType = "add" + OpType = opType }; var ctnCodeList = _cache.GetAllCodeCtn().GetAwaiter().GetResult().ToList(); @@ -1809,6 +1809,54 @@ namespace Myshipping.Application return await _bookingSlotService.GetSlotCompareResult(bcOrder.BOOKING_SLOT_ID.Value, bcOrder.BATCH_NO); } + + /// + /// 同步舱位变更 + /// + /// BC任务主键 + /// 返回回执 + [HttpGet("/TaskManageBC/SyncBookingSlotChange")] + public async Task SyncBookingSlotChange(string taskPKId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + /* + 1、检索对应舱位,比对差异 + 2、更新舱位信息。 + 3、检索舱位对应的订舱信息,如果有则生成通知邮件 + */ + try + { + var bcOrder = _taskBCInfoRepository.AsQueryable().First(a => a.TASK_ID == taskPKId); + + if (bcOrder == null) + throw Oops.Oh($"任务主键{taskPKId}无法获取BC业务信息"); + + + if(bcOrder.BOOKING_SLOT_ID.HasValue && bcOrder.BOOKING_SLOT_ID.Value > 0) + { + var bcCtnList = _taskBCCTNInfoRepository.AsQueryable().Where(a => a.P_ID == bcOrder.PK_ID).ToList(); + + var fileList = _taskFileRepository.AsQueryable().Where(a => a.TASK_PKID == taskPKId).ToList(); + + //推送舱位 + var bookingSlotId = GenerateBookingSlot(bcOrder, bcCtnList, fileList,"update").GetAwaiter().GetResult(); + + + } + else + { + throw Oops.Oh($"未检索到对应的舱位信息"); + } + } + catch (Exception ex) + { + result.succ = false; + result.msg = $"处理异常,原因:{ex.Message}"; + } + + return result; + } } ///