20240505 质量导出

This commit is contained in:
2024-05-05 17:08:38 +08:00
parent ae9728039b
commit 3243a2ee9e
30 changed files with 1933 additions and 592 deletions
@@ -415,10 +415,31 @@ namespace FineUIPro.Web.CQMS.Check
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
uploadfilepath = rootPath + initTemplatePath;
var lists = BLL.JointCheckService.GetDriverPlanByProjectId(this.CurrUser.LoginProjectId);
var lists = from x in Funs.DB.Check_JointCheck where x.ProjectId == this.CurrUser.LoginProjectId select x;
if (!string.IsNullOrEmpty(txtStartTime.Text.Trim()))
{
lists = lists.Where(x => x.CheckDate >= Funs.GetNewDateTime(txtStartTime.Text.Trim() + " 00:00:00"));
}
if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
{
lists = lists.Where(x => x.CheckDate <= Funs.GetNewDateTime(txtEndTime.Text.Trim() + " 23:59:59"));
}
if (drpSponsorUnit.SelectedValue != BLL.Const._Null)
{
lists = lists.Where(x => x.UnitId == drpSponsorUnit.SelectedValue);
}
if (drpCheckType.SelectedValue != BLL.Const._Null)
{
lists = lists.Where(x => x.CheckType == drpCheckType.SelectedValue);
}
if (drpState.SelectedValue != BLL.Const._Null)
{
lists = lists.Where(x => x.State == drpState.SelectedValue);
}
if (lists != null)
{
newUrl = uploadfilepath.Replace("质量专项检查模版.xls", "质量专项检查.xls");
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
newUrl = uploadfilepath.Replace("质量专项检查模板", "质量专项检查(" + projectName + DateTime.Now.ToString("yyyyMMdd") + "");
File.Copy(uploadfilepath, newUrl);
// 第一步:读取文件流
NPOI.SS.UserModel.IWorkbook workbook;
@@ -453,7 +474,7 @@ namespace FineUIPro.Web.CQMS.Check
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
NPOI.SS.UserModel.ICell cell;
int i = 1;
int i = 2;
foreach (var item in lists)
{
// 第二步:创建新数据行
@@ -461,14 +482,11 @@ namespace FineUIPro.Web.CQMS.Check
// 添加数据
cell = row.CreateCell(0);
cell.CellStyle = cellStyle;
cell.SetCellValue(i.ToString());//序号
cell.SetCellValue(item.JointCheckCode);
cell = row.CreateCell(1);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.JointCheckCode);
cell = row.CreateCell(2);
cell.CellStyle = cellStyle;
cell.SetCellValue(BLL.UnitService.GetUnitNameByUnitId(item.UnitId));
cell = row.CreateCell(3);
cell = row.CreateCell(2);
cell.CellStyle = cellStyle;
string checkName = string.Empty;
if (item.CheckType == "1")
@@ -488,16 +506,16 @@ namespace FineUIPro.Web.CQMS.Check
checkName = "专业检查";
}
cell.SetCellValue(checkName);
cell = row.CreateCell(4);
cell = row.CreateCell(3);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.CheckName);
cell = row.CreateCell(5);
cell = row.CreateCell(4);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.CheckDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.CheckDate) : "");
cell = row.CreateCell(6);
cell = row.CreateCell(5);
cell.CellStyle = cellStyle;
cell.SetCellValue(BLL.UserService.GetUserNameByUserId(item.CheckMan));
cell = row.CreateCell(7);
cell = row.CreateCell(6);
cell.CellStyle = cellStyle;
string state = string.Empty;
if (item.State.ToString() == BLL.Const.JointCheck_ReCompile)
@@ -537,7 +555,7 @@ namespace FineUIPro.Web.CQMS.Check
state = "分包专工重新回复";
}
cell.SetCellValue(state);
cell = row.CreateCell(8);
cell = row.CreateCell(7);
cell.CellStyle = cellStyle;
string userNames = string.Empty;
List<Model.Check_JointCheckApprove> list = BLL.JointCheckApproveService.GetJointCheckApprovesByJointCheckId(item.JointCheckId);