diff --git a/Myshipping.Application/Entity/BookingCustomerOrder.cs b/Myshipping.Application/Entity/BookingCustomerOrder.cs index 4c92bd0a..59916c24 100644 --- a/Myshipping.Application/Entity/BookingCustomerOrder.cs +++ b/Myshipping.Application/Entity/BookingCustomerOrder.cs @@ -908,6 +908,12 @@ namespace Myshipping.Application.Entity /// 父级订单编号 /// public string ParentBookingNO { get; set; } + + /// + /// 订舱编号 + /// + public string CustNO { get; set; } + } /// diff --git a/Myshipping.Application/Event/BillTraceSubscriber.cs b/Myshipping.Application/Event/BillTraceSubscriber.cs index cae27b7c..28f69664 100644 --- a/Myshipping.Application/Event/BillTraceSubscriber.cs +++ b/Myshipping.Application/Event/BillTraceSubscriber.cs @@ -117,7 +117,7 @@ namespace Myshipping.Application.Event YardCode = order.YARDID == "" ? null : order.YARDID, CARRIER = order.CARRIER == "" ? null : order.CARRIER, CARRIERID = order.CARRIERID == "" ? null : order.CARRIERID, - isBook = false, + isBook = order.IsBookingYZ is "2" or "3", AlertEmail = string.Join(";", emailList) }); diff --git a/Myshipping.Application/Event/BookingSyncSubscriber.cs b/Myshipping.Application/Event/BookingSyncSubscriber.cs index 93a283e7..0bf045aa 100644 --- a/Myshipping.Application/Event/BookingSyncSubscriber.cs +++ b/Myshipping.Application/Event/BookingSyncSubscriber.cs @@ -492,7 +492,7 @@ namespace Myshipping.Application.Event { //生成id并插入客户订舱数据 custOrder.Id = YitIdHelper.NextId(); - custOrder.BOOKINGNO = item.GetStringValue("BookingNO"); + custOrder.BOOKINGNO = item.GetStringValue("bookingNO"); custOrder.BSNO = item.GetStringValue("custOrderId"); custOrder.ParentBookingNO = parentBookingNO; JObject jobjExt = null; @@ -505,8 +505,9 @@ namespace Myshipping.Application.Event jobjExt = new JObject(); } - jobjExt["CustNO"] = item.GetStringValue("CustNO"); + jobjExt["CustNO"] = item.GetStringValue("custNO"); custOrder.ExtendData = jobjExt.ToString(); + custOrder.CustNO= item.GetStringValue("custNO"); await repoCutomerOrder.InsertAsync(custOrder); @@ -529,7 +530,7 @@ namespace Myshipping.Application.Event ord.CUSTNO = item.GetStringValue("custNO"); ord.CUSTOMERNAME = custOrder.BookingTenantName; 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}"); diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs index db8daf36..e0ba07f5 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs @@ -136,6 +136,7 @@ namespace Myshipping.Application .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.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.ETDEnd.HasValue, x => x.ETD < input.ETDEnd.Value.Date.AddDays(1)) .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(); CustomerBookingSyncHelper.SendCustomerBookingSync(bkOrder.Id, BookingOrderSyncTypeEnum.CC.ToString()); _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") @@ -2416,6 +2421,10 @@ namespace Myshipping.Application CustomerBookingSyncHelper.SendCustomerBookingSync(bkOrder.Id, BookingOrderSyncTypeEnum.CC.ToString()); _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); if (custNOArr.Count > 0) @@ -2933,17 +2942,17 @@ namespace Myshipping.Application } - ////收货地校验 - //if (string.IsNullOrEmpty(input.PLACERECEIPTCODE)) - //{ - // throw Oops.Bah("收货地代码不能为空"); - //} + //收货地校验 + if (input.CARRIERID == "EMC" && string.IsNullOrEmpty(input.PLACERECEIPTCODE)) + { + throw Oops.Bah("收货地代码不能为空"); + } var placereceipt = portLoadList.FirstOrDefault(x => x.Code == input.PLACERECEIPTCODE); - //if (placereceipt == null) - //{ - // throw Oops.Bah($"未找到匹配的收货地:{input.PLACERECEIPTCODE}"); - //} + if (input.CARRIERID == "EMC" && placereceipt == null) + { + throw Oops.Bah($"未找到匹配的收货地:{input.PLACERECEIPTCODE}"); + } //目的地校验 diff --git a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs index 0acd53b1..70e1e3a3 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs @@ -119,6 +119,11 @@ namespace Myshipping.Application /// 父级订单编号 /// public string ParentBookingNO { get; set; } + + /// + /// 订舱编号 + /// + public string CustNO { get; set; } } //dto @@ -787,6 +792,11 @@ namespace Myshipping.Application /// 父级订单编号 /// public string ParentBookingNO { get; set; } + + /// + /// 订舱编号 + /// + public string CustNO { get; set; } } //保存dto diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 8fb98d84..43db8b06 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -305,8 +305,8 @@ namespace Myshipping.Application #region var query = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID) - .WhereIF(!input.ISDel, x => x.IsDeleted == false) - .WhereIF(input.ISDel, x => x.IsDeleted == true) + .WhereIF(!input.WithCancel && !input.ISDel, x => x.IsDeleted == false) + .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天,且创建人、操作是当前人 .Where(x => x.ParentId == 0 || x.ParentId == null) //台账只查询主单!! .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.BETA != null, u => u.ETA >= input.BETA) .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.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD)) .WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOADID), u => u.PORTLOADID == input.PORTLOADID) @@ -10438,7 +10439,7 @@ namespace Myshipping.Application { IModel mqModel = conn.CreateModel(); 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.QueueBind(queueName, MqActionExchangeName, queueName, null); byte[] messageBodyBytes = Encoding.UTF8.GetBytes(SharpZipLib.Compress(json)); diff --git a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs index 8311b254..4bc5e3fb 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs @@ -2611,18 +2611,29 @@ namespace Myshipping.Application /// /// 单票正本下载 + /// 1=正本下载 2=副本下载 /// [HttpGet("/BookingValueAdded/DownloadOriginal")] - public async Task DownloadOriginal(long id, bool? isCheck) + public async Task DownloadOriginal(long id, bool? isCheck, int downloadType = 1) { - const string FileTypeCode = "zhengben"; - const string FileTypeName = "正本"; + string fileTypeCode = downloadType switch + { + 1 => "zhengben", + 2 => "fuben", + _ => throw new NotImplementedException() + }; + string fileTypeName = downloadType switch + { + 1 => "正本", + 2 => "副本", + _ => throw new NotImplementedException() + }; TaskManageOrderResultDto result = new TaskManageOrderResultDto(); 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.succ = false; @@ -2686,7 +2697,7 @@ namespace Myshipping.Application carrierId = (carrierId ?? order.CARRIERID).ToUpper(); 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; 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 { web_code = carrierId, @@ -2712,7 +2728,7 @@ namespace Myshipping.Application { { "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; var rtn = await url.OnClientCreating(client => { @@ -2723,12 +2739,12 @@ namespace Myshipping.Application TimeSpan ts = eDate.Subtract(bDate); 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); 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"); @@ -2740,7 +2756,15 @@ namespace Myshipping.Application // 读取文件保存配置 var fileCfg = App.GetOptions(); - 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 fileSavePath = $"{relativeDic}\\{new System.IO.FileInfo(remoteFilePath).Name}"; @@ -2781,15 +2805,15 @@ namespace Myshipping.Application } result.succ = true; - result.msg = "正本下载成功"; + result.msg = $"{fileTypeName}下载成功"; - await _bookingFileRepository.DeleteAsync(x => x.TypeCode == FileTypeCode && x.BookingId == order.Id); - await SaveEDIFile(order.Id, bookFilePath, reallyFileName, FileTypeCode, FileTypeName); + await _bookingFileRepository.DeleteAsync(x => x.TypeCode == fileTypeCode && x.BookingId == order.Id); + await SaveEDIFile(order.Id, bookFilePath, reallyFileName, fileTypeCode, fileTypeName); } else { 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); } } @@ -2797,7 +2821,7 @@ namespace Myshipping.Application { result.succ = false; result.status = -2; - result.msg = $"正本下载失败,{ex.Message}"; + result.msg = $"{fileTypeName}下载失败,{ex.Message}"; } return result; } diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BillTraceDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BillTraceDto.cs index 9d87da93..b4f71936 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BillTraceDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BillTraceDto.cs @@ -33,6 +33,9 @@ namespace Myshipping.Application.Service.BookingOrder.Dto public string CARRIER { get; set; } + /// + /// 是否订阅港后运踪 + /// public bool isBook { get; set; } public string AlertEmail { get; set; } diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderInput.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderInput.cs index f63c0a1b..c8667827 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderInput.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderInput.cs @@ -18,6 +18,13 @@ namespace Myshipping.Application /// 查询已删除 /// public virtual bool ISDel { get; set; } = false; + + /// + /// 包含已退舱(删除) + /// 配合ISDel参数使用,为true时,则ISDel无效,为false时,根据ISDel参数查询 + /// + public virtual bool WithCancel { get; set; } = false; + /// /// 首次查询标识 /// @@ -859,6 +866,11 @@ namespace Myshipping.Application /// public string SubOp { get; set; } + /// + /// ERP代码 + /// + public string ErpCode { get; set; } + /// /// 所属公司ID /// diff --git a/Myshipping.Application/Service/BookingOrder/Dto/PageBookingOrder.cs b/Myshipping.Application/Service/BookingOrder/Dto/PageBookingOrder.cs index 88fed3f2..2f157e8b 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/PageBookingOrder.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/PageBookingOrder.cs @@ -1014,5 +1014,16 @@ namespace Myshipping.Application.Service.BookingOrder.Dto /// 是否截单回执 /// public DateTime? IsSISubmitted { get; set; } + + + /// + /// 所属公司ID + /// + public long? SubTenantId { get; set; } + + /// + /// 所属公司名称 + /// + public string SubTenantName { get; set; } } } diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index b2e5c265..39ac6043 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -1528,7 +1528,7 @@ namespace Myshipping.Application .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.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.VOYNO), bas => bas.VOYNO.Contains(slotInput.VOYNO)) .WhereIF(!string.IsNullOrEmpty(slotInput.CARRIAGE_TYPE), bas => bas.CARRIAGE_TYPE == slotInput.CARRIAGE_TYPE) diff --git a/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs b/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs index 17e9797c..72aae781 100644 --- a/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs +++ b/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs @@ -14,6 +14,7 @@ using Myshipping.Core.Service; using Myshipping.Core.Entity; using Microsoft.Extensions.Logging; using Microsoft.AspNetCore.SignalR; +using Furion; namespace Myshipping.Application { @@ -158,15 +159,19 @@ namespace Myshipping.Application && !string.IsNullOrEmpty(old.Voyno) && !string.IsNullOrEmpty(old.CARRIERID)) { - var order = await _order.AsQueryable() - .Filter(null, true) - .Where(x => x.TenantId == UserManager.TENANT_ID - && x.IsDeleted == false - && x.VESSEL == old.Vessel - && x.VOYNO == old.Voyno - && x.CARRIERID == old.CARRIERID) - .WhereIF(!string.IsNullOrEmpty(old.PortLoadingId), x => x.PORTLOADID == old.PortLoadingId) - .ToListAsync(); + var query = _order.AsQueryable() + .Filter(null, true) + .Where(x => x.TenantId == UserManager.TENANT_ID + && x.IsDeleted == false + && x.VESSEL == old.Vessel + && x.VOYNO == old.Voyno + && x.CARRIERID == old.CARRIERID); + if (App.Configuration["RunType"] != CommonConst.RUN_TYPE_HECHUAN) + { + query.WhereIF(!string.IsNullOrEmpty(old.PortLoadingId), x => x.PORTLOADID == old.PortLoadingId); + } + var order = await query.ToListAsync(); + bool issend = false; if (order != null) { diff --git a/Myshipping.Application/Service/BookingYunZong/BookingYunZong.cs b/Myshipping.Application/Service/BookingYunZong/BookingYunZong.cs index 89c67ca6..0197bcfc 100644 --- a/Myshipping.Application/Service/BookingYunZong/BookingYunZong.cs +++ b/Myshipping.Application/Service/BookingYunZong/BookingYunZong.cs @@ -40,7 +40,7 @@ namespace Myshipping.Application private readonly IBookingOrderService _bookingorderservice; private readonly IBookingValueAddedService _bookingValueAddedService; public BookingYunZongService(ILogger logger, ISysCacheService cache, IDjyWebsiteAccountConfigService account, SqlSugarRepository repBookingStatus, - SqlSugarRepository rep, SqlSugarRepository repStatuslog, SqlSugarRepository statuslogdetail, IBookingOrderService bookingorderservice, IBookingValueAddedService bookingValueAddedService) + SqlSugarRepository rep, SqlSugarRepository repStatuslog, SqlSugarRepository statuslogdetail, IBookingOrderService bookingorderservice, IBookingValueAddedService bookingValueAddedService, SqlSugarRepository repBookinglog, SqlSugarRepository repBookinglogdetail) { _cache = cache; _account = account; @@ -51,6 +51,8 @@ namespace Myshipping.Application _repBookingStatus = repBookingStatus; _bookingorderservice = bookingorderservice; _bookingValueAddedService = bookingValueAddedService; + _repBookinglog = repBookinglog; + _repBookinglogdetail = repBookinglogdetail; } /// @@ -885,7 +887,7 @@ namespace Myshipping.Application throw Oops.Bah("未传入正确参数!"); } - var key = await _account.GetAccountConfig("seae_billtraceurl", userId); + var key = await _account.GetAccountConfigByTenantId("seae_billtraceurl", userId, tenentId); if (key == null) { throw Oops.Bah("调用运踪接口相关账号未维护!"); diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 49f17bb2..1a67c208 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -645,9 +645,20 @@ namespace Myshipping.Application .Distinct() .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()}条订舱数据"); foreach (var it in order) { + if (lockedList.Contains(it.Id)) + { + _logger.LogWarning($"提单号:{it.MBLNO}、ID: {it.Id} 的订舱数据已封账,不更新船期"); + continue; + } + var old = it.Adapt(); //更新订舱船期 if (it.ETD != item.ETD && item.ETD != null) @@ -1834,18 +1845,40 @@ namespace Myshipping.Application UpdatedTime = DateTime.Now }); - var orderList = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID - && x.IsDeleted == false - && x.VESSEL == item.Vessel - && x.VOYNO == item.Voyno).ToListAsync(); - + #region 扣费相关 //当前租户配置为实际开船后扣费 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) { - 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 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; //批量变更业务数据 @@ -1885,10 +1918,14 @@ namespace Myshipping.Application { issend = true; await update.Value.Where(b => b.Id == order.Id).ExecuteCommandAsync(); - await _bookingorderservice.SaveLog(newOrder.Value, order, "回推船期"); + await _bookingorderservice.SaveLog(newOrder.Value, order, "回推船期", new List() + { + nameof(BookingOrder.StartATA), + nameof(BookingOrder.StartETA), + nameof(BookingOrder.YgtETD), + nameof(BookingOrder.ATD), + }); } - - } if (issend) { @@ -2769,6 +2806,70 @@ namespace Myshipping.Application 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); } #endregion @@ -3023,6 +3124,7 @@ namespace Myshipping.Application CreatedTime = DateTime.Now, CreatedUserId = 0, CreatedUserName = string.IsNullOrEmpty(item.UserName) ? UserManager.Name : item.UserName, + FromFunc = "封账" }); await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail { diff --git a/Myshipping.Core/Const/TenantParamCode.cs b/Myshipping.Core/Const/TenantParamCode.cs index 66bd75ad..a078f2aa 100644 --- a/Myshipping.Core/Const/TenantParamCode.cs +++ b/Myshipping.Core/Const/TenantParamCode.cs @@ -50,5 +50,15 @@ /// 订舱分公司信息 /// public const string BOOKING_SUB_TENANT = "BOOKING_SUB_TENANT"; + + /// + /// 货描允许中文 + /// + public const string DESCRIP_CAN_CHINESE = "DESCRIP_CAN_CHINESE"; + + /// + /// 订舱台账显示退舱 + /// + public const string BOOKING_LIST_SHOW_CANCEL = "BOOKING_LIST_SHOW_CANCEL"; } } diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 2f91e4aa..05f69abc 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -923,6 +923,16 @@ 订舱分公司信息 + + + 货描允许中文 + + + + + 订舱台账显示退舱 + + 代码 diff --git a/Myshipping.Core/Service/Auth/AuthService.cs b/Myshipping.Core/Service/Auth/AuthService.cs index b2adf52c..0a531368 100644 --- a/Myshipping.Core/Service/Auth/AuthService.cs +++ b/Myshipping.Core/Service/Auth/AuthService.cs @@ -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, - 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); //多账号关联 diff --git a/Myshipping.Core/Util/JsonUtil.cs b/Myshipping.Core/Util/JsonUtil.cs index 86697e1c..17f3bc77 100644 --- a/Myshipping.Core/Util/JsonUtil.cs +++ b/Myshipping.Core/Util/JsonUtil.cs @@ -267,11 +267,11 @@ public static class JsonUtil return "HS代码存在中文字符"; } - if (Regex.IsMatch(sourceVal.ToString(), @"[\u4e00-\u9fa5]") && propName.ToUpper() == "DESCRIPTION") - { - return "货描存在中文字符"; + //if (Regex.IsMatch(sourceVal.ToString(), @"[\u4e00-\u9fa5]") && propName.ToUpper() == "DESCRIPTION") + //{ + // return "货描存在中文字符"; - } + //} //if (Regex.IsMatch(sourceVal.ToString(), @"[\u4e00-\u9fa5]") && propName.ToUpper() == "CUSTNO") //{ // return "订舱编号存在中文字符";