| | |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 供应商搜索 |
| | | a => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 到货单号搜索 |
| | | a => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | a => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 检验单号搜索 |
| | | a => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 物料规格搜索 |
| | |
| | | ItemName = a.ItemName, |
| | | ItemModel = a.ItemModel, |
| | | SuppName = a.SuppName, |
| | | PaperBillNo = a.PaperBillNo, |
| | | LotNo = a.LotNo, |
| | | ReleaseNo = a.ReleaseNo, |
| | | FcheckResu = a.FcheckResu, |
| | | CreateDate = a.CreateDate, |
| | | FcovertQty = a.FcovertQty, |
| | | DEPARTMENTNAME = a.DEPARTMENTNAME, |
| | | FcheckBy = a.FcheckBy, |
| | | Modify1By = a.Modify1By, |
| | | FngDesc = a.FngDesc, |
| | | UrgentFlag = a.UrgentFlag, |
| | | Ftype = a.Ftype, |
| | |
| | | // 添加评审状态 |
| | | PSZT = a.PSZT, |
| | | // 添加检验项目维护状态 |
| | | Jyxm = a.Jyxm |
| | | Jyxm = a.Jyxm, |
| | | // 添加版本号(用于FTP路径) |
| | | Fversion = a.Fversion |
| | | }) |
| | | .OrderBy("IQC_DATE DESC") |
| | | .OrderBy("CASE WHEN EMERGENCY = 1 THEN 0 ELSE 1 END") |
| | |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 供应商搜索 |
| | | (a, v) => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 到货单号搜索 |
| | | (a, v) => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | (a, v) => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 检验单号搜索 |
| | | (a, v) => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 物料规格搜索 |
| | |
| | | ItemName = a.ItemName, |
| | | ItemModel = a.ItemModel, |
| | | SuppName = a.SuppName, |
| | | PaperBillNo = a.PaperBillNo, |
| | | LotNo = a.LotNo, |
| | | ReleaseNo = a.ReleaseNo, |
| | | FcheckResu = a.FcheckResu, |
| | |
| | | UrgentFlag = a.UrgentFlag, |
| | | Ftype = a.Ftype, |
| | | LotNo1 = a.LotNo1, |
| | | FcheckBy = a.FcheckBy, |
| | | Modify1By = a.Modify1By, |
| | | EMERGENCY = a.EMERGENCY, |
| | | Status = a.Status, |
| | | IqcDate = a.IqcDate, |
| | |
| | | // 添加评审状态 |
| | | PSZT = a.PSZT, |
| | | // 添加检验项目维护状态 |
| | | Jyxm = a.Jyxm |
| | | Jyxm = a.Jyxm, |
| | | // 添加版本号(用于FTP路径) |
| | | Fversion = a.Fversion |
| | | }) |
| | | .OrderBy("IQC_DATE DESC") |
| | | .OrderBy("CASE WHEN EMERGENCY = 1 THEN 0 ELSE 1 END") |
| | |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 供应商搜索 |
| | | a => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 到货单号搜索 |
| | | a => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | a => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 检验单号搜索 |
| | | a => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 物料规格搜索 |
| | |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 供应商搜索 |
| | | (a, v) => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 到货单号搜索 |
| | | (a, v) => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | (a, v) => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 检验单号搜索 |
| | | (a, v) => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower())) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 物料规格搜索 |
| | |
| | | return input.Substring(startIndex + 1, length); |
| | | } |
| | | |
| | | public List<QamftpDto> GetAttachments(string ItemNo) |
| | | /// <summary> |
| | | /// 获取附件信息 |
| | | /// </summary> |
| | | /// <param name="ItemNo">物料编码</param> |
| | | /// <param name="fversion">版本号(可选,用于过滤)</param> |
| | | /// <returns>附件列表</returns> |
| | | public List<QamftpDto> GetAttachments(string ItemNo, string fversion = null) |
| | | { |
| | | //if (string.IsNullOrEmpty(ItemNo)) |
| | | //{ |
| | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | try |
| | | { |
| | | return db.Queryable<MesQamftp>() |
| | | var query = db.Queryable<MesQamftp>() |
| | | .Where(x => x.ItemNo == ItemNo) |
| | | .Where(x => x.Ftype == "来料检"); // 添加FTYPE = '来料检'的限制 |
| | | |
| | | // 如果传入了fversion,则按Fversion过滤 |
| | | if (!string.IsNullOrEmpty(fversion)) |
| | | { |
| | | query = query.Where(x => x.Fversion == fversion); |
| | | } |
| | | |
| | | return query |
| | | .OrderBy(x => x.Fdate, OrderByType.Desc) |
| | | // .ThenBy(x => x.CreateDate, OrderByType.Desc) |
| | | .Select(x => new QamftpDto |
| | |
| | | } |
| | | } |
| | | |
| | | public byte[] GetFtpFile(string itemNo, string fileName, string ftpServer) |
| | | public byte[] GetFtpFile(string itemNo, string fileName, string ftpServer, string fversion = null) |
| | | { |
| | | // 参数验证 |
| | | if (string.IsNullOrEmpty(itemNo) || string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(ftpServer)) |
| | |
| | | // 标准化FTP服务器地址 |
| | | string normalizedServer = NormalizeFtpServer(ftpServer); |
| | | |
| | | // 构建FTP文件路径 |
| | | string ftpPath = $"{normalizedServer}/IQC/{itemNo}/{fileName}"; |
| | | // 构建FTP文件路径 - 来料检使用IQC目录,使用fversion作为子目录 |
| | | string ftpPath; |
| | | if (!string.IsNullOrEmpty(fversion)) |
| | | { |
| | | ftpPath = $"{normalizedServer}/IQC/{itemNo}/{fversion}/{fileName}"; |
| | | } |
| | | else |
| | | { |
| | | ftpPath = $"{normalizedServer}/IQC/{itemNo}/{fileName}"; |
| | | } |
| | | |
| | | try |
| | | { |