[前端] 修改查詢單號

This commit is contained in:
dev02 2023-08-01 18:29:25 +08:00
parent 5e0c46d027
commit 2a70a285e2
3 changed files with 36 additions and 26 deletions

View File

@ -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();
}

View File

@ -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<Operation_Record>(sqlString);
List<Operation_Record_File> operation_record_file = new List<Operation_Record_File>();
@ -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<Operation_Record>(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<Operation_Record_File>(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;