|
|
@ -1091,7 +1091,7 @@ namespace Myshipping.Application
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("/BookingSlot/refreshAllStock")]
|
|
|
|
[HttpPost("/BookingSlot/refreshAllStock")]
|
|
|
|
public async Task RefreshAllStock([FromBody] long telentId)
|
|
|
|
public async Task RefreshAllStock([FromQuery] long telentId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var n = await _repStock.DeleteAsync(x => x.TenantId == telentId);
|
|
|
|
var n = await _repStock.DeleteAsync(x => x.TenantId == telentId);
|
|
|
|
|
|
|
|
|
|
|
@ -1131,18 +1131,18 @@ namespace Myshipping.Application
|
|
|
|
/// 根据某租户下面所有收货地、交货地、计算出装货港、卸货港
|
|
|
|
/// 根据某租户下面所有收货地、交货地、计算出装货港、卸货港
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
[HttpPost("/BookingSlot/refreshAllPort")]
|
|
|
|
[HttpPost("/BookingSlot/refreshAllPort")]
|
|
|
|
public async Task RefreshAllPort([FromBody] long telentId)
|
|
|
|
public async Task RefreshAllPort([FromQuery] long? telentId, [FromQuery] int? type)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var cachePort = await _cache.GetAllCodePort();
|
|
|
|
var cachePort = await _cache.GetAllCodePort();
|
|
|
|
var cachePortLoad = await _cache.GetAllCodePortLoad();
|
|
|
|
var cachePortLoad = await _cache.GetAllCodePortLoad();
|
|
|
|
|
|
|
|
|
|
|
|
var list = await _repBase.AsQueryable().Filter(null, true)
|
|
|
|
var list = await _repBase.AsQueryable().Filter(null, true)
|
|
|
|
.Where(x => x.TenantId == telentId
|
|
|
|
.Where(x => x.IsDeleted == false && x.IS_CANCELLATION == false)
|
|
|
|
&& x.IsDeleted == false
|
|
|
|
.WhereIF(telentId != null, x => x.TenantId == telentId)
|
|
|
|
&& x.IS_CANCELLATION == false
|
|
|
|
.WhereIF(type == 1, x => !string.IsNullOrEmpty(x.PLACERECEIPT) && (string.IsNullOrEmpty(x.PORTLOADID) || string.IsNullOrEmpty(x.PORTLOAD)))
|
|
|
|
&& !string.IsNullOrEmpty(x.PLACERECEIPT)
|
|
|
|
.WhereIF(type == 2, x => !string.IsNullOrEmpty(x.PLACEDELIVERY) && (string.IsNullOrEmpty(x.PORTDISCHARGEID) || string.IsNullOrEmpty(x.PORTDISCHARGE)))
|
|
|
|
&& !string.IsNullOrEmpty(x.PLACEDELIVERY)
|
|
|
|
.WhereIF(type == null, x => (!string.IsNullOrEmpty(x.PLACERECEIPT) || !string.IsNullOrEmpty(x.PLACEDELIVERY))
|
|
|
|
&& (string.IsNullOrEmpty(x.PORTLOADID) || string.IsNullOrEmpty(x.PORTDISCHARGEID)))
|
|
|
|
&& (string.IsNullOrEmpty(x.PORTDISCHARGE) || string.IsNullOrEmpty(x.PORTDISCHARGEID) || string.IsNullOrEmpty(x.PORTLOAD) || string.IsNullOrEmpty(x.PORTLOADID)))
|
|
|
|
.Select(x => new BookingSlotBase()
|
|
|
|
.Select(x => new BookingSlotBase()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Id = x.Id,
|
|
|
|
Id = x.Id,
|
|
|
@ -1168,6 +1168,8 @@ namespace Myshipping.Application
|
|
|
|
foreach (var item in list)
|
|
|
|
foreach (var item in list)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 解析收货地,得到装货港名称及五字码
|
|
|
|
// 解析收货地,得到装货港名称及五字码
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(item.PLACERECEIPT))
|
|
|
|
|
|
|
|
{
|
|
|
|
var portEnName = item.PLACERECEIPT.Split(',')[0]?.Trim();
|
|
|
|
var portEnName = item.PLACERECEIPT.Split(',')[0]?.Trim();
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName)
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName)
|
|
|
|
&& (string.IsNullOrEmpty(item.PORTLOADID) || string.IsNullOrEmpty(item.PORTLOAD)))
|
|
|
|
&& (string.IsNullOrEmpty(item.PORTLOADID) || string.IsNullOrEmpty(item.PORTLOAD)))
|
|
|
@ -1175,14 +1177,14 @@ namespace Myshipping.Application
|
|
|
|
var portInfo = await PlaceToPortHelper.PlaceReceiptToPortload(portEnName, cachePortLoad, () => _cache.GetAllMappingPortLoad());
|
|
|
|
var portInfo = await PlaceToPortHelper.PlaceReceiptToPortload(portEnName, cachePortLoad, () => _cache.GetAllMappingPortLoad());
|
|
|
|
if (portInfo != null)
|
|
|
|
if (portInfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(item.PORTLOADID))
|
|
|
|
//if (string.IsNullOrEmpty(item.PORTLOADID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
updateIdSet.Add(item.Id);
|
|
|
|
updateIdSet.Add(item.Id);
|
|
|
|
item.PORTLOADID = portInfo.EdiCode;
|
|
|
|
item.PORTLOADID = portInfo.EdiCode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(item.PORTLOAD))
|
|
|
|
//if (string.IsNullOrEmpty(item.PORTLOAD))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
updateIdSet.Add(item.Id);
|
|
|
|
//updateIdSet.Add(item.Id);
|
|
|
|
item.PORTLOAD = portInfo.EnName;
|
|
|
|
item.PORTLOAD = portInfo.EnName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1191,8 +1193,11 @@ namespace Myshipping.Application
|
|
|
|
_logger.LogInformation("通过收货地城市名称未匹配到港口信息,订舱编号:{SLOT_BOOKING_NO}", item.SLOT_BOOKING_NO);
|
|
|
|
_logger.LogInformation("通过收货地城市名称未匹配到港口信息,订舱编号:{SLOT_BOOKING_NO}", item.SLOT_BOOKING_NO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 解析交货地,得到为卸货港名称及五字码, 以及国家信息
|
|
|
|
// 解析交货地,得到为卸货港名称及五字码, 以及国家信息
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(item.PLACEDELIVERY))
|
|
|
|
|
|
|
|
{
|
|
|
|
var portEnName2 = item.PLACEDELIVERY.Split(',')[0]?.Trim();
|
|
|
|
var portEnName2 = item.PLACEDELIVERY.Split(',')[0]?.Trim();
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName2))
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName2))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1204,24 +1209,24 @@ namespace Myshipping.Application
|
|
|
|
|| string.IsNullOrEmpty(item.PORTDISCHARGE_COUNTRY_CODE)
|
|
|
|
|| string.IsNullOrEmpty(item.PORTDISCHARGE_COUNTRY_CODE)
|
|
|
|
|| string.IsNullOrEmpty(item.PORTDISCHARGE_COUNTRY)))
|
|
|
|
|| string.IsNullOrEmpty(item.PORTDISCHARGE_COUNTRY)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(item.PORTDISCHARGEID))
|
|
|
|
//if (string.IsNullOrEmpty(item.PORTDISCHARGEID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
updateIdSet.Add(item.Id);
|
|
|
|
updateIdSet.Add(item.Id);
|
|
|
|
item.PORTDISCHARGEID = portInfo.EdiCode;
|
|
|
|
item.PORTDISCHARGEID = portInfo.EdiCode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(item.PORTDISCHARGE))
|
|
|
|
//if (string.IsNullOrEmpty(item.PORTDISCHARGE))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
updateIdSet.Add(item.Id);
|
|
|
|
//updateIdSet.Add(item.Id);
|
|
|
|
item.PORTDISCHARGE = portInfo.EnName;
|
|
|
|
item.PORTDISCHARGE = portInfo.EnName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(item.PORTDISCHARGE_COUNTRY_CODE))
|
|
|
|
//if (string.IsNullOrEmpty(item.PORTDISCHARGE_COUNTRY_CODE))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
updateIdSet.Add(item.Id);
|
|
|
|
//updateIdSet.Add(item.Id);
|
|
|
|
item.PORTDISCHARGE_COUNTRY_CODE = portInfo.CountryCode;
|
|
|
|
item.PORTDISCHARGE_COUNTRY_CODE = portInfo.CountryCode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(item.PORTDISCHARGE_COUNTRY))
|
|
|
|
//if (string.IsNullOrEmpty(item.PORTDISCHARGE_COUNTRY))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
updateIdSet.Add(item.Id);
|
|
|
|
//updateIdSet.Add(item.Id);
|
|
|
|
item.PORTDISCHARGE_COUNTRY = portInfo.Country;
|
|
|
|
item.PORTDISCHARGE_COUNTRY = portInfo.Country;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1231,11 +1236,25 @@ namespace Myshipping.Application
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (updateIdSet.Count > 0)
|
|
|
|
if (updateIdSet.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var updateList = list.Where(x => updateIdSet.Contains(x.Id)).ToList();
|
|
|
|
var updateList = list.Where(x => updateIdSet.Contains(x.Id)).ToList();
|
|
|
|
await _repBase.AsUpdateable(updateList).UpdateColumns(x => new
|
|
|
|
await _repBase.AsUpdateable(updateList)
|
|
|
|
|
|
|
|
.UpdateColumnsIF(type == 1, x => new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
x.PORTLOADID,
|
|
|
|
|
|
|
|
x.PORTLOAD,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.UpdateColumnsIF(type == 2, x => new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
x.PORTDISCHARGEID,
|
|
|
|
|
|
|
|
x.PORTDISCHARGE,
|
|
|
|
|
|
|
|
x.PORTDISCHARGE_COUNTRY_CODE,
|
|
|
|
|
|
|
|
x.PORTDISCHARGE_COUNTRY,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.UpdateColumnsIF(type == null, x => new
|
|
|
|
{
|
|
|
|
{
|
|
|
|
x.PORTLOADID,
|
|
|
|
x.PORTLOADID,
|
|
|
|
x.PORTDISCHARGEID,
|
|
|
|
x.PORTDISCHARGEID,
|
|
|
@ -1263,9 +1282,11 @@ namespace Myshipping.Application
|
|
|
|
x.CONTRACT_NO,
|
|
|
|
x.CONTRACT_NO,
|
|
|
|
x.TenantId
|
|
|
|
x.TenantId
|
|
|
|
}).ToList();
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
_ = Task.Run(async () =>
|
|
|
|
|
|
|
|
{
|
|
|
|
foreach (var item in group)
|
|
|
|
foreach (var item in group)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
await Task.Delay(1000);
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BOOKING_SLOT_TYPE = item.Key.BOOKING_SLOT_TYPE,
|
|
|
|
BOOKING_SLOT_TYPE = item.Key.BOOKING_SLOT_TYPE,
|
|
|
@ -1278,6 +1299,7 @@ namespace Myshipping.Application
|
|
|
|
TenantId = item.Key.TenantId
|
|
|
|
TenantId = item.Key.TenantId
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|