hytos / ID2.Manager / ID2.Manager.Common / Helpers / ID2Excel.cs @ 1018a498
이력 | 보기 | 이력해설 | 다운로드 (33.2 KB)
1 |
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 |
|
8 |
using System.IO; |
9 |
using System.IO.Compression; |
10 |
|
11 |
using GemBox.Spreadsheet; |
12 |
|
13 |
namespace ID2.Manager.Common.Helpers |
14 |
{ |
15 |
public class ID2Excel :IDisposable |
16 |
{ |
17 |
readonly Informations informations = Informations.Instance; |
18 |
|
19 |
public void Dispose() |
20 |
{ |
21 |
try |
22 |
{ |
23 |
} |
24 |
catch (Exception) |
25 |
{ |
26 |
throw; |
27 |
} |
28 |
finally |
29 |
{ |
30 |
GC.Collect(2); |
31 |
GC.Collect(2); |
32 |
} |
33 |
} |
34 |
|
35 |
public ID2Excel() { } |
36 |
|
37 |
private ProjectInfo GetProject(string project) |
38 |
{ |
39 |
List<ProjectInfo> projects = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList(); |
40 |
|
41 |
ProjectInfo prjInfo = projects.FirstOrDefault(x => x.Code.Equals(project)); |
42 |
if (prjInfo != null) return prjInfo; |
43 |
|
44 |
prjInfo = projects.FirstOrDefault(x => x.Name.Equals(project)); |
45 |
if (prjInfo != null) return prjInfo; |
46 |
|
47 |
return prjInfo ?? new ProjectInfo(); |
48 |
} |
49 |
|
50 |
private UserInfo GetUser(string user) |
51 |
{ |
52 |
UserInfo userInfo = informations.UserList.Where(x => x.ID.Equals(user)).FirstOrDefault(); |
53 |
if (userInfo != null) return userInfo; |
54 |
|
55 |
userInfo = informations.UserList.Where(x => x.Name.Equals(user)).FirstOrDefault(); |
56 |
if (userInfo != null) return userInfo; |
57 |
|
58 |
return userInfo ?? new UserInfo(); |
59 |
} |
60 |
|
61 |
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 |
private System.Drawing.Image GetImage(string base64String) |
77 |
{ |
78 |
System.Drawing.Image result = null; |
79 |
|
80 |
var str = CompressHelper.DecompressString(base64String); |
81 |
|
82 |
byte[] imageBytes = Convert.FromBase64String(str); |
83 |
|
84 |
using (MemoryStream ms = new MemoryStream(imageBytes)) |
85 |
{ |
86 |
result = System.Drawing.Image.FromStream(ms); |
87 |
} |
88 |
|
89 |
return result; |
90 |
} |
91 |
|
92 |
private byte[] ExcelToImageData(string base64String) |
93 |
{ |
94 |
var str = CompressHelper.DecompressString(base64String); |
95 |
|
96 |
return Convert.FromBase64String(str); |
97 |
} |
98 |
|
99 |
|
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 |
if (rowCount < 10 || columnCount != 49) |
116 |
{ |
117 |
result.Error = "Please, check the excel."; |
118 |
return result; |
119 |
} |
120 |
|
121 |
#region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical) |
122 |
ExcelData.Where(col => col.ROW_INDEX > exRow) |
123 |
.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 |
|
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 |
#region 엑셀 도면명 중복 값 체크 |
141 |
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 |
|
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 |
result.Images = new List<System.Drawing.Image>(); |
174 |
|
175 |
foreach (var row in ExcelData.Where(row => row.ROW_INDEX > exRow).GroupBy(x => x.ROW_INDEX)) |
176 |
{ |
177 |
var document = new Documents(); |
178 |
//document.DocID = Guid.NewGuid().ToString(); |
179 |
|
180 |
int toreview = 0; |
181 |
int frreview = 0; |
182 |
int id2work = 0; |
183 |
|
184 |
foreach (var cell in row.OrderBy(x=>x.COUMMN_INDEX)) |
185 |
{ |
186 |
var value = cell.VALUE.DefalutValue(); |
187 |
|
188 |
switch (cell.COUMMN_INDEX) |
189 |
{ |
190 |
case 9: |
191 |
document.RefProjectCode = this.GetProject(value).Code; |
192 |
if (!string.IsNullOrEmpty(document.RefProjectCode)) |
193 |
{ |
194 |
document.Team = this.GetProject(value).Team; |
195 |
} |
196 |
break; |
197 |
case 10: |
198 |
document.System = value; |
199 |
break; |
200 |
case 11: |
201 |
document.SubSystemCode = value; |
202 |
break; |
203 |
case 12: |
204 |
document.DocumentNo = value; |
205 |
break; |
206 |
case 13: |
207 |
document.PersonInCharge = this.GetUser(value).ID; |
208 |
break; |
209 |
case 14: |
210 |
document.Worker = this.GetUser(value).ID; |
211 |
break; |
212 |
case 15: |
213 |
document.AVEVAPersonInCharge = this.GetUser(value).ID; |
214 |
break; |
215 |
case 16: |
216 |
document.AVEVAWorker = this.GetUser(value).ID; |
217 |
break; |
218 |
case 17: |
219 |
document.JobLevel = value; |
220 |
break; |
221 |
case 18: |
222 |
document.RevisonNo = value; |
223 |
break; |
224 |
case 19: |
225 |
document.ToIsDiscussion = value; |
226 |
break; |
227 |
case 20: |
228 |
document.ToRemarks = value; |
229 |
break; |
230 |
case 21: |
231 |
document.ToCreator = this.GetUser(value).ID; |
232 |
break; |
233 |
case 22: |
234 |
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 |
//RefID = document.DocID, |
245 |
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 |
|
256 |
document.ToCapture = ++toreview; |
257 |
} |
258 |
break; |
259 |
case 23: |
260 |
document.FrReviewStatus = value; |
261 |
break; |
262 |
case 24: |
263 |
document.FrRemarks = value; |
264 |
break; |
265 |
case 25: |
266 |
document.FrCreator = this.GetUser(value).ID; |
267 |
break; |
268 |
case 26: |
269 |
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 |
//RefID = document.DocID, |
280 |
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 |
|
291 |
document.FrCapture = ++frreview; |
292 |
} |
293 |
break; |
294 |
case 27: |
295 |
document.ID2StartDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
296 |
break; |
297 |
case 28: |
298 |
document.ID2EndDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
299 |
break; |
300 |
case 29: |
301 |
document.ID2Status = value; |
302 |
break; |
303 |
case 30: |
304 |
document.ID2Issues = value; |
305 |
break; |
306 |
case 31: |
307 |
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 |
|
329 |
document.ID2Capture = ++id2work; |
330 |
} |
331 |
break; |
332 |
case 32: |
333 |
document.ReplyModifications = value; |
334 |
break; |
335 |
case 33: |
336 |
document.ReplyRequester = this.GetUser(value).ID; |
337 |
break; |
338 |
case 34: |
339 |
document.IsConvert = value; |
340 |
break; |
341 |
case 35: |
342 |
document.AVEVAConvertDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
343 |
break; |
344 |
case 36: |
345 |
document.AVEVAWorkDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
346 |
break; |
347 |
case 37: |
348 |
document.AVEVAStatus = value; |
349 |
break; |
350 |
case 38: |
351 |
document.AVEVAIssues = value; |
352 |
break; |
353 |
case 39: |
354 |
document.AVEVAReviewDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
355 |
break; |
356 |
case 40: |
357 |
document.ProdReviewer = this.GetUser(value).ID; |
358 |
break; |
359 |
case 41: |
360 |
document.ProdIsResult = value; |
361 |
break; |
362 |
case 42: |
363 |
document.ProdRemarks = value; |
364 |
break; |
365 |
case 43: |
366 |
document.ClientReviewer = this.GetUser(value).ID; |
367 |
break; |
368 |
case 44: |
369 |
document.ClientIsResult = value; |
370 |
break; |
371 |
case 45: |
372 |
document.ClientRemarks = value; |
373 |
break; |
374 |
case 46: |
375 |
document.DTIsGateWay = value; |
376 |
break; |
377 |
case 47: |
378 |
document.DTIsImport = value; |
379 |
break; |
380 |
case 48: |
381 |
document.DTIsRegSystem = value; |
382 |
break; |
383 |
case 49: |
384 |
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 |
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 |
if (rowCount < 10 || columnCount != 48) |
420 |
{ |
421 |
result.Error = "Please, check the excel."; |
422 |
return result; |
423 |
} |
424 |
|
425 |
#region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical) |
426 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
427 |
.Where(col => col.Column.Index > 7 && col.Column.Index < 17 && col.Row.Index > exRow && col.Value == null) |
428 |
.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 |
#region 엑셀 도면명 중복 값 체크 |
445 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
446 |
.Where(col => col.Column.Index == 11 && col.Row.Index > exRow) |
447 |
.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 |
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 |
//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 |
//IsTypical = ws.Rows[p.Index].Cells[9].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(), |
540 |
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 |
//IsID2Work = ws.Rows[p.Index].Cells[21].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(), |
552 |
//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 |
//AVEVAWorkDate 추가필요 |
562 |
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 |
*/ |
575 |
}); |
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 |
} |