海运出口保存修改根据条件自动订阅及取消订阅

dev
cjy 2 weeks ago
parent e8f49ff065
commit 39096b5002

@ -40,7 +40,7 @@ namespace DS.WMS.Core.Op.Dtos
/// <summary> /// <summary>
/// 是否订阅港后的运踪默认为false /// 是否订阅港后的运踪默认为false
/// </summary> /// </summary>
public bool isBook { get; set; } public bool IsBook { get; set; }
/// <summary> /// <summary>
/// 是否订阅港前运踪默认为true /// 是否订阅港前运踪默认为true
/// </summary> /// </summary>
@ -80,7 +80,7 @@ namespace DS.WMS.Core.Op.Dtos
/// <summary> /// <summary>
/// 是否订阅港后的运踪默认为false /// 是否订阅港后的运踪默认为false
/// </summary> /// </summary>
public bool isBook { get; set; } public bool IsBook { get; set; }
/// <summary> /// <summary>
/// 是否订阅港前运踪默认为true /// 是否订阅港前运踪默认为true
/// </summary> /// </summary>

@ -30,11 +30,15 @@ using LanguageExt;
using Mapster; using Mapster;
using Masuit.Tools.Systems; using Masuit.Tools.Systems;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json; using Newtonsoft.Json;
using NLog; using NLog;
using Spring.Expressions.Parser.antlr.debug;
using SqlSugar; using SqlSugar;
using System.Data; using System.Data;
using System.Threading;
using static iText.StyledXmlParser.Jsoup.Select.Evaluator;
using Logger = NLog.Logger; using Logger = NLog.Logger;
namespace DS.WMS.Core.Op.Method; namespace DS.WMS.Core.Op.Method;
@ -562,6 +566,41 @@ public partial class SeaExportService : ISeaExportService
//return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); //return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
await tenantDb.Ado.CommitTranAsync(); 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<BillTraceSendReq>(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<BillTraceUnsubscribeList>(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 { //await _bookingSlotService.SyncBookingOrderToSlot(new BookingOrderToSlotDto {
// BookingId = info.Id, // BookingId = info.Id,
@ -732,6 +771,27 @@ public partial class SeaExportService : ISeaExportService
#endregion #endregion
//return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); //return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
await tenantDb.Ado.CommitTranAsync(); await tenantDb.Ado.CommitTranAsync();
//发起运踪订阅
if (!string.IsNullOrEmpty(entity.MBLNO) && !string.IsNullOrEmpty(entity.Yard))
{
var traceReq = new List<BillTraceSendReq>();
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)); return await Task.FromResult(DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess));
} }
catch (Exception ex) catch (Exception ex)

@ -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<string>.Failed("订阅目的港船公司或提单号不能为空!")); return await Task.FromResult(DataResult<string>.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<string>.Failed("订阅港前数据提单号或场站不能为空!")); return await Task.FromResult(DataResult<string>.Failed("订阅港前数据提单号或场站不能为空!"));
} }
@ -115,23 +115,23 @@ namespace DS.WMS.Core.Op.Method
YardCode = yardMap?.MapCode == "" ? null : yardMap?.MapCode, YardCode = yardMap?.MapCode == "" ? null : yardMap?.MapCode,
CARRIER = carrierName, CARRIER = carrierName,
CARRIERID = carrierCode == "" ? null : carrierCode, CARRIERID = carrierCode == "" ? null : carrierCode,
isBook = item.isBook, IsBook = item.IsBook,
IsFrontPort = item.IsFrontPort, IsFrontPort = item.IsFrontPort,
}); });
var status = string.Empty; var status = string.Empty;
var IsBookingYZ = String.Empty; var IsBookingYZ = String.Empty;
if (item.IsFrontPort && item.isBook) if (item.IsFrontPort && item.IsBook)
{ {
status = "订阅起运港,目的港"; status = "订阅起运港,目的港";
IsBookingYZ = "3"; IsBookingYZ = "3";
} }
else if (item.IsFrontPort && item.isBook == false) { else if (item.IsFrontPort && item.IsBook == false) {
status = "订阅起运港"; status = "订阅起运港";
IsBookingYZ = "1"; IsBookingYZ = "1";
} }
else if (item.isBook && item.IsFrontPort == false) else if (item.IsBook && item.IsFrontPort == false)
{ {
status = "订阅目的港"; status = "订阅目的港";
IsBookingYZ = "2"; IsBookingYZ = "2";

Loading…
Cancel
Save