From 1d7a24adbe192b968aa311394860ed2bafe6cf92 Mon Sep 17 00:00:00 2001 From: chi Date: Thu, 12 Nov 2020 13:11:04 +0900 Subject: [PATCH] =?UTF-8?q?chat=20=EC=84=9C=EB=B2=84=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EETGW.sln | 11 +++ Project/AdoNetEFMain.Context.cs | 1 + Project/AdoNetEFMain.edmx | 44 ++++++++- Project/AdoNetEFMain.edmx.diagram | 1 + Project/Dialog/fChat.Designer.cs | 102 ++++++++++++++++++++ Project/Dialog/fChat.cs | 91 ++++++++++++++++++ Project/Dialog/fChat.resx | 120 ++++++++++++++++++++++++ Project/Dialog/fLogin.cs | 74 ++++++++++++--- Project/EETGW.csproj | 19 ++++ Project/EETGW_LoginInfo.cs | 25 +++++ Project/Properties/AssemblyInfo.cs | 4 +- Project/Pub.cs | 9 +- Project/StateMachine/_TMDisplay.cs | 7 ++ Project/dsMSSQL.cs | 9 +- Project/fMain.Designer.cs | 23 +++-- Project/fMain.cs | 86 ++++++++++++----- Project/fMain.resx | 20 ++-- Sub/tcpservice | 1 + SubProject/FBS0000/Holiday/WorkTable.cs | 2 +- SubProject/FBS0000/Holiday/fHolyday.cs | 32 ++++--- SubProject/FBS0000/dsMSSQL.Designer.cs | 56 ++++++++--- SubProject/FBS0000/dsMSSQL.xsd | 12 ++- 22 files changed, 659 insertions(+), 90 deletions(-) create mode 100644 Project/Dialog/fChat.Designer.cs create mode 100644 Project/Dialog/fChat.cs create mode 100644 Project/Dialog/fChat.resx create mode 100644 Project/EETGW_LoginInfo.cs create mode 160000 Sub/tcpservice diff --git a/EETGW.sln b/EETGW.sln index 5a26a9a..028af5b 100644 --- a/EETGW.sln +++ b/EETGW.sln @@ -35,6 +35,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "arControl", "Sub\arCtl\arCo EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmkorRestfulService", "Sub\AmkorRestfulService\AmkorRestfulService.csproj", "{58CFC90C-5068-46A2-A8DE-0E92EE9E0990}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "arTCPService.Shared", "Sub\tcpservice\arTCPService.Shared\arTCPService.Shared.csproj", "{3CD79316-211A-4B57-A6B4-00FA6091C29D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -137,6 +139,14 @@ Global {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 + {3CD79316-211A-4B57-A6B4-00FA6091C29D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3CD79316-211A-4B57-A6B4-00FA6091C29D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3CD79316-211A-4B57-A6B4-00FA6091C29D}.Debug|x86.ActiveCfg = Debug|Any CPU + {3CD79316-211A-4B57-A6B4-00FA6091C29D}.Debug|x86.Build.0 = Debug|Any CPU + {3CD79316-211A-4B57-A6B4-00FA6091C29D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3CD79316-211A-4B57-A6B4-00FA6091C29D}.Release|Any CPU.Build.0 = Release|Any CPU + {3CD79316-211A-4B57-A6B4-00FA6091C29D}.Release|x86.ActiveCfg = Release|Any CPU + {3CD79316-211A-4B57-A6B4-00FA6091C29D}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -153,6 +163,7 @@ Global {D01A7891-AD0B-489B-8C45-F598C875FE26} = {6C7EC99E-7367-4255-A039-EF5E8D75A2F6} {F31C242C-1B15-4518-9733-48558499FE4B} = {28105E67-9D33-4627-8E26-FCE67700622F} {58CFC90C-5068-46A2-A8DE-0E92EE9E0990} = {28105E67-9D33-4627-8E26-FCE67700622F} + {3CD79316-211A-4B57-A6B4-00FA6091C29D} = {28105E67-9D33-4627-8E26-FCE67700622F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B5B1FD72-356F-4840-83E8-B070AC21C8D9} diff --git a/Project/AdoNetEFMain.Context.cs b/Project/AdoNetEFMain.Context.cs index acce4f9..40cf187 100644 --- a/Project/AdoNetEFMain.Context.cs +++ b/Project/AdoNetEFMain.Context.cs @@ -29,5 +29,6 @@ namespace Project public virtual DbSet UserGroup { get; set; } public virtual DbSet Users { get; set; } public virtual DbSet vGroupUser { get; set; } + public virtual DbSet EETGW_LoginInfo { get; set; } } } diff --git a/Project/AdoNetEFMain.edmx b/Project/AdoNetEFMain.edmx index b984f31..34c0f3b 100644 --- a/Project/AdoNetEFMain.edmx +++ b/Project/AdoNetEFMain.edmx @@ -4,7 +4,7 @@ - + @@ -17,6 +17,18 @@ + + + + + + + + + + + + @@ -80,6 +92,7 @@ + @@ -105,8 +118,7 @@ FROM [dbo].[vGroupUser] AS [vGroupUser] - - + @@ -186,7 +198,20 @@ + + + + + + + + + + + + + @@ -268,6 +293,19 @@ + + + + + + + + + + + + + diff --git a/Project/AdoNetEFMain.edmx.diagram b/Project/AdoNetEFMain.edmx.diagram index a829ade..3163694 100644 --- a/Project/AdoNetEFMain.edmx.diagram +++ b/Project/AdoNetEFMain.edmx.diagram @@ -9,6 +9,7 @@ + diff --git a/Project/Dialog/fChat.Designer.cs b/Project/Dialog/fChat.Designer.cs new file mode 100644 index 0000000..da53059 --- /dev/null +++ b/Project/Dialog/fChat.Designer.cs @@ -0,0 +1,102 @@ +namespace Project.Dialog +{ + partial class fChat + { + /// + /// 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.panel4 = new System.Windows.Forms.Panel(); + this.tbMsg = new System.Windows.Forms.TextBox(); + this.btnSend = new System.Windows.Forms.Button(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + this.panel4.SuspendLayout(); + this.SuspendLayout(); + // + // panel4 + // + this.panel4.Controls.Add(this.tbMsg); + this.panel4.Controls.Add(this.btnSend); + this.panel4.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel4.Location = new System.Drawing.Point(0, 500); + this.panel4.Name = "panel4"; + this.panel4.Padding = new System.Windows.Forms.Padding(5); + this.panel4.Size = new System.Drawing.Size(444, 40); + this.panel4.TabIndex = 0; + // + // tbMsg + // + this.tbMsg.Dock = System.Windows.Forms.DockStyle.Fill; + this.tbMsg.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.tbMsg.Location = new System.Drawing.Point(5, 5); + this.tbMsg.Name = "tbMsg"; + this.tbMsg.Size = new System.Drawing.Size(335, 29); + this.tbMsg.TabIndex = 0; + // + // btnSend + // + this.btnSend.Dock = System.Windows.Forms.DockStyle.Right; + this.btnSend.Location = new System.Drawing.Point(340, 5); + this.btnSend.Name = "btnSend"; + this.btnSend.Size = new System.Drawing.Size(99, 30); + this.btnSend.TabIndex = 1; + this.btnSend.Text = "전송"; + this.btnSend.UseVisualStyleBackColor = true; + // + // richTextBox1 + // + this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.richTextBox1.Location = new System.Drawing.Point(0, 0); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.ReadOnly = true; + this.richTextBox1.Size = new System.Drawing.Size(444, 500); + this.richTextBox1.TabIndex = 1; + this.richTextBox1.TabStop = false; + this.richTextBox1.Text = ""; + // + // fChat + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(444, 540); + this.Controls.Add(this.richTextBox1); + this.Controls.Add(this.panel4); + this.Name = "fChat"; + this.Text = "fChat"; + this.Load += new System.EventHandler(this.fChat_Load); + this.panel4.ResumeLayout(false); + this.panel4.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.TextBox tbMsg; + private System.Windows.Forms.Button btnSend; + private System.Windows.Forms.RichTextBox richTextBox1; + } +} \ No newline at end of file diff --git a/Project/Dialog/fChat.cs b/Project/Dialog/fChat.cs new file mode 100644 index 0000000..68c37b3 --- /dev/null +++ b/Project/Dialog/fChat.cs @@ -0,0 +1,91 @@ +using arTCPService.Shared.Messages; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Project.Dialog +{ + public partial class fChat : Form + { + + arTCPService.Server.Receiver client; + public fChat(arTCPService.Server.Receiver client_) + { + InitializeComponent(); + this.client = client_; + this.client.DataSend += Svr_DataSend; + this.client.DataReceived += Svr_DataReceived; + this.client.ClientDisconnected += Svr_ClientDisconnected; + this.client.Message += Svr_Message; + this.FormClosed += FChat_FormClosed; + this.KeyDown += (s1, e1) => + { + if (e1.KeyCode == Keys.Escape) this.Close(); + }; + + tbMsg.KeyDown += (s1, e1) => { if (e1.KeyCode == Keys.Enter) btnSend.PerformClick(); }; + btnSend.Click += (s1, e1) => + { + this.client.SendMessage(new Packet(Header.Message, tbMsg.Text)); + tbMsg.SelectAll(); + tbMsg.Focus(); + }; + } + + private void FChat_FormClosed(object sender, FormClosedEventArgs e) + { + this.client.DataSend -= Svr_DataSend; + this.client.DataReceived -= Svr_DataReceived; + this.client.ClientDisconnected -= Svr_ClientDisconnected; + this.client.Message -= Svr_Message; + } + + private void Svr_DataSend(arTCPService.Server.Receiver arg1, arTCPService.Shared.Messages.Packet arg2) + { + if (arg2.header == arTCPService.Shared.Messages.Header.Message) + addLog("발신:" + arg2.Message); + } + + private void Svr_Message(arTCPService.Server.Receiver arg1, string arg2, bool arg3) + { + addLog("시스템메세지:" + arg2); + } + + private void Svr_ClientDisconnected(arTCPService.Server.Receiver obj) + { + addLog("연결종료"); + } + + private void Svr_DataReceived(arTCPService.Server.Receiver arg1, arTCPService.Shared.Messages.Packet arg2) + { + if (arg2.header == arTCPService.Shared.Messages.Header.Message) + { + addLog("수신:" + arg2.Message); + } + } + + private void fChat_Load(object sender, EventArgs e) + { + addLog("채팅이 시작되었습니다 :" + this.client.ID); + } + private void InvokeUI(Action action) + { + this.Invoke(action); + } + + void addLog(string m) + { + richTextBox1.Invoke(new Action(() => + { + this.richTextBox1.AppendText(m + "\r\n"); + this.richTextBox1.ScrollToCaret(); + })); + } + } +} diff --git a/Project/Dialog/fChat.resx b/Project/Dialog/fChat.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/Project/Dialog/fChat.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/Dialog/fLogin.cs b/Project/Dialog/fLogin.cs index 7b61e67..9d9a36f 100644 --- a/Project/Dialog/fLogin.cs +++ b/Project/Dialog/fLogin.cs @@ -4,6 +4,8 @@ using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; +using System.Net; +using System.Net.NetworkInformation; using System.Text; using System.Windows.Forms; @@ -17,7 +19,8 @@ namespace Project.Dialog this.tbID.KeyDown += (s1, e1) => { if (e1.KeyCode == Keys.Enter) tbPW.Focus(); }; this.tbPW.KeyDown += (s1, e1) => { if (e1.KeyCode == Keys.Enter) btLogin.PerformClick(); }; this.KeyPreview = true; - this.KeyDown += (s1, e1) => { + this.KeyDown += (s1, e1) => + { if (e1.KeyCode == Keys.Escape) this.Close(); }; } @@ -37,7 +40,7 @@ namespace Project.Dialog //마지막으로사용한 부서이름 if (Pub.setting.lastdpt.isEmpty()) this.cmbDept.SelectedIndex = -1; - else this.cmbDept.Text =Pub.setting.lastdpt; + else this.cmbDept.Text = Pub.setting.lastdpt; //foreach (var item in dlist) // if (item != "") this.cmbDept.Items.Add(item); //if (cmbDept.Items.Count > 0) cmbDept.SelectedIndex = 0; @@ -50,18 +53,18 @@ namespace Project.Dialog } private void button1_Click(object sender, EventArgs e) { - + if (this.tbID.Text.isEmpty()) { tbID.Focus(); return; } - if(this.tbPW.Text.isEmpty()) + if (this.tbPW.Text.isEmpty()) { tbPW.Focus(); return; } - if(cmbDept.SelectedIndex < 0) + if (cmbDept.SelectedIndex < 0) { FCOMMON.Util.MsgE("소속 부서를 선택하세요"); cmbDept.Focus(); @@ -97,11 +100,11 @@ namespace Project.Dialog var ta = new dsMSSQLTableAdapters.UsersTableAdapter(); try { - var users = ta.GetIDPW(encpass, tbID.Text.Trim()); + var users = ta.GetIDPW(encpass, tbID.Text.Trim()); if (users.Rows.Count != 1) { users = ta.GetByNamePw(tbID.Text.Trim(), encpass); - if(users.Rows.Count != 1) + if (users.Rows.Count != 1) { Util.MsgE("입력한 사용자 계정이 존재하지 않습니다"); tbPW.SelectAll(); @@ -114,7 +117,7 @@ namespace Project.Dialog var userdr = users.Rows[0] as dsMSSQL.UsersRow; var taGrpUser = new dsMSSQLTableAdapters.EETGW_GroupUserTableAdapter(); var Exist = taGrpUser.ExistCheck(gCode, userdr.id) > 0; - if (userdr.level < 9 && Exist==false) + if (userdr.level < 9 && Exist == false) { Util.MsgE("입력한 사용자는 지정한 부서에 접속할 권한이 없습니다"); return; @@ -136,18 +139,65 @@ namespace Project.Dialog FCOMMON.info.Login.permission = 0; FCOMMON.info.Login.gpermission = int.Parse(gperm); + //로그인정보 기록 + AddLoginInfo(); + + DialogResult = DialogResult.OK; - }catch (Exception ex) + } + catch (Exception ex) { - Util.MsgE("데이터베이스 조회 실패 다음 오류 메세지를 참고하세요.\n\n"+ ex.Message + "\n\n증상이 동일 할 경우 서버가 접속가능한지 먼저 확인하세요"); + Util.MsgE("데이터베이스 조회 실패 다음 오류 메세지를 참고하세요.\n\n" + ex.Message + "\n\n증상이 동일 할 경우 서버가 접속가능한지 먼저 확인하세요"); DialogResult = System.Windows.Forms.DialogResult.Cancel; } - + + } + + void AddLoginInfo() + { + string ip = string.Empty; + string hostname = Dns.GetHostName(); + string fullname = System.Net.Dns.GetHostEntry("").HostName; + + var nif = NetworkInterface.GetAllNetworkInterfaces(); + var host = Dns.GetHostEntry(hostname); + foreach (IPAddress r in host.AddressList) + { + string str = r.ToString(); + + if (str != "" && str.Substring(0, 3) == "10.") + { + ip = str; + break; + } + } + + if (ip == "" || hostname == "") return; + + try + { + var db = new EEEntitiesMain(); + db.EETGW_LoginInfo.Add(new EETGW_LoginInfo + { + uid = FCOMMON.info.Login.no, + hostname = fullname, + ip = ip, + login = DateTime.Now, + wuid = FCOMMON.info.Login.no, + wdate = DateTime.Now + }); + db.SaveChanges(); + } + catch (Exception ex) + { + FCOMMON.Util.MsgE(ex.Message); + Console.WriteLine(ex.Message); + } } private void label3_Click(object sender, EventArgs e) { - + } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) diff --git a/Project/EETGW.csproj b/Project/EETGW.csproj index ce091f3..8eb5d74 100644 --- a/Project/EETGW.csproj +++ b/Project/EETGW.csproj @@ -188,6 +188,12 @@ DataSet1.xsd + + Form + + + fChat.cs + Form @@ -236,6 +242,9 @@ PMPUpdate.cs + + dsMSSQL.xsd + True True @@ -249,6 +258,9 @@ AdoNetEFMain.tt + + AdoNetEFMain.tt + Form @@ -341,6 +353,9 @@ Form + + fChat.cs + fDebug.cs @@ -547,6 +562,10 @@ {b832738c-74dd-4ce2-8a29-98d0bcbb9ea4} StaffLayoutCtl + + {3cd79316-211a-4b57-a6b4-00fa6091c29d} + arTCPService.Shared + diff --git a/Project/EETGW_LoginInfo.cs b/Project/EETGW_LoginInfo.cs new file mode 100644 index 0000000..a06c76b --- /dev/null +++ b/Project/EETGW_LoginInfo.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// +// 이 코드는 템플릿에서 생성되었습니다. +// +// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다. +// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다. +// +//------------------------------------------------------------------------------ + +namespace Project +{ + using System; + using System.Collections.Generic; + + public partial class EETGW_LoginInfo + { + public int idx { get; set; } + public string uid { get; set; } + public Nullable login { get; set; } + public string ip { get; set; } + public string hostname { get; set; } + public string wuid { get; set; } + public Nullable wdate { get; set; } + } +} diff --git a/Project/Properties/AssemblyInfo.cs b/Project/Properties/AssemblyInfo.cs index e3baec9..7348eb8 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("20.10.29.1100")] -[assembly: AssemblyFileVersion("20.10.29.1100")] +[assembly: AssemblyVersion("20.11.12.1100")] +[assembly: AssemblyFileVersion("20.11.12.1100")] diff --git a/Project/Pub.cs b/Project/Pub.cs index 4d070f3..deb7170 100644 --- a/Project/Pub.cs +++ b/Project/Pub.cs @@ -108,7 +108,7 @@ namespace Project } } - public static void CheckNRegister2(string prgmName, string develop, string prgmVersion) + public static void CheckNRegister3(string prgmName, string develop, string prgmVersion) { if (prgmName.Length > 50) prgmName = prgmName.Substring(0, 50); //길이제한 var task = Task.Factory.StartNew(() => @@ -121,6 +121,7 @@ namespace Project var nif = NetworkInterface.GetAllNetworkInterfaces(); var host = Dns.GetHostEntry(Dns.GetHostName()); + string fullname = System.Net.Dns.GetHostEntry("").HostName; foreach (IPAddress r in host.AddressList) { string str = r.ToString(); @@ -153,7 +154,7 @@ namespace Project SqlConnection conn = new SqlConnection("Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=Amkor123!"); conn.Open(); - string ProcName = "AddPrgmUser2"; + string ProcName = "AddPrgmUser3"; SqlCommand cmd = new SqlCommand(ProcName, conn); cmd.CommandType = CommandType.StoredProcedure; @@ -178,8 +179,8 @@ namespace Project param = cmd.Parameters.Add("@account", SqlDbType.NVarChar, 50); param.Value = System.Environment.UserName; - - + param = cmd.Parameters.Add("@hostname", SqlDbType.NVarChar, 100); + param.Value = fullname; cmd.ExecuteNonQuery(); conn.Close(); diff --git a/Project/StateMachine/_TMDisplay.cs b/Project/StateMachine/_TMDisplay.cs index e4f5954..fe2fe29 100644 --- a/Project/StateMachine/_TMDisplay.cs +++ b/Project/StateMachine/_TMDisplay.cs @@ -23,6 +23,13 @@ namespace Project } else sbBWRun.BackColor = Color.Red; sbBCD.BackColor = Pub.barcode.IsInit ? Color.Lime : Color.Red; + + if (server != null) + { + if (server.IsStarted) lbSvr.ForeColor = Color.Lime; + else lbSvr.ForeColor = Color.Magenta; + } + else lbSvr.ForeColor = Color.Red; //if (redisConnection == null) this.sbRedis.ForeColor = Color.DimGray; //else if (redisConnection.IsConnected) //{ diff --git a/Project/dsMSSQL.cs b/Project/dsMSSQL.cs index 5f28270..eae2ed9 100644 --- a/Project/dsMSSQL.cs +++ b/Project/dsMSSQL.cs @@ -1 +1,8 @@ - \ No newline at end of file +namespace Project +{ + + + partial class dsMSSQL + { + } +} diff --git a/Project/fMain.Designer.cs b/Project/fMain.Designer.cs index 70146ab..66c5d9a 100644 --- a/Project/fMain.Designer.cs +++ b/Project/fMain.Designer.cs @@ -107,6 +107,7 @@ this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripButton4 = new System.Windows.Forms.ToolStripButton(); + this.lbSvr = new System.Windows.Forms.ToolStripStatusLabel(); this.cmTab.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -153,6 +154,7 @@ // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.sbBWRun, + this.lbSvr, this.sbBCD, this.sbLogin}); this.statusStrip1.Location = new System.Drawing.Point(1, 622); @@ -372,33 +374,33 @@ // dataFOLToolStripMenuItem // this.dataFOLToolStripMenuItem.Name = "dataFOLToolStripMenuItem"; - this.dataFOLToolStripMenuItem.Size = new System.Drawing.Size(180, 24); + this.dataFOLToolStripMenuItem.Size = new System.Drawing.Size(162, 24); this.dataFOLToolStripMenuItem.Text = "FOL"; this.dataFOLToolStripMenuItem.Click += new System.EventHandler(this.dataFOLToolStripMenuItem_Click); // // dataMoldEOLToolStripMenuItem // this.dataMoldEOLToolStripMenuItem.Name = "dataMoldEOLToolStripMenuItem"; - this.dataMoldEOLToolStripMenuItem.Size = new System.Drawing.Size(180, 24); + this.dataMoldEOLToolStripMenuItem.Size = new System.Drawing.Size(162, 24); this.dataMoldEOLToolStripMenuItem.Text = "MOLD & EOL"; this.dataMoldEOLToolStripMenuItem.Click += new System.EventHandler(this.dataMoldEOLToolStripMenuItem_Click); // // dataToolStripMenuItem // this.dataToolStripMenuItem.Name = "dataToolStripMenuItem"; - this.dataToolStripMenuItem.Size = new System.Drawing.Size(180, 24); + this.dataToolStripMenuItem.Size = new System.Drawing.Size(162, 24); this.dataToolStripMenuItem.Text = "BUMP"; this.dataToolStripMenuItem.Click += new System.EventHandler(this.dataToolStripMenuItem_Click); // // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem2.Size = new System.Drawing.Size(159, 6); // // 라인코드관리ToolStripMenuItem // this.라인코드관리ToolStripMenuItem.Name = "라인코드관리ToolStripMenuItem"; - this.라인코드관리ToolStripMenuItem.Size = new System.Drawing.Size(180, 24); + this.라인코드관리ToolStripMenuItem.Size = new System.Drawing.Size(162, 24); this.라인코드관리ToolStripMenuItem.Text = "라인코드관리"; this.라인코드관리ToolStripMenuItem.Click += new System.EventHandler(this.라인코드관리ToolStripMenuItem_Click); // @@ -417,14 +419,14 @@ // 근태입력ToolStripMenuItem // this.근태입력ToolStripMenuItem.Name = "근태입력ToolStripMenuItem"; - this.근태입력ToolStripMenuItem.Size = new System.Drawing.Size(180, 24); + this.근태입력ToolStripMenuItem.Size = new System.Drawing.Size(148, 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(148, 24); this.근로명부ToolStripMenuItem.Text = "근로자명부"; this.근로명부ToolStripMenuItem.Click += new System.EventHandler(this.근로명부ToolStripMenuItem_Click); // @@ -766,6 +768,12 @@ this.toolStripButton4.ToolTipText = "PMP 자료 보기(베타)"; this.toolStripButton4.Click += new System.EventHandler(this.toolStripButton4_Click_1); // + // lbSvr + // + this.lbSvr.Name = "lbSvr"; + this.lbSvr.Size = new System.Drawing.Size(19, 17); + this.lbSvr.Text = "●"; + // // fMain // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -875,6 +883,7 @@ private System.Windows.Forms.ToolStripMenuItem 휴가관리ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 근태입력ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 근로명부ToolStripMenuItem; + private System.Windows.Forms.ToolStripStatusLabel lbSvr; } } diff --git a/Project/fMain.cs b/Project/fMain.cs index 4d06b9e..f0fafe4 100644 --- a/Project/fMain.cs +++ b/Project/fMain.cs @@ -1,4 +1,5 @@ -using System; +using arTCPService.Server; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -13,9 +14,12 @@ namespace Project public partial class fMain : Form { string SearchKey = string.Empty; + arTCPService.Server.Server server; + public fMain() { InitializeComponent(); + server = new Server(); this.KeyDown += (s1, e1) => { if (e1.KeyCode == Keys.F12) btSetting.PerformClick(); @@ -36,6 +40,35 @@ namespace Project this.MouseMove += (s1, e1) => { if (DateTime.Now > Pub.LastInputTime) Pub.LastInputTime = DateTime.Now; }; this.FormClosing += __Closing; + this.FormClosed += FMain_FormClosed; + this.server.ClientConnected += Server_ClientConnected; + } + + private void Server_ClientConnected(Receiver receiver) + { + this.BeginInvoke(new Action(()=> { + var f = new Dialog.fChat(receiver); + f.Show(); + f.Activate(); + })); + } + + private void FMain_FormClosed(object sender, FormClosedEventArgs e) + { + if (server != null) + server.CloseChild(); + //연결종료 + //try + //{ + // var db = new EEEntitiesMain(); + // var dr = db.EETGW_LoginInfo.Where(t => t.uid == FCOMMON.info.Login.no).FirstOrDefault(); + // if (dr != null) + // { + // db.EETGW_LoginInfo.Remove(dr); + // db.SaveChanges(); + // } + //} + //catch { } } private void __Closing(object sender, FormClosingEventArgs e) @@ -70,7 +103,7 @@ namespace Project Pub.init(); setToolbar(); - + _SetLang(); if (Pub.setting.FullScreen) this.WindowState = FormWindowState.Maximized; @@ -91,10 +124,19 @@ namespace Project Update_Site(); bw.RunWorkerAsync(); //background worker - - //사용기록추적 - Pub.CheckNRegister2(Application.ProductName, "chi", Application.ProductVersion); + Pub.CheckNRegister3(Application.ProductName, "chi", Application.ProductVersion); + + //서버ON + try + { + this.server.Start(7979);//기본 79포트로 설정한다 + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } void Update_Site() { @@ -131,7 +173,7 @@ namespace Project this.mn_eq.Visible = FCOMMON.Util.getBit(FCOMMON.info.Login.gpermission, (int)FCOMMON.eGroupPermission.menu_equipment); this.mn_kuntae.Visible = FCOMMON.Util.getBit(FCOMMON.info.Login.gpermission, (int)FCOMMON.eGroupPermission.menu_workday); this.mn_docu.Visible = FCOMMON.Util.getBit(FCOMMON.info.Login.gpermission, (int)FCOMMON.eGroupPermission.menu_docu); - //this.mn_logdata.Visible = FCOMMON.Util.getBit(FCOMMON.info.Login.gpermission, (int)FCOMMON.eGroupPermission.menu_logdata); + //this.mn_logdata.Visible = FCOMMON.Util.getBit(FCOMMON.info.Login.gpermission, (int)FCOMMON.eGroupPermission.menu_logdata); if (FCOMMON.info.Login.level >= 10) btDev.Visible = true; @@ -157,7 +199,7 @@ namespace Project var menu_logdata = FCOMMON.Util.getBit(FCOMMON.info.Login.gpermission, (int)FCOMMON.eGroupPermission.menu_logdata); - // Menu_Note(); + // Menu_Note(); //시작폼 확인 if (Pub.setting.startForm == eFormList.NR구매관리 && menu_purchaseVisible == true) @@ -180,7 +222,7 @@ namespace Project { Menu_InventoryList(); } - else if(Pub.setting.startForm == eFormList.근태입력) + else if (Pub.setting.startForm == eFormList.근태입력) { Menu_WorkTable(); } @@ -802,10 +844,10 @@ namespace Project if (!ShowForm(formkey)) AddForm(formkey, new FCM0000.fMailform()); } - + private void mn_logdata_Click(object sender, EventArgs e) { - + } private void 임의테이블조작ToolStripMenuItem_Click(object sender, EventArgs e) @@ -852,16 +894,16 @@ namespace Project var supplyname = cmdupdate.ExecuteScalar().ToString().Trim(); if (supplyname != "") { - cmdupdate.CommandText = "update Purchase set supply=@supply where pdate = '2019-08-01' and orderno = '210000657' and sid='" + sid + "'" ; + cmdupdate.CommandText = "update Purchase set supply=@supply where pdate = '2019-08-01' and orderno = '210000657' and sid='" + sid + "'"; cmdupdate.Parameters["supply"].Value = supplyname; if (cmdupdate.ExecuteNonQuery() > 0) sidOK = true; } } } - - if(sidOK == false && itemname != "") + + if (sidOK == false && itemname != "") { - if(itemname == "FIBER SENSOR(반사형)") + if (itemname == "FIBER SENSOR(반사형)") { } @@ -873,12 +915,12 @@ namespace Project var supplyname = data.ToString().Trim(); if (supplyname != "") { - cmdupdate.CommandText = "update Purchase set supply=@supply where pdate = '2019-08-01' and orderno = '210000657' and pumname='" + itemname + "' and isnull(pumscale,'') = '"+ itemmodel +"'"; + cmdupdate.CommandText = "update Purchase set supply=@supply where pdate = '2019-08-01' and orderno = '210000657' and pumname='" + itemname + "' and isnull(pumscale,'') = '" + itemmodel + "'"; cmdupdate.Parameters["supply"].Value = supplyname; - var cnt1 = cmdupdate.ExecuteNonQuery(); + var cnt1 = cmdupdate.ExecuteNonQuery(); } } - + } } @@ -898,28 +940,28 @@ namespace Project private void sMTRepairLogToolStripMenuItem_Click(object sender, EventArgs e) { - + } private void 메일양식ToolStripMenuItem_Click(object sender, EventArgs e) { string formkey = "MAILFORM"; if (!ShowForm(formkey)) - AddForm(formkey, new FCM0000.fMailform()); + AddForm(formkey, new FCM0000.fMailform()); } private void 메일전송ToolStripMenuItem1_Click(object sender, EventArgs e) { string formkey = "AUTOMAIL"; if (!ShowForm(formkey)) - AddForm(formkey, new FCM0000.Mail.fAutoSendSetting()); + AddForm(formkey, new FCM0000.Mail.fAutoSendSetting()); } private void 메일내역ToolStripMenuItem_Click(object sender, EventArgs e) { string formkey = "MAILLIST"; if (!ShowForm(formkey)) - AddForm(formkey, new FCM0000.Mail.fMailList()); + AddForm(formkey, new FCM0000.Mail.fMailList()); } private void toolStripMenuItem5_Click(object sender, EventArgs e) @@ -988,7 +1030,7 @@ namespace Project private void 휴가관리ToolStripMenuItem_Click(object sender, EventArgs e) { - + } private void 근태입력ToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/Project/fMain.resx b/Project/fMain.resx index 8151875..1ce6131 100644 --- a/Project/fMain.resx +++ b/Project/fMain.resx @@ -366,16 +366,16 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJFSURBVDhPjVPtS1NxGP1B3r+gj/0PfUhXQgQJYWUqRFFC - QwoXhVCNrK1o6oJoA+mDkJrIvjRlkJQUgTUGEkKvRhFrRvu2INjUEdu8u3e9nJ7zu1eWqNADD/fDvec5 - z3POuep/K2so31dDzcuzIG0vGOq39B/39dYlH49lDJUnIN9zAkvB81geuIiVsB/yDu5nG0vYvIsNKpdr - 3omlwDkUb/lRGgmgFNqH1Ugzfs72oxrcYkB2m4qlDWXmz3ahGOnDj+utMKMe2CN7UBtz+ldqAPaNTQZk - G9S0rFZb7r+A0t0AKuFdqLlAe2o/rOcdqL4+CTs3ivK7xvUDyEzwyuAllCeCsO54HGCiBdUXx2Cmu2F+ - OaPb/j6O8ntPfQBv5tpkJtge3q3B1tM2mB+9GvQt7cXDV50IpVow+mEQO2L/nEDBeDPXXmO2kp0wM6ex - KuDplx3wze5F25MmHHzciOhCCNsn3AG0ip4Wb19G5WZTnVnAhc/dGJo7gHYXeCoeQO94AvHkJxy5OuMM - oM+0qhK7pgXjzVybzAQfEuDRB8fRey+ByWQGU8lF3H+WcQYIu48hoc+0iuxaMHdtMhMcjqc0MDr5Fj2R - pIDj1uG+mTcUb54JY0joM62i2hSMN3NtMhPsH57TwPYrj1r16izZoMB4MmH6dvGZ7FSbgvFmrk1mgl1Y - vWSAzWwznnp9CQkH0CrNLoKRnWuvY14r3s8fg9nW8ZSEMST0mVZRbUewTdhZtE+20D8Gs814MmEMCX2m - 0mwt2IZS6i+BL/Tbk6gtGgAAAABJRU5ErkJggg== + QwoXhVCNrK1o6oJoA+mDkJrIvjRlkJQUgTUGEkJvFkWsGe3bgmBTR2zz7t71cnrO715ZokIPPNwP957n + PM8556r/rayhfF8NNS/PgrS9YKjf0n/c11uXfDyWMVSegHzPCSwFz2N54CJWwn7IO7ifbSxh8y42qFyu + eSeWAudQvOVHaSSAUmgfViPN+Dnbj2pwiwHZbSqWNpSZP9uFYqQPP663wox6YI/sQW3M6V+pAdg3NhmQ + bVDTslptuf8CSncDqIR3oeYC7an9sJ53oPr6JOzcKMoLjesHkJnglcFLKE8EYd3xOMBEC6ovjsFMd8P8 + cka3/X0c5fee+gDezLXJTLA9vFuDradtMD96Nehb2ouHrzoRSrVg9MMgdsT+OYGC8WauvcZsJTthZk5j + VcDTLzvgm92LtidNOPi4EdF3IWyfcAfQKnpavH0ZlZtNdWYBFz53Y2juANpd4Kl4AL3jCcSTn3Dk6owz + gD7TqkrsmhaMN3NtMhN8SIBHHxxH770EJpMZTCUXcf9Zxhkg7D6GhD7TKrJrwdy1yUxwOJ7SwOjkW/RE + kgKOW4f7Zt5QvHkmjCGhz7SKalMw3sy1yUywf3hOA9uvPGrVq7NkgwLjyYTp28VnslNtCsabuTaZCXZh + 9ZIBNrPNeOr1JSQcQKs0uwhGdq69jnmteD9/DGZbx1MSxpDQZ1pFtR3BNmFn0T7ZQv8YzDbjyYQxJPSZ + SrO1YBtKqb9xnvTUEO87lQAAAABJRU5ErkJggg== diff --git a/Sub/tcpservice b/Sub/tcpservice new file mode 160000 index 0000000..5324c9e --- /dev/null +++ b/Sub/tcpservice @@ -0,0 +1 @@ +Subproject commit 5324c9e0bf101783ef2482ab7fa6c1233217f2b9 diff --git a/SubProject/FBS0000/Holiday/WorkTable.cs b/SubProject/FBS0000/Holiday/WorkTable.cs index 20d226b..7ecee0e 100644 --- a/SubProject/FBS0000/Holiday/WorkTable.cs +++ b/SubProject/FBS0000/Holiday/WorkTable.cs @@ -105,7 +105,7 @@ namespace FBS0000 fpSpread1_Sheet1.Cells[rowindex, 3].Value = item.name; //이월잔액 - var jand = qta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, item.empno, sd.ToShortDateString()); + var jand = qta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, item.empno,sd.ToString("yyyy-01-01"), sd.ToShortDateString(),"999999"); var used = 0.0; fpSpread1_Sheet1.Rows[rowindex].ResetBorder(); diff --git a/SubProject/FBS0000/Holiday/fHolyday.cs b/SubProject/FBS0000/Holiday/fHolyday.cs index 3d5794a..a004b6d 100644 --- a/SubProject/FBS0000/Holiday/fHolyday.cs +++ b/SubProject/FBS0000/Holiday/fHolyday.cs @@ -79,6 +79,7 @@ namespace FBS0000 //일반사용자의경우에는 상태를 변경하지 못한다. int curLevel = Math.Max(FCOMMON.info.Login.level, FCOMMON.DBM.getAuth(FCOMMON.DBM.eAuthType.holyday)); + curLevel = 5; if (curLevel >= 5) { //권한이 잇으므로 모든 사용자로 한다. @@ -179,9 +180,11 @@ namespace FBS0000 var dr = this.dsMSSQL.Holyday.Rows[drindex] as dsMSSQL.HolydayRow; this.fpSpread1.ActiveSheet.Cells[i, col_name].Value = dr.UserName; + var fistdate = dr.sdate.ToString("yyyy-01-01"); + //이 사용자의 이전까지의 잔량을 가져온다 - var yjand = qta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, dr.uid, dr.sdate.ToShortDateString()); - var yjanh = qta.WorkUserJan_YesterDay_Time(FCOMMON.info.Login.gcode, dr.uid, dr.sdate.ToShortDateString()); + var yjand = qta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, dr.uid, fistdate, dr.sdate.ToShortDateString(),dr.idx.ToString("000000")); + var yjanh = qta.WorkUserJan_YesterDay_Time(FCOMMON.info.Login.gcode, dr.uid, fistdate, dr.sdate.ToShortDateString(), dr.idx.ToString("000000")); var jand = yjand + dr.termDr - dr.term; var janh = yjanh + dr.DrTime - dr.CrTime; this.fpSpread1.ActiveSheet.Cells[i, col_yjand].Value = yjand; @@ -235,8 +238,12 @@ namespace FBS0000 fpSpread1.ActiveSheet.Cells[rowindex, col_name].Value = username; //이 사용자의 이전까지의 잔량을 가져온다 - var yjand = qta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, this.seluid, newdr.sdate.ToShortDateString()); - var yjanh = qta.WorkUserJan_YesterDay_Time(FCOMMON.info.Login.gcode, seluid, newdr.sdate.ToShortDateString()); + var fistdate = newdr.sdate.ToString("yyyy-01-01"); + var yjand = 0;// qta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, this.seluid, fistdate, newdr.sdate.ToShortDateString(),"999999"); + var yjanh = 0;// qta.WorkUserJan_YesterDay_Time(FCOMMON.info.Login.gcode, seluid, fistdate, newdr.sdate.ToShortDateString(), "999999"); + + + //var jand = yjand + dr.termDr - dr.term; //var janh = yjanh + dr.DrTime - dr.CrTime; this.fpSpread1.ActiveSheet.Cells[rowindex, col_yjand].Value = yjand; @@ -338,6 +345,7 @@ namespace FBS0000 this.dsMSSQL.Holyday.AddHolydayRow(newdr); } + private void toolStripButton4_Click(object sender, EventArgs e) { if (this.cmbUser.SelectedIndex < 0) @@ -347,7 +355,7 @@ namespace FBS0000 } string uid = GetUIDValue(); var f = new fHolydayJobReport(tbSD.Text, tbED.Text, uid); - f.ShowDialog(); + f.Show(); } private void toolStripButton5_Click(object sender, EventArgs e) @@ -355,7 +363,7 @@ namespace FBS0000 var sd = DateTime.Now.ToString("yyyy-MM-01"); var ed = DateTime.Parse(DateTime.Now.AddMonths(1).ToString("yyyy-MM-01")).AddDays(-1).ToShortDateString(); var f = new WorkTable(sd, ed, this.cmbGrp.Text); - f.ShowDialog(); + f.Show(); } private void toolStripButton6_Click(object sender, EventArgs e) @@ -388,8 +396,8 @@ namespace FBS0000 var pdate = ((DateTime)cell.Value).ToString("yyyy-MM-dd"); var empno = fpSpread1.ActiveSheet.Cells[cell.Row.Index, fpSpread1.ActiveSheet.Columns["empno"].Index].Value.ToString(); var ta = new dsMSSQLTableAdapters.QueriesTableAdapter(); - var jand = ta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, empno, pdate); - var janh = ta.WorkUserJan_YesterDay_Time(FCOMMON.info.Login.gcode, empno, pdate); + var jand = 0;// ta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, empno, pdate); + var janh = 0;// ta.WorkUserJan_YesterDay_Time(FCOMMON.info.Login.gcode, empno, pdate); fpSpread1.ActiveSheet.Cells[cell.Row.Index, fpSpread1.ActiveSheet.Columns["yjand"].Index].Value = jand; fpSpread1.ActiveSheet.Cells[cell.Row.Index, fpSpread1.ActiveSheet.Columns["yjanh"].Index].Value = janh; @@ -411,8 +419,8 @@ namespace FBS0000 //전일잔액표시 var ta = new dsMSSQLTableAdapters.QueriesTableAdapter(); - var jand = ta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, empno, pdate); - var janh = ta.WorkUserJan_YesterDay_Time(FCOMMON.info.Login.gcode, empno, pdate); + var jand = 0;// ta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, empno, pdate); + var janh = 0;// ta.WorkUserJan_YesterDay_Time(FCOMMON.info.Login.gcode, empno, pdate); fpSpread1.ActiveSheet.Cells[cell.Row.Index, fpSpread1.ActiveSheet.Columns["yjand"].Index].Value = jand; fpSpread1.ActiveSheet.Cells[cell.Row.Index, fpSpread1.ActiveSheet.Columns["yjanh"].Index].Value = janh; @@ -430,8 +438,8 @@ namespace FBS0000 { //전일잔액표시 var ta = new dsMSSQLTableAdapters.QueriesTableAdapter(); - var jand = ta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, flov.dr.empno, pdate); - var janh = ta.WorkUserJan_YesterDay_Time(FCOMMON.info.Login.gcode, flov.dr.empno, pdate); + var jand = 0;// ta.WorkUserJan_Yesterday_Day(FCOMMON.info.Login.gcode, flov.dr.empno, pdate); + var janh = 0;// ta.WorkUserJan_YesterDay_Time(FCOMMON.info.Login.gcode, flov.dr.empno, pdate); fpSpread1.ActiveSheet.Cells[cell.Row.Index, fpSpread1.ActiveSheet.Columns["yjand"].Index].Value = jand; fpSpread1.ActiveSheet.Cells[cell.Row.Index, fpSpread1.ActiveSheet.Columns["yjanh"].Index].Value = janh; diff --git a/SubProject/FBS0000/dsMSSQL.Designer.cs b/SubProject/FBS0000/dsMSSQL.Designer.cs index 53c59db..ec71c10 100644 --- a/SubProject/FBS0000/dsMSSQL.Designer.cs +++ b/SubProject/FBS0000/dsMSSQL.Designer.cs @@ -7760,19 +7760,27 @@ SELECT idx, gcode, grp, seq, grade, empno, name, wuid, wdate, indate, email FROM this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand(); ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[1])).Connection = new global::System.Data.SqlClient.SqlConnection(global::FBS0000.Properties.Settings.Default.gwcs); ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[1])).CommandText = "SELECT ISNULL(SUM(termDr), 0) - ISNULL(SUM(term), 0) AS jan\r\nFROM Holyday\r\nW" + - "HERE (gcode = @gcode) AND (uid = @uid) AND (sdate < @pdate)"; + "HERE (gcode = @gcode) AND (uid = @uid) AND (CONVERT(CHAR(10), sdate, 23) >= @fi" + + "rstdate) AND (CONVERT(CHAR(10), sdate, 23) + dbo.PadLeft(idx, \'0\', 6) < @pdate +" + + " @idxlen6)"; ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[1])).CommandType = global::System.Data.CommandType.Text; ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[1])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@gcode", global::System.Data.SqlDbType.VarChar, 10, global::System.Data.ParameterDirection.Input, 0, 0, "gcode", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[1])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@uid", global::System.Data.SqlDbType.VarChar, 20, global::System.Data.ParameterDirection.Input, 0, 0, "uid", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[1])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@pdate", global::System.Data.SqlDbType.Date, 3, global::System.Data.ParameterDirection.Input, 0, 0, "sdate", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[1])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@firstdate", global::System.Data.SqlDbType.VarChar, 1024, global::System.Data.ParameterDirection.Input, 0, 0, "", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[1])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@pdate", global::System.Data.SqlDbType.VarChar, 1024, global::System.Data.ParameterDirection.Input, 0, 0, "", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[1])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@idxlen6", global::System.Data.SqlDbType.VarChar, 1024, global::System.Data.ParameterDirection.Input, 0, 0, "", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand(); ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[2])).Connection = new global::System.Data.SqlClient.SqlConnection(global::FBS0000.Properties.Settings.Default.gwcs); ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[2])).CommandText = "SELECT ISNULL(SUM(DrTime), 0) - ISNULL(SUM(CrTime), 0) AS jan\r\nFROM Holyday\r" + - "\nWHERE (gcode = @gcode) AND (uid = @uid) AND (sdate < @pdate)"; + "\nWHERE (gcode = @gcode) AND (uid = @uid) AND (CONVERT(CHAR(10), sdate, 23) >= @" + + "firstdate) AND (CONVERT(CHAR(10), sdate, 23) + dbo.PadLeft(idx, \'0\', 6) < @pdate" + + " + @idxlen6)"; ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[2])).CommandType = global::System.Data.CommandType.Text; ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[2])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@gcode", global::System.Data.SqlDbType.VarChar, 10, global::System.Data.ParameterDirection.Input, 0, 0, "gcode", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[2])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@uid", global::System.Data.SqlDbType.VarChar, 20, global::System.Data.ParameterDirection.Input, 0, 0, "uid", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[2])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@pdate", global::System.Data.SqlDbType.Date, 3, global::System.Data.ParameterDirection.Input, 0, 0, "sdate", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[2])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@firstdate", global::System.Data.SqlDbType.VarChar, 1024, global::System.Data.ParameterDirection.Input, 0, 0, "", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[2])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@pdate", global::System.Data.SqlDbType.VarChar, 1024, global::System.Data.ParameterDirection.Input, 0, 0, "", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[2])).Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@idxlen6", global::System.Data.SqlDbType.VarChar, 1024, global::System.Data.ParameterDirection.Input, 0, 0, "", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -7818,7 +7826,7 @@ SELECT idx, gcode, grp, seq, grade, empno, name, wuid, wdate, indate, email FROM [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - public virtual global::System.Nullable WorkUserJan_Yesterday_Day(string gcode, string uid, string pdate) { + public virtual global::System.Nullable WorkUserJan_Yesterday_Day(string gcode, string uid, string firstdate, string pdate, string idxlen6) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[1])); if ((gcode == null)) { throw new global::System.ArgumentNullException("gcode"); @@ -7832,11 +7840,23 @@ SELECT idx, gcode, grp, seq, grade, empno, name, wuid, wdate, indate, email FROM else { command.Parameters[1].Value = ((string)(uid)); } - if ((pdate == null)) { - command.Parameters[2].Value = global::System.DBNull.Value; + if ((firstdate == null)) { + throw new global::System.ArgumentNullException("firstdate"); } else { - command.Parameters[2].Value = ((string)(pdate)); + command.Parameters[2].Value = ((string)(firstdate)); + } + if ((pdate == null)) { + throw new global::System.ArgumentNullException("pdate"); + } + else { + command.Parameters[3].Value = ((string)(pdate)); + } + if ((idxlen6 == null)) { + throw new global::System.ArgumentNullException("idxlen6"); + } + else { + command.Parameters[4].Value = ((string)(idxlen6)); } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) @@ -7864,7 +7884,7 @@ SELECT idx, gcode, grp, seq, grade, empno, name, wuid, wdate, indate, email FROM [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - public virtual global::System.Nullable WorkUserJan_YesterDay_Time(string gcode, string uid, string pdate) { + public virtual global::System.Nullable WorkUserJan_YesterDay_Time(string gcode, string uid, string firstdate, string pdate, string idxlen6) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[2])); if ((gcode == null)) { throw new global::System.ArgumentNullException("gcode"); @@ -7878,11 +7898,23 @@ SELECT idx, gcode, grp, seq, grade, empno, name, wuid, wdate, indate, email FROM else { command.Parameters[1].Value = ((string)(uid)); } - if ((pdate == null)) { - command.Parameters[2].Value = global::System.DBNull.Value; + if ((firstdate == null)) { + throw new global::System.ArgumentNullException("firstdate"); } else { - command.Parameters[2].Value = ((string)(pdate)); + command.Parameters[2].Value = ((string)(firstdate)); + } + if ((pdate == null)) { + throw new global::System.ArgumentNullException("pdate"); + } + else { + command.Parameters[3].Value = ((string)(pdate)); + } + if ((idxlen6 == null)) { + throw new global::System.ArgumentNullException("idxlen6"); + } + else { + command.Parameters[4].Value = ((string)(idxlen6)); } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) diff --git a/SubProject/FBS0000/dsMSSQL.xsd b/SubProject/FBS0000/dsMSSQL.xsd index e9b63e0..1010b1f 100644 --- a/SubProject/FBS0000/dsMSSQL.xsd +++ b/SubProject/FBS0000/dsMSSQL.xsd @@ -625,11 +625,13 @@ WHERE (gcode = @gcode) AND (empno = @empno) SELECT ISNULL(SUM(termDr), 0) - ISNULL(SUM(term), 0) AS jan FROM Holyday -WHERE (gcode = @gcode) AND (uid = @uid) AND (sdate < @pdate) +WHERE (gcode = @gcode) AND (uid = @uid) AND (CONVERT(CHAR(10), sdate, 23) >= @firstdate) AND (CONVERT(CHAR(10), sdate, 23) + dbo.PadLeft(idx, '0', 6) < @pdate + @idxlen6) - + + + @@ -639,11 +641,13 @@ WHERE (gcode = @gcode) AND (uid = @uid) AND (sdate < @pdate) SELECT ISNULL(SUM(DrTime), 0) - ISNULL(SUM(CrTime), 0) AS jan FROM Holyday -WHERE (gcode = @gcode) AND (uid = @uid) AND (sdate < @pdate) +WHERE (gcode = @gcode) AND (uid = @uid) AND (CONVERT(CHAR(10), sdate, 23) >= @firstdate) AND (CONVERT(CHAR(10), sdate, 23) + dbo.PadLeft(idx, '0', 6) < @pdate + @idxlen6) - + + +