20250919 排产计划导出数字格式

This commit is contained in:
2025-09-19 14:47:27 +08:00
parent 490a942589
commit f24e6a366e
@@ -622,9 +622,21 @@ namespace FineUIPro.Web.HJGL.PreDesign
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center; cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center; cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
cellStyle.WrapText = true;//自动换行 cellStyle.WrapText = true;//自动换行
NPOI.SS.UserModel.ICellStyle style11 = workbook.CreateCellStyle();
style11.DataFormat = NPOI.HSSF.UserModel.HSSFDataFormat.GetBuiltinFormat("0.00");//数字格式
style11.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
style11.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
style11.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
style11.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
style11.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Right;
style11.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
style11.WrapText = true;//自动换行
var font = workbook.CreateFont(); var font = workbook.CreateFont();
font.FontHeightInPoints = 11; font.FontHeightInPoints = 11;
cellStyle.SetFont(font); cellStyle.SetFont(font);
// 第二步:创建新数据行 // 第二步:创建新数据行
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0); NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
NPOI.SS.UserModel.IRow row = sheet.GetRow(0); NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
@@ -652,20 +664,23 @@ namespace FineUIPro.Web.HJGL.PreDesign
cell.SetCellValue(item.Caliber);//口径 cell.SetCellValue(item.Caliber);//口径
cell = row.CreateCell(4); cell = row.CreateCell(4);
cell.CellStyle = cellStyle; //cell.CellStyle = cellStyle;
cell.SetCellValue(item.Dain.HasValue ? item.Dain.ToString() : "");//达因数 cell.SetCellValue(item.Dain.HasValue ? Convert.ToDouble(item.Dain) : 0);//达因数
cell.CellStyle = style11;
cell = row.CreateCell(5); cell = row.CreateCell(5);
cell.CellStyle = cellStyle; //cell.CellStyle = cellStyle;
cell.SetCellValue(item.TotalDyne.HasValue ? item.TotalDyne.ToString() : "");//总达因数 cell.SetCellValue(item.TotalDyne.HasValue ? Convert.ToDouble(item.TotalDyne) : 0);//总达因数
cell.CellStyle = style11;
cell = row.CreateCell(6); cell = row.CreateCell(6);
cell.CellStyle = cellStyle; cell.CellStyle = cellStyle;
cell.SetCellValue(item.TotalPriority);//总优先级 cell.SetCellValue(item.TotalPriority);//总优先级
cell = row.CreateCell(7); cell = row.CreateCell(7);
cell.CellStyle = cellStyle; //cell.CellStyle = cellStyle;
cell.SetCellValue(item.PriorityTotalDyne.HasValue ? item.PriorityTotalDyne.ToString() : "");//优先级总达因 cell.SetCellValue(item.PriorityTotalDyne.HasValue ? Convert.ToDouble(item.PriorityTotalDyne) : 0);//优先级总达因
cell.CellStyle = style11;
cell = row.CreateCell(8); cell = row.CreateCell(8);
cell.CellStyle = cellStyle; cell.CellStyle = cellStyle;
@@ -680,20 +695,24 @@ namespace FineUIPro.Web.HJGL.PreDesign
cell.SetCellValue(item.Days.HasValue ? item.Days.ToString() : "");//天数 cell.SetCellValue(item.Days.HasValue ? item.Days.ToString() : "");//天数
cell = row.CreateCell(11); cell = row.CreateCell(11);
cell.CellStyle = cellStyle; //cell.CellStyle = cellStyle;
cell.SetCellValue(item.AvgDailyWorkload.HasValue ? item.AvgDailyWorkload.ToString() : "");//平均每天工作量 cell.SetCellValue(item.AvgDailyWorkload.HasValue ? Convert.ToDouble(item.AvgDailyWorkload.ToString()) : 0);//平均每天工作量
cell.CellStyle = style11;
cell = row.CreateCell(12); cell = row.CreateCell(12);
cell.CellStyle = cellStyle; //cell.CellStyle = cellStyle;
cell.SetCellValue(item.OnDayCompleteDyne.HasValue ? item.OnDayCompleteDyne.ToString() : "");//当日已完成量 cell.SetCellValue(item.OnDayCompleteDyne.HasValue ? Convert.ToDouble(item.OnDayCompleteDyne.ToString()) : 0);//当日已完成量
cell.CellStyle = style11;
cell = row.CreateCell(13); cell = row.CreateCell(13);
cell.CellStyle = cellStyle; //cell.CellStyle = cellStyle;
cell.SetCellValue(item.NextDayCompleteDyne.HasValue ? item.NextDayCompleteDyne.ToString() : "");//次日应完成量 cell.SetCellValue(item.NextDayCompleteDyne.HasValue ? Convert.ToDouble(item.NextDayCompleteDyne.ToString()) : 0);//次日应完成量
cell.CellStyle = style11;
cell = row.CreateCell(14); cell = row.CreateCell(14);
cell.CellStyle = cellStyle; //cell.CellStyle = cellStyle;
cell.SetCellValue(item.CompletedCount.HasValue ? item.CompletedCount.ToString() : "");//累计已完成量 cell.SetCellValue(item.CompletedCount.HasValue ? Convert.ToDouble(item.CompletedCount.ToString()) : 0);//累计已完成量
cell.CellStyle = style11;
cell = row.CreateCell(15); cell = row.CreateCell(15);
cell.CellStyle = cellStyle; cell.CellStyle = cellStyle;