From 39096b500260940304b5af491ec2e8520f9b5960 Mon Sep 17 00:00:00 2001 From: cjy Date: Wed, 13 Nov 2024 11:47:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=B7=E8=BF=90=E5=87=BA=E5=8F=A3=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E4=BF=AE=E6=94=B9=E6=A0=B9=E6=8D=AE=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=AE=A2=E9=98=85=E5=8F=8A=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Op/Dtos/BillTraceReq.cs | 4 +- .../DS.WMS.Core/Op/Method/SeaExportService.cs | 60 +++++++++++++++++++ .../Op/Method/SeaExportTraceService.cs | 12 ++-- 3 files changed, 68 insertions(+), 8 deletions(-) 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";