개정판 224535bb
dev issue #569 : PDF To Image 변환툴 여러 파일 가능하게 수정 / OPC 작업을 위한 Drawing 정보 정리
Change-Id: I62beba4afda9acbeab9bfb5ace94ca221673c584
DTI_PID/PDF_TO_IMAGE/ConvertImage.cs | ||
---|---|---|
38 | 38 |
private void Btn_LoadPDF_Click(object sender, EventArgs e) |
39 | 39 |
{ |
40 | 40 |
OpenFileDialog OFD = new OpenFileDialog() { Filter = "PDF Files (.PDF)|*.PDF" }; |
41 |
OFD.Multiselect = true; |
|
41 | 42 |
if (OFD.ShowDialog() == DialogResult.OK) |
42 | 43 |
{ |
43 |
string pdfpath = OFD.FileName; |
|
44 |
if (OFD.FileNames.Length > 1) |
|
45 |
{ |
|
46 |
if (MessageBox.Show("여러 파일을 하나로 합치고 진행하시겠습니까?", "Question", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) |
|
47 |
{ |
|
48 |
SaveFileDialog saveFileDialog = new SaveFileDialog(); |
|
49 |
saveFileDialog.Filter = "PDF Files (.PDF)|*.PDF"; |
|
50 |
if (saveFileDialog.ShowDialog() == DialogResult.OK) |
|
51 |
{ |
|
52 |
int iScale = 0; |
|
53 |
double iLength = 0; |
|
54 |
bool bResult = true; |
|
55 |
|
|
56 |
if (Chk_Scale.Checked) |
|
57 |
iScale = Convert.ToInt32(Combo_Scale.SelectedItem.ToString().Split(new char[] { ' ' })[1]); |
|
58 |
else |
|
59 |
{ |
|
60 |
if (!double.TryParse(Txt_Length.Text, out iLength) || iLength < 300) |
|
61 |
bResult = false; |
|
62 |
|
|
63 |
} |
|
64 |
|
|
65 |
if (bResult) |
|
66 |
{ |
|
67 |
splashScreenManager1.ShowWaitForm(); |
|
68 |
splashScreenManager1.SetWaitFormCaption("Convert Pdf File to Image Files"); |
|
69 |
|
|
70 |
PdfDocumentProcessor pdp = new PdfDocumentProcessor(); |
|
71 |
pdp.CreateEmptyDocument(); |
|
72 |
foreach (var fileName in OFD.FileNames) |
|
73 |
{ |
|
74 |
PdfDocumentProcessor selectFile = new PdfDocumentProcessor(); |
|
75 |
selectFile.LoadDocument(fileName); |
|
76 |
foreach (var page in selectFile.Document.Pages) |
|
77 |
pdp.Document.Pages.Add(page); |
|
78 |
selectFile.CloseDocument(); |
|
79 |
selectFile.Dispose(); |
|
80 |
selectFile = null; |
|
81 |
} |
|
82 |
|
|
83 |
pdp.SaveDocument(saveFileDialog.FileName); |
|
84 |
|
|
85 |
string sPathNonExtension = saveFileDialog.FileName.Replace(Path.GetExtension(saveFileDialog.FileName), ""); |
|
86 |
|
|
87 |
|
|
88 |
try |
|
89 |
{ |
|
90 |
int iPage = pdp.Document.Pages.Count; |
|
91 |
string sPage = iPage.ToString(); |
|
92 |
for (int i = 0; i < pdp.Document.Pages.Count; i++) |
|
93 |
{ |
|
94 |
int iPercent = i * 100 / iPage; |
|
95 |
splashScreenManager1.SetWaitFormDescription(i + " / " + sPage + " Pages ( " + iPercent + "% )"); |
|
96 |
PdfPage page = pdp.Document.Pages[i]; |
|
97 |
|
|
98 |
double dWidth = page.CropBox.Width; |
|
99 |
double dHeight = page.CropBox.Height; |
|
44 | 100 |
|
45 |
Txt_PDFPath.Text = pdfpath; |
|
101 |
if (Chk_Scale.Checked) |
|
102 |
{ |
|
103 |
dWidth = dWidth * iScale; |
|
104 |
dHeight = dHeight * iScale; |
|
105 |
} |
|
106 |
else |
|
107 |
{ |
|
108 |
if (Combo_LengthType.SelectedItem.ToString() == "Width") |
|
109 |
{ |
|
110 |
double dScale = dWidth / iLength; |
|
111 |
dWidth = iLength; |
|
112 |
dHeight = dHeight / dScale; |
|
113 |
} |
|
114 |
else |
|
115 |
{ |
|
116 |
double dScale = dHeight / iLength; |
|
117 |
dHeight = iLength; |
|
118 |
dWidth = dWidth / dScale; |
|
119 |
} |
|
120 |
} |
|
121 |
|
|
122 |
double dMax = Math.Max(dWidth, dHeight); |
|
123 |
|
|
124 |
using (Bitmap bitmap = pdp.CreateBitmap(i + 1, (int)dMax)) |
|
125 |
{ |
|
126 |
bitmap.Save(sPathNonExtension + "_Page" + (i + 1) + ".png"); |
|
127 |
} |
|
128 |
|
|
129 |
iPercent = (i + 1) * 100 / iPage; |
|
130 |
splashScreenManager1.SetWaitFormDescription((i + 1) + " / " + sPage + " Pages ( " + iPercent + "% )"); |
|
131 |
} |
|
132 |
|
|
133 |
MessageBox.Show("변환완료"); |
|
134 |
} |
|
135 |
catch (Exception ex) |
|
136 |
{ |
|
137 |
MessageBox.Show("변환 이미지의 사이즈를 줄여주십시오"); |
|
138 |
} |
|
139 |
|
|
140 |
pdp.CloseDocument(); |
|
141 |
splashScreenManager1.CloseWaitForm(); |
|
142 |
} |
|
143 |
else |
|
144 |
{ |
|
145 |
MessageBox.Show("PDF 경로와 Scale 또는 Width or Height를 확인해주세요"); |
|
146 |
} |
|
147 |
} |
|
148 |
} |
|
149 |
} |
|
150 |
else |
|
151 |
{ |
|
152 |
string pdfpath = OFD.FileName; |
|
153 |
Txt_PDFPath.Text = pdfpath; |
|
154 |
} |
|
46 | 155 |
} |
47 | 156 |
} |
48 | 157 |
|
... | ... | |
155 | 264 |
{ |
156 | 265 |
MessageBox.Show("PDF 경로와 Scale 또는 Width or Height를 확인해주세요"); |
157 | 266 |
} |
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
//Properties.Settings.Default._Dpi = Combo_Scale.Text; |
|
163 |
//Properties.Settings.Default._Height = Txt_Length.Text; |
|
164 |
//Properties.Settings.Default._Width = Txt_Width.Text; |
|
165 |
//Properties.Settings.Default.Save(); |
|
166 |
///// ConvertPdfToImage(Txt_PDFPath.Text); |
|
167 |
///// |
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
//pdftron.PDFNet.Initialize("daelim.co.kr(Doftech Corp):CPU:2::W:AMC(20120315):EF6E886F25A414FFB5F8C1F2999CF2DA33DC6C5164315BAF7011B87AF0FA"); |
|
172 |
//using (PDFDoc doc = new PDFDoc(Txt_PDFPath.Text)) |
|
173 |
//{ |
|
174 |
// ImageCodecInfo DefaultImageCodecInfo = GetEncoderInfo("image/png"); |
|
175 |
// EncoderParameters DefaultEncoderParameters = new EncoderParameters(2); |
|
176 |
// System.Drawing.Imaging.Encoder QualityEncoder = System.Drawing.Imaging.Encoder.Quality; |
|
177 |
// System.Drawing.Imaging.Encoder ColorDepthEncoder = System.Drawing.Imaging.Encoder.ColorDepth; |
|
178 |
// DefaultEncoderParameters.Param[0] = new EncoderParameter(QualityEncoder, 100L); |
|
179 |
// DefaultEncoderParameters.Param[1] = new EncoderParameter(ColorDepthEncoder, 1L); |
|
180 |
|
|
181 |
// #region 이미지 만들기 |
|
182 |
// for (int i = 1; i < doc.GetPageCount() + 1; i++) |
|
183 |
// { |
|
184 |
// string sFileName = ""; |
|
185 |
// string pagePath = sPathNonExtension; |
|
186 |
// if (i > 1) |
|
187 |
// { |
|
188 |
// pagePath = sPathNonExtension + "_" + i; |
|
189 |
// } |
|
190 |
// try |
|
191 |
// { |
|
192 |
// using (pdftron.PDF.PDFDraw draw = new pdftron.PDF.PDFDraw()) |
|
193 |
// { |
|
194 |
// ElementBuilder bld = new ElementBuilder(); |
|
195 |
// ElementWriter writer = new ElementWriter(); |
|
196 |
// if (Chk_Scale.Checked) |
|
197 |
// { |
|
198 |
// float fDpix = 600; |
|
199 |
// float fDpiy = 600; |
|
200 |
// try |
|
201 |
// { |
|
202 |
// fDpix = float.Parse(Combo_Scale.Text); |
|
203 |
// fDpiy = float.Parse(Combo_Scale.Text); |
|
204 |
// } |
|
205 |
// catch |
|
206 |
// { } |
|
207 |
|
|
208 |
// var rotation = doc.GetPage(i).GetRotation(); |
|
209 |
|
|
210 |
// draw.SetDPI(fDpix); |
|
211 |
// sFileName = pagePath + "_" + fDpix + ".jpeg"; |
|
212 |
// } |
|
213 |
// else |
|
214 |
// { |
|
215 |
// var widthData =int.Parse(Txt_Width.Text); |
|
216 |
// int heightData = int.Parse(Txt_Length.Text); |
|
217 |
|
|
218 |
// var rotation = doc.GetPage(i).GetRotation(); |
|
219 |
// draw.SetImageSize(widthData, heightData, true); |
|
220 |
// sFileName = pagePath + "_" + widthData + "_" + heightData + ".png"; |
|
221 |
// } |
|
222 |
// draw.SetAntiAliasing(false); |
|
223 |
// draw.SetImageSmoothing(false); |
|
224 |
// Bitmap newBmp_ = draw.GetBitmap(doc.GetPage(i)); |
|
225 |
|
|
226 |
// using (MemoryStream _savestream = new MemoryStream()) |
|
227 |
// { |
|
228 |
// try |
|
229 |
// { |
|
230 |
// newBmp_.Save(_savestream, DefaultImageCodecInfo, DefaultEncoderParameters); |
|
231 |
// using (Bitmap bmpImage = new Bitmap(_savestream)) |
|
232 |
// { |
|
233 |
// ObjSet objset = new ObjSet(); |
|
234 |
// Obj jbig2_hint = objset.CreateName("png"); |
|
235 |
// bmpImage.Save(sFileName, ImageFormat.Png); |
|
236 |
// bmpImage.Dispose(); |
|
237 |
// // Do something with the Bitmap object |
|
238 |
// } |
|
239 |
// } |
|
240 |
// catch (Exception ex) |
|
241 |
// { |
|
242 |
// MessageBox.Show("err" + "\n" + ex.ToString() + "\n" + ex.Message); |
|
243 |
// } |
|
244 |
|
|
245 |
// } |
|
246 |
// GC.Collect(); |
|
247 |
// GC.WaitForPendingFinalizers(); |
|
248 |
// } |
|
249 |
// } |
|
250 |
// catch (Exception ex) |
|
251 |
// { |
|
252 |
// MessageBox.Show("err2" + "\n" + ex.ToString() + "\n" + ex.Message); |
|
253 |
// // return false; |
|
254 |
// } |
|
255 |
// } |
|
256 |
// if (doc.GetPageCount() > 0) |
|
257 |
// { |
|
258 |
// MessageBox.Show("변환완료"); |
|
259 |
// } |
|
260 |
// #endregion |
|
261 |
//} |
|
262 | 267 |
} |
263 | 268 |
|
264 | 269 |
|
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
105 | 105 |
/// </summary> |
106 | 106 |
public void Run() |
107 | 107 |
{ |
108 |
string drawingNumber = document.DrawingNumber; |
|
109 |
string drawingName = document.DrawingName; |
|
108 | 110 |
try |
109 | 111 |
{ |
110 | 112 |
_placement = new Placement(); |
111 | 113 |
dataSource = _placement.PIDDataSource; |
112 | 114 |
|
113 |
CreateDocument(); |
|
115 |
CreateDocument(ref drawingNumber, ref drawingName);
|
|
114 | 116 |
|
115 | 117 |
if (DocumentCoordinateCorrection()) |
116 | 118 |
{ |
... | ... | |
240 | 242 |
ReleaseCOMObjects(dataSource); |
241 | 243 |
ReleaseCOMObjects(_placement); |
242 | 244 |
|
245 |
Project_DB.InsertDrawingInfo(document.PATH, drawingNumber, drawingName, document); |
|
243 | 246 |
//SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.ClearParent, null); |
244 | 247 |
SplashScreenManager.CloseForm(false); |
245 | 248 |
} |
... | ... | |
248 | 251 |
/// <summary> |
249 | 252 |
/// 도면 생성 메서드 |
250 | 253 |
/// </summary> |
251 |
private void CreateDocument() |
|
254 |
private void CreateDocument(ref string drawingNumber, ref string drawingName)
|
|
252 | 255 |
{ |
253 |
string drawingName = document.DrawingName; |
|
254 |
string drawingNumber = document.DrawingNumber; |
|
255 |
|
|
256 | 256 |
GetDrawingNameAndNumber(ref drawingName, ref drawingNumber); |
257 | 257 |
|
258 | 258 |
newDrawing = application.Drawings.Add(document.Unit, document.Template, drawingNumber, drawingName); |
... | ... | |
260 | 260 |
Thread.Sleep(1000); |
261 | 261 |
application.ActiveWindow.Zoom = 2000; |
262 | 262 |
Thread.Sleep(2000); |
263 |
|
|
264 |
Project_DB.InsertDrawingInfo(document.PATH, drawingNumber, drawingName); |
|
265 | 263 |
} |
266 | 264 |
|
267 | 265 |
/// <summary> |
... | ... | |
537 | 535 |
{ |
538 | 536 |
_LMSymbol.Commit(); |
539 | 537 |
symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id; |
538 |
symbol.SPPID.ModelItemID = _LMSymbol.ModelItemID; |
|
540 | 539 |
symbol.SPPID.GraphicOID = _LMSymbol.get_GraphicOID(); |
541 | 540 |
|
542 | 541 |
foreach (var item in symbol.ChildSymbols) |
DTI_PID/SPPIDConverter/AutoModeling_OPC.cs | ||
---|---|---|
29 | 29 |
{ |
30 | 30 |
Placement _placement; |
31 | 31 |
LMADataSource dataSource; |
32 |
dynamic newDrawing; |
|
33 | 32 |
dynamic application; |
33 |
string SPPID_DrawingName; |
|
34 | 34 |
Ingr.RAD2D.Application radApp; |
35 | 35 |
SPPID_Document document; |
36 |
ETCSetting _ETCSetting; |
|
37 | 36 |
|
38 |
public string DocumentLabelText { get; set; } |
|
39 |
|
|
40 |
int CurrentCount; |
|
41 |
List<Tuple<string, Line, Line>> BranchLines = new List<Tuple<string, Line, Line>>(); |
|
42 |
|
|
43 |
public AutoModeling_OPC(SPPID_Document document, dynamic application, Ingr.RAD2D.Application radApp) |
|
37 |
public AutoModeling_OPC(SPPID_Document document, dynamic application, Ingr.RAD2D.Application radApp, string SPPID_DrawingName) |
|
44 | 38 |
{ |
45 | 39 |
this.document = document; |
46 | 40 |
this.application = application; |
47 | 41 |
this.radApp = radApp; |
48 |
|
|
49 |
|
|
50 |
this._ETCSetting = ETCSetting.GetInstance(); |
|
42 |
this.SPPID_DrawingName = SPPID_DrawingName; |
|
51 | 43 |
} |
52 | 44 |
|
53 |
private bool CheckProjectConnection()
|
|
45 |
public void Run()
|
|
54 | 46 |
{ |
55 |
bool result = false; |
|
47 |
Placement _placement = new Placement(); |
|
48 |
LMADataSource dataSource = _placement.PIDDataSource; |
|
49 |
|
|
50 |
|
|
51 |
|
|
56 | 52 |
|
57 | 53 |
|
58 |
return result; |
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
ReleaseCOMObjects(_placement); |
|
59 |
ReleaseCOMObjects(dataSource); |
|
60 |
} |
|
61 |
|
|
62 |
public void ReleaseCOMObjects(params object[] objVars) |
|
63 |
{ |
|
64 |
int intNewRefCount = 0; |
|
65 |
foreach (object obj in objVars) |
|
66 |
{ |
|
67 |
if (!Information.IsNothing(obj) && System.Runtime.InteropServices.Marshal.IsComObject(obj)) |
|
68 |
intNewRefCount = intNewRefCount + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj); |
|
69 |
} |
|
59 | 70 |
} |
60 | 71 |
} |
61 | 72 |
} |
DTI_PID/SPPIDConverter/BaseModel/SPPID/SPPIDSymbolInfo.cs | ||
---|---|---|
11 | 11 |
public string MAPPINGNAME { get; set; } |
12 | 12 |
public double ORIGINAL_X { get; set; } |
13 | 13 |
public double ORIGINAL_Y { get; set; } |
14 |
public string ModelItemID { get; set; } |
|
14 | 15 |
public string RepresentationId { get; set; } |
15 | 16 |
public string GraphicOID { get; set; } |
16 | 17 |
public bool IsCorrectionX { get; set; } |
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
20 | 20 |
using Plaice; |
21 | 21 |
using Llama; |
22 | 22 |
using DevExpress.XtraSplashScreen; |
23 |
using Newtonsoft.Json; |
|
23 | 24 |
|
24 | 25 |
namespace Converter.SPPID.Wrapper |
25 | 26 |
{ |
... | ... | |
99 | 100 |
_ProjectInfo.DefaultPath = Settings.Default.LatestProjectPath; |
100 | 101 |
if (Project_DB.ConnTestAndCreateTable()) |
101 | 102 |
{ |
102 |
drawings.Collect(dataSource); |
|
103 |
DataTable dt = Project_DB.SelectSPPID_DB_INFO(); |
|
104 |
if (dt.Columns.Count > 0 && dt.Rows.Count > 0) |
|
105 |
SPPIDUtil.ConvertToSPPIDInfo(dt.Rows[0][0].ToString()); |
|
106 |
else |
|
107 |
SPPID_DBInfo.Clear(); |
|
108 |
|
|
109 |
SPPID_DBInfo sPPID_DBInfo = SPPID_DBInfo.GetInstance(); |
|
110 |
if (sPPID_DBInfo.Enable) |
|
111 |
{ |
|
112 |
drawings.Collect(dataSource); |
|
103 | 113 |
|
104 |
List<string> drawingNameList = new List<string>();
|
|
105 |
List<string> drawingNumberList = new List<string>();
|
|
106 |
DataTable drawingTable = Project_DB.SelectDrawingInfo();
|
|
114 |
DataTable drawingTable = Project_DB.SelectDrawingInfo();
|
|
115 |
drawingTable.Columns.Add("EXIST", typeof(bool));
|
|
116 |
drawingTable.Columns.Add("SPPIDPATH", typeof(string));
|
|
107 | 117 |
|
108 |
foreach (LMDrawing item in drawings) |
|
109 |
{ |
|
110 |
drawingNameList.Add(item.Attributes["Name"].get_Value().ToString()); |
|
111 |
drawingNumberList.Add(item.Attributes["DrawingNumber"].get_Value().ToString()); |
|
112 |
} |
|
118 |
foreach (LMDrawing item in drawings) |
|
119 |
{ |
|
120 |
DataRow[] rows = drawingTable.Select(string.Format("DRAWINGNUMBER = '{0}'", item.Attributes["DrawingNumber"].get_Value())); |
|
121 |
foreach (DataRow row in rows) |
|
122 |
{ |
|
123 |
row["EXIST"] = true; |
|
124 |
row["DRAWINGNAME"] = item.Attributes["Name"].get_Value(); |
|
125 |
row["SPPIDPATH"] = item.get_Path(); |
|
126 |
} |
|
127 |
} |
|
113 | 128 |
|
129 |
foreach (DataRow row in drawingTable.Rows) |
|
130 |
{ |
|
131 |
SPPID_Document document = JsonConvert.DeserializeObject<SPPID_Document>(row["DOCUMENT"].ToString()); |
|
132 |
AutoModeling_OPC opc = new AutoModeling_OPC(document, application, radApp, row["DRAWINGNAME"].ToString()); |
|
133 |
opc.Run(); |
|
134 |
} |
|
135 |
//dynamic doc = application.Drawings.OpenDrawing(drawingTable.Rows[0]["DRAWINGNAME"]); |
|
114 | 136 |
|
137 |
//doc.CloseDrawing(true); |
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
//radApp.Documents.Open(sPPID_DBInfo.PlantPath + @"\" + drawingTable.Rows[0]["SPPIDPATH"].ToString()); |
|
142 |
} |
|
115 | 143 |
} |
116 | 144 |
else |
117 | 145 |
{ |
... | ... | |
181 | 209 |
Placement _placement = new Placement(); |
182 | 210 |
LMADataSource dataSource = new LMADataSource();//placement.PIDDataSource; |
183 | 211 |
|
184 |
foreach (var item in radApp.ActiveDocument.ActiveSheet.DrawingObjects) |
|
212 |
LMOPC opc = dataSource.GetOPC("B79C53F295454F489B9DBCD9F1078D3E"); |
|
213 |
LMOPC pairOPC = opc.pairedWithOPCObject; |
|
214 |
|
|
215 |
foreach (LMRepresentation rep in pairOPC.Representations) |
|
185 | 216 |
{ |
186 |
Ingr.RAD2D.DependencyObject dependencyObject = item as Ingr.RAD2D.DependencyObject; |
|
187 |
if (dependencyObject != null) |
|
217 |
if (rep.DrawingID != "0") |
|
188 | 218 |
{ |
189 |
string sModelItemType = string.Empty; |
|
190 |
string sModelID = string.Empty; |
|
191 |
foreach (Ingr.RAD2D.AttributeSet attributes in dependencyObject.AttributeSets) |
|
192 |
{ |
|
193 |
foreach (var attribute in attributes) |
|
194 |
{ |
|
195 |
if (attribute.Name == "ModelItemType") |
|
196 |
sModelItemType = attribute.GetValue().ToString(); |
|
197 |
else if (attribute.Name == "ModelID") |
|
198 |
sModelID = attribute.GetValue().ToString(); |
|
199 |
} |
|
200 |
} |
|
201 |
|
|
202 |
if (sModelItemType == "PipeRun" && !string.IsNullOrEmpty(sModelID)) |
|
203 |
{ |
|
204 |
LMModelItem modelItem = dataSource.GetModelItem(sModelID); |
|
205 |
if (modelItem != null && modelItem.get_ItemStatus() == "Active") |
|
206 |
{ |
|
207 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
208 |
{ |
|
209 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
210 |
{ |
|
211 |
LMConnector connector = dataSource.GetConnector(rep.Id); |
|
212 |
if (connector.get_IsZeroLength() && connector.LabelPersists.Count == 0) |
|
213 |
{ |
|
214 |
|
|
215 |
} |
|
216 |
} |
|
217 |
} |
|
218 |
|
|
219 |
} |
|
220 |
} |
|
219 |
MessageBox.Show(rep.DrawingObject.Attributes["Name"].get_Value().ToString()); |
|
221 | 220 |
} |
222 | 221 |
} |
223 |
|
|
224 |
//string modelItemId = "B79C53F295454F489B9DBCD9F1078D3E"; |
|
225 |
//LMOPC opc = dataSource.GetOPC(modelItemId); |
|
226 |
//try |
|
227 |
//{ |
|
228 |
// if (opc != null) |
|
229 |
// { |
|
230 |
// LMOPC pairedOPC = opc.pairedWithOPCObject; |
|
231 |
// //MessageBox.Show(pairedOPC.get_ItemStatus()); |
|
232 |
// //pairedOPC.Attributes[] |
|
233 |
// _placement.PIDPlaceSymbol(@"\Piping\Piping OPC's\Off-Drawing.sym", 0, 0, 0, 0, pairedOPC.AsLMAItem()); |
|
234 |
// } |
|
235 |
//} |
|
236 |
//catch (Exception ex) |
|
237 |
//{ |
|
238 |
// System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
239 |
//} |
|
240 |
//finally |
|
241 |
//{ |
|
242 |
|
|
243 |
//} |
|
244 |
|
|
245 |
//if (radApp.ActiveSelectSet.Count > 0) |
|
246 |
//{ |
|
247 |
// DependencyObject line2D = radApp.ActiveSelectSet[0] as DependencyObject; |
|
248 |
// if (line2D != null) |
|
249 |
// { |
|
250 |
// double minX = 0; |
|
251 |
// double minY = 0; |
|
252 |
// double maxX = 0; |
|
253 |
// double maxY = 0; |
|
254 |
// line2D.Range(out minX, out minY, out maxX, out maxY); |
|
255 |
|
|
256 |
// StringBuilder sb = new StringBuilder(); |
|
257 |
// sb.AppendLine(minX.ToString()); |
|
258 |
// sb.AppendLine(minY.ToString()); |
|
259 |
// sb.AppendLine(maxX.ToString()); |
|
260 |
// sb.AppendLine(maxY.ToString()); |
|
261 |
// MessageBox.Show(sb.ToString()); |
|
262 |
|
|
263 |
// } |
|
264 |
// else |
|
265 |
// MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
266 |
//} |
|
267 |
//else |
|
268 |
// MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
269 |
|
|
222 |
|
|
270 | 223 |
} |
271 | 224 |
|
272 | 225 |
|
DTI_PID/SPPIDConverter/DB/Project_DB.cs | ||
---|---|---|
6 | 6 |
using System.Globalization; |
7 | 7 |
using System.Data.SQLite; |
8 | 8 |
using System.Data; |
9 |
using Newtonsoft.Json; |
|
9 | 10 |
|
10 | 11 |
namespace Converter.BaseModel |
11 | 12 |
{ |
... | ... | |
218 | 219 |
} |
219 | 220 |
if (dt.Select(string.Format("NAME = '{0}'", SPPID_DRAWING_INFO)).Length == 0) |
220 | 221 |
{ |
221 |
cmd.CommandText = string.Format("CREATE TABLE {0} (PATH TEXT PRIMARY KEY, DRAWINGNUMBER TEXT, DRAWINGNAME TEXT)", SPPID_DRAWING_INFO); |
|
222 |
cmd.CommandText = string.Format("CREATE TABLE {0} (PATH TEXT PRIMARY KEY, DRAWINGNUMBER TEXT, DRAWINGNAME TEXT, DOCUMENT Text)", SPPID_DRAWING_INFO);
|
|
222 | 223 |
cmd.ExecuteNonQuery(); |
223 | 224 |
} |
224 | 225 |
} |
... | ... | |
247 | 248 |
cmd.ExecuteNonQuery(); |
248 | 249 |
} |
249 | 250 |
} |
251 |
|
|
252 |
cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_DRAWING_INFO); |
|
253 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
254 |
using (DataTable dt = new DataTable()) |
|
255 |
{ |
|
256 |
dt.Load(dr); |
|
257 |
if (!dt.Columns.Contains("DOCUMENT")) |
|
258 |
{ |
|
259 |
cmd.CommandText = string.Format("ALTER TABLE {0} ADD COLUMN DOCUMENT Text", SPPID_DRAWING_INFO); |
|
260 |
cmd.ExecuteNonQuery(); |
|
261 |
} |
|
262 |
} |
|
250 | 263 |
#endregion |
251 | 264 |
} |
252 | 265 |
} |
... | ... | |
684 | 697 |
return true; |
685 | 698 |
} |
686 | 699 |
|
687 |
public static bool InsertDrawingInfo(string path, string drawingNumber, string drawingName) |
|
700 |
public static bool InsertDrawingInfo(string path, string drawingNumber, string drawingName, SPPID.Model.SPPID_Document document)
|
|
688 | 701 |
{ |
689 | 702 |
Project_Info projectInfo = Project_Info.GetInstance(); |
690 | 703 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath))) |
... | ... | |
698 | 711 |
{ |
699 | 712 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
700 | 713 |
{ |
701 |
cmd.CommandText = string.Format("INSERT OR REPLACE INTO {0} (PATH, DRAWINGNUMBER, DRAWINGNAME) VALUES (@PATH, @DRAWINGNUMBER, @DRAWINGNAME)", SPPID_DRAWING_INFO);
|
|
714 |
cmd.CommandText = string.Format("INSERT OR REPLACE INTO {0} (PATH, DRAWINGNUMBER, DRAWINGNAME, DOCUMENT) VALUES (@PATH, @DRAWINGNUMBER, @DRAWINGNAME, @DOCUMENT)", SPPID_DRAWING_INFO);
|
|
702 | 715 |
cmd.Parameters.AddWithValue("@PATH", path); |
703 | 716 |
cmd.Parameters.AddWithValue("@DRAWINGNUMBER", drawingNumber); |
704 | 717 |
cmd.Parameters.AddWithValue("@DRAWINGNAME", drawingName); |
718 |
cmd.Parameters.AddWithValue("@DOCUMENT", JsonConvert.SerializeObject(document)); |
|
705 | 719 |
cmd.ExecuteNonQuery(); |
706 | 720 |
} |
707 | 721 |
transaction.Commit(); |
DTI_PID/SPPIDConverter/DB/SPPID_DB.cs | ||
---|---|---|
146 | 146 |
bResult = true; |
147 | 147 |
} |
148 | 148 |
} |
149 |
|
|
150 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT PATH FROM {0}.T_ROOTITEM WHERE NAME = '{1}'", dbInfo.Site, dbInfo.Plant); |
|
151 |
using (OracleDataReader reader = cmd.ExecuteReader()) |
|
152 |
{ |
|
153 |
while (reader.Read()) |
|
154 |
{ |
|
155 |
dbInfo.PlantPath = reader["PATH"].ToString(); |
|
156 |
} |
|
157 |
} |
|
149 | 158 |
} |
150 | 159 |
} |
151 | 160 |
} |
내보내기 Unified diff