|
|
@ -21,6 +21,7 @@ using Myshipping.Core.Const;
|
|
|
|
using Yitter.IdGenerator;
|
|
|
|
using Yitter.IdGenerator;
|
|
|
|
using System.Diagnostics;
|
|
|
|
using System.Diagnostics;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -349,6 +350,9 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
Legs = new List<MSKAPISPOTScheduleRateResultShowLegsDto>()
|
|
|
|
Legs = new List<MSKAPISPOTScheduleRateResultShowLegsDto>()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (a.totalAmount.HasValue)
|
|
|
|
|
|
|
|
showDto.totalAmountShow = string.Format("{0:N}", a.totalAmount.Value);
|
|
|
|
|
|
|
|
|
|
|
|
//ETD
|
|
|
|
//ETD
|
|
|
|
if (!string.IsNullOrWhiteSpace(a.departureDate))
|
|
|
|
if (!string.IsNullOrWhiteSpace(a.departureDate))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -593,6 +597,51 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
//这里是校验必填项
|
|
|
|
//这里是校验必填项
|
|
|
|
ValidateMSKAPIData(model);
|
|
|
|
ValidateMSKAPIData(model);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MSKAPISPOTSearchScheduleRateResultDataDto selectedShipSchedule = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BookingDeliveryRecordShipSchedule shipScheduleRecord = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.PId == 0)
|
|
|
|
|
|
|
|
throw Oops.Oh("船期信息不能为空,请重新检索船期");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.PId > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (model.id.HasValue && model.id.Value > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var recordId = model.id.Value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shipScheduleRecord = await _bookingDeliveryRecordShipScheduleRep.AsQueryable()
|
|
|
|
|
|
|
|
.FirstAsync(a => a.RECORD_ID == recordId && a.SHIP_RATE_PID != null &&
|
|
|
|
|
|
|
|
a.SHIP_RATE_PID.Value == model.PId && a.IsDeleted == false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (shipScheduleRecord == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
selectedShipSchedule = GetCacheShipSailingSchedule(model.PId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
selectedShipSchedule = JSON.Deserialize<MSKAPISPOTSearchScheduleRateResultDataDto>(shipScheduleRecord.SHIP_JSON);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selectedShipSchedule == null)
|
|
|
|
|
|
|
|
throw Oops.Oh("船期数据校验失败,请重新查询船期信息");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selectedShipSchedule.priceID.Equals(model.priceID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"请求当前船期请求参数错误 priceID={model.priceID} 缓存priceID={selectedShipSchedule.priceID} PId={model.PId}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Oh("船期数据校验失败,当前船期请求参数错误,请重新查询船期信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selectedShipSchedule.totalAmount.Value != model.ShipRateTotalAmount.Value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"请求当前船期请求参数错误 totalAmount={selectedShipSchedule.totalAmount.Value} 缓存totalAmount={model.ShipRateTotalAmount.Value} PId={model.PId}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Oh("船期数据校验失败,当前船期请求参数错误,价格发生差异,请重新查询船期信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DateTime nowDate = DateTime.Now;
|
|
|
|
DateTime nowDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
var recordInfo = model.Adapt<BookingDeliveryRecord>();
|
|
|
|
var recordInfo = model.Adapt<BookingDeliveryRecord>();
|
|
|
@ -618,7 +667,8 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
priceReference = model.priceReference,
|
|
|
|
priceReference = model.priceReference,
|
|
|
|
productCode = model.productCode,
|
|
|
|
productCode = model.productCode,
|
|
|
|
sender = model.sender,
|
|
|
|
sender = model.sender,
|
|
|
|
bookingOfficeUNLocationCode = "CNTAO"
|
|
|
|
bookingOfficeUNLocationCode = "CNTAO",
|
|
|
|
|
|
|
|
isSpotTermsAndConditionsAccepted = true,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
bookingDto.bookingBody.mandatoryParties = new MSKAPIBookingMandatoryParties
|
|
|
|
bookingDto.bookingBody.mandatoryParties = new MSKAPIBookingMandatoryParties
|
|
|
@ -639,12 +689,6 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//排查怀疑这里是导致BC没有合约号胡的问题,开启这个值看看
|
|
|
|
|
|
|
|
//if (model.isBookingPartOwnPrice)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// bookingDto.bookingBody.mandatoryParties.isPriceOwnerFromServiceContractAccepted = true;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bookingDto.bookingBody.transport = new MSKAPIBookingTransport
|
|
|
|
bookingDto.bookingBody.transport = new MSKAPIBookingTransport
|
|
|
|
{
|
|
|
|
{
|
|
|
|
carrierCode = model.carrierCode,
|
|
|
|
carrierCode = model.carrierCode,
|
|
|
@ -655,55 +699,84 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
{
|
|
|
|
{
|
|
|
|
placeOfReceipt = new MSKAPIBookingRouteDetailsBase
|
|
|
|
placeOfReceipt = new MSKAPIBookingRouteDetailsBase
|
|
|
|
{
|
|
|
|
{
|
|
|
|
UNLocationCode = model.userPlaceOfReceiptUnLocCode
|
|
|
|
UNLocationCode = model.userPlaceOfReceiptUnLocCode,
|
|
|
|
//: model.placeOfReceiptUnLocCode,
|
|
|
|
maerskCityGeoId = selectedShipSchedule.originGeoId,
|
|
|
|
//cityName = model.placeOfReceiptCityName,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
placeOfDelivery = new MSKAPIBookingRouteDetailsBase
|
|
|
|
placeOfDelivery = new MSKAPIBookingRouteDetailsBase
|
|
|
|
{
|
|
|
|
{
|
|
|
|
UNLocationCode = model.userPlaceOfDeliveryUnLocCode
|
|
|
|
UNLocationCode = model.userPlaceOfDeliveryUnLocCode,
|
|
|
|
//: model.placeOfDeliveryUnLocCode,
|
|
|
|
maerskCityGeoId = selectedShipSchedule.destinationGeoId,
|
|
|
|
//cityName = model.placeOfDeliveryCityName,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
selectedRoute = new MSKAPIBookingRoute
|
|
|
|
selectedRoute = new MSKAPIBookingRoute
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bookingSchedules = new List<MSKAPIBookingSchedules> {
|
|
|
|
bookingSchedules = new List<MSKAPIBookingSchedules>(),
|
|
|
|
new MSKAPIBookingSchedules
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
originDepartureDateTimeLocal = model.originDepartureDateTimeLocal.Value.ToString("yyyy-MM-ddTHH:mm:ss"),
|
|
|
|
|
|
|
|
destinationArrivalDateTimeLocal = model.destinationArrivalDateTimeLocal.Value.ToString("yyyy-MM-ddTHH:mm:ss"),
|
|
|
|
|
|
|
|
transportMode = new MSKAPIBookingTransportMode
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
vessel = new MSKAPIBookingTransportModeVessel
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name = model.vesselName,
|
|
|
|
|
|
|
|
maerskVesselCode = model.carrierVesselCode,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
exportVoyageNumber = model.exportVoyageNumber,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
startLocation = new MSKAPIBookingRouteDetailsBase
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//cityName = model.placeOfReceiptCityName,
|
|
|
|
|
|
|
|
UNLocationCode = model.userPlaceOfReceiptUnLocCode
|
|
|
|
|
|
|
|
//: model.placeOfReceiptUnLocCode
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
endLocation = new MSKAPIBookingRouteDetailsBase
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//cityName = model.placeOfDeliveryCityName,
|
|
|
|
|
|
|
|
UNLocationCode = model.userPlaceOfDeliveryUnLocCode
|
|
|
|
|
|
|
|
//: model.placeOfDeliveryUnLocCode
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
transportModeCode = model.transportMode
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//if(!model.isSendNoSchedule)
|
|
|
|
foreach (var detail in selectedShipSchedule.scheduleDetails)
|
|
|
|
//{
|
|
|
|
{
|
|
|
|
// bookingDto.bookingBody.transport.routeDetails.selectedRoute.routeScheduleId = model.carrierProductId;
|
|
|
|
var currDto = new MSKAPIBookingSchedules();
|
|
|
|
//}
|
|
|
|
//ETD
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(detail.fromLocation.date))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
DateTime currDate = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (DateTime.TryParse($"{detail.fromLocation.date} {detail.fromLocation.time}", out currDate))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
currDto.originDepartureDateTimeLocal = currDate.ToString("yyyy-MM-ddTHH:mm:ss");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah($"查询船期错误,priceID={model.priceID} pid={model.PId} 预计离港日期departureDate={detail.fromLocation.date} {detail.fromLocation.time} 格式解析错误");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//ETD
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(detail.toLocation.date))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
DateTime currDate = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (DateTime.TryParse($"{detail.toLocation.date} {detail.toLocation.time}", out currDate))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
currDto.destinationArrivalDateTimeLocal = currDate.ToString("yyyy-MM-ddTHH:mm:ss");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah($"查询船期错误,priceID={model.priceID} pid={model.PId} 预计离港日期ArrivalDate={detail.toLocation.date} {detail.toLocation.time} 格式解析错误");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
currDto.transportMode = new MSKAPIBookingTransportMode
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
vessel = new MSKAPIBookingTransportModeVessel
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name = detail.transport.vessel.name,
|
|
|
|
|
|
|
|
maerskVesselCode = detail.transport.vessel.code,
|
|
|
|
|
|
|
|
vesselIMONumber = detail.transport.vessel.imoNumber
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
exportVoyageNumber = detail.transport.voyageNumber,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
currDto.serviceCode = detail.serviceCode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
currDto.startLocation = new MSKAPIBookingRouteDetailsBase {
|
|
|
|
|
|
|
|
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.cityName,
|
|
|
|
|
|
|
|
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.countryCode,
|
|
|
|
|
|
|
|
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.unLocCode,
|
|
|
|
|
|
|
|
maerskCityGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.cityGeoId,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
currDto.endLocation = new MSKAPIBookingRouteDetailsBase
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.cityName,
|
|
|
|
|
|
|
|
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.countryCode,
|
|
|
|
|
|
|
|
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.unLocCode,
|
|
|
|
|
|
|
|
maerskCityGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.cityGeoId,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bookingDto.bookingBody.transport.routeDetails.selectedRoute.bookingSchedules.Add(currDto);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bookingDto.bookingBody.cargo = new MSKAPIBookingCargo
|
|
|
|
bookingDto.bookingBody.cargo = new MSKAPIBookingCargo
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1187,10 +1260,18 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
|
|
|
|
|
|
|
MSKAPISPOTSearchScheduleRateResultDataDto selectedShipSchedule = null;
|
|
|
|
MSKAPISPOTSearchScheduleRateResultDataDto selectedShipSchedule = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BookingDeliveryRecordShipSchedule shipScheduleRecord = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (model.PId > 0)
|
|
|
|
if (model.PId > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var shipScheduleRecord = await _bookingDeliveryRecordShipScheduleRep.AsQueryable()
|
|
|
|
if (model.id.HasValue && model.id.Value > 0)
|
|
|
|
.FirstAsync(a => a.SHIP_RATE_PID != null && a.SHIP_RATE_PID.Value == model.PId);
|
|
|
|
{
|
|
|
|
|
|
|
|
var recordId = model.id.Value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shipScheduleRecord = await _bookingDeliveryRecordShipScheduleRep.AsQueryable()
|
|
|
|
|
|
|
|
.FirstAsync(a => a.RECORD_ID == recordId && a.SHIP_RATE_PID != null &&
|
|
|
|
|
|
|
|
a.SHIP_RATE_PID.Value == model.PId && a.IsDeleted == false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (shipScheduleRecord == null)
|
|
|
|
if (shipScheduleRecord == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1203,6 +1284,28 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
|
|
|
|
|
|
|
if (selectedShipSchedule == null)
|
|
|
|
if (selectedShipSchedule == null)
|
|
|
|
throw Oops.Oh("船期数据校验失败,请重新查询船期信息");
|
|
|
|
throw Oops.Oh("船期数据校验失败,请重新查询船期信息");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selectedShipSchedule.priceID.Equals(model.priceID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"请求当前船期请求参数错误 priceID={model.priceID} 缓存priceID={selectedShipSchedule.priceID} PId={model.PId}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Oh("船期数据校验失败,当前船期请求参数错误,请重新查询船期信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selectedShipSchedule.totalAmount.Value != model.ShipRateTotalAmount.Value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"请求当前船期请求参数错误 totalAmount={selectedShipSchedule.totalAmount.Value} 缓存totalAmount={model.ShipRateTotalAmount.Value} PId={model.PId}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Oh("船期数据校验失败,当前船期请求参数错误,价格发生差异,请重新查询船期信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.placeOfReceiptCountryName = selectedShipSchedule.originCountryName;
|
|
|
|
|
|
|
|
model.placeOfReceiptRegionName = selectedShipSchedule.originRegionName;
|
|
|
|
|
|
|
|
model.placeOfReceiptGeoId = selectedShipSchedule.originGeoId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.placeOfDeliveryRegionName = selectedShipSchedule.destinationCountryName;
|
|
|
|
|
|
|
|
model.placeOfDeliveryCountryName = selectedShipSchedule.destinationCountryName;
|
|
|
|
|
|
|
|
model.placeOfReceiptRegionName = selectedShipSchedule.destinationGeoId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (model.ctns != null && model.ctns.Count > 0)
|
|
|
|
if (model.ctns != null && model.ctns.Count > 0)
|
|
|
@ -1328,14 +1431,36 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(shipScheduleRecord == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(model.PId > 0 && selectedShipSchedule != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
shipScheduleRecord = new BookingDeliveryRecordShipSchedule
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = YitIdHelper.NextId(),
|
|
|
|
|
|
|
|
RECORD_ID = model.id.Value,
|
|
|
|
|
|
|
|
PRICE_ID = model.priceID,
|
|
|
|
|
|
|
|
SHIP_RATE_PID = selectedShipSchedule.PId,
|
|
|
|
|
|
|
|
SHIP_RATE_MD5 = selectedShipSchedule.MD5,
|
|
|
|
|
|
|
|
SHIP_RATE_TOTAL_AMOUNT = selectedShipSchedule.totalAmount.HasValue ? selectedShipSchedule.totalAmount.Value : 0,
|
|
|
|
|
|
|
|
SHIP_RATE_TOTAL_CURRENCY = selectedShipSchedule.totalCurrency,
|
|
|
|
|
|
|
|
SHIP_JSON = Newtonsoft.Json.JsonConvert.SerializeObject(selectedShipSchedule),
|
|
|
|
|
|
|
|
CreatedTime = nowDate,
|
|
|
|
|
|
|
|
UpdatedTime = nowDate,
|
|
|
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _bookingDeliveryRecordShipScheduleRep.InsertAsync(shipScheduleRecord);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return model.id.Value;
|
|
|
|
return model.id.Value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BookingDeliveryRecord entity = model.Adapt<BookingDeliveryRecord>();
|
|
|
|
BookingDeliveryRecord entity = model.Adapt<BookingDeliveryRecord>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entity.CreatedTime = nowDate;
|
|
|
|
entity.CreatedTime = nowDate;
|
|
|
|
entity.UpdatedTime = nowDate;
|
|
|
|
entity.UpdatedTime = nowDate;
|
|
|
|
entity.CreatedUserId = UserManager.UserId;
|
|
|
|
entity.CreatedUserId = UserManager.UserId;
|
|
|
@ -1372,6 +1497,71 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (shipScheduleRecord == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (model.PId > 0 && selectedShipSchedule != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
shipScheduleRecord = new BookingDeliveryRecordShipSchedule
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = YitIdHelper.NextId(),
|
|
|
|
|
|
|
|
RECORD_ID = model.id.Value,
|
|
|
|
|
|
|
|
PRICE_ID = model.priceID,
|
|
|
|
|
|
|
|
SHIP_RATE_PID = selectedShipSchedule.PId,
|
|
|
|
|
|
|
|
SHIP_RATE_MD5 = selectedShipSchedule.MD5,
|
|
|
|
|
|
|
|
SHIP_RATE_TOTAL_AMOUNT = selectedShipSchedule.totalAmount.HasValue ? selectedShipSchedule.totalAmount.Value : 0,
|
|
|
|
|
|
|
|
SHIP_RATE_TOTAL_CURRENCY = selectedShipSchedule.totalCurrency,
|
|
|
|
|
|
|
|
SHIP_JSON = Newtonsoft.Json.JsonConvert.SerializeObject(selectedShipSchedule),
|
|
|
|
|
|
|
|
CreatedTime = nowDate,
|
|
|
|
|
|
|
|
UpdatedTime = nowDate,
|
|
|
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _bookingDeliveryRecordShipScheduleRep.InsertAsync(shipScheduleRecord);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//只有船期发生变化时才重新写入新的船期记录
|
|
|
|
|
|
|
|
if (model.PId != shipScheduleRecord.SHIP_RATE_PID.Value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"MSK SPOT id={model.id} 换了船期 原记录:{selectedShipSchedule.PId} 新记录:{model.PId} 作废原船期,插入新船期");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shipScheduleRecord.IsDeleted = true;
|
|
|
|
|
|
|
|
shipScheduleRecord.UpdatedTime = nowDate;
|
|
|
|
|
|
|
|
shipScheduleRecord.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
|
|
|
shipScheduleRecord.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _bookingDeliveryRecordShipScheduleRep.AsUpdateable(shipScheduleRecord).UpdateColumns(x=>new {
|
|
|
|
|
|
|
|
x.IsDeleted,
|
|
|
|
|
|
|
|
x.UpdatedUserId,
|
|
|
|
|
|
|
|
x.UpdatedUserName,
|
|
|
|
|
|
|
|
x.UpdatedTime
|
|
|
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shipScheduleRecord = new BookingDeliveryRecordShipSchedule
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = YitIdHelper.NextId(),
|
|
|
|
|
|
|
|
RECORD_ID = model.id.Value,
|
|
|
|
|
|
|
|
PRICE_ID = model.priceID,
|
|
|
|
|
|
|
|
SHIP_RATE_PID = selectedShipSchedule.PId,
|
|
|
|
|
|
|
|
SHIP_RATE_MD5 = selectedShipSchedule.MD5,
|
|
|
|
|
|
|
|
SHIP_RATE_TOTAL_AMOUNT = selectedShipSchedule.totalAmount.HasValue ? selectedShipSchedule.totalAmount.Value : 0,
|
|
|
|
|
|
|
|
SHIP_RATE_TOTAL_CURRENCY = selectedShipSchedule.totalCurrency,
|
|
|
|
|
|
|
|
SHIP_JSON = Newtonsoft.Json.JsonConvert.SerializeObject(selectedShipSchedule),
|
|
|
|
|
|
|
|
CreatedTime = nowDate,
|
|
|
|
|
|
|
|
UpdatedTime = nowDate,
|
|
|
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _bookingDeliveryRecordShipScheduleRep.InsertAsync(shipScheduleRecord);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"MSK SPOT id={model.id} 船期没变化 model.PId={model.PId} shipScheduleRecord.SHIP_RATE_PID={shipScheduleRecord.SHIP_RATE_PID.Value}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return entity.Id;
|
|
|
|
return entity.Id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|