From c8a9ab01f01ffdf522a5f174d684aff7722a9679 Mon Sep 17 00:00:00 2001 From: xwt <2740516069@qq.com> Date: 星期四, 17 七月 2025 14:32:10 +0800 Subject: [PATCH] 来料检获取附件信息 --- StandardInterface/MES.Service/Modes/MesQamftp.cs | 54 +++++++++++++++++++++++++++ StandardInterface/MESApplication/Controllers/AttachmentController.cs | 32 ++++++++++++++++ StandardInterface/MES.Service/Modes/QamftpDto.cs | 23 +++++++++++ 3 files changed, 109 insertions(+), 0 deletions(-) diff --git a/StandardInterface/MES.Service/Modes/MesQamftp.cs b/StandardInterface/MES.Service/Modes/MesQamftp.cs new file mode 100644 index 0000000..29c0519 --- /dev/null +++ b/StandardInterface/MES.Service/Modes/MesQamftp.cs @@ -0,0 +1,54 @@ +using System; +using SqlSugar; + +namespace MES.Service.Modes +{ + [SugarTable("MES_QAMFTP")] + public class MesQamftp + { + [SugarColumn(ColumnName = "ID")] + public decimal Id { get; set; } + + [SugarColumn(ColumnName = "ITEM_NO")] + public string ItemNo { get; set; } + + [SugarColumn(ColumnName = "FTYPE")] + public string Ftype { get; set; } + + [SugarColumn(ColumnName = "FATTACH")] + public string Fattach { get; set; } + + [SugarColumn(ColumnName = "FVERSION")] + public string Fversion { get; set; } + + [SugarColumn(ColumnName = "FDATE")] + public string Fdate { get; set; } + + [SugarColumn(ColumnName = "CREATE_BY")] + public string CreateBy { get; set; } + + [SugarColumn(ColumnName = "CREATE_DATE")] + public string CreateDate { get; set; } + + [SugarColumn(ColumnName = "COMPANY")] + public string Company { get; set; } + + [SugarColumn(ColumnName = "FACTORY")] + public string Factory { get; set; } + + [SugarColumn(ColumnName = "RELEASE_NO")] + public string ReleaseNo { get; set; } + + [SugarColumn(ColumnName = "F_TYPE")] + public int? F_type { get; set; } + + [SugarColumn(ColumnName = "LASTUPDATE_BY")] + public string LastupdateBy { get; set; } + + [SugarColumn(ColumnName = "LASTUPDATE_DATE")] + public DateTime? LastupdateDate { get; set; } + + [SugarColumn(ColumnName = "ITEM_ID")] + public decimal? ItemId { get; set; } + } +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/Modes/QamftpDto.cs b/StandardInterface/MES.Service/Modes/QamftpDto.cs new file mode 100644 index 0000000..c1ba272 --- /dev/null +++ b/StandardInterface/MES.Service/Modes/QamftpDto.cs @@ -0,0 +1,23 @@ +using System; + +namespace MES.Service.Modes +{ + public class QamftpDto + { + public decimal Id { get; set; } + public string ItemNo { get; set; } + public string Ftype { get; set; } + public string Fattach { get; set; } + public string Fversion { get; set; } + public string Fdate { get; set; } + public string CreateBy { get; set; } + public string CreateDate { get; set; } + public string Company { get; set; } + public string Factory { get; set; } + public string ReleaseNo { get; set; } + public int? F_type { get; set; } + public string LastupdateBy { get; set; } + public DateTime? LastupdateDate { get; set; } + public decimal? ItemId { get; set; } + } +} \ No newline at end of file diff --git a/StandardInterface/MESApplication/Controllers/AttachmentController.cs b/StandardInterface/MESApplication/Controllers/AttachmentController.cs new file mode 100644 index 0000000..46703f0 --- /dev/null +++ b/StandardInterface/MESApplication/Controllers/AttachmentController.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Mvc; +using System.IO; + +namespace MESApplication.Controllers +{ + [ApiController] + [Route("Attachment")] + public class AttachmentController : ControllerBase + { + // 鏍圭洰褰� + private readonly string ftpRootPath = @"D:\MES_FTP\IQC"; + + [HttpGet("Download")] + public IActionResult Download([FromQuery] string itemNo, [FromQuery] string fileName) + { + if (string.IsNullOrWhiteSpace(itemNo) || string.IsNullOrWhiteSpace(fileName)) + return BadRequest("鐗╂枡缂栫爜鍜屾枃浠跺悕涓嶈兘涓虹┖"); + + // 闃叉璺緞绌胯秺鏀诲嚮 + var safeItemNo = Path.GetFileName(itemNo.Trim()); + var safeFileName = Path.GetFileName(fileName.Trim()); + + var filePath = Path.Combine(ftpRootPath, safeItemNo, safeFileName); + + if (!System.IO.File.Exists(filePath)) + return NotFound("鏂囦欢涓嶅瓨鍦�"); + + var contentType = "application/octet-stream"; + return PhysicalFile(filePath, contentType, safeFileName); + } + } +} \ No newline at end of file -- Gitblit v1.9.3