fix:质量检查
This commit is contained in:
@@ -8,6 +8,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NPOI.SS.UserModel;
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Check
|
||||
{
|
||||
@@ -693,6 +694,7 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
}
|
||||
if (lists != null)
|
||||
{
|
||||
lists = lists.OrderByDescending(x => x.CheckDate);
|
||||
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("质量巡检模板", "质量巡检(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
if (File.Exists(newUrl))
|
||||
@@ -729,9 +731,13 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
// cell = row.CreateCell(0);
|
||||
// cell.CellStyle = cellStyle;
|
||||
// cell.SetCellValue(item.DocCode);//质量巡检编号
|
||||
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DocCode);//质量巡检编号
|
||||
cell.SetCellValue(item.CheckDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.CheckDate) : "");//检查日期
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
@@ -785,23 +791,99 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
}
|
||||
cell.SetCellValue(t);//问题类别
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.CheckSite);//部位
|
||||
|
||||
// cell = row.CreateCell(5);
|
||||
// cell.CellStyle = cellStyle;
|
||||
// cell.SetCellValue(item.CheckSite);//整改前照片
|
||||
//整改前照片
|
||||
var attachFile = Funs.DB.AttachFile
|
||||
.Where(p => p.MenuId == BLL.Const.CheckListMenuId && p.ToKeyId == item.CheckControlCode)
|
||||
.FirstOrDefault();
|
||||
if (attachFile != null)
|
||||
{
|
||||
var photoesUrl = attachFile.AttachUrl;
|
||||
if (photoesUrl != null)
|
||||
{
|
||||
string[] arrUrl = photoesUrl.Split(',');
|
||||
sheet.SetColumnWidth(5, 30 * 256);
|
||||
row.Height = (short)(90 * 20 * arrUrl.Length);
|
||||
foreach (string url in arrUrl)
|
||||
{
|
||||
var oneUrl = Server.MapPath("~/") + url;
|
||||
byte[] bytes = System.IO.File.ReadAllBytes(oneUrl);
|
||||
int pictureIdx = workbook.AddPicture(bytes, PictureType.JPEG);
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.CheckDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.CheckDate) : "");//巡检日期
|
||||
// 第三步:创建画部
|
||||
IDrawing patriarch = sheet.CreateDrawingPatriarch();
|
||||
// 第四步:设置锚点
|
||||
int rowline = 1; // y方向
|
||||
// 参数说明:(在起始单元格的X坐标0-1023,Y的坐标0-255,在终止单元格的X坐标0-1023,Y的坐标0-255,起始单元格列数,行数,终止单元格列数,行数)
|
||||
IClientAnchor anchor = patriarch.CreateAnchor(0, 0, 0, 0, 5, i, 6, i + 1);
|
||||
// 第五步:把图片插到相应的位置+1
|
||||
IPicture pict = patriarch.CreatePicture(anchor, pictureIdx);
|
||||
//就取第一张,如果后期想取全部 那把下面这个跳出语句去掉
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//整改后照片
|
||||
var attachFile1 = Funs.DB.AttachFile.Where(p =>
|
||||
p.MenuId == BLL.Const.CheckListMenuId && p.ToKeyId == item.CheckControlCode + "r")
|
||||
.FirstOrDefault();
|
||||
if (attachFile1 != null)
|
||||
{
|
||||
var photoesUrl1 = attachFile1.AttachUrl;
|
||||
if (photoesUrl1 != null)
|
||||
{
|
||||
string[] arrUrl = photoesUrl1.Split(',');
|
||||
sheet.SetColumnWidth(6, 30 * 256);
|
||||
row.Height = (short)(90 * 20 * arrUrl.Length);
|
||||
foreach (string url in arrUrl)
|
||||
{
|
||||
var oneUrl = Server.MapPath("~/") + url;
|
||||
byte[] bytes = System.IO.File.ReadAllBytes(oneUrl);
|
||||
int pictureIdx = workbook.AddPicture(bytes, PictureType.JPEG);
|
||||
|
||||
// 第三步:创建画部
|
||||
IDrawing patriarch = sheet.CreateDrawingPatriarch();
|
||||
// 第四步:设置锚点
|
||||
int rowline = 1; // y方向
|
||||
// 参数说明:(在起始单元格的X坐标0-1023,Y的坐标0-255,在终止单元格的X坐标0-1023,Y的坐标0-255,起始单元格列数,行数,终止单元格列数,行数)
|
||||
IClientAnchor anchor = patriarch.CreateAnchor(0, 0, 0, 0, 6, i, 7, i + 1);
|
||||
// 第五步:把图片插到相应的位置+1
|
||||
IPicture pict = patriarch.CreatePicture(anchor, pictureIdx);
|
||||
//就取第一张,如果后期想取全部 那把下面这个跳出语句去掉
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cell = row.CreateCell(6);
|
||||
// cell.CellStyle = cellStyle;
|
||||
// cell.SetCellValue(item.CheckSite);//整改后照片
|
||||
|
||||
// cell = row.CreateCell(5);
|
||||
// cell.CellStyle = cellStyle;
|
||||
// cell.SetCellValue(item.CheckSite);//部位
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.QuestionDef);//问题描述
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RectifyOpinion);//整改意见
|
||||
|
||||
cell = row.CreateCell(9);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.LimitDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.LimitDate) : "");//整改日期
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell = row.CreateCell(10);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(BLL.UserService.GetUserNameByUserId(item.CheckMan));//检查人
|
||||
|
||||
cell = row.CreateCell(9);
|
||||
cell = row.CreateCell(11);
|
||||
cell.CellStyle = cellStyle;
|
||||
string s = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.State))
|
||||
@@ -810,7 +892,7 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
}
|
||||
cell.SetCellValue(s);//审批状态
|
||||
|
||||
cell = row.CreateCell(10);
|
||||
cell = row.CreateCell(12);
|
||||
cell.CellStyle = cellStyle;
|
||||
string man = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.CheckControlCode))
|
||||
@@ -819,7 +901,7 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
}
|
||||
cell.SetCellValue(man);//办理人
|
||||
|
||||
cell = row.CreateCell(11);
|
||||
cell = row.CreateCell(13);
|
||||
cell.CellStyle = cellStyle;
|
||||
string status = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.CheckControlCode))
|
||||
|
||||
Reference in New Issue
Block a user