|
|
|
@ -18,6 +18,7 @@ using Microsoft.Extensions.Logging;
|
|
|
|
|
using Myshipping.Application.Helper;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using Myshipping.Core.Const;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
{
|
|
|
|
@ -32,6 +33,7 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
|
private readonly IDjyWebsiteAccountConfigService _webAccountConfig;
|
|
|
|
|
private readonly ILogger<BookingMSKAPIService> _logger;
|
|
|
|
|
private readonly ISysDataUserMenu _sysDataUserMenuService;
|
|
|
|
|
|
|
|
|
|
const string CONST_MSK_API_COMMODITY_URL = "MSKApiCommodity";
|
|
|
|
|
const string CONST_MSK_API_BOOKING_URL = "MSKApiBooking";
|
|
|
|
@ -40,6 +42,7 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
|
|
|
|
|
public BookingMSKAPIService(ILogger<BookingMSKAPIService> logger, ISysCacheService cache,
|
|
|
|
|
IDjyWebsiteAccountConfigService webAccountConfig, SqlSugarRepository<BookingDeliveryRecord> bookingDeliveryRecordRep,
|
|
|
|
|
ISysDataUserMenu sysDataUserMenuService,
|
|
|
|
|
SqlSugarRepository<BookingDeliveryRecordCtn> bookingDeliveryRecordCtnRep)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
@ -47,7 +50,7 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
_webAccountConfig = webAccountConfig;
|
|
|
|
|
_bookingDeliveryRecordRep = bookingDeliveryRecordRep;
|
|
|
|
|
_bookingDeliveryRecordCtnRep = bookingDeliveryRecordCtnRep;
|
|
|
|
|
|
|
|
|
|
_sysDataUserMenuService = sysDataUserMenuService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 检索海运船期详情
|
|
|
|
@ -327,14 +330,14 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
{
|
|
|
|
|
placeOfReceipt = new MSKAPIBookingRouteDetailsBase
|
|
|
|
|
{
|
|
|
|
|
UNLocationCode = model.isSendNoSchedule ? model.userPlaceOfReceiptUnLocCode
|
|
|
|
|
: model.placeOfReceiptUnLocCode,
|
|
|
|
|
UNLocationCode = model.userPlaceOfReceiptUnLocCode
|
|
|
|
|
//: model.placeOfReceiptUnLocCode,
|
|
|
|
|
//cityName = model.placeOfReceiptCityName,
|
|
|
|
|
},
|
|
|
|
|
placeOfDelivery = new MSKAPIBookingRouteDetailsBase
|
|
|
|
|
{
|
|
|
|
|
UNLocationCode = model.isSendNoSchedule ? model.userPlaceOfDeliveryUnLocCode
|
|
|
|
|
: model.placeOfDeliveryUnLocCode,
|
|
|
|
|
UNLocationCode = model.userPlaceOfDeliveryUnLocCode
|
|
|
|
|
//: model.placeOfDeliveryUnLocCode,
|
|
|
|
|
//cityName = model.placeOfDeliveryCityName,
|
|
|
|
|
},
|
|
|
|
|
selectedRoute = new MSKAPIBookingRoute
|
|
|
|
@ -356,14 +359,14 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
startLocation = new MSKAPIBookingRouteDetailsBase
|
|
|
|
|
{
|
|
|
|
|
//cityName = model.placeOfReceiptCityName,
|
|
|
|
|
UNLocationCode = model.isSendNoSchedule ? model.userPlaceOfReceiptUnLocCode
|
|
|
|
|
: model.placeOfReceiptUnLocCode
|
|
|
|
|
UNLocationCode = model.userPlaceOfReceiptUnLocCode
|
|
|
|
|
//: model.placeOfReceiptUnLocCode
|
|
|
|
|
},
|
|
|
|
|
endLocation = new MSKAPIBookingRouteDetailsBase
|
|
|
|
|
{
|
|
|
|
|
//cityName = model.placeOfDeliveryCityName,
|
|
|
|
|
UNLocationCode = model.isSendNoSchedule ? model.userPlaceOfDeliveryUnLocCode
|
|
|
|
|
: model.placeOfDeliveryUnLocCode
|
|
|
|
|
UNLocationCode = model.userPlaceOfDeliveryUnLocCode
|
|
|
|
|
//: model.placeOfDeliveryUnLocCode
|
|
|
|
|
},
|
|
|
|
|
transportModeCode = model.transportMode
|
|
|
|
|
}
|
|
|
|
@ -635,8 +638,14 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
if(!model.earliestDepartureDate.HasValue)
|
|
|
|
|
throw Oops.Bah($"预计离港日期必填");
|
|
|
|
|
|
|
|
|
|
if (!model.isSendNoSchedule && string.IsNullOrWhiteSpace(model.carrierProductId))
|
|
|
|
|
throw Oops.Bah($"船期信息不能为空,请查询船期信息");
|
|
|
|
|
if(string.IsNullOrWhiteSpace(model.userPlaceOfReceiptUnLocCode))
|
|
|
|
|
throw Oops.Bah($"始发地必填");
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.userPlaceOfDeliveryUnLocCode))
|
|
|
|
|
throw Oops.Bah($"目的地必填");
|
|
|
|
|
|
|
|
|
|
//if (!model.isSendNoSchedule && string.IsNullOrWhiteSpace(model.carrierProductId))
|
|
|
|
|
// throw Oops.Bah($"船期信息不能为空,请查询船期信息");
|
|
|
|
|
|
|
|
|
|
if (model.isReefer)
|
|
|
|
|
{
|
|
|
|
@ -977,8 +986,21 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
//这里因为返回给前端的台账数据是DTO,所以这里排序时候需要转换成Entity对应的字段
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.SortField))
|
|
|
|
|
entityOrderCol = MapsterExtHelper.GetAdaptProperty<BookingDeliveryRecordDto, BookingDeliveryRecord>(QuerySearch.SortField);
|
|
|
|
|
|
|
|
|
|
//菜单375504048771141=我的任务台账
|
|
|
|
|
List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuMSKApi);
|
|
|
|
|
|
|
|
|
|
if (userlist == null)
|
|
|
|
|
userlist = new List<long> { UserManager.UserId };
|
|
|
|
|
|
|
|
|
|
if (userlist.Count > 0)
|
|
|
|
|
userlist = userlist.Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("任务台账权限范围 {list}", userlist);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entities = await _bookingDeliveryRecordRep.AsQueryable()
|
|
|
|
|
.Where(t => userlist.Contains(t.CreatedUserId.Value))
|
|
|
|
|
.WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value >= createBegin)
|
|
|
|
|
.WhereIF(createEnd != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value < createEnd)
|
|
|
|
|
.WhereIF(updateBegin != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value >= updateBegin)
|
|
|
|
@ -1153,6 +1175,7 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
x.TenantId,
|
|
|
|
|
x.STUFFING_MEASUREMENT_TYPE,
|
|
|
|
|
x.STUFFING_MEASUREMENT_UNIT,
|
|
|
|
|
x.CTN_SUFFER_WEIGHT
|
|
|
|
|
}).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -1161,7 +1184,8 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
{
|
|
|
|
|
CTN_CODE = ctn.ctnCode,
|
|
|
|
|
CTN_NAME = ctn.ctnName,
|
|
|
|
|
CTN_NUM = ctn.ctnNum.Value
|
|
|
|
|
CTN_NUM = ctn.ctnNum.Value,
|
|
|
|
|
CTN_SUFFER_WEIGHT = (int)ctn.ctnSufferWeight.Value,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ctnEntity.RECORD_ID = entity.Id;
|
|
|
|
@ -1218,7 +1242,8 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
var ctnEntity = new BookingDeliveryRecordCtn {
|
|
|
|
|
CTN_CODE = ctn.ctnCode,
|
|
|
|
|
CTN_NAME = ctn.ctnName,
|
|
|
|
|
CTN_NUM = ctn.ctnNum.Value
|
|
|
|
|
CTN_NUM = ctn.ctnNum.Value,
|
|
|
|
|
CTN_SUFFER_WEIGHT = (int)ctn.ctnSufferWeight.Value,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ctnEntity.RECORD_ID = entity.Id;
|
|
|
|
|