From 479a736b800960e4c262734212abf6c794a952c3 Mon Sep 17 00:00:00 2001 From: backuppc Date: Mon, 14 Jul 2025 16:30:03 +0900 Subject: [PATCH] .. --- Project/Dialog/fJobReport.Designer.cs | 46 + Project/Dialog/fJobReport.cs | 86 ++ Project/Dialog/fJobReport.resx | 120 +++ Project/EETGW.csproj | 12 + Project/Web/Controller/DashBoardController.cs | 62 +- Project/Web/Controller/JobreportController.cs | 79 +- Project/Web/wwwroot/Jobreport/index.html | 863 ++++++++++++++++++ Project/fMain.cs | 8 +- 8 files changed, 1201 insertions(+), 75 deletions(-) create mode 100644 Project/Dialog/fJobReport.Designer.cs create mode 100644 Project/Dialog/fJobReport.cs create mode 100644 Project/Dialog/fJobReport.resx create mode 100644 Project/Web/wwwroot/Jobreport/index.html diff --git a/Project/Dialog/fJobReport.Designer.cs b/Project/Dialog/fJobReport.Designer.cs new file mode 100644 index 0000000..c8a5b49 --- /dev/null +++ b/Project/Dialog/fJobReport.Designer.cs @@ -0,0 +1,46 @@ +namespace Project.Dialog +{ + partial class fJobReport + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // fJobReport + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1063, 567); + this.Name = "fJobReport"; + this.Text = "업무일지"; + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/Project/Dialog/fJobReport.cs b/Project/Dialog/fJobReport.cs new file mode 100644 index 0000000..c847fb3 --- /dev/null +++ b/Project/Dialog/fJobReport.cs @@ -0,0 +1,86 @@ +using FCM0000.Mail; +using FCOMMON; +using Microsoft.Web.WebView2.Core; +using Microsoft.Web.WebView2.WinForms; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Project.Dialog +{ + public partial class fJobReport : fBase + { + private WebView2 webView21; + public fJobReport() + { + InitializeComponent(); + + + InitializeWebView2(); + + + } + private void InitializeWebView2() + { + // 수동으로 WebView2 컨트롤 생성 + this.webView21 = new WebView2(); + + // 기본 속성 설정 + this.webView21.CreationProperties = null; + this.webView21.DefaultBackgroundColor = Color.White; + this.webView21.Dock = DockStyle.Fill; + this.webView21.Location = new Point(0, 0); + this.webView21.Name = "webView21"; + this.webView21.Size = new Size(800, 600); + this.webView21.TabIndex = 0; + this.webView21.ZoomFactor = 1D; + + // 폼에 추가 + this.Controls.Add(this.webView21); + + // 비동기 초기화 + InitializeAsync(); + } + private async void InitializeAsync() + { + try + { + // Fixed Version 경로 설정 + string runtimePath = Path.Combine(Application.StartupPath, "WebView2Runtime"); + + if (Directory.Exists(runtimePath)) + { + var env = await CoreWebView2Environment.CreateAsync(runtimePath); + await this.webView21.EnsureCoreWebView2Async(env); + } + else + { + // 시스템에 설치된 WebView2 사용 + await this.webView21.EnsureCoreWebView2Async(); + } + // OWIN 서버의 DashBoard 페이지로 연결 + webView21.Source = new Uri($"{Pub.setting.WebServiceURL}/Jobreport"); + } + catch (Exception ex) + { + MessageBox.Show($"WebView2 초기화 실패: {ex.Message}"); + } + } + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + EnsureVisibleAndUsableSize(); + } + private void label1_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/Project/Dialog/fJobReport.resx b/Project/Dialog/fJobReport.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Project/Dialog/fJobReport.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Project/EETGW.csproj b/Project/EETGW.csproj index cd16ce6..240e29c 100644 --- a/Project/EETGW.csproj +++ b/Project/EETGW.csproj @@ -259,6 +259,12 @@ + + Form + + + fJobReport.cs + Form @@ -469,6 +475,9 @@ fDisableItem.cs + + fJobReport.cs + fDashboard.cs @@ -645,6 +654,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Project/Web/Controller/DashBoardController.cs b/Project/Web/Controller/DashBoardController.cs index 6e92f0b..e243a12 100644 --- a/Project/Web/Controller/DashBoardController.cs +++ b/Project/Web/Controller/DashBoardController.cs @@ -32,7 +32,7 @@ namespace Project.Web.Controllers { var sql = "select count(*) from EETGW_HolydayRequest " + - " where gcode = @gcode and isnull(conf,0) = 1 "+ + " where gcode = @gcode and isnull(conf,0) = 1 " + " and sdate <= convert(varchar(10),GETDATE(),120) and edate >= convert(varchar(10),GETDATE(),120)"; var cn = DBM.getCn(); @@ -84,7 +84,7 @@ namespace Project.Web.Controllers } } - + [HttpGet] public HttpResponseMessage GetholyRequestUser() { @@ -93,8 +93,8 @@ namespace Project.Web.Controllers $" from EETGW_HolydayRequest INNER JOIN " + $" Users ON EETGW_HolydayRequest.uid = Users.id " + $" where EETGW_HolydayRequest.gcode = @gcode" + - $" and isnull(conf,0) = 0 "; - //" and sdate <= convert(varchar(10),GETDATE(),120) and edate >= convert(varchar(10),GETDATE(),120)"; + $" and isnull(conf,0) = 0 "; + //" and sdate <= convert(varchar(10),GETDATE(),120) and edate >= convert(varchar(10),GETDATE(),120)"; //sql = sql.Replace("{gcode}", FCOMMON.info.Login.gcode); @@ -125,6 +125,60 @@ namespace Project.Web.Controllers return resp; } + [HttpGet] + public HttpResponseMessage GetJobData(string startDate = "", string endDate = "") + { + var sql = string.Empty; + + // 기본값 설정 (이번 달) + if (string.IsNullOrEmpty(startDate) || string.IsNullOrEmpty(endDate)) + { + var now = DateTime.Now; + var firstDayOfMonth = new DateTime(now.Year, now.Month, 1); + var lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1); + startDate = firstDayOfMonth.ToString("yyyy-MM-dd"); + endDate = lastDayOfMonth.ToString("yyyy-MM-dd"); + } + + sql = $" select idx,pdate,status,projectName, uid, requestpart, package,type,process,description," + + " hrs,ot,otStart,otEnd" + + " from JobReport" + + " where gcode = @gcode and uid = @uid" + + " and pdate between @startDate and @endDate" + + " order by pdate desc, wdate desc"; + + var cs = Properties.Settings.Default.gwcs; + var cn = new System.Data.SqlClient.SqlConnection(cs); + var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); + cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode); + cmd.Parameters.AddWithValue("uid", FCOMMON.info.Login.no); + cmd.Parameters.AddWithValue("startDate", startDate); + cmd.Parameters.AddWithValue("endDate", endDate); + var da = new System.Data.SqlClient.SqlDataAdapter(cmd); + var dt = new System.Data.DataTable(); + da.Fill(dt); + da.Dispose(); + cmd.Dispose(); + cn.Dispose(); + + var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore + }); + + var resp = new HttpResponseMessage() + { + Content = new StringContent( + txtjson, + System.Text.Encoding.UTF8, + "application/json") + }; + + return resp; + } + + + [HttpGet] public HttpResponseMessage GetCurrentUserCount() diff --git a/Project/Web/Controller/JobreportController.cs b/Project/Web/Controller/JobreportController.cs index a3b47a9..f6c37c1 100644 --- a/Project/Web/Controller/JobreportController.cs +++ b/Project/Web/Controller/JobreportController.cs @@ -288,93 +288,32 @@ namespace Project.Web.Controllers [HttpGet] public HttpResponseMessage Index() { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); + // 직접 파일을 읽어서 반환 + var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "Jobreport", "index.html"); + var contents = string.Empty; - - var gets = Request.GetQueryNameValuePairs();// GetParameters(data); - - - var key_search = gets.Where(t => t.Key == "search").FirstOrDefault(); - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var searchkey = string.Empty; - if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim(); - - var tbody = new System.Text.StringBuilder(); - - //테이블데이터생성 - var itemcnt = 0; - //if (searchkey.isEmpty() == false) + if (System.IO.File.Exists(filePath)) { - var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();// EEEntitiesJobreport(); - var sd = DateTime.Now.ToShortDateString(); - var ed = DateTime.Now.ToShortDateString(); - var rows = db.GetByDate(FCOMMON.info.Login.gcode, FCOMMON.info.Login.no, sd, ed); - //.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.id == FCOMMON.info.Login.no && t.pdate.CompareTo(sd) >= 0 && t.pdate.CompareTo(ed) <= 1).OrderByDescending(t => t.pdate); - itemcnt = rows.Count(); - foreach (var item in rows) - { - tbody.AppendLine(""); - - tbody.AppendLine($"{item.pdate.Substring(5)}"); - tbody.AppendLine($"{item.ww}"); - tbody.AppendLine($"{item.name}"); - - if (item.status == "진행 중" || item.status.EndsWith("%")) - tbody.AppendLine($"{item.status}"); - else - tbody.AppendLine($"{item.status}"); - - tbody.AppendLine($"{item.type}"); - tbody.AppendLine($"{item.projectName}"); - tbody.AppendLine($"{item.hrs}"); - tbody.AppendLine($"{item.ot}"); - - tbody.AppendLine(""); - tbody.AppendLine(item.description); - tbody.AppendLine(""); - - tbody.AppendLine(""); - } + contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8); } - - - - //아잍쳄이 없는경우 - if (itemcnt == 0) + else { - tbody.AppendLine(""); - tbody.AppendLine("1"); - tbody.AppendLine("자료가 없습니다"); - tbody.AppendLine(""); + // 파일이 없으면 404 에러 페이지 또는 기본 메시지 + contents = "

404 - File Not Found

The requested file was not found: " + filePath + "

"; } - - var contents = result.Content.Replace("{search}", searchkey); - contents = contents.Replace("{tabledata}", tbody.ToString()); - contents = contents.Replace("{cnt}", itemcnt.ToString()); - - //공용값 적용 ApplyCommonValue(ref contents); - //최종문자 적용 - result.Content = contents; - var resp = new HttpResponseMessage() { Content = new StringContent( - result.Content, + contents, System.Text.Encoding.UTF8, "text/html") }; return resp; } - } } diff --git a/Project/Web/wwwroot/Jobreport/index.html b/Project/Web/wwwroot/Jobreport/index.html new file mode 100644 index 0000000..98c3414 --- /dev/null +++ b/Project/Web/wwwroot/Jobreport/index.html @@ -0,0 +1,863 @@ + + + + + + + + + 업무일지 + + + + + + + +
+
+
+
+ +

업무일지

+
+
+ +
+ +
+
+
+
+
+ + +
+ +
+
+
+
+ +
+
+

총 업무일수

+

0

+
+
+
+
+
+
+ +
+
+

총 근무시간

+

0h

+
+
+
+
+
+
+ +
+
+

총 초과근무

+

0h

+
+
+
+
+
+
+ +
+
+

진행중 프로젝트

+

0

+
+
+
+
+ + +
+
+
+
+
+ +
+ + ~ + +
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + +
+ 날짜 + + 상태 + + 프로젝트명 + + 요청부서 + + 패키지 + + 타입 + + 프로세스 + 업무내용 + 근무시간 + + 초과근무 + 초과근무 시간
+
+ + + + +
+ + + + + +
+ + + + + + + \ No newline at end of file diff --git a/Project/fMain.cs b/Project/fMain.cs index 1114869..13ba22f 100644 --- a/Project/fMain.cs +++ b/Project/fMain.cs @@ -374,7 +374,13 @@ namespace Project { string formkey = "WORKBOOK"; if (!ShowForm(formkey)) - AddForm(formkey, new FPJ0000.fJobReport()); + { + if (this.webok && Pub.InitWebView == 1 && System.Diagnostics.Debugger.IsAttached) + AddForm(formkey, new Dialog.fJobReport()); + else + AddForm(formkey, new FPJ0000.fJobReport()); + } + } void menu_save_cost()