Commit 6d806f1f authored by 張益誠's avatar 張益誠

檔案匯出功能

parent 4b327bc9
...@@ -21,6 +21,7 @@ namespace ETC_App1 ...@@ -21,6 +21,7 @@ namespace ETC_App1
else //錯誤就提示帳密錯誤 else //錯誤就提示帳密錯誤
{ {
MessageBox.Show("帳號或密碼錯誤"); //錯誤提示框 MessageBox.Show("帳號或密碼錯誤"); //錯誤提示框
return false; return false;
} }
} }
......
using System; using NPOI.HSSF.UserModel;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
...@@ -28,6 +29,8 @@ namespace ETC_App1 ...@@ -28,6 +29,8 @@ namespace ETC_App1
public Dictionary<string, string> Processed = new Dictionary<string, string>(); public Dictionary<string, string> Processed = new Dictionary<string, string>();
public string SelectedKey { get; set; } public string SelectedKey { get; set; }
public ETCBackgroundWorker3() public ETCBackgroundWorker3()
{ {
InitializeComponent(); InitializeComponent();
...@@ -318,6 +321,28 @@ namespace ETC_App1 ...@@ -318,6 +321,28 @@ namespace ETC_App1
} }
}
public void SaveExcel()
{
List<Dictionary<string, string>> data = Data[SelectedKey];
HSSFWorkbook workbook2003 = new HSSFWorkbook(); //新建工作簿
workbook2003.CreateSheet("Sheet1"); //新建1個Sheet工作表
HSSFSheet SheetOne = (HSSFSheet)workbook2003.GetSheet("Sheet1"); //獲取名稱為Sheet1的工作表
for (int i = 1; i < 13; i++) //列數
{
SheetOne.CreateRow(i);
for (int j = 0; j < 20; j++) //行數
{
SheetOne.GetRow(i).CreateCell(j).SetCellValue(data[i]["帳單編號"]);
}
}
FileStream file2003 = new FileStream("C:\\Users\\admin\\e-eye\\eee.xls", FileMode.Create);
workbook2003.Write(file2003);
file2003.Close();
workbook2003.Close();
} }
} }
} }
...@@ -8,6 +8,7 @@ using System.Linq; ...@@ -8,6 +8,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using NPOI.HSSF.UserModel;
/// <summary> /// <summary>
/// 功能: 建立顯示處理結果的物件,包含檔案清單、處理過的影像,萃取資訊的小圖與處理程序產生出來的紀錄。 /// 功能: 建立顯示處理結果的物件,包含檔案清單、處理過的影像,萃取資訊的小圖與處理程序產生出來的紀錄。
/// 維護: /// 維護:
...@@ -22,7 +23,7 @@ namespace ETC_App1 ...@@ -22,7 +23,7 @@ namespace ETC_App1
private Image BrokeImage = new Bitmap("data" + Path.DirectorySeparatorChar + "broke.jpg"); private Image BrokeImage = new Bitmap("data" + Path.DirectorySeparatorChar + "broke.jpg");
private List<Json> Data = new List<Json>(); public List<Json> Data = new List<Json>();
public string UsingID { get; set; } public string UsingID { get; set; }
...@@ -318,6 +319,25 @@ namespace ETC_App1 ...@@ -318,6 +319,25 @@ namespace ETC_App1
sw.Close(); sw.Close();
fs.Close(); fs.Close();
}
public void SaveExcel(string save_path)
{
HSSFWorkbook workbook2003 = new HSSFWorkbook(); //新建工作簿
workbook2003.CreateSheet("Sheet1"); //新建1個Sheet工作表
HSSFSheet SheetOne = (HSSFSheet)workbook2003.GetSheet("Sheet1"); //獲取名稱為Sheet1的工作表
for (int i = 1; i < 13; i++) //列數
{
SheetOne.CreateRow(i);
for (int j = 0; j < 20; j++) //行數
{
SheetOne.GetRow(i).CreateCell(j).SetCellValue(1);
}
}
FileStream file2003 = new FileStream("C:\\Users\\admin\\e-eye\\eee.xls", FileMode.Create);
workbook2003.Write(file2003);
file2003.Close();
workbook2003.Close();
} }
} }
} }
using System; using NPOI.HSSF.UserModel;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
...@@ -9,6 +10,9 @@ using System.Text; ...@@ -9,6 +10,9 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace ETC_App1 namespace ETC_App1
{ {
...@@ -272,7 +276,148 @@ namespace ETC_App1 ...@@ -272,7 +276,148 @@ namespace ETC_App1
private void ToolStripButton6_Click(object sender, EventArgs e) private void ToolStripButton6_Click(object sender, EventArgs e)
{ {
BackgroundWorker worker = new BackgroundWorker() { WorkerReportsProgress = true, WorkerSupportsCancellation = true };
worker.RunWorkerAsync(new object[] { etcPictureCheckBox1.Data, etcBackgroundWorker31.Data[etcBackgroundWorker31.SelectedKey] , toolStripTextBox4.Text });
worker.DoWork += Worker_DoWork;
worker.DoWork += Worker_DoWork_fail;
etcPictureCheckBox1.SaveLogs(toolStripTextBox4.Text); etcPictureCheckBox1.SaveLogs(toolStripTextBox4.Text);
}
private void Worker_DoWork(object sender, DoWorkEventArgs e)
{
object[] arg = e.Argument as object[];
List<Json> jsonData = arg[0] as List<Json>;
List<Dictionary<string, string>> execlData = arg[1] as List<Dictionary<string, string>>;
string file_path = arg[2] + "/success.xls";
{
HSSFWorkbook workbook2003 = new HSSFWorkbook(); //新建工作簿
workbook2003.CreateSheet("Sheet1"); //新建1個Sheet工作表
HSSFSheet SheetOne = (HSSFSheet)workbook2003.GetSheet("Sheet1"); //獲取名稱為Sheet1的工作表
SheetOne.CreateRow(0);
int i = 0;
int j = 1;
//for (int i = 0; i < execlData.Count; i++) //列數
foreach (Json json in jsonData)
{
bool success = json.success;
if (success)
if (i < execlData.Count)
{
SheetOne.CreateRow(j);
SheetOne.GetRow(j).CreateCell(0).SetCellValue(execlData[i]["序號"]);
SheetOne.GetRow(j).CreateCell(1).SetCellValue(execlData[i]["申訴單位"]);
SheetOne.GetRow(j).CreateCell(2).SetCellValue(execlData[i]["公警隊別"]);
SheetOne.GetRow(j).CreateCell(3).SetCellValue(execlData[i]["起站國道編號"]);
SheetOne.GetRow(j).CreateCell(4).SetCellValue(execlData[i]["起站收費區"]);
SheetOne.GetRow(j).CreateCell(5).SetCellValue(execlData[i]["起站門架座落地點"]);
SheetOne.GetRow(j).CreateCell(6).SetCellValue(execlData[i]["訖站國道編號"]);
SheetOne.GetRow(j).CreateCell(7).SetCellValue(execlData[i]["訖站收費區"]);
SheetOne.GetRow(j).CreateCell(8).SetCellValue(execlData[i]["訖站門架座落地點"]);
SheetOne.GetRow(j).CreateCell(9).SetCellValue(execlData[i]["訖站時間"]);
SheetOne.GetRow(j).CreateCell(10).SetCellValue(execlData[i]["帳單編號"]);
SheetOne.GetRow(j).CreateCell(11).SetCellValue(execlData[i]["交易日"]);
SheetOne.GetRow(j).CreateCell(12).SetCellValue(execlData[i]["車牌號碼"]);
SheetOne.GetRow(j).CreateCell(13).SetCellValue(execlData[i]["車型"]);
SheetOne.GetRow(j).CreateCell(14).SetCellValue(execlData[i]["車主"]);
SheetOne.GetRow(j).CreateCell(15).SetCellValue(execlData[i]["車主證號"]);
SheetOne.GetRow(j).CreateCell(16).SetCellValue(execlData[i]["改寄人"]);
SheetOne.GetRow(j).CreateCell(17).SetCellValue(execlData[i]["改寄人證號"]);
SheetOne.GetRow(j).CreateCell(18).SetCellValue(execlData[i]["改寄人生日"]);
SheetOne.GetRow(j).CreateCell(19).SetCellValue(execlData[i]["改寄人應到案處所"]);
SheetOne.GetRow(j).CreateCell(20).SetCellValue(execlData[i]["申裝類別"]);
SheetOne.GetRow(j).CreateCell(21).SetCellValue(execlData[i]["通行費淨額"]);
SheetOne.GetRow(j).CreateCell(22).SetCellValue(execlData[i]["欠費原因"]);
SheetOne.GetRow(j).CreateCell(23).SetCellValue(execlData[i]["繳款期限"]);
SheetOne.GetRow(j).CreateCell(24).SetCellValue(execlData[i]["偵測之eTag ID"]);
SheetOne.GetRow(j).CreateCell(25).SetCellValue(execlData[i]["帳單地址"]);
SheetOne.GetRow(j).CreateCell(26).SetCellValue(execlData[i]["帳單地址類別"]);
SheetOne.GetRow(j).CreateCell(27).SetCellValue(execlData[i]["改寄類別"]);
j += 1;
}
i = i + 1;
}
FileStream file2003 = new FileStream(file_path, FileMode.Create);
workbook2003.Write(file2003);
file2003.Close();
workbook2003.Close();
}
}
private void Worker_DoWork_fail(object sender, DoWorkEventArgs e)
{
object[] arg = e.Argument as object[];
List<Json> jsonData = arg[0] as List<Json>;
List<Dictionary<string, string>> execlData = arg[1] as List<Dictionary<string, string>>;
string file_path = arg[2] + "/failed.xls";
HSSFWorkbook workbook2003 = new HSSFWorkbook(); //新建工作簿
workbook2003.CreateSheet("Sheet1"); //新建1個Sheet工作表
HSSFSheet SheetOne = (HSSFSheet)workbook2003.GetSheet("Sheet1"); //獲取名稱為Sheet1的工作表
SheetOne.CreateRow(0);
int i = 0;
int j = 1;
foreach (Json json in jsonData)
{
bool success = json.success;
if (!success)
if (i < execlData.Count)
{
SheetOne.CreateRow(j);
SheetOne.GetRow(j).CreateCell(0).SetCellValue(execlData[i]["序號"]);
SheetOne.GetRow(j).CreateCell(1).SetCellValue(execlData[i]["申訴單位"]);
SheetOne.GetRow(j).CreateCell(2).SetCellValue(execlData[i]["公警隊別"]);
SheetOne.GetRow(j).CreateCell(3).SetCellValue(execlData[i]["起站國道編號"]);
SheetOne.GetRow(j).CreateCell(4).SetCellValue(execlData[i]["起站收費區"]);
SheetOne.GetRow(j).CreateCell(5).SetCellValue(execlData[i]["起站門架座落地點"]);
SheetOne.GetRow(j).CreateCell(6).SetCellValue(execlData[i]["訖站國道編號"]);
SheetOne.GetRow(j).CreateCell(7).SetCellValue(execlData[i]["訖站收費區"]);
SheetOne.GetRow(j).CreateCell(8).SetCellValue(execlData[i]["訖站門架座落地點"]);
SheetOne.GetRow(j).CreateCell(9).SetCellValue(execlData[i]["訖站時間"]);
SheetOne.GetRow(j).CreateCell(10).SetCellValue(execlData[i]["帳單編號"]);
SheetOne.GetRow(j).CreateCell(11).SetCellValue(execlData[i]["交易日"]);
SheetOne.GetRow(j).CreateCell(12).SetCellValue(execlData[i]["車牌號碼"]);
SheetOne.GetRow(j).CreateCell(13).SetCellValue(execlData[i]["車型"]);
SheetOne.GetRow(j).CreateCell(14).SetCellValue(execlData[i]["車主"]);
SheetOne.GetRow(j).CreateCell(15).SetCellValue(execlData[i]["車主證號"]);
SheetOne.GetRow(j).CreateCell(16).SetCellValue(execlData[i]["改寄人"]);
SheetOne.GetRow(j).CreateCell(17).SetCellValue(execlData[i]["改寄人證號"]);
SheetOne.GetRow(j).CreateCell(18).SetCellValue(execlData[i]["改寄人生日"]);
SheetOne.GetRow(j).CreateCell(19).SetCellValue(execlData[i]["改寄人應到案處所"]);
SheetOne.GetRow(j).CreateCell(20).SetCellValue(execlData[i]["申裝類別"]);
SheetOne.GetRow(j).CreateCell(21).SetCellValue(execlData[i]["通行費淨額"]);
SheetOne.GetRow(j).CreateCell(22).SetCellValue(execlData[i]["欠費原因"]);
SheetOne.GetRow(j).CreateCell(23).SetCellValue(execlData[i]["繳款期限"]);
SheetOne.GetRow(j).CreateCell(24).SetCellValue(execlData[i]["偵測之eTag ID"]);
SheetOne.GetRow(j).CreateCell(25).SetCellValue(execlData[i]["帳單地址"]);
SheetOne.GetRow(j).CreateCell(26).SetCellValue(execlData[i]["帳單地址類別"]);
SheetOne.GetRow(j).CreateCell(27).SetCellValue(execlData[i]["改寄類別"]);
j += 1;
}
i = i + 1;
}
FileStream file2003 = new FileStream(file_path, FileMode.Create);
workbook2003.Write(file2003);
file2003.Close();
workbook2003.Close();
} }
} }
} }
de48493c4e47c17f1d3fb9ea7de587584520d94e b66c9576fb8ce4f62cb9bb554b89ffd693447181
...@@ -177,3 +177,64 @@ D:\C#\e-eye3\ETC_App1\obj\Debug\ETC_App1.exe ...@@ -177,3 +177,64 @@ D:\C#\e-eye3\ETC_App1\obj\Debug\ETC_App1.exe
D:\C#\e-eye3\ETC_App1\obj\Debug\ETC_App1.pdb D:\C#\e-eye3\ETC_App1\obj\Debug\ETC_App1.pdb
D:\C#\e-eye\ETC_App1\bin\Debug\MySql.Data.dll D:\C#\e-eye\ETC_App1\bin\Debug\MySql.Data.dll
D:\C#\e-eye\ETC_App1\bin\Debug\MySql.Data.xml D:\C#\e-eye\ETC_App1\bin\Debug\MySql.Data.xml
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.csprojAssemblyReference.cache
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCBackgroundWorker1.resources
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCBackgroundWorker2.resources
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCBackgroundWorker3.resources
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCPictureBox.resources
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCPictureCheckBox.resources
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCStatusStrip.resources
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.ETCToolStrip.resources
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.Form1.resources
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.Properties.Resources.resources
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.csproj.GenerateResource.cache
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.csproj.CoreCompileInputs.cache
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.exe
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.pdb
C:\Users\admin\e-eye\ETC_App1\bin\Debug\x64\concrt140.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\x64\cvextern.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\x64\msvcp140.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\x64\opencv_ffmpeg401_64.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\x64\vcruntime140.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\x86\concrt140.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\x86\cvextern.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\x86\msvcp140.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\x86\opencv_ffmpeg401.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\x86\vcruntime140.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\ETC_App1.exe.config
C:\Users\admin\e-eye\ETC_App1\bin\Debug\ETC_App1.exe
C:\Users\admin\e-eye\ETC_App1\bin\Debug\ETC_App1.pdb
C:\Users\admin\e-eye\ETC_App1\bin\Debug\Aspose.BarCode.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\Emgu.CV.UI.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\Emgu.CV.World.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\ICSharpCode.SharpZipLib.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\MySql.Data.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\Newtonsoft.Json.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\NPOI.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\NPOI.OOXML.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\NPOI.OpenXml4Net.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\NPOI.OpenXmlFormats.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\RestSharp.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\ZedGraph.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\Aspose.BarCode.xml
C:\Users\admin\e-eye\ETC_App1\bin\Debug\Emgu.CV.UI.xml
C:\Users\admin\e-eye\ETC_App1\bin\Debug\Emgu.CV.World.xml
C:\Users\admin\e-eye\ETC_App1\bin\Debug\ICSharpCode.SharpZipLib.xml
C:\Users\admin\e-eye\ETC_App1\bin\Debug\MySql.Data.xml
C:\Users\admin\e-eye\ETC_App1\bin\Debug\Newtonsoft.Json.xml
C:\Users\admin\e-eye\ETC_App1\bin\Debug\RestSharp.xml
C:\Users\admin\e-eye\ETC_App1\bin\Debug\ZedGraph.xml
C:\Users\admin\e-eye\ETC_App1\bin\Debug\de\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\es\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\fr\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\hu\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\it\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\ja\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\pt\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\ru\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\sk\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\sv\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\tr\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\zh-cn\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\bin\Debug\zh-tw\ZedGraph.resources.dll
C:\Users\admin\e-eye\ETC_App1\obj\Debug\ETC_App1.csproj.CopyComplete
68b17283f877db405cc276ee20cdb836bc8420b7 91e24228b07a8a00d51c171de3fd3cf41f4cbcab
26237647b74ccd9c962a1be50bd84e9a9d74becf 9024d00d191523eccae6c462eda910629a7bc36c
aa4c1c0c43c2733a95130f18a90549e96879dddb 3a605f9c3d1a63dcad5f2eababb0a56bbd339be2
File added
*
\ No newline at end of file
File added
File added
0.找無檔案
1.找無檔案
2.LAD-505[Allen]
3.找無檔案
4.找無檔案
5.找無檔案
6.找無檔案
7.找無檔案
8.AKR-0793[Allen]
9.找無檔案
10.找無檔案
11.找無檔案
12.找無檔案
13.找無檔案
14.2888-RH
15.找無檔案
16.找無檔案
17.找無檔案
18.找無檔案
19.找無檔案
C:\Users\admin\e-eye\test\img\4_0548319871F.jpg,缺少比對資料
C:\Users\admin\e-eye\test\img\5_0548315693F.jpg,缺少比對資料
C:\Users\admin\e-eye\test\img\8_0548409441F.jpg,缺少比對資料
完全正確:3 找不到圖片:17 缺少比對資料:3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment