| | |
| | | var rkjDto = new RKJDto(); |
| | | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | var qsItemOqcItem = |
| | | db.Queryable<QsItemOqcItem>().Single(s => s.Id == id); |
| | | |
| | | // 使用JOIN查询获取子表数据和主表的ItemNo字段 |
| | | var qsItemOqcItem = db |
| | | .Queryable<QsItemOqcItem, QsItemOqcReq>((a, b) => new JoinQueryInfos(JoinType.Left, a.Pid == b.Id)) |
| | | .Where((a, b) => a.Id == id) |
| | | .Select((a, b) => new QsItemOqcItem |
| | | { |
| | | Id = a.Id, |
| | | Pid = a.Pid, |
| | | ProjName = a.ProjName, |
| | | ItemMod = a.ItemMod, |
| | | InspectionMethod = a.InspectionMethod, |
| | | UsingInstruments = a.UsingInstruments, |
| | | LevelNum = a.LevelNum, |
| | | MaxValue = a.MaxValue, |
| | | StandardValue = a.StandardValue, |
| | | MinValue = a.MinValue, |
| | | Notes = a.Notes, |
| | | FcheckLevel = a.FcheckLevel, |
| | | FacLevel = a.FacLevel, |
| | | QsCode = a.QsCode, |
| | | QsName = a.QsName, |
| | | Picture = a.Picture, |
| | | Picturename = a.Picturename, |
| | | IsPass = a.IsPass, |
| | | Remarks = a.Remarks, |
| | | FreQty = a.FreQty, |
| | | // 添加主表的ItemNo字段 |
| | | ItemNo = b.ItemNo |
| | | }).Single(); |
| | | |
| | | if (qsItemOqcItem.IsPass == 0) |
| | | qsItemOqcItem.Result = "不合格"; |
| | |
| | | qsItemOqcItem.Unqualified = count; |
| | | |
| | | rkjDto.ItemXj01 = qsItemOqcItem; |
| | | |
| | | |
| | | rkjDto.ItemXj02s = db.Queryable<QsItemOqcItemDetail>() |
| | | .Where(s => s.Pid == id) |
| | |
| | | /// 获取附件信息 |
| | | /// </summary> |
| | | /// <param name="ItemNo">物料编码</param> |
| | | /// <param name="projName">项目名称(用于过滤)</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) |
| | | .Where(x => x.Ftype == "入库检"); // 添加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 |
| | | { |
| | |
| | | /// </summary> |
| | | /// <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 projName = null) |
| | | { |
| | | // 参数验证 |
| | | if (string.IsNullOrEmpty(itemNo) || string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(ftpServer)) |
| | | if (string.IsNullOrEmpty(itemNo) || string.IsNullOrEmpty(fileName)) |
| | | { |
| | | throw new ArgumentException("参数不能为空: itemNo, fileName, ftpServer"); |
| | | throw new ArgumentException("参数不能为空: itemNo, fileName"); |
| | | } |
| | | |
| | | string ftpUser = "hm_ftp"; |
| | | string ftpPwd = "dell_123"; |
| | | string ftpServer = "ftp://192.168.1.100"; // 默认FTP服务器地址 |
| | | |
| | | // 标准化FTP服务器地址 |
| | | string normalizedServer = NormalizeFtpServer(ftpServer); |
| | | |
| | | // 构建FTP文件路径 - RKJ使用FQC文件夹 |
| | | string ftpPath = $"{normalizedServer}/FQC/{itemNo}/{fileName}"; |
| | | // 构建FTP文件路径 - RKJ使用FQC文件夹,如果有projName则使用projName作为路径的最后一段 |
| | | string ftpPath; |
| | | if (!string.IsNullOrEmpty(projName)) |
| | | { |
| | | ftpPath = $"{normalizedServer}/FQC/{itemNo}/{projName}/{fileName}"; |
| | | } |
| | | else |
| | | { |
| | | ftpPath = $"{normalizedServer}/FQC/{itemNo}/{fileName}"; |
| | | } |
| | | |
| | | try |
| | | { |