20240428 修改资料收发文登记记录导入导出

This commit is contained in:
2024-04-28 17:40:20 +08:00
parent 0aefcb309d
commit fc56b1f6c2
10 changed files with 63 additions and 29 deletions
@@ -330,7 +330,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
protected void btnOut_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/");
string initTemplatePath = Const.DataReceivingDocTempUrl;
string initTemplatePath = Const.CQMS_DataReceivingDocTempUrl;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
uploadfilepath = rootPath + initTemplatePath;
@@ -346,10 +346,11 @@ namespace FineUIPro.Web.CQMS.Comprehensive
{
lists = lists.Where(x => x.FileName.Contains(this.stxtFileName.Text.Trim()));
}
lists = lists.OrderBy(x => x.FileCode);
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;
@@ -384,7 +385,7 @@ namespace FineUIPro.Web.CQMS.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 = 3;
foreach (var item in lists)
{
// 第二步:创建新数据行
@@ -511,6 +512,10 @@ namespace FineUIPro.Web.CQMS.Comprehensive
}
cell.SetCellValue(isO);//是否存档
cell = row.CreateCell(19);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.RemarkCode);//标志编号
i++;
}
// 第三步:写入文件流