修改马士基API订舱

master
jianghaiqing 9 months ago
parent ca9f04f58d
commit f413b04a51

@ -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<BookingDeliveryRecord>();
var recordCtnList = model.ctns.Adapt<List<BookingDeliveryRecordCtn>>();
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)

@ -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<MSKBookingDto, BookingDeliveryRecord>()
.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<MSKBookingCtnInfo, BookingDeliveryRecordCtn>()
.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);
}
}
}

@ -17,6 +17,11 @@ namespace Myshipping.Application
/// </summary>
public string carrierId { get; set; }
/// <summary>
/// 订舱ID
/// </summary>
public long bookingId { get; set; }
/// <summary>
/// 合同唯一id
/// </summary>
@ -170,6 +175,11 @@ namespace Myshipping.Application
[RegularExpression("^[0-9]{6}$",ErrorMessage = "6")]
public string commodityCode { get; set; }
/// <summary>
/// 货物名称
/// </summary>
public string commodityName { get; set; }
/// <summary>
/// 货物类型, 箱型, 为REEFER 时, 需要上传reeferSettings参数中的温度,通风,湿度等(DRY, REEFER)
/// </summary>

Loading…
Cancel
Save