|
|
|
@ -1093,7 +1093,7 @@ namespace Myshipping.Application
|
|
|
|
|
[HttpPost("/BookingSlot/refreshAllStock")]
|
|
|
|
|
public async Task RefreshAllStock([FromBody] long telentId)
|
|
|
|
|
{
|
|
|
|
|
await _repStock.DeleteAsync(x => x.TenantId == telentId);
|
|
|
|
|
var n = await _repStock.DeleteAsync(x => x.TenantId == telentId);
|
|
|
|
|
|
|
|
|
|
var logger = App.GetService<ILogger<BookingSlotStockSubscriber>>();
|
|
|
|
|
BookingSlotStockSubscriber subscriber = new BookingSlotStockSubscriber(logger);
|
|
|
|
@ -1146,6 +1146,11 @@ namespace Myshipping.Application
|
|
|
|
|
.Select(x => new BookingSlotBase()
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
VESSEL = x.VESSEL,
|
|
|
|
|
VOYNO = x.VOYNO,
|
|
|
|
|
CARRIERID = x.CARRIERID,
|
|
|
|
|
CONTRACT_NO = x.CONTRACT_NO,
|
|
|
|
|
BOOKING_SLOT_TYPE = x.BOOKING_SLOT_TYPE,
|
|
|
|
|
SLOT_BOOKING_NO = x.SLOT_BOOKING_NO,
|
|
|
|
|
PLACERECEIPT = x.PLACERECEIPT,
|
|
|
|
|
PLACEDELIVERY = x.PLACEDELIVERY,
|
|
|
|
@ -1155,6 +1160,7 @@ namespace Myshipping.Application
|
|
|
|
|
PORTDISCHARGE = x.PORTDISCHARGE,
|
|
|
|
|
PORTDISCHARGE_COUNTRY_CODE = x.PORTDISCHARGE_COUNTRY_CODE,
|
|
|
|
|
PORTDISCHARGE_COUNTRY = x.PORTDISCHARGE_COUNTRY,
|
|
|
|
|
TenantId = x.TenantId
|
|
|
|
|
})
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
HashSet<long> updateIdSet = new HashSet<long>();
|
|
|
|
@ -1191,11 +1197,11 @@ namespace Myshipping.Application
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName2))
|
|
|
|
|
{
|
|
|
|
|
var portInfo = await PlaceToPortHelper.PlaceDeliveryToPort(portEnName2, cachePort, () => _cache.GetAllMappingPort());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (portInfo != null
|
|
|
|
|
&& (string.IsNullOrEmpty(item.PORTDISCHARGEID)
|
|
|
|
|
|| string.IsNullOrEmpty(item.PORTDISCHARGE)
|
|
|
|
|
|| string.IsNullOrEmpty(item.PORTDISCHARGE_COUNTRY_CODE)
|
|
|
|
|
&& (string.IsNullOrEmpty(item.PORTDISCHARGEID)
|
|
|
|
|
|| string.IsNullOrEmpty(item.PORTDISCHARGE)
|
|
|
|
|
|| string.IsNullOrEmpty(item.PORTDISCHARGE_COUNTRY_CODE)
|
|
|
|
|
|| string.IsNullOrEmpty(item.PORTDISCHARGE_COUNTRY)))
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(item.PORTDISCHARGEID))
|
|
|
|
@ -1239,38 +1245,39 @@ namespace Myshipping.Application
|
|
|
|
|
x.PORTDISCHARGE_COUNTRY,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
//var group = updateList.Where(x => !string.IsNullOrEmpty(x.VESSEL)
|
|
|
|
|
// && !string.IsNullOrEmpty(x.VOYNO)
|
|
|
|
|
// && !string.IsNullOrEmpty(x.CONTRACT_NO)
|
|
|
|
|
// && !string.IsNullOrEmpty(x.BOOKING_SLOT_TYPE)
|
|
|
|
|
// && !string.IsNullOrEmpty(x.CARRIERID)
|
|
|
|
|
// && !string.IsNullOrEmpty(x.PORTLOADID)
|
|
|
|
|
// && !string.IsNullOrEmpty(x.PORTDISCHARGEID))
|
|
|
|
|
// .GroupBy(x => new
|
|
|
|
|
// {
|
|
|
|
|
// x.VESSEL,
|
|
|
|
|
// x.VOYNO,
|
|
|
|
|
// x.CARRIERID,
|
|
|
|
|
// x.BOOKING_SLOT_TYPE,
|
|
|
|
|
// x.PORTDISCHARGEID,
|
|
|
|
|
// x.PORTLOADID,
|
|
|
|
|
// x.CONTRACT_NO
|
|
|
|
|
// }).ToList();
|
|
|
|
|
|
|
|
|
|
//foreach (var item in group)
|
|
|
|
|
//{
|
|
|
|
|
// await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
|
|
|
|
|
// {
|
|
|
|
|
// BOOKING_SLOT_TYPE = item.Key.BOOKING_SLOT_TYPE,
|
|
|
|
|
// CARRIERID = item.Key.CARRIERID,
|
|
|
|
|
// CONTRACT_NO = item.Key.CONTRACT_NO,
|
|
|
|
|
// VESSEL = item.Key.VESSEL,
|
|
|
|
|
// VOYNO = item.Key.VOYNO,
|
|
|
|
|
// PORTLOADID = item.Key.PORTLOADID,
|
|
|
|
|
// PORTDISCHARGEID = item.Key.PORTDISCHARGEID,
|
|
|
|
|
// TenantId = UserManager.TENANT_ID
|
|
|
|
|
// }));
|
|
|
|
|
//}
|
|
|
|
|
var group = updateList.Where(x => !string.IsNullOrEmpty(x.VESSEL)
|
|
|
|
|
&& !string.IsNullOrEmpty(x.VOYNO)
|
|
|
|
|
&& !string.IsNullOrEmpty(x.CONTRACT_NO)
|
|
|
|
|
&& !string.IsNullOrEmpty(x.BOOKING_SLOT_TYPE)
|
|
|
|
|
&& !string.IsNullOrEmpty(x.CARRIERID)
|
|
|
|
|
&& !string.IsNullOrEmpty(x.PORTLOADID)
|
|
|
|
|
&& !string.IsNullOrEmpty(x.PORTDISCHARGEID))
|
|
|
|
|
.GroupBy(x => new
|
|
|
|
|
{
|
|
|
|
|
x.VESSEL,
|
|
|
|
|
x.VOYNO,
|
|
|
|
|
x.CARRIERID,
|
|
|
|
|
x.BOOKING_SLOT_TYPE,
|
|
|
|
|
x.PORTDISCHARGEID,
|
|
|
|
|
x.PORTLOADID,
|
|
|
|
|
x.CONTRACT_NO,
|
|
|
|
|
x.TenantId
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var item in group)
|
|
|
|
|
{
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
|
|
|
|
|
{
|
|
|
|
|
BOOKING_SLOT_TYPE = item.Key.BOOKING_SLOT_TYPE,
|
|
|
|
|
CARRIERID = item.Key.CARRIERID,
|
|
|
|
|
CONTRACT_NO = item.Key.CONTRACT_NO,
|
|
|
|
|
VESSEL = item.Key.VESSEL,
|
|
|
|
|
VOYNO = item.Key.VOYNO,
|
|
|
|
|
PORTLOADID = item.Key.PORTLOADID,
|
|
|
|
|
PORTDISCHARGEID = item.Key.PORTDISCHARGEID,
|
|
|
|
|
TenantId = item.Key.TenantId
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|