新增列表, 修改excel

This commit is contained in:
dev02 2022-11-15 16:16:36 +08:00
parent f32af4ecde
commit 6be9be174c
2 changed files with 102 additions and 56 deletions

View File

@ -434,5 +434,55 @@ namespace FrontendWebApi.ApiControllers
}
/// <summary>
/// 即時趨勢條件過濾條件面板
/// </summary>
/// <param name="account"></param>
/// <returns></returns>
[HttpPost]
[Route("api/Device/GetMainSub")]
public async Task<ActionResult<ApiResult<History_MainSubBuildFloor>>> GetMainSub()
{
ApiResult<History_MainSubBuildFloor> apiResult = new ApiResult<History_MainSubBuildFloor>(jwt_str);
if (!jwtlife)
{
apiResult.Code = "5000";
return BadRequest(apiResult);
}
try
{
var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
@$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority
from role_auth a
join auth_page b on a.AuthCode = b.AuthCode
join userinfo c on c.role_guid = a.role_guid
join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
where c.account = @account
order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type });
var mains = dbsub.GroupBy(a => a.main_system_tag).ToList();
apiResult.Data = new History_MainSubBuildFloor();
apiResult.Data.history_Main_Systems = new List<History_Main_system>();
foreach (var main in mains)
{
History_Main_system history_Main_System = new History_Main_system();
history_Main_System.main_system_tag = main.Select(a => a.main_system_tag).FirstOrDefault();
history_Main_System.full_name = main.Select(a => a.main_name).FirstOrDefault();
apiResult.Data.history_Main_Systems.Add(history_Main_System);
}
apiResult.Code = "0000";
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
return Ok(apiResult);
}
return Ok(apiResult);
}
}
}

View File

@ -597,11 +597,7 @@ namespace FrontendWebApi.ApiControllers
var imageByte = System.IO.File.ReadAllBytes(fullPath);
int format = 0;
var drawing = sheet.CreateDrawingPatriarch();
foreach (var v in Enum.GetNames(typeof(PictureType)))
{
if (v == extName)
format = Convert.ToInt32(Enum.Parse(typeof(PictureType), v));
}
format = Convert.ToInt32(Enum.Parse(typeof(PictureType), extName));
if (format != 0)
{