jianghaiqing 4 months ago
commit 363695d795

@ -908,6 +908,12 @@ namespace Myshipping.Application.Entity
/// 父级订单编号 /// 父级订单编号
/// </summary> /// </summary>
public string ParentBookingNO { get; set; } public string ParentBookingNO { get; set; }
/// <summary>
/// 订舱编号
/// </summary>
public string CustNO { get; set; }
} }
/// <summary> /// <summary>

@ -117,7 +117,7 @@ namespace Myshipping.Application.Event
YardCode = order.YARDID == "" ? null : order.YARDID, YardCode = order.YARDID == "" ? null : order.YARDID,
CARRIER = order.CARRIER == "" ? null : order.CARRIER, CARRIER = order.CARRIER == "" ? null : order.CARRIER,
CARRIERID = order.CARRIERID == "" ? null : order.CARRIERID, CARRIERID = order.CARRIERID == "" ? null : order.CARRIERID,
isBook = false, isBook = order.IsBookingYZ is "2" or "3",
AlertEmail = string.Join(";", emailList) AlertEmail = string.Join(";", emailList)
}); });

@ -492,7 +492,7 @@ namespace Myshipping.Application.Event
{ {
//生成id并插入客户订舱数据 //生成id并插入客户订舱数据
custOrder.Id = YitIdHelper.NextId(); custOrder.Id = YitIdHelper.NextId();
custOrder.BOOKINGNO = item.GetStringValue("BookingNO"); custOrder.BOOKINGNO = item.GetStringValue("bookingNO");
custOrder.BSNO = item.GetStringValue("custOrderId"); custOrder.BSNO = item.GetStringValue("custOrderId");
custOrder.ParentBookingNO = parentBookingNO; custOrder.ParentBookingNO = parentBookingNO;
JObject jobjExt = null; JObject jobjExt = null;
@ -505,8 +505,9 @@ namespace Myshipping.Application.Event
jobjExt = new JObject(); jobjExt = new JObject();
} }
jobjExt["CustNO"] = item.GetStringValue("CustNO"); jobjExt["CustNO"] = item.GetStringValue("custNO");
custOrder.ExtendData = jobjExt.ToString(); custOrder.ExtendData = jobjExt.ToString();
custOrder.CustNO= item.GetStringValue("custNO");
await repoCutomerOrder.InsertAsync(custOrder); await repoCutomerOrder.InsertAsync(custOrder);
@ -529,7 +530,7 @@ namespace Myshipping.Application.Event
ord.CUSTNO = item.GetStringValue("custNO"); ord.CUSTNO = item.GetStringValue("custNO");
ord.CUSTOMERNAME = custOrder.BookingTenantName; ord.CUSTOMERNAME = custOrder.BookingTenantName;
ord.LANENAME = ord.LANECODE; ord.LANENAME = ord.LANECODE;
await repoOrder.AsUpdateable(ord).UpdateColumns(x => new { x.BSNO, x.CUSTOMERNAME, x.LANENAME }).ExecuteCommandAsync(); await repoOrder.AsUpdateable(ord).UpdateColumns(x => new { x.BSNO, x.CUSTNO, x.CUSTOMERNAME, x.LANENAME }).ExecuteCommandAsync();
_logger.LogInformation($"生成了订舱台账数据 {ord.Id}"); _logger.LogInformation($"生成了订舱台账数据 {ord.Id}");

@ -136,6 +136,7 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrEmpty(input.BookingName), x => x.BookingName.Contains(input.BookingName)) .WhereIF(!string.IsNullOrEmpty(input.BookingName), x => x.BookingName.Contains(input.BookingName))
.WhereIF(!string.IsNullOrEmpty(input.BookingTenantName), x => x.BookingTenantName.Contains(input.BookingTenantName)) .WhereIF(!string.IsNullOrEmpty(input.BookingTenantName), x => x.BookingTenantName.Contains(input.BookingTenantName))
.WhereIF(!string.IsNullOrEmpty(input.ParentBookingNO), x => x.BOOKINGNO.Contains(input.ParentBookingNO) || x.ParentBookingNO.Contains(input.ParentBookingNO)) .WhereIF(!string.IsNullOrEmpty(input.ParentBookingNO), x => x.BOOKINGNO.Contains(input.ParentBookingNO) || x.ParentBookingNO.Contains(input.ParentBookingNO))
.WhereIF(!string.IsNullOrEmpty(input.CustNO), x => x.CustNO.Contains(input.CustNO))
.WhereIF(input.ETDStart.HasValue, x => x.ETD >= input.ETDStart) .WhereIF(input.ETDStart.HasValue, x => x.ETD >= input.ETDStart)
.WhereIF(input.ETDEnd.HasValue, x => x.ETD < input.ETDEnd.Value.Date.AddDays(1)) .WhereIF(input.ETDEnd.HasValue, x => x.ETD < input.ETDEnd.Value.Date.AddDays(1))
.WhereIF(input.CreatedTimeStart.HasValue, x => x.CreatedTime >= input.CreatedTimeStart) .WhereIF(input.CreatedTimeStart.HasValue, x => x.CreatedTime >= input.CreatedTimeStart)
@ -2400,6 +2401,10 @@ namespace Myshipping.Application
await _repOrder.AsUpdateable(bkOrder).UpdateColumns(x => new { x.CUSTNO, x.BSSTATUS }).ExecuteCommandAsync(); await _repOrder.AsUpdateable(bkOrder).UpdateColumns(x => new { x.CUSTNO, x.BSSTATUS }).ExecuteCommandAsync();
CustomerBookingSyncHelper.SendCustomerBookingSync(bkOrder.Id, BookingOrderSyncTypeEnum.CC.ToString()); CustomerBookingSyncHelper.SendCustomerBookingSync(bkOrder.Id, BookingOrderSyncTypeEnum.CC.ToString());
_logger.LogInformation($"回写订舱号并回推客户端:{bkOrder.Id} {custNO}"); _logger.LogInformation($"回写订舱号并回推客户端:{bkOrder.Id} {custNO}");
//2024年7月17日增加了单独的订舱编号字段方便运营端查询
model.CustNO = custNO;
await _rep.AsUpdateable(model).UpdateColumns(x => new { x.CustNO }).ExecuteCommandAsync();
} }
} }
else if (model.CARRIERID == "EMC") else if (model.CARRIERID == "EMC")
@ -2416,6 +2421,10 @@ namespace Myshipping.Application
CustomerBookingSyncHelper.SendCustomerBookingSync(bkOrder.Id, BookingOrderSyncTypeEnum.CC.ToString()); CustomerBookingSyncHelper.SendCustomerBookingSync(bkOrder.Id, BookingOrderSyncTypeEnum.CC.ToString());
_logger.LogInformation($"回写订舱号并回推客户端:{bkOrder.Id} {bkOrder.CUSTNO}"); _logger.LogInformation($"回写订舱号并回推客户端:{bkOrder.Id} {bkOrder.CUSTNO}");
//2024年7月17日增加了单独的订舱编号字段方便运营端查询
model.CustNO = custNO;
await _rep.AsUpdateable(model).UpdateColumns(x => new { x.CustNO }).ExecuteCommandAsync();
//有多票订舱编号,后台自动创建数据并对应 //有多票订舱编号,后台自动创建数据并对应
custNOArr.RemoveAt(0); custNOArr.RemoveAt(0);
if (custNOArr.Count > 0) if (custNOArr.Count > 0)
@ -2933,17 +2942,17 @@ namespace Myshipping.Application
} }
////收货地校验 //收货地校验
//if (string.IsNullOrEmpty(input.PLACERECEIPTCODE)) if (input.CARRIERID == "EMC" && string.IsNullOrEmpty(input.PLACERECEIPTCODE))
//{ {
// throw Oops.Bah("收货地代码不能为空"); throw Oops.Bah("收货地代码不能为空");
//} }
var placereceipt = portLoadList.FirstOrDefault(x => x.Code == input.PLACERECEIPTCODE); var placereceipt = portLoadList.FirstOrDefault(x => x.Code == input.PLACERECEIPTCODE);
//if (placereceipt == null) if (input.CARRIERID == "EMC" && placereceipt == null)
//{ {
// throw Oops.Bah($"未找到匹配的收货地:{input.PLACERECEIPTCODE}"); throw Oops.Bah($"未找到匹配的收货地:{input.PLACERECEIPTCODE}");
//} }
//目的地校验 //目的地校验

@ -119,6 +119,11 @@ namespace Myshipping.Application
/// 父级订单编号 /// 父级订单编号
/// </summary> /// </summary>
public string ParentBookingNO { get; set; } public string ParentBookingNO { get; set; }
/// <summary>
/// 订舱编号
/// </summary>
public string CustNO { get; set; }
} }
//dto //dto
@ -787,6 +792,11 @@ namespace Myshipping.Application
/// 父级订单编号 /// 父级订单编号
/// </summary> /// </summary>
public string ParentBookingNO { get; set; } public string ParentBookingNO { get; set; }
/// <summary>
/// 订舱编号
/// </summary>
public string CustNO { get; set; }
} }
//保存dto //保存dto

@ -305,8 +305,8 @@ namespace Myshipping.Application
#region #region
var query = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID) var query = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID)
.WhereIF(!input.ISDel, x => x.IsDeleted == false) .WhereIF(!input.WithCancel && !input.ISDel, x => x.IsDeleted == false)
.WhereIF(input.ISDel, x => x.IsDeleted == true) .WhereIF(!input.WithCancel && input.ISDel, x => x.IsDeleted == true)
.WhereIF(input.firstFlag, x => (x.ETD <= etoday && x.ETD >= ftoday || x.ETD == null) && (x.CreatedUserId == UserManager.UserId || x.OPID == UserManager.UserId.ToString() || x.SubOpId == UserManager.UserId || x.DOCID == UserManager.UserId.ToString() || x.ROUTEID == UserManager.UserId.ToString() || x.LineManageID == UserManager.UserId.ToString() || x.CUSTSERVICEID == UserManager.UserId.ToString() || x.SALEID == UserManager.UserId.ToString())) //首次加载数据ETD前后15天且创建人、操作是当前人 .WhereIF(input.firstFlag, x => (x.ETD <= etoday && x.ETD >= ftoday || x.ETD == null) && (x.CreatedUserId == UserManager.UserId || x.OPID == UserManager.UserId.ToString() || x.SubOpId == UserManager.UserId || x.DOCID == UserManager.UserId.ToString() || x.ROUTEID == UserManager.UserId.ToString() || x.LineManageID == UserManager.UserId.ToString() || x.CUSTSERVICEID == UserManager.UserId.ToString() || x.SALEID == UserManager.UserId.ToString())) //首次加载数据ETD前后15天且创建人、操作是当前人
.Where(x => x.ParentId == 0 || x.ParentId == null) //台账只查询主单!! .Where(x => x.ParentId == 0 || x.ParentId == null) //台账只查询主单!!
.WhereIF(input.Id != 0, x => x.Id == input.Id) .WhereIF(input.Id != 0, x => x.Id == input.Id)
@ -344,6 +344,7 @@ namespace Myshipping.Application
.WhereIF(input.ECLOSEVGMDATE != null, u => u.CLOSEVGMDATE <= input.ECLOSEVGMDATE) .WhereIF(input.ECLOSEVGMDATE != null, u => u.CLOSEVGMDATE <= input.ECLOSEVGMDATE)
.WhereIF(input.BETA != null, u => u.ETA >= input.BETA) .WhereIF(input.BETA != null, u => u.ETA >= input.BETA)
.WhereIF(input.EETA != null, u => u.ETA < input.EETA.Value.AddDays(1)) .WhereIF(input.EETA != null, u => u.ETA < input.EETA.Value.AddDays(1))
.WhereIF(!string.IsNullOrWhiteSpace(input.ErpCode), u => u.ErpCode.Contains(input.ErpCode))
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPT), u => u.PLACERECEIPT.Contains(input.PLACERECEIPT)) .WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPT), u => u.PLACERECEIPT.Contains(input.PLACERECEIPT))
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD)) .WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD))
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOADID), u => u.PORTLOADID == input.PORTLOADID) .WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOADID), u => u.PORTLOADID == input.PORTLOADID)
@ -10438,7 +10439,7 @@ namespace Myshipping.Application
{ {
IModel mqModel = conn.CreateModel(); IModel mqModel = conn.CreateModel();
mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct); mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct);
var queueName = $"{MqActionQueueName}.{UserManager.TENANT_ID}"; var queueName = $"{MqActionQueueName}.{(item.SubTenantId.HasValue && item.SubTenantId > 0 ? item.SubTenantId.Value : item.TenantId)}";
mqModel.QueueDeclare(queueName, false, false, false, null); mqModel.QueueDeclare(queueName, false, false, false, null);
mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null); mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null);
byte[] messageBodyBytes = Encoding.UTF8.GetBytes(SharpZipLib.Compress(json)); byte[] messageBodyBytes = Encoding.UTF8.GetBytes(SharpZipLib.Compress(json));

@ -2611,18 +2611,29 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 单票正本下载 /// 单票正本下载
/// <paramref name="downloadType">1=正本下载 2=副本下载</paramref>
/// </summary> /// </summary>
[HttpGet("/BookingValueAdded/DownloadOriginal")] [HttpGet("/BookingValueAdded/DownloadOriginal")]
public async Task<TaskManageOrderResultDto> DownloadOriginal(long id, bool? isCheck) public async Task<TaskManageOrderResultDto> DownloadOriginal(long id, bool? isCheck, int downloadType = 1)
{ {
const string FileTypeCode = "zhengben"; string fileTypeCode = downloadType switch
const string FileTypeName = "正本"; {
1 => "zhengben",
2 => "fuben",
_ => throw new NotImplementedException()
};
string fileTypeName = downloadType switch
{
1 => "正本",
2 => "副本",
_ => throw new NotImplementedException()
};
TaskManageOrderResultDto result = new TaskManageOrderResultDto(); TaskManageOrderResultDto result = new TaskManageOrderResultDto();
if (isCheck == true) if (isCheck == true)
{ {
if (await _bookingFileRepository.IsExistsAsync(x => x.BookingId == id && x.TypeCode == FileTypeCode)) if (await _bookingFileRepository.IsExistsAsync(x => x.BookingId == id && x.TypeCode == fileTypeCode))
{ {
result.status = -1; result.status = -1;
result.succ = false; result.succ = false;
@ -2686,7 +2697,7 @@ namespace Myshipping.Application
carrierId = (carrierId ?? order.CARRIERID).ToUpper(); carrierId = (carrierId ?? order.CARRIERID).ToUpper();
if (carrierId != "MSK") if (carrierId != "MSK")
{ {
throw Oops.Bah($"船公司=[{order.CARRIER}]暂不支持正本下载"); throw Oops.Bah($"船公司=[{order.CARRIER}]暂不支持{fileTypeName}下载");
} }
// 判断签单方式是否符合条件 // 判断签单方式是否符合条件
@ -2694,11 +2705,16 @@ namespace Myshipping.Application
issueType = issueType ?? order.ISSUETYPE; issueType = issueType ?? order.ISSUETYPE;
if (!issueType.Equals("original", StringComparison.OrdinalIgnoreCase)) if (!issueType.Equals("original", StringComparison.OrdinalIgnoreCase))
{ {
throw Oops.Bah("此单签单方式非[正本下载],无法下载正本"); throw Oops.Bah($"此单签单方式非[正本],无法下载");
} }
// 实时下载接口 // 实时下载接口
url += "/documents_server/api/draft/v1/download_realtime"; url += downloadType switch
{
1 => "/documents_server/api/bill_lading/v1/download_realtime",
2 => "/documents_server/api/copy/v1/download_realtime",
_ => throw new NotImplementedException()
};
var body = new var body = new
{ {
web_code = carrierId, web_code = carrierId,
@ -2712,7 +2728,7 @@ namespace Myshipping.Application
{ {
{ "Token",token }, { "Content-Type", "application/json" } { "Token",token }, { "Content-Type", "application/json" }
}; };
_logger.LogInformation("请求正本下载接口开始mblno={mblno}, url={url}, body={body}", order.MBLNO, url, body); _logger.LogInformation("请求fileTypeName={fileTypeName}下载接口开始mblno={mblno}, url={url}, body={body}", fileTypeName, order.MBLNO, url, body);
DateTime bDate = DateTime.Now; DateTime bDate = DateTime.Now;
var rtn = await url.OnClientCreating(client => var rtn = await url.OnClientCreating(client =>
{ {
@ -2723,12 +2739,12 @@ namespace Myshipping.Application
TimeSpan ts = eDate.Subtract(bDate); TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds; var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("请求正本下载接口结束mblno={mblno}, rtn={rtn}, 耗时:{timeDiff}ms", order.MBLNO, rtn, timeDiff); _logger.LogInformation("请求fileTypeName={fileTypeName}下载接口结束mblno={mblno}, rtn={rtn}, 耗时:{timeDiff}ms", fileTypeName, order.MBLNO, rtn, timeDiff);
var jsonRtn = JObject.Parse(rtn); var jsonRtn = JObject.Parse(rtn);
if (jsonRtn.GetIntValue("status") == 1) if (jsonRtn.GetIntValue("status") == 1)
{ {
_logger.LogInformation("请求正本下载接口成功转存本地mblno={mblno}", order.MBLNO); _logger.LogInformation("请求fileTypeName={fileTypeName}下载接口成功转存本地mblno={mblno}", fileTypeName, order.MBLNO);
var data = jsonRtn.GetJObjectValue("data"); var data = jsonRtn.GetJObjectValue("data");
@ -2740,7 +2756,15 @@ namespace Myshipping.Application
// 读取文件保存配置 // 读取文件保存配置
var fileCfg = App.GetOptions<BookingAttachOptions>(); var fileCfg = App.GetOptions<BookingAttachOptions>();
string relativePath = $"{fileCfg.relativePath}\\originalfiles\\{order.Id}"; // 实时下载接口
string floderName = downloadType switch
{
1 => "originalfiles",
2 => "copyfiles",
_ => throw new NotImplementedException()
};
string relativePath = $"{fileCfg.relativePath}\\{floderName}\\{order.Id}";
string relativeDic = $"{(!string.IsNullOrWhiteSpace(fileCfg.basePath) ? fileCfg.basePath : App.WebHostEnvironment.WebRootPath)}\\{relativePath}"; string relativeDic = $"{(!string.IsNullOrWhiteSpace(fileCfg.basePath) ? fileCfg.basePath : App.WebHostEnvironment.WebRootPath)}\\{relativePath}";
string fileSavePath = $"{relativeDic}\\{new System.IO.FileInfo(remoteFilePath).Name}"; string fileSavePath = $"{relativeDic}\\{new System.IO.FileInfo(remoteFilePath).Name}";
@ -2781,15 +2805,15 @@ namespace Myshipping.Application
} }
result.succ = true; result.succ = true;
result.msg = "正本下载成功"; result.msg = $"{fileTypeName}下载成功";
await _bookingFileRepository.DeleteAsync(x => x.TypeCode == FileTypeCode && x.BookingId == order.Id); await _bookingFileRepository.DeleteAsync(x => x.TypeCode == fileTypeCode && x.BookingId == order.Id);
await SaveEDIFile(order.Id, bookFilePath, reallyFileName, FileTypeCode, FileTypeName); await SaveEDIFile(order.Id, bookFilePath, reallyFileName, fileTypeCode, fileTypeName);
} }
else else
{ {
var msg = jsonRtn.GetStringValue("message")?.Replace("爬虫", ""); var msg = jsonRtn.GetStringValue("message")?.Replace("爬虫", "");
_logger.LogInformation("请求正本下载接口失败mblno={mblno}, 服务返回:{msg}", order.MBLNO, msg); _logger.LogInformation("请求fileTypeName={fileTypeName}下载接口失败mblno={mblno}, 服务返回:{msg}", fileTypeName, order.MBLNO, msg);
throw Oops.Bah(msg); throw Oops.Bah(msg);
} }
} }
@ -2797,7 +2821,7 @@ namespace Myshipping.Application
{ {
result.succ = false; result.succ = false;
result.status = -2; result.status = -2;
result.msg = $"正本下载失败,{ex.Message}"; result.msg = $"{fileTypeName}下载失败,{ex.Message}";
} }
return result; return result;
} }

@ -33,6 +33,9 @@ namespace Myshipping.Application.Service.BookingOrder.Dto
public string CARRIER { get; set; } public string CARRIER { get; set; }
/// <summary>
/// 是否订阅港后运踪
/// </summary>
public bool isBook { get; set; } public bool isBook { get; set; }
public string AlertEmail { get; set; } public string AlertEmail { get; set; }

@ -18,6 +18,13 @@ namespace Myshipping.Application
/// 查询已删除 /// 查询已删除
/// </summary> /// </summary>
public virtual bool ISDel { get; set; } = false; public virtual bool ISDel { get; set; } = false;
/// <summary>
/// 包含已退舱(删除)
/// 配合ISDel参数使用为true时则ISDel无效为false时根据ISDel参数查询
/// </summary>
public virtual bool WithCancel { get; set; } = false;
/// <summary> /// <summary>
/// 首次查询标识 /// 首次查询标识
/// </summary> /// </summary>
@ -859,6 +866,11 @@ namespace Myshipping.Application
/// </summary> /// </summary>
public string SubOp { get; set; } public string SubOp { get; set; }
/// <summary>
/// ERP代码
/// </summary>
public string ErpCode { get; set; }
/// <summary> /// <summary>
/// 所属公司ID /// 所属公司ID
/// </summary> /// </summary>

@ -1014,5 +1014,16 @@ namespace Myshipping.Application.Service.BookingOrder.Dto
/// 是否截单回执 /// 是否截单回执
/// </summary> /// </summary>
public DateTime? IsSISubmitted { get; set; } public DateTime? IsSISubmitted { get; set; }
/// <summary>
/// 所属公司ID
/// </summary>
public long? SubTenantId { get; set; }
/// <summary>
/// 所属公司名称
/// </summary>
public string SubTenantName { get; set; }
} }
} }

@ -1528,7 +1528,7 @@ namespace Myshipping.Application
.Where(bas => bas.IS_CANCELLATION == false) .Where(bas => bas.IS_CANCELLATION == false)
.WhereIF(!string.IsNullOrEmpty(slotInput.SLOT_BOOKING_NO), bas => bas.SLOT_BOOKING_NO == slotInput.SLOT_BOOKING_NO) .WhereIF(!string.IsNullOrEmpty(slotInput.SLOT_BOOKING_NO), bas => bas.SLOT_BOOKING_NO == slotInput.SLOT_BOOKING_NO)
.WhereIF(!string.IsNullOrEmpty(slotInput.PORTLOAD), bas => bas.PORTLOAD.Contains(slotInput.PORTLOAD)) .WhereIF(!string.IsNullOrEmpty(slotInput.PORTLOAD), bas => bas.PORTLOAD.Contains(slotInput.PORTLOAD))
.WhereIF(!string.IsNullOrEmpty(slotInput.PORTDISCHARGE), bas => bas.PORTLOAD.Contains(slotInput.PORTLOAD)) .WhereIF(!string.IsNullOrEmpty(slotInput.PORTDISCHARGE), bas => bas.PORTDISCHARGE.Contains(slotInput.PORTDISCHARGE))
.WhereIF(!string.IsNullOrEmpty(slotInput.VESSEL), bas => bas.VESSEL.Contains(slotInput.VESSEL)) .WhereIF(!string.IsNullOrEmpty(slotInput.VESSEL), bas => bas.VESSEL.Contains(slotInput.VESSEL))
.WhereIF(!string.IsNullOrEmpty(slotInput.VOYNO), bas => bas.VOYNO.Contains(slotInput.VOYNO)) .WhereIF(!string.IsNullOrEmpty(slotInput.VOYNO), bas => bas.VOYNO.Contains(slotInput.VOYNO))
.WhereIF(!string.IsNullOrEmpty(slotInput.CARRIAGE_TYPE), bas => bas.CARRIAGE_TYPE == slotInput.CARRIAGE_TYPE) .WhereIF(!string.IsNullOrEmpty(slotInput.CARRIAGE_TYPE), bas => bas.CARRIAGE_TYPE == slotInput.CARRIAGE_TYPE)

@ -14,6 +14,7 @@ using Myshipping.Core.Service;
using Myshipping.Core.Entity; using Myshipping.Core.Entity;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using Furion;
namespace Myshipping.Application namespace Myshipping.Application
{ {
@ -158,15 +159,19 @@ namespace Myshipping.Application
&& !string.IsNullOrEmpty(old.Voyno) && !string.IsNullOrEmpty(old.Voyno)
&& !string.IsNullOrEmpty(old.CARRIERID)) && !string.IsNullOrEmpty(old.CARRIERID))
{ {
var order = await _order.AsQueryable() var query = _order.AsQueryable()
.Filter(null, true) .Filter(null, true)
.Where(x => x.TenantId == UserManager.TENANT_ID .Where(x => x.TenantId == UserManager.TENANT_ID
&& x.IsDeleted == false && x.IsDeleted == false
&& x.VESSEL == old.Vessel && x.VESSEL == old.Vessel
&& x.VOYNO == old.Voyno && x.VOYNO == old.Voyno
&& x.CARRIERID == old.CARRIERID) && x.CARRIERID == old.CARRIERID);
.WhereIF(!string.IsNullOrEmpty(old.PortLoadingId), x => x.PORTLOADID == old.PortLoadingId) if (App.Configuration["RunType"] != CommonConst.RUN_TYPE_HECHUAN)
.ToListAsync(); {
query.WhereIF(!string.IsNullOrEmpty(old.PortLoadingId), x => x.PORTLOADID == old.PortLoadingId);
}
var order = await query.ToListAsync();
bool issend = false; bool issend = false;
if (order != null) if (order != null)
{ {

@ -40,7 +40,7 @@ namespace Myshipping.Application
private readonly IBookingOrderService _bookingorderservice; private readonly IBookingOrderService _bookingorderservice;
private readonly IBookingValueAddedService _bookingValueAddedService; private readonly IBookingValueAddedService _bookingValueAddedService;
public BookingYunZongService(ILogger<BookingYunZongService> logger, ISysCacheService cache, IDjyWebsiteAccountConfigService account, SqlSugarRepository<BookingStatus> repBookingStatus, public BookingYunZongService(ILogger<BookingYunZongService> logger, ISysCacheService cache, IDjyWebsiteAccountConfigService account, SqlSugarRepository<BookingStatus> repBookingStatus,
SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingStatusLog> repStatuslog, SqlSugarRepository<BookingStatusLogDetail> statuslogdetail, IBookingOrderService bookingorderservice, IBookingValueAddedService bookingValueAddedService) SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingStatusLog> repStatuslog, SqlSugarRepository<BookingStatusLogDetail> statuslogdetail, IBookingOrderService bookingorderservice, IBookingValueAddedService bookingValueAddedService, SqlSugarRepository<BookingLog> repBookinglog, SqlSugarRepository<BookingLogDetail> repBookinglogdetail)
{ {
_cache = cache; _cache = cache;
_account = account; _account = account;
@ -51,6 +51,8 @@ namespace Myshipping.Application
_repBookingStatus = repBookingStatus; _repBookingStatus = repBookingStatus;
_bookingorderservice = bookingorderservice; _bookingorderservice = bookingorderservice;
_bookingValueAddedService = bookingValueAddedService; _bookingValueAddedService = bookingValueAddedService;
_repBookinglog = repBookinglog;
_repBookinglogdetail = repBookinglogdetail;
} }
/// <summary> /// <summary>
@ -885,7 +887,7 @@ namespace Myshipping.Application
throw Oops.Bah("未传入正确参数!"); throw Oops.Bah("未传入正确参数!");
} }
var key = await _account.GetAccountConfig("seae_billtraceurl", userId); var key = await _account.GetAccountConfigByTenantId("seae_billtraceurl", userId, tenentId);
if (key == null) if (key == null)
{ {
throw Oops.Bah("调用运踪接口相关账号未维护!"); throw Oops.Bah("调用运踪接口相关账号未维护!");

@ -645,9 +645,20 @@ namespace Myshipping.Application
.Distinct() .Distinct()
.ToListAsync(); .ToListAsync();
var orderIds = order.Select(x => x.Id).ToList();
//已封账的订舱数据不更新
var lockedList = await _bookingextstate.AsQueryable().Where(x => orderIds.Contains(x.bookingId) && x.IsLockBooking).Select(x => x.bookingId).ToListAsync();
_logger.LogInformation($"同步船期_查询到{UserManager.TENANT_NAME}需要更新{order.Count()}条订舱数据"); _logger.LogInformation($"同步船期_查询到{UserManager.TENANT_NAME}需要更新{order.Count()}条订舱数据");
foreach (var it in order) foreach (var it in order)
{ {
if (lockedList.Contains(it.Id))
{
_logger.LogWarning($"提单号:{it.MBLNO}、ID {it.Id} 的订舱数据已封账,不更新船期");
continue;
}
var old = it.Adapt<BookingOrder>(); var old = it.Adapt<BookingOrder>();
//更新订舱船期 //更新订舱船期
if (it.ETD != item.ETD && item.ETD != null) if (it.ETD != item.ETD && item.ETD != null)
@ -1834,18 +1845,40 @@ namespace Myshipping.Application
UpdatedTime = DateTime.Now UpdatedTime = DateTime.Now
}); });
var orderList = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID #region 扣费相关
&& x.IsDeleted == false
&& x.VESSEL == item.Vessel
&& x.VOYNO == item.Voyno).ToListAsync();
//当前租户配置为实际开船后扣费 //当前租户配置为实际开船后扣费
var paraVal = _tenantParamValue.AsQueryable().Filter(null, true).First(x => x.TenantId == UserManager.TENANT_ID && x.ParaCode == "BOOKING_FEE_METHOD"); var paraVal = _tenantParamValue.AsQueryable().Filter(null, true).First(x => x.TenantId == UserManager.TENANT_ID && x.ParaCode == "BOOKING_FEE_METHOD");
//有实际开船,扣费 //有实际开船,扣费
if (paraVal != null && paraVal.ItemCode == "ATD" && item.ATD.HasValue) if (paraVal != null && paraVal.ItemCode == "ATD" && item.ATD.HasValue)
{ {
feeIdList.AddRange(orderList.Where(x => !feeIdList.Contains(x.Id)).Select(x => x.Id)); var orderIdList = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID
&& x.IsDeleted == false
&& x.VESSEL == item.Vessel
&& x.VOYNO == item.Voyno).Select(x => x.Id).ToListAsync();
feeIdList.AddRange(orderIdList.Where(x => !feeIdList.Contains(x)));
} }
#endregion
// 118订舱系统2024.7.19修改:同一船名航次,启运港不同,船期也会不同;更新订舱时需要判断启运港
// 钉钉审批单号202407121821000478565
var query = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID
&& x.IsDeleted == false
&& x.VESSEL == item.Vessel
&& x.VOYNO == item.Voyno);
if (App.Configuration["RunType"] != CommonConst.RUN_TYPE_HECHUAN)
{
query.Where(x => string.IsNullOrEmpty(x.PORTLOADID));
}
List<BookingOrder> orderList = await query.Select(x => new BookingOrder
{
Id = x.Id,
StartETA = x.StartETA,
YgtETD = x.YgtETD,
ATD = x.ATD,
StartATA = x.StartATA,
}).ToListAsync();
bool issend = false; bool issend = false;
//批量变更业务数据 //批量变更业务数据
@ -1885,10 +1918,14 @@ namespace Myshipping.Application
{ {
issend = true; issend = true;
await update.Value.Where(b => b.Id == order.Id).ExecuteCommandAsync(); await update.Value.Where(b => b.Id == order.Id).ExecuteCommandAsync();
await _bookingorderservice.SaveLog(newOrder.Value, order, "回推船期"); await _bookingorderservice.SaveLog(newOrder.Value, order, "回推船期", new List<string>()
{
nameof(BookingOrder.StartATA),
nameof(BookingOrder.StartETA),
nameof(BookingOrder.YgtETD),
nameof(BookingOrder.ATD),
});
} }
} }
if (issend) if (issend)
{ {
@ -2769,6 +2806,70 @@ namespace Myshipping.Application
saveDto.ChangedFields = changeFileds; saveDto.ChangedFields = changeFileds;
} }
#region 处理操作、单证等人员ID
var sysUserList = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
//销售
if (!string.IsNullOrEmpty(saveDto.SALE))
{
var sale = sysUserList.FirstOrDefault(x => x.Name == saveDto.SALE);
if (sale != null)
{
saveDto.SALEID = sale.Id.ToString();
}
}
//操作
if (!string.IsNullOrEmpty(saveDto.OP))
{
var operatorUser = sysUserList.FirstOrDefault(x => x.Name == saveDto.OP);
if (operatorUser != null)
{
saveDto.OPID = operatorUser.Id.ToString();
}
}
//客服
if (!string.IsNullOrEmpty(saveDto.CUSTSERVICE))
{
var custServiceUser = sysUserList.FirstOrDefault(x => x.Name == saveDto.CUSTSERVICE);
if (custServiceUser != null)
{
saveDto.CUSTSERVICEID = custServiceUser.Id.ToString();
}
}
//单证
if (!string.IsNullOrEmpty(saveDto.DOC))
{
var docUser = sysUserList.FirstOrDefault(x => x.Name == saveDto.DOC);
if (docUser != null)
{
saveDto.DOCID = docUser.Id.ToString();
}
}
//航线操作
if (!string.IsNullOrEmpty(saveDto.ROUTE))
{
var routeUser = sysUserList.FirstOrDefault(x => x.Name == saveDto.ROUTE);
if (routeUser != null)
{
saveDto.ROUTEID = routeUser.Id.ToString();
}
}
//航线管理
if (!string.IsNullOrEmpty(saveDto.LineManage))
{
var lineManageUser = sysUserList.FirstOrDefault(x => x.Name == saveDto.LineManage);
if (lineManageUser != null)
{
saveDto.LineManageID = lineManageUser.Id.ToString();
}
}
#endregion
await _bookingorderservice.Save(saveDto); await _bookingorderservice.Save(saveDto);
} }
#endregion #endregion
@ -3023,6 +3124,7 @@ namespace Myshipping.Application
CreatedTime = DateTime.Now, CreatedTime = DateTime.Now,
CreatedUserId = 0, CreatedUserId = 0,
CreatedUserName = string.IsNullOrEmpty(item.UserName) ? UserManager.Name : item.UserName, CreatedUserName = string.IsNullOrEmpty(item.UserName) ? UserManager.Name : item.UserName,
FromFunc = "封账"
}); });
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
{ {

@ -50,5 +50,15 @@
/// 订舱分公司信息 /// 订舱分公司信息
/// </summary> /// </summary>
public const string BOOKING_SUB_TENANT = "BOOKING_SUB_TENANT"; public const string BOOKING_SUB_TENANT = "BOOKING_SUB_TENANT";
/// <summary>
/// 货描允许中文
/// </summary>
public const string DESCRIP_CAN_CHINESE = "DESCRIP_CAN_CHINESE";
/// <summary>
/// 订舱台账显示退舱
/// </summary>
public const string BOOKING_LIST_SHOW_CANCEL = "BOOKING_LIST_SHOW_CANCEL";
} }
} }

@ -923,6 +923,16 @@
订舱分公司信息 订舱分公司信息
</summary> </summary>
</member> </member>
<member name="F:Myshipping.Core.Const.TenantParamCode.DESCRIP_CAN_CHINESE">
<summary>
货描允许中文
</summary>
</member>
<member name="F:Myshipping.Core.Const.TenantParamCode.BOOKING_LIST_SHOW_CANCEL">
<summary>
订舱台账显示退舱
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeCarrier.Code"> <member name="P:Myshipping.Core.Entity.CodeCarrier.Code">
<summary> <summary>
代码 代码

@ -262,7 +262,8 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
// 返回前端需要使用的租户参数 // 返回前端需要使用的租户参数
var paraCodeArr = new string[] { TenantParamCode.ENABLE_SLOT_ABILITY, TenantParamCode.ENABLE_FEE_ABILITY, TenantParamCode.VESSEL_FROM_CONFIG_ONLY, var paraCodeArr = new string[] { TenantParamCode.ENABLE_SLOT_ABILITY, TenantParamCode.ENABLE_FEE_ABILITY, TenantParamCode.VESSEL_FROM_CONFIG_ONLY,
TenantParamCode.BOOKING_CHANNEL_SELECT_SHOW, TenantParamCode.BC_TASK_CREATE_ORDER,TenantParamCode.BOOKING_SUB_TENANT }; TenantParamCode.BOOKING_CHANNEL_SELECT_SHOW, TenantParamCode.BC_TASK_CREATE_ORDER,TenantParamCode.BOOKING_SUB_TENANT,TenantParamCode.DESCRIP_CAN_CHINESE,
TenantParamCode.BOOKING_LIST_SHOW_CANCEL};
loginOutput.TenantParams = await _djyTenantParamService.GetParaCodeWithValue(paraCodeArr); loginOutput.TenantParams = await _djyTenantParamService.GetParaCodeWithValue(paraCodeArr);
//多账号关联 //多账号关联

@ -267,11 +267,11 @@ public static class JsonUtil
return "HS代码存在中文字符"; return "HS代码存在中文字符";
} }
if (Regex.IsMatch(sourceVal.ToString(), @"[\u4e00-\u9fa5]") && propName.ToUpper() == "DESCRIPTION") //if (Regex.IsMatch(sourceVal.ToString(), @"[\u4e00-\u9fa5]") && propName.ToUpper() == "DESCRIPTION")
{ //{
return "货描存在中文字符"; // return "货描存在中文字符";
} //}
//if (Regex.IsMatch(sourceVal.ToString(), @"[\u4e00-\u9fa5]") && propName.ToUpper() == "CUSTNO") //if (Regex.IsMatch(sourceVal.ToString(), @"[\u4e00-\u9fa5]") && propName.ToUpper() == "CUSTNO")
//{ //{
// return "订舱编号存在中文字符"; // return "订舱编号存在中文字符";

Loading…
Cancel
Save