|
|
|
@ -16,6 +16,7 @@ using Myshipping.Core.Service;
|
|
|
|
|
using Org.BouncyCastle.Asn1.X9;
|
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
@ -74,7 +75,15 @@ namespace Myshipping.Application
|
|
|
|
|
return await InnerExcuteShippingOrderCompareAsync(bookingId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task<TaskManageExcuteResultDto> InnerExcuteShippingOrderCompareAsync(string bookingId)
|
|
|
|
|
#region 执行下货纸比对
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 执行下货纸比对
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bookingId">订舱主键</param>
|
|
|
|
|
/// <param name="LstShipOrderCompareMode">比对模式(MANUAL-手工 AUTO-自动)</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
private async Task<TaskManageExcuteResultDto> InnerExcuteShippingOrderCompareAsync(string bookingId,
|
|
|
|
|
string LstShipOrderCompareMode = "MANUAL")
|
|
|
|
|
{
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
@ -151,21 +160,96 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
if (compareResult.succ)
|
|
|
|
|
{
|
|
|
|
|
orderInfo.LstShipOrderCompareMode = "MANUAL";
|
|
|
|
|
orderInfo.LstShipOrderCompareMode = LstShipOrderCompareMode;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
isComplete标记当票是否满足截至要求
|
|
|
|
|
1、场站返回的记录里所有箱都有了返场日期。
|
|
|
|
|
2、或者当票的实际开船日期或者预计开船日期已到也可以截至。
|
|
|
|
|
*/
|
|
|
|
|
bool isComplete = false;
|
|
|
|
|
bool isBefore = false;
|
|
|
|
|
|
|
|
|
|
//需要细分状态,返场前和返场后
|
|
|
|
|
if (compareResult.yardStatInfo != null)
|
|
|
|
|
{
|
|
|
|
|
var yardStatInfo = compareResult.yardStatInfo as YardStatInfo;
|
|
|
|
|
|
|
|
|
|
//如果场站集装箱都有了返场时间,即认为下货纸自动任务结束
|
|
|
|
|
if (yardStatInfo.LstReturnYardDate.HasValue && yardStatInfo.ContaNum >= 1 &&
|
|
|
|
|
yardStatInfo.ContaNum == yardStatInfo.ExistsReturnYardDateCtnNum)
|
|
|
|
|
{
|
|
|
|
|
isComplete = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (yardStatInfo.ExistsCtnNo < yardStatInfo.ContaNum)
|
|
|
|
|
isBefore = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DateTime etd = DateTime.MinValue;
|
|
|
|
|
if(model.ATD.HasValue)
|
|
|
|
|
{
|
|
|
|
|
etd = model.ATD.Value;
|
|
|
|
|
}
|
|
|
|
|
else if (model.ETD.HasValue)
|
|
|
|
|
{
|
|
|
|
|
etd = model.ETD.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (etd != DateTime.MinValue && etd <= DateTime.Now)
|
|
|
|
|
isComplete = true;
|
|
|
|
|
|
|
|
|
|
if (compareResult.extra.IsExistsDiff)
|
|
|
|
|
{
|
|
|
|
|
if(isComplete)
|
|
|
|
|
{
|
|
|
|
|
orderInfo.LstShipOrderCompareRlt = "DIFF";
|
|
|
|
|
orderInfo.LstShipOrderCompareRltName = "有差异";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (isBefore)
|
|
|
|
|
{
|
|
|
|
|
orderInfo.LstShipOrderCompareRlt = "BEFORE_DIFF";
|
|
|
|
|
orderInfo.LstShipOrderCompareRltName = "返场前比对有差异";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
orderInfo.LstShipOrderCompareRlt = "DIFF_U";
|
|
|
|
|
orderInfo.LstShipOrderCompareRltName = "有差异未结束";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (isComplete)
|
|
|
|
|
{
|
|
|
|
|
orderInfo.LstShipOrderCompareRlt = "NO_DIFF";
|
|
|
|
|
orderInfo.LstShipOrderCompareRltName = "正常";
|
|
|
|
|
|
|
|
|
|
//推送状态JHQ
|
|
|
|
|
if (App.Configuration["ServiceStatusOpenAuto"] == "1")
|
|
|
|
|
//比对成功后触发下货纸比对状态
|
|
|
|
|
var saveStatusRlt = await _bookingValueAddedService.SaveServiceStatus(new ModifyServiceProjectStatusDto
|
|
|
|
|
{
|
|
|
|
|
BookingId = long.Parse(bookingId),
|
|
|
|
|
SourceType = TrackingSourceTypeEnum.AUTO,
|
|
|
|
|
StatusCodes = new List<ModifyServiceProjectStatusDetailDto> {
|
|
|
|
|
new ModifyServiceProjectStatusDetailDto { StatusCode = "XHZBDCHG" } }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 异步推送下货纸比对状态完成,结果={rlt}", batchNo, JSON.Serialize(saveStatusRlt));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (isBefore)
|
|
|
|
|
{
|
|
|
|
|
orderInfo.LstShipOrderCompareRlt = "BEFORE_EQUAL";
|
|
|
|
|
orderInfo.LstShipOrderCompareRltName = "返场前比对正常";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
orderInfo.LstShipOrderCompareRlt = "NO_DIFF_U";
|
|
|
|
|
orderInfo.LstShipOrderCompareRltName = "正常未结束";
|
|
|
|
|
|
|
|
|
|
//比对成功后触发下货纸比对状态
|
|
|
|
|
var saveStatusRlt = await _bookingValueAddedService.SaveServiceStatus(new ModifyServiceProjectStatusDto
|
|
|
|
|
{
|
|
|
|
@ -179,6 +263,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
orderInfo.LstShipOrderCompareRlt = "NO_YARD";
|
|
|
|
@ -219,6 +304,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 批量执行下货纸比对
|
|
|
|
@ -472,7 +558,7 @@ namespace Myshipping.Application
|
|
|
|
|
5、返回回执。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
return await InnerExcuteShippingOrderCompareAsync(bookingId);
|
|
|
|
|
return await InnerExcuteShippingOrderCompareAsync(bookingId, "AUTO");
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|