diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index e2f0c7e5..aefa92e4 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -6082,7 +6082,7 @@ - 获取放舱pdf + 获取放舱pdf(准备作废,后期使用打印相关接口) 类型,1:pdf、2:xlsx、3:docx @@ -6090,7 +6090,7 @@ - 获取放舱excel + 获取放舱excel(准备作废,后期使用打印相关接口) @@ -6109,7 +6109,7 @@ 生成打印报表文件 订舱ID - 打印模板 + 打印模板 类型,1:pdf、2:xlsx、3:docx @@ -6140,15 +6140,22 @@ - 下载打印文件(PDF直接预览) + 预览模板生成的pdf文件 - 查看ID + 文件名称 + + 获取订舱打印模板列表(带有当前用户打印历史排序)(准备作废,使用PrintTemplateWithHistoryList代替) + + + + 获取订舱打印模板列表(带有当前用户打印历史排序) + 分类代码(使用字典【booking_template_category】中的代码) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 1d4d5b30..74169d9d 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -368,7 +368,7 @@ namespace Myshipping.Application var groupList = input.ctnInputs.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Sum(gg => gg.CTNNUM)}"); input.CNTRTOTAL = string.Join(" / ", groupList); } - var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0).FirstAsync(); + var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.HBLNO == input.HBLNO&&x.ParentId==input.ParentId).FirstAsync(); if (et != null) { @@ -483,7 +483,7 @@ namespace Myshipping.Application } var main = await _rep.AsQueryable().Where(x => x.Id == input.Id).FirstAsync(); - var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.Id != input.Id && x.ParentId == 0).FirstAsync(); + var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.HBLNO == input.HBLNO && x.ParentId == input.ParentId&&x.Id!=input.Id).FirstAsync(); if (et != null) { @@ -1644,7 +1644,7 @@ namespace Myshipping.Application /// /// 文件名 /// - [HttpGet("/BookingOrder/DownloadPrint")] + [HttpGet("/BookingOrder/DownloadPrint"), AllowAnonymous] public IActionResult DownloadPrint(string fileName) { var opt = App.GetOptions().Path; @@ -3462,6 +3462,67 @@ namespace Myshipping.Application } } #endregion + [HttpGet("/BookingOrder/test")] + public void test() { + + var opt = App.GetOptions(); + var dirAbs = opt.Path; + var RemainHours = Convert.ToDouble(opt.RemainHours); + var fileFullPath = Path.Combine(App.WebHostEnvironment.WebRootPath, dirAbs); + string[] Files = Directory.GetFiles(fileFullPath); //当前目录下的文件: + foreach (string it in Files) + { + FileInfo fi = new FileInfo(it); + var date = fi.CreationTime.AddHours(RemainHours); + if (date < DateTime.Now) + { + File.Delete(it); + } + } + string[] _Files = Directory.GetDirectories(fileFullPath); //当前目录下的文件夹: + if (_Files.Length>0) { + foreach (string it in _Files) + { + //FileInfo fi = new FileInfo(it); + //var date = fi.CreationTime.AddHours(RemainHours); + //if (date < DateTime.Now) + //{ + // File.Delete(it); + //} + test1( it); + } + + } + + } + public void test1(string path) { + var opt = App.GetOptions(); + var RemainHours = Convert.ToDouble(opt.RemainHours); + string[] Files = Directory.GetFiles(path); //当前目录下的文件: + foreach (string it in Files) + { + FileInfo fi = new FileInfo(it); + var date = fi.CreationTime.AddHours(RemainHours); + if (date < DateTime.Now) + { + File.Delete(it); + } + } + string[] _Files = Directory.GetDirectories(path); //当前目录下的文件夹: + if (_Files.Length>0) { + foreach (string it in _Files) + { + test1(it); + } + + } + + } + + + + + } } diff --git a/Myshipping.Core/Job/LogJobWorker.cs b/Myshipping.Core/Job/LogJobWorker.cs index fb62262c..daf8818f 100644 --- a/Myshipping.Core/Job/LogJobWorker.cs +++ b/Myshipping.Core/Job/LogJobWorker.cs @@ -277,5 +277,44 @@ public class LogJobWorker : ISpareTimeWorker, IDynamicApiController, ITransient File.Delete(it); } } + string[] _Files = Directory.GetDirectories(fileFullPath); //当前目录下的文件夹: + if (_Files.Length > 0) + { + foreach (string it in _Files) + { + + TemporaryDirectories(it); + } + + } + + + } + + + public void TemporaryDirectories(string path) + { + var opt = App.GetOptions(); + var RemainHours = Convert.ToDouble(opt.RemainHours); + string[] Files = Directory.GetFiles(path); //当前目录下的文件: + foreach (string it in Files) + { + FileInfo fi = new FileInfo(it); + var date = fi.CreationTime.AddHours(RemainHours); + if (date < DateTime.Now) + { + File.Delete(it); + } + } + string[] _Files = Directory.GetDirectories(path); //当前目录下的文件夹: + if (_Files.Length > 0) + { + foreach (string it in _Files) + { + TemporaryDirectories(it); + } + + } + } }