From 42b24b2553e82b4edd53a936b1913b3beb485c62 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Fri, 30 Dec 2022 17:40:17 +0800 Subject: [PATCH] excel --- .../BookingTemplate/BookingTemplateService.cs | 5 ++-- Myshipping.Core/Myshipping.Core.xml | 14 +++++++++++ .../DjyVesselInfo/DjyVesselInfoService.cs | 24 +++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs index 9cc6bbfe..20093b2b 100644 --- a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs +++ b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs @@ -256,10 +256,11 @@ namespace Myshipping.Application Directory.CreateDirectory(fileFullPath); } var fileName = string.Format("订舱{0}.xls", DateTime.Now.Ticks); + _logger.LogInformation("导出excel:" + Path.Combine(fileFullPath, fileName)); var filestream = new FileStream(Path.Combine(fileFullPath ,fileName), FileMode.OpenOrCreate, FileAccess.ReadWrite); excelwork.Write(filestream); - var result = new FileStreamResult(filestream, "application/octet-stream") { FileDownloadName = fileName }; - return Path.Combine(fileFullPath, fileName); + var result = new FileStreamResult(new FileStream(Path.Combine(fileFullPath, fileName), FileMode.Open), "application/octet-stream") { FileDownloadName = fileName }; + return result; } diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 421c7bde..eaa91009 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -10867,6 +10867,20 @@ 船期手工维护模块 + + + 获取列表 + + + + + + + 删除 + + + + 新增编辑 diff --git a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs index bfcbd3d7..bc475a44 100644 --- a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs +++ b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs @@ -27,6 +27,30 @@ namespace Myshipping.Core.Service _sysCacheService = sysCacheService; _rep = rep; } + /// + /// 获取列表 + /// + /// + /// + [HttpGet("/DjyVesselInfoService/GetListPage")] + public async Task GetListPage([FromQuery] string KeyWord) { + + return await _rep.AsQueryable().WhereIF(!string.IsNullOrWhiteSpace(KeyWord), x => x.Vessel.Contains(KeyWord)).ToListAsync(); + } + + /// + /// 删除 + /// + /// + /// + [HttpGet("/DjyVesselInfoService/Delete")] + public async Task Delete([FromQuery] long[] Ids) + { + + var entity = await _rep.FirstOrDefaultAsync(u => Ids.Contains(u.Id)); + await _rep.DeleteAsync(entity); + } + ///