diff --git a/Myshipping.Application/Helper/BusinessIDGenHelper.cs b/Myshipping.Application/Helper/BusinessIDGenHelper.cs
new file mode 100644
index 00000000..d2fa17da
--- /dev/null
+++ b/Myshipping.Application/Helper/BusinessIDGenHelper.cs
@@ -0,0 +1,75 @@
+using Furion;
+using Furion.FriendlyException;
+using Myshipping.Core;
+using Myshipping.Core.Entity;
+using Myshipping.Core.Service;
+using Org.BouncyCastle.Asn1.Tsp;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Myshipping.Application.Helper
+{
+ public static class BusinessIDGenHelper
+ {
+ ///
+ /// 生成流水号
+ ///
+ /// 租户ID
+ ///
+ public static string GenNext(long tenantId)
+ {
+ if (tenantId <= 0)
+ throw Oops.Oh($"租户ID不能为空");
+
+ var _djyTenantParamService = App.GetService();
+
+ var paramInfo = _djyTenantParamService
+ .GetParaCodeWithValue(new[] { "BOOKING_MSG_REFERNO_STARTCODE" }).GetAwaiter().GetResult().FirstOrDefault();
+
+ string startCode = string.Empty;
+
+ if (paramInfo != null)
+ {
+ startCode = paramInfo.ParaValue?.Trim();
+ }
+
+ if (string.IsNullOrWhiteSpace(startCode))
+ throw Oops.Oh($"当前租户未配置“订舱申请号生成开头代码”租户参数");
+
+ string flowno = string.Empty;
+
+ var cacheService = App.GetService();
+
+ //生成KEY 代码类型-BOOKING_TENANTID_
+ string cacheKey = $"BOOKING_{tenantId}";
+ string cacheCalcKey = $"BOOKING_{tenantId}_CALC";
+
+ DateTime nowDate = DateTime.Now;
+ DateTime expireDateTime = new DateTime(nowDate.Year, nowDate.Month, nowDate.Day, 23, 59, 59);
+
+ var expireTimeSpan = expireDateTime.Subtract(DateTime.Now).Duration();
+
+ var autoIncrementKey = RedisHelper.IncrBy(cacheCalcKey);
+
+ if (cacheService.Exists(cacheKey))
+ {
+ flowno = $"{startCode}{nowDate.ToString("yyyyMMdd")}{autoIncrementKey.ToString().PadLeft(4, '0')}";
+ }
+ else
+ {
+ if (autoIncrementKey > 0)
+ RedisHelper.IncrBy(cacheCalcKey, -autoIncrementKey);
+
+ //重新计数
+ autoIncrementKey = RedisHelper.IncrBy(cacheCalcKey);
+
+ cacheService.SetTimeoutAsync(cacheKey, autoIncrementKey, expireTimeSpan).GetAwaiter().GetResult();
+ }
+
+ return flowno;
+ }
+ }
+}
diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
index c910e199..5203950a 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
@@ -1718,6 +1718,7 @@ namespace Myshipping.Application
}
entity.VERSION = Guid.NewGuid().ToString();
+
entity.BOOKINGNO = Yitter.IdGenerator.YitIdHelper.NextId().ToString();
entity.BSDATE = DateTime.Today;
entity.BSNO = null;
@@ -7537,7 +7538,26 @@ namespace Myshipping.Application
}
else
{
- primaryModel.ORDERNO = order.BOOKINGNO;
+ if (ediRouteEnum == EDIRouteEnum.INTTRA)
+ {
+ if (!string.IsNullOrWhiteSpace(order.BOOKINGNO) && order.BOOKINGNO.Length > 14)
+ {
+ var flowno = BusinessIDGenHelper.GenNext(UserManager.TENANT_ID);
+
+ if(!string.IsNullOrWhiteSpace(flowno))
+ {
+ order.BOOKINGNO = flowno;
+ await _rep.AsUpdateable(order).UpdateColumns(x => new { x.BOOKINGNO }).ExecuteCommandAsync();
+
+ _logger.LogInformation("批次={no} INTTRA 判断业务编号长度不能大于14,重新生成 MBLNO={mblno} custno={custno} 新单号{flowno}", batchNo, primaryModel.MBLNO, order.BOOKINGNO, flowno);
+ }
+ }
+ }
+ else
+ {
+ primaryModel.ORDERNO = order.BOOKINGNO;
+ }
+
}
//2023-06-15 按照沟通要求,如果主提单号为空,并且订舱编号不为空,可以去订舱编号填入主提单号
diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskPOLContainerNotPickUpService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskPOLContainerNotPickUpService.cs
index 4e3ac5a7..ecbcff00 100644
--- a/Myshipping.Application/Service/TaskManagePlat/TaskPOLContainerNotPickUpService.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/TaskPOLContainerNotPickUpService.cs
@@ -33,6 +33,7 @@ using System.Numerics;
using SqlSugar;
using System.Reflection.Metadata.Ecma335;
using Microsoft.Extensions.Primitives;
+using Myshipping.Core.Helper;
namespace Myshipping.Application
{