新增格式单、下货纸比对人工反馈功能

master
jianghaiqing 7 months ago
parent 25d729d99b
commit f281bb40a3

@ -856,7 +856,7 @@ namespace Myshipping.Application.Entity
/// <summary>
/// 最后下货纸比对状态 NO_DIFF-无异常;DIFF-有差异;NO_YARD-无场站数据;EXPT-异常
/// </summary>
[Description("下货纸比对")]
[Description("下货纸比对状态")]
public string LstShipOrderCompareRlt { get; set; }
/// <summary>
@ -871,6 +871,7 @@ namespace Myshipping.Application.Entity
/// <summary>
/// 最后下货纸比对状态 NO_DIFF-无异常;DIFF-有差异;NO_YARD-无场站数据;EXPT-异常
/// </summary>
[Description("下货纸比对状态名称")]
public string LstShipOrderCompareRltName { get; set; }
/// <summary>
@ -1013,6 +1014,7 @@ namespace Myshipping.Application.Entity
/// <summary>
/// 最后格式单比对状态 NO_DIFF-无异常;DIFF-有差异;
/// </summary>
[Description("最后格式单比对状态")]
public string LstDraftCompareRlt { get; set; }
/// <summary>

@ -63,5 +63,19 @@ namespace Myshipping.Application.Entity.DraftCompare
[SugarColumn(ColumnName = "NOTES")]
[Description("备注")]
public string NOTES { get; set; }
/// <summary>
/// 比对类型 DRAFT-格式单比对SHIPORDER-下货纸比对
/// </summary>
[SugarColumn(ColumnName = "COMPARE_TYPE")]
[Description("比对类型")]
public string COMPARE_TYPE { get; set; }
/// <summary>
/// 比对完成时间
/// </summary>
[SugarColumn(ColumnName = "COMPARE_TIME")]
[Description("比对完成时间")]
public Nullable<DateTime> COMPARE_TIME { get; set; }
}
}

@ -6,7 +6,54 @@ using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 格式单反馈记录
/// </summary>
public class TaskDraftCompareFeedBackDto
{
/// <summary>
/// 订舱主键
/// </summary>
public long bookingId { get; set; }
/// <summary>
/// 提单号
/// </summary>
public string mblNo { get; set; }
/// <summary>
/// 比对主键
/// </summary>
public string taskCompareId { get; set; }
/// <summary>
/// 是否识别问题 1-时 0-否
/// </summary>
public bool isOCRError { get; set; }
/// <summary>
/// 是否订舱录入问题 1-是 0-否
/// </summary>
public bool isEditError { get; set; }
/// <summary>
/// 是否代理录入问题 1-是 0-否
/// </summary>
public bool isAgentError { get; set; }
/// <summary>
/// 备注
/// </summary>
public string notes { get; set; }
/// <summary>
/// 比对类型 DRAFT-格式单比对SHIPORDER-下货纸比对
/// </summary>
public string compareType { get; set; }
/// <summary>
/// 比对完成时间
/// </summary>
public Nullable<DateTime> compareTime { get; set; }
}
}

@ -44,6 +44,6 @@ namespace Myshipping.Application
/// </summary>
/// <param name="model">请求详情</param>
/// <returns>返回回执</returns>
Task<TaskManageExcuteResultDto> SaveDraftCompareManual(TaskDraftCompareFeedBackDto model);
Task SaveDraftCompareManual(TaskDraftCompareFeedBackDto model);
}
}

@ -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
}

@ -429,6 +429,7 @@ public class SyncHisRecord: ISyncHisRecord,ITransient
public void SyncServiceProjectRecord4()
{
/*
SI
1

Loading…
Cancel
Save