master
wanghaomei 9 months ago
parent ab3ae370ed
commit 76e9370fc1

@ -147,6 +147,8 @@ namespace Myshipping.Application
private readonly IEventPublisher _publisher; private readonly IEventPublisher _publisher;
private readonly SqlSugarRepository<DjyTenantParamValue> _repTenantParamValue;
const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING"; const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING";
const string CONST_MAPPING_MODULE_ROUTE = "BOOK_OR_CLOSING_RT"; const string CONST_MAPPING_MODULE_ROUTE = "BOOK_OR_CLOSING_RT";
const string CONST_MAPPING_MODULE_VOLTA = "BOOK_CLOSING_VOLTA"; const string CONST_MAPPING_MODULE_VOLTA = "BOOK_CLOSING_VOLTA";
@ -175,7 +177,9 @@ namespace Myshipping.Application
SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<BookingStatus> repBookingStatus, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingServiceItem> serviceItem, SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<BookingStatus> repBookingStatus, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingServiceItem> serviceItem,
SqlSugarRepository<ParaContractNoInfo> paraContractNoInfoRepository, IHttpContextAccessor httpContextAccessor, IBookingGoodsStatusConfigService GoodsConfig, SqlSugarRepository<DjyWebsiteAccountConfig> djyWebsiteAccountConfigRepository, SqlSugarRepository<ParaContractNoInfo> paraContractNoInfoRepository, IHttpContextAccessor httpContextAccessor, IBookingGoodsStatusConfigService GoodsConfig, SqlSugarRepository<DjyWebsiteAccountConfig> djyWebsiteAccountConfigRepository,
ISysOrgService orgService, SqlSugarRepository<BookingLineOpMgrConfig> repLineOpMgrConfig, SqlSugarRepository<SysEmp> repSysEmp, SqlSugarRepository<BookingAutoYardImport> repAutoYard, ISysOrgService orgService, SqlSugarRepository<BookingLineOpMgrConfig> repLineOpMgrConfig, SqlSugarRepository<SysEmp> repSysEmp, SqlSugarRepository<BookingAutoYardImport> repAutoYard,
IServiceWorkFlowManageService serviceWorkFlowManageService, IDjyUserConfigService djyUserConfigService, IEventPublisher publisher, SqlSugarRepository<BookingSlotBase> repSlotBase, SqlSugarRepository<BookingSlotAllocation> repSlotAllocation, SqlSugarRepository<BookingSlotAllocationCtn> repSlotAllocationCtn, IBookingSlotService bookingSlotService, SqlSugarRepository<BookingGoodsStatusSubscribe> repBookingStatusSubscribe) IServiceWorkFlowManageService serviceWorkFlowManageService, IDjyUserConfigService djyUserConfigService, IEventPublisher publisher, SqlSugarRepository<BookingSlotBase> repSlotBase,
SqlSugarRepository<BookingSlotAllocation> repSlotAllocation, SqlSugarRepository<BookingSlotAllocationCtn> repSlotAllocationCtn, IBookingSlotService bookingSlotService,
SqlSugarRepository<BookingGoodsStatusSubscribe> repBookingStatusSubscribe, SqlSugarRepository<DjyTenantParamValue> repTenantParamValue)
{ {
this._logger = logger; this._logger = logger;
this._rep = rep; this._rep = rep;
@ -228,6 +232,7 @@ namespace Myshipping.Application
_repSlotAllocationCtn = repSlotAllocationCtn; _repSlotAllocationCtn = repSlotAllocationCtn;
this.bookingSlotService = bookingSlotService; this.bookingSlotService = bookingSlotService;
_repBookingStatusSubscribe = repBookingStatusSubscribe; _repBookingStatusSubscribe = repBookingStatusSubscribe;
_repTenantParamValue = repTenantParamValue;
} }
#region 主表和箱信息 #region 主表和箱信息
@ -9941,6 +9946,15 @@ namespace Myshipping.Application
{ {
order.ATD = sjlg_time; order.ATD = sjlg_time;
flag = true; flag = true;
//当前租户配置为实际开船后扣费
var paraVal = _repTenantParamValue.AsQueryable().Filter(null, true).First(x => x.TenantId == UserManager.TENANT_ID && x.ParaCode == "BOOKING_FEE_METHOD");
//有实际开船,扣费
if (paraVal != null && paraVal.ItemCode == "ATD")
{
//扣费
await _publisher.PublishAsync(new ChannelEventSource($"Booking:DoFeeRecord", new { bsType = 28, sendtype = 0, idList = new List<long>() { order.Id } }));
}
} }
//同步船期 //同步船期
if (flag) if (flag)
@ -11882,7 +11896,7 @@ namespace Myshipping.Application
*/ */
try try
{ {
if(string.IsNullOrWhiteSpace(model.collectionOriginCityName)) if (string.IsNullOrWhiteSpace(model.collectionOriginCityName))
throw Oops.Oh($"始发地不能为空"); throw Oops.Oh($"始发地不能为空");
if (string.IsNullOrWhiteSpace(model.deliveryDestinationCityName)) if (string.IsNullOrWhiteSpace(model.deliveryDestinationCityName))
@ -11899,7 +11913,7 @@ namespace Myshipping.Application
DateTime etd = DateTime.MinValue; DateTime etd = DateTime.MinValue;
if(!DateTime.TryParse(model.startDate,out etd)) if (!DateTime.TryParse(model.startDate, out etd))
throw Oops.Oh($"预计离港日期格式错误"); throw Oops.Oh($"预计离港日期格式错误");
string queryUrl = string.Empty; string queryUrl = string.Empty;
@ -11984,7 +11998,7 @@ namespace Myshipping.Application
info.days = (int)Math.Ceiling(timeDiff / 24.0); info.days = (int)Math.Ceiling(timeDiff / 24.0);
} }
if(b.facilities != null) if (b.facilities != null)
{ {
info.orignCityName = b.facilities.collectionOrigin?.cityName; info.orignCityName = b.facilities.collectionOrigin?.cityName;
info.orignCarrierSiteGeoID = b.facilities.collectionOrigin?.carrierSiteGeoID; info.orignCarrierSiteGeoID = b.facilities.collectionOrigin?.carrierSiteGeoID;
@ -12080,7 +12094,8 @@ namespace Myshipping.Application
throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi"); throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi");
MSKAPIBookingDto bookingDto = new MSKAPIBookingDto { MSKAPIBookingDto bookingDto = new MSKAPIBookingDto
{
userKey = App.Configuration["MSKAPIDjyUserKey"], userKey = App.Configuration["MSKAPIDjyUserKey"],
userSecret = App.Configuration["MSKAPIDjyUserSecret"], userSecret = App.Configuration["MSKAPIDjyUserSecret"],
operatingEnvironment = App.Configuration["MSKAPIOPEnvironment"], operatingEnvironment = App.Configuration["MSKAPIOPEnvironment"],
@ -12088,38 +12103,46 @@ namespace Myshipping.Application
bookingBody = new MSKAPIBookingBodyDto() bookingBody = new MSKAPIBookingBodyDto()
}; };
bookingDto.bookingBody.references = new MSKAPIBookingReferenceDto { bookingDto.bookingBody.references = new MSKAPIBookingReferenceDto
{
priceReference = model.priceReference, priceReference = model.priceReference,
productCode = model.productCode, productCode = model.productCode,
sender = model.sender, sender = model.sender,
}; };
bookingDto.bookingBody.mandatoryParties = new MSKAPIBookingMandatoryParties { bookingDto.bookingBody.mandatoryParties = new MSKAPIBookingMandatoryParties
{
bookedByCompanyName = model.bookedByCompanyName, bookedByCompanyName = model.bookedByCompanyName,
bookedByMaerskPartyCode = model.bookedByMaerskPartyCode, bookedByMaerskPartyCode = model.bookedByMaerskPartyCode,
bookedByPartyContact = new MSKAPIBookingMandatoryPartyContact { bookedByPartyContact = new MSKAPIBookingMandatoryPartyContact
name = model.bookedByCompanyContactName, {
name = model.bookedByCompanyContactName,
email = model.bookedByCompanyContactEmail email = model.bookedByCompanyContactEmail
}, },
priceOwnerCompanyName = model.priceOwnerCompanyName, priceOwnerCompanyName = model.priceOwnerCompanyName,
priceOwnerMaerskPartyCode = model.priceOwnerMaerskPartyCode, priceOwnerMaerskPartyCode = model.priceOwnerMaerskPartyCode,
priceOwnerPartyContact = new MSKAPIBookingMandatoryPartyContact { priceOwnerPartyContact = new MSKAPIBookingMandatoryPartyContact
{
name = model.priceOwnerContactName, name = model.priceOwnerContactName,
email = model.priceOwnerContactEmail email = model.priceOwnerContactEmail
}, },
}; };
bookingDto.bookingBody.transport = new MSKAPIBookingTransport { bookingDto.bookingBody.transport = new MSKAPIBookingTransport
{
carrierCode = model.carrierCode, carrierCode = model.carrierCode,
earliestDepartureDate = model.earliestDepartureDate, earliestDepartureDate = model.earliestDepartureDate,
exportServiceMode = model.exportServiceMode, exportServiceMode = model.exportServiceMode,
importServiceMode = model.importServiceMode, importServiceMode = model.importServiceMode,
routeDetails = new MSKAPIBookingRouteDetails { routeDetails = new MSKAPIBookingRouteDetails
placeOfReceipt = new MSKAPIBookingRouteDetailsBase { {
placeOfReceipt = new MSKAPIBookingRouteDetailsBase
{
UNLocationCode = model.placeOfReceiptUnLocCode, UNLocationCode = model.placeOfReceiptUnLocCode,
cityName = model.placeOfReceiptCityName, cityName = model.placeOfReceiptCityName,
}, },
placeOfDelivery = new MSKAPIBookingRouteDetailsBase { placeOfDelivery = new MSKAPIBookingRouteDetailsBase
{
UNLocationCode = model.placeOfDeliveryUnLocCode, UNLocationCode = model.placeOfDeliveryUnLocCode,
cityName = model.placeOfDeliveryCityName, cityName = model.placeOfDeliveryCityName,
}, },
@ -12174,7 +12197,7 @@ namespace Myshipping.Application
throw Oops.Oh($"当前船公司 {model.carrierId} 未配置相应的请求接口"); throw Oops.Oh($"当前船公司 {model.carrierId} 未配置相应的请求接口");
} }
if(string.IsNullOrWhiteSpace(queryUrl)) if (string.IsNullOrWhiteSpace(queryUrl))
throw Oops.Oh("未配置商品请求接口地址,请联系管理员"); throw Oops.Oh("未配置商品请求接口地址,请联系管理员");
var webAccountConfig = _webAccountConfig var webAccountConfig = _webAccountConfig
@ -12183,7 +12206,8 @@ namespace Myshipping.Application
if (webAccountConfig == null) if (webAccountConfig == null)
throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi"); throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi");
MSKAPISearchCommodityDto queryInfo = new MSKAPISearchCommodityDto { MSKAPISearchCommodityDto queryInfo = new MSKAPISearchCommodityDto
{
userKey = App.Configuration["MSKAPIDjyUserKey"], userKey = App.Configuration["MSKAPIDjyUserKey"],
userSecret = App.Configuration["MSKAPIDjyUserSecret"], userSecret = App.Configuration["MSKAPIDjyUserSecret"],
operatingEnvironment = App.Configuration["MSKAPIOPEnvironment"], operatingEnvironment = App.Configuration["MSKAPIOPEnvironment"],
@ -12202,7 +12226,7 @@ namespace Myshipping.Application
{ {
resultInfo = JSON.Deserialize<MSKAPISearchCommodityResultDto>(rlt); resultInfo = JSON.Deserialize<MSKAPISearchCommodityResultDto>(rlt);
} }
catch(Exception ex) catch (Exception ex)
{ {
_logger.LogInformation($"请求MSK API检索商品异常原因{ex.Message}"); _logger.LogInformation($"请求MSK API检索商品异常原因{ex.Message}");

Loading…
Cancel
Save