xwt
2 天以前 c8a9ab01f01ffdf522a5f174d684aff7722a9679
来料检获取附件信息
已添加3个文件
109 ■■■■■ 文件已修改
StandardInterface/MES.Service/Modes/MesQamftp.cs 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MES.Service/Modes/QamftpDto.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MESApplication/Controllers/AttachmentController.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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; }
    }
}
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; }
    }
}
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);
        }
    }
}