jianghaiqing 10 months ago
commit ff71d0d5fb

@ -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,7 +10502,8 @@ namespace Myshipping.Application
}).ExecuteCommand();
// 保存日志
await SaveLog(model, oldModel, "设置货物状态");
fromFunc = fromFunc != null ? $"设置货物状态({fromFunc}" : "设置货物状态";
await SaveLog(model, oldModel, fromFunc);
//推送东胜
if (isAutoSyncDS)
@ -10604,7 +10606,7 @@ namespace Myshipping.Application
//it.VERSION
}).ExecuteCommand();
// 保存日志
//保存日志
await SaveLog(model, oldModel, "取消设置货物状态");
//推送东胜

@ -1154,6 +1154,7 @@ namespace Myshipping.Application
throw Oops.Oh($"订舱信息获取失败,无法更新");
}
var oldBkInfo = bkInfo.Adapt<BookingOrder>();
/* //2023-07-06 按照最新要求,从订舱编号取单号,所以这里不判断了
if(Regex.IsMatch(bkInfo.MBLNO,"\\bESL\\w+"))
@ -1180,6 +1181,9 @@ namespace Myshipping.Application
it.UpdatedUserName
}).ExecuteCommandAsync();
// 记录日志
await _bookingOrderService.SaveLog(bkInfo, oldBkInfo, "单票舱位分配查询");
result.succ = true;
result.msg = "舱位分配查询成功";
}
@ -1726,6 +1730,8 @@ namespace Myshipping.Application
result.bno = bookingOrder.MBLNO;
var oldBookingOrder = bookingOrder.Adapt<BookingOrder>();
try
{
if (string.IsNullOrWhiteSpace(result.bno))
@ -1819,6 +1825,9 @@ namespace Myshipping.Application
it.MBLNO
}).ExecuteCommandAsync();
// 记录日志
await _bookingOrderService.SaveLog(bookingOrder, oldBookingOrder, "单票BC更新订舱信息");
_logger.LogInformation("批次={no} id={id} BC引入更新订舱完成", batchNo, bookingOrder.Id);
result.succ = true;

@ -37,6 +37,11 @@ namespace Myshipping.Application.Service.BookingOrder.Dto
/// </summary>
public long BookingId { get; set; }
/// <summary>
/// 功能来源
/// </summary>
public string FromFunc { get; set; }
public List<BookingLogDetail> details { get; set; }
}

@ -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>
/// 取消服务状态

@ -596,7 +596,6 @@ namespace Myshipping.Application
order.VOYNO = entity.Voyno;
order.UpdatedTime = DateTime.Now;
await _rep.Context.Updateable(order).UpdateColumns(o => new { o.VOYNO, o.UpdatedTime }).ExecuteCommandAsync();
var a = _rep.Context.Updateable(order).UpdateColumns(o => new { o.VOYNO, o.UpdatedTime }).ToSqlString();
await _bookingorderservice.SaveLog(order, oldOrder, "同步船期");
await _bookingorderservice.SendBookingOrder(new long[] { order.Id });
@ -617,7 +616,7 @@ namespace Myshipping.Application
_logger.LogInformation($"同步船期_查询到{UserManager.TENANT_NAME}需要更新{order.Count()}条订舱数据");
foreach (var it in order)
{
var old = it;
var old = it.Adapt<BookingOrder>();
//更新订舱船期
if (it.ETD != item.ETD && item.ETD != null)
{
@ -2502,7 +2501,7 @@ namespace Myshipping.Application
if (item.Status == "MDGETA")
{
var o = _rep.AsQueryable().Filter(null, true).Where(x => x.Id == all[0].BookingId && x.IsDeleted == false).First();
var oldorder = o;
var oldorder = o.Adapt<BookingOrder>();
var oldeta = o == null ? null : o.ETA;
if (oldeta != item.OpTime && item.OpTime != null)
{
@ -2533,7 +2532,7 @@ namespace Myshipping.Application
if (item.Status == "MDGATA")
{
var o = _rep.AsQueryable().Filter(null, true).Where(x => x.Id == all[0].BookingId && x.IsDeleted == false).First();
var oldorder = o;
var oldorder = o.Adapt<BookingOrder>();
var oldata = o == null ? null : o.ATA;
if (oldata != item.OpTime && item.OpTime != null)
{

@ -133,14 +133,6 @@ namespace Myshipping.Application.Service.Fee.Dto
}
/// <summary>
/// 费用代码列表查询
/// </summary>
public class FeeCodeCacheDto : FeeCodeDto
{
public long TenantId { get; set; }
}
/// <summary>
/// 结算对象列表查询
/// </summary>

@ -77,12 +77,4 @@ namespace Myshipping.Application.Service.Fee.Dto
{
}
/// <summary>
/// 币别列表查询
/// </summary>
public class FeeCurrencyCacheDto : FeeCurrencyDto
{
public long TenantId { get; set; }
}
}

@ -139,15 +139,14 @@ namespace Myshipping.Application
/// </summary>
/// <returns></returns>
[HttpGet("/FeeCode/List")]
public async Task<List<FeeCodeCacheDto>> List()
public async Task<List<FeeCodeDto>> List()
{
var result = await _cache.GetAsync<List<FeeCodeCacheDto>>(CommonConst.CACHE_KEY_FEE_CODE);
var result = await _cache.GetAsync<List<FeeCodeDto>>(CommonConst.CACHE_KEY_FEE_CODE + "_" + UserManager.TENANT_ID);
if (result?.Any() != true)
{
result = await CacheFeeCode();
}
result = result.Where(f => f.TenantId == UserManager.TENANT_ID).ToList();
return result;
}
@ -155,14 +154,33 @@ namespace Myshipping.Application
/// 缓存费用代码列表
/// </summary>
[NonAction]
public async Task<List<FeeCodeCacheDto>> CacheFeeCode()
public async Task<List<FeeCodeDto>> CacheFeeCode()
{
var allFeeCode = await _repCode.AsQueryable().Filter(null, true).Where(x => !x.IsDeleted).ToListAsync();
if (UserManager.IsSuperAdmin)
{
// 如果登陆人是SuperAdmin则分别缓存所有租户的费用代码
var allFeeCode = await _repCode.AsQueryable().Filter(null, true).Where(x => !x.IsDeleted).ToListAsync();
var groupFeeCodeCache = allFeeCode.GroupBy(x => x.TenantId);
foreach (var item in groupFeeCodeCache)
{
var item2 = item.Adapt<List<FeeCodeDto>>();
await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CODE + "_" + item.Key, item2, new TimeSpan(6, 0, 0));
}
var result = groupFeeCodeCache.FirstOrDefault(x => x.Key == UserManager.TENANT_ID)?.Adapt<List<FeeCodeDto>>();
return result;
}
else
{
// 否则只缓存当前租户的费用代码
var tenantFeeCode = await _repCode.AsQueryable().Filter(null, true).Where(x => !x.IsDeleted && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var cacheFeeCode = allFeeCode.Adapt<List<FeeCodeCacheDto>>();
await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CODE, cacheFeeCode, new TimeSpan(6, 0, 0));
await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CODE + "_" + UserManager.TENANT_ID, tenantFeeCode, new TimeSpan(6, 0, 0));
return cacheFeeCode;
var result = tenantFeeCode.Adapt<List<FeeCodeDto>>();
return result;
}
}
}
}

@ -129,15 +129,14 @@ namespace Myshipping.Application
/// 获取币别列表
/// </summary>
[HttpGet("/FeeCurrency/List")]
public async Task<List<FeeCurrencyCacheDto>> List()
public async Task<List<FeeCurrencyDto>> List()
{
List<FeeCurrencyCacheDto> result = await _cache.GetAsync<List<FeeCurrencyCacheDto>>(CommonConst.CACHE_KEY_FEE_CURRENCY);
List<FeeCurrencyDto> result = await _cache.GetAsync<List<FeeCurrencyDto>>(CommonConst.CACHE_KEY_FEE_CURRENCY);
if (result?.Any() != true)
{
result = await CacheFeeCurrency();
}
result = result.Where(f => f.TenantId == UserManager.TENANT_ID).ToList();
return result;
}
@ -145,14 +144,33 @@ namespace Myshipping.Application
/// 缓存币别列表
/// </summary>
[NonAction]
public async Task<List<FeeCurrencyCacheDto>> CacheFeeCurrency()
public async Task<List<FeeCurrencyDto>> CacheFeeCurrency()
{
var allFeeCurrency = await _repCode.AsQueryable().Filter(null, true).Where(x => !x.IsDeleted).ToListAsync();
if (UserManager.IsSuperAdmin)
{
// 如果登陆人是SuperAdmin则分别缓存所有租户的费用币别
var allFeeCurrency = await _repCode.AsQueryable().Filter(null, true).Where(x => !x.IsDeleted).ToListAsync();
var groupFeeCurrency = allFeeCurrency.GroupBy(x => x.TenantId);
foreach (var item in groupFeeCurrency)
{
var item2 = item.Adapt<List<FeeCurrencyDto>>();
await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CURRENCY + "_" + item.Key, item2, new TimeSpan(6, 0, 0));
}
var result = groupFeeCurrency.FirstOrDefault(x => x.Key == UserManager.TENANT_ID)?.Adapt<List<FeeCurrencyDto>>();
return result;
}
else
{
// 否则只缓存当前租户的费用币别
var tenantFeeCurrency = await _repCode.AsQueryable().Filter(null, true).Where(x => !x.IsDeleted && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var cacheFeeCode = allFeeCurrency.Adapt<List<FeeCurrencyCacheDto>>();
await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CURRENCY, cacheFeeCode, new TimeSpan(6, 0, 0));
await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CURRENCY + "_" + UserManager.TENANT_ID, tenantFeeCurrency, new TimeSpan(6, 0, 0));
return cacheFeeCode;
var result = tenantFeeCurrency.Adapt<List<FeeCurrencyDto>>();
return result;
}
}
}
}

@ -9,6 +9,6 @@ namespace Myshipping.Application.Service.Fee
/// <summary>
/// 获取币别列表
/// </summary>
Task<List<FeeCurrencyCacheDto>> List();
Task<List<FeeCurrencyDto>> List();
}
}

@ -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;
@ -803,12 +806,12 @@ namespace Myshipping.Application
}).ExecuteCommandAsync();
// 添加日志
await _bookingOrderService.SaveLog(entity, oldEntity, "执行邮件Draft比对附件");
await _bookingOrderService.SaveLog(entity, oldEntity, "执行邮件Draft比对含附件");
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);

@ -2752,6 +2752,8 @@ namespace Myshipping.Application
//更新任务状态
orderInfo = _bookingOrderRepository.AsQueryable().First(t => t.Id == orderInfo.Id);
var oldOrderInfo = orderInfo.Adapt<BookingOrder>();
orderInfo.VESSEL = taskChangeShipModel.VESSEL_TO;
orderInfo.VOYNO = taskChangeShipModel.VOYNO_TO;
orderInfo.SHIPAGENCY = taskChangeShipModel.SHIP_AGENCY_TO;
@ -2769,6 +2771,10 @@ namespace Myshipping.Application
it.VOYNO
}).ExecuteCommandAsync();
// 记录日志
var bookingOrderService = _namedBookingOrderServiceProvider.GetService<ITransient>(nameof(BookingOrderService));
await bookingOrderService.SaveLog(orderInfo, oldOrderInfo, "接收换船后更新订舱");
_logger.LogInformation("批次={no} 更新订舱完成", batchNo);
taskInfo.STATUS = TaskStatusEnum.Complete.ToString();

@ -39,10 +39,11 @@ namespace Myshipping.Application
//private readonly SqlSugarRepository<SysUser> _userRepository;
private readonly IBookingValueAddedService _bookingValueAddedService;
private readonly IBookingOrderService _bookingOrderService;
public TaskShippingOrderCompareService(ISysCacheService cache, ILogger<TaskShippingOrderCompareService> logger,
SqlSugarRepository<BookingOrder> bookingOrderRepository, SqlSugarRepository<BookingCtn> bookingOrderContaRepository,
IBookingValueAddedService bookingValueAddedService)
IBookingValueAddedService bookingValueAddedService, IBookingOrderService bookingOrderService)
{
_cache = cache;
_logger = logger;
@ -50,6 +51,8 @@ namespace Myshipping.Application
_bookingOrderRepository = bookingOrderRepository;
_bookingOrderContaRepository = bookingOrderContaRepository;
_bookingValueAddedService = bookingValueAddedService;
_bookingOrderService = bookingOrderService;
}
/// <summary>
/// 执行下货纸比对
@ -156,6 +159,7 @@ namespace Myshipping.Application
if (orderInfo != null)
{
var oldOrderInfo = orderInfo.Adapt<BookingOrder>();
orderInfo.LstShipOrderCompareDate = bDate;
if (compareResult.succ)
@ -302,6 +306,9 @@ namespace Myshipping.Application
it.LstShipOrderCompareRltName,
it.LstShipOrderCompareMode,
}).ExecuteCommandAsync();
// 记录日志
await _bookingOrderService.SaveLog(orderInfo, oldOrderInfo, "执行下货纸比对");
}
@ -445,6 +452,7 @@ namespace Myshipping.Application
{
throw Oops.Oh($"订舱信息检索失败ID={model.reqBusiId}");
}
var oldBookingOrder = bookingOrder.Adapt<BookingOrder>();
bookingOrder.LstShipOrderCompareId = model.compareId;
bookingOrder.LstShipOrderCompareDate = model.compareDate;
@ -462,6 +470,8 @@ namespace Myshipping.Application
it.LstShipOrderCompareMode,
}).ExecuteCommandAsync();
await _bookingOrderService.SaveLog(bookingOrder, oldBookingOrder, "下货纸自动比对回写状态");
result.succ = true;
result.msg = "更新完成";
}

Loading…
Cancel
Save