From f4464c940d932c4b83a4ff2e437ce032fddf9cca Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 10 Jan 2023 15:49:18 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=8B=89=E5=8F=96=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=A8=A1=E6=9D=BFbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/Myshipping.Application.xml | 3 ++- .../Service/BookingOrder/BookingOrderService.cs | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index df53b3f7..392e3151 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -6356,12 +6356,13 @@ 文件名 - + 订舱打印(返回文件名) 订舱Id 打印模板ID + 分类代码(使用字典【booking_template_category】中的代码) 类型,1:pdf、2:xlsx、3:docx 打印类型,10:FastReport、20:Excel模板 diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index d13c5da0..42baceb9 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -847,7 +847,7 @@ namespace Myshipping.Application public async Task> GetBookingStatusLog(long Id) { - var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == Id).OrderByDescending(x=>x.OpTime).ToListAsync(); + var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == Id).OrderByDescending(x => x.OpTime).ToListAsync(); var dto = statuslog.Adapt>(); foreach (var item in dto) { @@ -1744,7 +1744,7 @@ namespace Myshipping.Application if (entity.Where(x => x.Row == (_row + 1)).Count() > 0) { - ///创建行 + //创建行 var row = NpoiExcelExportHelper._.CreateRow(sheet, _row, 25); for (int _cellNum = 0; _cellNum < entity.Max(x => x.Column); _cellNum++) { @@ -1901,10 +1901,11 @@ namespace Myshipping.Application [HttpGet("/BookingOrder/PrintTemplateWithHistoryList")] public async Task PrintTemplateWithHistoryList(string cateCode, BookingPrintTemplateType printType) { + var typeCode = printType.ToString(); //当前公司所有已配置的模板 var allList = await _repPrintTemplate.AsQueryable() .Filter(null, true).InnerJoin((d, t) => d.Id == t.PrintTemplateId && t.SysUserId == UserManager.UserId) - .Where(d => d.TenantId == UserManager.TENANT_ID && d.CateCode.Contains(cateCode)) + .Where(d => d.TenantId == UserManager.TENANT_ID && d.CateCode.Contains(cateCode) && d.TypeCode == typeCode) .Select(d => new { d.Id, From e769b4815db24726cbce1534e6800af1c03228d1 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 10 Jan 2023 16:15:03 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=8B=89=E5=8F=96=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=A8=A1=E6=9D=BFbug?= 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 42baceb9..bb4c0b25 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -1905,7 +1905,7 @@ namespace Myshipping.Application //当前公司所有已配置的模板 var allList = await _repPrintTemplate.AsQueryable() .Filter(null, true).InnerJoin((d, t) => d.Id == t.PrintTemplateId && t.SysUserId == UserManager.UserId) - .Where(d => d.TenantId == UserManager.TENANT_ID && d.CateCode.Contains(cateCode) && d.TypeCode == typeCode) + .Where(d => d.TenantId == UserManager.TENANT_ID && d.CateCode.Contains(cateCode) && d.Type == typeCode) .Select(d => new { d.Id, From 5195bbf4b16c5e71d1fcb63f23d29f9ac33f5adf Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 10 Jan 2023 16:32:45 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index bb4c0b25..a683d4ab 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -1684,6 +1684,12 @@ namespace Myshipping.Application throw Oops.Bah(BookingErrorCode.BOOK115); } + var order = await _rep.FirstOrDefaultAsync(x => x.Id == bookingId); + if (order == null) + { + throw Oops.Bah(BookingErrorCode.BOOK001); + } + var fileName = string.Empty; #region FastReport打印 @@ -1708,7 +1714,13 @@ namespace Myshipping.Application throw Oops.Bah("类型参数不正确"); } - fileName = HttpUtility.UrlEncode($"{bookingId}_{DateTime.Now.Ticks}{fileType}", Encoding.GetEncoding("UTF-8"));//名称 + var dicCate = (await _cache.GetAllDictData()).FirstOrDefault(x => x.Code == cateCode && x.TypeCode == "booking_template_category"); + if (dicCate == null) + { + throw Oops.Bah("分类代码参数不正确"); + } + + fileName = HttpUtility.UrlEncode($"{dicCate.Value}_{order.MBLNO}_{DateTime.Now.Ticks}{fileType}", Encoding.GetEncoding("UTF-8"));//名称 var opt = App.GetOptions().Path; var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径 if (!Directory.Exists(serverpath)) @@ -1735,7 +1747,6 @@ namespace Myshipping.Application var result = new FileStream(fileAbsPath, FileMode.Open); var excelwork = new HSSFWorkbook(result); var sheet = excelwork.GetSheetAt(0); - var order = await _rep.AsQueryable().Where(x => x.Id == bookingId).FirstAsync(); var entity = await _excelrep.AsQueryable().Where(x => x.PId == templateId).OrderBy(x => x.Row).ToListAsync(); //单元格样式 var cellStyle = NpoiExcelExportHelper._.CreateStyle(excelwork, HorizontalAlignment.Center, VerticalAlignment.Center, 10, true, 0); From 1dd6dbf138ebc1dc59cb3f7d73b396effa7a36bb Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 10 Jan 2023 16:40:06 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../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 a683d4ab..28070404 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -1720,7 +1720,7 @@ namespace Myshipping.Application throw Oops.Bah("分类代码参数不正确"); } - fileName = HttpUtility.UrlEncode($"{dicCate.Value}_{order.MBLNO}_{DateTime.Now.Ticks}{fileType}", Encoding.GetEncoding("UTF-8"));//名称 + fileName = $"{dicCate.Value}_{order.MBLNO}_{DateTime.Now.Ticks}{fileType}";//名称 var opt = App.GetOptions().Path; var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径 if (!Directory.Exists(serverpath)) @@ -1806,7 +1806,7 @@ namespace Myshipping.Application await _repUserConfig.UpdateAsync(usrCfg); } - return fileName; + return HttpUtility.UrlEncode(fileName, Encoding.GetEncoding("UTF-8")); } ///// From 954b36e7dd3737902e6a3ea5594c4263f112e05a Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 10 Jan 2023 16:52:31 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=8F=90=E5=8D=95=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=BF=94=E5=9B=9Eid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 28070404..878b2bbf 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -2015,19 +2015,22 @@ namespace Myshipping.Application /// /// [HttpPost("/BookingSampleBill/Save")] - public async Task SampleBillSave(UpdateBookingSampleBillInput input) + public async Task SampleBillSave(UpdateBookingSampleBillInput input) { + BookingSampleBill entity = null; if (input.Id == 0) { - var entity = input.Adapt(); + entity = input.Adapt(); await _repSampleBill.InsertAsync(entity); } else { - var entity = _repSampleBill.FirstOrDefault(x => x.BookingId == input.Id); + entity = _repSampleBill.FirstOrDefault(x => x.BookingId == input.Id); entity = input.Adapt(entity); await _repSampleBill.UpdateAsync(entity); } + + return entity.Id; } ///