From 513751f81bc03154b77f4ce0099307896fe46dbc Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 16 May 2023 13:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=BB=E5=8A=A1=E5=8F=B0?= =?UTF-8?q?=E8=B4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingValueAddedService.cs | 33 ++++++++++++++++++- .../TaskManagePlat/Dtos/TaskBaseInfoDto.cs | 25 ++++++++++++++ .../TaskManagePlat/Dtos/TaskManageMapper.cs | 8 +++-- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs index c23c396b..796107d7 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs @@ -98,6 +98,17 @@ namespace Myshipping.Application result.succ = true; result.msg = "批量下载BC成功"; + + var downResultList = taskList.Select(x => x.Result); + + if (downResultList.Any(x => !x.succ)) + { + result.succ = false; + result.msg = "BC下载失败"; + //result.ext = + } + + //result.ext = id; } catch (Exception ex) @@ -187,10 +198,14 @@ namespace Myshipping.Application string relativePath = $"{fileCfg.relativePath}\\bcfiles\\{bookingOrder.Id}"; string filePath = $"{(!string.IsNullOrWhiteSpace(fileCfg.basePath) ? fileCfg.basePath : App.WebHostEnvironment.WebRootPath)}\\{relativePath}"; + string fileFullName = $"{filePath}\\{new System.IO.FileInfo(currFilePath).Name}"; + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { relativePath = relativePath.Replace("\\", "/"); filePath = filePath.Replace("\\", "/"); + + fileFullName = fileFullName.Replace("\\", "/"); } _logger.LogInformation("批次={no} 生成文件保存路径完成 路由={filePath} 服务器系统={system}", batchNo, filePath, RuntimeInformation.OSDescription); @@ -202,8 +217,24 @@ namespace Myshipping.Application var bcStream = await currFilePath.GetAsStreamAsync(); + using (var fileStream = File.Create(fileFullName)) + { + await bcStream.CopyToAsync(fileStream); + } + + string bookFilePath = string.Empty; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + bookFilePath = System.Text.RegularExpressions.Regex.Match(fileFullName, relativePath.Replace("/", "\\/") + ".*").Value; + } + else + { + bookFilePath = System.Text.RegularExpressions.Regex.Match(fileFullName, relativePath.Replace("\\", "\\\\") + ".*").Value; + } + //这里先写入附件表 - await SaveEDIFile(bookingOrder.Id, currFilePath, new System.IO.FileInfo(currFilePath).Name, + await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(currFilePath).Name, fileTypeCode, fileTypeName); } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskBaseInfoDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskBaseInfoDto.cs index 7ad4133f..4783195c 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskBaseInfoDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskBaseInfoDto.cs @@ -180,5 +180,30 @@ namespace Myshipping.Application /// public string IssueTypeName { get; set; } + /// + /// 操作ID + /// + public long TaskReqUserId { get; set; } + + /// + /// 操作名称 + /// + public string TaskReqUserName { get; set; } + + /// + /// 箱型箱量 + /// + public string ContaInfo { get; set; } + + /// + /// 船名航次 + /// + public string VesselVoyno { get; set; } + + /// + /// 场站 + /// + public string YardName { get; set; } + } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs index 25c99866..0157b2af 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs @@ -97,7 +97,7 @@ namespace Myshipping.Application .Map(dest => dest.CompleteDate, src => src.COMPLETE_DATE) .Map(dest => dest.BookOrderNo, src => src.BOOK_ORDER_NO) .Map(dest => dest.ResultNote, src => src.RESULT_NOTE) - .Map(dest => dest.ETD, src => src.ETD.HasValue? src.ETD.Value.ToString("yyyy-MM-dd HH:mm:ss"):"") + .Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd HH:mm:ss") : "") .Map(dest => dest.CreatedTime, src => src.CreatedTime) .Map(dest => dest.UpdatedTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "") .Map(dest => dest.CreatedUserId, src => src.CreatedUserId) @@ -107,7 +107,11 @@ namespace Myshipping.Application .Map(dest => dest.ComplateDeal, src => src.COMPLETE_DEAL) .Map(dest => dest.ComplateDealName, src => src.COMPLETE_DEAL_NAME) .Map(dest => dest.IssueType, src => src.ISSUE_TYPE) - .Map(dest => dest.IssueTypeName, src => src.ISSUE_TYPE_NAME); + .Map(dest => dest.IssueTypeName, src => src.ISSUE_TYPE_NAME) + .Map(dest => dest.TaskReqUserId, src => src.TASK_REQ_USERID) + .Map(dest => dest.TaskReqUserName, src => src.TASK_REQ_USERNAME) + .Map(dest => dest.YardName, src => src.YARD_NAME) + .Map(dest => dest.VesselVoyno, src => src.VESSEL_VOYNO); config.ForType() .Map(dest => dest.PK_ID, src => src.PKId)