日志记录调整:货物状态相关

optimize
zhangxiaofeng 10 months ago
parent ecbf91a11c
commit 3da4d35738

@ -10422,8 +10422,9 @@ namespace Myshipping.Application
/// <param name="code">服务状态代码</param>
/// <param name="bookingId">订舱ID</param>
/// <param name="isAutoSyncDS">是否默认同步东胜 true-自动同步 false-不自动同步</param>
/// <param name="fromFunc">调用方模块</param>
/// <returns></returns>
public async Task SetGoodsStatusPush(string code, long bookingId, bool isAutoSyncDS = false)
public async Task SetGoodsStatusPush(string code, long bookingId, bool isAutoSyncDS = false, string fromFunc = null)
{
string batchNo = IDGen.NextID().ToString();
@ -10501,8 +10502,8 @@ namespace Myshipping.Application
}).ExecuteCommand();
// 保存日志
//fromFunc = fromFunc != null ? $"设置货物状态({fromFunc}" : "设置货物状态";
//await SaveLog(model, oldModel, fromFunc);
fromFunc = fromFunc != null ? $"设置货物状态({fromFunc}" : "设置货物状态";
await SaveLog(model, oldModel, fromFunc);
//推送东胜
if (isAutoSyncDS)
@ -10605,8 +10606,8 @@ namespace Myshipping.Application
//it.VERSION
}).ExecuteCommand();
// 保存日志
// await SaveLog(model, oldModel, "取消设置货物状态");
//保存日志
await SaveLog(model, oldModel, "取消设置货物状态");
//推送东胜
if (isAutoSyncDS)

@ -89,8 +89,9 @@ namespace Myshipping.Application
/// <param name="code">服务状态代码</param>
/// <param name="bookingId">订舱ID</param>
/// <param name="isAutoSyncDS">是否默认同步东胜 true-自动同步 false-不自动同步</param>
/// <param name="fromFunc">调用方模块</param>
/// <returns></returns>
Task SetGoodsStatusPush(string code, long bookingId, bool isAutoSyncDS = false);
Task SetGoodsStatusPush(string code, long bookingId, bool isAutoSyncDS = false, string fromFunc = null);
/// <summary>
/// 取消服务状态

@ -52,7 +52,7 @@ namespace Myshipping.Application
public TaskDraftCompareService(ISysCacheService cache, ILogger<TaskDraftCompareService> logger,
SqlSugarRepository<BookingOrder> bookingOrderRepository, SqlSugarRepository<BookingCtn> bookingOrderContaRepository,
SqlSugarRepository<BookingOrder> bookingOrderRepository, SqlSugarRepository<BookingCtn> bookingOrderContaRepository,
SqlSugarRepository<BookingFile> bookingFileRepository, SqlSugarRepository<SysUser> sysUserRepository, IBookingOrderService bookingOrderService)
{
_cache = cache;
@ -72,7 +72,7 @@ namespace Myshipping.Application
/// <param name="file">请求文件</param>
/// <param name="jsonData">邮件Draft比对请求报文</param>
/// <returns>返回回执</returns>
[AllowAnonymous,HttpPost("/TaskDraftCompare/ExcuteEmailDraftCompare"), ApiUser(ApiCode = "ExcuteEmailDraftCompare")]
[AllowAnonymous, HttpPost("/TaskDraftCompare/ExcuteEmailDraftCompare"), ApiUser(ApiCode = "ExcuteEmailDraftCompare")]
public async Task<TaskManageExcuteResultDto> ExcuteEmailDraftCompareAsync(IFormFile file, [FromForm] string jsonData)
{
string batchNo = IDGen.NextID().ToString();
@ -125,7 +125,7 @@ namespace Myshipping.Application
file = "file",
fileName = file.FileName,
fileBytes = bytes
},null);
}, null);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
@ -136,7 +136,7 @@ namespace Myshipping.Application
JSON.Serialize(readResult));
if(!readResult.succ)
if (!readResult.succ)
{
_logger.LogInformation("批次={no} 请求Draft文件解析失败 原因={reason}", batchNo, readResult.msg);
@ -148,18 +148,18 @@ namespace Myshipping.Application
string billNo = string.Empty;
if(!string.IsNullOrWhiteSpace(readModel.MasterBlNo))
if (!string.IsNullOrWhiteSpace(readModel.MasterBlNo))
{
billNo = readModel.MasterBlNo;
}
if(string.IsNullOrWhiteSpace(billNo))
if (string.IsNullOrWhiteSpace(billNo))
{
_logger.LogInformation("批次={no} 请求Draft文件解析未获取到有效提单号", batchNo);
throw Oops.Oh($"请求Draft文件解析未获取到有效提单号");
}
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null, true)
.First(a => a.MBLNO.Equals(billNo) && !a.IsDeleted && a.TenantId == UserManager.TENANT_ID);
@ -169,10 +169,11 @@ namespace Myshipping.Application
throw Oops.Oh($"提单号{billNo}无法获取业务信息");
}
_logger.LogInformation("批次={no}获取订舱数据完成", batchNo);
TaskDraftCompareMessageInfo msgModel = new TaskDraftCompareMessageInfo {
TaskDraftCompareMessageInfo msgModel = new TaskDraftCompareMessageInfo
{
Head = new TaskMessageHead
{
GID = batchNo,
@ -198,7 +199,7 @@ namespace Myshipping.Application
mainInfo.UserName = UserManager.Name;
mainInfo.UserEmail = UserManager.Email;
var contaList = _bookingOrderContaRepository.AsQueryable().Filter(null,true)
var contaList = _bookingOrderContaRepository.AsQueryable().Filter(null, true)
.Where(x => x.BILLID == bookingOrder.Id && !x.IsDeleted && x.TenantId == UserManager.TENANT_ID).ToList();
_logger.LogInformation("批次={no} 提取箱完成 数量={total}", batchNo, contaList.Count);
@ -247,7 +248,7 @@ namespace Myshipping.Application
if (entity.LstDraftCompareRlt == "NO DIFF")
{
//推送状态 HDGSD-核对格式单
await _bookingOrderService.SetGoodsStatusPush("HDGSD", bookingOrder.Id, true);
await _bookingOrderService.SetGoodsStatusPush("HDGSD", bookingOrder.Id, true, "执行邮件Draft比对");
//写日志
_logger.LogInformation("批次={no} 推送状态 HDGSD-核对格式单 id={id}", batchNo, bookingOrder.Id);
@ -255,7 +256,7 @@ namespace Myshipping.Application
//如果确认文件读取成功
var bookFilePath = await FileAttachHelper.MoveFile(bookingOrder.Id.ToString(), fileFullName, batchNo, false, "draftfiles");
//将格式单附件写入订舱的附件
await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(fileFullName).Name, entity.TenantId.Value,
CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME);
@ -338,7 +339,7 @@ namespace Myshipping.Application
reduceAttach.Add(Content, fileInfo.file.ToString(), HttpUtility.UrlEncode(fileInfo.fileName.ToString()));
if(fileAttach != null)
if (fileAttach != null)
{
var Content2 = new ByteArrayContent(fileAttach.fileBytes);
@ -524,8 +525,10 @@ namespace Myshipping.Application
RequestDate = nowDate.ToString("yyyy-MM-dd HH:mm:ss"),
RequestAction = "Compare",
},
Main = new TaskDraftMessageMainInfo {
BusinessInfo = new BusinessInfo {
Main = new TaskDraftMessageMainInfo
{
BusinessInfo = new BusinessInfo
{
BusiPKId = bookingId.ToString()
}
}
@ -535,14 +538,14 @@ namespace Myshipping.Application
result = await GetDraftCompareResult(msgModel);
var lastFileInfo = _bookingFileRepository.AsQueryable().Filter(null,true).Where(a=>a.BookingId == bookingId &&
var lastFileInfo = _bookingFileRepository.AsQueryable().Filter(null, true).Where(a => a.BookingId == bookingId &&
a.TypeCode.Equals(CONST_DRAFT_FILE_CODE))
.OrderByDescending(a=>a.CreatedTime).First();
.OrderByDescending(a => a.CreatedTime).First();
if (lastFileInfo != null)
result.extra3 = lastFileInfo.Id;
}
catch(Exception ex)
catch (Exception ex)
{
_logger.LogInformation("获取Draft比对结果异常原因{error}", ex.Message);
@ -645,7 +648,7 @@ namespace Myshipping.Application
string fileAttchedFullName = string.Empty;
if(fileAttach != null)
if (fileAttach != null)
{
fileAttchedFullName = await FileAttachHelper.TempSaveWebFile(model.Head.GID, fileAttach, batchNo, CONST_DRAFT_FILE_CODE);
}
@ -682,7 +685,7 @@ namespace Myshipping.Application
file = "file",
fileName = file.FileName,
fileBytes = bytes
},null);
}, null);
}
DateTime eDate = DateTime.Now;
@ -808,7 +811,7 @@ namespace Myshipping.Application
if (entity.LstDraftCompareRlt == "NO DIFF")
{
//推送状态 HDGSD-核对格式单
await _bookingOrderService.SetGoodsStatusPush("HDGSD", bookingOrder.Id, true);
await _bookingOrderService.SetGoodsStatusPush("HDGSD", bookingOrder.Id, true, "执行邮件Draft比对含附件");
//写日志
_logger.LogInformation("批次={no} 推送状态 HDGSD-核对格式单 id={id}", batchNo, bookingOrder.Id);
@ -821,7 +824,7 @@ namespace Myshipping.Application
await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(fileFullName).Name, entity.TenantId.Value,
CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME);
if(!string.IsNullOrWhiteSpace(fileAttchedFullName))
if (!string.IsNullOrWhiteSpace(fileAttchedFullName))
{
var currBookFilePath = await FileAttachHelper.MoveFile(bookingOrder.Id.ToString(), fileAttchedFullName, batchNo);

Loading…
Cancel
Save