wanghaomei 8 months ago
commit 7611609ccd

@ -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;

@ -433,7 +433,7 @@ namespace Myshipping.Application
/// <summary>
/// 最后BC接收时间
/// </summary>
public bool LstRecvBCDate { get; set; }
public Nullable<DateTime> LstRecvBCDate { get; set; }
/// <summary>
/// 是否已有BookingCancellation
@ -443,7 +443,7 @@ namespace Myshipping.Application
/// <summary>
/// 最后BookingCancellation接收时间
/// </summary>
public bool LstRecvBKCancelDate { get; set; }
public Nullable<DateTime> LstRecvBKCancelDate { get; set; }
/// <summary>
/// 预计航行天数

@ -377,17 +377,29 @@ namespace Myshipping.Application
// 舱单主单
var mainSeaOrder = waitCheckSeaList.FirstOrDefault(x => string.IsNullOrWhiteSpace(x.HBLNO));
// 是否检验舱单主单
var isCheckMainSea = true;
if (mainSeaOrder == null)
{
isCheckMainSea = false;
mainSeaOrder = await _seaeedi.AsQueryable().Filter(null, true).Where(x => x.BookingId == bkOrderId && string.IsNullOrWhiteSpace(x.HBLNO)).FirstAsync();
}
// 舱单分单
var subSeaOrderList = waitCheckSeaList.Where(x => !string.IsNullOrWhiteSpace(x.HBLNO)).ToList();
// 校验1船名航次唛头货描 ,起运港,卸货港,主单提单号
if (bkOrder.MBLNO != mainSeaOrder.MBLNO) checkResult.Add("舱单主单与订舱【提单号】不一致");
if (bkOrder.VESSEL != mainSeaOrder.VESSEL) checkResult.Add("舱单主单与订舱【船名】不一致");
if (bkOrder.VOYNO != mainSeaOrder.VOYNO) checkResult.Add("舱单主单与订舱【航次】不一致");
if (bkOrder.MARKS != mainSeaOrder.MARKS) checkResult.Add("舱单主单与订舱【唛头】不一致");
if (bkOrder.DESCRIPTION != mainSeaOrder.DESCRIPTION) checkResult.Add("舱单主单与订舱【货描】不一致");
if (bkOrder.PORTLOADID != mainSeaOrder.PORTLOADID || bkOrder.PORTLOAD != mainSeaOrder.PORTLOAD) checkResult.Add("舱单主单与订舱【起运港】不一致");
if (bkOrder.PORTDISCHARGEID != mainSeaOrder.PORTDISCHARGEID || bkOrder.PORTDISCHARGE != mainSeaOrder.PORTDISCHARGE) checkResult.Add("舱单主单与订舱【卸货港】不一致");
if (isCheckMainSea)
{
if (bkOrder.MBLNO != mainSeaOrder.MBLNO) checkResult.Add("舱单主单与订舱【提单号】不一致");
if (bkOrder.VESSEL != mainSeaOrder.VESSEL) checkResult.Add("舱单主单与订舱【船名】不一致");
if (bkOrder.VOYNO != mainSeaOrder.VOYNO) checkResult.Add("舱单主单与订舱【航次】不一致");
if (bkOrder.MARKS != mainSeaOrder.MARKS) checkResult.Add("舱单主单与订舱【唛头】不一致");
if (bkOrder.DESCRIPTION != mainSeaOrder.DESCRIPTION) checkResult.Add("舱单主单与订舱【货描】不一致");
if (bkOrder.PORTLOADID != mainSeaOrder.PORTLOADID || bkOrder.PORTLOAD != mainSeaOrder.PORTLOAD) checkResult.Add("舱单主单与订舱【起运港】不一致");
if (bkOrder.PORTDISCHARGEID != mainSeaOrder.PORTDISCHARGEID || bkOrder.PORTDISCHARGE != mainSeaOrder.PORTDISCHARGE) checkResult.Add("舱单主单与订舱【卸货港】不一致");
}
subSeaOrderList.ForEach(x =>
{
if (bkOrder.VESSEL != x.VESSEL) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【船名】不一致");
@ -403,35 +415,38 @@ namespace Myshipping.Application
var = waitCheckSeaCtnList.Where(x => x.PId == mainSeaOrder.Id).ToList();
var = waitCheckSeaCtnList.Where(x => x.PId != mainSeaOrder.Id).ToList();
foreach (var item in .GroupBy(x => x.CNTRNO))
if (isCheckMainSea)
{
if (item.Sum(x => x.PKGS) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【件数】与订舱中同箱号箱子的【件数】不一致");
}
if (item.Sum(x => x.KGS) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
foreach (var item in .GroupBy(x => x.CNTRNO))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【重量】与订舱中同箱号箱子的【重量】不一致");
}
if (item.Sum(x => x.CBM) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【尺码】与订舱中同箱号箱子的【尺码】不一致");
if (item.Sum(x => x.PKGS) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【件数】与订舱中同箱号箱子的【件数】不一致");
}
if (item.Sum(x => x.KGS) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【重量】与订舱中同箱号箱子的【重量】不一致");
}
if (item.Sum(x => x.CBM) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【尺码】与订舱中同箱号箱子的【尺码】不一致");
}
}
}
foreach (var item in .GroupBy(x => x.CNTRNO))
{
if (item.Sum(x => x.PKGS) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
if (item.Sum(x => x.PKGS) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总件数】大于主单中同箱号箱子的件数");
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总件数】大于订舱中同箱号箱子的件数");
}
if (item.Sum(x => x.KGS) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
if (item.Sum(x => x.KGS) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总重量】大于主单中同箱号箱子的重量");
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总重量】大于订舱中同箱号箱子的重量");
}
if (item.Sum(x => x.CBM) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
if (item.Sum(x => x.CBM) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总尺码】大于主单中同箱号箱子的尺码");
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总尺码】大于订舱中同箱号箱子的尺码");
}
}
@ -440,25 +455,28 @@ namespace Myshipping.Application
var = .Select(x => $"箱号[{x.CNTRNO}] 封号[{x.SEALNO}] 箱型[{x.CTNALL.Replace("'", "")}]").ToList();
var = .Select(x => $"箱号[{x.CNTRNO}] 封号[{x.SEALNO}] 箱型[{x.CTNALL.Replace("'", "")}]").Distinct().ToList();
var list1 = .Except();
if (list1.Any())
{
checkResult.Add($"订舱中的下列箱信息在舱单主单中不存在:{string.Join("", list1)}");
}
else
if (isCheckMainSea)
{
var list2 = .Except();
if (list2.Any())
var list1 = .Except();
if (list1.Any())
{
checkResult.Add($"单主单中的下列箱信息在舱中不存在:{string.Join("", list2)}");
checkResult.Add($"订舱中的下列箱信息在舱单主单中不存在:{string.Join("", list1)}");
}
var list3 = .Except();
if (list3.Any())
else
{
checkResult.Add($"舱单分单中存在未知的箱信息:{string.Join("", list3)}");
var list2 = .Except();
if (list2.Any())
{
checkResult.Add($"舱单主单中的下列箱信息在订舱中不存在:{string.Join("", list2)}");
}
}
}
var list3 = .Except();
if (list3.Any())
{
checkResult.Add($"舱单分单中存在未知的箱信息:{string.Join("", list3)}");
}
if (checkResult.Count > 0)
{

@ -16,5 +16,10 @@ namespace Myshipping.Core.Const
/// 我的任务台账
/// </summary>
public const long MenuTaskManage = 375504048771141;
/// <summary>
/// 马士基API订舱
/// </summary>
public const long MenuMSKApi = 526643045195845;
}
}

@ -842,6 +842,11 @@
我的任务台账
</summary>
</member>
<member name="F:Myshipping.Core.Const.MenuConst.MenuMSKApi">
<summary>
马士基API订舱
</summary>
</member>
<member name="T:Myshipping.Core.Const.TenantParamCode">
<summary>
租户参数Code常量

Loading…
Cancel
Save