20240429 修改综合管理导入导出
This commit is contained in:
@@ -372,7 +372,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.InspectionPersonTempUrl;
|
||||
string initTemplatePath = Const.InspectionPersonDataInUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
@@ -392,10 +392,11 @@ namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
lists = lists.Where(x => x.PersonName.Contains(this.stxtPersonName.Text.Trim()));
|
||||
}
|
||||
lists = lists.OrderBy(x => x.UnitId);
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
newUrl = uploadfilepath.Replace("人员报验模板.xls", "人员报验.xls");
|
||||
string projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("人员报验导入模板", "人员报验(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
NPOI.SS.UserModel.IWorkbook workbook;
|
||||
@@ -430,7 +431,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
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)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
@@ -446,6 +447,10 @@ namespace FineUIPro.Web.Comprehensive
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PersonName);//姓名
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
@@ -454,7 +459,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitWork = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitWorkId))
|
||||
@@ -463,23 +468,19 @@ namespace FineUIPro.Web.Comprehensive
|
||||
}
|
||||
cell.SetCellValue(unitWork);//单位工程名称
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
string postName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.PostId))
|
||||
{
|
||||
var post = BLL.PostService.GetPostById(item.PostId);
|
||||
if (post!=null)
|
||||
if (post != null)
|
||||
{
|
||||
postName = post.PostName;
|
||||
}
|
||||
}
|
||||
cell.SetCellValue(postName);//工种
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PersonName);//姓名
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.CertificateNumber);//证书编号
|
||||
@@ -498,8 +499,42 @@ namespace FineUIPro.Web.Comprehensive
|
||||
|
||||
cell = row.CreateCell(10);
|
||||
cell.CellStyle = cellStyle;
|
||||
string isO = string.Empty;
|
||||
if (item.IsOnSite == true)//是否在场
|
||||
{
|
||||
isO = "是";
|
||||
}
|
||||
else
|
||||
{
|
||||
isO = "否";
|
||||
}
|
||||
cell.SetCellValue(isO);
|
||||
|
||||
cell = row.CreateCell(11);
|
||||
cell.CellStyle = cellStyle;
|
||||
string isT = string.Empty;
|
||||
if (item.IsTrain == true)//是否培训
|
||||
{
|
||||
isT = "是";
|
||||
}
|
||||
else
|
||||
{
|
||||
isT = "否";
|
||||
}
|
||||
cell.SetCellValue(isT);
|
||||
|
||||
cell = row.CreateCell(12);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DepartureTime.HasValue ? string.Format("{0:yyyy-MM-dd}", item.DepartureTime) : "");//离场时间
|
||||
|
||||
cell = row.CreateCell(13);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Remark);//备注
|
||||
|
||||
cell = row.CreateCell(14);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarkCode.HasValue ? item.RemarkCode.ToString() : "");//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
|
||||
Reference in New Issue
Block a user