From f0c21ec9c1e9c7cd5db58caeb760c7d7ca6df002 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期二, 16 十二月 2025 08:47:56 +0800
Subject: [PATCH] 公文管理中,“主题词”和“抄送”的字体改为粗宋 完成
---
CY_ECommercePlatform/CY.WebForm/Pages/business/DeliverPlanDakaList.aspx.cs | 201 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 198 insertions(+), 3 deletions(-)
diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/business/DeliverPlanDakaList.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/business/DeliverPlanDakaList.aspx.cs
index 2789512..575a35e 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/business/DeliverPlanDakaList.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/business/DeliverPlanDakaList.aspx.cs
@@ -18,6 +18,9 @@
using CY.SQLDAL;
using System.Data.SqlClient;
using CY.Infrastructure.Logging;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
+using System.IO;
namespace CY.WebForm.Pages.business
{
@@ -115,7 +118,7 @@
this.txtCreatTimeend.Value,
this.selCarId.Value,
this.txtCreater.Value,
- this.selClockType.Value
+ ""
);
Database DC = new Database();
@@ -125,6 +128,104 @@
List<OA_CorporateClientsContract> fileDataList = null;
foreach (var oA_DriverRecord in oA_DriverRecords)
{
+
+
+ var oA_DriverRecord1 = _oA_DriverRecordBLL.GetModelByTimeCarIDClockType(oA_DriverRecord.CreatTime, oA_DriverRecord.CarID, 2);
+ if (oA_DriverRecord1 != null)
+ {
+ oA_DriverRecord1.CreatTimeName = oA_DriverRecord1.CreatTime.ToString("yyyy-MM-dd HH:mm:ss");
+ if (string.IsNullOrEmpty(oA_DriverRecord1.MileageImg))
+ {
+ oA_DriverRecord1.MileageImgName = "";
+ }
+ else
+ {
+ oA_DriverRecord1.MileageImgName = "<img src=\"" + oA_DriverRecord1.MileageImg + "\" width=\"20\" height=\"20\" >";
+ }
+
+
+
+
+
+ string sqlStr1 = string.Format(@" select * from [dbo].[OA_attachment] where [OA_Id]='{0}' and [AttachmentType]=4 order by [CreateTime] ", oA_DriverRecord1.Id);
+
+ SqlCommand myCmd1 = new SqlCommand(sqlStr1, DC.Connection);
+ //SqlDataAdapter myDa = new SqlDataAdapter(myCmd);
+ var a1 = myCmd1.ExecuteReader();
+ //myDa.Dispose();
+ fileDataList = new List<OA_CorporateClientsContract>();
+ OA_CorporateClientsContract Contract1;
+ var j = 1;
+ while (a1.Read())
+ { //娉ㄦ剰濡備綍灏嗘瘡娆¤鍙栧埌鐨勮褰曟坊鍔犲埌listbox1涓紙鍥犱负绗竴娆″仛鏃跺嚭閿欎簡锛屽樋鍢匡級
+ Contract1 = new OA_CorporateClientsContract();
+ // Contract.Keyid = a.GetInt32(0);
+ //Contract.CorporateClientsid = a.GetGuid(1);
+ //Contract.CorporateClientsName = a.GetString(4);
+ Contract1.FileName = a1[4].ToString();
+ Contract1.PageCode = j;
+ Contract1.FilePath = a1.GetString(2);
+ // Contract.Remark = a.GetString(6);
+ j += 1;
+
+ fileDataList.Add(Contract1);
+ }
+ a1.Close(); //鍏抽棴sqldatareader
+
+ if (fileDataList.Count > 0)
+ {
+ oA_DriverRecord1.ZhuangcheImg = "<img src=\"" + fileDataList[0].FilePath + "\" width=\"20\" height=\"20\" >";
+ }
+ else
+ {
+ oA_DriverRecord1.ZhuangcheImg = "";
+ }
+
+
+
+
+ sqlStr1 = string.Format(@" select * from [dbo].[OA_attachment] where [OA_Id]='{0}' and [AttachmentType]=5 order by [CreateTime] ", oA_DriverRecord1.Id);
+
+ myCmd1 = new SqlCommand(sqlStr1, DC.Connection);
+ //SqlDataAdapter myDa = new SqlDataAdapter(myCmd);
+ a1 = myCmd1.ExecuteReader();
+ //myDa.Dispose();
+ fileDataList = new List<OA_CorporateClientsContract>();
+ j = 1;
+ while (a1.Read())
+ { //娉ㄦ剰濡備綍灏嗘瘡娆¤鍙栧埌鐨勮褰曟坊鍔犲埌listbox1涓紙鍥犱负绗竴娆″仛鏃跺嚭閿欎簡锛屽樋鍢匡級
+ Contract1 = new OA_CorporateClientsContract();
+ // Contract.Keyid = a.GetInt32(0);
+ //Contract.CorporateClientsid = a.GetGuid(1);
+ //Contract.CorporateClientsName = a.GetString(4);
+ Contract1.FileName = a1[4].ToString();
+ Contract1.PageCode = j;
+ Contract1.FilePath = a1.GetString(2);
+ // Contract.Remark = a.GetString(6);
+ j += 1;
+
+ fileDataList.Add(Contract1);
+ }
+ a1.Close(); //鍏抽棴sqldatareader
+
+ if (fileDataList.Count > 0)
+ {
+ oA_DriverRecord1.CarConditionImg = "<img src=\"" + fileDataList[0].FilePath + "\" width=\"20\" height=\"20\" >";
+ }
+ else
+ {
+ oA_DriverRecord1.CarConditionImg = "";
+ }
+
+ oA_DriverRecord.oA_DriverRecord = oA_DriverRecord1;
+ }
+ else
+ {
+ oA_DriverRecord.oA_DriverRecord = new OA_DriverRecord();
+ }
+
+
+
if (string.IsNullOrEmpty(oA_DriverRecord.MileageImg))
{
oA_DriverRecord.MileageImgName = "";
@@ -228,9 +329,103 @@
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
}
-
-
+
+ //鏌ヨ浜嬩欢
+ protected void btn_Daochu_Click(object src, EventArgs e)
+ {
+
+ byte[] fileBytes = ExportToExcel();
+ if (fileBytes != null)
+ {
+ Response.Clear();
+ Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+ Response.AppendHeader("Content-Disposition", "attachment; filename=鎵撳崱瀵煎嚭.xlsx");
+ Response.BinaryWrite(fileBytes);
+ Response.End();
+ }
+ else
+ {
+ // 澶勭悊瀵煎嚭澶辫触鐨勬儏鍐�
+ Response.Write("瀵煎嚭澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+ }
+
+ }
+
+
+ public byte[] ExportToExcel()
+ {
+ byte[] bt = null;
+ try
+ {
+ Pagination pa = new Pagination();
+ pa.PageSize = 1000;
+ pa.PageIndex = 1;
+
+
+
+ IEnumerable<OA_DriverRecord> results = _oA_DriverRecordBLL.SelectModelPage(pa,
+ this.txtCreatTimestart.Value,
+ this.txtCreatTimeend.Value,
+ this.selCarId.Value,
+ this.txtCreater.Value,
+ ""
+ );
+
+ // 鍒涘缓宸ヤ綔绨�
+ IWorkbook workbook = new XSSFWorkbook();
+ ISheet sheet = workbook.CreateSheet("瀵煎嚭鏁版嵁");
+
+ // 鍒涘缓琛ㄥご
+ IRow headerRow = sheet.CreateRow(0);
+ headerRow.CreateCell(0).SetCellValue("缂栧彿");
+ headerRow.CreateCell(1).SetCellValue("杞﹁締");
+ headerRow.CreateCell(2).SetCellValue("椹鹃┒鍛�");
+ headerRow.CreateCell(3).SetCellValue("鎵撳崱鏃堕棿");
+ headerRow.CreateCell(4).SetCellValue("鎵撳崱绫诲瀷");
+ headerRow.CreateCell(5).SetCellValue("鏈璐ф儏鍐�");
+ headerRow.CreateCell(6).SetCellValue("杞﹀喌");
+ headerRow.CreateCell(7).SetCellValue("澶囨敞");
+ headerRow.CreateCell(8).SetCellValue("閲岀▼(鍏噷)");
+
+
+
+ // 娣诲姞鏁版嵁
+ int rowIndex = 1;
+ foreach (var oA_DriverRecord in results)
+ {
+ IRow row = sheet.CreateRow(rowIndex++);
+ row.CreateCell(0).SetCellValue((rowIndex - 1).ToString());
+ row.CreateCell(1).SetCellValue(oA_DriverRecord.CarName);
+ row.CreateCell(2).SetCellValue(oA_DriverRecord.Creater);
+ row.CreateCell(3).SetCellValue(oA_DriverRecord.CreatTime.ToString("yyyy-MM-dd"));
+ row.CreateCell(4).SetCellValue(oA_DriverRecord.ClockTypeName);
+ row.CreateCell(5).SetCellValue(oA_DriverRecord.EmptyCause);
+ row.CreateCell(6).SetCellValue(oA_DriverRecord.CarCondition);
+ row.CreateCell(7).SetCellValue(oA_DriverRecord.Remark);
+ row.CreateCell(8).SetCellValue(oA_DriverRecord.Mileage.ToString());
+
+
+
+ }
+
+ // 灏嗗伐浣滅翱鍐欏叆鍐呭瓨娴�
+ using (var ms = new MemoryStream())
+ {
+ workbook.Write(ms);
+ bt = ms.ToArray();
+ }
+ }
+ catch (Exception e)
+ {
+ bt = null;
+ // 璁板綍鏃ュ織
+
+ }
+ return bt;
+ }
+
+
}
}
\ No newline at end of file
--
Gitblit v1.9.1