From f413b04a517ff08bb58dc35df5d3dac4e763deab Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Wed, 6 Mar 2024 10:48:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A9=AC=E5=A3=AB=E5=9F=BAAP?= =?UTF-8?q?I=E8=AE=A2=E8=88=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 49 ++++++++++++++++++- .../BookingOrder/Dto/BookingEDIMapper.cs | 45 +++++++++++++++++ .../Service/BookingOrder/Dto/MSKBookingDto.cs | 10 ++++ 3 files changed, 103 insertions(+), 1 deletion(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index c9b1d0c3..cc3e3797 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -12067,7 +12067,6 @@ namespace Myshipping.Application /* MSKApiBooking - */ try { @@ -12098,6 +12097,10 @@ namespace Myshipping.Application if (webAccountConfig == null) throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi"); + DateTime nowDate = DateTime.Now; + + var recordInfo = model.Adapt(); + var recordCtnList = model.ctns.Adapt>(); MSKAPIBookingDto bookingDto = new MSKAPIBookingDto { @@ -12224,6 +12227,27 @@ namespace Myshipping.Application }); } + recordInfo.CreatedTime = nowDate; + recordInfo.UpdatedTime = nowDate; + recordInfo.CreatedUserId = UserManager.UserId; + recordInfo.CreatedUserName = UserManager.Name; + + _bookingDeliveryRecordRep.Insert(recordInfo); + + if(recordCtnList.Count > 0) + { + recordCtnList.ForEach(async x => + { + x.RECORD_ID = recordInfo.Id; + x.CreatedTime = nowDate; + x.UpdatedTime = nowDate; + x.CreatedUserId = UserManager.UserId; + x.CreatedUserName = UserManager.Name; + + await _bookingDeliveryRecordCtnRep.InsertAsync(x); + }); + } + MSKAPIBookingResultDto resultInfo = null; var rlt = await sendUrl.SetBody(bookingDto) @@ -12243,10 +12267,33 @@ namespace Myshipping.Application } } + var entity = _bookingDeliveryRecordRep + .FirstOrDefault(a => a.Id == recordInfo.Id); + if (resultInfo != null && resultInfo.code == 200 && resultInfo.data != null) { + entity.REQUEST_ACKNOWLEDGEMENT_ID = resultInfo.data.requestAcknowledgementId; + entity.BOOKING_REFERENCE = resultInfo.data.bookingReference; + entity.STATUS = "SUCC"; + + await _bookingDeliveryRecordRep.AsUpdateable(entity).UpdateColumns(x => new + { + x.REQUEST_ACKNOWLEDGEMENT_ID, + x.BOOKING_REFERENCE, + x.STATUS + }).ExecuteCommandAsync(); + } + else + { + entity.STATUS = "SUCC"; + entity.NOTES = resultInfo.msg.Length > 500 ? resultInfo.msg.Substring(0, 500) : resultInfo.msg; + await _bookingDeliveryRecordRep.AsUpdateable(entity).UpdateColumns(x => new + { + x.STATUS, + x.NOTES + }).ExecuteCommandAsync(); } } catch (Exception ex) diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs index 7486af19..7208d7c9 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs @@ -91,6 +91,51 @@ namespace Myshipping.Application .Map(dest => dest.KINDPKGS, src => src.KINDPKGS) .Map(dest => dest.KGS, src => src.KGS.HasValue ? src.KGS.Value : 0) .Map(dest => dest.CBM, src => src.CBM.HasValue ? src.CBM.Value : 0); + + config.ForType() + .Map(dest => dest.CARRIERID, src => src.carrierId) + .Map(dest => dest.BookingId, src => src.bookingId) + .Map(dest => dest.PRICE_REFERENCE, src => src.priceReference) + .Map(dest => dest.PRODUCT_CODE, src => src.productCode) + .Map(dest => dest.SENDER, src => src.sender) + .Map(dest => dest.BOOKEDBY_COMPANY_NAME, src => src.bookedByCompanyName) + .Map(dest => dest.BOOKEDBY_COMPANY_PARTYCODE, src => src.bookedByMaerskPartyCode) + .Map(dest => dest.BOOKEDBY_COMPANY_CONTACT, src => src.bookedByCompanyContactName) + .Map(dest => dest.BOOKEDBY_COMPANY_CONTACT_EMAIL, src => src.bookedByCompanyContactEmail) + .Map(dest => dest.IS_BOOKING_PART_OWN_PRICE, src => src.isBookingPartOwnPrice) + .Map(dest => dest.PRICE_OWNER_COMPANY_NAME, src => src.priceOwnerCompanyName) + .Map(dest => dest.PRICE_OWNER_COMPANY_PARTYCODE, src => src.priceOwnerMaerskPartyCode) + .Map(dest => dest.PRICE_OWNER_COMPANY_CONTACT, src => src.priceOwnerContactName) + .Map(dest => dest.PRICE_OWNER_COMPANY_CONTACT_EMAIL, src => src.priceOwnerContactEmail) + .Map(dest => dest.CARRIER_CODE, src => src.carrierCode) + .Map(dest => dest.EARLIEST_DEPARTURE_DATE, src => src.earliestDepartureDate) + .Map(dest => dest.EXPORT_SERVICE_MODE, src => src.exportServiceMode) + .Map(dest => dest.IMPORT_SERVICE_MODE, src => src.importServiceMode) + .Map(dest => dest.PLACERECEIPT_CITY, src => src.placeOfReceiptCityName) + .Map(dest => dest.PLACERECEIPT_UNLOC_CODE, src => src.placeOfReceiptUnLocCode) + .Map(dest => dest.PLACEDELIVERY_CITY, src => src.placeOfDeliveryCityName) + .Map(dest => dest.PLACEDELIVERY_UNLOC_CODE, src => src.placeOfDeliveryUnLocCode) + .Map(dest => dest.ETD, src => src.originDepartureDateTimeLocal) + .Map(dest => dest.ETA, src => src.destinationArrivalDateTimeLocal) + .Map(dest => dest.VESSEL, src => src.vesselName) + .Map(dest => dest.VESSEL_CODE, src => src.carrierVesselCode) + .Map(dest => dest.VOYNO, src => src.exportVoyageNumber) + .Map(dest => dest.TRANSPORT_MODE, src => src.transportMode) + .Map(dest => dest.TOTAL_CARGO_WEIGHT, src => src.totalCargoWeight) + .Map(dest => dest.NO_OF_PROBES, src => src.noOfProbes) + .Map(dest => dest.TEMPSET, src => src.temperature) + .Map(dest => dest.VENT, src => src.ventilation) + .Map(dest => dest.HUMIDITY, src => src.humidity) + .Map(dest => dest.COMMODITY_CODE_TYPE, src => src.commodityCodeType) + .Map(dest => dest.GOODSCODE, src => src.commodityCode) + .Map(dest => dest.GOODSNAME, src => src.commodityName); + + + config.ForType() + .Map(dest => dest.CTN_CODE, src => src.ctnCode) + .Map(dest => dest.CTN_NUM, src => src.ctnNum) + .Map(dest => dest.CTN_SUFFER_WEIGHT, src => src.ctnSufferWeight); + } } } diff --git a/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs index 890ba693..63a1d863 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs @@ -17,6 +17,11 @@ namespace Myshipping.Application /// public string carrierId { get; set; } + /// + /// 订舱ID + /// + public long bookingId { get; set; } + /// /// 合同唯一id /// @@ -170,6 +175,11 @@ namespace Myshipping.Application [RegularExpression("^[0-9]{6}$",ErrorMessage = "货物代码格式错误,应提交6位数字代码")] public string commodityCode { get; set; } + /// + /// 货物名称 + /// + public string commodityName { get; set; } + /// /// 货物类型, 箱型, 为REEFER 时, 需要上传reeferSettings参数中的温度,通风,湿度等(DRY, REEFER) ///