20240429 修改综合管理导入导出

This commit is contained in:
2024-04-29 19:13:54 +08:00
parent fc56b1f6c2
commit a3e123957d
48 changed files with 560 additions and 266 deletions
@@ -305,7 +305,7 @@ namespace FineUIPro.Web.Comprehensive
protected void btnOut_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/");
string initTemplatePath = Const.InspectionMachineTempUrl;
string initTemplatePath = Const.InspectionMachineDataInUrl;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
uploadfilepath = rootPath + initTemplatePath;
@@ -325,10 +325,11 @@ namespace FineUIPro.Web.Comprehensive
{
lists = lists.Where(x => x.InspectionType == this.sdrpType.SelectedValue);
}
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;
@@ -363,7 +364,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)
{
// 第二步:创建新数据行
@@ -449,8 +450,28 @@ namespace FineUIPro.Web.Comprehensive
cell = row.CreateCell(12);
cell.CellStyle = cellStyle;
string isK = string.Empty;
if (item.IsCheckOK.HasValue)//校验合格
{
if (item.IsCheckOK == true)
{
isK = "是";
}
else if (item.IsCheckOK == false)
{
isK = "否";
}
}
cell.SetCellValue(isK);
cell = row.CreateCell(13);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.LeaveDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.LeaveDate) : "");//离场时间
cell = row.CreateCell(14);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.RemarkCode.HasValue ? item.RemarkCode.ToString() : "");//标志编号
i++;
}
// 第三步:写入文件流