개정판 c9264d17
dev issue #000 : add unit
Change-Id: I56c0662ff4e447e0b3595fb93503528abb98a6b1
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
44 | 44 |
Ingr.RAD2D.Application radApp; |
45 | 45 |
SPPID_Document document; |
46 | 46 |
ETCSetting _ETCSetting; |
47 |
|
|
47 |
DataTable nominalDiameterTable = null; |
|
48 | 48 |
public string DocumentLabelText { get; set; } |
49 | 49 |
|
50 | 50 |
List<Line> BranchLines = new List<Line>(); |
... | ... | |
90 | 90 |
string drawingName = document.DrawingName; |
91 | 91 |
try |
92 | 92 |
{ |
93 |
nominalDiameterTable = Project_DB.SelectProjectNominalDiameter(); |
|
93 | 94 |
_placement = new Placement(); |
94 | 95 |
dataSource = _placement.PIDDataSource; |
95 | 96 |
|
... | ... | |
4622 | 4623 |
if (mapping != null && !string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None") |
4623 | 4624 |
{ |
4624 | 4625 |
LMAAttribute _LMAAttribute = _LMModelItem.Attributes[mapping.SPPIDATTRIBUTENAME]; |
4625 |
if (_LMAAttribute != null) |
|
4626 |
if (mapping.SPPIDATTRIBUTENAME.Equals("NominalDiameter") && !string.IsNullOrEmpty(attribute.VALUE) && _LMAAttribute != null) |
|
4627 |
{ |
|
4628 |
DataRow[] rows = nominalDiameterTable.Select(string.Format("MetricStr = '{0}' OR InchStr = '{0}'", attribute.VALUE)); |
|
4629 |
|
|
4630 |
if (rows.Length.Equals(1)) |
|
4631 |
{ |
|
4632 |
if (_ETCSetting.UnitSetting != null && _ETCSetting.UnitSetting.Equals("Metric")) |
|
4633 |
attribute.VALUE = rows[0]["MetricStr"].ToString(); |
|
4634 |
else |
|
4635 |
attribute.VALUE = rows[0]["InchStr"].ToString(); |
|
4636 |
|
|
4637 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
4638 |
_LMAAttribute.set_Value(attribute.VALUE); |
|
4639 |
else if (_LMAAttribute.get_Value() != attribute.VALUE) |
|
4640 |
_LMAAttribute.set_Value(attribute.VALUE); |
|
4641 |
} |
|
4642 |
} |
|
4643 |
else if (_LMAAttribute != null) |
|
4626 | 4644 |
{ |
4627 | 4645 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
4628 | 4646 |
_LMAAttribute.set_Value(attribute.VALUE); |
... | ... | |
4679 | 4697 |
dt.Dispose(); |
4680 | 4698 |
} |
4681 | 4699 |
} |
4700 |
else if (mapping.SPPIDATTRIBUTENAME.Equals("NominalDiameter") && !string.IsNullOrEmpty(attribute.VALUE) && _LMAAttribute != null) |
|
4701 |
{ |
|
4702 |
DataRow[] rows = nominalDiameterTable.Select(string.Format("MetricStr = '{0}' OR InchStr = '{0}'", attribute.VALUE)); |
|
4703 |
|
|
4704 |
if (rows.Length.Equals(1)) |
|
4705 |
{ |
|
4706 |
if (_ETCSetting.UnitSetting != null && _ETCSetting.UnitSetting.Equals("Metric")) |
|
4707 |
attribute.VALUE = rows[0]["MetricStr"].ToString(); |
|
4708 |
else |
|
4709 |
attribute.VALUE = rows[0]["InchStr"].ToString(); |
|
4710 |
|
|
4711 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
4712 |
_LMAAttribute.set_Value(attribute.VALUE); |
|
4713 |
else if (_LMAAttribute.get_Value() != attribute.VALUE) |
|
4714 |
_LMAAttribute.set_Value(attribute.VALUE); |
|
4715 |
} |
|
4716 |
} |
|
4682 | 4717 |
else if (_LMAAttribute != null) |
4683 | 4718 |
{ |
4684 | 4719 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
... | ... | |
4728 | 4763 |
{ |
4729 | 4764 |
if (!mapping.IsText) |
4730 | 4765 |
{ |
4731 |
LMAAttribute _Attribute = _Attributes[mapping.SPPIDATTRIBUTENAME]; |
|
4732 |
if (_Attribute != null)
|
|
4766 |
LMAAttribute _LMAAttribute = _Attributes[mapping.SPPIDATTRIBUTENAME];
|
|
4767 |
if (mapping.SPPIDATTRIBUTENAME.Equals("NominalDiameter") && !string.IsNullOrEmpty(item.VALUE) && _LMAAttribute != null)
|
|
4733 | 4768 |
{ |
4734 |
_Attribute.set_Value(item.VALUE); |
|
4769 |
DataRow[] rows = nominalDiameterTable.Select(string.Format("MetricStr = '{0}' OR InchStr = '{0}'", item.VALUE)); |
|
4770 |
|
|
4771 |
if (rows.Length.Equals(1)) |
|
4772 |
{ |
|
4773 |
if (_ETCSetting.UnitSetting != null && _ETCSetting.UnitSetting.Equals("Metric")) |
|
4774 |
item.VALUE = rows[0]["MetricStr"].ToString(); |
|
4775 |
else |
|
4776 |
item.VALUE = rows[0]["InchStr"].ToString(); |
|
4777 |
|
|
4778 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
4779 |
_LMAAttribute.set_Value(item.VALUE); |
|
4780 |
else if (_LMAAttribute.get_Value() != item.VALUE) |
|
4781 |
_LMAAttribute.set_Value(item.VALUE); |
|
4782 |
} |
|
4783 |
} |
|
4784 |
else if (_LMAAttribute != null) |
|
4785 |
{ |
|
4786 |
_LMAAttribute.set_Value(item.VALUE); |
|
4735 | 4787 |
// OPC 일경우 Attribute 저장 |
4736 | 4788 |
if (targetItem.GetType() == typeof(Symbol)) |
4737 | 4789 |
{ |
... | ... | |
4786 | 4838 |
dt.Dispose(); |
4787 | 4839 |
} |
4788 | 4840 |
} |
4841 |
else if (mapping.SPPIDATTRIBUTENAME.Equals("NominalDiameter") && !string.IsNullOrEmpty(item.VALUE) && _LMAAttribute != null) |
|
4842 |
{ |
|
4843 |
DataRow[] rows = nominalDiameterTable.Select(string.Format("MetricStr = '{0}' OR InchStr = '{0}'", item.VALUE)); |
|
4844 |
|
|
4845 |
if (rows.Length.Equals(1)) |
|
4846 |
{ |
|
4847 |
if (_ETCSetting.UnitSetting != null && _ETCSetting.UnitSetting.Equals("Metric")) |
|
4848 |
item.VALUE = rows[0]["MetricStr"].ToString(); |
|
4849 |
else |
|
4850 |
item.VALUE = rows[0]["InchStr"].ToString(); |
|
4851 |
|
|
4852 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
4853 |
_LMAAttribute.set_Value(item.VALUE); |
|
4854 |
else if (_LMAAttribute.get_Value() != item.VALUE) |
|
4855 |
_LMAAttribute.set_Value(item.VALUE); |
|
4856 |
} |
|
4857 |
} |
|
4789 | 4858 |
else if (mapping != null && !string.IsNullOrEmpty(item.VALUE) && item.VALUE != "None") |
4790 | 4859 |
{ |
4791 | 4860 |
if (!mapping.IsText) |
내보내기 Unified diff