From 0878e80f14c97e9ae9b4a21cb9a070853896f224 Mon Sep 17 00:00:00 2001 From: "chikyun.kim" Date: Mon, 29 Oct 2018 09:53:15 +0900 Subject: [PATCH] .. --- Project/History.txt | 3 +- Project/Properties/AssemblyInfo.cs | 4 +- SubProject/FCOMMON/Auth.cs | 39 +++++++ SubProject/FCOMMON/DataBaseManager.cs | 3 +- SubProject/FCOMMON/FCOMMON.csproj | 1 + SubProject/FEQ0000/FEQ0000.csproj | 9 ++ SubProject/FEQ0000/Properties/AssemblyInfo.cs | 4 +- SubProject/FEQ0000/Purchase/fPurchase.cs | 15 ++- .../Purchase/fPurchase_Import.Designer.cs | 68 ++++++++++- .../FEQ0000/Purchase/fPurchase_Import.cs | 106 +++++++++++++----- 10 files changed, 208 insertions(+), 44 deletions(-) create mode 100644 SubProject/FCOMMON/Auth.cs diff --git a/Project/History.txt b/Project/History.txt index a1443cb..0363c45 100644 --- a/Project/History.txt +++ b/Project/History.txt @@ -1,4 +1,5 @@ -181004 chi 장비목록 출력물이 나오지 않는 현상 제거 (resource path 오류) +181023 chi getAuth_Purchase, 추가 +181004 chi 장비목록 출력물이 나오지 않는 현상 제거 (resource path 오류) 장비목록 내부검색기능 추가 180917 chi 180624 chi setting 의 경로를 applicationdata 적용 되도록 수정 \ No newline at end of file diff --git a/Project/Properties/AssemblyInfo.cs b/Project/Properties/AssemblyInfo.cs index 49e24aa..1df7b53 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("18.10.02.0000")] -[assembly: AssemblyFileVersion("18.10.02.0000")] +[assembly: AssemblyVersion("18.10.29.1000")] +[assembly: AssemblyFileVersion("18.10.29.1000")] diff --git a/SubProject/FCOMMON/Auth.cs b/SubProject/FCOMMON/Auth.cs new file mode 100644 index 0000000..7ccd8b9 --- /dev/null +++ b/SubProject/FCOMMON/Auth.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Data.SqlClient; + +namespace FCOMMON +{ + public static partial class DBM + { + + public static int getAuth_Purchase(string uid) + { + return getAuth("purchase", uid); + } + public static int getAuth_Purchase() + { + return getAuth("purchase", info.Login.no); + } + public static int getAuth(string field,string uid) + { + var cn = getCn(); + cn.Open(); + + int retval = 0; + + string sql = string.Format("select isnull([{0}],0) from Auth where [user]= '{1}'",field,uid); + var cmd = new SqlCommand(sql, cn); + var rdr = cmd.ExecuteScalar(); + if(rdr != null ) + retval = int.Parse(rdr.ToString()); + + cn.Close(); + cn.Dispose(); + return retval; + } + + } +} diff --git a/SubProject/FCOMMON/DataBaseManager.cs b/SubProject/FCOMMON/DataBaseManager.cs index c14ea34..7c6ce83 100644 --- a/SubProject/FCOMMON/DataBaseManager.cs +++ b/SubProject/FCOMMON/DataBaseManager.cs @@ -6,7 +6,7 @@ using System.Data.SqlClient; namespace FCOMMON { - public static class DBM + public static partial class DBM { public static SqlConnection getCn() { @@ -72,6 +72,7 @@ namespace FCOMMON return retval; } + public static sItemInfo getItemInfo(int idx) { var cn = getCn(); diff --git a/SubProject/FCOMMON/FCOMMON.csproj b/SubProject/FCOMMON/FCOMMON.csproj index cdb27c7..085569a 100644 --- a/SubProject/FCOMMON/FCOMMON.csproj +++ b/SubProject/FCOMMON/FCOMMON.csproj @@ -45,6 +45,7 @@ + Form diff --git a/SubProject/FEQ0000/FEQ0000.csproj b/SubProject/FEQ0000/FEQ0000.csproj index 7cd9aba..a661ae3 100644 --- a/SubProject/FEQ0000/FEQ0000.csproj +++ b/SubProject/FEQ0000/FEQ0000.csproj @@ -119,6 +119,12 @@ rpt_equipmentB.cs + + Form + + + fInputSC.cs + Form @@ -178,6 +184,9 @@ rpt_equipmentB.cs + + fInputSC.cs + fPurchase_Add.cs diff --git a/SubProject/FEQ0000/Properties/AssemblyInfo.cs b/SubProject/FEQ0000/Properties/AssemblyInfo.cs index aa4601e..bd3977e 100644 --- a/SubProject/FEQ0000/Properties/AssemblyInfo.cs +++ b/SubProject/FEQ0000/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로 // 지정되도록 할 수 있습니다. // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("18.10.29.0950")] +[assembly: AssemblyFileVersion("18.10.29.0950")] diff --git a/SubProject/FEQ0000/Purchase/fPurchase.cs b/SubProject/FEQ0000/Purchase/fPurchase.cs index d022e4a..f8c5262 100644 --- a/SubProject/FEQ0000/Purchase/fPurchase.cs +++ b/SubProject/FEQ0000/Purchase/fPurchase.cs @@ -57,7 +57,9 @@ namespace FEQ0000 cmbState.Items.Add(item); this.cmbState.SelectedIndex = 1; - if (FCOMMON.info.Login.level > 9) + //일반사용자의경우에는 상태를 변경하지 못한다. + int curLevel = Math.Max(FCOMMON.info.Login.level, FCOMMON.DBM.getAuth_Purchase()); + if (curLevel >= 5) { btSave.Visible = true; } @@ -92,7 +94,7 @@ namespace FEQ0000 " and (isnull(request,'') like @req or isnull(receive,'') like @req)"; if (cmbState.SelectedIndex != 1) cmd.CommandText += " and state like @st"; - else cmd.CommandText += " and state < '04'"; + else cmd.CommandText += " and (state < '04' or state > '07')"; cmd.CommandText += " ORDER BY pdate DESC, idx DESC"; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sd", dtSD.Text)); @@ -470,5 +472,14 @@ namespace FEQ0000 //} } + private void updateSCToolStripMenuItem_Click(object sender, EventArgs e) + { + var dlg = FCOMMON.Util.MsgQ("#SC가 없는 자료에 한하여 일괄 기록을 실행 합니다."); + if(dlg == System.Windows.Forms.DialogResult.Yes) + { + + } + } + } } diff --git a/SubProject/FEQ0000/Purchase/fPurchase_Import.Designer.cs b/SubProject/FEQ0000/Purchase/fPurchase_Import.Designer.cs index 5f9796f..2a334c7 100644 --- a/SubProject/FEQ0000/Purchase/fPurchase_Import.Designer.cs +++ b/SubProject/FEQ0000/Purchase/fPurchase_Import.Designer.cs @@ -60,6 +60,10 @@ this.bindingNavigatorSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.progressBar1 = new System.Windows.Forms.ToolStripProgressBar(); this.bs = new System.Windows.Forms.BindingSource(this.components); + this.sd = new System.Windows.Forms.DateTimePicker(); + this.ed = new System.Windows.Forms.DateTimePicker(); + this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); + this.label6 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudCE)).BeginInit(); @@ -70,6 +74,7 @@ ((System.ComponentModel.ISupportInitialize)(this.bn)).BeginInit(); this.bn.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.bs)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); this.SuspendLayout(); // // textBox1 @@ -105,10 +110,10 @@ this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; - this.dataGridView1.Location = new System.Drawing.Point(0, 66); + this.dataGridView1.Location = new System.Drawing.Point(0, 97); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.RowTemplate.Height = 23; - this.dataGridView1.Size = new System.Drawing.Size(693, 437); + this.dataGridView1.Size = new System.Drawing.Size(721, 535); this.dataGridView1.TabIndex = 1; // // button3 @@ -123,6 +128,10 @@ // // panel1 // + this.panel1.Controls.Add(this.numericUpDown2); + this.panel1.Controls.Add(this.label6); + this.panel1.Controls.Add(this.ed); + this.panel1.Controls.Add(this.sd); this.panel1.Controls.Add(this.label4); this.panel1.Controls.Add(this.nudCE); this.panel1.Controls.Add(this.nudCS); @@ -140,8 +149,9 @@ this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(693, 66); + this.panel1.Size = new System.Drawing.Size(721, 97); this.panel1.TabIndex = 0; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); // // label4 // @@ -292,14 +302,14 @@ this.bindingNavigatorAddNewItem, this.bindingNavigatorDeleteItem, this.progressBar1}); - this.bn.Location = new System.Drawing.Point(0, 503); + this.bn.Location = new System.Drawing.Point(0, 632); this.bn.MoveFirstItem = this.bindingNavigatorMoveFirstItem; this.bn.MoveLastItem = this.bindingNavigatorMoveLastItem; this.bn.MoveNextItem = this.bindingNavigatorMoveNextItem; this.bn.MovePreviousItem = this.bindingNavigatorMovePreviousItem; this.bn.Name = "bn"; this.bn.PositionItem = this.bindingNavigatorPositionItem; - this.bn.Size = new System.Drawing.Size(693, 25); + this.bn.Size = new System.Drawing.Size(721, 25); this.bn.TabIndex = 2; this.bn.Text = "bindingNavigator1"; // @@ -394,11 +404,52 @@ this.progressBar1.Name = "progressBar1"; this.progressBar1.Size = new System.Drawing.Size(200, 22); // + // sd + // + this.sd.Location = new System.Drawing.Point(42, 40); + this.sd.Name = "sd"; + this.sd.Size = new System.Drawing.Size(170, 21); + this.sd.TabIndex = 15; + // + // ed + // + this.ed.Location = new System.Drawing.Point(42, 67); + this.ed.Name = "ed"; + this.ed.Size = new System.Drawing.Size(170, 21); + this.ed.TabIndex = 16; + // + // numericUpDown2 + // + this.numericUpDown2.Location = new System.Drawing.Point(406, 63); + this.numericUpDown2.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.numericUpDown2.Name = "numericUpDown2"; + this.numericUpDown2.Size = new System.Drawing.Size(45, 21); + this.numericUpDown2.TabIndex = 18; + this.numericUpDown2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDown2.Value = new decimal(new int[] { + 6, + 0, + 0, + 0}); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(312, 67); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(87, 12); + this.label6.TabIndex = 17; + this.label6.Text = "Column Name"; + // // fPurchase_Import // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(693, 528); + this.ClientSize = new System.Drawing.Size(721, 657); this.Controls.Add(this.dataGridView1); this.Controls.Add(this.bn); this.Controls.Add(this.panel1); @@ -417,6 +468,7 @@ this.bn.ResumeLayout(false); this.bn.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.bs)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -454,5 +506,9 @@ private System.Windows.Forms.NumericUpDown nudCE; private System.Windows.Forms.NumericUpDown nudCS; private System.Windows.Forms.Label label5; + private System.Windows.Forms.DateTimePicker ed; + private System.Windows.Forms.DateTimePicker sd; + private System.Windows.Forms.NumericUpDown numericUpDown2; + private System.Windows.Forms.Label label6; } } \ No newline at end of file diff --git a/SubProject/FEQ0000/Purchase/fPurchase_Import.cs b/SubProject/FEQ0000/Purchase/fPurchase_Import.cs index be14d8a..023cecd 100644 --- a/SubProject/FEQ0000/Purchase/fPurchase_Import.cs +++ b/SubProject/FEQ0000/Purchase/fPurchase_Import.cs @@ -21,7 +21,8 @@ namespace FEQ0000 private void __Load(object sender, EventArgs e) { - + this.sd.Value = DateTime.Now.AddMonths(-1); + this.ed.Value = DateTime.Now; } void __Closed(object sender, FormClosedEventArgs e) @@ -42,6 +43,7 @@ namespace FEQ0000 private void button1_Click(object sender, EventArgs e) { + int ColumnNameNo = (int)numericUpDown2.Value; if(textBox1.Text.isEmpty()) { FCOMMON.Util.MsgE("파일을 선택하세요"); @@ -85,6 +87,11 @@ namespace FEQ0000 MaxRow = (int)Math.Min(MaxRow, nudE.Value-1); MinRow = (int)Math.Max(MinRow, nudS.Value-1); + if(MinRow <= (ColumnNameNo-1)) + { + FCOMMON.Util.MsgI("시작줄을 제목줄 보다 커야 합니다. 자동으로 +1 증가합니다."); + MinRow = ColumnNameNo ; + } var MaxCol = sheet.lastCol(); @@ -93,37 +100,81 @@ namespace FEQ0000 MaxCol = (int)Math.Min(MaxCol, nudCE.Value - 1); MinCol = (int)Math.Max(MinCol, nudCS.Value - 1); - + //제목줄을 처리한다. 181029 List cols = new List(); - bool firstRow = true; + + string sDate = sd.Value.ToShortDateString(); + string eDate = ed.Value.ToShortDateString(); + + for (int c = MinCol; c <= MaxCol; c++) + { + var strVallue = sheet.readStr(ColumnNameNo-1, c); + if (strVallue.isEmpty() ) + { + if (c == MinCol) + { + //첫줄 첫행이 빈값이면 처리하지 않는다. + FCOMMON.Util.MsgE("열 제목에 빈값이 있어 처리되지 못합니다."); + return; + } + else + { + //빈값이 나왓으므로 열 최대값을 변경해준다. + if(c < MaxCol) + { + FCOMMON.Util.MsgI("빈값으로 인해 최대 열 번호를 " + c.ToString() + "로 변경합니다"); + MaxCol = c; + break; + } + } + } + cols.Add(strVallue); + this.dtExcel.Columns.Add(strVallue); + } + + try{ for (int r = MinRow; r <= MaxRow; r++) { - DataRow dr = null; - if (firstRow ==false) dr = dtExcel.NewRow(); + DataRow dr = dtExcel.NewRow(); Boolean nullColumn = false; for (int c = MinCol; c <= MaxCol; c++) { - if(firstRow ==false && (c == 0|| c==21 || c==22 )) + if (sheet.isDate(r, c)) { - if(sheet.isDate(r, c)) - { - var datevalue = sheet.readNum(r, c); - int y, m, d; - y = m = d = 0; - book.dateUnpack(datevalue, ref y, ref m, ref d); - if (y >= 2000) - dr[cols[c]] = string.Format("{0:0000}-{1:00}-{2:00}", y, m, d); - } + var datevalue = sheet.readNum(r, c); + int y, m, d; + y = m = d = 0; + book.dateUnpack(datevalue, ref y, ref m, ref d); + if (y >= 2000) + dr[cols[c]] = string.Format("{0:0000}-{1:00}-{2:00}", y, m, d); else - { - var dateStrin = sheet.readStr(r, c); - } + dr[cols[c]] = string.Empty; + //일자가 만약 넘어서면 패스한다. + if(cols[c]=="일자" ) + { + string value = dr[cols[c]].ToString(); + if(value == "") + { + nullColumn = true; //날짜가 없다면 패스 + break; + } else if(value.CompareTo(sDate) < 0) + { + nullColumn = true; //과거데이터라서 패스 + break; + } else if(value.CompareTo(eDate) > 0) + { + nullColumn = true; //미래데이터 패스 + break; + } + } } else { + var dateStrin = sheet.readStr(r, c); + var strVallue = sheet.readStr(r, c); if (strVallue.isEmpty() && c == MinCol) { @@ -131,21 +182,11 @@ namespace FEQ0000 nullColumn = true; break; } - if (firstRow) - { - cols.Add(strVallue); - this.dtExcel.Columns.Add(strVallue); - } - else - { - if (!cols[c].isEmpty()) - dr[cols[c]] = strVallue; - } + if (!cols[c].isEmpty()) + dr[cols[c]] = strVallue; } - } if (nullColumn) continue; //줄처리를 못한 경우 넘어감 - if (firstRow) firstRow = false; if (dr != null) { dtExcel.Rows.Add(dr); @@ -249,5 +290,10 @@ namespace FEQ0000 dt.AcceptChanges(); FCOMMON.Util.MsgI("Save OK"); } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } }