개정판 4b9f349c
issue #0000
excel 관련 수정진행중
- import
- export
- excel 포멧
Change-Id: I19c8d12043705db1d8ae12f6b1f574dace0e224a
ID2.Manager/ID2.Manager.Common/Helpers/ID2Excel.cs | ||
---|---|---|
103 | 103 |
#region Excel 유효성검사 |
104 | 104 |
|
105 | 105 |
//Excel 포멧체크 |
106 |
if (rowCount < 10 || columnCount != 45)
|
|
106 |
if (rowCount < 10 || columnCount != 48)
|
|
107 | 107 |
{ |
108 | 108 |
result.Error = "Please, check the excel."; |
109 | 109 |
return result; |
... | ... | |
111 | 111 |
|
112 | 112 |
#region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical) |
113 | 113 |
ExcelData.Where(col => col.ROW_INDEX > exRow) |
114 |
.Where(col => col.COUMMN_INDEX > 5 && col.COUMMN_INDEX < 11 && col.ROW_INDEX > exRow && string.IsNullOrEmpty(col.VALUE))
|
|
114 |
.Where(col => col.COUMMN_INDEX > 7 && col.COUMMN_INDEX < 17 && col.ROW_INDEX > exRow && string.IsNullOrEmpty(col.VALUE))
|
|
115 | 115 |
.ToList() |
116 | 116 |
.ForEach(p => sbErrMsg.Append(", " + p.TopLeftCell)); |
117 | 117 |
|
... | ... | |
128 | 128 |
} |
129 | 129 |
#endregion |
130 | 130 |
|
131 |
#region 엑셀 도명명 중복 값 체크
|
|
132 |
ExcelData.Where(col => col.COUMMN_INDEX == 7 && col.ROW_INDEX > exRow)
|
|
131 |
#region 엑셀 도면명 중복 값 체크
|
|
132 |
ExcelData.Where(col => col.COUMMN_INDEX == 11 && col.ROW_INDEX > exRow)
|
|
133 | 133 |
.GroupBy(g => g.ROW_INDEX) |
134 | 134 |
.Select(p => new |
135 | 135 |
{ |
... | ... | |
138 | 138 |
}) |
139 | 139 |
.GroupBy(g => g.docNo) |
140 | 140 |
.Where(p => p.Count() > 1) |
141 |
.Select(p => p.Select(x => (x.rowIndex + 1).ToString())
|
|
141 |
.Select(p => p.Select(x => x.rowIndex.ToString())
|
|
142 | 142 |
.Aggregate((x, y) => x.ToString() + "," + y.ToString()) |
143 | 143 |
.ToString()) |
144 | 144 |
.ToList().ForEach(p => sbErrMsg.Append("\n" + p.ToString())); |
... | ... | |
173 | 173 |
|
174 | 174 |
switch (cell.COUMMN_INDEX) |
175 | 175 |
{ |
176 |
case 6:
|
|
176 |
case 8:
|
|
177 | 177 |
document.RefProjectCode = value; |
178 | 178 |
break; |
179 |
case 7: |
|
179 |
case 9: |
|
180 |
document.System = value; |
|
181 |
break; |
|
182 |
case 10: |
|
183 |
document.SubSystemCode = value; |
|
184 |
break; |
|
185 |
case 11: |
|
180 | 186 |
document.DocumentNo = value; |
181 | 187 |
break; |
182 |
case 8:
|
|
188 |
case 12:
|
|
183 | 189 |
document.PersonInCharge = this.GetUser(value).ID; |
184 | 190 |
break; |
185 |
case 9: |
|
191 |
case 13: |
|
192 |
document.Worker = this.GetUser(value).ID; |
|
193 |
break; |
|
194 |
case 14: |
|
195 |
document.AVEVAPersonInCharge = this.GetUser(value).ID; |
|
196 |
break; |
|
197 |
case 15: |
|
198 |
document.AVEVAWorker = this.GetUser(value).ID; |
|
199 |
break; |
|
200 |
case 16: |
|
186 | 201 |
document.JobLevel = value; |
187 | 202 |
break; |
188 |
|
|
189 |
//case 10: |
|
190 |
// document.IsTypical = value; |
|
191 |
// break; |
|
192 |
case 11: |
|
203 |
case 17: |
|
193 | 204 |
document.RevisonNo = value; |
194 | 205 |
break; |
195 |
case 12:
|
|
206 |
case 18:
|
|
196 | 207 |
document.ToIsDiscussion = value; |
197 | 208 |
break; |
198 |
case 13:
|
|
209 |
case 19:
|
|
199 | 210 |
document.ToRemarks = value; |
200 | 211 |
break; |
201 |
case 14:
|
|
212 |
case 20:
|
|
202 | 213 |
document.ToCreator = this.GetUser(value).ID; |
203 | 214 |
break; |
204 |
case 15:
|
|
215 |
case 21:
|
|
205 | 216 |
if (value != null) |
206 | 217 |
{ |
207 | 218 |
if (document.AttFiles == null) |
... | ... | |
225 | 236 |
}); |
226 | 237 |
} |
227 | 238 |
break; |
228 |
case 17:
|
|
239 |
case 22:
|
|
229 | 240 |
document.FrReviewStatus = value; |
230 | 241 |
break; |
231 |
case 18:
|
|
242 |
case 23:
|
|
232 | 243 |
document.FrRemarks = value; |
233 | 244 |
break; |
234 |
case 19:
|
|
245 |
case 24:
|
|
235 | 246 |
document.FrCreator = this.GetUser(value).ID; |
236 | 247 |
break; |
237 |
case 20:
|
|
248 |
case 25:
|
|
238 | 249 |
if (value != null) |
239 | 250 |
{ |
240 | 251 |
if (document.AttFiles == null) |
... | ... | |
258 | 269 |
}); |
259 | 270 |
} |
260 | 271 |
break; |
261 |
//case 22: |
|
262 |
// document.IsID2Work = value; |
|
263 |
// break; |
|
264 |
case 24: |
|
272 |
case 26: |
|
265 | 273 |
document.ID2StartDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
266 | 274 |
break; |
267 |
case 25:
|
|
275 |
case 27:
|
|
268 | 276 |
document.ID2EndDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
269 | 277 |
break; |
270 |
case 27:
|
|
278 |
case 28:
|
|
271 | 279 |
document.ID2Status = value; |
272 | 280 |
break; |
273 |
case 28:
|
|
281 |
case 29:
|
|
274 | 282 |
document.ID2Issues = value; |
275 | 283 |
break; |
276 | 284 |
case 30: |
277 |
document.AVEVAConvertDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
|
285 |
if (value != null) |
|
286 |
{ |
|
287 |
if (document.AttFiles == null) |
|
288 |
{ |
|
289 |
document.AttFiles = new List<AttFileInfo>(); |
|
290 |
} |
|
291 |
|
|
292 |
document.AttFiles.Add(new AttFileInfo |
|
293 |
{ |
|
294 |
FileID = Guid.NewGuid().ToString(), |
|
295 |
//RefID = document.DocID, |
|
296 |
Category = "id2work", |
|
297 |
FileType = "image/png", |
|
298 |
FileName = "ClipBoard", |
|
299 |
FilePath = "ClipBoard", |
|
300 |
FileExtension = ".png", |
|
301 |
CreatedDate = DateTime.Now, |
|
302 |
Creator = document.FrCreator, |
|
303 |
FileData = ExcelToImageData(value) |
|
304 |
|
|
305 |
}); |
|
306 |
} |
|
278 | 307 |
break; |
279 | 308 |
case 31: |
280 |
document.AVEVAReviewDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
|
|
309 |
document.ReplyModifications = value;
|
|
281 | 310 |
break; |
282 |
//case 31:추가필요 |
|
283 |
// document.AVEVAWorkDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
|
284 |
// break; |
|
285 | 311 |
case 32: |
286 |
document.AVEVAStatus = value;
|
|
312 |
document.ReplyRequester = value;
|
|
287 | 313 |
break; |
288 | 314 |
case 33: |
289 |
document.AVEVAIssues = value; |
|
315 |
document.IsConvert = value; |
|
316 |
break; |
|
317 |
case 34: |
|
318 |
document.AVEVAConvertDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
|
319 |
break; |
|
320 |
case 35: |
|
321 |
document.AVEVAWorkDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
|
290 | 322 |
break; |
291 | 323 |
case 36: |
292 |
document.ProdReviewer = this.GetUser(value).ID;
|
|
324 |
document.AVEVAStatus = value;
|
|
293 | 325 |
break; |
294 | 326 |
case 37: |
295 |
document.ProdIsResult = value;
|
|
327 |
document.AVEVAIssues = value;
|
|
296 | 328 |
break; |
297 | 329 |
case 38: |
298 |
document.ProdRemarks = value;
|
|
330 |
document.AVEVAReviewDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
|
|
299 | 331 |
break; |
300 | 332 |
case 39: |
301 |
document.ClientReviewer = this.GetUser(value).ID;
|
|
333 |
document.ProdReviewer = this.GetUser(value).ID;
|
|
302 | 334 |
break; |
303 | 335 |
case 40: |
304 |
document.ClientIsResult = value;
|
|
336 |
document.ProdIsResult = value;
|
|
305 | 337 |
break; |
306 | 338 |
case 41: |
307 |
document.ClientRemarks = value;
|
|
339 |
document.ProdRemarks = value;
|
|
308 | 340 |
break; |
309 | 341 |
case 42: |
310 |
document.DTIsGateWay = value;
|
|
342 |
document.ClientReviewer = this.GetUser(value).ID;
|
|
311 | 343 |
break; |
312 | 344 |
case 43: |
313 |
document.DTIsImport = value;
|
|
345 |
document.ClientIsResult = value;
|
|
314 | 346 |
break; |
315 | 347 |
case 44: |
316 |
document.DTIsRegSystem = value;
|
|
348 |
document.ClientRemarks = value;
|
|
317 | 349 |
break; |
318 | 350 |
case 45: |
351 |
document.DTIsGateWay = value; |
|
352 |
break; |
|
353 |
case 46: |
|
354 |
document.DTIsImport = value; |
|
355 |
break; |
|
356 |
case 47: |
|
357 |
document.DTIsRegSystem = value; |
|
358 |
break; |
|
359 |
case 48: |
|
319 | 360 |
document.DTRemarks = value; |
320 | 361 |
break; |
321 | 362 |
} |
322 |
|
|
323 | 363 |
} |
324 | 364 |
|
325 | 365 |
result.documents.Add(document); |
... | ... | |
352 | 392 |
#region Excel 유효성검사 |
353 | 393 |
|
354 | 394 |
//Excel 포멧체크 |
355 |
if (rowCount < 10 || columnCount != 45)
|
|
395 |
if (rowCount < 10 || columnCount != 48)
|
|
356 | 396 |
{ |
357 | 397 |
result.Error = "Please, check the excel."; |
358 | 398 |
return result; |
... | ... | |
360 | 400 |
|
361 | 401 |
#region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical) |
362 | 402 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
363 |
.Where(col => col.Column.Index > 5 && col.Column.Index < 10 && col.Row.Index > exRow && col.Value == null)
|
|
403 |
.Where(col => col.Column.Index > 7 && col.Column.Index < 17 && col.Row.Index > exRow && col.Value == null)
|
|
364 | 404 |
.ToList() |
365 | 405 |
.ForEach(p => sbErrMsg.Append(", " + p.Column.Name + p.Row.Name)); |
366 | 406 |
|
... | ... | |
377 | 417 |
} |
378 | 418 |
#endregion |
379 | 419 |
|
380 |
#region 엑셀 도명명 중복 값 체크
|
|
420 |
#region 엑셀 도면명 중복 값 체크
|
|
381 | 421 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
382 |
.Where(col => col.Column.Index == 6 && col.Row.Index > exRow)
|
|
422 |
.Where(col => col.Column.Index == 11 && col.Row.Index > exRow)
|
|
383 | 423 |
.GroupBy(g => g.Row.Index) |
384 | 424 |
.Select(p => new |
385 | 425 |
{ |
... | ... | |
418 | 458 |
{ |
419 | 459 |
result.documents.Add(new Documents() |
420 | 460 |
{ |
461 |
RefProjectCode = ws.Rows[p.Index].Cells[7].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[7].Value.ToString(), |
|
462 |
System = ws.Rows[p.Index].Cells[8].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(), |
|
463 |
SubSystemCode = ws.Rows[p.Index].Cells[9].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(), |
|
464 |
DocumentNo = ws.Rows[p.Index].Cells[10].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(), |
|
465 |
PersonInCharge = ws.Rows[p.Index].Cells[11].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[11].Value.ToString()).ID, |
|
466 |
Worker = ws.Rows[p.Index].Cells[12].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[12].Value.ToString()).ID, |
|
467 |
AVEVAPersonInCharge = ws.Rows[p.Index].Cells[13].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID, |
|
468 |
AVEVAWorker = ws.Rows[p.Index].Cells[14].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[14].Value.ToString()).ID, |
|
469 |
JobLevel = ws.Rows[p.Index].Cells[15].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[15].Value.ToString(), |
|
470 |
RevisonNo = ws.Rows[p.Index].Cells[16].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(), |
|
471 |
ToIsDiscussion = ws.Rows[p.Index].Cells[17].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(), |
|
472 |
ToRemarks = ws.Rows[p.Index].Cells[18].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[18].Value.ToString(), |
|
473 |
ToCreator = ws.Rows[p.Index].Cells[19].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[19].Value.ToString()).ID, |
|
474 |
//toreview-20 |
|
475 |
FrReviewStatus = ws.Rows[p.Index].Cells[21].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(), |
|
476 |
FrRemarks = ws.Rows[p.Index].Cells[22].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[22].Value.ToString(), |
|
477 |
FrCreator = ws.Rows[p.Index].Cells[23].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[23].Value.ToString()).ID, |
|
478 |
//frreview-24 |
|
479 |
ID2StartDate = ws.Rows[p.Index].Cells[25].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[25].Value?.ToString()), |
|
480 |
ID2EndDate = ws.Rows[p.Index].Cells[26].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[26].Value?.ToString()), |
|
481 |
ID2Status = ws.Rows[p.Index].Cells[27].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(), |
|
482 |
ID2Issues = ws.Rows[p.Index].Cells[28].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[28].Value.ToString(), |
|
483 |
//id2work-29 |
|
484 |
ReplyModifications = ws.Rows[p.Index].Cells[30].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[30].Value.ToString(), |
|
485 |
ReplyRequester = ws.Rows[p.Index].Cells[31].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(), |
|
486 |
IsConvert = ws.Rows[p.Index].Cells[32].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(), |
|
487 |
AVEVAConvertDate = ws.Rows[p.Index].Cells[33].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[33].Value.ToString()), |
|
488 |
AVEVAWorkDate = ws.Rows[p.Index].Cells[34].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[34].Value.ToString()), |
|
489 |
AVEVAStatus = ws.Rows[p.Index].Cells[35].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[35].Value.ToString(), |
|
490 |
AVEVAIssues = ws.Rows[p.Index].Cells[36].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(), |
|
491 |
AVEVAReviewDate = ws.Rows[p.Index].Cells[37].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[37].Value.ToString()), |
|
492 |
ProdReviewer = ws.Rows[p.Index].Cells[38].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID, |
|
493 |
ProdIsResult = ws.Rows[p.Index].Cells[39].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(), |
|
494 |
ProdRemarks = ws.Rows[p.Index].Cells[40].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(), |
|
495 |
ClientReviewer = ws.Rows[p.Index].Cells[41].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[41].Value.ToString()).ID, |
|
496 |
ClientIsResult = ws.Rows[p.Index].Cells[42].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(), |
|
497 |
ClientRemarks = ws.Rows[p.Index].Cells[43].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(), |
|
498 |
DTIsGateWay = ws.Rows[p.Index].Cells[44].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString(), |
|
499 |
DTIsImport = ws.Rows[p.Index].Cells[45].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[45].Value.ToString(), |
|
500 |
DTIsRegSystem = ws.Rows[p.Index].Cells[46].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[46].Value.ToString(), |
|
501 |
DTRemarks = ws.Rows[p.Index].Cells[47].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[47].Value.ToString() |
|
502 |
|
|
503 |
/* |
|
421 | 504 |
//UID = string.Empty, |
422 | 505 |
//Type = this.radTextBoxInsulationType.Text, |
423 | 506 |
//TempFrom = ws.Rows[exRow].Cells[p.Column.Index].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[exRow].Cells[p.Column.Index].Value), |
... | ... | |
464 | 547 |
DTIsImport = ws.Rows[p.Index].Cells[42].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(), |
465 | 548 |
DTIsRegSystem = ws.Rows[p.Index].Cells[43].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(), |
466 | 549 |
DTRemarks = ws.Rows[p.Index].Cells[44].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString() |
550 |
*/ |
|
467 | 551 |
}); |
468 | 552 |
} |
469 | 553 |
catch (Exception ex) |
ID2.Manager/ID2.Manager/Main.cs | ||
---|---|---|
1739 | 1739 |
} |
1740 | 1740 |
} |
1741 | 1741 |
|
1742 |
private void RadButtonElementExcelImport_Click_old(object sender, EventArgs e) |
|
1743 |
{ |
|
1744 |
using (OpenFileDialog ofd = new OpenFileDialog() |
|
1745 |
{ |
|
1746 |
Filter = "Excel files (*.xlsx)|*.xlsx", |
|
1747 |
Title = "Open an Excel File", |
|
1748 |
RestoreDirectory = true |
|
1749 |
}) |
|
1750 |
{ |
|
1751 |
if (ofd.ShowDialog() == DialogResult.OK) |
|
1752 |
{ |
|
1753 |
//Error Message |
|
1754 |
StringBuilder sbErrMsg = new StringBuilder(); |
|
1755 |
|
|
1756 |
var exFile = ExcelFile.Load(ofd.FileName); |
|
1757 |
var ws = exFile.Worksheets[0]; |
|
1758 |
|
|
1759 |
int rowCount = ws.Rows.Count; |
|
1760 |
int columnCount = ws.CalculateMaxUsedColumns(); |
|
1761 |
int exRow = 8; |
|
1762 |
|
|
1763 |
#region Excel 유효성검사 |
|
1764 |
|
|
1765 |
//Excel 포멧체크 |
|
1766 |
if (rowCount < 10 || columnCount != 45) |
|
1767 |
{ |
|
1768 |
RadMessageBox.Show("Please, check the excel.\n", "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
|
1769 |
return; |
|
1770 |
} |
|
1771 |
|
|
1772 |
#region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical) |
|
1773 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
|
1774 |
.Where(col => col.Column.Index > 5 && col.Column.Index < 10 && col.Row.Index > exRow && col.Value == null) |
|
1775 |
.ToList() |
|
1776 |
.ForEach(p => sbErrMsg.Append(", " + p.Column.Name + p.Row.Name)); |
|
1777 |
|
|
1778 |
if (sbErrMsg.Length > 0) |
|
1779 |
{ |
|
1780 |
string errMsg = sbErrMsg.ToString().Substring(2); |
|
1781 |
if (errMsg.Length > 100) |
|
1782 |
{ |
|
1783 |
errMsg = $"{errMsg.Substring(0, 100)}..."; |
|
1784 |
} |
|
1785 |
|
|
1786 |
RadMessageBox.Show($"Please, check null value in excel.\n{errMsg}", "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
|
1787 |
return; |
|
1788 |
} |
|
1789 |
#endregion |
|
1790 |
|
|
1791 |
#region 엑셀 도명명 중복 값 체크 |
|
1792 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
|
1793 |
.Where(col => col.Column.Index == 6 && col.Row.Index > exRow) |
|
1794 |
.GroupBy(g => g.Row.Index) |
|
1795 |
.Select(p => new { |
|
1796 |
rowIndex = p.Key, |
|
1797 |
docNo = p.Select(x => x.Value.ToString()).FirstOrDefault() |
|
1798 |
}) |
|
1799 |
.GroupBy(g => g.docNo) |
|
1800 |
.Where(p => p.Count() > 1) |
|
1801 |
.Select(p => p.Select(x => (x.rowIndex + 1).ToString()) |
|
1802 |
.Aggregate((x, y) => x.ToString() + "," + y.ToString()) |
|
1803 |
.ToString()) |
|
1804 |
.ToList().ForEach(p => sbErrMsg.Append("\n" + p.ToString())); |
|
1805 |
if (sbErrMsg.Length > 0) |
|
1806 |
{ |
|
1807 |
sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : "); |
|
1808 |
string errMsg = sbErrMsg.ToString(); |
|
1809 |
if (errMsg.Length > 100) |
|
1810 |
{ |
|
1811 |
errMsg = $"{errMsg.Substring(0, 100)}..."; |
|
1812 |
} |
|
1813 |
|
|
1814 |
RadMessageBox.Show($"Please, check the duplicate value in excel.\n{errMsg}", "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
|
1815 |
return; |
|
1816 |
} |
|
1817 |
#endregion |
|
1818 |
|
|
1819 |
#endregion |
|
1820 |
|
|
1821 |
List<Documents> appendDocuments = new List<Documents>(); |
|
1822 |
|
|
1823 |
ws.Rows.Where(row => row.Index > exRow) |
|
1824 |
.ToList() |
|
1825 |
.ForEach(p => appendDocuments.Add(new Documents() |
|
1826 |
{ |
|
1827 |
//UID = string.Empty, |
|
1828 |
//Type = this.radTextBoxInsulationType.Text, |
|
1829 |
//TempFrom = ws.Rows[exRow].Cells[p.Column.Index].Value == null ? 0 : Convert.ToSingle(ws.Rows[exRow].Cells[p.Column.Index].Value), |
|
1830 |
//TempTo = ws.Rows[exRow + 2].Cells[p.Column.Index].Value == null ? 0 : Convert.ToSingle(ws.Rows[exRow + 2].Cells[p.Column.Index].Value), |
|
1831 |
//NPS = ws.Rows[p.Row.Index].Cells[0].Value == null ? 0 : Convert.ToSingle(ws.Rows[p.Row.Index].Cells[0].Value), |
|
1832 |
//Thickness = p.Value == null ? 0 : Convert.ToSingle(p.Value) |
|
1833 |
|
|
1834 |
RefProjectCode = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
|
1835 |
DocumentNo = ws.Rows[p.Index].Cells[6].Value == null ? string.Empty : ws.Rows[p.Index].Cells[6].Value.ToString(), |
|
1836 |
PersonInCharge = ws.Rows[p.Index].Cells[7].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[7].Value.ToString()).ID, |
|
1837 |
JobLevel = ws.Rows[p.Index].Cells[8].Value == null ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(), |
|
1838 |
//IsTypical = ws.Rows[p.Index].Cells[9].Value == null ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(), |
|
1839 |
RevisonNo = ws.Rows[p.Index].Cells[10].Value == null ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(), |
|
1840 |
ToIsDiscussion = ws.Rows[p.Index].Cells[11].Value == null ? string.Empty : ws.Rows[p.Index].Cells[11].Value.ToString(), |
|
1841 |
ToRemarks = ws.Rows[p.Index].Cells[12].Value == null ? string.Empty : ws.Rows[p.Index].Cells[12].Value.ToString(), |
|
1842 |
ToCreator = ws.Rows[p.Index].Cells[13].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID, |
|
1843 |
//ToCapture = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
|
1844 |
//ToIsMarkup = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
|
1845 |
FrReviewStatus = ws.Rows[p.Index].Cells[16].Value == null ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(), |
|
1846 |
FrRemarks = ws.Rows[p.Index].Cells[17].Value == null ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(), |
|
1847 |
FrCreator = ws.Rows[p.Index].Cells[18].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[18].Value.ToString()).ID, |
|
1848 |
//FrCapture = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
|
1849 |
//FrIsMarkup = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
|
1850 |
//IsID2Work = ws.Rows[p.Index].Cells[21].Value == null ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(), |
|
1851 |
//ID2Connection = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
|
1852 |
ID2StartDate = ws.Rows[p.Index].Cells[23].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[23].Value?.ToString()), |
|
1853 |
ID2EndDate = ws.Rows[p.Index].Cells[24].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[24].Value?.ToString()), |
|
1854 |
//ID2JobTime = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
|
1855 |
ID2Status = ws.Rows[p.Index].Cells[26].Value == null ? string.Empty : ws.Rows[p.Index].Cells[26].Value.ToString(), |
|
1856 |
ID2Issues = ws.Rows[p.Index].Cells[27].Value == null ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(), |
|
1857 |
//AVEVAConnection = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
|
1858 |
AVEVAConvertDate = ws.Rows[p.Index].Cells[29].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[29].Value.ToString()), |
|
1859 |
AVEVAReviewDate = ws.Rows[p.Index].Cells[30].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[30].Value.ToString()), |
|
1860 |
//추가필요 AVEVAWorkDate = ws.Rows[p.Index].Cells[30].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[30].Value.ToString()), |
|
1861 |
AVEVAStatus = ws.Rows[p.Index].Cells[31].Value == null ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(), |
|
1862 |
AVEVAIssues = ws.Rows[p.Index].Cells[32].Value == null ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(), |
|
1863 |
ProdReviewer = ws.Rows[p.Index].Cells[35].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[35].Value.ToString()).ID, |
|
1864 |
ProdIsResult = ws.Rows[p.Index].Cells[36].Value == null ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(), |
|
1865 |
ProdRemarks = ws.Rows[p.Index].Cells[37].Value == null ? string.Empty : ws.Rows[p.Index].Cells[37].Value.ToString(), |
|
1866 |
ClientReviewer = ws.Rows[p.Index].Cells[38].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID, |
|
1867 |
ClientIsResult = ws.Rows[p.Index].Cells[39].Value == null ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(), |
|
1868 |
ClientRemarks = ws.Rows[p.Index].Cells[40].Value == null ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(), |
|
1869 |
DTIsGateWay = ws.Rows[p.Index].Cells[41].Value == null ? string.Empty : ws.Rows[p.Index].Cells[41].Value.ToString(), |
|
1870 |
DTIsImport = ws.Rows[p.Index].Cells[42].Value == null ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(), |
|
1871 |
DTIsRegSystem = ws.Rows[p.Index].Cells[43].Value == null ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(), |
|
1872 |
DTRemarks = ws.Rows[p.Index].Cells[44].Value == null ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString() |
|
1873 |
})); |
|
1874 |
|
|
1875 |
this.documents.AddRange(appendDocuments); |
|
1876 |
if (this.orgDocuments == null) this.orgDocuments = new List<Documents>(); |
|
1877 |
this.DocumentListBinding(); |
|
1878 |
|
|
1879 |
//foreach (Documents appDoc in appendDocuments) |
|
1880 |
//{ |
|
1881 |
// GridViewRowInfo rowInfo = this.radGridViewDocuments.Rows.AddNew(); |
|
1882 |
|
|
1883 |
// foreach (FieldInfo fieldInfo in appDoc.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)) |
|
1884 |
// { |
|
1885 |
// if (fieldInfo.GetValue(appDoc) != null) |
|
1886 |
// { |
|
1887 |
// var cols = rowInfo.Cells.Where(x => fieldInfo.Name.Contains($"<{x.ColumnInfo.Name}>")); |
|
1888 |
|
|
1889 |
// if (cols.Any()) |
|
1890 |
// { |
|
1891 |
// cols.FirstOrDefault().Value = fieldInfo.GetValue(appDoc); |
|
1892 |
// } |
|
1893 |
// } |
|
1894 |
// } |
|
1895 |
//} |
|
1896 |
} |
|
1897 |
} |
|
1898 |
} |
|
1899 |
|
|
1900 | 1742 |
private void RadButtonElementExcelExport_Click(object sender, EventArgs e) |
1901 | 1743 |
{ |
1902 | 1744 |
string sPrefixName = "Samsung Elec Task Management"; |
... | ... | |
1931 | 1773 |
{ |
1932 | 1774 |
int rowIndex = 9; |
1933 | 1775 |
//int colIndex = 1; |
1776 |
int rowNo = 1; |
|
1934 | 1777 |
|
1935 | 1778 |
foreach (var row in this.radGridViewDocuments.Rows) |
1936 | 1779 |
{ |
1937 | 1780 |
var doc = row.DataBoundItem as Documents; |
1938 | 1781 |
|
1782 |
templateWorksheet.Cells[rowIndex, 0].Value = rowNo++; |
|
1783 |
|
|
1784 |
templateWorksheet.Cells[rowIndex, 7].Value = doc.RefProjectCode; |
|
1785 |
templateWorksheet.Cells[rowIndex, 8].Value = doc.System; |
|
1786 |
templateWorksheet.Cells[rowIndex, 9].Value = doc.SubSystemCode; |
|
1787 |
templateWorksheet.Cells[rowIndex, 10].Value = doc.DocumentNo; |
|
1788 |
templateWorksheet.Cells[rowIndex, 11].Value = this.GetUser(doc.PersonInCharge).Name; |
|
1789 |
templateWorksheet.Cells[rowIndex, 12].Value = this.GetUser(doc.Worker).Name; |
|
1790 |
templateWorksheet.Cells[rowIndex, 13].Value = this.GetUser(doc.AVEVAPersonInCharge).Name; |
|
1791 |
templateWorksheet.Cells[rowIndex, 14].Value = this.GetUser(doc.AVEVAWorker).Name; |
|
1792 |
templateWorksheet.Cells[rowIndex, 15].Value = doc.JobLevel; |
|
1793 |
templateWorksheet.Cells[rowIndex, 16].Value = doc.RevisonNo; |
|
1794 |
templateWorksheet.Cells[rowIndex, 17].Value = doc.ToIsDiscussion; |
|
1795 |
templateWorksheet.Cells[rowIndex, 18].Value = doc.ToRemarks; |
|
1796 |
templateWorksheet.Cells[rowIndex, 19].Value = this.GetUser(doc.ToCreator).Name; |
|
1797 |
//toreview-20 |
|
1798 |
templateWorksheet.Cells[rowIndex, 21].Value = doc.FrReviewStatus; |
|
1799 |
templateWorksheet.Cells[rowIndex, 22].Value = doc.FrRemarks; |
|
1800 |
templateWorksheet.Cells[rowIndex, 23].Value = this.GetUser(doc.FrCreator).Name; |
|
1801 |
//frreview-24 |
|
1802 |
templateWorksheet.Cells[rowIndex, 25].Value = $"{doc.ID2StartDate:yyyy/MM/dd hh:mm:ss}"; |
|
1803 |
templateWorksheet.Cells[rowIndex, 26].Value = $"{doc.ID2EndDate:yyyy/MM/dd hh:mm:ss}"; |
|
1804 |
templateWorksheet.Cells[rowIndex, 27].Value = doc.ID2Status; |
|
1805 |
templateWorksheet.Cells[rowIndex, 28].Value = doc.ID2Issues; |
|
1806 |
//id2work-29 |
|
1807 |
templateWorksheet.Cells[rowIndex, 30].Value = doc.ReplyModifications; |
|
1808 |
templateWorksheet.Cells[rowIndex, 31].Value = this.GetUser(doc.ReplyRequester).Name; |
|
1809 |
templateWorksheet.Cells[rowIndex, 32].Value = doc.IsConvert; |
|
1810 |
templateWorksheet.Cells[rowIndex, 33].Value = $"{doc.AVEVAConvertDate:yyyy/MM/dd}"; |
|
1811 |
templateWorksheet.Cells[rowIndex, 34].Value = $"{doc.AVEVAWorkDate:yyyy/MM/dd}"; |
|
1812 |
templateWorksheet.Cells[rowIndex, 35].Value = doc.AVEVAStatus; |
|
1813 |
templateWorksheet.Cells[rowIndex, 36].Value = doc.AVEVAIssues; |
|
1814 |
templateWorksheet.Cells[rowIndex, 37].Value = $"{doc.AVEVAReviewDate:yyyy/MM/dd}"; |
|
1815 |
templateWorksheet.Cells[rowIndex, 38].Value = this.GetUser(doc.ProdReviewer).Name; |
|
1816 |
templateWorksheet.Cells[rowIndex, 39].Value = doc.ProdIsResult; |
|
1817 |
templateWorksheet.Cells[rowIndex, 40].Value = doc.ProdRemarks; |
|
1818 |
templateWorksheet.Cells[rowIndex, 41].Value = this.GetUser(doc.ClientReviewer).Name; |
|
1819 |
templateWorksheet.Cells[rowIndex, 42].Value = doc.ClientIsResult; |
|
1820 |
templateWorksheet.Cells[rowIndex, 43].Value = doc.ClientRemarks; |
|
1821 |
templateWorksheet.Cells[rowIndex, 44].Value = doc.DTIsGateWay; |
|
1822 |
templateWorksheet.Cells[rowIndex, 45].Value = doc.DTIsImport; |
|
1823 |
templateWorksheet.Cells[rowIndex, 46].Value = doc.DTIsRegSystem; |
|
1824 |
templateWorksheet.Cells[rowIndex, 47].Value = doc.DTRemarks; |
|
1825 |
|
|
1826 |
/* |
|
1939 | 1827 |
templateWorksheet.Cells[rowIndex, 0].Value = doc.Seq; |
1940 | 1828 |
//templateWorksheet.Cells[rowIndex, 1].Value = doc.DocumentNo; |
1941 | 1829 |
//templateWorksheet.Cells[rowIndex, 2].Value = doc.DocumentNo; |
... | ... | |
1982 | 1870 |
templateWorksheet.Cells[rowIndex, 42].Value = doc.DTIsImport; |
1983 | 1871 |
templateWorksheet.Cells[rowIndex, 43].Value = doc.DTIsRegSystem; |
1984 | 1872 |
templateWorksheet.Cells[rowIndex, 44].Value = doc.DTRemarks; |
1873 |
*/ |
|
1985 | 1874 |
rowIndex++; |
1986 | 1875 |
} |
1987 | 1876 |
} |
... | ... | |
2332 | 2221 |
List<string> docInfoColNames = new List<string>() { "RefProjectCode", "System", "SubSystemCode", "DocumentNo", "PersonInCharge", "Worker", "AVEVAPersonInCharge", "AVEVAWorker", "JobLevel", "RevisonNo" }; |
2333 | 2222 |
List<string> rvToColNames = new List<string>() { "ToIsDiscussion", "ToRemarks", "ToCreator", "ToCapture" }; |
2334 | 2223 |
List<string> rvFrColNames = new List<string>() { "FrReviewStatus", "FrRemarks", "FrCreator", "FrCapture" }; |
2335 |
List<string> wkID2ColNames = new List<string>() { "ID2StartDate", "ID2EndDate", "ID2Status", "ID2Issues", "ID2Capture", "ReplyModifications", "ReplyRequester", "IsConvert" };
|
|
2336 |
List<string> wkAVEVAColNames = new List<string>() { "AVEVAConvertDate", "AVEVAWorkDate", "AVEVAStatus", "AVEVAIssues" }; |
|
2224 |
List<string> wkID2ColNames = new List<string>() { "ID2StartDate", "ID2EndDate", "ID2Status", "ID2Issues", "ID2Capture", "ReplyModifications", "ReplyRequester" }; |
|
2225 |
List<string> wkAVEVAColNames = new List<string>() { "IsConvert", "AVEVAConvertDate", "AVEVAWorkDate", "AVEVAStatus", "AVEVAIssues" };
|
|
2337 | 2226 |
List<string> valProdColNames = new List<string>() { "AVEVAReviewDate", "ProdReviewer", "ProdIsResult", "ProdRemarks" }; |
2338 | 2227 |
List<string> valCntColNames = new List<string>() { "ClientReviewer", "ClientIsResult", "ClientRemarks" }; |
2339 | 2228 |
List<string> dtColNames = new List<string>() { "DTIsGateWay", "DTIsImport", "DTIsRegSystem", "DTRemarks" }; |
내보내기 Unified diff