diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index 2b3a3d86..df53b3f7 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -13200,6 +13200,13 @@ 提单纸登记请求参数 + + + 下载任务附件 + + + 返回文件流 + 任务管理 @@ -13326,5 +13333,12 @@ 任务主键数组 返回结果 + + + 下载任务附件 + + + 返回文件流 + diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 02255648..d13c5da0 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -1671,11 +1671,12 @@ namespace Myshipping.Application /// /// 订舱Id /// 打印模板ID + /// 分类代码(使用字典【booking_template_category】中的代码) /// 类型,1:pdf、2:xlsx、3:docx /// 打印类型,10:FastReport、20:Excel模板 /// [HttpGet("/BookingOrder/PrintOrder")] - public async Task PrintOrder(long bookingId, long templateId, int type = 1, BookingPrintTemplateType printType = BookingPrintTemplateType.FastReport) + public async Task PrintOrder(long bookingId, long templateId, string cateCode, int type = 1, BookingPrintTemplateType printType = BookingPrintTemplateType.FastReport) { var printTemplate = await _repPrintTemplate.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == templateId); if (printTemplate == null) @@ -1777,7 +1778,7 @@ namespace Myshipping.Application //记录打印次数和时间,用于前端动态展示常用的打印类型 - var printRecentListKey = $"{PrintRecentListTypeKey}_{printTemplate.CateCode}_{printType}"; + var printRecentListKey = $"{PrintRecentListTypeKey}_{cateCode}_{printType}"; var usrCfg = _repUserConfig.AsQueryable().First(x => x.CreatedUserId == UserManager.UserId && x.Type == printRecentListKey); if (usrCfg == null) { diff --git a/Myshipping.Application/Service/Para/ParaService.cs b/Myshipping.Application/Service/Para/ParaService.cs index 7017bacc..90982ea6 100644 --- a/Myshipping.Application/Service/Para/ParaService.cs +++ b/Myshipping.Application/Service/Para/ParaService.cs @@ -470,12 +470,12 @@ namespace Myshipping.Application } //这里需要判断当前的品名分类是否已经对应到品名上,如果已有对应则不能直接作废 - var existsList = _paraGoodsCategoryInfoRepository.AsQueryable() - .LeftJoin(_paraGoodsInfoRepository.AsQueryable(),(cate, goods) => cate.GOODS_CATEGORY == goods.GOODS_CATEGORY) - .Where(cate => Ids.Contains(cate.Id)) - .Select((cate, goods) => new { Cate = cate, Goods = goods }).ToList(); + var existsList = _paraGoodsCategoryInfoRepository.EntityContext.Queryable() + .InnerJoin((cate, goods) => cate.GOODS_CATEGORY == goods.GOODS_CATEGORY) + .Where(cate => Ids.Contains(cate.Id)) + .Select((cate, goods) => new { Cate = cate, Goods = goods }).ToList(); - if(existsList.Any(t=>t.Goods != null)) + if(existsList.Count > 0) throw Oops.Oh($"以下分类代码已指定品名参数不能直接删除,{string.Join(",",existsList.Select(t=>t.Cate.GOODS_CATEGORY).Distinct().ToArray())}"); list.ForEach(async entity => diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs index bd9b9f78..cc4b104a 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs @@ -97,5 +97,19 @@ namespace Myshipping.Application /// Task LaraPaperRegistPost(string taskPKId, LaraPaperRegistPostDto model); + /// + /// 下载任务附件 + /// + /// + /// 返回文件流 + IActionResult DownloadTaskAttach(string taskPKId); + + + ///// + ///// 正本附件批量打印 + ///// + ///// 任务主键数组 + ///// 返回结果 + //Task PrintBatch(string[] PKIds); } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 242e2710..9f8cf32e 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using System.Dynamic; using System.IO; using System.Linq; +using System.Net; using System.Net.Http; using System.Reflection.Metadata.Ecma335; using System.Runtime.InteropServices; @@ -1208,6 +1209,7 @@ namespace Myshipping.Application /// 任务主键 /// 提单纸登记请求参数 /// + [HttpPost("/TaskManage/LaraPaperRegistPost")] public async Task LaraPaperRegistPost(string taskPKId, LaraPaperRegistPostDto model) { TaskManageOrderResultDto result = new TaskManageOrderResultDto(); @@ -1536,8 +1538,37 @@ namespace Myshipping.Application return result; } #endregion + + /// + /// 下载任务附件 + /// + /// + /// 返回文件流 + [HttpGet("/TaskManage/DownloadTaskAttach")] + public IActionResult DownloadTaskAttach([FromQuery] string taskPKId) + { + FileStreamResult result = null; + + var fileList = _taskFileInfoRepository.AsQueryable().Where(t => t.TASK_PKID == taskPKId).ToList(); + + var fileInfo = fileList.FirstOrDefault(); + if (fileInfo.FILE_PATH.StartsWith("http://")) + { + WebClient wc = new WebClient(); + var data = wc.DownloadData(fileInfo.FILE_PATH); + + result = new FileStreamResult(new MemoryStream(data), "application/octet-stream") { FileDownloadName = fileInfo.FILE_NAME }; + } + else if (System.IO.File.Exists(fileInfo.FILE_PATH)) + { + result = new FileStreamResult(new FileStream(fileInfo.FILE_PATH, FileMode.Open), "application/octet-stream") { FileDownloadName = fileInfo.FILE_NAME }; + } + + return result; + } } + public static class DraftPaperExtension { diff --git a/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs b/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs index 3485fbbe..88a3a9bd 100644 --- a/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs +++ b/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs @@ -51,7 +51,7 @@ namespace Myshipping.Core.Service /// /// /// - [HttpPost("/DjyApiAuth/sava")] + [HttpPost("/DjyApiAuth/save")] public async Task Save(SaveDjyApiAuthInput input) { DjyApiAuth entity = null;