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 != 48)
|
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 > 7 && col.COUMMN_INDEX < 17 && 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 == 11 && 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().ForEach(p => sbErrMsg.Append("\n" + p.ToString()));
|
154
|
|
155
|
if (sbErrMsg.Length > 0)
|
156
|
{
|
157
|
sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : ");
|
158
|
string errMsg = sbErrMsg.ToString();
|
159
|
if (errMsg.Length > 100)
|
160
|
{
|
161
|
errMsg = $"{errMsg.Substring(0, 100)}...";
|
162
|
}
|
163
|
|
164
|
result.Error = $"Please, check the duplicate value in excel.\n{errMsg}";
|
165
|
return result;
|
166
|
}
|
167
|
#endregion
|
168
|
|
169
|
#endregion
|
170
|
|
171
|
result.documents = new List<Documents>();
|
172
|
result.Images = new List<System.Drawing.Image>();
|
173
|
|
174
|
foreach (var row in ExcelData.Where(row => row.ROW_INDEX > exRow).GroupBy(x => x.ROW_INDEX))
|
175
|
{
|
176
|
var document = new Documents();
|
177
|
//document.DocID = Guid.NewGuid().ToString();
|
178
|
|
179
|
int toreview = 0;
|
180
|
int frreview = 0;
|
181
|
int id2work = 0;
|
182
|
|
183
|
foreach (var cell in row.OrderBy(x=>x.COUMMN_INDEX))
|
184
|
{
|
185
|
var value = cell.VALUE.DefalutValue();
|
186
|
|
187
|
switch (cell.COUMMN_INDEX)
|
188
|
{
|
189
|
case 8:
|
190
|
document.RefProjectCode = this.GetProject(value).Code;
|
191
|
break;
|
192
|
case 9:
|
193
|
document.System = value;
|
194
|
break;
|
195
|
case 10:
|
196
|
document.SubSystemCode = value;
|
197
|
break;
|
198
|
case 11:
|
199
|
document.DocumentNo = value;
|
200
|
break;
|
201
|
case 12:
|
202
|
document.PersonInCharge = this.GetUser(value).ID;
|
203
|
break;
|
204
|
case 13:
|
205
|
document.Worker = this.GetUser(value).ID;
|
206
|
break;
|
207
|
case 14:
|
208
|
document.AVEVAPersonInCharge = this.GetUser(value).ID;
|
209
|
break;
|
210
|
case 15:
|
211
|
document.AVEVAWorker = this.GetUser(value).ID;
|
212
|
break;
|
213
|
case 16:
|
214
|
document.JobLevel = value;
|
215
|
break;
|
216
|
case 17:
|
217
|
document.RevisonNo = value;
|
218
|
break;
|
219
|
case 18:
|
220
|
document.ToIsDiscussion = value;
|
221
|
break;
|
222
|
case 19:
|
223
|
document.ToRemarks = value;
|
224
|
break;
|
225
|
case 20:
|
226
|
document.ToCreator = this.GetUser(value).ID;
|
227
|
break;
|
228
|
case 21:
|
229
|
if (value != null)
|
230
|
{
|
231
|
if (document.AttFiles == null)
|
232
|
{
|
233
|
document.AttFiles = new List<AttFileInfo>();
|
234
|
}
|
235
|
|
236
|
document.AttFiles.Add(new AttFileInfo
|
237
|
{
|
238
|
FileID = Guid.NewGuid().ToString(),
|
239
|
//RefID = document.DocID,
|
240
|
Category = "toreview",
|
241
|
FileType = "image/png",
|
242
|
FileName = "ClipBoard",
|
243
|
FilePath = "ClipBoard",
|
244
|
FileExtension = ".png",
|
245
|
CreatedDate = DateTime.Now,
|
246
|
Creator = document.ToCreator,
|
247
|
FileData = ExcelToImageData(value)
|
248
|
|
249
|
});
|
250
|
|
251
|
document.ToCapture = ++toreview;
|
252
|
}
|
253
|
break;
|
254
|
case 22:
|
255
|
document.FrReviewStatus = value;
|
256
|
break;
|
257
|
case 23:
|
258
|
document.FrRemarks = value;
|
259
|
break;
|
260
|
case 24:
|
261
|
document.FrCreator = this.GetUser(value).ID;
|
262
|
break;
|
263
|
case 25:
|
264
|
if (value != null)
|
265
|
{
|
266
|
if (document.AttFiles == null)
|
267
|
{
|
268
|
document.AttFiles = new List<AttFileInfo>();
|
269
|
}
|
270
|
|
271
|
document.AttFiles.Add(new AttFileInfo
|
272
|
{
|
273
|
FileID = Guid.NewGuid().ToString(),
|
274
|
//RefID = document.DocID,
|
275
|
Category = "frreview",
|
276
|
FileType = "image/png",
|
277
|
FileName = "ClipBoard",
|
278
|
FilePath = "ClipBoard",
|
279
|
FileExtension = ".png",
|
280
|
CreatedDate = DateTime.Now,
|
281
|
Creator = document.FrCreator,
|
282
|
FileData = ExcelToImageData(value)
|
283
|
|
284
|
});
|
285
|
|
286
|
document.FrCapture = ++frreview;
|
287
|
}
|
288
|
break;
|
289
|
case 26:
|
290
|
document.ID2StartDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
|
291
|
break;
|
292
|
case 27:
|
293
|
document.ID2EndDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
|
294
|
break;
|
295
|
case 28:
|
296
|
document.ID2Status = value;
|
297
|
break;
|
298
|
case 29:
|
299
|
document.ID2Issues = value;
|
300
|
break;
|
301
|
case 30:
|
302
|
if (value != null)
|
303
|
{
|
304
|
if (document.AttFiles == null)
|
305
|
{
|
306
|
document.AttFiles = new List<AttFileInfo>();
|
307
|
}
|
308
|
|
309
|
document.AttFiles.Add(new AttFileInfo
|
310
|
{
|
311
|
FileID = Guid.NewGuid().ToString(),
|
312
|
//RefID = document.DocID,
|
313
|
Category = "id2work",
|
314
|
FileType = "image/png",
|
315
|
FileName = "ClipBoard",
|
316
|
FilePath = "ClipBoard",
|
317
|
FileExtension = ".png",
|
318
|
CreatedDate = DateTime.Now,
|
319
|
Creator = document.FrCreator,
|
320
|
FileData = ExcelToImageData(value)
|
321
|
|
322
|
});
|
323
|
|
324
|
document.ID2Capture = ++id2work;
|
325
|
}
|
326
|
break;
|
327
|
case 31:
|
328
|
document.ReplyModifications = value;
|
329
|
break;
|
330
|
case 32:
|
331
|
document.ReplyRequester = value;
|
332
|
break;
|
333
|
case 33:
|
334
|
document.IsConvert = value;
|
335
|
break;
|
336
|
case 34:
|
337
|
document.AVEVAConvertDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
|
338
|
break;
|
339
|
case 35:
|
340
|
document.AVEVAWorkDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
|
341
|
break;
|
342
|
case 36:
|
343
|
document.AVEVAStatus = value;
|
344
|
break;
|
345
|
case 37:
|
346
|
document.AVEVAIssues = value;
|
347
|
break;
|
348
|
case 38:
|
349
|
document.AVEVAReviewDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
|
350
|
break;
|
351
|
case 39:
|
352
|
document.ProdReviewer = this.GetUser(value).ID;
|
353
|
break;
|
354
|
case 40:
|
355
|
document.ProdIsResult = value;
|
356
|
break;
|
357
|
case 41:
|
358
|
document.ProdRemarks = value;
|
359
|
break;
|
360
|
case 42:
|
361
|
document.ClientReviewer = this.GetUser(value).ID;
|
362
|
break;
|
363
|
case 43:
|
364
|
document.ClientIsResult = value;
|
365
|
break;
|
366
|
case 44:
|
367
|
document.ClientRemarks = value;
|
368
|
break;
|
369
|
case 45:
|
370
|
document.DTIsGateWay = value;
|
371
|
break;
|
372
|
case 46:
|
373
|
document.DTIsImport = value;
|
374
|
break;
|
375
|
case 47:
|
376
|
document.DTIsRegSystem = value;
|
377
|
break;
|
378
|
case 48:
|
379
|
document.DTRemarks = value;
|
380
|
break;
|
381
|
}
|
382
|
}
|
383
|
|
384
|
result.documents.Add(document);
|
385
|
}
|
386
|
}
|
387
|
catch (Exception)
|
388
|
{
|
389
|
throw;
|
390
|
}
|
391
|
|
392
|
return result;
|
393
|
}
|
394
|
|
395
|
|
396
|
public ImportResult GemboxImport(string fileName)
|
397
|
{
|
398
|
ImportResult result = new ImportResult();
|
399
|
|
400
|
StringBuilder sbErrMsg = new StringBuilder();
|
401
|
|
402
|
try
|
403
|
{
|
404
|
var exFile = ExcelFile.Load(fileName);
|
405
|
var ws = exFile.Worksheets[0];
|
406
|
|
407
|
int rowCount = ws.Rows.Count;
|
408
|
int columnCount = ws.CalculateMaxUsedColumns();
|
409
|
int exRow = 8;
|
410
|
|
411
|
#region Excel 유효성검사
|
412
|
|
413
|
//Excel 포멧체크
|
414
|
if (rowCount < 10 || columnCount != 48)
|
415
|
{
|
416
|
result.Error = "Please, check the excel.";
|
417
|
return result;
|
418
|
}
|
419
|
|
420
|
#region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical)
|
421
|
ws.Rows.SelectMany(row => row.AllocatedCells)
|
422
|
.Where(col => col.Column.Index > 7 && col.Column.Index < 17 && col.Row.Index > exRow && col.Value == null)
|
423
|
.ToList()
|
424
|
.ForEach(p => sbErrMsg.Append(", " + p.Column.Name + p.Row.Name));
|
425
|
|
426
|
if (sbErrMsg.Length > 0)
|
427
|
{
|
428
|
string errMsg = sbErrMsg.ToString().Substring(2);
|
429
|
if (errMsg.Length > 100)
|
430
|
{
|
431
|
errMsg = $"{errMsg.Substring(0, 100)}...";
|
432
|
}
|
433
|
|
434
|
result.Error = $"Please, check null value in excel.\n{errMsg}";
|
435
|
return result;
|
436
|
}
|
437
|
#endregion
|
438
|
|
439
|
#region 엑셀 도면명 중복 값 체크
|
440
|
ws.Rows.SelectMany(row => row.AllocatedCells)
|
441
|
.Where(col => col.Column.Index == 11 && col.Row.Index > exRow)
|
442
|
.GroupBy(g => g.Row.Index)
|
443
|
.Select(p => new
|
444
|
{
|
445
|
rowIndex = p.Key,
|
446
|
docNo = p.Select(x => x.Value.ToString()).FirstOrDefault()
|
447
|
})
|
448
|
.GroupBy(g => g.docNo)
|
449
|
.Where(p => p.Count() > 1)
|
450
|
.Select(p => p.Select(x => (x.rowIndex + 1).ToString())
|
451
|
.Aggregate((x, y) => x.ToString() + "," + y.ToString())
|
452
|
.ToString())
|
453
|
.ToList().ForEach(p => sbErrMsg.Append("\n" + p.ToString()));
|
454
|
if (sbErrMsg.Length > 0)
|
455
|
{
|
456
|
sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : ");
|
457
|
string errMsg = sbErrMsg.ToString();
|
458
|
if (errMsg.Length > 100)
|
459
|
{
|
460
|
errMsg = $"{errMsg.Substring(0, 100)}...";
|
461
|
}
|
462
|
|
463
|
result.Error = $"Please, check the duplicate value in excel.\n{errMsg}";
|
464
|
return result;
|
465
|
}
|
466
|
#endregion
|
467
|
|
468
|
#endregion
|
469
|
|
470
|
result.documents = new List<Documents>();
|
471
|
|
472
|
ws.Rows.Where(row => row.Index > exRow)
|
473
|
.ToList()
|
474
|
.ForEach(p =>
|
475
|
{
|
476
|
try
|
477
|
{
|
478
|
result.documents.Add(new Documents()
|
479
|
{
|
480
|
RefProjectCode = ws.Rows[p.Index].Cells[7].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[7].Value.ToString(),
|
481
|
System = ws.Rows[p.Index].Cells[8].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(),
|
482
|
SubSystemCode = ws.Rows[p.Index].Cells[9].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(),
|
483
|
DocumentNo = ws.Rows[p.Index].Cells[10].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(),
|
484
|
PersonInCharge = ws.Rows[p.Index].Cells[11].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[11].Value.ToString()).ID,
|
485
|
Worker = ws.Rows[p.Index].Cells[12].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[12].Value.ToString()).ID,
|
486
|
AVEVAPersonInCharge = ws.Rows[p.Index].Cells[13].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID,
|
487
|
AVEVAWorker = ws.Rows[p.Index].Cells[14].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[14].Value.ToString()).ID,
|
488
|
JobLevel = ws.Rows[p.Index].Cells[15].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[15].Value.ToString(),
|
489
|
RevisonNo = ws.Rows[p.Index].Cells[16].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(),
|
490
|
ToIsDiscussion = ws.Rows[p.Index].Cells[17].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(),
|
491
|
ToRemarks = ws.Rows[p.Index].Cells[18].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[18].Value.ToString(),
|
492
|
ToCreator = ws.Rows[p.Index].Cells[19].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[19].Value.ToString()).ID,
|
493
|
//toreview-20
|
494
|
FrReviewStatus = ws.Rows[p.Index].Cells[21].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(),
|
495
|
FrRemarks = ws.Rows[p.Index].Cells[22].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[22].Value.ToString(),
|
496
|
FrCreator = ws.Rows[p.Index].Cells[23].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[23].Value.ToString()).ID,
|
497
|
//frreview-24
|
498
|
ID2StartDate = ws.Rows[p.Index].Cells[25].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[25].Value?.ToString()),
|
499
|
ID2EndDate = ws.Rows[p.Index].Cells[26].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[26].Value?.ToString()),
|
500
|
ID2Status = ws.Rows[p.Index].Cells[27].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(),
|
501
|
ID2Issues = ws.Rows[p.Index].Cells[28].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[28].Value.ToString(),
|
502
|
//id2work-29
|
503
|
ReplyModifications = ws.Rows[p.Index].Cells[30].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[30].Value.ToString(),
|
504
|
ReplyRequester = ws.Rows[p.Index].Cells[31].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(),
|
505
|
IsConvert = ws.Rows[p.Index].Cells[32].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(),
|
506
|
AVEVAConvertDate = ws.Rows[p.Index].Cells[33].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[33].Value.ToString()),
|
507
|
AVEVAWorkDate = ws.Rows[p.Index].Cells[34].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[34].Value.ToString()),
|
508
|
AVEVAStatus = ws.Rows[p.Index].Cells[35].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[35].Value.ToString(),
|
509
|
AVEVAIssues = ws.Rows[p.Index].Cells[36].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(),
|
510
|
AVEVAReviewDate = ws.Rows[p.Index].Cells[37].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[37].Value.ToString()),
|
511
|
ProdReviewer = ws.Rows[p.Index].Cells[38].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID,
|
512
|
ProdIsResult = ws.Rows[p.Index].Cells[39].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(),
|
513
|
ProdRemarks = ws.Rows[p.Index].Cells[40].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(),
|
514
|
ClientReviewer = ws.Rows[p.Index].Cells[41].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[41].Value.ToString()).ID,
|
515
|
ClientIsResult = ws.Rows[p.Index].Cells[42].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(),
|
516
|
ClientRemarks = ws.Rows[p.Index].Cells[43].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(),
|
517
|
DTIsGateWay = ws.Rows[p.Index].Cells[44].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString(),
|
518
|
DTIsImport = ws.Rows[p.Index].Cells[45].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[45].Value.ToString(),
|
519
|
DTIsRegSystem = ws.Rows[p.Index].Cells[46].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[46].Value.ToString(),
|
520
|
DTRemarks = ws.Rows[p.Index].Cells[47].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[47].Value.ToString()
|
521
|
|
522
|
/*
|
523
|
//UID = string.Empty,
|
524
|
//Type = this.radTextBoxInsulationType.Text,
|
525
|
//TempFrom = ws.Rows[exRow].Cells[p.Column.Index].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[exRow].Cells[p.Column.Index].Value),
|
526
|
//TempTo = ws.Rows[exRow + 2].Cells[p.Column.Index].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[exRow + 2].Cells[p.Column.Index].Value),
|
527
|
//NPS = ws.Rows[p.Row.Index].Cells[0].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[p.Row.Index].Cells[0].Value),
|
528
|
//Thickness = p.IsNullOrEmpty() ? 0 : Convert.ToSingle(p.Value)
|
529
|
|
530
|
RefProjectCode = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
|
531
|
DocumentNo = ws.Rows[p.Index].Cells[6].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[6].Value.ToString(),
|
532
|
PersonInCharge = ws.Rows[p.Index].Cells[7].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[7].Value.ToString()).ID,
|
533
|
JobLevel = ws.Rows[p.Index].Cells[8].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(),
|
534
|
//IsTypical = ws.Rows[p.Index].Cells[9].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(),
|
535
|
RevisonNo = ws.Rows[p.Index].Cells[10].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(),
|
536
|
ToIsDiscussion = ws.Rows[p.Index].Cells[11].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[11].Value.ToString(),
|
537
|
ToRemarks = ws.Rows[p.Index].Cells[12].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[12].Value.ToString(),
|
538
|
ToCreator = ws.Rows[p.Index].Cells[13].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID,
|
539
|
//ToCapture = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
|
540
|
//ToIsMarkup = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
|
541
|
FrReviewStatus = ws.Rows[p.Index].Cells[16].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(),
|
542
|
FrRemarks = ws.Rows[p.Index].Cells[17].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(),
|
543
|
FrCreator = ws.Rows[p.Index].Cells[18].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[18].Value.ToString()).ID,
|
544
|
//FrCapture = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
|
545
|
//FrIsMarkup = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
|
546
|
//IsID2Work = ws.Rows[p.Index].Cells[21].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(),
|
547
|
//ID2Connection = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
|
548
|
ID2StartDate = ws.Rows[p.Index].Cells[23].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[23].Value?.ToString()),
|
549
|
ID2EndDate = ws.Rows[p.Index].Cells[24].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[24].Value?.ToString()),
|
550
|
//ID2JobTime = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
|
551
|
ID2Status = ws.Rows[p.Index].Cells[26].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[26].Value.ToString(),
|
552
|
ID2Issues = ws.Rows[p.Index].Cells[27].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(),
|
553
|
//AVEVAConnection = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
|
554
|
AVEVAConvertDate = ws.Rows[p.Index].Cells[29].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[29].Value.ToString()),
|
555
|
AVEVAReviewDate = ws.Rows[p.Index].Cells[30].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[30].Value.ToString()),
|
556
|
//AVEVAWorkDate 추가필요
|
557
|
AVEVAStatus = ws.Rows[p.Index].Cells[31].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(),
|
558
|
AVEVAIssues = ws.Rows[p.Index].Cells[32].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(),
|
559
|
ProdReviewer = ws.Rows[p.Index].Cells[35].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[35].Value.ToString()).ID,
|
560
|
ProdIsResult = ws.Rows[p.Index].Cells[36].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(),
|
561
|
ProdRemarks = ws.Rows[p.Index].Cells[37].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[37].Value.ToString(),
|
562
|
ClientReviewer = ws.Rows[p.Index].Cells[38].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID,
|
563
|
ClientIsResult = ws.Rows[p.Index].Cells[39].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(),
|
564
|
ClientRemarks = ws.Rows[p.Index].Cells[40].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(),
|
565
|
DTIsGateWay = ws.Rows[p.Index].Cells[41].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[41].Value.ToString(),
|
566
|
DTIsImport = ws.Rows[p.Index].Cells[42].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(),
|
567
|
DTIsRegSystem = ws.Rows[p.Index].Cells[43].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(),
|
568
|
DTRemarks = ws.Rows[p.Index].Cells[44].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString()
|
569
|
*/
|
570
|
});
|
571
|
}
|
572
|
catch (Exception ex)
|
573
|
{
|
574
|
throw new Exception($"Excel Import Row :{p.Index} Error.",ex);
|
575
|
}
|
576
|
});
|
577
|
|
578
|
}
|
579
|
catch (Exception)
|
580
|
{
|
581
|
throw;
|
582
|
}
|
583
|
|
584
|
return result;
|
585
|
}
|
586
|
}
|
587
|
}
|