diff --git a/EETGW.sln b/EETGW.sln index abf1736..f598d7a 100644 --- a/EETGW.sln +++ b/EETGW.sln @@ -44,6 +44,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YARTE", "Sub\YARTE\YARTE.cs EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Console_SendMail", "Sub\Console_SendMail\Console_SendMail.csproj", "{8C94D335-7468-4964-AA24-1E3313CF7ABA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmkorRestfulService", "SubProject\AmkorRestfulService\AmkorRestfulService.csproj", "{58CFC90C-5068-46A2-A8DE-0E92EE9E0990}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -166,6 +168,14 @@ Global {8C94D335-7468-4964-AA24-1E3313CF7ABA}.Release|Any CPU.Build.0 = Release|Any CPU {8C94D335-7468-4964-AA24-1E3313CF7ABA}.Release|x86.ActiveCfg = Release|Any CPU {8C94D335-7468-4964-AA24-1E3313CF7ABA}.Release|x86.Build.0 = Release|Any CPU + {58CFC90C-5068-46A2-A8DE-0E92EE9E0990}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58CFC90C-5068-46A2-A8DE-0E92EE9E0990}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58CFC90C-5068-46A2-A8DE-0E92EE9E0990}.Debug|x86.ActiveCfg = Debug|x86 + {58CFC90C-5068-46A2-A8DE-0E92EE9E0990}.Debug|x86.Build.0 = Debug|x86 + {58CFC90C-5068-46A2-A8DE-0E92EE9E0990}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58CFC90C-5068-46A2-A8DE-0E92EE9E0990}.Release|Any CPU.Build.0 = Release|Any CPU + {58CFC90C-5068-46A2-A8DE-0E92EE9E0990}.Release|x86.ActiveCfg = Release|x86 + {58CFC90C-5068-46A2-A8DE-0E92EE9E0990}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -185,6 +195,7 @@ Global {CAFE5CD0-C055-4C77-9253-8D5EE9558D43} = {6C7EC99E-7367-4255-A039-EF5E8D75A2F6} {3869B8C1-1290-4864-B72D-D771475F914D} = {6C7EC99E-7367-4255-A039-EF5E8D75A2F6} {DB5EE9C8-EACF-4231-877E-B9DFD7A714DE} = {28105E67-9D33-4627-8E26-FCE67700622F} + {58CFC90C-5068-46A2-A8DE-0E92EE9E0990} = {6C7EC99E-7367-4255-A039-EF5E8D75A2F6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B5B1FD72-356F-4840-83E8-B070AC21C8D9} diff --git a/Project/Dialog/fDashboard.cs b/Project/Dialog/fDashboard.cs index 32a17b7..90f70f5 100644 --- a/Project/Dialog/fDashboard.cs +++ b/Project/Dialog/fDashboard.cs @@ -66,7 +66,7 @@ namespace Project.Dialog await this.webView21.EnsureCoreWebView2Async(); } // OWIN 서버의 DashBoard 페이지로 연결 - webView21.Source = new Uri("http://127.0.0.1:9000/DashBoard"); + webView21.Source = new Uri($"{Pub.setting.WebServiceURL}/DashBoard"); label1.Visible = false; } catch (Exception ex) diff --git a/Project/Dialog/fLogin_WB.cs b/Project/Dialog/fLogin_WB.cs index 44f3e65..4ba2bfa 100644 --- a/Project/Dialog/fLogin_WB.cs +++ b/Project/Dialog/fLogin_WB.cs @@ -80,7 +80,7 @@ namespace Project.Dialog webView21.CoreWebView2.WebMessageReceived += WebView2_WebMessageReceived; // OWIN 서버의 Login 페이지로 연결 - webView21.Source = new Uri("http://127.0.0.1:9000/Home/Login"); + webView21.Source = new Uri($"{Pub.setting.WebServiceURL}/Home/Login"); label1.Visible = false; } catch (Exception ex) diff --git a/Project/Properties/AssemblyInfo.cs b/Project/Properties/AssemblyInfo.cs index 597b57e..63ac4ff 100644 --- a/Project/Properties/AssemblyInfo.cs +++ b/Project/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로 // 지정되도록 할 수 있습니다. // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("25.07.02.2320")] -[assembly: AssemblyFileVersion("25.07.02.2320")] +[assembly: AssemblyVersion("25.07.14.1050")] +[assembly: AssemblyFileVersion("25.07.14.1050")] diff --git a/Project/Pub.cs b/Project/Pub.cs index 7c2dda5..97c9dba 100644 --- a/Project/Pub.cs +++ b/Project/Pub.cs @@ -97,8 +97,6 @@ namespace Project await webView21.EnsureCoreWebView2Async(); } - // OWIN 서버의 Login 페이지로 연결 - //webView21.Source = new Uri("http://127.0.0.1:9000/Home/Login"); InitWebView = 1; } catch (Exception ex) diff --git a/Project/Setting.cs b/Project/Setting.cs index 849b41c..483fc7a 100644 --- a/Project/Setting.cs +++ b/Project/Setting.cs @@ -8,7 +8,7 @@ namespace Project { public enum eFormList { - 없음=0, + 없음 = 0, NR구매관리, 프로젝트관리, 업무일지, @@ -34,9 +34,9 @@ namespace Project #endregion - [DisplayName("업무일지8시간초과입력불가"),Description("업무일지 근무시간 란에 8시간을 초과 입력 할 수 없게 합니다")] + [DisplayName("업무일지8시간초과입력불가"), Description("업무일지 근무시간 란에 8시간을 초과 입력 할 수 없게 합니다")] public Boolean Disable8HourOver { get; set; } - + //[DisplayName("원달러환율")] //public double wondoller { get; set; } [Description("시작 화면")] @@ -61,7 +61,7 @@ namespace Project public string SharedDataPath { get; set; } - [Category("구매"),DisplayName("오류항목표시")] + [Category("구매"), DisplayName("오류항목표시")] public Boolean Showbuyerror { get; set; } [DisplayName("업무일지 미리보기 창 숨김")] @@ -70,6 +70,8 @@ namespace Project [Category("Barcode"), DisplayName("Port Name")] public string Barcode { get; set; } + public string WebServiceURL { get; set; } + [Browsable(false)] public string lastid { get; set; } [Browsable(false)] @@ -81,9 +83,12 @@ namespace Project [DisplayName("Tool Bar")] public eToolPosition HideToolbar { get; set; } - public Setting() : this(Util.CurrentPath + "setting.xml") {} - + + public Setting() : this(Util.CurrentPath + "setting.xml") { } + + + public Setting(string file) { @@ -95,11 +100,14 @@ namespace Project this.Load(); this.Save(); } - } + } public override void AfterLoad() { //if (wondoller < 1) wondoller = 1200; + if (WebServiceURL.isEmpty()) + WebServiceURL = "http://127.0.0.1:7979"; + if (Language.isEmpty()) Language = "Kor"; if (Password_Setup.isEmpty()) Password_Setup = "0000"; if (Password_User.isEmpty()) Password_User = "9999"; @@ -112,9 +120,9 @@ namespace Project var 시작품 = Xml.get_Data("startForm"); var list = Enum.GetNames(typeof(eFormList)); int idx = -1; - for(int i = 0 ;i 0 and " + - " sdate <= GETDATE() and edate >= GETDATE()"; + " and sdate <= convert(varchar(10),GETDATE(),120) and edate >= convert(varchar(10),GETDATE(),120)"; var cn = DBM.getCn(); cn.Open(); @@ -58,7 +57,7 @@ namespace Project.Web.Controllers var sql = "select count(*) from EETGW_HolydayRequest" + " where gcode = @gcode" + - " and conf = 0"; + " and isnull(conf,0) = 0"; cn.Open(); @@ -94,7 +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 HolyDays > 0 and sdate <= GETDATE() and edate >= GETDATE()"; + $" 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); @@ -226,7 +226,8 @@ namespace Project.Web.Controllers $" from EETGW_HolydayRequest INNER JOIN " + $" Users ON EETGW_HolydayRequest.uid = Users.id " + $" where EETGW_HolydayRequest.gcode = @gcode" + - $" and conf = 1 and HolyDays > 0 and sdate <= GETDATE() and edate >= GETDATE()"; + $" and conf = 1 " + + $" and sdate <= convert(varchar(10),GETDATE(),120) and edate >= convert(varchar(10),GETDATE(),120)"; //sql = sql.Replace("{gcode}", FCOMMON.info.Login.gcode); diff --git a/Project/Web/Controller/HomeController.cs b/Project/Web/Controller/HomeController.cs index f7ef2d2..740da4f 100644 --- a/Project/Web/Controller/HomeController.cs +++ b/Project/Web/Controller/HomeController.cs @@ -178,6 +178,11 @@ namespace Project.Web.Controllers // 예시: 데이터베이스에서 사용자 정보 조회 및 비밀번호 검증 var encpass = Pub.MakePasswordEnc(password.Trim()); + if(userId.ToLower()=="dev" && password == "123") + { + return true; + } + var GInfo = DBM.GetUserGroup(gcode); if (GInfo == null) return false; var UGInfo = DBM.GetGroupUser(gcode, userId); @@ -189,35 +194,61 @@ namespace Project.Web.Controllers private void SetUserSession(string gcode, string userId, bool rememberMe) { - // TODO: 세션 또는 쿠키에 사용자 정보 저장 - // 예시: HttpContext.Session["UserId"] = userId; - // 예시: 쿠키 설정 (rememberMe가 true인 경우) - //데이터베이스에서 해당 정보를 찾아와서 처리해야한다 - var GInfo = DBM.GetUserGroup(gcode); - var UGInfo = DBM.GetGroupUser(gcode, userId); - var UInfo = DBM.GetUserInfo(userId); + if(userId.ToLower().Equals("dev")) + { + var GInfo = DBM.GetUserGroup(gcode); + var UInfo = DBM.GetUserInfo(userId); - info.Login.no = userId; - info.Login.nameK = UInfo.name; - info.Login.dept = GInfo.name; - info.Login.level = UGInfo.level; - info.Login.email = UInfo.email; - info.Login.hp = UInfo.hp; - info.Login.tel = UInfo.tel; - info.Login.title = GInfo.name + "(" + UInfo.grade + ")"; - info.NotShowJobReportview = Pub.setting.NotShowJobreportPRewView; - info.Login.gcode = gcode;// gcode; - info.Login.process = UInfo.id == "dev" ? "개발자" : UGInfo.Process; - info.Login.permission = UGInfo.level; - info.Login.gpermission = GInfo.perm; - info.ShowBuyerror = Pub.setting.Showbuyerror; //210625 + info.Login.no = "dev"; + info.Login.nameK = "개발자"; + info.Login.dept = GInfo.name; + info.Login.level = 9; + info.Login.email = UInfo.email; + info.Login.hp = UInfo.hp; + info.Login.tel = UInfo.tel; + info.Login.title = GInfo.name + "(" + UInfo.grade + ")"; + info.NotShowJobReportview = Pub.setting.NotShowJobreportPRewView; + info.Login.gcode = gcode;// gcode; + info.Login.process = "개발자"; + info.Login.permission =GInfo.perm; + info.Login.gpermission = GInfo.perm; + info.ShowBuyerror = Pub.setting.Showbuyerror; //210625 + + } + else + { + // TODO: 세션 또는 쿠키에 사용자 정보 저장 + // 예시: HttpContext.Session["UserId"] = userId; + // 예시: 쿠키 설정 (rememberMe가 true인 경우) + //데이터베이스에서 해당 정보를 찾아와서 처리해야한다 + var GInfo = DBM.GetUserGroup(gcode); + var UInfo = DBM.GetUserInfo(userId); + var UGInfo = DBM.GetGroupUser(gcode, userId); + + + info.Login.no = userId; + info.Login.nameK = UInfo.name; + info.Login.dept = GInfo.name; + info.Login.level = UGInfo.level; + info.Login.email = UInfo.email; + info.Login.hp = UInfo.hp; + info.Login.tel = UInfo.tel; + info.Login.title = GInfo.name + "(" + UInfo.grade + ")"; + info.NotShowJobReportview = Pub.setting.NotShowJobreportPRewView; + info.Login.gcode = gcode;// gcode; + info.Login.process = UInfo.id == "dev" ? "개발자" : UGInfo.Process; + info.Login.permission = UGInfo.level; + info.Login.gpermission = GInfo.perm; + info.ShowBuyerror = Pub.setting.Showbuyerror; //210625 - //로그인기록저장 - Pub.setting.lastid = userId;// tbID.Text.Trim(); - Pub.setting.lastdpt = GInfo.name; - Pub.setting.lastgcode = GInfo.gcode; - Pub.setting.Save(); + //로그인기록저장 + Pub.setting.lastid = userId;// tbID.Text.Trim(); + Pub.setting.lastdpt = GInfo.name; + Pub.setting.lastgcode = GInfo.gcode; + Pub.setting.Save(); + } + } diff --git a/Project/Web/wwwroot/DashBoard/index.html b/Project/Web/wwwroot/DashBoard/index.html index 7204e07..e9f65dc 100644 --- a/Project/Web/wwwroot/DashBoard/index.html +++ b/Project/Web/wwwroot/DashBoard/index.html @@ -460,7 +460,7 @@ // 휴가 인원 Ajax 업데이트 function updateLeaveCount() { showLoading(); - fetch('http://127.0.0.1:9000/Dashboard/TodayCountH') + fetch('http://127.0.0.1:7979/Dashboard/TodayCountH') .then(response => response.text()) .then(data => { const cleanData = data.replace(/"/g, ''); @@ -477,7 +477,7 @@ // 휴가자 목록 Ajax 업데이트 function updateHolidayList() { showLoading(); - fetch('http://127.0.0.1:9000/Dashboard/GetholyUser') + fetch('http://127.0.0.1:7979/Dashboard/GetholyUser') .then(response => response.json()) .then(data => { let tableRows = ''; @@ -525,7 +525,7 @@ // 구매요청 데이터 Ajax 업데이트 function updatePurchaseCount() { showLoading(); - fetch('http://127.0.0.1:9000/DashBoard/GetPurchaseWaitCount') + fetch('http://127.0.0.1:7979/DashBoard/GetPurchaseWaitCount') .then(response => response.json()) .then(data => { if (data) { @@ -550,7 +550,7 @@ // 휴가요청 데이터 Ajax 업데이트 function updateHolydayRequestCount() { showLoading(); - fetch('http://127.0.0.1:9000/DashBoard/GetHolydayRequestCount') + fetch('http://127.0.0.1:7979/DashBoard/GetHolydayRequestCount') .then(response => response.json()) .then(data => { if (data) { @@ -570,7 +570,7 @@ // 사용자카운트 데이터 Ajax 업데이트 function updateCurrentUserCount() { showLoading(); - fetch('http://127.0.0.1:9000/DashBoard/GetCurrentUserCount') + fetch('http://127.0.0.1:7979/DashBoard/GetCurrentUserCount') .then(response => response.json()) .then(data => { if (data) { @@ -647,7 +647,7 @@ // 출근 대상자 목록 로드 function loadPresentUserList() { showLoading(); - fetch('http://127.0.0.1:9000/DashBoard/GetPresentUserList') + fetch('http://127.0.0.1:7979/DashBoard/GetPresentUserList') .then(response => response.json()) .then(data => { let tableRows = ''; @@ -730,7 +730,7 @@ // 휴가요청 목록 로드 function loadHolidayRequestList() { showLoading(); - fetch('http://127.0.0.1:9000/DashBoard/GetholyRequestUser') + fetch('http://127.0.0.1:7979/DashBoard/GetholyRequestUser') .then(response => response.json()) .then(data => { let tableRows = ''; @@ -809,7 +809,7 @@ // 구매NR 목록 로드 function loadPurchaseNRList() { showLoading(); - fetch('http://127.0.0.1:9000/DashBoard/GetPurchaseNRList') + fetch('http://127.0.0.1:7979/DashBoard/GetPurchaseNRList') .then(response => response.json()) .then(data => { let tableRows = ''; @@ -884,7 +884,7 @@ // 구매CR 목록 로드 function loadPurchaseCRList() { showLoading(); - fetch('http://127.0.0.1:9000/DashBoard/GetPurchaseCRList') + fetch('http://127.0.0.1:7979/DashBoard/GetPurchaseCRList') .then(response => response.json()) .then(data => { let tableRows = ''; diff --git a/Project/Web/wwwroot/login.html b/Project/Web/wwwroot/login.html index 883f458..f61eb94 100644 --- a/Project/Web/wwwroot/login.html +++ b/Project/Web/wwwroot/login.html @@ -280,7 +280,7 @@ showLoading(); // HomeController의 로그인 API 호출 - fetch('http://127.0.0.1:9000/Home/Login', { + fetch('http://127.0.0.1:7979/Home/Login', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -373,7 +373,7 @@ // 그룹 목록 로드 function loadUserGroups() { - fetch('http://127.0.0.1:9000/DashBoard/GetUserGroups') + fetch('http://127.0.0.1:7979/DashBoard/GetUserGroups') .then(response => response.json()) .then(data => { const gcodeSelect = document.getElementById('gcode'); @@ -406,7 +406,7 @@ // 이전 로그인 정보 설정 function setPreviousLoginInfo() { // HomeController의 GetPreviousLoginInfo API 호출 - fetch('http://127.0.0.1:9000/Home/GetPreviousLoginInfo') + fetch('http://127.0.0.1:7979/Home/GetPreviousLoginInfo') .then(response => response.json()) .then(data => { if (data.Success && data.Data) { diff --git a/Project/fMain.Designer.cs b/Project/fMain.Designer.cs index a88143d..cbd7539 100644 --- a/Project/fMain.Designer.cs +++ b/Project/fMain.Designer.cs @@ -116,6 +116,8 @@ this.기타ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.품목검색ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.대쉬보드ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem17 = new System.Windows.Forms.ToolStripSeparator(); + this.webview2TestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.즐겨찾기ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.btDev = new System.Windows.Forms.ToolStripMenuItem(); this.purchaseImportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -149,8 +151,7 @@ this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); - this.toolStripMenuItem17 = new System.Windows.Forms.ToolStripSeparator(); - this.webview2TestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.sbWeb = new System.Windows.Forms.ToolStripStatusLabel(); this.cmTab.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -188,7 +189,8 @@ this.sbBCD, this.sbLogin, this.toolStripStatusLabel1, - this.sbLoginUseTime}); + this.sbLoginUseTime, + this.sbWeb}); this.statusStrip1.Location = new System.Drawing.Point(1, 622); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(1094, 22); @@ -850,17 +852,29 @@ // 품목검색ToolStripMenuItem // this.품목검색ToolStripMenuItem.Name = "품목검색ToolStripMenuItem"; - this.품목검색ToolStripMenuItem.Size = new System.Drawing.Size(180, 24); + this.품목검색ToolStripMenuItem.Size = new System.Drawing.Size(171, 24); this.품목검색ToolStripMenuItem.Text = "품목 검색"; this.품목검색ToolStripMenuItem.Click += new System.EventHandler(this.품목검색ToolStripMenuItem_Click); // // 대쉬보드ToolStripMenuItem // this.대쉬보드ToolStripMenuItem.Name = "대쉬보드ToolStripMenuItem"; - this.대쉬보드ToolStripMenuItem.Size = new System.Drawing.Size(180, 24); + this.대쉬보드ToolStripMenuItem.Size = new System.Drawing.Size(171, 24); this.대쉬보드ToolStripMenuItem.Text = "대쉬보드"; this.대쉬보드ToolStripMenuItem.Click += new System.EventHandler(this.대쉬보드ToolStripMenuItem_Click); // + // toolStripMenuItem17 + // + this.toolStripMenuItem17.Name = "toolStripMenuItem17"; + this.toolStripMenuItem17.Size = new System.Drawing.Size(168, 6); + // + // webview2TestToolStripMenuItem + // + this.webview2TestToolStripMenuItem.Name = "webview2TestToolStripMenuItem"; + this.webview2TestToolStripMenuItem.Size = new System.Drawing.Size(171, 24); + this.webview2TestToolStripMenuItem.Text = "Webview2 Test"; + this.webview2TestToolStripMenuItem.Click += new System.EventHandler(this.webview2TestToolStripMenuItem_Click); + // // 즐겨찾기ToolStripMenuItem // this.즐겨찾기ToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("즐겨찾기ToolStripMenuItem.Image"))); @@ -1161,17 +1175,11 @@ this.toolStripButton3.ToolTipText = "휴가신청"; this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click); // - // toolStripMenuItem17 + // sbWeb // - this.toolStripMenuItem17.Name = "toolStripMenuItem17"; - this.toolStripMenuItem17.Size = new System.Drawing.Size(177, 6); - // - // webview2TestToolStripMenuItem - // - this.webview2TestToolStripMenuItem.Name = "webview2TestToolStripMenuItem"; - this.webview2TestToolStripMenuItem.Size = new System.Drawing.Size(180, 24); - this.webview2TestToolStripMenuItem.Text = "Webview2 Test"; - this.webview2TestToolStripMenuItem.Click += new System.EventHandler(this.webview2TestToolStripMenuItem_Click); + this.sbWeb.Name = "sbWeb"; + this.sbWeb.Size = new System.Drawing.Size(31, 17); + this.sbWeb.Text = "WEB"; // // fMain // @@ -1324,6 +1332,7 @@ private System.Windows.Forms.ToolStripMenuItem 월별NRCR기준금액입력ToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem17; private System.Windows.Forms.ToolStripMenuItem webview2TestToolStripMenuItem; + private System.Windows.Forms.ToolStripStatusLabel sbWeb; } } diff --git a/Project/fMain.cs b/Project/fMain.cs index 507244a..1114869 100644 --- a/Project/fMain.cs +++ b/Project/fMain.cs @@ -151,7 +151,7 @@ namespace Project // Start OWIN host try { - var options = new StartOptions("http://127.0.0.1:9000"); + var options = new StartOptions(Pub.setting.WebServiceURL); webApp = WebApp.Start(options); Console.WriteLine("start webapp"); Pub.log.AddI("웹지원 서버 준비 완료"); @@ -167,7 +167,7 @@ namespace Project var wat = new System.Diagnostics.Stopwatch(); wat.Restart(); - while(true) + while (true) { if (Pub.InitWebView != 0) break; if (wat.ElapsedMilliseconds > 5000) break; @@ -176,10 +176,10 @@ namespace Project } f.Dispose(); - + Func_Login(); - + ///즐겨찾기 목록 갱신 Update_FavoriteSite(); @@ -217,7 +217,8 @@ namespace Project void Func_Login() { //Pub.InitWebView = 2; - if (Pub.InitWebView == 1) + this.sbWeb.Text = $"Host:{(webok ? "O" : "X")},WebView:{Pub.InitWebView}"; + if (webok && Pub.InitWebView == 1) { using (var f = new Dialog.fLogin_WB()) if (f.ShowDialog() != System.Windows.Forms.DialogResult.OK) @@ -1010,10 +1011,8 @@ namespace Project private void 품목검색ToolStripMenuItem_Click(object sender, EventArgs e) { - var url = "http://localhost:9000/item/find"; + var url = $"{Pub.setting.WebServiceURL}/item/find"; Util.RunExplorer(url); - //var f = new Dialog.fWebView("http://localhost:9000/item/find"); - //f.Show(); } @@ -1041,7 +1040,7 @@ namespace Project private void 설명서ToolStripMenuItem_Click(object sender, EventArgs e) { - Util.RunExplorer("http://127.0.0.1:9000/Manual"); + Util.RunExplorer($"{Pub.setting.WebServiceURL}/Manual"); } private void 라이선스ToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/Project/fMain.resx b/Project/fMain.resx index 7976280..eb22939 100644 --- a/Project/fMain.resx +++ b/Project/fMain.resx @@ -454,14 +454,14 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPY4CDmcasDEu1MxmW6ixgWKbTwrBYVx0svkqL h2GZViHDMu15QPFWhmXqUmBxDLBUZzVQwX84Xqzzg2GJpifDMs3rKOJLtZ4ADZWA6oKCpVo2IEmBtZb/ - /U7m/E+5XP8/92TF/3lzYj/U9OT/S73c8D/yXNl/1W1eUEO0+6A6oWCZzgT+NebHkq/Ufyu+1fO/5GbP + /U7m/E+5XP8/92TF/3lzYj/UdOf/S73c8D/yXNl/1W1eUEO0+6A6oWCZzgT+NebHkq/Ufyu+1fO/5GbP /0Mzc/4/6kz7f3VS5k+QGAyb7A49wbBE5xpUJxQs1RUsvtVdB1PUcaj+//XSiP/7W+3/Xi/0+tyzrRBu QPGtrgsg9VCdCFB8s3suTFHlpY5l5wtDDl5Odvt2MUjt/7YKp73FFzs+guQKbva8g2pBBTAXFN3sKQHx X7RGiD8u8/x/JUPrz5NsG7XCm736QNs/F93qOQ/WgA6K7/QYF9/oOg7lMjwu9vR8VOrxH4xLvDxAYkBX lgItagErwAaK73SLQZkMTyq8smAGPKn0zgSJ1d+v58i9NZEPrIAQeFTh2fek3Os/CD8u9+qFChMPgP7f CPdCqccGqDBx4P/+eo4XXVGn3/TE/Qfhl52Rp0BiUGns4N+Bfs2/B3r7/h/oPXP/QO9vIP0fGUPFzoDV - 7O/RgGoDatw2kR0oOP/CxPp/6JpwYZDavwd65oH0Mvzd39uLTRExGKQX6PQ+W6Bpy4ECq0jBID3/DvTZ - AgBXZap4/fGa+QAAAABJRU5ErkJggg== + 7O/RgGoDatw2kR0oOP/8hPp/6JpwYZDavwd65oH0Mvzd39uLTRExGKQX6PQ+W6Bpy4ECq0jBID3/DvTZ + AgBRa6pzQEH+NwAAAABJRU5ErkJggg== diff --git a/SubProject/FCOMMON/FCOMMON.csproj b/SubProject/FCOMMON/FCOMMON.csproj index 4d041d0..7ab83b5 100644 --- a/SubProject/FCOMMON/FCOMMON.csproj +++ b/SubProject/FCOMMON/FCOMMON.csproj @@ -72,6 +72,9 @@ ..\..\packages\Microsoft.SqlServer.Types.14.0.314.76\lib\net40\Microsoft.SqlServer.Types.dll + + ..\..\DLL\Newtonsoft.Json.dll + diff --git a/SubProject/FCOMMON/Util.cs b/SubProject/FCOMMON/Util.cs index e77588a..1549dc0 100644 --- a/SubProject/FCOMMON/Util.cs +++ b/SubProject/FCOMMON/Util.cs @@ -8,16 +8,200 @@ //180614 chi map 명령어 추가 using System; using System.Collections.Generic; +using System.Data; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Windows.Forms; -using static System.Windows.Forms.VisualStyles.VisualStyleElement; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace FCOMMON { + public static class AmkorRestfulService + { + + public class RestfulResultDataTable + { + /// + /// 오류 및 기타상황의 메세지 + /// + public string Message { get; set; } + + /// + /// Restful 의 실행이 완료되었는가? + /// + public Boolean Complete { get; set; } + + /// + /// Restful 실행 결과를 담고있는 RawBuffer + /// + public string Buffer { get; set; } + + /// + /// Restful Service 호출 URL + /// + public string Url { get; set; } + + + + /// + /// 결과값 + /// + public System.Data.DataTable Result { get; set; } + public RestfulResultDataTable() + { + Complete = false; + Message = string.Empty; + Buffer = string.Empty; + Url = string.Empty; + Result = new System.Data.DataTable(); + } + } + + /// + /// SPM사이트에서 SID검색을 합니다. + /// + /// + /// + public static RestfulResultDataTable SPMSIDSearch(string sid) + { + var retval = new RestfulResultDataTable(); + retval.Url = "https://atknet.amkor.co.kr/spm/getActiveInventoryBySid/{0}"; + retval.Url = string.Format(retval.Url, sid); + + Boolean isError; + + retval.Buffer = GetFromUrl(retval.Url, out isError); + + var cols = new string[] { "plant", "location", "quantity", "part_description", "batch_no", "serial", "costcenter", "responsible", "bin_location" }; + + retval.Result = new DataTable(); + foreach (var col in cols) + retval.Result.Columns.Add(col); + + try + { + var json = JArray.Parse(retval.Buffer); + List items = new List(); + string[] data = new string[cols.Length]; + + for (int i = 0; i < json.Count; i++) + { + var jdata = json[i]; + for (int c = 0; c < cols.Length; c++) + { + var itemdata = jdata[cols[c]]; + if (itemdata != null) data[c] = itemdata.ToString(); + + } + if (int.TryParse(data[2], out int value)) + { + if (value > 0) + retval.Result.Rows.Add(data); + + } + + } + retval.Complete = retval.Result.Rows.Count > 0; + } + catch + { + retval.Complete = false; + } + + retval.Result.AcceptChanges(); + + //if (retval.Buffer.ToLower().Contains("error") || isError) + //{ + // retval.Complete = false; + // retval.Message = retval.Buffer; + // RaiseMessage(true, "get_tms_info Error : " + retval.Buffer); + //} + //else + //{ + + //string tmpBuffer = retval.Buffer; + + //tmpBuffer = tmpBuffer.Replace((char)0x02, (char)0x0a); + //tmpBuffer = tmpBuffer.Replace((char)0x03, (char)0x09); + //retval.Result = GenerateDataTable(tmpBuffer); + //} + + return retval; + } + public class MessageEventArgs : EventArgs + { + public Boolean isError { get; set; } + public string Message { get; set; } + public MessageEventArgs(bool iserr_, string msg_) + { + this.isError = iserr_; + this.Message = msg_; + } + } + public static event EventHandler Message; + + /// + /// 웹서비스에서 받은 데이터 원문 메세지 입니다. + /// + public static event EventHandler RawMessage; + private static void RaiseMessage(Boolean iserr, string msg) + { + if (Message != null) + Message(null, new MessageEventArgs(iserr, msg)); + } + private static void RaiseRawMessage(string url, string msg) + { + if (RawMessage != null) + RawMessage(null, new MessageEventArgs(false, "URL : " + url + "\n" + msg)); + } + public static int timeout = 10000; + public static string LastQueryURL { get; private set; } + public static string LastQueryBUF { get; private set; } + + private static string GetFromUrl(string url, out Boolean isError, string authid = "", string authpw = "") + { + isError = false; + string result = ""; + try + { + RaiseMessage(false, "GET : " + url); + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url)); + request.Timeout = timeout; + request.ReadWriteTimeout = timeout; + + if (string.IsNullOrEmpty(authid) == false && string.IsNullOrEmpty(authpw) == false) + { + string authInfo = $"{authid}:{authpw}"; + authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo)); + request.Headers["Authorization"] = "Basic " + authInfo; + } + + request.MaximumAutomaticRedirections = 4; + request.MaximumResponseHeadersLength = 4; + request.Credentials = CredentialCache.DefaultCredentials; + var response = request.GetResponse() as HttpWebResponse; + var txtReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); + result = txtReader.ReadToEnd(); + + LastQueryBUF = result; + LastQueryURL = url; + RaiseRawMessage(url, "RESULT\n" + result); //181026 - show data + } + catch (Exception ex) + { + isError = true; + result = ex.Message.ToString(); + RaiseMessage(true, "GET-ERROR\n" + result); + LastQueryBUF = string.Empty; + } + + return result; + } + } public static partial class Util { diff --git a/SubProject/FEQ0000/PurchaseCR/fPurchaseCR.Designer.cs b/SubProject/FEQ0000/PurchaseCR/fPurchaseCR.Designer.cs index 86d31f4..2fbb39f 100644 --- a/SubProject/FEQ0000/PurchaseCR/fPurchaseCR.Designer.cs +++ b/SubProject/FEQ0000/PurchaseCR/fPurchaseCR.Designer.cs @@ -278,7 +278,6 @@ // this.bindingNavigatorPositionItem.AccessibleName = "위치"; this.bindingNavigatorPositionItem.AutoSize = false; - this.bindingNavigatorPositionItem.Font = new System.Drawing.Font("맑은 고딕", 9F); this.bindingNavigatorPositionItem.Name = "bindingNavigatorPositionItem"; this.bindingNavigatorPositionItem.Size = new System.Drawing.Size(50, 23); this.bindingNavigatorPositionItem.Text = "0"; @@ -405,7 +404,6 @@ // tbFind // this.tbFind.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.tbFind.Font = new System.Drawing.Font("맑은 고딕", 9F); this.tbFind.Name = "tbFind"; this.tbFind.Size = new System.Drawing.Size(100, 26); this.tbFind.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbFind_KeyDown); @@ -764,7 +762,6 @@ // dtSD // this.dtSD.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.dtSD.Font = new System.Drawing.Font("맑은 고딕", 9F); this.dtSD.Name = "dtSD"; this.dtSD.Size = new System.Drawing.Size(75, 37); this.dtSD.Text = "1982-11-23"; @@ -781,7 +778,6 @@ // dtED // this.dtED.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.dtED.Font = new System.Drawing.Font("맑은 고딕", 9F); this.dtED.Name = "dtED"; this.dtED.Size = new System.Drawing.Size(75, 37); this.dtED.Text = "1982-11-23"; @@ -838,7 +834,6 @@ // tbRequest // this.tbRequest.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.tbRequest.Font = new System.Drawing.Font("맑은 고딕", 9F); this.tbRequest.Name = "tbRequest"; this.tbRequest.Size = new System.Drawing.Size(70, 37); this.tbRequest.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Center; @@ -853,7 +848,6 @@ // tbManager // this.tbManager.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.tbManager.Font = new System.Drawing.Font("맑은 고딕", 9F); this.tbManager.Name = "tbManager"; this.tbManager.Size = new System.Drawing.Size(70, 37); this.tbManager.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Center; @@ -867,7 +861,6 @@ // tbAdmin // this.tbAdmin.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.tbAdmin.Font = new System.Drawing.Font("맑은 고딕", 9F); this.tbAdmin.Name = "tbAdmin"; this.tbAdmin.Size = new System.Drawing.Size(70, 37); this.tbAdmin.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Center; diff --git a/SubProject/FEQ0000/PurchaseCR/fPurchaseCR_Add.cs b/SubProject/FEQ0000/PurchaseCR/fPurchaseCR_Add.cs index 977d509..96aadca 100644 --- a/SubProject/FEQ0000/PurchaseCR/fPurchaseCR_Add.cs +++ b/SubProject/FEQ0000/PurchaseCR/fPurchaseCR_Add.cs @@ -1131,7 +1131,7 @@ namespace FEQ0000 return; } - var dt = Amkor.RestfulService.SPMSIDSearch(sid); + var dt = AmkorRestfulService.SPMSIDSearch(sid); if (dt.Complete) { var f = new FCM0000.fSIDListSelect(sid, dt.Result); diff --git a/SubProject/FEQ0000/PurchaseNR/fPurchase_Add.cs b/SubProject/FEQ0000/PurchaseNR/fPurchase_Add.cs index 7bb9b8c..6d115e2 100644 --- a/SubProject/FEQ0000/PurchaseNR/fPurchase_Add.cs +++ b/SubProject/FEQ0000/PurchaseNR/fPurchase_Add.cs @@ -1280,7 +1280,7 @@ namespace FEQ0000 return; } - var dt = Amkor.RestfulService.SPMSIDSearch(sid); + var dt = AmkorRestfulService.SPMSIDSearch(sid); if (dt.Complete) { var f = new FCM0000.fSIDListSelect(sid, dt.Result); diff --git a/SubProject/FEQ0000/PurchaseNR/fSIDCheckNR.cs b/SubProject/FEQ0000/PurchaseNR/fSIDCheckNR.cs index b073dfd..6301f4c 100644 --- a/SubProject/FEQ0000/PurchaseNR/fSIDCheckNR.cs +++ b/SubProject/FEQ0000/PurchaseNR/fSIDCheckNR.cs @@ -132,7 +132,7 @@ namespace FEQ0000.Purchase } else { - var dt = Amkor.RestfulService.SPMSIDSearch(sid); + var dt = AmkorRestfulService.SPMSIDSearch(sid); if (dt.Complete) { dr.sitecnt = $"{dt.Result.Rows.Count}건"; @@ -166,7 +166,7 @@ namespace FEQ0000.Purchase } else { - var dt = Amkor.RestfulService.SPMSIDSearch(sid); + var dt = AmkorRestfulService.SPMSIDSearch(sid); if (dt.Complete) { dr.sitecnt = $"{dt.Result.Rows.Count}건"; diff --git a/SubProject/FPJ0000/Project/fProjectPartToPurchaseCR.cs b/SubProject/FPJ0000/Project/fProjectPartToPurchaseCR.cs index 3367062..56d99cb 100644 --- a/SubProject/FPJ0000/Project/fProjectPartToPurchaseCR.cs +++ b/SubProject/FPJ0000/Project/fProjectPartToPurchaseCR.cs @@ -687,7 +687,7 @@ namespace FPJ0000 } else { - var dt = Amkor.RestfulService.SPMSIDSearch(sid); + var dt = AmkorRestfulService.SPMSIDSearch(sid); if (dt.Complete) { row.Cells["dvc_spm"].Value = $"{dt.Result.Rows.Count}건"; @@ -734,7 +734,7 @@ namespace FPJ0000 } else { - var dt = Amkor.RestfulService.SPMSIDSearch(sid); + var dt = AmkorRestfulService.SPMSIDSearch(sid); if (dt.Complete) { dv1.Rows[e.RowIndex].Cells["dvc_spm"].Value = $"{dt.Result.Rows.Count}건";