修改下货纸比对

optimize
jianghaiqing 1 year ago
parent 22d3f61ae6
commit d50ced386e

@ -30,6 +30,11 @@ namespace Myshipping.Application
/// </summary>
public string BusiPKId { get; set; }
/// <summary>
/// 比对ID
/// </summary>
public string TaskCompareId { get; set; }
/// <summary>
/// 用户ID
/// </summary>

@ -39,5 +39,13 @@ namespace Myshipping.Application
/// <param name="bookingId">订舱主键</param>
/// <returns>返回回执</returns>
Task<TaskManageExcuteResultDto> ExcuteAutoShippingOrderCompareAsync(string bookingId);
/// <summary>
/// 获取下货纸比对结果
/// </summary>
/// <param name="bookingId">订舱主键</param>
/// <returns>返回回执</returns>
Task<TaskManageExcuteResultDto> GetShippingOrderCompareResult(long bookingId);
}
}

@ -561,5 +561,102 @@ namespace Myshipping.Application
return await InnerExcuteShippingOrderCompareAsync(bookingId, "AUTO");
}
#endregion
/// <summary>
/// 获取下货纸比对结果
/// </summary>
/// <param name="bookingId">订舱主键</param>
/// <returns>返回回执</returns>
[HttpGet("/TaskShippingOrderCompare/GetShippingOrderCompareResult")]
public async Task<TaskManageExcuteResultDto> GetShippingOrderCompareResult(long bookingId)
{
string batchNo = IDGen.NextID().ToString();
TaskManageExcuteResultDto result = new TaskManageExcuteResultDto();
try
{
var model = _bookingOrderRepository.AsQueryable().Filter(null, true)
.First(a => a.Id == bookingId && !a.IsDeleted && a.TenantId == UserManager.TENANT_ID);
DateTime nowDate = DateTime.Now;
TaskMessageInfoDto msgModel = new TaskMessageInfoDto
{
Head = new TaskMessageHead
{
GID = batchNo,
MessageType = "DRAFT_COMPARE",
SenderId = App.Configuration["RulesEngineSender"],
SenderName = App.Configuration["RulesEngineSenderName"],
ReceiverId = "RulesEngine",
ReceiverName = "大简云规则引擎",
Version = "1.0",
RequestDate = nowDate.ToString("yyyy-MM-dd HH:mm:ss"),
RequestAction = "Compare",
},
Main = new TaskMessageMain
{
BusiPKId = bookingId.ToString(),
TaskCompareId = model.LstShipOrderCompareId,
}
};
_logger.LogInformation($"开始请求查询 msg={JSON.Serialize(msgModel)}");
result = await GetCompareResult(msgModel);
}
catch (Exception ex)
{
_logger.LogInformation("获取Draft比对结果异常原因{error}", ex.Message);
throw Oops.Oh($"获取Draft比对结果异常原因{ex.Message}");
}
return result;
}
#region 获取Draft比对结果
/// <summary>
/// 获取Draft比对结果
/// </summary>
/// <param name="info">请求报文</param>
/// <returns>返回回执</returns>
[NonAction]
private async Task<TaskManageExcuteResultDto> GetCompareResult(TaskMessageInfoDto info)
{
TaskManageExcuteResultDto model = null;
var url = App.Configuration["GetShippingOrderCompareUrl"];
try
{
var res = await url.SetHttpMethod(HttpMethod.Post)
.SetBody(JSON.Serialize(info), "application/json")
.SetContentEncoding(Encoding.UTF8)
.PostAsync();
_logger.LogInformation("批次={no} 对应请求报文完成 res={res}", info.Head.GID, JSON.Serialize(res));
if (res.StatusCode == System.Net.HttpStatusCode.OK)
{
var userResult = await res.Content.ReadAsStringAsync();
_logger.LogInformation("对应请求报文 userResult={userResult}", userResult);
model = JSON.Deserialize<TaskManageExcuteResultDto>(userResult);
}
}
catch (Exception ex)
{
//写日志
if (ex is HttpRequestException)
throw Oops.Oh(10000002);
}
return model;
}
#endregion
}
}

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2023-09-04T09:20:02.6360803Z;True|2023-09-04T10:10:54.4958128+08:00;</History>
<History>True|2023-09-11T12:42:58.0481784Z;True|2023-09-11T20:42:47.7986046+08:00;True|2023-09-04T17:20:02.6360803+08:00;True|2023-09-04T10:10:54.4958128+08:00;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
Loading…
Cancel
Save