From d7f3fff594b602ade510e7cf77c9fb0a64339efd Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Mon, 5 Jun 2023 14:55:09 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=B8=85=E7=90=86?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Core/Job/LogJobWorker.cs | 32 ++++++++++++------- .../Properties/launchSettings.json | 6 ++-- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Myshipping.Core/Job/LogJobWorker.cs b/Myshipping.Core/Job/LogJobWorker.cs index 5bfabaed..cc3b8e7a 100644 --- a/Myshipping.Core/Job/LogJobWorker.cs +++ b/Myshipping.Core/Job/LogJobWorker.cs @@ -13,6 +13,7 @@ using System.IO; using Furion.DynamicApiController; using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; +using Furion.Logging; namespace Myshipping.Core.Job; @@ -42,7 +43,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient } // 默认值 - var daysAgo = 15; + var daysAgo = 30; var sysCache = App.GetRequiredService(); @@ -53,10 +54,12 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient // 如果存在相关配置项 if (parameters != null && parameters.ContainsKey("daysAgo") && - string.IsNullOrEmpty(parameters["daysAgo"])) + !string.IsNullOrEmpty(parameters["daysAgo"])) daysAgo = int.Parse(parameters["daysAgo"]); } + Log.Information($"准备清理天{daysAgo}之前的日志LogEx"); + // 生成查询表达式 Expression> expression = ex => ex.ExceptionTime < DateTime.Now.AddDays(-daysAgo); @@ -69,7 +72,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient /// /// /// - [SpareTime("@midnight", "LogOpDeletionService", Description = "后台定期删除操作日志,配置项参数:{\"daysAgo\": 7},不填默认为7", + [SpareTime("@midnight", "LogOpDeletionService", Description = "后台定期删除操作日志,配置项参数:{\"daysAgo\": 30},不填默认为30", DoOnce = false, StartNow = true, ExecuteType = SpareTimeExecuteTypes.Serial)] public void DoDeleteLogOp(SpareTimer timer, long count) { @@ -80,7 +83,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient } // 默认值 - var daysAgo = 7; + var daysAgo = 30; var sysCache = App.GetRequiredService(); @@ -91,10 +94,12 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient // 如果存在相关配置项 if (parameters != null && parameters.ContainsKey("daysAgo") && - string.IsNullOrEmpty(parameters["daysAgo"])) + !string.IsNullOrEmpty(parameters["daysAgo"])) daysAgo = int.Parse(parameters["daysAgo"]); } + Log.Information($"准备清理天{daysAgo}之前的日志LogOp"); + // 生成查询表达式 Expression> expression = ex => ex.OpTime < DateTime.Now.AddDays(-daysAgo); @@ -107,7 +112,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient /// /// /// - [SpareTime("@midnight", "LogVisDeletionService", Description = "后台定期删除访问日志,配置项参数:{\"daysAgo\": 15},不填默认为15", + [SpareTime("@midnight", "LogVisDeletionService", Description = "后台定期删除访问日志,配置项参数:{\"daysAgo\": 30},不填默认为30", DoOnce = false, StartNow = true, ExecuteType = SpareTimeExecuteTypes.Serial)] public void DoDeleteLogVis(SpareTimer timer, long count) { @@ -118,7 +123,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient } // 默认值 - var daysAgo = 15; + var daysAgo = 30; var sysCache = App.GetRequiredService(); @@ -129,10 +134,12 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient // 如果存在相关配置项 if (parameters != null && parameters.ContainsKey("daysAgo") && - string.IsNullOrEmpty(parameters["daysAgo"])) + !string.IsNullOrEmpty(parameters["daysAgo"])) daysAgo = int.Parse(parameters["daysAgo"]); } + Log.Information($"准备清理天{daysAgo}之前的日志LogVis"); + // 生成查询表达式 Expression> expression = ex => ex.VisTime < DateTime.Now.AddDays(-daysAgo); @@ -204,7 +211,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient Scoped.Create((_, scope) => { var services = scope.ServiceProvider; - var logRep =App.GetService(services); + var logRep = App.GetService(services); var sysCache = services.GetRequiredService(); // 默认值 @@ -252,7 +259,7 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient { var services = scope.ServiceProvider; var logRep = App.GetService(services); - logRep.Deleteable(expression); + logRep.Deleteable(expression).ExecuteCommand(); }); } @@ -288,10 +295,11 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient { fi.Delete(true); } - else { + else + { TemporaryDirectories(it); } - + } } } diff --git a/Myshipping.Web.Entry/Properties/launchSettings.json b/Myshipping.Web.Entry/Properties/launchSettings.json index 73fa5ef9..0e72b226 100644 --- a/Myshipping.Web.Entry/Properties/launchSettings.json +++ b/Myshipping.Web.Entry/Properties/launchSettings.json @@ -13,7 +13,8 @@ "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "nativeDebugging": true }, "Myshipping.Web.Entry": { "commandName": "Project", @@ -22,7 +23,8 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "http://localhost:5000", - "dotnetRunMessages": "true" + "dotnetRunMessages": "true", + "nativeDebugging": true } } } \ No newline at end of file From a2b207b2668791733b273e6687b0b4c8f84d7d53 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Mon, 5 Jun 2023 17:15:08 +0800 Subject: [PATCH 02/17] 1 --- .../BookingOrder/BookingOrderService.cs | 9 ++- .../BookingOrder/Dto/BookingEDIExtDto.cs | 15 +++++ .../BookingOrder/Dto/PageBookingOrder.cs | 3 + .../BookingOrderSeaeEdiService.cs | 61 ++++++++++++++++++- .../Dto/BookingOrderSeaeEdiServiceDto.cs | 4 ++ 5 files changed, 90 insertions(+), 2 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 6133bfe2..efb85837 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -492,7 +492,14 @@ namespace Myshipping.Application } item.GoodsStatusList = itgoods.Union(itconfig).OrderBy(x => x.Sort).ToList(); - + var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id&&(x.Status== "提箱"|| x.Status == "返场")).OrderByDescending(x => x.CreatedTime).ToListAsync(); + var dto = statuslog.Adapt>(); + foreach (var it in dto) + { + var detail = await _statuslogdetail.AsQueryable().Where(x => x.PId == it.Id).ToListAsync(); + it.detail = detail.Adapt>(); + } + item.statuslogs = dto; } return list; diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIExtDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIExtDto.cs index 6a0121e7..d8959dd3 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIExtDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIExtDto.cs @@ -171,5 +171,20 @@ namespace Myshipping.Application /// CNPTNo /// public string CNPTNo { get; set; } + + + + + /// + /// 箱满仓业务员 + /// + [Description("箱满仓业务员")] + public string XMCYWY { get; set; } + + /// + /// EMC Name accout + /// + [Description("EMC Name accout")] + public string EmcNameAccount { get; set; } } } diff --git a/Myshipping.Application/Service/BookingOrder/Dto/PageBookingOrder.cs b/Myshipping.Application/Service/BookingOrder/Dto/PageBookingOrder.cs index 1f8d2fae..2c1a26d4 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/PageBookingOrder.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/PageBookingOrder.cs @@ -813,6 +813,9 @@ namespace Myshipping.Application.Service.BookingOrder.Dto public List bookremark { get; set; } + + public List statuslogs { get; set; } + public List GoodsStatusList { get; set; } /// diff --git a/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs b/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs index 1340a425..8434baff 100644 --- a/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs +++ b/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs @@ -49,12 +49,16 @@ namespace Myshipping.Application private readonly SqlSugarRepository _seaeedi; private readonly SqlSugarRepository _seaeedictn; private readonly ISysCacheService _cache; + private readonly IBookingOrderService _rep; private readonly SqlSugarRepository _repStatuslog; private readonly SqlSugarRepository _repTemplate; private readonly IDjyWebsiteAccountConfigService _webAccountConfig; + private readonly SqlSugarRepository _goodsStatusConfig; + private readonly SqlSugarRepository _goodsStatus; public BookingOrderSeaeEdiService(ILogger logger, SqlSugarRepository seaeedi, SqlSugarRepository seaeedictn, ISysCacheService cache, SqlSugarRepository repStatuslog, - SqlSugarRepository repTemplate, + SqlSugarRepository repTemplate, SqlSugarRepository goodsStatusConfig, + SqlSugarRepository goodsStatus, IBookingOrderService rep, IDjyWebsiteAccountConfigService webAccountConfig) { this._logger = logger; @@ -64,6 +68,9 @@ namespace Myshipping.Application this._repStatuslog = repStatuslog; this._webAccountConfig = webAccountConfig; this._repTemplate = repTemplate; + this._goodsStatusConfig = goodsStatusConfig; + this._goodsStatus = goodsStatus; + this._rep = rep; } /// /// 获取数据 @@ -375,7 +382,59 @@ namespace Myshipping.Application if (type == "4") { await _seaeedi.UpdateAsync(x => x.Id == Id, x => new BookingOrderSeaeEdi { State = "已作废", SENDREMARK = SENDREMARK }); + + + + + } + if (type == "3"|| type == "0"||type == "1") { + #region 插入货运动态 + //配置中所有的货物状态 + var config = _goodsStatusConfig.AsQueryable().Where(config => config.CreatedUserId == order.CreatedUserId).ToList().DistinctBy(x => x.StatusName).Select(config => new GoodsStatusQuery + { + + ConfigId = config.Id, + SystemCode = config.SystemCode, + StatusName = config.StatusName, + FinishTime = null, + FinishUser = null, + FinishUserId = null, + IsPublic = false, + ExtData = null, + Remark = null, + Sort = config.Sort + }).ToList(); + + var ConfigId = config.Where(x => x.StatusName == "已订舱").Select(x => x.ConfigId).First(); + + await _goodsStatus.InsertAsync(new BookingGoodsStatus + { + bookingId= Id, + ConfigId= ConfigId, + FinishTime=DateTime.Now, + FinishUser= order.CreatedUserName, + FinishUserId = order.CreatedUserId, + IsPublic=false + }); + List tslist = new List(); + tslist.Add((long)Id); + var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault(); + if (!string.IsNullOrEmpty(itemcode)) + { + if (itemcode == "true") + await _rep.SendBookingOrder(tslist.ToArray()); + _logger.LogInformation(Id + "自动订舱货物状态推送成功!"); + } } + + + + + + #endregion + + + } } diff --git a/Myshipping.Application/Service/BookingOrderSeaeEdi/Dto/BookingOrderSeaeEdiServiceDto.cs b/Myshipping.Application/Service/BookingOrderSeaeEdi/Dto/BookingOrderSeaeEdiServiceDto.cs index f42595b7..716896b4 100644 --- a/Myshipping.Application/Service/BookingOrderSeaeEdi/Dto/BookingOrderSeaeEdiServiceDto.cs +++ b/Myshipping.Application/Service/BookingOrderSeaeEdi/Dto/BookingOrderSeaeEdiServiceDto.cs @@ -197,6 +197,10 @@ namespace Myshipping.Application.Service.BookingOrderSeaeEdi.Dto /// 状态 /// public string State { get; set; } + + + + public List EdiCtn { get; set; } From 6d1c537ee27d768017d9515374a7633c5556c097 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Tue, 6 Jun 2023 11:22:35 +0800 Subject: [PATCH 03/17] 1 --- .../BookingOrder/BookingOrderService.cs | 2593 ++++++++++------- .../BookingOrder/Dto/BookingEDIExtDto.cs | 3 - .../BookingOrder/IBookingOrderService.cs | 4 +- 3 files changed, 1601 insertions(+), 999 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index efb85837..0e8d35f7 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -821,7 +821,14 @@ namespace Myshipping.Application } item.GoodsStatusList = itgoods.Union(itconfig).OrderBy(x => x.Sort).ToList(); - + var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id && (x.Status == "提箱" || x.Status == "返场")).OrderByDescending(x => x.CreatedTime).ToListAsync(); + var dto = statuslog.Adapt>(); + foreach (var it in dto) + { + var detail = await _statuslogdetail.AsQueryable().Where(x => x.PId == it.Id).ToListAsync(); + it.detail = detail.Adapt>(); + } + item.statuslogs = dto; } return list; @@ -4234,7 +4241,7 @@ namespace Myshipping.Application /// 订舱、截单EDI请求 /// 返回回执 [HttpPost("/BookingOrder/SendBookingOrClosingEDI")] - public async Task SendBookingOrClosingEDI(BookingOrClosingEDIOrderDto model) + public async Task SendBookingOrClosingEDI(BookingOrClosingEDIOrderDto model) { var dictvalue = _cache.GetAllDictData().Result.Where(x => x.Code == "XiangManCang").Select(x => x.Value).FirstOrDefault(); @@ -4242,598 +4249,1195 @@ namespace Myshipping.Application var FORWARDER = order.FORWARDER; if (!string.IsNullOrEmpty(FORWARDER) && dictvalue == FORWARDER) { - var edi = _bookingEDIExt.FirstOrDefault(x => x.BookingId == model.Id); - var ctn = _repCtn.AsQueryable().Where(x => x.BILLID == model.Id).ToList(); - #region 箱满仓生成excel文件 - string fileName = String.Empty; - var opt = App.GetOptions(); - var dirAbs = opt.basePath; - if (string.IsNullOrEmpty(dirAbs)) - { - dirAbs = App.WebHostEnvironment.WebRootPath; + #region + //var edi = _bookingEDIExt.FirstOrDefault(x => x.BookingId == model.Id); + //var ctn = _repCtn.AsQueryable().Where(x => x.BILLID == model.Id).ToList(); + //#region 箱满仓生成excel文件 + //string fileName = String.Empty; + //var opt = App.GetOptions(); + //var dirAbs = opt.basePath; + //if (string.IsNullOrEmpty(dirAbs)) + //{ + // dirAbs = App.WebHostEnvironment.WebRootPath; + //} + //var fPath = "upload/printtemplate/箱满舱上传Excel模板.xls"; + //var fileAbsPath = Path.Combine(dirAbs, fPath); + //_logger.LogInformation($"准备调用EXCEL"); + //var file = new FileStream(fileAbsPath, FileMode.Open); + //var excelwork = new HSSFWorkbook(file); + //var sheet = excelwork.GetSheetAt(0); + //for (int i = 0; i < sheet.LastRowNum; i++) + //{ + // ////获取行 + // var row = sheet.GetRow(i); + // if (i == 0) + // { + // //委托编号 + // ICell cell = row.GetCell(5); + // if (cell != null) + // { + // row.Cells[5].SetCellValue(order.CUSTNO); + // } + // else + // { + // row.CreateCell(5).SetCellValue(order.CUSTNO); + // } + // } + // if (i == 1) + // { + // //场站 + // var yardid = order.YARDID; + // if (!string.IsNullOrEmpty(yardid)) + // { + // ICell cell = row.GetCell(5); + // var yard = _cache.GetAllMappingYard().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == yardid).Select(x => x.MapCode).First(); + // if (cell != null) + // { + // row.Cells[5].SetCellValue(yard); + // } + // else + // { + // row.CreateCell(5).SetCellValue(yard); + // } + + // } + + // } + // if (i == 2) + // { + // //指定业务员 + // ICell cell = row.GetCell(5); + // if (cell != null) + // { + // row.Cells[5].SetCellValue(edi.XMCYWY); + // } + // else + // { + // row.CreateCell(5).SetCellValue(edi.XMCYWY); + // } + // } + // if (i == 3) + // { + // //提单号 + // ICell cell = row.GetCell(5); + // if (cell != null) + // { + // row.Cells[5].SetCellValue(order.MBLNO); + // } + // else + // { + // row.CreateCell(5).SetCellValue(order.MBLNO); + // } + // } + // if (i == 8) + // { + // //发货人 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.SHIPPER); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.SHIPPER); + // } + // } + // if (i == 10) + // { + // //发货人代码 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.SHIPPERID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.SHIPPERID); + // } + // } + // if (i == 11) + // { + // //收货人 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.CONSIGNEE); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.CONSIGNEE); + // } + // } + // if (i == 14) + // { + // //通知人 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.NOTIFYPARTY); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.NOTIFYPARTY); + // } + // } + // if (i == 17) + // { + // //第二通知人 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.NOTIFYPARTY2); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.NOTIFYPARTY2); + // } + // } + // if (i == 18) + // { + // //起运港国际五字代码 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.PORTLOADID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PORTLOADID); + // } + + // var service = order.SERVICE; + // //运输方式 + // ICell cell5 = row.GetCell(5); + // if (cell5 != null) + // { + // row.Cells[5].SetCellValue(_cache.GetAllMappingService().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == service).Select(x => x.MapCode).First()); + // } + // else + // { + // row.CreateCell(5).SetCellValue(_cache.GetAllMappingService().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == service).Select(x => x.MapCode).First()); + // } + + + + + + // } + // if (i == 19) + // { + // //卸货港国际五字代码 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.PORTDISCHARGEID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PORTDISCHARGEID); + // } + // } + // if (i == 20) + // { + // //交货地国际五字代码 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.PLACEDELIVERYID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PLACEDELIVERYID); + // } + // } + // if (i == 21) + // { + // //ETD + + // if (order.ETD != null) + // { + + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(Convert.ToDateTime(order.ETD).ToString("yyyy-MM-dd")); + // } + // else + // { + // row.CreateCell(1).SetCellValue(Convert.ToDateTime(order.ETD).ToString("yyyy-MM-dd")); + // } + // } + + + // //船名 + // ICell cell4 = row.GetCell(4); + // if (cell4 != null) + // { + // row.Cells[4].SetCellValue(order.VESSEL); + // } + // else + // { + // row.CreateCell(4).SetCellValue(order.VESSEL); + // } + + // } + // if (i == 22) + // { + // //客户协约号 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.CONTRACTNO); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.CONTRACTNO); + // } + // } + // if (i == 23) + // { + // //航次 + // ICell cell = row.GetCell(4); + // if (cell != null) + // { + // row.Cells[4].SetCellValue(order.VOYNO); + // } + // else + // { + // row.CreateCell(4).SetCellValue(order.VOYNO); + // } + // } + // if (i == 26) + // { + // //唛头 + // ICell cell = row.GetCell(0); + // if (cell != null) + // { + // row.Cells[0].SetCellValue(order.MARKS); + // } + // else + // { + // row.CreateCell(0).SetCellValue(order.MARKS); + // } + + // if (order.PKGS != null) + // { + // //件数 + // ICell cell1 = row.GetCell(1); + // if (cell1 != null) + // { + // row.Cells[1].SetCellValue(order.PKGS.ToString()); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PKGS.ToString()); + // } + + // } + // //包装 + // ICell cell2 = row.GetCell(2); + // if (cell2 != null) + // { + // row.Cells[2].SetCellValue(order.KINDPKGS); + // } + // else + // { + // row.CreateCell(2).SetCellValue(order.KINDPKGS); + // } + // //品名 + // ICell cell3 = row.GetCell(3); + // if (cell3 != null) + // { + // row.Cells[3].SetCellValue(order.DESCRIPTION); + // } + // else + // { + // row.CreateCell(3).SetCellValue(order.DESCRIPTION); + // } + // if (order.KGS != null) + // { + // //重量 + // ICell cell4 = row.GetCell(4); + // if (cell3 != null) + // { + // row.Cells[4].SetCellValue(order.KGS.ToString()); + // } + // else + // { + // row.CreateCell(4).SetCellValue(order.KGS.ToString()); + // } + // } + // if (order.CBM != null) + // { + // //尺码 + // ICell cell5 = row.GetCell(5); + // if (cell5 != null) + // { + // row.Cells[5].SetCellValue(order.CBM.ToString()); + // } + // else + // { + // row.CreateCell(5).SetCellValue(order.CBM.ToString()); + // } + // } + // } + // if (i == 39) + // { + // var c = ctn.DistinctBy(x => x.CTNALL).ToList(); + // var ctnAll = string.Empty; + // foreach (var item in c) + // { + // ctnAll += $"{ctn.Where(x => x.CTNALL == item.CTNALL).Count()}*{_cache.GetAllMappingCtn().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == item.CTNCODE).Select(x => x.MapCode).First()}+"; + // } + // ctnAll = ctnAll.Substring(0, ctnAll.Length - 1); + // //箱型箱量 + // ICell cell = row.GetCell(0); + // if (cell != null) + // { + // row.Cells[0].SetCellValue(ctnAll); + // } + // else + // { + // row.CreateCell(0).SetCellValue(ctnAll); + // } + // } + // if (i == 42) + // { + // //运费支付方式 + + // var BLFRTCode = _cache.GetAllCodeFrt().Result.Where(x => x.EnName == order.BLFRT).Select(x => x.Code).First(); + // var bl = string.Empty; + // if (!string.IsNullOrEmpty(BLFRTCode)) + // { + // bl = _cache.GetAllMappingFrt().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == BLFRTCode).Select(x => x.MapCode).First(); + // } + // ICell cell = row.GetCell(0); + // if (cell != null) + // { + // row.Cells[0].SetCellValue(bl); + // } + // else + // { + // row.CreateCell(0).SetCellValue(bl); + // } + // } + // if (i == 43) + // { + // //hscode + // ICell cell = row.GetCell(3); + // if (cell != null) + // { + // row.Cells[3].SetCellValue(order.HSCODE); + // } + // else + // { + // row.CreateCell(3).SetCellValue(order.HSCODE); + // } + // } + // if (i == 44) + // { + // var BLFRTCode = _cache.GetAllCodeFrt().Result.Where(x => x.EnName == order.BLFRT).Select(x => x.Code).First(); + // var bl = string.Empty; + // if (!string.IsNullOrEmpty(BLFRTCode)) + // { + // bl = _cache.GetAllMappingFrt().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == BLFRTCode).Select(x => x.MapCode).First(); + // } + // if (bl == "预付") + // { + // //预付地点 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.PREPARDATID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PREPARDATID); + // } + + // } + // else if((bl == "到付")) + // { + + // //预付地点 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.PAYABLEATID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PAYABLEATID); + // } + + + // } + + // } + // if (i == 45) + // { + // //Name accout + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(edi.EmcNameAccount); + // } + // else + // { + // row.CreateCell(1).SetCellValue(edi.EmcNameAccount); + // } + // } + // if (i == 47) + // { + // //Name accout + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.TEMPSET); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.TEMPSET); + // } + + + + // //温度 + // ICell cell2 = row.GetCell(2); + // if (cell2 != null) + // { + // row.Cells[2].SetCellValue(order.TEMPSET); + // } + // else + // { + // row.CreateCell(2).SetCellValue(order.TEMPSET); + // } + + + // //湿度 + // ICell cell3 = row.GetCell(3); + // if (cell2 != null) + // { + // row.Cells[3].SetCellValue(order.HUMIDITY); + // } + // else + // { + // row.CreateCell(3).SetCellValue(order.HUMIDITY); + // } + // } + // if (i == 49) + // { + // //危险品编号 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.DUNNO); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.DUNNO); + // } + // } + // if (i == 50) + // { + // //订舱备注 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.SOREMARK); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.SOREMARK); + // } + // } + //} + + //var fileFullPath = Path.Combine(App.WebHostEnvironment.WebRootPath, App.GetOptions().Path);//服务器路径 + //if (!Directory.Exists(fileFullPath)) + //{ + // Directory.CreateDirectory(fileFullPath); + //} + + ////2023-4-3,根据合川操作要求,文件名只带提单号 + //if (!string.IsNullOrEmpty(order.MBLNO)) + //{ + // fileName = $"{DateTime.Now.Ticks}_{order.MBLNO}.xls";//名称 + //} + //else + //{ + // fileName = $"{DateTime.Now.Ticks}_{order.MBLNO}.xls";//名称 + //} + //_logger.LogInformation("导出excel:" + Path.Combine(fileFullPath, fileName)); + //var filestream = new FileStream(Path.Combine(fileFullPath, fileName), FileMode.OpenOrCreate, FileAccess.ReadWrite); + //excelwork.Write(filestream); + //#endregion + + //#region 调用爬虫接口 + + //var url = _cache.GetAllDictData().Result.Where(x => x.Code == "xiangManCangPostUrl").Select(x => x.Value).FirstOrDefault(); + + //var account = _webAccountConfig.GetAccountConfig("XiangManCang", UserManager.UserId).Result; + + + //var key = _cache.GetAllSysConfig().Result.Where(x => x.Code == "billTraceNewUserKey").Select(x => x.Value).FirstOrDefault(); + //if (string.IsNullOrEmpty(key)) + //{ + // throw Oops.Bah("未获取到相关KEY,请联系管理员!"); + //} + + //var secret = _cache.GetAllSysConfig().Result.Where(x => x.Code == "billTraceNewUserSecret").Select(x => x.Value).FirstOrDefault(); + //if (string.IsNullOrEmpty(secret)) + //{ + // throw Oops.Bah("未获取到相关SECRET,请联系管理员!"); + //} + //////使用HttpClient方式上传文件 + //var carrier_code = _cache.GetAllMappingCarrier().Result.Where(x => x.Module == "HeChuan" && x.MapCode == order.CARRIERID).Select(x => x.Code).First(); + //string fn = string.Empty; + //using (var httpClient = new HttpClient()) + //{ + // using (var request = new HttpRequestMessage(new HttpMethod("Post"), url)) + // { + // request.Headers.TryAddWithoutValidation("Content-Type", "application/x-www-form-urlencoded"); + // var multipartContent = new MultipartFormDataContent(); + // multipartContent.Add(new StringContent("user_key"), key); + // multipartContent.Add(new StringContent("user_secret"), secret); + // multipartContent.Add(new StringContent("web_user"), account.Account); + // multipartContent.Add(new StringContent("web_psw"), account.Password); + // multipartContent.Add(new StringContent("carrier_code"), carrier_code); + // multipartContent.Add(new StreamContent(filestream, (int)filestream.Length), "file", fileName); + // request.Content = multipartContent; + // var response = await httpClient.SendAsync(request); + // if (response.IsSuccessStatusCode) + // { + // var strRtn = response.Content.ReadAsStringAsync().Result; + // var jobj = strRtn.ToJObject(); + // if (jobj.GetIntValue("code") == 200) + // { + // fn = jobj.GetStringValue("msg"); + + // } + // else + // { + // throw Oops.Bah(jobj.GetStringValue("msg")); + // } + // } + // } + //} + + //return fn; + //#endregion + #endregion + return await XMCEXCEL(model.Id); + } + else { + return await InnerBookingOrClosingEDI(model); + } + + } + + [NonAction] + public async Task XMCEXCEL(long Id,bool flag=false) { + + var order = _rep.FirstOrDefault(x => x.Id == Id); + var edi = _bookingEDIExt.FirstOrDefault(x => x.BookingId == Id); + var ctn = _repCtn.AsQueryable().Where(x => x.BILLID == Id).ToList(); + #region 箱满仓生成excel文件 + string fileName = String.Empty; + var opt = App.GetOptions(); + var dirAbs = opt.basePath; + if (string.IsNullOrEmpty(dirAbs)) + { + dirAbs = App.WebHostEnvironment.WebRootPath; + } + var fPath = "upload/printtemplate/箱满舱上传Excel模板.xls"; + var fileAbsPath = Path.Combine(dirAbs, fPath); + _logger.LogInformation($"准备调用EXCEL"); + var file = new FileStream(fileAbsPath, FileMode.Open); + var excelwork = new HSSFWorkbook(file); + var sheet = excelwork.GetSheetAt(0); + for (int i = 0; i < sheet.LastRowNum; i++) + { + ////获取行 + var row = sheet.GetRow(i); + if (i == 0) + { + //委托编号 + ICell cell = row.GetCell(5); + if (cell != null) + { + row.Cells[5].SetCellValue(order.CUSTNO); + } + else + { + row.CreateCell(5).SetCellValue(order.CUSTNO); + } } - var fPath = "upload/printtemplate/箱满舱上传Excel模板.xls"; - var fileAbsPath = Path.Combine(dirAbs, fPath); - _logger.LogInformation($"准备调用EXCEL"); - var file = new FileStream(fileAbsPath, FileMode.Open); - var excelwork = new HSSFWorkbook(file); - var sheet = excelwork.GetSheetAt(0); - for (int i = 0; i < sheet.LastRowNum; i++) + if (i == 1) { - ////获取行 - var row = sheet.GetRow(i); - if (i == 0) + //场站 + var yardid = order.YARDID; + if (!string.IsNullOrEmpty(yardid)) { - //委托编号 ICell cell = row.GetCell(5); + var yard = _cache.GetAllMappingYard().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == yardid).Select(x => x.MapCode).First(); if (cell != null) { - row.Cells[5].SetCellValue(order.CUSTNO); + row.Cells[5].SetCellValue(yard); } else { - row.CreateCell(5).SetCellValue(order.CUSTNO); + row.CreateCell(5).SetCellValue(yard); } - } - if (i == 1) - { - //场站 - var yardid = order.YARDID; - if (!string.IsNullOrEmpty(yardid)) - { - ICell cell = row.GetCell(5); - var yard = _cache.GetAllMappingYard().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == yardid).Select(x => x.MapCode).First(); - if (cell != null) - { - row.Cells[5].SetCellValue(yard); - } - else - { - row.CreateCell(5).SetCellValue(yard); - } - } + } + } + if (i == 2) + { + //指定业务员 + ICell cell = row.GetCell(5); + if (cell != null) + { + row.Cells[5].SetCellValue(edi.XMCYWY); } - if (i == 2) + else { - //指定业务员 - ICell cell = row.GetCell(5); - if (cell != null) - { - row.Cells[5].SetCellValue(edi.XMCYWY); - } - else - { - row.CreateCell(5).SetCellValue(edi.XMCYWY); - } + row.CreateCell(5).SetCellValue(edi.XMCYWY); } - if (i == 3) + } + if (i == 3) + { + //提单号 + ICell cell = row.GetCell(5); + if (cell != null) { - //提单号 - ICell cell = row.GetCell(5); - if (cell != null) - { - row.Cells[5].SetCellValue(order.MBLNO); - } - else - { - row.CreateCell(5).SetCellValue(order.MBLNO); - } + row.Cells[5].SetCellValue(order.MBLNO); } - if (i == 8) + else { - //发货人 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.SHIPPER); - } - else - { - row.CreateCell(1).SetCellValue(order.SHIPPER); - } + row.CreateCell(5).SetCellValue(order.MBLNO); } - if (i == 10) + } + if (i == 8) + { + //发货人 + ICell cell = row.GetCell(1); + if (cell != null) { - //发货人代码 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.SHIPPERID); - } - else - { - row.CreateCell(1).SetCellValue(order.SHIPPERID); - } + row.Cells[1].SetCellValue(order.SHIPPER); } - if (i == 11) + else { - //收货人 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.CONSIGNEE); - } - else - { - row.CreateCell(1).SetCellValue(order.CONSIGNEE); - } + row.CreateCell(1).SetCellValue(order.SHIPPER); } - if (i == 14) + } + if (i == 10) + { + //发货人代码 + ICell cell = row.GetCell(1); + if (cell != null) { - //通知人 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.NOTIFYPARTY); - } - else - { - row.CreateCell(1).SetCellValue(order.NOTIFYPARTY); - } + row.Cells[1].SetCellValue(order.SHIPPERID); } - if (i == 17) + else { - //第二通知人 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.NOTIFYPARTY2); - } - else - { - row.CreateCell(1).SetCellValue(order.NOTIFYPARTY2); - } + row.CreateCell(1).SetCellValue(order.SHIPPERID); + } + } + if (i == 11) + { + //收货人 + ICell cell = row.GetCell(1); + if (cell != null) + { + row.Cells[1].SetCellValue(order.CONSIGNEE); } - if (i == 18) + else { - //起运港国际五字代码 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.PORTLOADID); - } - else - { - row.CreateCell(1).SetCellValue(order.PORTLOADID); - } + row.CreateCell(1).SetCellValue(order.CONSIGNEE); + } + } + if (i == 14) + { + //通知人 + ICell cell = row.GetCell(1); + if (cell != null) + { + row.Cells[1].SetCellValue(order.NOTIFYPARTY); + } + else + { + row.CreateCell(1).SetCellValue(order.NOTIFYPARTY); + } + } + if (i == 17) + { + //第二通知人 + ICell cell = row.GetCell(1); + if (cell != null) + { + row.Cells[1].SetCellValue(order.NOTIFYPARTY2); + } + else + { + row.CreateCell(1).SetCellValue(order.NOTIFYPARTY2); + } + } + if (i == 18) + { + //起运港国际五字代码 + ICell cell = row.GetCell(1); + if (cell != null) + { + row.Cells[1].SetCellValue(order.PORTLOADID); + } + else + { + row.CreateCell(1).SetCellValue(order.PORTLOADID); + } - var service = order.SERVICE; - //运输方式 - ICell cell5 = row.GetCell(5); - if (cell5 != null) - { - row.Cells[5].SetCellValue(_cache.GetAllMappingService().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == service).Select(x => x.MapCode).First()); - } - else - { - row.CreateCell(5).SetCellValue(_cache.GetAllMappingService().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == service).Select(x => x.MapCode).First()); - } + var service = order.SERVICE; + //运输方式 + ICell cell5 = row.GetCell(5); + if (cell5 != null) + { + row.Cells[5].SetCellValue(_cache.GetAllMappingService().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == service).Select(x => x.MapCode).First()); + } + else + { + row.CreateCell(5).SetCellValue(_cache.GetAllMappingService().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == service).Select(x => x.MapCode).First()); + } + } + if (i == 19) + { + //卸货港国际五字代码 + ICell cell = row.GetCell(1); + if (cell != null) + { + row.Cells[1].SetCellValue(order.PORTDISCHARGEID); } - if (i == 19) + else + { + row.CreateCell(1).SetCellValue(order.PORTDISCHARGEID); + } + } + if (i == 20) + { + //交货地国际五字代码 + ICell cell = row.GetCell(1); + if (cell != null) + { + row.Cells[1].SetCellValue(order.PLACEDELIVERYID); + } + else { - //卸货港国际五字代码 + row.CreateCell(1).SetCellValue(order.PLACEDELIVERYID); + } + } + if (i == 21) + { + //ETD + + if (order.ETD != null) + { + ICell cell = row.GetCell(1); if (cell != null) { - row.Cells[1].SetCellValue(order.PORTDISCHARGEID); + row.Cells[1].SetCellValue(Convert.ToDateTime(order.ETD).ToString("yyyy-MM-dd")); } else { - row.CreateCell(1).SetCellValue(order.PORTDISCHARGEID); + row.CreateCell(1).SetCellValue(Convert.ToDateTime(order.ETD).ToString("yyyy-MM-dd")); } } - if (i == 20) + + + //船名 + ICell cell4 = row.GetCell(4); + if (cell4 != null) { - //交货地国际五字代码 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.PLACEDELIVERYID); - } - else - { - row.CreateCell(1).SetCellValue(order.PLACEDELIVERYID); - } + row.Cells[4].SetCellValue(order.VESSEL); } - if (i == 21) + else { - //ETD - - if (order.ETD != null) - { - - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(Convert.ToDateTime(order.ETD).ToString("yyyy-MM-dd")); - } - else - { - row.CreateCell(1).SetCellValue(Convert.ToDateTime(order.ETD).ToString("yyyy-MM-dd")); - } - } + row.CreateCell(4).SetCellValue(order.VESSEL); + } + } + if (i == 22) + { + //客户协约号 + ICell cell = row.GetCell(1); + if (cell != null) + { + row.Cells[1].SetCellValue(order.CONTRACTNO); + } + else + { + row.CreateCell(1).SetCellValue(order.CONTRACTNO); + } + } + if (i == 23) + { + //航次 + ICell cell = row.GetCell(4); + if (cell != null) + { + row.Cells[4].SetCellValue(order.VOYNO); + } + else + { + row.CreateCell(4).SetCellValue(order.VOYNO); + } + } + if (i == 26) + { + //唛头 + ICell cell = row.GetCell(0); + if (cell != null) + { + row.Cells[0].SetCellValue(order.MARKS); + } + else + { + row.CreateCell(0).SetCellValue(order.MARKS); + } - //船名 - ICell cell4 = row.GetCell(4); - if (cell4 != null) + if (order.PKGS != null) + { + //件数 + ICell cell1 = row.GetCell(1); + if (cell1 != null) { - row.Cells[4].SetCellValue(order.VESSEL); + row.Cells[1].SetCellValue(order.PKGS.ToString()); } else { - row.CreateCell(4).SetCellValue(order.VESSEL); + row.CreateCell(1).SetCellValue(order.PKGS.ToString()); } } - if (i == 22) + //包装 + ICell cell2 = row.GetCell(2); + if (cell2 != null) { - //客户协约号 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.CONTRACTNO); - } - else - { - row.CreateCell(1).SetCellValue(order.CONTRACTNO); - } + row.Cells[2].SetCellValue(order.KINDPKGS); } - if (i == 23) + else { - //航次 - ICell cell = row.GetCell(4); - if (cell != null) - { - row.Cells[4].SetCellValue(order.VOYNO); - } - else - { - row.CreateCell(4).SetCellValue(order.VOYNO); - } + row.CreateCell(2).SetCellValue(order.KINDPKGS); } - if (i == 26) + //品名 + ICell cell3 = row.GetCell(3); + if (cell3 != null) { - //唛头 - ICell cell = row.GetCell(0); - if (cell != null) - { - row.Cells[0].SetCellValue(order.MARKS); - } - else - { - row.CreateCell(0).SetCellValue(order.MARKS); - } - - if (order.PKGS != null) - { - //件数 - ICell cell1 = row.GetCell(1); - if (cell1 != null) - { - row.Cells[1].SetCellValue(order.PKGS.ToString()); - } - else - { - row.CreateCell(1).SetCellValue(order.PKGS.ToString()); - } - - } - //包装 - ICell cell2 = row.GetCell(2); - if (cell2 != null) - { - row.Cells[2].SetCellValue(order.KINDPKGS); - } - else - { - row.CreateCell(2).SetCellValue(order.KINDPKGS); - } - //品名 - ICell cell3 = row.GetCell(3); + row.Cells[3].SetCellValue(order.DESCRIPTION); + } + else + { + row.CreateCell(3).SetCellValue(order.DESCRIPTION); + } + if (order.KGS != null) + { + //重量 + ICell cell4 = row.GetCell(4); if (cell3 != null) { - row.Cells[3].SetCellValue(order.DESCRIPTION); + row.Cells[4].SetCellValue(order.KGS.ToString()); } else { - row.CreateCell(3).SetCellValue(order.DESCRIPTION); - } - if (order.KGS != null) - { - //重量 - ICell cell4 = row.GetCell(4); - if (cell3 != null) - { - row.Cells[4].SetCellValue(order.KGS.ToString()); - } - else - { - row.CreateCell(4).SetCellValue(order.KGS.ToString()); - } - } - if (order.CBM != null) - { - //尺码 - ICell cell5 = row.GetCell(5); - if (cell5 != null) - { - row.Cells[5].SetCellValue(order.CBM.ToString()); - } - else - { - row.CreateCell(5).SetCellValue(order.CBM.ToString()); - } + row.CreateCell(4).SetCellValue(order.KGS.ToString()); } } - if (i == 39) + if (order.CBM != null) { - var c = ctn.DistinctBy(x => x.CTNALL).ToList(); - var ctnAll = string.Empty; - foreach (var item in c) - { - ctnAll += $"{ctn.Where(x => x.CTNALL == item.CTNALL).Count()}*{_cache.GetAllMappingCtn().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == item.CTNCODE).Select(x => x.MapCode).First()}+"; - } - ctnAll = ctnAll.Substring(0, ctnAll.Length - 1); - //箱型箱量 - ICell cell = row.GetCell(0); - if (cell != null) + //尺码 + ICell cell5 = row.GetCell(5); + if (cell5 != null) { - row.Cells[0].SetCellValue(ctnAll); + row.Cells[5].SetCellValue(order.CBM.ToString()); } else { - row.CreateCell(0).SetCellValue(ctnAll); + row.CreateCell(5).SetCellValue(order.CBM.ToString()); } } - if (i == 42) + } + if (i == 39) + { + var c = ctn.DistinctBy(x => x.CTNALL).ToList(); + var ctnAll = string.Empty; + foreach (var item in c) { - //运费支付方式 - - var BLFRTCode = _cache.GetAllCodeFrt().Result.Where(x => x.EnName == order.BLFRT).Select(x => x.Code).First(); - var bl = string.Empty; - if (!string.IsNullOrEmpty(BLFRTCode)) - { - bl = _cache.GetAllMappingFrt().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == BLFRTCode).Select(x => x.MapCode).First(); - } - ICell cell = row.GetCell(0); - if (cell != null) - { - row.Cells[0].SetCellValue(bl); - } - else - { - row.CreateCell(0).SetCellValue(bl); - } + ctnAll += $"{ctn.Where(x => x.CTNALL == item.CTNALL).Count()}*{_cache.GetAllMappingCtn().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == item.CTNCODE).Select(x => x.MapCode).First()}+"; } - if (i == 43) + ctnAll = ctnAll.Substring(0, ctnAll.Length - 1); + //箱型箱量 + ICell cell = row.GetCell(0); + if (cell != null) { - //hscode - ICell cell = row.GetCell(3); - if (cell != null) - { - row.Cells[3].SetCellValue(order.HSCODE); - } - else - { - row.CreateCell(3).SetCellValue(order.HSCODE); - } + row.Cells[0].SetCellValue(ctnAll); } - if (i == 44) + else { - var BLFRTCode = _cache.GetAllCodeFrt().Result.Where(x => x.EnName == order.BLFRT).Select(x => x.Code).First(); - var bl = string.Empty; - if (!string.IsNullOrEmpty(BLFRTCode)) - { - bl = _cache.GetAllMappingFrt().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == BLFRTCode).Select(x => x.MapCode).First(); - } - if (bl == "预付") - { - //预付地点 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.PREPARDATID); - } - else - { - row.CreateCell(1).SetCellValue(order.PREPARDATID); - } - - } - else if((bl == "到付")) - { - - //预付地点 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.PAYABLEATID); - } - else - { - row.CreateCell(1).SetCellValue(order.PAYABLEATID); - } - + row.CreateCell(0).SetCellValue(ctnAll); + } + } + if (i == 42) + { + //运费支付方式 - } - + var BLFRTCode = _cache.GetAllCodeFrt().Result.Where(x => x.EnName == order.BLFRT).Select(x => x.Code).First(); + var bl = string.Empty; + if (!string.IsNullOrEmpty(BLFRTCode)) + { + bl = _cache.GetAllMappingFrt().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == BLFRTCode).Select(x => x.MapCode).First(); } - if (i == 45) + ICell cell = row.GetCell(0); + if (cell != null) { - //Name accout - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(edi.EmcNameAccount); - } - else - { - row.CreateCell(1).SetCellValue(edi.EmcNameAccount); - } + row.Cells[0].SetCellValue(bl); } - if (i == 47) + else { - //Name accout - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.TEMPSET); - } - else - { - row.CreateCell(1).SetCellValue(order.TEMPSET); - } - - - - //温度 - ICell cell2 = row.GetCell(2); - if (cell2 != null) - { - row.Cells[2].SetCellValue(order.TEMPSET); - } - else - { - row.CreateCell(2).SetCellValue(order.TEMPSET); - } - - - //湿度 - ICell cell3 = row.GetCell(3); - if (cell2 != null) - { - row.Cells[3].SetCellValue(order.HUMIDITY); - } - else - { - row.CreateCell(3).SetCellValue(order.HUMIDITY); - } + row.CreateCell(0).SetCellValue(bl); + } + } + if (i == 43) + { + //hscode + ICell cell = row.GetCell(3); + if (cell != null) + { + row.Cells[3].SetCellValue(order.HSCODE); + } + else + { + row.CreateCell(3).SetCellValue(order.HSCODE); + } + } + if (i == 44) + { + var BLFRTCode = _cache.GetAllCodeFrt().Result.Where(x => x.EnName == order.BLFRT).Select(x => x.Code).First(); + var bl = string.Empty; + if (!string.IsNullOrEmpty(BLFRTCode)) + { + bl = _cache.GetAllMappingFrt().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == BLFRTCode).Select(x => x.MapCode).First(); } - if (i == 49) + if (bl == "预付") { - //危险品编号 + //预付地点 ICell cell = row.GetCell(1); if (cell != null) { - row.Cells[1].SetCellValue(order.DUNNO); + row.Cells[1].SetCellValue(order.PREPARDATID); } else { - row.CreateCell(1).SetCellValue(order.DUNNO); + row.CreateCell(1).SetCellValue(order.PREPARDATID); } + } - if (i == 50) + else if ((bl == "到付")) { - //订舱备注 + + //预付地点 ICell cell = row.GetCell(1); if (cell != null) { - row.Cells[1].SetCellValue(order.SOREMARK); + row.Cells[1].SetCellValue(order.PAYABLEATID); } else { - row.CreateCell(1).SetCellValue(order.SOREMARK); + row.CreateCell(1).SetCellValue(order.PAYABLEATID); } + + } - } - var fileFullPath = Path.Combine(App.WebHostEnvironment.WebRootPath, App.GetOptions().Path);//服务器路径 - if (!Directory.Exists(fileFullPath)) - { - Directory.CreateDirectory(fileFullPath); } - - //2023-4-3,根据合川操作要求,文件名只带提单号 - if (!string.IsNullOrEmpty(order.MBLNO)) + if (i == 45) { - fileName = $"{DateTime.Now.Ticks}_{order.MBLNO}.xls";//名称 + //Name accout + ICell cell = row.GetCell(1); + if (cell != null) + { + row.Cells[1].SetCellValue(edi.EmcNameAccount); + } + else + { + row.CreateCell(1).SetCellValue(edi.EmcNameAccount); + } } - else + if (i == 47) { - fileName = $"{DateTime.Now.Ticks}_{order.MBLNO}.xls";//名称 - } - _logger.LogInformation("导出excel:" + Path.Combine(fileFullPath, fileName)); - var filestream = new FileStream(Path.Combine(fileFullPath, fileName), FileMode.OpenOrCreate, FileAccess.ReadWrite); - excelwork.Write(filestream); - #endregion - #region 调用爬虫接口 + //Name accout + ICell cell = row.GetCell(1); + if (cell != null) + { + row.Cells[1].SetCellValue(order.TEMPSET); + } + else + { + row.CreateCell(1).SetCellValue(order.TEMPSET); + } + - var url = _cache.GetAllDictData().Result.Where(x => x.Code == "xiangManCangPostUrl").Select(x => x.Value).FirstOrDefault(); - var account = _webAccountConfig.GetAccountConfig("XiangManCang", UserManager.UserId).Result; + //温度 + ICell cell2 = row.GetCell(2); + if (cell2 != null) + { + row.Cells[2].SetCellValue(order.TEMPSET); + } + else + { + row.CreateCell(2).SetCellValue(order.TEMPSET); + } - var key = _cache.GetAllSysConfig().Result.Where(x => x.Code == "billTraceNewUserKey").Select(x => x.Value).FirstOrDefault(); - if (string.IsNullOrEmpty(key)) - { - throw Oops.Bah("未获取到相关KEY,请联系管理员!"); + //湿度 + ICell cell3 = row.GetCell(3); + if (cell2 != null) + { + row.Cells[3].SetCellValue(order.HUMIDITY); + } + else + { + row.CreateCell(3).SetCellValue(order.HUMIDITY); + } } - - var secret = _cache.GetAllSysConfig().Result.Where(x => x.Code == "billTraceNewUserSecret").Select(x => x.Value).FirstOrDefault(); - if (string.IsNullOrEmpty(secret)) + if (i == 49) { - throw Oops.Bah("未获取到相关SECRET,请联系管理员!"); + //危险品编号 + ICell cell = row.GetCell(1); + if (cell != null) + { + row.Cells[1].SetCellValue(order.DUNNO); + } + else + { + row.CreateCell(1).SetCellValue(order.DUNNO); + } } - ////使用HttpClient方式上传文件 - var carrier_code = _cache.GetAllMappingCarrier().Result.Where(x => x.Module == "HeChuan" && x.MapCode == order.CARRIERID).Select(x => x.Code).First(); - string fn = string.Empty; - using (var httpClient = new HttpClient()) + if (i == 50) { - using (var request = new HttpRequestMessage(new HttpMethod("Post"), url)) + //订舱备注 + ICell cell = row.GetCell(1); + if (cell != null) { - request.Headers.TryAddWithoutValidation("Content-Type", "application/x-www-form-urlencoded"); - var multipartContent = new MultipartFormDataContent(); - multipartContent.Add(new StringContent("user_key"), key); - multipartContent.Add(new StringContent("user_secret"), secret); - multipartContent.Add(new StringContent("web_user"), account.Account); - multipartContent.Add(new StringContent("web_psw"), account.Password); - multipartContent.Add(new StringContent("carrier_code"), carrier_code); - multipartContent.Add(new StreamContent(filestream, (int)filestream.Length), "file", fileName); - request.Content = multipartContent; - var response = await httpClient.SendAsync(request); - if (response.IsSuccessStatusCode) - { - var strRtn = response.Content.ReadAsStringAsync().Result; - var jobj = strRtn.ToJObject(); - if (jobj.GetIntValue("code") == 200) - { - fn = jobj.GetStringValue("msg"); - - } - else - { - throw Oops.Bah(jobj.GetStringValue("msg")); - } - } + row.Cells[1].SetCellValue(order.SOREMARK); + } + else + { + row.CreateCell(1).SetCellValue(order.SOREMARK); } } + } - return fn; - #endregion + var fileFullPath = Path.Combine(App.WebHostEnvironment.WebRootPath, App.GetOptions().Path);//服务器路径 + if (!Directory.Exists(fileFullPath)) + { + Directory.CreateDirectory(fileFullPath); } - else { - return await InnerBookingOrClosingEDI(model); + + //2023-4-3,根据合川操作要求,文件名只带提单号 + if (!string.IsNullOrEmpty(order.MBLNO)) + { + fileName = $"{DateTime.Now.Ticks}_{order.MBLNO}.xls";//名称 + } + else + { + fileName = $"{DateTime.Now.Ticks}_{order.MBLNO}.xls";//名称 + } + _logger.LogInformation("导出excel:" + Path.Combine(fileFullPath, fileName)); + var filestream = new FileStream(Path.Combine(fileFullPath, fileName), FileMode.OpenOrCreate, FileAccess.ReadWrite); + excelwork.Write(filestream); + + #endregion + if (flag) { + filestream.Close(); + filestream.Dispose(); + var fpath = Path.Combine(fileFullPath, fileName); + var fInfo = new FileInfo(fpath); + _logger.LogInformation("箱满仓文件地址:" + fpath + " " + fInfo); + return new FileStreamResult(new FileStream(fpath, FileMode.Open), "application/octet-stream") { FileDownloadName = fInfo.Name }; } - - } - [NonAction] - public async Task InnerBookingOrClosingEDI(BookingOrClosingEDIOrderDto model) - { - string batchNo = IDGen.NextID().ToString(); + #region 调用爬虫接口 - _logger.LogInformation("批次={no}获取请求订舱、截单EDI {msg}", batchNo, JSON.Serialize(model)); - /* - 发送订舱和截单EDI的流程 - 1、通过订单号获取订单信息。 + var url = _cache.GetAllDictData().Result.Where(x => x.Code == "xiangManCangPostUrl").Select(x => x.Value).FirstOrDefault(); + + var account = _webAccountConfig.GetAccountConfig("XiangManCang", UserManager.UserId).Result; + + + var key = _cache.GetAllSysConfig().Result.Where(x => x.Code == "billTraceNewUserKey").Select(x => x.Value).FirstOrDefault(); + if (string.IsNullOrEmpty(key)) + { + throw Oops.Bah("未获取到相关KEY,请联系管理员!"); + } + + var secret = _cache.GetAllSysConfig().Result.Where(x => x.Code == "billTraceNewUserSecret").Select(x => x.Value).FirstOrDefault(); + if (string.IsNullOrEmpty(secret)) + { + throw Oops.Bah("未获取到相关SECRET,请联系管理员!"); + } + ////使用HttpClient方式上传文件 + var carrier_code = _cache.GetAllMappingCarrier().Result.Where(x => x.Module == "HeChuan" && x.MapCode == order.CARRIERID).Select(x => x.Code).First(); + string fn = string.Empty; + using (var httpClient = new HttpClient()) + { + using (var request = new HttpRequestMessage(new HttpMethod("Post"), url)) + { + request.Headers.TryAddWithoutValidation("Content-Type", "application/x-www-form-urlencoded"); + var multipartContent = new MultipartFormDataContent(); + multipartContent.Add(new StringContent("user_key"), key); + multipartContent.Add(new StringContent("user_secret"), secret); + multipartContent.Add(new StringContent("web_user"), account.Account); + multipartContent.Add(new StringContent("web_psw"), account.Password); + multipartContent.Add(new StringContent("carrier_code"), carrier_code); + multipartContent.Add(new StreamContent(filestream, (int)filestream.Length), "file", fileName); + request.Content = multipartContent; + var response = await httpClient.SendAsync(request); + if (response.IsSuccessStatusCode) + { + var strRtn = response.Content.ReadAsStringAsync().Result; + var jobj = strRtn.ToJObject(); + if (jobj.GetIntValue("code") == 200) + { + fn = jobj.GetStringValue("msg"); + + } + else + { + throw Oops.Bah(jobj.GetStringValue("msg")); + } + } + } + } + + return fn; + #endregion + } + + + [NonAction] + public async Task InnerBookingOrClosingEDI(BookingOrClosingEDIOrderDto model) + { + string batchNo = IDGen.NextID().ToString(); + + _logger.LogInformation("批次={no}获取请求订舱、截单EDI {msg}", batchNo, JSON.Serialize(model)); + /* + 发送订舱和截单EDI的流程 + 1、通过订单号获取订单信息。 2、检查订单的必填信息。 3、根据船公司ID获取对应的路由枚举。 4、获取EDI转换参数。(集装箱型号、包装方式) @@ -5713,541 +6317,542 @@ namespace Myshipping.Application [FromQuery] string forwarderCode, [FromQuery] string forwarderName, [FromQuery] string fileRole, [FromQuery] string sendType) { var order = _rep.FirstOrDefault(x => x.Id == id); - var edi = _bookingEDIExt.FirstOrDefault(x => x.BookingId == id); - var ctn = _repCtn.AsQueryable().Where(x => x.BILLID == id).ToList(); var FORWARDER = order.FORWARDER; var dictvalue = _cache.GetAllDictData().Result.Where(x => x.Code == "XiangManCang").Select(x => x.Value).FirstOrDefault(); _logger.LogInformation("FORWARDER:" + FORWARDER + "dictvalue:" + dictvalue); if (!string.IsNullOrEmpty(FORWARDER) && dictvalue == FORWARDER) { - #region 箱满仓生成excel文件 - string fileName = String.Empty; - var opt = App.GetOptions(); - var dirAbs = opt.basePath; - if (string.IsNullOrEmpty(dirAbs)) - { - dirAbs = App.WebHostEnvironment.WebRootPath; - } - var fPath = "upload/printtemplate/箱满舱上传Excel模板.xls"; - var fileAbsPath = Path.Combine(dirAbs, fPath); - _logger.LogInformation($"准备调用EXCEL"); - var file = new FileStream(fileAbsPath, FileMode.Open); - var excelwork = new HSSFWorkbook(file); - var sheet = excelwork.GetSheetAt(0); - for (int i = 0; i < sheet.LastRowNum; i++) - { - ////获取行 - var row = sheet.GetRow(i); - if (i == 0) - { - //委托编号 - ICell cell = row.GetCell(5); - if (cell != null) - { - row.Cells[5].SetCellValue(order.CUSTNO); - } - else - { - row.CreateCell(5).SetCellValue(order.CUSTNO); - } - } - if (i == 1) - { - //场站 - var yardid = order.YARDID; - if (!string.IsNullOrEmpty(yardid)) - { - ICell cell = row.GetCell(5); - var yard = _cache.GetAllMappingYard().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == yardid).Select(x => x.MapCode).First(); - if (cell != null) - { - row.Cells[5].SetCellValue(yard); - } - else - { - row.CreateCell(5).SetCellValue(yard); - } - - } - - } - if (i == 2) - { - //指定业务员 - ICell cell = row.GetCell(5); - if (cell != null) - { - row.Cells[5].SetCellValue(edi.XMCYWY); - } - else - { - row.CreateCell(5).SetCellValue(edi.XMCYWY); - } - } - if (i == 3) - { - //提单号 - ICell cell = row.GetCell(5); - if (cell != null) - { - row.Cells[5].SetCellValue(order.MBLNO); - } - else - { - row.CreateCell(5).SetCellValue(order.MBLNO); - } - } - if (i == 8) - { - //发货人 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.SHIPPER); - } - else - { - row.CreateCell(1).SetCellValue(order.SHIPPER); - } - } - if (i == 10) - { - //发货人代码 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.SHIPPERID); - } - else - { - row.CreateCell(1).SetCellValue(order.SHIPPERID); - } - } - if (i == 11) - { - //收货人 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.CONSIGNEE); - } - else - { - row.CreateCell(1).SetCellValue(order.CONSIGNEE); - } - } - if (i == 14) - { - //通知人 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.NOTIFYPARTY); - } - else - { - row.CreateCell(1).SetCellValue(order.NOTIFYPARTY); - } - } - if (i == 17) - { - //第二通知人 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.NOTIFYPARTY2); - } - else - { - row.CreateCell(1).SetCellValue(order.NOTIFYPARTY2); - } - } - if (i == 18) - { - //起运港国际五字代码 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.PORTLOADID); - } - else - { - row.CreateCell(1).SetCellValue(order.PORTLOADID); - } - - var service = order.SERVICE; - //运输方式 - ICell cell5 = row.GetCell(5); - if (cell5 != null) - { - row.Cells[5].SetCellValue(_cache.GetAllMappingService().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == service).Select(x => x.MapCode).First()); - } - else - { - row.CreateCell(5).SetCellValue(_cache.GetAllMappingService().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == service).Select(x => x.MapCode).First()); - } - - - - - - } - if (i == 19) - { - //卸货港国际五字代码 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.PORTDISCHARGEID); - } - else - { - row.CreateCell(1).SetCellValue(order.PORTDISCHARGEID); - } - } - if (i == 20) - { - //交货地国际五字代码 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.PLACEDELIVERYID); - } - else - { - row.CreateCell(1).SetCellValue(order.PLACEDELIVERYID); - } - } - if (i == 21) - { - //ETD - - if (order.ETD != null) - { - - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(Convert.ToDateTime(order.ETD).ToString("yyyy-MM-dd")); - } - else - { - row.CreateCell(1).SetCellValue(Convert.ToDateTime(order.ETD).ToString("yyyy-MM-dd")); - } - } - - - //船名 - ICell cell4 = row.GetCell(4); - if (cell4 != null) - { - row.Cells[4].SetCellValue(order.VESSEL); - } - else - { - row.CreateCell(4).SetCellValue(order.VESSEL); - } - - } - if (i == 22) - { - //客户协约号 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.CONTRACTNO); - } - else - { - row.CreateCell(1).SetCellValue(order.CONTRACTNO); - } - } - if (i == 23) - { - //航次 - ICell cell = row.GetCell(4); - if (cell != null) - { - row.Cells[4].SetCellValue(order.VOYNO); - } - else - { - row.CreateCell(4).SetCellValue(order.VOYNO); - } - } - if (i == 26) - { - //唛头 - ICell cell = row.GetCell(0); - if (cell != null) - { - row.Cells[0].SetCellValue(order.MARKS); - } - else - { - row.CreateCell(0).SetCellValue(order.MARKS); - } - - if (order.PKGS != null) - { - //件数 - ICell cell1 = row.GetCell(1); - if (cell1 != null) - { - row.Cells[1].SetCellValue(order.PKGS.ToString()); - } - else - { - row.CreateCell(1).SetCellValue(order.PKGS.ToString()); - } + #region + //#region 箱满仓生成excel文件 + //string fileName = String.Empty; + //var opt = App.GetOptions(); + //var dirAbs = opt.basePath; + //if (string.IsNullOrEmpty(dirAbs)) + //{ + // dirAbs = App.WebHostEnvironment.WebRootPath; + //} + //var fPath = "upload/printtemplate/箱满舱上传Excel模板.xls"; + //var fileAbsPath = Path.Combine(dirAbs, fPath); + //_logger.LogInformation($"准备调用EXCEL"); + //var file = new FileStream(fileAbsPath, FileMode.Open); + //var excelwork = new HSSFWorkbook(file); + //var sheet = excelwork.GetSheetAt(0); + //for (int i = 0; i < sheet.LastRowNum; i++) + //{ + // ////获取行 + // var row = sheet.GetRow(i); + // if (i == 0) + // { + // //委托编号 + // ICell cell = row.GetCell(5); + // if (cell != null) + // { + // row.Cells[5].SetCellValue(order.CUSTNO); + // } + // else + // { + // row.CreateCell(5).SetCellValue(order.CUSTNO); + // } + // } + // if (i == 1) + // { + // //场站 + // var yardid = order.YARDID; + // if (!string.IsNullOrEmpty(yardid)) + // { + // ICell cell = row.GetCell(5); + // var yard = _cache.GetAllMappingYard().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == yardid).Select(x => x.MapCode).First(); + // if (cell != null) + // { + // row.Cells[5].SetCellValue(yard); + // } + // else + // { + // row.CreateCell(5).SetCellValue(yard); + // } + + // } - } - //包装 - ICell cell2 = row.GetCell(2); - if (cell2 != null) - { - row.Cells[2].SetCellValue(order.KINDPKGS); - } - else - { - row.CreateCell(2).SetCellValue(order.KINDPKGS); - } - //品名 - ICell cell3 = row.GetCell(3); - if (cell3 != null) - { - row.Cells[3].SetCellValue(order.DESCRIPTION); - } - else - { - row.CreateCell(3).SetCellValue(order.DESCRIPTION); - } - if (order.KGS != null) - { - //重量 - ICell cell4 = row.GetCell(4); - if (cell3 != null) - { - row.Cells[4].SetCellValue(order.KGS.ToString()); - } - else - { - row.CreateCell(4).SetCellValue(order.KGS.ToString()); - } - } - if (order.CBM != null) - { - //尺码 - ICell cell5 = row.GetCell(5); - if (cell5 != null) - { - row.Cells[5].SetCellValue(order.CBM.ToString()); - } - else - { - row.CreateCell(5).SetCellValue(order.CBM.ToString()); - } - } - } - if (i == 39) - { - var c = ctn.DistinctBy(x => x.CTNALL).ToList(); - var ctnAll = string.Empty; - foreach (var item in c) - { - ctnAll += $"{ctn.Where(x => x.CTNALL == item.CTNALL).Count()}*{_cache.GetAllMappingCtn().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == item.CTNCODE).Select(x => x.MapCode).First()}+"; - } - ctnAll = ctnAll.Substring(0, ctnAll.Length - 1); - //箱型箱量 - ICell cell = row.GetCell(0); - if (cell != null) - { - row.Cells[0].SetCellValue(ctnAll); - } - else - { - row.CreateCell(0).SetCellValue(ctnAll); - } - } - if (i == 42) - { - //运费支付方式 + // } + // if (i == 2) + // { + // //指定业务员 + // ICell cell = row.GetCell(5); + // if (cell != null) + // { + // row.Cells[5].SetCellValue(edi.XMCYWY); + // } + // else + // { + // row.CreateCell(5).SetCellValue(edi.XMCYWY); + // } + // } + // if (i == 3) + // { + // //提单号 + // ICell cell = row.GetCell(5); + // if (cell != null) + // { + // row.Cells[5].SetCellValue(order.MBLNO); + // } + // else + // { + // row.CreateCell(5).SetCellValue(order.MBLNO); + // } + // } + // if (i == 8) + // { + // //发货人 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.SHIPPER); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.SHIPPER); + // } + // } + // if (i == 10) + // { + // //发货人代码 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.SHIPPERID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.SHIPPERID); + // } + // } + // if (i == 11) + // { + // //收货人 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.CONSIGNEE); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.CONSIGNEE); + // } + // } + // if (i == 14) + // { + // //通知人 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.NOTIFYPARTY); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.NOTIFYPARTY); + // } + // } + // if (i == 17) + // { + // //第二通知人 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.NOTIFYPARTY2); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.NOTIFYPARTY2); + // } + // } + // if (i == 18) + // { + // //起运港国际五字代码 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.PORTLOADID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PORTLOADID); + // } - var BLFRTCode = _cache.GetAllCodeFrt().Result.Where(x => x.EnName == order.BLFRT).Select(x => x.Code).First(); - var bl = string.Empty; - if (!string.IsNullOrEmpty(BLFRTCode)) - { - bl = _cache.GetAllMappingFrt().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == BLFRTCode).Select(x => x.MapCode).First(); - } - ICell cell = row.GetCell(0); - if (cell != null) - { - row.Cells[0].SetCellValue(bl); - } - else - { - row.CreateCell(0).SetCellValue(bl); - } - } - if (i == 43) - { - //hscode - ICell cell = row.GetCell(3); - if (cell != null) - { - row.Cells[3].SetCellValue(order.HSCODE); - } - else - { - row.CreateCell(3).SetCellValue(order.HSCODE); - } - } - if (i == 44) - { - var BLFRTCode = _cache.GetAllCodeFrt().Result.Where(x => x.EnName == order.BLFRT).Select(x => x.Code).First(); - var bl = string.Empty; - if (!string.IsNullOrEmpty(BLFRTCode)) - { - bl = _cache.GetAllMappingFrt().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == BLFRTCode).Select(x => x.MapCode).First(); - } - if (bl == "预付") - { - //预付地点 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.PREPARDATID); - } - else - { - row.CreateCell(1).SetCellValue(order.PREPARDATID); - } + // var service = order.SERVICE; + // //运输方式 + // ICell cell5 = row.GetCell(5); + // if (cell5 != null) + // { + // row.Cells[5].SetCellValue(_cache.GetAllMappingService().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == service).Select(x => x.MapCode).First()); + // } + // else + // { + // row.CreateCell(5).SetCellValue(_cache.GetAllMappingService().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == service).Select(x => x.MapCode).First()); + // } - } - else if ((bl == "到付")) - { - //预付地点 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.PAYABLEATID); - } - else - { - row.CreateCell(1).SetCellValue(order.PAYABLEATID); - } - } - - } - if (i == 45) - { - //Name accout - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(edi.EmcNameAccount); - } - else - { - row.CreateCell(1).SetCellValue(edi.EmcNameAccount); - } - } - if (i == 47) - { - //Name accout - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.TEMPSET); - } - else - { - row.CreateCell(1).SetCellValue(order.TEMPSET); - } - + // } + // if (i == 19) + // { + // //卸货港国际五字代码 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.PORTDISCHARGEID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PORTDISCHARGEID); + // } + // } + // if (i == 20) + // { + // //交货地国际五字代码 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.PLACEDELIVERYID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PLACEDELIVERYID); + // } + // } + // if (i == 21) + // { + // //ETD + + // if (order.ETD != null) + // { + + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(Convert.ToDateTime(order.ETD).ToString("yyyy-MM-dd")); + // } + // else + // { + // row.CreateCell(1).SetCellValue(Convert.ToDateTime(order.ETD).ToString("yyyy-MM-dd")); + // } + // } + + + // //船名 + // ICell cell4 = row.GetCell(4); + // if (cell4 != null) + // { + // row.Cells[4].SetCellValue(order.VESSEL); + // } + // else + // { + // row.CreateCell(4).SetCellValue(order.VESSEL); + // } - //温度 - ICell cell2 = row.GetCell(2); - if (cell2 != null) - { - row.Cells[2].SetCellValue(order.TEMPSET); - } - else - { - row.CreateCell(2).SetCellValue(order.TEMPSET); - } + // } + // if (i == 22) + // { + // //客户协约号 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.CONTRACTNO); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.CONTRACTNO); + // } + // } + // if (i == 23) + // { + // //航次 + // ICell cell = row.GetCell(4); + // if (cell != null) + // { + // row.Cells[4].SetCellValue(order.VOYNO); + // } + // else + // { + // row.CreateCell(4).SetCellValue(order.VOYNO); + // } + // } + // if (i == 26) + // { + // //唛头 + // ICell cell = row.GetCell(0); + // if (cell != null) + // { + // row.Cells[0].SetCellValue(order.MARKS); + // } + // else + // { + // row.CreateCell(0).SetCellValue(order.MARKS); + // } + + // if (order.PKGS != null) + // { + // //件数 + // ICell cell1 = row.GetCell(1); + // if (cell1 != null) + // { + // row.Cells[1].SetCellValue(order.PKGS.ToString()); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PKGS.ToString()); + // } + + // } + // //包装 + // ICell cell2 = row.GetCell(2); + // if (cell2 != null) + // { + // row.Cells[2].SetCellValue(order.KINDPKGS); + // } + // else + // { + // row.CreateCell(2).SetCellValue(order.KINDPKGS); + // } + // //品名 + // ICell cell3 = row.GetCell(3); + // if (cell3 != null) + // { + // row.Cells[3].SetCellValue(order.DESCRIPTION); + // } + // else + // { + // row.CreateCell(3).SetCellValue(order.DESCRIPTION); + // } + // if (order.KGS != null) + // { + // //重量 + // ICell cell4 = row.GetCell(4); + // if (cell3 != null) + // { + // row.Cells[4].SetCellValue(order.KGS.ToString()); + // } + // else + // { + // row.CreateCell(4).SetCellValue(order.KGS.ToString()); + // } + // } + // if (order.CBM != null) + // { + // //尺码 + // ICell cell5 = row.GetCell(5); + // if (cell5 != null) + // { + // row.Cells[5].SetCellValue(order.CBM.ToString()); + // } + // else + // { + // row.CreateCell(5).SetCellValue(order.CBM.ToString()); + // } + // } + // } + // if (i == 39) + // { + // var c = ctn.DistinctBy(x => x.CTNALL).ToList(); + // var ctnAll = string.Empty; + // foreach (var item in c) + // { + // ctnAll += $"{ctn.Where(x => x.CTNALL == item.CTNALL).Count()}*{_cache.GetAllMappingCtn().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == item.CTNCODE).Select(x => x.MapCode).First()}+"; + // } + // ctnAll = ctnAll.Substring(0, ctnAll.Length - 1); + // //箱型箱量 + // ICell cell = row.GetCell(0); + // if (cell != null) + // { + // row.Cells[0].SetCellValue(ctnAll); + // } + // else + // { + // row.CreateCell(0).SetCellValue(ctnAll); + // } + // } + // if (i == 42) + // { + // //运费支付方式 + + // var BLFRTCode = _cache.GetAllCodeFrt().Result.Where(x => x.EnName == order.BLFRT).Select(x => x.Code).First(); + // var bl = string.Empty; + // if (!string.IsNullOrEmpty(BLFRTCode)) + // { + // bl = _cache.GetAllMappingFrt().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == BLFRTCode).Select(x => x.MapCode).First(); + // } + // ICell cell = row.GetCell(0); + // if (cell != null) + // { + // row.Cells[0].SetCellValue(bl); + // } + // else + // { + // row.CreateCell(0).SetCellValue(bl); + // } + // } + // if (i == 43) + // { + // //hscode + // ICell cell = row.GetCell(3); + // if (cell != null) + // { + // row.Cells[3].SetCellValue(order.HSCODE); + // } + // else + // { + // row.CreateCell(3).SetCellValue(order.HSCODE); + // } + // } + // if (i == 44) + // { + // var BLFRTCode = _cache.GetAllCodeFrt().Result.Where(x => x.EnName == order.BLFRT).Select(x => x.Code).First(); + // var bl = string.Empty; + // if (!string.IsNullOrEmpty(BLFRTCode)) + // { + // bl = _cache.GetAllMappingFrt().Result.Where(x => x.Module == "XiangManCangEDI" && x.Code == BLFRTCode).Select(x => x.MapCode).First(); + // } + // if (bl == "预付") + // { + // //预付地点 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.PREPARDATID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PREPARDATID); + // } + + // } + // else if ((bl == "到付")) + // { + + // //预付地点 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.PAYABLEATID); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.PAYABLEATID); + // } + + + // } + // } + // if (i == 45) + // { + // //Name accout + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(edi.EmcNameAccount); + // } + // else + // { + // row.CreateCell(1).SetCellValue(edi.EmcNameAccount); + // } + // } + // if (i == 47) + // { + // //Name accout + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.TEMPSET); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.TEMPSET); + // } + + + + // //温度 + // ICell cell2 = row.GetCell(2); + // if (cell2 != null) + // { + // row.Cells[2].SetCellValue(order.TEMPSET); + // } + // else + // { + // row.CreateCell(2).SetCellValue(order.TEMPSET); + // } + + + // //湿度 + // ICell cell3 = row.GetCell(3); + // if (cell2 != null) + // { + // row.Cells[3].SetCellValue(order.HUMIDITY); + // } + // else + // { + // row.CreateCell(3).SetCellValue(order.HUMIDITY); + // } + // } + // if (i == 49) + // { + // //危险品编号 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.DUNNO); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.DUNNO); + // } + // } + // if (i == 50) + // { + // //订舱备注 + // ICell cell = row.GetCell(1); + // if (cell != null) + // { + // row.Cells[1].SetCellValue(order.SOREMARK); + // } + // else + // { + // row.CreateCell(1).SetCellValue(order.SOREMARK); + // } + // } + //} - //湿度 - ICell cell3 = row.GetCell(3); - if (cell2 != null) - { - row.Cells[3].SetCellValue(order.HUMIDITY); - } - else - { - row.CreateCell(3).SetCellValue(order.HUMIDITY); - } - } - if (i == 49) - { - //危险品编号 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.DUNNO); - } - else - { - row.CreateCell(1).SetCellValue(order.DUNNO); - } - } - if (i == 50) - { - //订舱备注 - ICell cell = row.GetCell(1); - if (cell != null) - { - row.Cells[1].SetCellValue(order.SOREMARK); - } - else - { - row.CreateCell(1).SetCellValue(order.SOREMARK); - } - } - } + //var fileFullPath = Path.Combine(App.WebHostEnvironment.WebRootPath, App.GetOptions().Path);//服务器路径 + //if (!Directory.Exists(fileFullPath)) + //{ + // Directory.CreateDirectory(fileFullPath); + //} - var fileFullPath = Path.Combine(App.WebHostEnvironment.WebRootPath, App.GetOptions().Path);//服务器路径 - if (!Directory.Exists(fileFullPath)) - { - Directory.CreateDirectory(fileFullPath); - } - - if (!string.IsNullOrEmpty(order.MBLNO)) - { - fileName = $"{DateTime.Now.Ticks}_{order.MBLNO}.xls";//名称 - } - else - { - fileName = $"{DateTime.Now.Ticks}_{order.MBLNO}.xls";//名称 - } - _logger.LogInformation("导出excel:" + Path.Combine(fileFullPath, fileName)); - var filestream = new FileStream(Path.Combine(fileFullPath, fileName), FileMode.OpenOrCreate, FileAccess.ReadWrite); - excelwork.Write(filestream); - filestream.Close(); - filestream.Dispose(); + //if (!string.IsNullOrEmpty(order.MBLNO)) + //{ + // fileName = $"{DateTime.Now.Ticks}_{order.MBLNO}.xls";//名称 + //} + //else + //{ + // fileName = $"{DateTime.Now.Ticks}_{order.MBLNO}.xls";//名称 + //} + //_logger.LogInformation("导出excel:" + Path.Combine(fileFullPath, fileName)); + //var filestream = new FileStream(Path.Combine(fileFullPath, fileName), FileMode.OpenOrCreate, FileAccess.ReadWrite); + //excelwork.Write(filestream); + //filestream.Close(); + //filestream.Dispose(); + //#endregion + ////return new FileStreamResult( filestream, "application/octet-stream") { FileDownloadName = fileName }; + //var fpath = Path.Combine(fileFullPath, fileName); + //var fInfo = new FileInfo(fpath); + //_logger.LogInformation("箱满仓文件地址:" + fpath + " " + fInfo); + //return new FileStreamResult(new FileStream(fpath, FileMode.Open), "application/octet-stream") { FileDownloadName = fInfo.Name }; #endregion - //return new FileStreamResult( filestream, "application/octet-stream") { FileDownloadName = fileName }; - var fpath = Path.Combine(fileFullPath, fileName); - var fInfo = new FileInfo(fpath); - _logger.LogInformation("箱满仓文件地址:" + fpath + " " + fInfo); - return new FileStreamResult(new FileStream(fpath, FileMode.Open), "application/octet-stream") { FileDownloadName = fInfo.Name }; - + + return await XMCEXCEL(id, true); } @@ -7469,7 +8074,7 @@ namespace Myshipping.Application { throw Oops.Bah("请上传正确数据"); } - var order = await _rep.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id) && x.TenantId == UserManager.TENANT_ID).ToListAsync(); + var order = await _rep.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id) && x.TenantId == UserManager.TENANT_ID&&x.IsDeleted==false).ToListAsync(); var dto = order.Adapt>(); if (dto.Count() == 0) @@ -7501,15 +8106,15 @@ namespace Myshipping.Application // item.ISSUETYPE = ISSUETYPE; //} - var ctn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == item.Id).ToListAsync(); + var ctn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == item.Id && x.IsDeleted == false).ToListAsync(); item.ctnInputs = ctn.Adapt>(); foreach (var it in item.ctnInputs) { - var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id).ToListAsync(); + var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync(); it.ctnDetailInputs = ctnDetailInputs.Adapt>(); } - var BookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id).FirstAsync(); + var BookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id && x.IsDeleted == false).FirstAsync(); if (BookingEDIExt != null) { item.BookingEDIExt = BookingEDIExt.Adapt(); @@ -7522,21 +8127,21 @@ namespace Myshipping.Application ExtData = t.ExtData }).Distinct().ToListAsync(); - var childrens = await _rep.AsQueryable().Filter(null, true).Where(x => x.ParentId == item.Id && x.TenantId == UserManager.TENANT_ID).ToListAsync(); + var childrens = await _rep.AsQueryable().Filter(null, true).Where(x => x.ParentId == item.Id && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); item.childrens = childrens.Adapt>(); foreach (var childitem in item.childrens) { - var ctnInputs = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == childitem.Id).ToListAsync(); + var ctnInputs = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == childitem.Id && x.IsDeleted == false).ToListAsync(); childitem.ctnInputs = ctnInputs.Adapt>(); foreach (var it in childitem.ctnInputs) { - var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id).ToListAsync(); + var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync(); it.ctnDetailInputs = ctnDetailInputs.Adapt>(); } - var childBookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == childitem.Id).FirstAsync(); + var childBookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == childitem.Id && x.IsDeleted == false).FirstAsync(); if (childBookingEDIExt != null) { childitem.BookingEDIExt = childBookingEDIExt.Adapt(); diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIExtDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIExtDto.cs index d8959dd3..96120cab 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIExtDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIExtDto.cs @@ -172,9 +172,6 @@ namespace Myshipping.Application /// public string CNPTNo { get; set; } - - - /// /// 箱满仓业务员 /// diff --git a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs index 2f8f017a..7f27fae0 100644 --- a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs @@ -40,11 +40,11 @@ namespace Myshipping.Application /// /// 订舱、截单EDI请求 /// 返回回执 - Task SendBookingOrClosingEDI (BookingOrClosingEDIOrderDto model); + Task SendBookingOrClosingEDI (BookingOrClosingEDIOrderDto model); Task BachUpdate(BatchUpdate dto); - Task InnerBookingOrClosingEDI(BookingOrClosingEDIOrderDto model); + Task InnerBookingOrClosingEDI(BookingOrClosingEDIOrderDto model); Task SendBookingOrder(long[] ids); From fc0dfaa6b5675c8393547a9cf64654eae7790955 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Tue, 6 Jun 2023 14:52:35 +0800 Subject: [PATCH 04/17] 1 --- .../BookingOrder/BookingOrderService.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 0e8d35f7..f0214356 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -2203,6 +2203,24 @@ namespace Myshipping.Application } } + [HttpPost("/BookingOrder/RefreshBillTrace")] + public async Task RefreshBillTrace(string Ids) { + + var url = _cache.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "response_seae_billtraceRefreshurl").Value; + var html = await url.SetHttpMethod(HttpMethod.Post).SetQueries(new { Ids = Ids, flag=true }).SetRetryPolicy(3, 5000).SendAsAsync(); + _logger.LogInformation("调用运踪刷新接口返回" + html.ToJsonString()); + if (html.Success != true) + { + _logger.LogError("调用运踪刷新接口返回:" + html.ToJsonString()); + throw Oops.Bah(html.Message); + } + } + + + + + + /// /// 插入货运动态 /// From 5d119280c877a6d0d969afb6f65d47954a139247 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 6 Jun 2023 15:44:30 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E8=88=B9=E6=9C=9F=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=92=89=E9=92=89@?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/DataSync/DataSyncService.cs | 76 ++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index ddb2b6f1..3756f9db 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -35,6 +35,7 @@ using Newtonsoft.Json.Linq; using Myshipping.Application.Service.BookingOrder.Dto; using Myshipping.Application.Enum; using Myshipping.Core.Helper; +using Furion.TaskScheduler; namespace Myshipping.Application { @@ -1800,6 +1801,7 @@ namespace Myshipping.Application } } + } @@ -1812,7 +1814,7 @@ namespace Myshipping.Application [SqlSugarUnitOfWork] public async Task SaveSyncGHVesselDate(List dto) { - + foreach (var item in dto) { @@ -2153,9 +2155,81 @@ namespace Myshipping.Application } //推送钉钉消息 DingTalkGroupHelper.SendDingTalkGroupMessage("hechuanVesselExcepNotify", "船期获取异常提醒", msg); + } } + //[HttpPost("/DataSync/SyncVesselDateTest"), ApiUser(ApiCode = "SaveSyncVesselDate")] + //public async Task SyncVesselDateTest(List dto) + private async Task SyncVesselExcepAtOp(List dto) + { + var tenantId = UserManager.TENANT_ID; + SpareTime.DoOnce(1000, (tmr, l) => + { + _logger.LogInformation($"SaveSyncVesselDate @通知执行"); + int maxSendLimit = 20; //钉钉每分钟发送限制 + + var usrList = _repUser.AsQueryable().Filter(null, true).Where(u => u.TenantId == tenantId && !u.IsDeleted).ToList(); + Dictionary> dic = new Dictionary>(); + + //遍历船名航次,查询订舱数据 + foreach (var item in dto) + { + var boUserList = _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && (x.ParentId == 0 || x.ParentId == null) && !x.IsDeleted && x.TenantId == tenantId) + .Select(x => x.CreatedUserId).ToList(); + if (boUserList.Count > 0) + { + var phoneList = usrList.Where(u => boUserList.Contains(u.Id) && u.Phone != "" && u.Phone != null).Select(x => x.Phone).ToList(); + + foreach (var phone in phoneList) + { + var msg = $"船名:{item.Vessel},航次:{item.Voyno},{item.Message}"; + if (dic.ContainsKey(phone)) + { + dic[phone].Add(msg); + } + else + { + dic.Add(phone, new List(new string[] { msg })); + } + } + } + } + + _logger.LogInformation($"处理发送后,准备给{dic.Count}个用户发送通知"); + + if (dic.Count > maxSendLimit) //大于限制,分多次发送 + { + int times = (int)Math.Ceiling(dic.Count * 1.0 / maxSendLimit); + _logger.LogInformation($"发送通知超限,准备分为{times}次发送"); + for (var t = 0; t < times; t++) + { + var keyList = dic.Keys.Skip(t * maxSendLimit).Take(maxSendLimit); + var currTimes = t + 1; + SpareTime.DoOnce(t == 0 ? 1000 : 70 * 1000 * t, doWhat: (st, val) => + { + _logger.LogInformation($"超限第{currTimes}次发送,共{keyList.Count()}个"); + foreach (var k in keyList) + { + var content = string.Join("\r\n", dic[k]); + _logger.LogInformation($"准备发送船期通知给 {k},内容:\r\n{content}"); + //DingTalkGroupHelper.SendDingTalkGroupMessage("", "船期提醒", content, false, new string[] { k }, null); + } + }); + } + } + else + { + foreach (var item in dic) + { + var content = string.Join("\r\n", item.Value); + _logger.LogInformation($"准备发送船期通知给 {item.Key},内容:\r\n{content}"); + //DingTalkGroupHelper.SendDingTalkGroupMessage("", "船期提醒", content, false, new string[] { item.Key }, null); + } + } + }); + + } #endregion #region 下载数据 From 8f6b36c28f9f47ad0743ee04b9f08184b8a7e546 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Tue, 6 Jun 2023 16:10:21 +0800 Subject: [PATCH 06/17] 1 --- .../BookingOrder/BookingOrderService.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index f0214356..346b5895 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -404,7 +404,8 @@ namespace Myshipping.Application CreatedUserId = config.CreatedUserId, Sort = config.Sort }).ToList(); - + var statusloglist = _repStatuslog.AsQueryable().Where(x => (x.Status == "提箱" || x.Status == "返场")).ToList(); + var statuslogdetaillist = _statuslogdetail.AsQueryable().ToList(); foreach (var item in list.Items) { var sta = _repBookingStatus.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id).ToList(); @@ -492,11 +493,12 @@ namespace Myshipping.Application } item.GoodsStatusList = itgoods.Union(itconfig).OrderBy(x => x.Sort).ToList(); - var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id&&(x.Status== "提箱"|| x.Status == "返场")).OrderByDescending(x => x.CreatedTime).ToListAsync(); + //获取提箱返场状态 + var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList(); var dto = statuslog.Adapt>(); foreach (var it in dto) { - var detail = await _statuslogdetail.AsQueryable().Where(x => x.PId == it.Id).ToListAsync(); + var detail = statuslogdetaillist.Where(x => x.PId == it.Id).ToList(); it.detail = detail.Adapt>(); } item.statuslogs = dto; @@ -733,7 +735,8 @@ namespace Myshipping.Application CreatedUserId = config.CreatedUserId, Sort = config.Sort }).ToList(); - + var statusloglist = _repStatuslog.AsQueryable().Where(x=> (x.Status == "提箱" || x.Status == "返场")).ToList(); + var statuslogdetaillist = _statuslogdetail.AsQueryable().ToList(); foreach (var item in list.Items) { var sta = _repBookingStatus.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id).ToList(); @@ -821,11 +824,12 @@ namespace Myshipping.Application } item.GoodsStatusList = itgoods.Union(itconfig).OrderBy(x => x.Sort).ToList(); - var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id && (x.Status == "提箱" || x.Status == "返场")).OrderByDescending(x => x.CreatedTime).ToListAsync(); + //获取提箱返场状态 + var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList(); var dto = statuslog.Adapt>(); foreach (var it in dto) { - var detail = await _statuslogdetail.AsQueryable().Where(x => x.PId == it.Id).ToListAsync(); + var detail = statuslogdetaillist.Where(x => x.PId == it.Id).ToList(); it.detail = detail.Adapt>(); } item.statuslogs = dto; @@ -2163,7 +2167,7 @@ namespace Myshipping.Application OldValue = "", NewValue = status, }); - + if (!string.IsNullOrWhiteSpace(item.CARRIERID)) From 0f1b4b1d719134b17ad836708470c55a1c670665 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 6 Jun 2023 17:37:02 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E4=B8=8D=E6=9B=BF=E6=8D=A2=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E8=B4=A6=E5=8F=B7=E3=80=81=E6=89=8B=E6=9C=BA=E3=80=81?= =?UTF-8?q?=E9=82=AE=E7=AE=B1=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/DataSync/DataSyncService.cs | 1 + Myshipping.Core/Job/UserSyncWorker.cs | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 3756f9db..6d0f44c4 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -36,6 +36,7 @@ using Myshipping.Application.Service.BookingOrder.Dto; using Myshipping.Application.Enum; using Myshipping.Core.Helper; using Furion.TaskScheduler; +using System.Linq.Expressions; namespace Myshipping.Application { diff --git a/Myshipping.Core/Job/UserSyncWorker.cs b/Myshipping.Core/Job/UserSyncWorker.cs index 5a6f8163..f6eb9864 100644 --- a/Myshipping.Core/Job/UserSyncWorker.cs +++ b/Myshipping.Core/Job/UserSyncWorker.cs @@ -60,7 +60,7 @@ namespace Myshipping.Core.Job { foreach (var user in users) { - var existUser = sysUsers.Count(x => x.Account == user.CODENAME) > 0; + var existUser = sysUsers.Count(x => x.DjyUserId == user.GID) > 0; SysUser sysUser = null; if (!existUser) { @@ -68,24 +68,21 @@ namespace Myshipping.Core.Job } else { - sysUser = sysUsers.First(x => x.Account == user.CODENAME); + sysUser = sysUsers.First(x => x.DjyUserId == user.GID); } var ub = _repPingTaiUserBase.FirstOrDefault(x => x.USERID == user.GID); - sysUser.Account = user.CODENAME; - //sysUser.Password = DESCEncryption.Encrypt(user.PASSWORD, keyDES); //只在新增时同步密码,防止覆盖 sysUser.TenantId = tenantId; - //sysUser.Name = user.SHOWNAME;//只在新增时同步姓名,防止覆盖 sysUser.AdminType = AdminType.None; sysUser.DjyUserId = user.GID; - //sysUser.NickName = user.SHOWNAME;//只在新增时同步昵称,防止覆盖 - sysUser.Phone = ub.MOBILE; - sysUser.Email = ub.EMAIL1; sysUser.IsDeleted = user.IsLeave; if (!existUser) { + sysUser.Account = user.CODENAME; + sysUser.Phone = ub.MOBILE; + sysUser.Email = ub.EMAIL1; sysUser.Password = DESCEncryption.Encrypt(user.PASSWORD, keyDES);//只在新增时同步密码 sysUser.Name = user.SHOWNAME;//只在新增时同步姓名,防止覆盖 sysUser.NickName = user.SHOWNAME;//只在新增时同步昵称,防止覆盖 From a302ef98820ec6da0f8df9234f324ffd08ab37b6 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Wed, 7 Jun 2023 09:05:56 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E8=88=B9=E6=9C=9F@?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/Service/DataSync/DataSyncService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 6d0f44c4..9c452d3f 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -2157,6 +2157,8 @@ namespace Myshipping.Application //推送钉钉消息 DingTalkGroupHelper.SendDingTalkGroupMessage("hechuanVesselExcepNotify", "船期获取异常提醒", msg); + //推送和川钉钉群,@具体操作 + SyncVesselExcepAtOp(dto); } } From 715f469bce5c9d043b8429b600d76fac4cd02afc Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Wed, 7 Jun 2023 09:50:04 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E6=94=B6=E5=8F=91=E9=80=9A=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/BookingTemplate.cs | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Myshipping.Application/Entity/BookingTemplate.cs b/Myshipping.Application/Entity/BookingTemplate.cs index 09c3f0ca..ff0e8ff0 100644 --- a/Myshipping.Application/Entity/BookingTemplate.cs +++ b/Myshipping.Application/Entity/BookingTemplate.cs @@ -5,7 +5,7 @@ using Myshipping.Core.Entity; namespace Myshipping.Application.Entity { /// - /// + /// 收发通模板 /// [SugarTable("booking_template")] [Description("订舱收发通模板")] @@ -50,4 +50,31 @@ namespace Myshipping.Application.Entity /// public string TEL { get; set; } } + + + /// + /// 收发通模板分享 + /// + [SugarTable("booking_template_share")] + [Description("收发通模板分享")] + public class BookingTemplateShare : DBEntityTenant + { + /// + /// 模板ID + /// + public long TemplateId { get; set; } + /// + /// 分享用户Id + /// + public long ShareToId { get; set; } + /// + /// 分享用户 + /// + public string ShareToName { get; set; } + /// + /// 备注 + /// + public string Remark { get; set; } + + } } \ No newline at end of file From ce5a60c160b1bd5a534ddf15de121b4902eb4114 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Wed, 7 Jun 2023 10:49:58 +0800 Subject: [PATCH 10/17] 1 --- .../BookingOrder/BookingOrderService.cs | 122 +++++++++--------- 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 346b5895..99706e2f 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -392,18 +392,18 @@ namespace Myshipping.Application Sort = config.Sort }).ToList(); - var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new - { - bookingid = "", - ConfigId = config.Id, - SystemCode = config.SystemCode, - StatusName = config.StatusName, - FinishTime = "", - ExtData = "", - Remark = "", - CreatedUserId = config.CreatedUserId, - Sort = config.Sort - }).ToList(); + //var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new + //{ + // bookingid = "", + // ConfigId = config.Id, + // SystemCode = config.SystemCode, + // StatusName = config.StatusName, + // FinishTime = "", + // ExtData = "", + // Remark = "", + // CreatedUserId = config.CreatedUserId, + // Sort = config.Sort + //}).ToList(); var statusloglist = _repStatuslog.AsQueryable().Where(x => (x.Status == "提箱" || x.Status == "返场")).ToList(); var statuslogdetaillist = _statuslogdetail.AsQueryable().ToList(); foreach (var item in list.Items) @@ -475,24 +475,24 @@ namespace Myshipping.Application Sort = x.Sort }).ToList(); - var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort). - Select(x => new GoodsStatusList - { - ConfigId = x.ConfigId, - StatusName = x.StatusName, - SystemCode = x.SystemCode, - FinishTime = null, - ExtData = x.ExtData, - Remark = x.Remark, - Sort = x.Sort - }).ToList(); - - foreach (var ii in itgoods) - { - itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId); - } + //var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort). + // Select(x => new GoodsStatusList + // { + // ConfigId = x.ConfigId, + // StatusName = x.StatusName, + // SystemCode = x.SystemCode, + // FinishTime = null, + // ExtData = x.ExtData, + // Remark = x.Remark, + // Sort = x.Sort + // }).ToList(); + + //foreach (var ii in itgoods) + //{ + // itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId); + //} - item.GoodsStatusList = itgoods.Union(itconfig).OrderBy(x => x.Sort).ToList(); + item.GoodsStatusList = itgoods; //获取提箱返场状态 var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList(); var dto = statuslog.Adapt>(); @@ -723,18 +723,18 @@ namespace Myshipping.Application Sort = config.Sort }).ToList(); - var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new - { - bookingid = "", - ConfigId = config.Id, - SystemCode = config.SystemCode, - StatusName = config.StatusName, - FinishTime = "", - ExtData = "", - Remark = "", - CreatedUserId = config.CreatedUserId, - Sort = config.Sort - }).ToList(); + //var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new + //{ + // bookingid = "", + // ConfigId = config.Id, + // SystemCode = config.SystemCode, + // StatusName = config.StatusName, + // FinishTime = "", + // ExtData = "", + // Remark = "", + // CreatedUserId = config.CreatedUserId, + // Sort = config.Sort + //}).ToList(); var statusloglist = _repStatuslog.AsQueryable().Where(x=> (x.Status == "提箱" || x.Status == "返场")).ToList(); var statuslogdetaillist = _statuslogdetail.AsQueryable().ToList(); foreach (var item in list.Items) @@ -806,24 +806,24 @@ namespace Myshipping.Application Sort = x.Sort }).ToList(); - var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort). - Select(x => new GoodsStatusList - { - ConfigId = x.ConfigId, - StatusName = x.StatusName, - SystemCode = x.SystemCode, - FinishTime = null, - ExtData = x.ExtData, - Remark = x.Remark, - Sort = x.Sort - }).ToList(); - - foreach (var ii in itgoods) - { - itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId); - } + //var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort). + // Select(x => new GoodsStatusList + // { + // ConfigId = x.ConfigId, + // StatusName = x.StatusName, + // SystemCode = x.SystemCode, + // FinishTime = null, + // ExtData = x.ExtData, + // Remark = x.Remark, + // Sort = x.Sort + // }).ToList(); + + //foreach (var ii in itgoods) + //{ + // itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId); + //} - item.GoodsStatusList = itgoods.Union(itconfig).OrderBy(x => x.Sort).ToList(); + item.GoodsStatusList = itgoods; //获取提箱返场状态 var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList(); var dto = statuslog.Adapt>(); @@ -2206,7 +2206,11 @@ namespace Myshipping.Application throw Oops.Bah(html.Message); } } - + /// + /// 即时刷新运踪 + /// + /// + /// [HttpPost("/BookingOrder/RefreshBillTrace")] public async Task RefreshBillTrace(string Ids) { From c77f1744fe05a226fd3b708c7cce60c7c98adeac Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Wed, 7 Jun 2023 11:41:27 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E8=88=B9=E6=9C=9F@=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=8A=93=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/DataSync/DataSyncService.cs | 98 +++++++++++-------- 1 file changed, 56 insertions(+), 42 deletions(-) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 9c452d3f..6dc4c164 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -2169,65 +2169,79 @@ namespace Myshipping.Application var tenantId = UserManager.TENANT_ID; SpareTime.DoOnce(1000, (tmr, l) => { - _logger.LogInformation($"SaveSyncVesselDate @通知执行"); - int maxSendLimit = 20; //钉钉每分钟发送限制 + try + { + _logger.LogInformation($"SaveSyncVesselDate @通知执行"); + int maxSendLimit = 20; //钉钉每分钟发送限制 - var usrList = _repUser.AsQueryable().Filter(null, true).Where(u => u.TenantId == tenantId && !u.IsDeleted).ToList(); - Dictionary> dic = new Dictionary>(); + var usrList = _repUser.AsQueryable().Filter(null, true).Where(u => u.TenantId == tenantId && !u.IsDeleted).ToList(); + Dictionary> dic = new Dictionary>(); - //遍历船名航次,查询订舱数据 - foreach (var item in dto) - { - var boUserList = _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && (x.ParentId == 0 || x.ParentId == null) && !x.IsDeleted && x.TenantId == tenantId) - .Select(x => x.CreatedUserId).ToList(); - if (boUserList.Count > 0) + //遍历船名航次,查询订舱数据 + foreach (var item in dto) { - var phoneList = usrList.Where(u => boUserList.Contains(u.Id) && u.Phone != "" && u.Phone != null).Select(x => x.Phone).ToList(); - - foreach (var phone in phoneList) + var boUserList = _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && (x.ParentId == 0 || x.ParentId == null) && !x.IsDeleted && x.TenantId == tenantId) + .Select(x => x.CreatedUserId).ToList(); + if (boUserList.Count > 0) { - var msg = $"船名:{item.Vessel},航次:{item.Voyno},{item.Message}"; - if (dic.ContainsKey(phone)) - { - dic[phone].Add(msg); - } - else + var phoneList = usrList.Where(u => boUserList.Contains(u.Id) && u.Phone != "" && u.Phone != null).Select(x => x.Phone).ToList(); + + foreach (var phone in phoneList) { - dic.Add(phone, new List(new string[] { msg })); + var msg = $"船名:{item.Vessel},航次:{item.Voyno},{item.Message}"; + if (dic.ContainsKey(phone)) + { + dic[phone].Add(msg); + } + else + { + dic.Add(phone, new List(new string[] { msg })); + } } } } - } - _logger.LogInformation($"处理发送后,准备给{dic.Count}个用户发送通知"); + _logger.LogInformation($"处理发送后,准备给{dic.Count}个用户发送通知"); - if (dic.Count > maxSendLimit) //大于限制,分多次发送 - { - int times = (int)Math.Ceiling(dic.Count * 1.0 / maxSendLimit); - _logger.LogInformation($"发送通知超限,准备分为{times}次发送"); - for (var t = 0; t < times; t++) + if (dic.Count > maxSendLimit) //大于限制,分多次发送 { - var keyList = dic.Keys.Skip(t * maxSendLimit).Take(maxSendLimit); - var currTimes = t + 1; - SpareTime.DoOnce(t == 0 ? 1000 : 70 * 1000 * t, doWhat: (st, val) => + int times = (int)Math.Ceiling(dic.Count * 1.0 / maxSendLimit); + _logger.LogInformation($"发送通知超限,准备分为{times}次发送"); + for (var t = 0; t < times; t++) { - _logger.LogInformation($"超限第{currTimes}次发送,共{keyList.Count()}个"); - foreach (var k in keyList) + var keyList = dic.Keys.Skip(t * maxSendLimit).Take(maxSendLimit); + var currTimes = t + 1; + SpareTime.DoOnce(t == 0 ? 1000 : 70 * 1000 * t, doWhat: (st, val) => { - var content = string.Join("\r\n", dic[k]); - _logger.LogInformation($"准备发送船期通知给 {k},内容:\r\n{content}"); - //DingTalkGroupHelper.SendDingTalkGroupMessage("", "船期提醒", content, false, new string[] { k }, null); - } - }); + _logger.LogInformation($"超限第{currTimes}次发送,共{keyList.Count()}个"); + foreach (var k in keyList) + { + var content = string.Join("\r\n", dic[k]); + _logger.LogInformation($"准备发送船期通知给 {k},内容:\r\n{content}"); + //DingTalkGroupHelper.SendDingTalkGroupMessage("", "船期提醒", content, false, new string[] { k }, null); + } + }); + } + } + else + { + foreach (var item in dic) + { + var content = string.Join("\r\n", item.Value); + _logger.LogInformation($"准备发送船期通知给 {item.Key},内容:\r\n{content}"); + //DingTalkGroupHelper.SendDingTalkGroupMessage("", "船期提醒", content, false, new string[] { item.Key }, null); + } } } - else + catch (Exception ex) { - foreach (var item in dic) + var excep = ex; + while (excep != null) { - var content = string.Join("\r\n", item.Value); - _logger.LogInformation($"准备发送船期通知给 {item.Key},内容:\r\n{content}"); - //DingTalkGroupHelper.SendDingTalkGroupMessage("", "船期提醒", content, false, new string[] { item.Key }, null); + _logger.LogError(excep.Message); + _logger.LogError(excep.StackTrace); + + excep = excep.InnerException; } } }); From b10246bd37007924798a4d2be79305017d1b1720 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Wed, 7 Jun 2023 11:53:55 +0800 Subject: [PATCH 12/17] 1 --- .../Service/DataSync/DataSyncService.cs | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 9c452d3f..c8c6faee 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -266,6 +266,8 @@ namespace Myshipping.Application public async Task SyncCustomer(List model) { var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); + var mlist = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); + var shiplist = await _codeForwarder.AsQueryable().ToListAsync(); foreach (var item in model) { @@ -274,7 +276,7 @@ namespace Myshipping.Application { throw Oops.Bah("简称未录入"); } - var m = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.ShortName == item.ShortName && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).FirstAsync(); + var m = mlist.Where(x => x.ShortName == item.ShortName).First(); var entity = item.Adapt(); if (m == null) { @@ -308,7 +310,7 @@ namespace Myshipping.Application if (entity.PropString.Contains("shipagency")) { - var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync(); + var ship = shiplist.Where(x => x.Code == entity.CodeName).First(); if (ship == null) { @@ -373,7 +375,7 @@ namespace Myshipping.Application if (entity.PropString.Contains("shipagency")) { - var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync(); + var ship = shiplist.Where(x => x.Code == entity.CodeName).First(); if (ship == null) { @@ -420,6 +422,9 @@ namespace Myshipping.Application { var mapcarrier = await _mapcarrier.Where(x => x.Module == "HeChuan").ToListAsync(); + var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); + var mlist = await _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToListAsync(); + var orderlist= await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); foreach (var item in model) { @@ -427,8 +432,8 @@ namespace Myshipping.Application { throw Oops.Bah("BSNO未录入"); } - var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); - var m = await _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.BSNO == item.BSNO && x.TenantId == UserManager.TENANT_ID).FirstAsync(); + + var m = mlist.Where(x => x.BSNO == item.BSNO).First(); var entity = item.Adapt(); entity.Vessel = item.Vessel.ToUpper().Trim(); if (!string.IsNullOrEmpty(item.CARRIER)) @@ -471,9 +476,9 @@ namespace Myshipping.Application if (!string.IsNullOrEmpty(item.CARRIER) && !string.IsNullOrEmpty(item.Vessel) && (!string.IsNullOrEmpty(item.Voyno) || !string.IsNullOrWhiteSpace(item.VoynoInside))) { - var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.CARRIERID == item.CARRIERID && x.VESSEL == item.Vessel && x.IsDeleted == false) + var order = orderlist.Where(x => x.CARRIERID == item.CARRIERID && x.VESSEL == item.Vessel) .WhereIF(!string.IsNullOrEmpty(item.Voyno), x => x.VOYNO == item.Voyno) - .WhereIF(!string.IsNullOrEmpty(item.VoynoInside), x => x.VOYNOINNER == item.VoynoInside).ToListAsync(); + .WhereIF(!string.IsNullOrEmpty(item.VoynoInside), x => x.VOYNOINNER == item.VoynoInside).ToList(); _logger.LogInformation($"同步船期_查询到{UserManager.TENANT_NAME}需要更新{order.Count()}条订舱数据"); foreach (var it in order) @@ -579,6 +584,9 @@ namespace Myshipping.Application var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); var djycustomer = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); var goodsconfig = await _goodsStatusConfig.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); + var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false&& x.TenantId == UserManager.TENANT_ID).ToListAsync(); + var linelist = await _repline.AsQueryable().Filter(null, true).Where(m => m.TenantId == UserManager.TENANT_ID).ToListAsync(); + foreach (var model in list) { if (string.IsNullOrWhiteSpace(model.BSNO)) @@ -590,12 +598,12 @@ namespace Myshipping.Application throw Oops.Bah("未录入创建人"); } - var user = await _repUser.AsQueryable().Filter(null, true).Where(x => x.Name == model.CreatedUserName.Trim() && x.IsDeleted == false).FirstAsync(); + var user = userlist.Where(x => x.Name == model.CreatedUserName.Trim() && x.IsDeleted == false).First(); if (user == null) { throw Oops.Bah($"未匹配到创建人{model.CreatedUserName.Trim()}请联系管理员添加相关用户"); } - var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.BSNO == model.BSNO && x.IsDeleted == false).FirstAsync(); + var order = await orderlist.Where(x => x.BSNO == model.BSNO ).FirstAsync(); if (order == null) @@ -679,7 +687,7 @@ namespace Myshipping.Application } if (!string.IsNullOrEmpty(entity.LineName)) { - var line = _repline.AsQueryable().Filter(null, true).Where(m => m.TenantId == UserManager.TENANT_ID && m.LineName.Contains(entity.LineName)).FirstAsync(); + var line = linelist.Where(m => m.LineName.Contains(entity.LineName)).First(); if (line == null) { await _repline.InsertAsync(new DjyTenantLine @@ -1665,11 +1673,13 @@ namespace Myshipping.Application [SqlSugarUnitOfWork] public async Task SaveSyncVesselDate(List dto) { + var infolist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToList(); + var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); + foreach (var item in dto) { - - var model = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno && x.TenantId == UserManager.TENANT_ID).First(); - if (model != null) + var model = infolist.Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno).First(); + if (model != null) { model.ETA = item.ETA; model.YgtETD = item.ETD; @@ -1677,7 +1687,7 @@ namespace Myshipping.Application await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync(); } - var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); + var order = orderlist.Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno).ToList(); bool issend = false; if (order != null) { @@ -1815,7 +1825,7 @@ namespace Myshipping.Application [SqlSugarUnitOfWork] public async Task SaveSyncGHVesselDate(List dto) { - + var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); foreach (var item in dto) { @@ -1824,7 +1834,7 @@ namespace Myshipping.Application //model.ETD = item.ETD; //model.ATD = item.ATD; //await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync(); - var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); + var order = orderlist.Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno).ToList(); bool issend = false; if (order != null) From 2f0cd5885f4792ed5fdbe42fca7ab21d190381f1 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Wed, 7 Jun 2023 12:46:40 +0800 Subject: [PATCH 13/17] 1 --- Myshipping.Application/Service/DataSync/DataSyncService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 89d294ac..32119c8e 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -603,7 +603,7 @@ namespace Myshipping.Application { throw Oops.Bah($"未匹配到创建人{model.CreatedUserName.Trim()}请联系管理员添加相关用户"); } - var order = await orderlist.Where(x => x.BSNO == model.BSNO ).FirstAsync(); + var order = orderlist.Where(x => x.BSNO == model.BSNO ).First(); if (order == null) From 4da83732f74c36902d02acc5c33e192380775c2a Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Wed, 7 Jun 2023 14:00:25 +0800 Subject: [PATCH 14/17] 1 --- .../Service/DataSync/DataSyncService.cs | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 32119c8e..8da51341 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -276,7 +276,7 @@ namespace Myshipping.Application { throw Oops.Bah("简称未录入"); } - var m = mlist.Where(x => x.ShortName == item.ShortName).First(); + var m = mlist.Where(x => x.ShortName == item.ShortName).FirstOrDefault(); var entity = item.Adapt(); if (m == null) { @@ -310,7 +310,7 @@ namespace Myshipping.Application if (entity.PropString.Contains("shipagency")) { - var ship = shiplist.Where(x => x.Code == entity.CodeName).First(); + var ship = shiplist.Where(x => x.Code == entity.CodeName).FirstOrDefault(); if (ship == null) { @@ -375,7 +375,7 @@ namespace Myshipping.Application if (entity.PropString.Contains("shipagency")) { - var ship = shiplist.Where(x => x.Code == entity.CodeName).First(); + var ship = shiplist.Where(x => x.Code == entity.CodeName).FirstOrDefault(); if (ship == null) { @@ -421,10 +421,10 @@ namespace Myshipping.Application public async Task SyncVesselDateList(List model) { - var mapcarrier = await _mapcarrier.Where(x => x.Module == "HeChuan").ToListAsync(); - var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); - var mlist = await _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToListAsync(); - var orderlist= await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); + var mapcarrier = _mapcarrier.Where(x => x.Module == "HeChuan").ToList(); + var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList(); + var mlist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToList(); + var orderlist= _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToList(); foreach (var item in model) { @@ -433,7 +433,7 @@ namespace Myshipping.Application throw Oops.Bah("BSNO未录入"); } - var m = mlist.Where(x => x.BSNO == item.BSNO).First(); + var m = mlist.Where(x => x.BSNO == item.BSNO).FirstOrDefault(); var entity = item.Adapt(); entity.Vessel = item.Vessel.ToUpper().Trim(); if (!string.IsNullOrEmpty(item.CARRIER)) @@ -456,7 +456,7 @@ namespace Myshipping.Application if (!string.IsNullOrEmpty(item.CreatedUserName)) { - entity.CreatedUserId = userlist.Result.Where(x => x.Name == item.CreatedUserName).Select(x => x.Id).FirstOrDefault(); + entity.CreatedUserId = userlist.Where(x => x.Name == item.CreatedUserName).Select(x => x.Id).FirstOrDefault(); } if (string.IsNullOrEmpty(item.Voyno)) { @@ -598,12 +598,12 @@ namespace Myshipping.Application throw Oops.Bah("未录入创建人"); } - var user = userlist.Where(x => x.Name == model.CreatedUserName.Trim() && x.IsDeleted == false).First(); + var user = userlist.Where(x => x.Name == model.CreatedUserName.Trim() && x.IsDeleted == false).FirstOrDefault(); if (user == null) { throw Oops.Bah($"未匹配到创建人{model.CreatedUserName.Trim()}请联系管理员添加相关用户"); } - var order = orderlist.Where(x => x.BSNO == model.BSNO ).First(); + var order = orderlist.Where(x => x.BSNO == model.BSNO ).FirstOrDefault(); if (order == null) @@ -687,7 +687,7 @@ namespace Myshipping.Application } if (!string.IsNullOrEmpty(entity.LineName)) { - var line = linelist.Where(m => m.LineName.Contains(entity.LineName)).First(); + var line = linelist.Where(m => m.LineName.Contains(entity.LineName)).FirstOrDefault(); if (line == null) { await _repline.InsertAsync(new DjyTenantLine @@ -1678,7 +1678,7 @@ namespace Myshipping.Application foreach (var item in dto) { - var model = infolist.Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno).First(); + var model = infolist.Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno).FirstOrDefault(); if (model != null) { model.ETA = item.ETA; @@ -1829,7 +1829,7 @@ namespace Myshipping.Application foreach (var item in dto) { - //var model = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno && x.TenantId == UserManager.TENANT_ID).First(); + //var model = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno && x.TenantId == UserManager.TENANT_ID).FirstOrDefault(); //model.ETA = item.ETA; //model.ETD = item.ETD; //model.ATD = item.ATD; From cbfe6a36843a76f2c936ab393c52eeae74ee4fc1 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Wed, 7 Jun 2023 14:03:21 +0800 Subject: [PATCH 15/17] 1 --- .../BookingOrder/BookingOrderService.cs | 116 +++++++++--------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 99706e2f..f60104ef 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -392,18 +392,18 @@ namespace Myshipping.Application Sort = config.Sort }).ToList(); - //var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new - //{ - // bookingid = "", - // ConfigId = config.Id, - // SystemCode = config.SystemCode, - // StatusName = config.StatusName, - // FinishTime = "", - // ExtData = "", - // Remark = "", - // CreatedUserId = config.CreatedUserId, - // Sort = config.Sort - //}).ToList(); + var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new + { + bookingid = "", + ConfigId = config.Id, + SystemCode = config.SystemCode, + StatusName = config.StatusName, + FinishTime = "", + ExtData = "", + Remark = "", + CreatedUserId = config.CreatedUserId, + Sort = config.Sort + }).ToList(); var statusloglist = _repStatuslog.AsQueryable().Where(x => (x.Status == "提箱" || x.Status == "返场")).ToList(); var statuslogdetaillist = _statuslogdetail.AsQueryable().ToList(); foreach (var item in list.Items) @@ -475,24 +475,24 @@ namespace Myshipping.Application Sort = x.Sort }).ToList(); - //var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort). - // Select(x => new GoodsStatusList - // { - // ConfigId = x.ConfigId, - // StatusName = x.StatusName, - // SystemCode = x.SystemCode, - // FinishTime = null, - // ExtData = x.ExtData, - // Remark = x.Remark, - // Sort = x.Sort - // }).ToList(); - - //foreach (var ii in itgoods) - //{ - // itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId); - //} + var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort). + Select(x => new GoodsStatusList + { + ConfigId = x.ConfigId, + StatusName = x.StatusName, + SystemCode = x.SystemCode, + FinishTime = null, + ExtData = x.ExtData, + Remark = x.Remark, + Sort = x.Sort + }).ToList(); + + foreach (var ii in itgoods) + { + itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId); + } - item.GoodsStatusList = itgoods; + item.GoodsStatusList = itgoods.Union(itconfig).OrderBy(x => x.Sort).ToList(); //获取提箱返场状态 var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList(); var dto = statuslog.Adapt>(); @@ -723,18 +723,18 @@ namespace Myshipping.Application Sort = config.Sort }).ToList(); - //var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new - //{ - // bookingid = "", - // ConfigId = config.Id, - // SystemCode = config.SystemCode, - // StatusName = config.StatusName, - // FinishTime = "", - // ExtData = "", - // Remark = "", - // CreatedUserId = config.CreatedUserId, - // Sort = config.Sort - //}).ToList(); + var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new + { + bookingid = "", + ConfigId = config.Id, + SystemCode = config.SystemCode, + StatusName = config.StatusName, + FinishTime = "", + ExtData = "", + Remark = "", + CreatedUserId = config.CreatedUserId, + Sort = config.Sort + }).ToList(); var statusloglist = _repStatuslog.AsQueryable().Where(x=> (x.Status == "提箱" || x.Status == "返场")).ToList(); var statuslogdetaillist = _statuslogdetail.AsQueryable().ToList(); foreach (var item in list.Items) @@ -806,24 +806,24 @@ namespace Myshipping.Application Sort = x.Sort }).ToList(); - //var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort). - // Select(x => new GoodsStatusList - // { - // ConfigId = x.ConfigId, - // StatusName = x.StatusName, - // SystemCode = x.SystemCode, - // FinishTime = null, - // ExtData = x.ExtData, - // Remark = x.Remark, - // Sort = x.Sort - // }).ToList(); - - //foreach (var ii in itgoods) - //{ - // itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId); - //} + var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort). + Select(x => new GoodsStatusList + { + ConfigId = x.ConfigId, + StatusName = x.StatusName, + SystemCode = x.SystemCode, + FinishTime = null, + ExtData = x.ExtData, + Remark = x.Remark, + Sort = x.Sort + }).ToList(); + + foreach (var ii in itgoods) + { + itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId); + } - item.GoodsStatusList = itgoods; + item.GoodsStatusList = itgoods.Union(itconfig).OrderBy(x => x.Sort).ToList(); //获取提箱返场状态 var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList(); var dto = statuslog.Adapt>(); From f2cf96c41deea21976d41f70e5e8743f8d3d7ba4 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Wed, 7 Jun 2023 14:47:10 +0800 Subject: [PATCH 16/17] 1 --- .../Service/BookingOrder/BookingOrderService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index f60104ef..c2131ed0 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -404,8 +404,8 @@ namespace Myshipping.Application CreatedUserId = config.CreatedUserId, Sort = config.Sort }).ToList(); - var statusloglist = _repStatuslog.AsQueryable().Where(x => (x.Status == "提箱" || x.Status == "返场")).ToList(); - var statuslogdetaillist = _statuslogdetail.AsQueryable().ToList(); + var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x => (x.Status == "提箱" || x.Status == "返场")&&x.IsDeleted==false&&x.TenantId==UserManager.TENANT_ID).ToList(); + var statuslogdetaillist = _statuslogdetail.AsQueryable().Filter(null, true).ToList(); foreach (var item in list.Items) { var sta = _repBookingStatus.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id).ToList(); @@ -735,7 +735,7 @@ namespace Myshipping.Application CreatedUserId = config.CreatedUserId, Sort = config.Sort }).ToList(); - var statusloglist = _repStatuslog.AsQueryable().Where(x=> (x.Status == "提箱" || x.Status == "返场")).ToList(); + var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x=> (x.Status == "提箱" || x.Status == "返场")&&x.IsDeleted==false&&x.TenantId==UserManager.TENANT_ID).ToList(); var statuslogdetaillist = _statuslogdetail.AsQueryable().ToList(); foreach (var item in list.Items) { From ccaa51cef348c25fd01ddf9502262ac9b6b1ebfe Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Wed, 7 Jun 2023 15:12:19 +0800 Subject: [PATCH 17/17] 1 --- .../Service/BookingOrder/BookingOrderService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index c2131ed0..97d56293 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -404,7 +404,7 @@ namespace Myshipping.Application CreatedUserId = config.CreatedUserId, Sort = config.Sort }).ToList(); - var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x => (x.Status == "提箱" || x.Status == "返场")&&x.IsDeleted==false&&x.TenantId==UserManager.TENANT_ID).ToList(); + var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x => (x.Status == "提箱" || x.Status == "返场")&&x.IsDeleted==false).ToList(); var statuslogdetaillist = _statuslogdetail.AsQueryable().Filter(null, true).ToList(); foreach (var item in list.Items) { @@ -735,7 +735,7 @@ namespace Myshipping.Application CreatedUserId = config.CreatedUserId, Sort = config.Sort }).ToList(); - var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x=> (x.Status == "提箱" || x.Status == "返场")&&x.IsDeleted==false&&x.TenantId==UserManager.TENANT_ID).ToList(); + var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x=> (x.Status == "提箱" || x.Status == "返场")&&x.IsDeleted==false).ToList(); var statuslogdetaillist = _statuslogdetail.AsQueryable().ToList(); foreach (var item in list.Items) {