[後端] 修改條件時間

This commit is contained in:
dev02 2023-08-03 11:08:23 +08:00
parent 02e032b201
commit fa8238ffc7

View File

@ -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}' and opr.created_at <= '{ee.enddate}';";
where opr.deleted = 0 and opr.work_type = 1 and opr.created_at >= '{ee.startdate.ToString().Split("_")[0] + "T00:00:00"}' and opr.created_at <= '{ee.enddate.ToString().Split("_")[0] + "T23:59:59"}';";
var sheet = workbook.CreateSheet("廠商資料");
var operation_record = backendRepository.GetAllAsync<Operation_Record>(sqlString);
List<Operation_Record_File> operation_record_file = new List<Operation_Record_File>();
@ -559,20 +559,13 @@ 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}' and opr.created_at <= '{ee.enddate}';";
where opr.deleted = 0 and opr.work_type = 2 and opr.created_at >= '{ee.startdate.ToString().Split("_")[0] + "T00:00:00"}' and opr.created_at <= '{ee.enddate.ToString().Split("_")[0] + "T23:59:59"}';";
var sheet = workbook.CreateSheet("廠商資料");
var operation_record = backendRepository.GetAllAsync<Operation_Record>(sqlString);
@ -583,7 +576,7 @@ 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 };