hytos / ID2.Manager / ID2.Manager.Common / Helpers / ID2Excel.cs @ 1018a498
이력 | 보기 | 이력해설 | 다운로드 (33.2 KB)
1 | 057ca09a | taeseongkim | using ID2.Manager.Data.Models; |
---|---|---|---|
2 | using System; |
||
3 | using System.Collections.Generic; |
||
4 | using System.Linq; |
||
5 | using System.Text; |
||
6 | using System.Threading.Tasks; |
||
7 | b6abb7b8 | yoush97 | |
8 | 43ceb5b3 | taeseongkim | using System.IO; |
9 | using System.IO.Compression; |
||
10 | 8eca8767 | taeseongkim | |
11 | b6abb7b8 | yoush97 | using GemBox.Spreadsheet; |
12 | |||
13 | 057ca09a | taeseongkim | namespace ID2.Manager.Common.Helpers |
14 | { |
||
15 | public class ID2Excel :IDisposable |
||
16 | { |
||
17 | 61124f6c | yoush97 | readonly Informations informations = Informations.Instance; |
18 | 057ca09a | taeseongkim | |
19 | public void Dispose() |
||
20 | { |
||
21 | 8eca8767 | taeseongkim | try |
22 | { |
||
23 | } |
||
24 | catch (Exception) |
||
25 | { |
||
26 | throw; |
||
27 | } |
||
28 | finally |
||
29 | { |
||
30 | GC.Collect(2); |
||
31 | GC.Collect(2); |
||
32 | } |
||
33 | 057ca09a | taeseongkim | } |
34 | |||
35 | 61124f6c | yoush97 | public ID2Excel() { } |
36 | |||
37 | 88c542dd | yoush97 | private ProjectInfo GetProject(string project) |
38 | 057ca09a | taeseongkim | { |
39 | 61124f6c | yoush97 | List<ProjectInfo> projects = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList(); |
40 | |||
41 | 88c542dd | yoush97 | ProjectInfo prjInfo = projects.FirstOrDefault(x => x.Code.Equals(project)); |
42 | if (prjInfo != null) return prjInfo; |
||
43 | 61124f6c | yoush97 | |
44 | 88c542dd | yoush97 | prjInfo = projects.FirstOrDefault(x => x.Name.Equals(project)); |
45 | if (prjInfo != null) return prjInfo; |
||
46 | |||
47 | return prjInfo ?? new ProjectInfo(); |
||
48 | 057ca09a | taeseongkim | } |
49 | |||
50 | private UserInfo GetUser(string user) |
||
51 | { |
||
52 | 61124f6c | yoush97 | UserInfo userInfo = informations.UserList.Where(x => x.ID.Equals(user)).FirstOrDefault(); |
53 | 057ca09a | taeseongkim | if (userInfo != null) return userInfo; |
54 | |||
55 | 61124f6c | yoush97 | userInfo = informations.UserList.Where(x => x.Name.Equals(user)).FirstOrDefault(); |
56 | 057ca09a | taeseongkim | if (userInfo != null) return userInfo; |
57 | |||
58 | return userInfo ?? new UserInfo(); |
||
59 | } |
||
60 | |||
61 | 8eca8767 | taeseongkim | private string GetColumnName(int column) |
62 | { |
||
63 | int dividend = column; |
||
64 | string columnName = string.Empty; |
||
65 | |||
66 | while (dividend > 0) |
||
67 | { |
||
68 | int modulo = (dividend - 1) % 26; |
||
69 | columnName = Convert.ToChar(65 + modulo) + columnName; |
||
70 | dividend = (dividend - modulo) / 26; |
||
71 | } |
||
72 | |||
73 | return columnName; |
||
74 | } |
||
75 | |||
76 | 56f7f16e | taeseongkim | private System.Drawing.Image GetImage(string base64String) |
77 | 43ceb5b3 | taeseongkim | { |
78 | 56f7f16e | taeseongkim | System.Drawing.Image result = null; |
79 | |||
80 | 43ceb5b3 | taeseongkim | var str = CompressHelper.DecompressString(base64String); |
81 | |||
82 | byte[] imageBytes = Convert.FromBase64String(str); |
||
83 | |||
84 | using (MemoryStream ms = new MemoryStream(imageBytes)) |
||
85 | { |
||
86 | 56f7f16e | taeseongkim | result = System.Drawing.Image.FromStream(ms); |
87 | 43ceb5b3 | taeseongkim | } |
88 | |||
89 | return result; |
||
90 | } |
||
91 | 8eca8767 | taeseongkim | |
92 | 422f620d | taeseongkim | private byte[] ExcelToImageData(string base64String) |
93 | { |
||
94 | var str = CompressHelper.DecompressString(base64String); |
||
95 | |||
96 | return Convert.FromBase64String(str); |
||
97 | } |
||
98 | |||
99 | 8eca8767 | taeseongkim | |
100 | public ImportResult ExcelDataImport(List<ExcelData> ExcelData) |
||
101 | { |
||
102 | ImportResult result = new ImportResult(); |
||
103 | |||
104 | StringBuilder sbErrMsg = new StringBuilder(); |
||
105 | |||
106 | try |
||
107 | { |
||
108 | int rowCount = ExcelData.Max(x=>x.ROW_INDEX); |
||
109 | int columnCount = ExcelData.Max(x => x.COUMMN_INDEX); |
||
110 | int exRow = 9; |
||
111 | |||
112 | #region Excel 유효성검사 |
||
113 | |||
114 | //Excel 포멧체크 |
||
115 | 7d73b57c | yoush97 | if (rowCount < 10 || columnCount != 49) |
116 | 8eca8767 | taeseongkim | { |
117 | result.Error = "Please, check the excel."; |
||
118 | return result; |
||
119 | } |
||
120 | |||
121 | #region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical) |
||
122 | ExcelData.Where(col => col.ROW_INDEX > exRow) |
||
123 | 7d73b57c | yoush97 | .Where(col => col.COUMMN_INDEX > 8 && col.COUMMN_INDEX < 18 && col.ROW_INDEX > exRow && string.IsNullOrEmpty(col.VALUE)) |
124 | .ToList() |
||
125 | .ForEach(p => sbErrMsg.Append(", " + p.TopLeftCell)); |
||
126 | 8eca8767 | taeseongkim | |
127 | if (sbErrMsg.Length > 0) |
||
128 | { |
||
129 | string errMsg = sbErrMsg.ToString().Substring(2); |
||
130 | if (errMsg.Length > 100) |
||
131 | { |
||
132 | errMsg = $"{errMsg.Substring(0, 100)}..."; |
||
133 | } |
||
134 | |||
135 | result.Error = $"Please, check null value in excel.\n{errMsg}"; |
||
136 | return result; |
||
137 | } |
||
138 | #endregion |
||
139 | |||
140 | 4b9f349c | yoush97 | #region 엑셀 도면명 중복 값 체크 |
141 | 7d73b57c | yoush97 | ExcelData.Where(col => col.COUMMN_INDEX == 12 && col.ROW_INDEX > exRow) |
142 | .GroupBy(g => g.ROW_INDEX) |
||
143 | .Select(p => new |
||
144 | { |
||
145 | rowIndex = p.Key, |
||
146 | docNo = p.Select(x => x.VALUE.ToString()).FirstOrDefault() |
||
147 | }) |
||
148 | .GroupBy(g => g.docNo) |
||
149 | .Where(p => p.Count() > 1) |
||
150 | .Select(p => p.Select(x => x.rowIndex.ToString()) |
||
151 | .Aggregate((x, y) => x.ToString() + "," + y.ToString()) |
||
152 | .ToString()) |
||
153 | .ToList() |
||
154 | .ForEach(p => sbErrMsg.Append("\n" + p.ToString())); |
||
155 | 8eca8767 | taeseongkim | |
156 | if (sbErrMsg.Length > 0) |
||
157 | { |
||
158 | sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : "); |
||
159 | string errMsg = sbErrMsg.ToString(); |
||
160 | if (errMsg.Length > 100) |
||
161 | { |
||
162 | errMsg = $"{errMsg.Substring(0, 100)}..."; |
||
163 | } |
||
164 | |||
165 | result.Error = $"Please, check the duplicate value in excel.\n{errMsg}"; |
||
166 | return result; |
||
167 | } |
||
168 | #endregion |
||
169 | |||
170 | #endregion |
||
171 | |||
172 | result.documents = new List<Documents>(); |
||
173 | 56f7f16e | taeseongkim | result.Images = new List<System.Drawing.Image>(); |
174 | 8eca8767 | taeseongkim | |
175 | foreach (var row in ExcelData.Where(row => row.ROW_INDEX > exRow).GroupBy(x => x.ROW_INDEX)) |
||
176 | { |
||
177 | var document = new Documents(); |
||
178 | 49ab10bd | taeseongkim | //document.DocID = Guid.NewGuid().ToString(); |
179 | 8eca8767 | taeseongkim | |
180 | 57ea162e | yoush97 | int toreview = 0; |
181 | int frreview = 0; |
||
182 | int id2work = 0; |
||
183 | |||
184 | 422f620d | taeseongkim | foreach (var cell in row.OrderBy(x=>x.COUMMN_INDEX)) |
185 | 8eca8767 | taeseongkim | { |
186 | var value = cell.VALUE.DefalutValue(); |
||
187 | |||
188 | switch (cell.COUMMN_INDEX) |
||
189 | { |
||
190 | 7d73b57c | yoush97 | case 9: |
191 | 61124f6c | yoush97 | document.RefProjectCode = this.GetProject(value).Code; |
192 | 7d73b57c | yoush97 | if (!string.IsNullOrEmpty(document.RefProjectCode)) |
193 | { |
||
194 | document.Team = this.GetProject(value).Team; |
||
195 | } |
||
196 | 8eca8767 | taeseongkim | break; |
197 | 7d73b57c | yoush97 | case 10: |
198 | 4b9f349c | yoush97 | document.System = value; |
199 | break; |
||
200 | 7d73b57c | yoush97 | case 11: |
201 | 4b9f349c | yoush97 | document.SubSystemCode = value; |
202 | break; |
||
203 | 7d73b57c | yoush97 | case 12: |
204 | 8eca8767 | taeseongkim | document.DocumentNo = value; |
205 | break; |
||
206 | 7d73b57c | yoush97 | case 13: |
207 | 8eca8767 | taeseongkim | document.PersonInCharge = this.GetUser(value).ID; |
208 | break; |
||
209 | 7d73b57c | yoush97 | case 14: |
210 | 4b9f349c | yoush97 | document.Worker = this.GetUser(value).ID; |
211 | break; |
||
212 | 7d73b57c | yoush97 | case 15: |
213 | 4b9f349c | yoush97 | document.AVEVAPersonInCharge = this.GetUser(value).ID; |
214 | break; |
||
215 | 7d73b57c | yoush97 | case 16: |
216 | 4b9f349c | yoush97 | document.AVEVAWorker = this.GetUser(value).ID; |
217 | break; |
||
218 | 7d73b57c | yoush97 | case 17: |
219 | 8eca8767 | taeseongkim | document.JobLevel = value; |
220 | break; |
||
221 | 7d73b57c | yoush97 | case 18: |
222 | 8eca8767 | taeseongkim | document.RevisonNo = value; |
223 | break; |
||
224 | 7d73b57c | yoush97 | case 19: |
225 | 8eca8767 | taeseongkim | document.ToIsDiscussion = value; |
226 | break; |
||
227 | 7d73b57c | yoush97 | case 20: |
228 | 8eca8767 | taeseongkim | document.ToRemarks = value; |
229 | break; |
||
230 | 7d73b57c | yoush97 | case 21: |
231 | 8eca8767 | taeseongkim | document.ToCreator = this.GetUser(value).ID; |
232 | break; |
||
233 | 7d73b57c | yoush97 | case 22: |
234 | 422f620d | taeseongkim | if (value != null) |
235 | { |
||
236 | if (document.AttFiles == null) |
||
237 | { |
||
238 | document.AttFiles = new List<AttFileInfo>(); |
||
239 | } |
||
240 | |||
241 | document.AttFiles.Add(new AttFileInfo |
||
242 | { |
||
243 | FileID = Guid.NewGuid().ToString(), |
||
244 | 49ab10bd | taeseongkim | //RefID = document.DocID, |
245 | 422f620d | taeseongkim | Category = "toreview", |
246 | FileType = "image/png", |
||
247 | FileName = "ClipBoard", |
||
248 | FilePath = "ClipBoard", |
||
249 | FileExtension = ".png", |
||
250 | CreatedDate = DateTime.Now, |
||
251 | Creator = document.ToCreator, |
||
252 | FileData = ExcelToImageData(value) |
||
253 | |||
254 | }); |
||
255 | 57ea162e | yoush97 | |
256 | document.ToCapture = ++toreview; |
||
257 | 422f620d | taeseongkim | } |
258 | 43ceb5b3 | taeseongkim | break; |
259 | 7d73b57c | yoush97 | case 23: |
260 | 8eca8767 | taeseongkim | document.FrReviewStatus = value; |
261 | break; |
||
262 | 7d73b57c | yoush97 | case 24: |
263 | 8eca8767 | taeseongkim | document.FrRemarks = value; |
264 | break; |
||
265 | 7d73b57c | yoush97 | case 25: |
266 | 8eca8767 | taeseongkim | document.FrCreator = this.GetUser(value).ID; |
267 | break; |
||
268 | 7d73b57c | yoush97 | case 26: |
269 | 422f620d | taeseongkim | if (value != null) |
270 | { |
||
271 | if (document.AttFiles == null) |
||
272 | { |
||
273 | document.AttFiles = new List<AttFileInfo>(); |
||
274 | } |
||
275 | |||
276 | document.AttFiles.Add(new AttFileInfo |
||
277 | { |
||
278 | FileID = Guid.NewGuid().ToString(), |
||
279 | 49ab10bd | taeseongkim | //RefID = document.DocID, |
280 | 422f620d | taeseongkim | Category = "frreview", |
281 | FileType = "image/png", |
||
282 | FileName = "ClipBoard", |
||
283 | FilePath = "ClipBoard", |
||
284 | FileExtension = ".png", |
||
285 | CreatedDate = DateTime.Now, |
||
286 | Creator = document.FrCreator, |
||
287 | FileData = ExcelToImageData(value) |
||
288 | |||
289 | }); |
||
290 | 57ea162e | yoush97 | |
291 | document.FrCapture = ++frreview; |
||
292 | 422f620d | taeseongkim | } |
293 | break; |
||
294 | 7d73b57c | yoush97 | case 27: |
295 | 8eca8767 | taeseongkim | document.ID2StartDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
296 | break; |
||
297 | 7d73b57c | yoush97 | case 28: |
298 | 8eca8767 | taeseongkim | document.ID2EndDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
299 | break; |
||
300 | 7d73b57c | yoush97 | case 29: |
301 | 8eca8767 | taeseongkim | document.ID2Status = value; |
302 | break; |
||
303 | 7d73b57c | yoush97 | case 30: |
304 | 8eca8767 | taeseongkim | document.ID2Issues = value; |
305 | break; |
||
306 | 7d73b57c | yoush97 | case 31: |
307 | 4b9f349c | yoush97 | if (value != null) |
308 | { |
||
309 | if (document.AttFiles == null) |
||
310 | { |
||
311 | document.AttFiles = new List<AttFileInfo>(); |
||
312 | } |
||
313 | |||
314 | document.AttFiles.Add(new AttFileInfo |
||
315 | { |
||
316 | FileID = Guid.NewGuid().ToString(), |
||
317 | //RefID = document.DocID, |
||
318 | Category = "id2work", |
||
319 | FileType = "image/png", |
||
320 | FileName = "ClipBoard", |
||
321 | FilePath = "ClipBoard", |
||
322 | FileExtension = ".png", |
||
323 | CreatedDate = DateTime.Now, |
||
324 | Creator = document.FrCreator, |
||
325 | FileData = ExcelToImageData(value) |
||
326 | |||
327 | }); |
||
328 | 57ea162e | yoush97 | |
329 | document.ID2Capture = ++id2work; |
||
330 | 4b9f349c | yoush97 | } |
331 | 8eca8767 | taeseongkim | break; |
332 | case 32: |
||
333 | 7d73b57c | yoush97 | document.ReplyModifications = value; |
334 | 8eca8767 | taeseongkim | break; |
335 | case 33: |
||
336 | 7d73b57c | yoush97 | document.ReplyRequester = this.GetUser(value).ID; |
337 | 4b9f349c | yoush97 | break; |
338 | case 34: |
||
339 | 7d73b57c | yoush97 | document.IsConvert = value; |
340 | 4b9f349c | yoush97 | break; |
341 | case 35: |
||
342 | 7d73b57c | yoush97 | document.AVEVAConvertDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
343 | 8eca8767 | taeseongkim | break; |
344 | case 36: |
||
345 | 7d73b57c | yoush97 | document.AVEVAWorkDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
346 | 8eca8767 | taeseongkim | break; |
347 | case 37: |
||
348 | 7d73b57c | yoush97 | document.AVEVAStatus = value; |
349 | 8eca8767 | taeseongkim | break; |
350 | case 38: |
||
351 | 7d73b57c | yoush97 | document.AVEVAIssues = value; |
352 | 8eca8767 | taeseongkim | break; |
353 | case 39: |
||
354 | 7d73b57c | yoush97 | document.AVEVAReviewDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
355 | 8eca8767 | taeseongkim | break; |
356 | case 40: |
||
357 | 7d73b57c | yoush97 | document.ProdReviewer = this.GetUser(value).ID; |
358 | 8eca8767 | taeseongkim | break; |
359 | case 41: |
||
360 | 7d73b57c | yoush97 | document.ProdIsResult = value; |
361 | 8eca8767 | taeseongkim | break; |
362 | case 42: |
||
363 | 7d73b57c | yoush97 | document.ProdRemarks = value; |
364 | 8eca8767 | taeseongkim | break; |
365 | case 43: |
||
366 | 7d73b57c | yoush97 | document.ClientReviewer = this.GetUser(value).ID; |
367 | 8eca8767 | taeseongkim | break; |
368 | case 44: |
||
369 | 7d73b57c | yoush97 | document.ClientIsResult = value; |
370 | 8eca8767 | taeseongkim | break; |
371 | case 45: |
||
372 | 7d73b57c | yoush97 | document.ClientRemarks = value; |
373 | 4b9f349c | yoush97 | break; |
374 | case 46: |
||
375 | 7d73b57c | yoush97 | document.DTIsGateWay = value; |
376 | 4b9f349c | yoush97 | break; |
377 | case 47: |
||
378 | 7d73b57c | yoush97 | document.DTIsImport = value; |
379 | 4b9f349c | yoush97 | break; |
380 | case 48: |
||
381 | 7d73b57c | yoush97 | document.DTIsRegSystem = value; |
382 | break; |
||
383 | case 49: |
||
384 | 8eca8767 | taeseongkim | document.DTRemarks = value; |
385 | break; |
||
386 | } |
||
387 | } |
||
388 | |||
389 | result.documents.Add(document); |
||
390 | } |
||
391 | } |
||
392 | catch (Exception) |
||
393 | { |
||
394 | throw; |
||
395 | } |
||
396 | |||
397 | return result; |
||
398 | } |
||
399 | |||
400 | |||
401 | 057ca09a | taeseongkim | public ImportResult GemboxImport(string fileName) |
402 | { |
||
403 | ImportResult result = new ImportResult(); |
||
404 | |||
405 | StringBuilder sbErrMsg = new StringBuilder(); |
||
406 | |||
407 | try |
||
408 | { |
||
409 | var exFile = ExcelFile.Load(fileName); |
||
410 | var ws = exFile.Worksheets[0]; |
||
411 | |||
412 | int rowCount = ws.Rows.Count; |
||
413 | int columnCount = ws.CalculateMaxUsedColumns(); |
||
414 | int exRow = 8; |
||
415 | |||
416 | #region Excel 유효성검사 |
||
417 | |||
418 | //Excel 포멧체크 |
||
419 | 4b9f349c | yoush97 | if (rowCount < 10 || columnCount != 48) |
420 | 057ca09a | taeseongkim | { |
421 | result.Error = "Please, check the excel."; |
||
422 | return result; |
||
423 | } |
||
424 | |||
425 | #region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical) |
||
426 | ws.Rows.SelectMany(row => row.AllocatedCells) |
||
427 | 4b9f349c | yoush97 | .Where(col => col.Column.Index > 7 && col.Column.Index < 17 && col.Row.Index > exRow && col.Value == null) |
428 | 057ca09a | taeseongkim | .ToList() |
429 | .ForEach(p => sbErrMsg.Append(", " + p.Column.Name + p.Row.Name)); |
||
430 | |||
431 | if (sbErrMsg.Length > 0) |
||
432 | { |
||
433 | string errMsg = sbErrMsg.ToString().Substring(2); |
||
434 | if (errMsg.Length > 100) |
||
435 | { |
||
436 | errMsg = $"{errMsg.Substring(0, 100)}..."; |
||
437 | } |
||
438 | |||
439 | result.Error = $"Please, check null value in excel.\n{errMsg}"; |
||
440 | return result; |
||
441 | } |
||
442 | #endregion |
||
443 | |||
444 | 4b9f349c | yoush97 | #region 엑셀 도면명 중복 값 체크 |
445 | 057ca09a | taeseongkim | ws.Rows.SelectMany(row => row.AllocatedCells) |
446 | 4b9f349c | yoush97 | .Where(col => col.Column.Index == 11 && col.Row.Index > exRow) |
447 | 057ca09a | taeseongkim | .GroupBy(g => g.Row.Index) |
448 | .Select(p => new |
||
449 | { |
||
450 | rowIndex = p.Key, |
||
451 | docNo = p.Select(x => x.Value.ToString()).FirstOrDefault() |
||
452 | }) |
||
453 | .GroupBy(g => g.docNo) |
||
454 | .Where(p => p.Count() > 1) |
||
455 | .Select(p => p.Select(x => (x.rowIndex + 1).ToString()) |
||
456 | .Aggregate((x, y) => x.ToString() + "," + y.ToString()) |
||
457 | .ToString()) |
||
458 | .ToList().ForEach(p => sbErrMsg.Append("\n" + p.ToString())); |
||
459 | if (sbErrMsg.Length > 0) |
||
460 | { |
||
461 | sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : "); |
||
462 | string errMsg = sbErrMsg.ToString(); |
||
463 | if (errMsg.Length > 100) |
||
464 | { |
||
465 | errMsg = $"{errMsg.Substring(0, 100)}..."; |
||
466 | } |
||
467 | |||
468 | result.Error = $"Please, check the duplicate value in excel.\n{errMsg}"; |
||
469 | return result; |
||
470 | } |
||
471 | #endregion |
||
472 | |||
473 | #endregion |
||
474 | |||
475 | result.documents = new List<Documents>(); |
||
476 | |||
477 | ws.Rows.Where(row => row.Index > exRow) |
||
478 | .ToList() |
||
479 | .ForEach(p => |
||
480 | { |
||
481 | try |
||
482 | { |
||
483 | result.documents.Add(new Documents() |
||
484 | { |
||
485 | 4b9f349c | yoush97 | RefProjectCode = ws.Rows[p.Index].Cells[7].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[7].Value.ToString(), |
486 | System = ws.Rows[p.Index].Cells[8].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(), |
||
487 | SubSystemCode = ws.Rows[p.Index].Cells[9].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(), |
||
488 | DocumentNo = ws.Rows[p.Index].Cells[10].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(), |
||
489 | PersonInCharge = ws.Rows[p.Index].Cells[11].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[11].Value.ToString()).ID, |
||
490 | Worker = ws.Rows[p.Index].Cells[12].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[12].Value.ToString()).ID, |
||
491 | AVEVAPersonInCharge = ws.Rows[p.Index].Cells[13].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID, |
||
492 | AVEVAWorker = ws.Rows[p.Index].Cells[14].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[14].Value.ToString()).ID, |
||
493 | JobLevel = ws.Rows[p.Index].Cells[15].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[15].Value.ToString(), |
||
494 | RevisonNo = ws.Rows[p.Index].Cells[16].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(), |
||
495 | ToIsDiscussion = ws.Rows[p.Index].Cells[17].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(), |
||
496 | ToRemarks = ws.Rows[p.Index].Cells[18].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[18].Value.ToString(), |
||
497 | ToCreator = ws.Rows[p.Index].Cells[19].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[19].Value.ToString()).ID, |
||
498 | //toreview-20 |
||
499 | FrReviewStatus = ws.Rows[p.Index].Cells[21].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(), |
||
500 | FrRemarks = ws.Rows[p.Index].Cells[22].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[22].Value.ToString(), |
||
501 | FrCreator = ws.Rows[p.Index].Cells[23].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[23].Value.ToString()).ID, |
||
502 | //frreview-24 |
||
503 | ID2StartDate = ws.Rows[p.Index].Cells[25].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[25].Value?.ToString()), |
||
504 | ID2EndDate = ws.Rows[p.Index].Cells[26].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[26].Value?.ToString()), |
||
505 | ID2Status = ws.Rows[p.Index].Cells[27].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(), |
||
506 | ID2Issues = ws.Rows[p.Index].Cells[28].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[28].Value.ToString(), |
||
507 | //id2work-29 |
||
508 | ReplyModifications = ws.Rows[p.Index].Cells[30].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[30].Value.ToString(), |
||
509 | ReplyRequester = ws.Rows[p.Index].Cells[31].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(), |
||
510 | IsConvert = ws.Rows[p.Index].Cells[32].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(), |
||
511 | AVEVAConvertDate = ws.Rows[p.Index].Cells[33].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[33].Value.ToString()), |
||
512 | AVEVAWorkDate = ws.Rows[p.Index].Cells[34].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[34].Value.ToString()), |
||
513 | AVEVAStatus = ws.Rows[p.Index].Cells[35].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[35].Value.ToString(), |
||
514 | AVEVAIssues = ws.Rows[p.Index].Cells[36].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(), |
||
515 | AVEVAReviewDate = ws.Rows[p.Index].Cells[37].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[37].Value.ToString()), |
||
516 | ProdReviewer = ws.Rows[p.Index].Cells[38].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID, |
||
517 | ProdIsResult = ws.Rows[p.Index].Cells[39].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(), |
||
518 | ProdRemarks = ws.Rows[p.Index].Cells[40].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(), |
||
519 | ClientReviewer = ws.Rows[p.Index].Cells[41].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[41].Value.ToString()).ID, |
||
520 | ClientIsResult = ws.Rows[p.Index].Cells[42].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(), |
||
521 | ClientRemarks = ws.Rows[p.Index].Cells[43].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(), |
||
522 | DTIsGateWay = ws.Rows[p.Index].Cells[44].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString(), |
||
523 | DTIsImport = ws.Rows[p.Index].Cells[45].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[45].Value.ToString(), |
||
524 | DTIsRegSystem = ws.Rows[p.Index].Cells[46].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[46].Value.ToString(), |
||
525 | DTRemarks = ws.Rows[p.Index].Cells[47].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[47].Value.ToString() |
||
526 | |||
527 | /* |
||
528 | 057ca09a | taeseongkim | //UID = string.Empty, |
529 | //Type = this.radTextBoxInsulationType.Text, |
||
530 | //TempFrom = ws.Rows[exRow].Cells[p.Column.Index].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[exRow].Cells[p.Column.Index].Value), |
||
531 | //TempTo = ws.Rows[exRow + 2].Cells[p.Column.Index].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[exRow + 2].Cells[p.Column.Index].Value), |
||
532 | //NPS = ws.Rows[p.Row.Index].Cells[0].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[p.Row.Index].Cells[0].Value), |
||
533 | //Thickness = p.IsNullOrEmpty() ? 0 : Convert.ToSingle(p.Value) |
||
534 | |||
535 | RefProjectCode = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
||
536 | DocumentNo = ws.Rows[p.Index].Cells[6].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[6].Value.ToString(), |
||
537 | PersonInCharge = ws.Rows[p.Index].Cells[7].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[7].Value.ToString()).ID, |
||
538 | JobLevel = ws.Rows[p.Index].Cells[8].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(), |
||
539 | d9949772 | yoush97 | //IsTypical = ws.Rows[p.Index].Cells[9].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(), |
540 | 057ca09a | taeseongkim | RevisonNo = ws.Rows[p.Index].Cells[10].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(), |
541 | ToIsDiscussion = ws.Rows[p.Index].Cells[11].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[11].Value.ToString(), |
||
542 | ToRemarks = ws.Rows[p.Index].Cells[12].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[12].Value.ToString(), |
||
543 | ToCreator = ws.Rows[p.Index].Cells[13].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID, |
||
544 | //ToCapture = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
||
545 | //ToIsMarkup = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
||
546 | FrReviewStatus = ws.Rows[p.Index].Cells[16].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(), |
||
547 | FrRemarks = ws.Rows[p.Index].Cells[17].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(), |
||
548 | FrCreator = ws.Rows[p.Index].Cells[18].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[18].Value.ToString()).ID, |
||
549 | //FrCapture = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
||
550 | //FrIsMarkup = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
||
551 | 2aa2a446 | yoush97 | //IsID2Work = ws.Rows[p.Index].Cells[21].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(), |
552 | 057ca09a | taeseongkim | //ID2Connection = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
553 | ID2StartDate = ws.Rows[p.Index].Cells[23].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[23].Value?.ToString()), |
||
554 | ID2EndDate = ws.Rows[p.Index].Cells[24].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[24].Value?.ToString()), |
||
555 | //ID2JobTime = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
||
556 | ID2Status = ws.Rows[p.Index].Cells[26].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[26].Value.ToString(), |
||
557 | ID2Issues = ws.Rows[p.Index].Cells[27].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(), |
||
558 | //AVEVAConnection = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
||
559 | AVEVAConvertDate = ws.Rows[p.Index].Cells[29].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[29].Value.ToString()), |
||
560 | AVEVAReviewDate = ws.Rows[p.Index].Cells[30].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[30].Value.ToString()), |
||
561 | ab3c1c74 | yoush97 | //AVEVAWorkDate 추가필요 |
562 | 057ca09a | taeseongkim | AVEVAStatus = ws.Rows[p.Index].Cells[31].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(), |
563 | AVEVAIssues = ws.Rows[p.Index].Cells[32].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(), |
||
564 | ProdReviewer = ws.Rows[p.Index].Cells[35].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[35].Value.ToString()).ID, |
||
565 | ProdIsResult = ws.Rows[p.Index].Cells[36].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(), |
||
566 | ProdRemarks = ws.Rows[p.Index].Cells[37].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[37].Value.ToString(), |
||
567 | ClientReviewer = ws.Rows[p.Index].Cells[38].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID, |
||
568 | ClientIsResult = ws.Rows[p.Index].Cells[39].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(), |
||
569 | ClientRemarks = ws.Rows[p.Index].Cells[40].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(), |
||
570 | DTIsGateWay = ws.Rows[p.Index].Cells[41].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[41].Value.ToString(), |
||
571 | DTIsImport = ws.Rows[p.Index].Cells[42].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(), |
||
572 | DTIsRegSystem = ws.Rows[p.Index].Cells[43].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(), |
||
573 | DTRemarks = ws.Rows[p.Index].Cells[44].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString() |
||
574 | 4b9f349c | yoush97 | */ |
575 | 057ca09a | taeseongkim | }); |
576 | } |
||
577 | catch (Exception ex) |
||
578 | { |
||
579 | throw new Exception($"Excel Import Row :{p.Index} Error.",ex); |
||
580 | } |
||
581 | }); |
||
582 | |||
583 | } |
||
584 | catch (Exception) |
||
585 | { |
||
586 | throw; |
||
587 | } |
||
588 | |||
589 | return result; |
||
590 | } |
||
591 | } |
||
592 | } |