From 8a1cf589dbe9291a5fe15d6fb6697056924a39eb Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Tue, 3 Jan 2023 16:56:16 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 63 ++++++++++++++++++- Myshipping.Core/Job/LogJobWorker.cs | 39 ++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index dc55ef28..a94fd2d7 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -1579,7 +1579,7 @@ namespace Myshipping.Application /// /// 文件名 /// - [HttpGet("/BookingOrder/DownloadPrint")] + [HttpGet("/BookingOrder/DownloadPrint"), AllowAnonymous] public IActionResult DownloadPrint(string fileName) { var opt = App.GetOptions().Path; @@ -3247,6 +3247,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); + } + + } + } } From 4c228279aaea013d60b58fec6407f8719e7bc2f7 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Tue, 3 Jan 2023 17:42:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8F=90=E5=8D=95=E5=8F=B7=E9=87=8D?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Myshipping.Application.xml | 17 ++++++++++++----- .../Service/BookingOrder/BookingOrderService.cs | 4 ++-- 2 files changed, 14 insertions(+), 7 deletions(-) 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 5b78a5e4..b4f36206 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).FirstAsync(); if (et != null) { From 97e148bc4e8b6848082c629eb057e9910d3ba576 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Tue, 3 Jan 2023 17:51:45 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index b4f36206..eed58ca0 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -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.HBLNO == input.HBLNO && x.ParentId == input.ParentId).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) {