..
This commit is contained in:
		| @@ -119,6 +119,12 @@ | ||||
|     <Compile Include="Equipment\rpt_equipmentB.Designer.cs"> | ||||
|       <DependentUpon>rpt_equipmentB.cs</DependentUpon> | ||||
|     </Compile> | ||||
|     <Compile Include="Purchase\fInputSC.cs"> | ||||
|       <SubType>Form</SubType> | ||||
|     </Compile> | ||||
|     <Compile Include="Purchase\fInputSC.Designer.cs"> | ||||
|       <DependentUpon>fInputSC.cs</DependentUpon> | ||||
|     </Compile> | ||||
|     <Compile Include="Purchase\fPurchase_Add.cs"> | ||||
|       <SubType>Form</SubType> | ||||
|     </Compile> | ||||
| @@ -178,6 +184,9 @@ | ||||
|     <EmbeddedResource Include="Equipment\rpt_equipmentB.resx"> | ||||
|       <DependentUpon>rpt_equipmentB.cs</DependentUpon> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Include="Purchase\fInputSC.resx"> | ||||
|       <DependentUpon>fInputSC.cs</DependentUpon> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Include="Purchase\fPurchase_Add.resx"> | ||||
|       <DependentUpon>fPurchase_Add.cs</DependentUpon> | ||||
|     </EmbeddedResource> | ||||
|   | ||||
| @@ -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")] | ||||
|   | ||||
| @@ -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) | ||||
|             { | ||||
|  | ||||
|             } | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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; | ||||
|     } | ||||
| } | ||||
| @@ -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<string> cols = new List<string>(); | ||||
|             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) | ||||
|         { | ||||
|  | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 chikyun.kim
					chikyun.kim