|
|
@ -48,6 +48,7 @@ namespace Myshipping.Application
|
|
|
|
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
|
|
|
|
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
|
|
|
|
private readonly IBookingOrderService _bookingOrderService;
|
|
|
|
private readonly IBookingOrderService _bookingOrderService;
|
|
|
|
private readonly SqlSugarRepository<DraftCompareFeedBackRecord> _draftCompareFeedBackRecordRepository;
|
|
|
|
private readonly SqlSugarRepository<DraftCompareFeedBackRecord> _draftCompareFeedBackRecordRepository;
|
|
|
|
|
|
|
|
private readonly IBookingValueAddedService _bookingValueAddedService;
|
|
|
|
|
|
|
|
|
|
|
|
const string CONST_DRAFT_FILE_CODE = "draft";
|
|
|
|
const string CONST_DRAFT_FILE_CODE = "draft";
|
|
|
|
const string CONST_DRAFT_FILE_NAME = "格式单";
|
|
|
|
const string CONST_DRAFT_FILE_NAME = "格式单";
|
|
|
@ -56,7 +57,7 @@ namespace Myshipping.Application
|
|
|
|
public TaskDraftCompareService(ISysCacheService cache, ILogger<TaskDraftCompareService> logger,
|
|
|
|
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,
|
|
|
|
SqlSugarRepository<BookingFile> bookingFileRepository, SqlSugarRepository<SysUser> sysUserRepository, IBookingOrderService bookingOrderService,
|
|
|
|
SqlSugarRepository<DraftCompareFeedBackRecord> draftCompareFeedBackRecordRepository)
|
|
|
|
SqlSugarRepository<DraftCompareFeedBackRecord> draftCompareFeedBackRecordRepository, IBookingValueAddedService bookingValueAddedService)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_cache = cache;
|
|
|
|
_cache = cache;
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
@ -68,6 +69,7 @@ namespace Myshipping.Application
|
|
|
|
_bookingOrderService = bookingOrderService;
|
|
|
|
_bookingOrderService = bookingOrderService;
|
|
|
|
|
|
|
|
|
|
|
|
_draftCompareFeedBackRecordRepository = draftCompareFeedBackRecordRepository;
|
|
|
|
_draftCompareFeedBackRecordRepository = draftCompareFeedBackRecordRepository;
|
|
|
|
|
|
|
|
_bookingValueAddedService = bookingValueAddedService;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 执行邮件Draft比对
|
|
|
|
#region 执行邮件Draft比对
|
|
|
@ -549,6 +551,25 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
if (lastFileInfo != null)
|
|
|
|
if (lastFileInfo != null)
|
|
|
|
result.extra3 = lastFileInfo.Id;
|
|
|
|
result.extra3 = lastFileInfo.Id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result != null && result.extra != null && !string.IsNullOrWhiteSpace(result.extra.TaskCompareId))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var feedBack = _draftCompareFeedBackRecordRepository.AsQueryable().First(a => a.BOOKING_ID == bookingId
|
|
|
|
|
|
|
|
&& a.TASK_COMPARE_ID == result.extra.TaskCompareId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (feedBack != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result.extra.ManualFeedBackResult = new FeedBackResult
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
OperNote = feedBack.NOTES,
|
|
|
|
|
|
|
|
OperTime = feedBack.CreatedTime.Value,
|
|
|
|
|
|
|
|
OperUser = feedBack.CreatedUserName,
|
|
|
|
|
|
|
|
Reason = (feedBack.IS_OCR_ERROR?"识别问题 ":"")+ (feedBack.IS_EDIT_ERROR ? "录入问题 " : "")+ (feedBack.IS_AGENT_ERROR ? "代理录入问题 " : "")
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -856,25 +877,107 @@ namespace Myshipping.Application
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="model">请求详情</param>
|
|
|
|
/// <param name="model">请求详情</param>
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
public async Task<TaskManageExcuteResultDto> SaveDraftCompareManual(TaskDraftCompareFeedBackDto model)
|
|
|
|
[HttpPost("/TaskDraftCompare/SaveDraftCompareManual")]
|
|
|
|
|
|
|
|
public async Task SaveDraftCompareManual(TaskDraftCompareFeedBackDto model)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TaskManageExcuteResultDto result = new TaskManageExcuteResultDto();
|
|
|
|
if (model.bookingId <= 0)
|
|
|
|
|
|
|
|
throw Oops.Oh($"订舱ID不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
var order = _bookingOrderRepository.AsQueryable().First(a => a.Id == model.bookingId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (order == null)
|
|
|
|
|
|
|
|
throw Oops.Oh($"订舱详情获取失败,订舱信息不存在或已作废");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!model.isOCRError && !model.isEditError && !model.isAgentError)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DraftCompareFeedBackRecord entity = new DraftCompareFeedBackRecord {
|
|
|
|
throw Oops.Oh($"至少选择一个原因");
|
|
|
|
//BOOKING_ID = model.
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("请求比对反馈,model={msg}", JSON.Serialize(model));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DateTime nowDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DraftCompareFeedBackRecord entity = new DraftCompareFeedBackRecord
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BOOKING_ID = model.bookingId,
|
|
|
|
|
|
|
|
IS_AGENT_ERROR = model.isAgentError,
|
|
|
|
|
|
|
|
IS_OCR_ERROR = model.isOCRError,
|
|
|
|
|
|
|
|
IS_EDIT_ERROR = model.isEditError,
|
|
|
|
|
|
|
|
NOTES = model.notes,
|
|
|
|
|
|
|
|
COMPARE_TYPE = model.compareType,
|
|
|
|
|
|
|
|
COMPARE_TIME = model.compareTime,
|
|
|
|
|
|
|
|
TASK_COMPARE_ID = model.taskCompareId,
|
|
|
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
|
|
|
CreatedUserName = UserManager.Name,
|
|
|
|
|
|
|
|
CreatedTime = nowDate,
|
|
|
|
|
|
|
|
UpdatedTime = nowDate
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//新增完记录
|
|
|
|
await _draftCompareFeedBackRecordRepository.InsertAsync(entity);
|
|
|
|
await _draftCompareFeedBackRecordRepository.InsertAsync(entity);
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
_logger.LogInformation("请求比对反馈写入表完成,id={id}", model.bookingId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var oldOrder = _bookingOrderRepository.AsQueryable().First(a => a.Id == model.bookingId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新订舱相关的格式单比对状态
|
|
|
|
|
|
|
|
if (model.compareType.Equals("DRAFT", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
result.succ = false;
|
|
|
|
_logger.LogInformation("请求比对反馈选择修正 compareType={compare},id={id}", model.compareType, model.bookingId);
|
|
|
|
result.msg = $"保存格式单比对反馈异常,{ex.Message}";
|
|
|
|
|
|
|
|
|
|
|
|
order.LstDraftCompareRlt = "NO DIFF";
|
|
|
|
|
|
|
|
order.UpdatedTime = nowDate;
|
|
|
|
|
|
|
|
order.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
|
|
|
order.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _bookingOrderRepository.AsUpdateable(order).UpdateColumns(t => new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
t.LstDraftCompareRlt,
|
|
|
|
|
|
|
|
t.UpdatedUserId,
|
|
|
|
|
|
|
|
t.UpdatedUserName,
|
|
|
|
|
|
|
|
t.UpdatedTime,
|
|
|
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("请求比对反馈更新订舱状态完成,id={id}", model.bookingId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 保存日志
|
|
|
|
|
|
|
|
await _bookingOrderService.SaveLog(order, oldOrder, "格式单比对反馈回写");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (model.compareType.Equals("SHIPORDER", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation("请求比对反馈选择修正 compareType={compare},id={id}", model.compareType, model.bookingId);
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
order.LstShipOrderCompareRlt = "NO_DIFF";
|
|
|
|
|
|
|
|
order.LstShipOrderCompareRltName = "正常";
|
|
|
|
|
|
|
|
order.UpdatedTime = nowDate;
|
|
|
|
|
|
|
|
order.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
|
|
|
order.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _bookingOrderRepository.AsUpdateable(order).UpdateColumns(t => new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
t.LstShipOrderCompareRlt,
|
|
|
|
|
|
|
|
t.LstShipOrderCompareRltName,
|
|
|
|
|
|
|
|
t.UpdatedUserId,
|
|
|
|
|
|
|
|
t.UpdatedUserName,
|
|
|
|
|
|
|
|
t.UpdatedTime,
|
|
|
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 保存日志
|
|
|
|
|
|
|
|
await _bookingOrderService.SaveLog(order, oldOrder, "格式单比对反馈回写");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("请求比对反馈更新订舱状态完成,id={id}", model.bookingId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//比对成功后触发下货纸比对状态
|
|
|
|
|
|
|
|
var saveStatusRlt = await _bookingValueAddedService.SaveServiceStatus(new ModifyServiceProjectStatusDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BookingId = model.bookingId,
|
|
|
|
|
|
|
|
SourceType = TrackingSourceTypeEnum.AUTO,
|
|
|
|
|
|
|
|
StatusCodes = new List<ModifyServiceProjectStatusDetailDto> {
|
|
|
|
|
|
|
|
new ModifyServiceProjectStatusDetailDto { StatusCode = "XHZBDCHG" } }
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("异步推送下货纸比对状态完成,结果={rlt}", JSON.Serialize(saveStatusRlt));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|