개정판 6b6e937c
Compare기능 수정
Change-Id: I3697fbe30f47d5cc4a51ece85df0055f7c596bf2
KCOM_API/ServiceDeepView.svc.cs | ||
---|---|---|
2 | 2 |
using IKCOM; |
3 | 3 |
using KCOMDataModel.Common; |
4 | 4 |
using KCOMDataModel.DataModel; |
5 |
using MARKUS; |
|
6 | 5 |
using System; |
7 | 6 |
using System.Collections.Generic; |
8 | 7 |
using System.Collections.ObjectModel; |
... | ... | |
230 | 229 |
[OperationContract] |
231 | 230 |
public List<Rect> GetCompareRect(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress) |
232 | 231 |
{ |
232 |
|
|
233 |
List<Rect> result = new List<Rect>(); |
|
234 |
|
|
233 | 235 |
string originFile = ""; |
234 | 236 |
string targetFile = ""; |
235 | 237 |
|
... | ... | |
245 | 247 |
targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo); |
246 | 248 |
} |
247 | 249 |
|
248 |
CompareLib compareLib = new CompareLib(); |
|
249 |
|
|
250 |
var resultOrigin = compareLib.ChangeCmpUrlToPng_File(originFile); |
|
251 |
var resultTarget = compareLib.ChangeCmpUrlToPng_File(targetFile); |
|
252 |
|
|
253 |
string outPutFile = compareLib.ImageCompare_File(resultOrigin, resultTarget); |
|
254 |
var result = compareLib.GetBoundBoxInImage(outPutFile); |
|
250 |
using (Markus.Image.ImageComparer compareLib = new Markus.Image.ImageComparer()) |
|
251 |
{ |
|
252 |
result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20)); |
|
253 |
} |
|
255 | 254 |
|
256 | 255 |
return result; |
257 | 256 |
} |
258 | 257 |
|
258 |
//[OperationContract] |
|
259 |
//public List<Rect> GetCompareRect_old(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress) |
|
260 |
//{ |
|
261 |
// System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); |
|
262 |
|
|
263 |
// stopwatch.Start(); |
|
264 |
|
|
265 |
// string originFile = ""; |
|
266 |
// string targetFile = ""; |
|
267 |
|
|
268 |
// string sFolder = originDocItem_ID.All(char.IsDigit) ? (Convert.ToUInt32(originDocItem_ID) / 100).ToString() : (originDocItem_ID.Length >= 5 ? originDocItem_ID.Substring(0, 5) : originDocItem_ID); |
|
269 |
// if (Boolean.Parse(isInternalAddress)) |
|
270 |
// { |
|
271 |
// originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sFolder, originDocItem_ID, originPageNo); |
|
272 |
// targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sFolder, targetDocItem_ID, targetPageNo); |
|
273 |
// } |
|
274 |
// else |
|
275 |
// { |
|
276 |
// originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, originDocItem_ID, originPageNo); |
|
277 |
// targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo); |
|
278 |
// } |
|
279 |
|
|
280 |
// CompareLib compareLib = new CompareLib(); |
|
281 |
|
|
282 |
// var resultOrigin = compareLib.ChangeCmpUrlToPng_File(originFile); |
|
283 |
// var resultTarget = compareLib.ChangeCmpUrlToPng_File(targetFile); |
|
284 |
|
|
285 |
// string outPutFile = compareLib.ImageCompare_File(resultOrigin, resultTarget); |
|
286 |
// var result = compareLib.GetBoundBoxInImage(outPutFile); |
|
287 |
|
|
288 |
// System.Diagnostics.Debug.WriteLine(new TimeSpan(stopwatch.ElapsedTicks)); |
|
289 |
|
|
290 |
// return result; |
|
291 |
//} |
|
292 |
|
|
259 | 293 |
|
260 | 294 |
#region Final PDF |
261 | 295 |
private string _ChanID = null; |
... | ... | |
1302 | 1336 |
[OperationContract] |
1303 | 1337 |
public bool SaveMarkupData(MarkupInfoItem UserState,string project_no,string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data) |
1304 | 1338 |
{ |
1339 |
|
|
1305 | 1340 |
string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1306 | 1341 |
using (CIEntities Entity = new CIEntities(sCIConnString)) |
1307 | 1342 |
{ |
... | ... | |
1416 | 1451 |
return true; |
1417 | 1452 |
} |
1418 | 1453 |
|
1454 |
[OperationContract] |
|
1455 |
public bool SavePageMarkupData(MarkupInfoItem UserState,int PageNo, string project_no, string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data) |
|
1456 |
{ |
|
1457 |
|
|
1458 |
string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
|
1459 |
using (CIEntities Entity = new CIEntities(sCIConnString)) |
|
1460 |
{ |
|
1461 |
#region Docinfo 정보 가져오기 |
|
1462 |
|
|
1463 |
string docinfoid_ = (from info in Entity.DOCINFO |
|
1464 |
where info.DOCUMENT_ID == doc_id |
|
1465 |
&& info.PROJECT_NO == project_no |
|
1466 |
select info.ID |
|
1467 |
).First().ToString(); |
|
1468 |
#endregion |
|
1469 |
|
|
1470 |
#region Markup_Info 저장 |
|
1471 |
|
|
1472 |
MARKUP_INFO markup_info = new MARKUP_INFO(); |
|
1473 |
try |
|
1474 |
{ |
|
1475 |
markup_info = (from info in Entity.MARKUP_INFO |
|
1476 |
where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id |
|
1477 |
select info).FirstOrDefault(); |
|
1478 |
} |
|
1479 |
catch (Exception) |
|
1480 |
{ |
|
1481 |
markup_info = null; |
|
1482 |
} |
|
1483 |
|
|
1484 |
//markup_info가 없을 경우 생성 |
|
1485 |
if (markup_info == null) |
|
1486 |
{ |
|
1487 |
//MarkupInfo 저장 |
|
1488 |
markup_info = new MARKUP_INFO |
|
1489 |
{ |
|
1490 |
ID = UserState.MarkupInfoID, |
|
1491 |
DOCINFO_ID = docinfoid_, |
|
1492 |
USER_ID = user_id, |
|
1493 |
CREATE_TIME = DateTime.Now, |
|
1494 |
CONSOLIDATE = UserState.Consolidate, |
|
1495 |
AVOID_CONSOLIDATE = UserState.AvoidConsolidate, |
|
1496 |
PART_CONSOLIDATE = UserState.PartConsolidate, |
|
1497 |
DESCRIPTION = UserState.Description, |
|
1498 |
UPDATE_TIME = DateTime.Now |
|
1499 |
}; |
|
1500 |
Entity.MARKUP_INFO.AddObject(markup_info); |
|
1501 |
} |
|
1502 |
//markup_info가 있을 경우 업데이트 |
|
1503 |
else |
|
1504 |
{ |
|
1505 |
markup_info.UPDATE_TIME = DateTime.Now; |
|
1506 |
} |
|
1507 |
Entity.SaveChanges(); |
|
1508 |
#endregion |
|
1509 |
|
|
1510 |
#region Markup_Info_Version 저장 |
|
1511 |
|
|
1512 |
MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
|
1513 |
|
|
1514 |
try |
|
1515 |
{ |
|
1516 |
markup_info_version = (from info in Entity.MARKUP_INFO_VERSION |
|
1517 |
where info.MARKUPINFO_ID == markup_info.ID |
|
1518 |
select info).FirstOrDefault(); |
|
1519 |
} |
|
1520 |
catch (Exception) |
|
1521 |
{ |
|
1522 |
markup_info_version = null; |
|
1523 |
} |
|
1524 |
|
|
1525 |
//markup_info_version 없을 경우 생성 |
|
1526 |
if (markup_info_version == null) |
|
1527 |
{ |
|
1528 |
//MarkupInfo_version 저장 |
|
1529 |
markup_info_version = new MARKUP_INFO_VERSION() |
|
1530 |
{ |
|
1531 |
ID = UserState.MarkupVersionID, |
|
1532 |
MARKUPINFO_ID = markup_info.ID, |
|
1533 |
CREATE_DATE = DateTime.Now |
|
1534 |
}; |
|
1535 |
Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version); |
|
1536 |
Entity.SaveChanges(); |
|
1537 |
} |
|
1538 |
#endregion |
|
1539 |
|
|
1540 |
|
|
1541 |
Entity.MARKUP_DATA.Where(data => data.PAGENUMBER == PageNo && data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item => |
|
1542 |
{ |
|
1543 |
Entity.MARKUP_DATA.DeleteObject(item); |
|
1544 |
}); |
|
1545 |
Entity.SaveChanges(); |
|
1546 |
|
|
1547 |
try |
|
1548 |
{ |
|
1549 |
mlmarkup_data.ForEach(value => |
|
1550 |
{ |
|
1551 |
Entity.MARKUP_DATA.AddObject(new MARKUP_DATA |
|
1552 |
{ |
|
1553 |
ID = value.ID, |
|
1554 |
DATA = value.DATA, |
|
1555 |
DATA_TYPE = value.DATA_TYPE, |
|
1556 |
PAGENUMBER = value.PAGENUMBER, |
|
1557 |
MARKUPINFO_VERSION_ID = markup_info_version.ID, |
|
1558 |
SYMBOL_ID = value.SYMBOL_ID, |
|
1559 |
//GROUP_ID = value.GROUP_ID |
|
1560 |
}); |
|
1561 |
}); |
|
1562 |
Entity.SaveChanges(); |
|
1563 |
} |
|
1564 |
catch (Exception) |
|
1565 |
{ |
|
1566 |
return false; |
|
1567 |
} |
|
1568 |
} |
|
1569 |
return true; |
|
1570 |
} |
|
1571 |
|
|
1419 | 1572 |
//[OperationContract] |
1420 | 1573 |
//public long AddMarkupDataGroup(MARKUP_DATA_GROUP mARKUP_DATA_GROUP, string ProjectNo) |
1421 | 1574 |
//{ |
내보내기 Unified diff