프로젝트 시스템 통합 및 전반적인 개선사항
- 솔루션 설정 및 프로젝트 파일 업데이트 - BaseController 최적화 (HtmlAgilityPack 의존성 제거) - CommonController 네비게이션 메뉴에 프로젝트 추가 - JobreportController 사용자 조회 기능 및 필터링 개선 - 모든 웹 화면 UI/UX 통합 및 일관성 개선 - 프로그램 시작 시 중복 실행 감지 개선 - 각종 폼 및 데이터셋 디자이너 업데이트 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
using Microsoft.Owin;
|
||||
using Project.Web.Controllers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Data;
|
||||
using System.Web.Http.Results;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
@@ -641,6 +645,90 @@ namespace Project.Web.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetUsers()
|
||||
{
|
||||
try
|
||||
{
|
||||
string connectionString = Properties.Settings.Default.gwcs;
|
||||
var users = new List<dynamic>();
|
||||
|
||||
using (var connection = new System.Data.SqlClient.SqlConnection(connectionString))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
string selectSql = @"
|
||||
SELECT name, id, processs
|
||||
FROM vGroupUser
|
||||
WHERE gcode = @gcode AND useJobReport = 1 AND useUserState = 1
|
||||
ORDER BY name";
|
||||
|
||||
using (var command = new System.Data.SqlClient.SqlCommand(selectSql, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
|
||||
using (var reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
users.Add(new
|
||||
{
|
||||
name = reader["name"],
|
||||
id = reader["id"],
|
||||
process = reader["processs"]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 디버깅 로그 추가
|
||||
System.Diagnostics.Debug.WriteLine($"GetUsers: Found {users.Count} users for gcode {FCOMMON.info.Login.gcode}");
|
||||
|
||||
// JSON 형태로 변환
|
||||
var jsonData = "[";
|
||||
bool first = true;
|
||||
|
||||
foreach (var user in users)
|
||||
{
|
||||
if (!first) jsonData += ",";
|
||||
first = false;
|
||||
|
||||
var name = EscapeJsonString(user.name?.ToString() ?? "");
|
||||
var id = EscapeJsonString(user.id?.ToString() ?? "");
|
||||
var process = EscapeJsonString(user.process?.ToString() ?? "");
|
||||
|
||||
jsonData += "{";
|
||||
jsonData += $"\"name\":\"{name}\",";
|
||||
jsonData += $"\"id\":\"{id}\",";
|
||||
jsonData += $"\"process\":\"{process}\"";
|
||||
jsonData += "}";
|
||||
}
|
||||
jsonData += "]";
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
jsonData,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorResp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
$"{{\"error\":\"{ex.Message}\"}}",
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
return errorResp;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetJobData()
|
||||
{
|
||||
@@ -649,9 +737,11 @@ namespace Project.Web.Controllers
|
||||
var gets = Request.GetQueryNameValuePairs();
|
||||
var startDateParam = gets.Where(t => t.Key == "startDate").FirstOrDefault();
|
||||
var endDateParam = gets.Where(t => t.Key == "endDate").FirstOrDefault();
|
||||
var userParam = gets.Where(t => t.Key == "user").FirstOrDefault();
|
||||
|
||||
var startDate = startDateParam.Key != null ? startDateParam.Value : null;
|
||||
var endDate = endDateParam.Key != null ? endDateParam.Value : null;
|
||||
var selectedUser = userParam.Key != null ? userParam.Value : null;
|
||||
|
||||
// 날짜 파라미터 처리
|
||||
string sd, ed;
|
||||
@@ -683,13 +773,17 @@ namespace Project.Web.Controllers
|
||||
description, '' as ww, otStart, otEnd, ot as ot2, '' as otReason,
|
||||
'' as grade, '' as indate, '' as outdate, pidx
|
||||
FROM JobReport WITH (NOLOCK)
|
||||
WHERE gcode = @gcode AND uid = @uid AND pdate BETWEEN @startDate AND @endDate
|
||||
ORDER BY pdate DESC";
|
||||
WHERE gcode = @gcode AND pdate BETWEEN @startDate AND @endDate";
|
||||
|
||||
// 사용자 필터가 있으면 해당 사용자, 없으면 로그인한 사용자
|
||||
selectSql += " AND uid = @uid";
|
||||
|
||||
selectSql += " ORDER BY pdate DESC";
|
||||
|
||||
using (var command = new System.Data.SqlClient.SqlCommand(selectSql, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
command.Parameters.AddWithValue("@uid", FCOMMON.info.Login.no);
|
||||
command.Parameters.AddWithValue("@uid", !string.IsNullOrEmpty(selectedUser) ? selectedUser : FCOMMON.info.Login.no);
|
||||
command.Parameters.AddWithValue("@startDate", sd);
|
||||
command.Parameters.AddWithValue("@endDate", ed);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user