From f281bb40a30757141d2e63b48f08ce5c66538d4e Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 23 Apr 2024 11:31:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=BC=E5=BC=8F=E5=8D=95?= =?UTF-8?q?=E3=80=81=E4=B8=8B=E8=B4=A7=E7=BA=B8=E6=AF=94=E5=AF=B9=E4=BA=BA?= =?UTF-8?q?=E5=B7=A5=E5=8F=8D=E9=A6=88=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/Entity/BookingOrder.cs | 4 +- .../DraftCompareFeedBackRecord.cs | 14 +++ .../Dtos/TaskDraftCompareFeedBackDto.cs | 47 ++++++++ .../Interface/ITaskDraftCompareService.cs | 2 +- .../TaskManagePlat/TaskDraftCompareService.cs | 108 +++++++++++++++--- ServiceProjectSyncWin/Program.cs | 1 + 6 files changed, 161 insertions(+), 15 deletions(-) diff --git a/Myshipping.Application/Entity/BookingOrder.cs b/Myshipping.Application/Entity/BookingOrder.cs index c1b4a498..5d28a31f 100644 --- a/Myshipping.Application/Entity/BookingOrder.cs +++ b/Myshipping.Application/Entity/BookingOrder.cs @@ -856,7 +856,7 @@ namespace Myshipping.Application.Entity /// /// 最后下货纸比对状态 NO_DIFF-无异常;DIFF-有差异;NO_YARD-无场站数据;EXPT-异常 /// - [Description("下货纸比对")] + [Description("下货纸比对状态")] public string LstShipOrderCompareRlt { get; set; } /// @@ -871,6 +871,7 @@ namespace Myshipping.Application.Entity /// /// 最后下货纸比对状态 NO_DIFF-无异常;DIFF-有差异;NO_YARD-无场站数据;EXPT-异常 /// + [Description("下货纸比对状态名称")] public string LstShipOrderCompareRltName { get; set; } /// @@ -1013,6 +1014,7 @@ namespace Myshipping.Application.Entity /// /// 最后格式单比对状态 NO_DIFF-无异常;DIFF-有差异; /// + [Description("最后格式单比对状态")] public string LstDraftCompareRlt { get; set; } /// diff --git a/Myshipping.Application/Entity/DraftCompare/DraftCompareFeedBackRecord.cs b/Myshipping.Application/Entity/DraftCompare/DraftCompareFeedBackRecord.cs index f39474ff..9af47f3a 100644 --- a/Myshipping.Application/Entity/DraftCompare/DraftCompareFeedBackRecord.cs +++ b/Myshipping.Application/Entity/DraftCompare/DraftCompareFeedBackRecord.cs @@ -63,5 +63,19 @@ namespace Myshipping.Application.Entity.DraftCompare [SugarColumn(ColumnName = "NOTES")] [Description("备注")] public string NOTES { get; set; } + + /// + /// 比对类型 DRAFT-格式单比对;SHIPORDER-下货纸比对 + /// + [SugarColumn(ColumnName = "COMPARE_TYPE")] + [Description("比对类型")] + public string COMPARE_TYPE { get; set; } + + /// + /// 比对完成时间 + /// + [SugarColumn(ColumnName = "COMPARE_TIME")] + [Description("比对完成时间")] + public Nullable COMPARE_TIME { get; set; } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskDraftCompareFeedBackDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskDraftCompareFeedBackDto.cs index 7af2b85c..0ccae4cc 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskDraftCompareFeedBackDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskDraftCompareFeedBackDto.cs @@ -6,7 +6,54 @@ using System.Threading.Tasks; namespace Myshipping.Application { + /// + /// 格式单反馈记录 + /// public class TaskDraftCompareFeedBackDto { + /// + /// 订舱主键 + /// + public long bookingId { get; set; } + + /// + /// 提单号 + /// + public string mblNo { get; set; } + + /// + /// 比对主键 + /// + public string taskCompareId { get; set; } + + /// + /// 是否识别问题 1-时 0-否 + /// + public bool isOCRError { get; set; } + + /// + /// 是否订舱录入问题 1-是 0-否 + /// + public bool isEditError { get; set; } + + /// + /// 是否代理录入问题 1-是 0-否 + /// + public bool isAgentError { get; set; } + + /// + /// 备注 + /// + public string notes { get; set; } + + /// + /// 比对类型 DRAFT-格式单比对;SHIPORDER-下货纸比对 + /// + public string compareType { get; set; } + + /// + /// 比对完成时间 + /// + public Nullable compareTime { get; set; } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskDraftCompareService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskDraftCompareService.cs index e71fc5ae..2f88baad 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskDraftCompareService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskDraftCompareService.cs @@ -44,6 +44,6 @@ namespace Myshipping.Application /// /// 请求详情 /// 返回回执 - Task SaveDraftCompareManual(TaskDraftCompareFeedBackDto model); + Task SaveDraftCompareManual(TaskDraftCompareFeedBackDto model); } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskDraftCompareService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskDraftCompareService.cs index e389ab28..57bfd0dd 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskDraftCompareService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskDraftCompareService.cs @@ -48,6 +48,7 @@ namespace Myshipping.Application private readonly SqlSugarRepository _sysUserRepository; private readonly IBookingOrderService _bookingOrderService; private readonly SqlSugarRepository _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 logger, SqlSugarRepository bookingOrderRepository, SqlSugarRepository bookingOrderContaRepository, SqlSugarRepository bookingFileRepository, SqlSugarRepository sysUserRepository, IBookingOrderService bookingOrderService, - SqlSugarRepository draftCompareFeedBackRecordRepository) + SqlSugarRepository 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 /// /// 请求详情 /// 返回回执 - public async Task 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 { + new ModifyServiceProjectStatusDetailDto { StatusCode = "XHZBDCHG" } } + }); + + _logger.LogInformation("异步推送下货纸比对状态完成,结果={rlt}", JSON.Serialize(saveStatusRlt)); + } } #endregion } diff --git a/ServiceProjectSyncWin/Program.cs b/ServiceProjectSyncWin/Program.cs index 24190456..a3551901 100644 --- a/ServiceProjectSyncWin/Program.cs +++ b/ServiceProjectSyncWin/Program.cs @@ -429,6 +429,7 @@ public class SyncHisRecord: ISyncHisRecord,ITransient public void SyncServiceProjectRecord4() { + /* 批量更新SI 截止时间 1、更新任务台