diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BillTraceReq.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BillTraceReq.cs index 1d9bc454..82de1228 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/BillTraceReq.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BillTraceReq.cs @@ -40,7 +40,7 @@ namespace DS.WMS.Core.Op.Dtos /// /// 是否订阅港后的运踪,默认为false /// - public bool isBook { get; set; } + public bool IsBook { get; set; } /// /// 是否订阅港前运踪,默认为true /// @@ -80,7 +80,7 @@ namespace DS.WMS.Core.Op.Dtos /// /// 是否订阅港后的运踪,默认为false /// - public bool isBook { get; set; } + public bool IsBook { get; set; } /// /// 是否订阅港前运踪,默认为true /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index 5661b181..5ef4c562 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -30,11 +30,15 @@ using LanguageExt; using Mapster; using Masuit.Tools.Systems; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using NLog; +using Spring.Expressions.Parser.antlr.debug; using SqlSugar; using System.Data; +using System.Threading; +using static iText.StyledXmlParser.Jsoup.Select.Evaluator; using Logger = NLog.Logger; namespace DS.WMS.Core.Op.Method; @@ -562,6 +566,41 @@ public partial class SeaExportService : ISeaExportService //return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); await tenantDb.Ado.CommitTranAsync(); + if (!string.IsNullOrEmpty(info.MBLNO) && !string.IsNullOrEmpty(info.Yard) && (req.MBLNO != oldOrder.MBLNO || info.YardId != oldOrder.YardId || info.CarrierId != oldOrder.CarrierId)) + { + _logger.Info($"数据有变化,更新运踪订阅"); + //更改提单号重新订阅运踪 + var traceReq = new List(1); + traceReq.Add(new BillTraceSendReq() + { + BusinessId = info.Id.ToString(), + Carrier = info.Carrier, + CarrierId = info.CarrierId, + IsBook = true, + IsFrontPort = false, + MBLNO = info.MBLNO, + Yard = info.Yard, + YardId = info.YardId + }); + await SendOrUpdateTrace(traceReq); + if (!string.IsNullOrEmpty(info.Id.ToString())) + { + _logger.Warn($"保存请求[{info.Id.ToString()}],更新运踪订阅完成"); + } + } + else if (string.IsNullOrEmpty(info.MBLNO) && !string.IsNullOrEmpty(oldOrder.MBLNO) && oldOrder.IsBookingYZ != "0") + { + // 在已经订阅运踪的情况下,如果操作员删除提单号,则取消订阅运踪 + var unsubcribeDto = new List(1) + { + new BillTraceUnsubscribeList(oldOrder.Id.ToString(), oldOrder.MBLNO) + }; + await UnsubscribeBillTrace(unsubcribeDto); + if (!string.IsNullOrEmpty(info.Id.ToString())) + { + _logger.Warn($"保存请求[{info.Id.ToString()}],退订运踪完成"); + } + } ////保存会同步舱位 //await _bookingSlotService.SyncBookingOrderToSlot(new BookingOrderToSlotDto { // BookingId = info.Id, @@ -732,6 +771,27 @@ public partial class SeaExportService : ISeaExportService #endregion //return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); await tenantDb.Ado.CommitTranAsync(); + //发起运踪订阅 + if (!string.IsNullOrEmpty(entity.MBLNO) && !string.IsNullOrEmpty(entity.Yard)) + { + var traceReq = new List(); + traceReq.Add(new BillTraceSendReq() + { + BusinessId = entity.Id.ToString(), + Carrier = entity.Carrier, + CarrierId = entity.CarrierId, + IsBook = true, + IsFrontPort = false, + MBLNO = entity.MBLNO, + Yard = entity.Yard, + YardId = entity.YardId + }); + await SendOrUpdateTrace(traceReq); + if (!string.IsNullOrEmpty(entity.Id.ToString())) + { + _logger.Warn($"保存请求[{entity.Id.ToString()}],更新运踪订阅完成"); + } + } return await Task.FromResult(DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess)); } catch (Exception ex) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs index b6c4eea1..a691ec89 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportTraceService.cs @@ -77,11 +77,11 @@ namespace DS.WMS.Core.Op.Method } } - if (item.isBook && (string.IsNullOrWhiteSpace(carrierCode) || string.IsNullOrWhiteSpace(item.Carrier) || string.IsNullOrWhiteSpace(item.MBLNO))) + if (item.IsBook && (string.IsNullOrWhiteSpace(carrierCode) || string.IsNullOrWhiteSpace(item.Carrier) || string.IsNullOrWhiteSpace(item.MBLNO))) { return await Task.FromResult(DataResult.Failed("订阅目的港船公司或提单号不能为空!")); } - if (!item.isBook && (string.IsNullOrWhiteSpace(item.Yard) || string.IsNullOrWhiteSpace(yardCode) || string.IsNullOrWhiteSpace(item.MBLNO))) + if (!item.IsBook && (string.IsNullOrWhiteSpace(item.Yard) || string.IsNullOrWhiteSpace(yardCode) || string.IsNullOrWhiteSpace(item.MBLNO))) { return await Task.FromResult(DataResult.Failed("订阅港前数据提单号或场站不能为空!")); } @@ -115,23 +115,23 @@ namespace DS.WMS.Core.Op.Method YardCode = yardMap?.MapCode == "" ? null : yardMap?.MapCode, CARRIER = carrierName, CARRIERID = carrierCode == "" ? null : carrierCode, - isBook = item.isBook, + IsBook = item.IsBook, IsFrontPort = item.IsFrontPort, }); var status = string.Empty; var IsBookingYZ = String.Empty; - if (item.IsFrontPort && item.isBook) + if (item.IsFrontPort && item.IsBook) { status = "订阅起运港,目的港"; IsBookingYZ = "3"; } - else if (item.IsFrontPort && item.isBook == false) { + else if (item.IsFrontPort && item.IsBook == false) { status = "订阅起运港"; IsBookingYZ = "1"; } - else if (item.isBook && item.IsFrontPort == false) + else if (item.IsBook && item.IsFrontPort == false) { status = "订阅目的港"; IsBookingYZ = "2";