diff --git a/FrontendWebApi/ApiControllers/OperationController.cs b/FrontendWebApi/ApiControllers/OperationController.cs index 878e3de..f9fd2c1 100644 --- a/FrontendWebApi/ApiControllers/OperationController.cs +++ b/FrontendWebApi/ApiControllers/OperationController.cs @@ -273,11 +273,11 @@ namespace FrontendWebApi.ApiControllers if (string.IsNullOrEmpty(work_type.ToString())) { - var sqlString = $@"select of.*, v2.system_key - from operation_firm of - left join variable v1 on of.device_system_category_layer2 = v1.system_value and v1.system_type = @main_system_type and v1.delted = 0 - left join variable v2 on v1.id = v2.system_parent_id and of.device_system_category_layer3 = v2.system_value and v2.system_type = @sub_system_type and v2.deleted = 0 - where of.deleted = 0"; + var sqlString = $@"select ofi.*, v2.system_key + from operation_firm ofi + left join variable v1 on ofi.device_system_category_layer2 = v1.system_value and v1.system_type = @main_system_type and v1.delted = 0 + left join variable v2 on v1.id = v2.system_parent_id and ofi.device_system_category_layer3 = v2.system_value and v2.system_type = @sub_system_type and v2.deleted = 0 + where ofi.deleted = 0"; var sheet = workbook.CreateSheet("廠商資料"); var operation_firm = backendRepository.GetAllAsync(sqlString, null); int RowPosition = 0; @@ -659,7 +659,7 @@ namespace FrontendWebApi.ApiControllers { if (ofl.start_created_at != null || ofl.end_created_at != null) { - sWhere += $@" and (of.created_at >= ifnull(@start_created_at, of.created_at) AND of.created_at <= ifnull(@end_created_at, of.created_at))"; + sWhere += $@" and (ofi.created_at >= ifnull(@start_created_at, ofi.created_at) AND ofi.created_at <= ifnull(@end_created_at, ofi.created_at))"; } //else if (ofl.today) //{ @@ -672,7 +672,7 @@ namespace FrontendWebApi.ApiControllers if (ofl.sub_system_tag != null || ofl.main_system_tag != null) { - sWhere += $@" and (of.device_system_category_layer2 = ifnull(@main_system_tag, device_system_category_layer2) AND of.device_system_category_layer3 = ifnull(@sub_system_tag, device_system_category_layer3))"; + sWhere += $@" and (ofi.device_system_category_layer2 = ifnull(@main_system_tag, device_system_category_layer2) AND ofi.device_system_category_layer3 = ifnull(@sub_system_tag, device_system_category_layer3))"; } var sqlString = @$"select ofi.*, v2.system_key @@ -686,7 +686,7 @@ namespace FrontendWebApi.ApiControllers } else { - var sqlString = $@"select of.id, of.name from operation_firm where deleted = 0"; + var sqlString = $@"select ofi.id, ofi.name from operation_firm where deleted = 0"; opList = await backendRepository.GetAllAsync(sqlString); } @@ -714,11 +714,11 @@ namespace FrontendWebApi.ApiControllers Operation_Firm opList = new Operation_Firm(); try { - var sqlString = @$"select of.*, v2.system_key - from operation_firm of - left join variable v1 on of.device_system_category_layer2 = v1.system_value and v1.system_type = @main_system_type and v1.deleted = 0 and of.device_system_category_layer2 = v1.system_value - left join variable v2 on v1.id = v2.system_parent_id and of.device_system_category_layer3 = v2.system_value and v2.deleted = 0 - where of.deleted = 0 and of.id = @id"; + var sqlString = @$"select ofi.*, v2.system_key + from operation_firm ofi + left join variable v1 on ofi.device_system_category_layer2 = v1.system_value and v1.system_type = @main_system_type and v1.deleted = 0 and ofi.device_system_category_layer2 = v1.system_value + left join variable v2 on v1.id = v2.system_parent_id and ofi.device_system_category_layer3 = v2.system_value and v2.deleted = 0 + where ofi.deleted = 0 and ofi.id = @id"; var param = new { @id = ofl.id }; opList = await backendRepository.GetOneAsync(sqlString, param); @@ -962,7 +962,7 @@ namespace FrontendWebApi.ApiControllers return apiResult; } - + #endregion #region 維修/保養 /// /// 維修/保養 讀取(work_type) @@ -1008,7 +1008,7 @@ namespace FrontendWebApi.ApiControllers return apiResult; } - + /// /// 維修/保養---新增/編輯 /// diff --git a/FrontendWebApi/Models/Operation.cs b/FrontendWebApi/Models/Operation.cs index 442a763..5a08c56 100644 --- a/FrontendWebApi/Models/Operation.cs +++ b/FrontendWebApi/Models/Operation.cs @@ -46,7 +46,7 @@ namespace FrontendWebApi.Models //public bool yesterday { get; set; }//昨天建立时间 public string main_system_tag { get; set; }//大类tag public string sub_system_tag { get; set; }//小类tag - public byte work_type { get; set; } // 1:保養, 2:維修 + public byte? work_type { get; set; } // 1:保養, 2:維修 } public class BuildingList