| | |
| | | /// </summary> |
| | | /// <param name="itemNo">物料编码</param> |
| | | /// <returns>附件列表</returns> |
| | | public List<QamftpDto> GetAttachments(string itemNo) |
| | | public List<QamftpDto> GetAttachments(string itemNo, string projName = null) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | try |
| | | { |
| | | return db.Queryable<MesQamftp>() |
| | | var query = db.Queryable<MesQamftp>() |
| | | .Where(x => x.ItemNo == itemNo) |
| | | .OrderBy(x => x.Fdate, OrderByType.Desc) |
| | | .Where(x => x.Ftype == "首检"); |
| | | |
| | | // 如果传入了projName,则按Fversion过滤 |
| | | if (!string.IsNullOrEmpty(projName)) |
| | | { |
| | | query = query.Where(x => x.Fversion == projName); |
| | | } |
| | | |
| | | return query.OrderBy(x => x.Fdate, OrderByType.Desc) |
| | | .Select(x => new QamftpDto |
| | | { |
| | | Id = x.Id, |
| | |
| | | F_type = x.F_type, |
| | | LastupdateBy = x.LastupdateBy, |
| | | LastupdateDate = x.LastupdateDate, |
| | | ItemId = x.ItemId |
| | | ItemId = x.ItemId, |
| | | Pid = x.Pid |
| | | }).ToList(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | /// <param name="itemNo">物料编码</param> |
| | | /// <param name="fileName">文件名</param> |
| | | /// <param name="ftpServer">FTP服务器地址</param> |
| | | /// <param name="projName">项目名称</param> |
| | | /// <returns>文件字节数组</returns> |
| | | public byte[] GetFtpFile(string itemNo, string fileName, string ftpServer) |
| | | public byte[] GetFtpFile(string itemNo, string fileName, string ftpServer, string projName = null) |
| | | { |
| | | // 参数验证 |
| | | if (string.IsNullOrEmpty(itemNo) || string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(ftpServer)) |
| | |
| | | // 标准化FTP服务器地址 |
| | | string normalizedServer = NormalizeFtpServer(ftpServer); |
| | | |
| | | // 构建FTP文件路径 - 首检使用OPC目录 |
| | | string ftpPath = $"{normalizedServer}/OPC/{itemNo}/{fileName}"; |
| | | // 构建FTP文件路径 - 首检使用OPC目录,如果传入了projName则使用新格式 |
| | | string ftpPath; |
| | | if (!string.IsNullOrEmpty(projName)) |
| | | { |
| | | ftpPath = $"{normalizedServer}/OPC/{itemNo}/{projName}/{fileName}"; |
| | | } |
| | | else |
| | | { |
| | | ftpPath = $"{normalizedServer}/OPC/{itemNo}/{fileName}"; |
| | | } |
| | | |
| | | try |
| | | { |