개정판 49d444ef
issue #875 ConsolidateMergedPDF 수정
KCOM_API/ServiceDeepView.svc.cs | ||
---|---|---|
1552 | 1552 |
return true; |
1553 | 1553 |
} |
1554 | 1554 |
|
1555 |
|
|
1556 |
[OperationContract] |
|
1557 |
public FinalPDFResult ConsolidateMergedPDF(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems, string ProjectNo, string DocInfoID, string CreateUserID) |
|
1558 |
{ |
|
1559 |
bool consolidate = false; |
|
1560 |
try |
|
1561 |
{ |
|
1562 |
List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
|
1563 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
|
1564 |
{ |
|
1565 |
var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
|
1566 |
if (markupInfo.CONSOLIDATE == 1) |
|
1567 |
{ |
|
1568 |
markupInfo.AVOID_CONSOLIDATE = 1; |
|
1569 |
} |
|
1570 |
|
|
1571 |
foreach (MarkupInfoItem item in markupInfoItems) |
|
1572 |
{ |
|
1573 |
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
|
1574 |
{ |
|
1575 |
instanceDataSet.Add(d); |
|
1576 |
}); |
|
1577 |
} |
|
1578 |
|
|
1579 |
KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
|
1580 |
info.ID = shortGuid(); |
|
1581 |
info.CONSOLIDATE = 1; |
|
1582 |
info.CREATE_TIME = DateTime.Now; |
|
1583 |
info.DOCINFO_ID = _doc_id; |
|
1584 |
info.UPDATE_TIME = DateTime.Now; |
|
1585 |
info.USER_ID = _user_id; |
|
1586 |
info.AVOID_CONSOLIDATE = 0; |
|
1587 |
|
|
1588 |
Entity.MARKUP_INFO.AddObject(info); |
|
1589 |
Entity.SaveChanges(); |
|
1590 |
|
|
1591 |
|
|
1592 |
KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
|
1593 |
{ |
|
1594 |
ID = shortGuid(), |
|
1595 |
CREATE_DATE = DateTime.Now, |
|
1596 |
MARKUP_INFO = info, |
|
1597 |
}; |
|
1598 |
Entity.SaveChanges(); |
|
1599 |
|
|
1600 |
foreach (var item in instanceDataSet) |
|
1601 |
{ |
|
1602 |
Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
|
1603 |
{ |
|
1604 |
ID = shortGuid(), |
|
1605 |
DATA = item.DATA, |
|
1606 |
DATA_TYPE = item.DATA_TYPE, |
|
1607 |
PAGENUMBER = item.PAGENUMBER, |
|
1608 |
MARKUP_INFO_VERSION = info2, |
|
1609 |
SYMBOL_ID = item.SYMBOL_ID |
|
1610 |
}); |
|
1611 |
} |
|
1612 |
Entity.SaveChanges(); |
|
1613 |
|
|
1614 |
|
|
1615 |
} |
|
1616 |
consolidate = true; |
|
1617 |
} |
|
1618 |
catch (Exception) |
|
1619 |
{ |
|
1620 |
consolidate = false; |
|
1621 |
} |
|
1622 |
FinalPDFResult _result = new FinalPDFResult(); |
|
1623 |
if (consolidate == true) |
|
1624 |
{ |
|
1625 |
RemFinalPDFObject remObj = null; |
|
1626 |
try |
|
1627 |
{ |
|
1628 |
string _finalID = shortGuid(); |
|
1629 |
int _DocTotalPages = -1; |
|
1630 |
string docItemId; |
|
1631 |
|
|
1632 |
|
|
1633 |
using (CIEntities _ci = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
|
1634 |
{ |
|
1635 |
var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID); |
|
1636 |
|
|
1637 |
if (_doc.Count() > 0) |
|
1638 |
{ |
|
1639 |
_DocTotalPages = _doc.First().PAGE_COUNT; |
|
1640 |
docItemId = _doc.First().DOCUMENT_ID; |
|
1641 |
} |
|
1642 |
else |
|
1643 |
{ |
|
1644 |
_result.Status = FinalStatus.Error; |
|
1645 |
_result.Exception = "페이지 정보를 가져올 수 없습니다."; |
|
1646 |
return _result; |
|
1647 |
} |
|
1648 |
} |
|
1649 |
|
|
1650 |
var Items = GetMarkupInfoItems(ProjectNo, DocInfoID); |
|
1651 |
if (_DocTotalPages > 0) |
|
1652 |
{ |
|
1653 |
var item2 = Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
|
1654 |
FINAL_PDF fm = new FINAL_PDF() |
|
1655 |
{ |
|
1656 |
ID = _finalID, |
|
1657 |
PROJECT_NO = ProjectNo, |
|
1658 |
DOCINFO_ID = DocInfoID, |
|
1659 |
DOCUMENT_ID = docItemId, |
|
1660 |
MARKUPINFO_ID = item2.MarkupInfoID, |
|
1661 |
CREATE_USER_ID = CreateUserID, |
|
1662 |
TOTAL_PAGE = _DocTotalPages, |
|
1663 |
CREATE_DATETIME = DateTime.Now, |
|
1664 |
STATUS = (int)IFinalPDF.FinalStatus.Insert |
|
1665 |
}; |
|
1666 |
using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
1667 |
{ |
|
1668 |
_entity.AddToFINAL_PDF(fm); |
|
1669 |
_entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave); |
|
1670 |
}; |
|
1671 |
|
|
1672 |
System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp"); |
|
1673 |
if (_ch == null) |
|
1674 |
{ |
|
1675 |
chan = new TcpChannel(); |
|
1676 |
_ChanID = chan.ChannelName; |
|
1677 |
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false); |
|
1678 |
// Create an instance of the remote object |
|
1679 |
|
|
1680 |
|
|
1681 |
using (KCOMEntities ec = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
1682 |
{ |
|
1683 |
|
|
1684 |
//remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
|
1685 |
// "tcp://localhost:9092/remFinalPDF"); |
|
1686 |
remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
|
1687 |
//"tcp://192.168.0.67:9092/remFinalPDF"); |
|
1688 |
"tcp://192.168.0.67:9092/remFinalPDF"); |
|
1689 |
} |
|
1690 |
|
|
1691 |
//"tcp://localhost:8080/remFinalPDF"); |
|
1692 |
|
|
1693 |
_result = remObj.SetFinalPDF(ProjectNo, _finalID); |
|
1694 |
_result.FinalID = _finalID; |
|
1695 |
_result.Status = FinalStatus.Success; |
|
1696 |
|
|
1697 |
//MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF(); |
|
1698 |
//fa.MakeFinalPDF(fm); |
|
1699 |
} |
|
1700 |
else |
|
1701 |
{ |
|
1702 |
_ChanID = _ch.ChannelName; |
|
1703 |
} |
|
1704 |
} |
|
1705 |
} |
|
1706 |
catch (Exception ex) |
|
1707 |
{ |
|
1708 |
_result.Status = FinalStatus.Error; |
|
1709 |
|
|
1710 |
if (ex.GetType() == typeof(System.Net.Sockets.SocketException)) |
|
1711 |
_result.Exception = "Final Server Not Connection"; |
|
1712 |
} |
|
1713 |
finally |
|
1714 |
{ |
|
1715 |
remObj = null; |
|
1716 |
if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null) |
|
1717 |
System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan); |
|
1718 |
|
|
1719 |
GC.Collect(2); |
|
1720 |
} |
|
1721 |
} |
|
1722 |
return _result; |
|
1723 |
} |
|
1555 | 1724 |
[OperationContract] |
1556 | 1725 |
public bool TeamConsolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems) |
1557 | 1726 |
{ |
내보내기 Unified diff