diff --git a/Frontend/_operation.html b/Frontend/_operation.html
index c605d4f..e58d435 100644
--- a/Frontend/_operation.html
+++ b/Frontend/_operation.html
@@ -946,6 +946,8 @@
function snSearch() {
clearPageAct();
+ pageAct.startdate = $('#startdate').val() + "T00:00:00";
+ pageAct.enddate = $('#enddate').val() + "T23:59:59"
pageAct.serial_number = $('#serial_number').val() || null;
refTable();
}
diff --git a/FrontendWebApi/ApiControllers/OperationController.cs b/FrontendWebApi/ApiControllers/OperationController.cs
index 6f53423..a9acb76 100644
--- a/FrontendWebApi/ApiControllers/OperationController.cs
+++ b/FrontendWebApi/ApiControllers/OperationController.cs
@@ -351,35 +351,35 @@ namespace FrontendWebApi.ApiControllers
cell = row.CreateCell(i);
if (i == 0)
{
- cell.SetCellValue(of.system_key);
+ cell.SetCellValue(of.system_key ?? "");
}
if (i == 1)
{
- cell.SetCellValue(of.name);
+ cell.SetCellValue(of.name ?? "");
}
if (i == 2)
{
- cell.SetCellValue(of.contact_person);
+ cell.SetCellValue(of.contact_person ?? "");
}
if (i == 3)
{
- cell.SetCellValue(of.phone);
+ cell.SetCellValue(of.phone ?? "");
}
if (i == 4)
{
- cell.SetCellValue(of.email);
+ cell.SetCellValue(of.email ?? "");
}
if (i == 5)
{
- cell.SetCellValue(of.tax_id_number);
+ cell.SetCellValue(of.tax_id_number ?? "");
}
if (i == 6)
{
- cell.SetCellValue(of.remark);
+ cell.SetCellValue(of.remark ?? "");
}
if (i == 7)
{
- cell.SetCellValue(of.Created_at);
+ cell.SetCellValue(of.Created_at ?? "");
}
cell.CellStyle = style12;
@@ -395,7 +395,7 @@ namespace FrontendWebApi.ApiControllers
and d.device_building_tag = SUBSTRING_INDEX(SUBSTRING_INDEX(opr.fix_do_code, '_', 2), '_', -1) and d.device_floor_tag = SUBSTRING_INDEX(SUBSTRING_INDEX(opr.fix_do_code, '_', 5), '_', -1)
and d.device_system_tag = opr.device_system_category_layer2 and d.device_name_tag = opr.device_system_category_layer3
left join userinfo ui on opr.work_person_id = ui.userinfo_guid
- where opr.deleted = 0 and opr.work_type = 1 and opr.created_at >= '{ee.startdate.ToString().Split("T")[0]}' and opr.created_at <= '{ee.enddate.ToString().Split("T")[0]}';";
+ where opr.deleted = 0 and opr.work_type = 1 and opr.created_at >= '{ee.startdate}' and opr.created_at <= '{ee.enddate}';";
var sheet = workbook.CreateSheet("廠商資料");
var operation_record = backendRepository.GetAllAsync(sqlString);
List operation_record_file = new List();
@@ -465,27 +465,27 @@ namespace FrontendWebApi.ApiControllers
cell = row.CreateCell(i);
if (i == 0)
{
- cell.SetCellValue(or.work_type_name);
+ cell.SetCellValue(or.work_type_name == "null" ? "" : or.work_type_name);
}
if (i == 1)
{
- cell.SetCellValue(or.location);
+ cell.SetCellValue(or.location == "null" ? "" : or.location);
}
if (i == 2)
{
- cell.SetCellValue(or.formId);
+ cell.SetCellValue(or.formId == "null" ? "" : or.formId);
}
if (i == 3)
{
- cell.SetCellValue(or.device_name);
+ cell.SetCellValue(or.device_name == "null" ? "" : or.device_name);
}
if (i == 4)
{
- cell.SetCellValue(or.status_name);
+ cell.SetCellValue(or.status_name == "null" ? "" : or.status_name);
}
if (i == 5)
{
- cell.SetCellValue(or.user_full_name);
+ cell.SetCellValue(or.user_full_name == "null" ? "" : or.user_full_name);
}
if (i == 6)
{
@@ -547,7 +547,7 @@ namespace FrontendWebApi.ApiControllers
}
if (i == 9)
{
- cell.SetCellValue(or.Created_at);
+ cell.SetCellValue(or.Created_at ?? "");
}
cell.CellStyle = style12;
@@ -559,13 +559,20 @@ namespace FrontendWebApi.ApiControllers
}
else if (ee.work_type == 2)
{
+
+
+
+
+
+
+
var sqlString = $@"select opr.*, d.full_name as device_name, ui.full_name as user_full_name
from operation_record opr
left join device d on opr.fix_do_code = d.device_number and d.deleted = 0 and d.device_area_tag = SUBSTRING_INDEX(opr.fix_do_code, '_', 1)
and d.device_building_tag = SUBSTRING_INDEX(SUBSTRING_INDEX(opr.fix_do_code, '_', 2), '_', -1) and d.device_floor_tag = SUBSTRING_INDEX(SUBSTRING_INDEX(opr.fix_do_code, '_', 5), '_', -1)
and d.device_system_tag = opr.device_system_category_layer2 and d.device_name_tag = opr.device_system_category_layer3
left join userinfo ui on opr.work_person_id = ui.userinfo_guid
- where opr.deleted = 0 and opr.work_type = 2 and opr.created_at >= '{ee.startdate.ToString().Split("T")[0]}' and opr.created_at <= '{ee.enddate.ToString().Split("T")[0]}';";
+ where opr.deleted = 0 and opr.work_type = 2 and opr.created_at >= '{ee.startdate}' and opr.created_at <= '{ee.enddate}';";
var sheet = workbook.CreateSheet("廠商資料");
var operation_record = backendRepository.GetAllAsync(sqlString);
@@ -576,7 +583,8 @@ namespace FrontendWebApi.ApiControllers
if (operation_record.Result.Count > 0)
{
foreach (var or in operation_record.Result)
- {
+
+
sqlString = $@"select * from operation_record_file where record_id = @record_id";
var param = new { @record_id = or.id };
operation_record_file = backendRepository.GetAllAsync(sqlString, param).Result;
@@ -641,32 +649,32 @@ namespace FrontendWebApi.ApiControllers
cell = row.CreateCell(i);
if (i == 0)
{
- cell.SetCellValue(or.work_type_name);
+ cell.SetCellValue(or.work_type_name == "null" ? "" : or.work_type_name);
}
if (i == 1)
{
- cell.SetCellValue(or.location);
+ cell.SetCellValue(or.location == "null" ? "" : or.location);
}
if (i == 2)
{
- cell.SetCellValue(or.error_code);
+ cell.SetCellValue(or.error_code == "null" ? "" : or.error_code);
sheet.AutoSizeColumn(i);
}
if (i == 3)
{
- cell.SetCellValue(or.formId);
+ cell.SetCellValue(or.formId == "null" ? "" : or.formId);
}
if (i == 4)
{
- cell.SetCellValue(or.device_name);
+ cell.SetCellValue(or.device_name == "null" ? "" : or.device_name);
}
if (i == 5)
{
- cell.SetCellValue(or.status_name);
+ cell.SetCellValue(or.status_name == "null" ? "" : or.status_name);
}
if (i == 6)
{
- cell.SetCellValue(or.user_full_name);
+ cell.SetCellValue(or.user_full_name == "null" ? "" : or.user_full_name);
}
if (i == 7)
{
@@ -728,7 +736,7 @@ namespace FrontendWebApi.ApiControllers
}
if (i == 10)
{
- cell.SetCellValue(or.Created_at);
+ cell.SetCellValue(or.Created_at == "null" ? "" : or.Created_at);
}
cell.CellStyle = style12;
diff --git a/FrontendWebApi/wwwroot/excel/operation/維修_2023-07-31_2023-07-31.xlsx b/FrontendWebApi/wwwroot/excel/operation/維修_2023-07-31_2023-07-31.xlsx
new file mode 100644
index 0000000..e69de29