|
|
|
@ -48,6 +48,7 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
|
|
|
|
|
private readonly IBookingOrderService _bookingOrderService;
|
|
|
|
|
private readonly SqlSugarRepository<DraftCompareFeedBackRecord> _draftCompareFeedBackRecordRepository;
|
|
|
|
|
private readonly IBookingValueAddedService _bookingValueAddedService;
|
|
|
|
|
|
|
|
|
|
const string CONST_DRAFT_FILE_CODE = "draft";
|
|
|
|
|
const string CONST_DRAFT_FILE_NAME = "格式单";
|
|
|
|
@ -56,7 +57,7 @@ namespace Myshipping.Application
|
|
|
|
|
public TaskDraftCompareService(ISysCacheService cache, ILogger<TaskDraftCompareService> logger,
|
|
|
|
|
SqlSugarRepository<BookingOrder> bookingOrderRepository, SqlSugarRepository<BookingCtn> bookingOrderContaRepository,
|
|
|
|
|
SqlSugarRepository<BookingFile> bookingFileRepository, SqlSugarRepository<SysUser> sysUserRepository, IBookingOrderService bookingOrderService,
|
|
|
|
|
SqlSugarRepository<DraftCompareFeedBackRecord> draftCompareFeedBackRecordRepository)
|
|
|
|
|
SqlSugarRepository<DraftCompareFeedBackRecord> draftCompareFeedBackRecordRepository, IBookingValueAddedService bookingValueAddedService)
|
|
|
|
|
{
|
|
|
|
|
_cache = cache;
|
|
|
|
|
_logger = logger;
|
|
|
|
@ -68,6 +69,7 @@ namespace Myshipping.Application
|
|
|
|
|
_bookingOrderService = bookingOrderService;
|
|
|
|
|
|
|
|
|
|
_draftCompareFeedBackRecordRepository = draftCompareFeedBackRecordRepository;
|
|
|
|
|
_bookingValueAddedService = bookingValueAddedService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 执行邮件Draft比对
|
|
|
|
@ -856,25 +858,105 @@ namespace Myshipping.Application
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">请求详情</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageExcuteResultDto> SaveDraftCompareManual(TaskDraftCompareFeedBackDto model)
|
|
|
|
|
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 {
|
|
|
|
|
//BOOKING_ID = model.
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await _draftCompareFeedBackRecordRepository.InsertAsync(entity);
|
|
|
|
|
throw Oops.Oh($"至少选择一个原因");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("请求比对反馈,model={msg}", JSON.Serialize(model));
|
|
|
|
|
|
|
|
|
|
DateTime nowDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
DraftCompareFeedBackRecord entity = new DraftCompareFeedBackRecord
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"保存格式单比对反馈异常,{ex.Message}";
|
|
|
|
|
BOOKING_ID = model.bookingId,
|
|
|
|
|
IS_AGENT_ERROR = model.isAgentError,
|
|
|
|
|
IS_OCR_ERROR = model.isOCRError,
|
|
|
|
|
IS_EDIT_ERROR = model.isEditError,
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("请求比对反馈写入表完成,id={id}", model.bookingId);
|
|
|
|
|
|
|
|
|
|
var oldOrder = _bookingOrderRepository.AsQueryable().First(a => a.Id == model.bookingId);
|
|
|
|
|
|
|
|
|
|
//更新订舱相关的格式单比对状态
|
|
|
|
|
if (model.compareType.Equals("DRAFT", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("请求比对反馈选择修正 compareType={compare},id={id}", model.compareType, model.bookingId);
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|