프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / SPPIDConverter / Util / SPPIDUtil.cs @ baa87c88

이력 | 보기 | 이력해설 | 다운로드 (42 KB)

1 23eb98bf gaqhf
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using Newtonsoft.Json;
7
using System.IO;
8 b8e2644e gaqhf
using Converter.SPPID.DB;
9 23eb98bf gaqhf
using Converter.BaseModel;
10
using System.Windows.Forms;
11 bca81f4c gaqhf
using Converter.SPPID.Model;
12 5dfb8a24 gaqhf
using System.Drawing;
13 4d4dce52 esham21
using Llama;
14 ea54adc8 gaqhf
using System.Data;
15 4d4dce52 esham21
using Plaice;
16 ea54adc8 gaqhf
using Microsoft.VisualBasic;
17 86c0a45e gaqhf
using DevExpress.XtraBars.ViewInfo;
18
using Converter.SPPID.SPPIDModel;
19 23eb98bf gaqhf
20 b8e2644e gaqhf
namespace Converter.SPPID.Util
21 23eb98bf gaqhf
{
22 86c0a45e gaqhf
    public enum BulkAttributeItemType
23
    {
24
        PipeRun,
25
        Symbol,
26
    }
27 5dfb8a24 gaqhf
    public enum SlopeType
28
    {
29 d1eac84d gaqhf
        None,
30 5dfb8a24 gaqhf
        Slope,
31
        HORIZONTAL,
32
        VERTICAL
33
    }
34 23eb98bf gaqhf
    public class SPPIDUtil
35
    {
36 6b60e542 Denny
        public static LMPipeRun PipeRun;
37
        public static List<BaseModel.SPPIDCodeList> CodeListSet;
38
        
39 fab4f207 gaqhf
        public static bool ConvertToSPPIDInfo(string jsonString)
40 23eb98bf gaqhf
        {
41 2e1e3c12 gaqhf
            SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance();
42 23eb98bf gaqhf
            try
43
            {
44 fab4f207 gaqhf
                SPPID_DBInfo jsonSPPIDInfo = JsonConvert.DeserializeObject<SPPID_DBInfo>(jsonString);
45 23eb98bf gaqhf
46
                _SPPIDInfo.DBType = jsonSPPIDInfo.DBType;
47
                _SPPIDInfo.Service = jsonSPPIDInfo.Service;
48
                _SPPIDInfo.Site = jsonSPPIDInfo.Site;
49
                _SPPIDInfo.ServerIP = jsonSPPIDInfo.ServerIP;
50
                _SPPIDInfo.Port = jsonSPPIDInfo.Port;
51
                _SPPIDInfo.DBUser = jsonSPPIDInfo.DBUser;
52
                _SPPIDInfo.DBPassword = jsonSPPIDInfo.DBPassword;
53
                _SPPIDInfo.PlantPath = jsonSPPIDInfo.PlantPath;
54
                _SPPIDInfo.PlantDic = jsonSPPIDInfo.PlantDic;
55
                _SPPIDInfo.PlantPID = jsonSPPIDInfo.PlantPID;
56
                _SPPIDInfo.PlantPIDDic = jsonSPPIDInfo.PlantPIDDic;
57
                _SPPIDInfo.Plant = jsonSPPIDInfo.Plant;
58
                _SPPIDInfo.Enable = jsonSPPIDInfo.Enable;
59
                _SPPIDInfo.SelectedPlant = jsonSPPIDInfo.SelectedPlant;
60
                _SPPIDInfo.PlantList = jsonSPPIDInfo.PlantList;
61 2e92b956 gaqhf
                _SPPIDInfo.SQLSERVER_DBNAME = jsonSPPIDInfo.SQLSERVER_DBNAME;
62 04133d37 gaqhf
                _SPPIDInfo.PlantDic_DataBase = jsonSPPIDInfo.PlantDic_DataBase;
63
                _SPPIDInfo.Plant_DataBase = jsonSPPIDInfo.Plant_DataBase;
64
                _SPPIDInfo.PlantPID_DataBase = jsonSPPIDInfo.PlantPID_DataBase;
65
                _SPPIDInfo.PlantPIDDic_DataBase = jsonSPPIDInfo.PlantPIDDic_DataBase;
66 23eb98bf gaqhf
67
            }
68
            catch (Exception ex)
69
            {
70 fab4f207 gaqhf
                _SPPIDInfo.Enable = false;
71 23eb98bf gaqhf
                return false;
72
            }
73
            return true;
74
        }
75 5dfb8a24 gaqhf
76 e00e891d gaqhf
        public static bool ConvertToETCSetting(string jsonString)
77
        {
78
            ETCSetting _ETCSetting = ETCSetting.GetInstance();
79
            try
80
            {
81
                ETCSetting jsonETCSetting = JsonConvert.DeserializeObject<ETCSetting>(jsonString);
82
83
                _ETCSetting.NoteSymbolPath = jsonETCSetting.NoteSymbolPath;
84
                _ETCSetting.TextSymbolPath = jsonETCSetting.TextSymbolPath;
85
                _ETCSetting.DrainValveSize = jsonETCSetting.DrainValveSize;
86 fbea6028 gaqhf
                _ETCSetting.VendorPackageSymbolPath = jsonETCSetting.VendorPackageSymbolPath;
87 1a3a74a8 gaqhf
                _ETCSetting.TextLocation = jsonETCSetting.TextLocation;
88
                _ETCSetting.NoteLocation = jsonETCSetting.NoteLocation;
89
                _ETCSetting.LineNumberLocation = jsonETCSetting.LineNumberLocation;
90 b2d1c1aa gaqhf
                _ETCSetting.FlowMarkSymbolPath = jsonETCSetting.FlowMarkSymbolPath;
91 b7b123ba gaqhf
                _ETCSetting.BorderFilePath = jsonETCSetting.BorderFilePath;
92 c9264d17 gaqhf
                _ETCSetting.UnitSetting = jsonETCSetting.UnitSetting;
93 86c0a45e gaqhf
                _ETCSetting.BulkAttributes = jsonETCSetting.BulkAttributes;
94 e00e891d gaqhf
            }
95
            catch (Exception ex)
96
            {
97
                return false;
98
            }
99
            return true;
100
        }
101 bca81f4c gaqhf
102 7cbb1038 gaqhf
        public static bool ConvertToGridSetting(string jsonString)
103
        {
104
            GridSetting _GridSetting = GridSetting.GetInstance();
105
            try
106
            {
107
                GridSetting jsonGridSetting = JsonConvert.DeserializeObject<GridSetting>(jsonString);
108
109
                _GridSetting.UseSnapGrid = jsonGridSetting.UseSnapGrid;
110
                _GridSetting.Density = jsonGridSetting.Density;
111
                _GridSetting.Unit = jsonGridSetting.Unit;
112 f676f99a gaqhf
                _GridSetting.DrainValveCellCount = jsonGridSetting.DrainValveCellCount;
113 7cbb1038 gaqhf
            }
114
            catch (Exception ex)
115
            {
116
                return false;
117
            }
118
            return true;
119
        }
120
121 39a2a688 gaqhf
        public static bool ConvertPointBystring(string sPoint, ref double dX, ref double dY)
122
        {
123
            try
124
            {
125
                string[] pointArr = sPoint.Split(new char[] { ',' });
126
                if (pointArr.Length == 2)
127
                {
128
                    dX = Convert.ToDouble(pointArr[0]);
129
                    dY = Convert.ToDouble(pointArr[1]);
130
                }
131
            }
132
            catch (Exception)
133
            {
134
                dX = 0;
135
                dY = 0;
136
                return false;
137
            }
138
139
            return true;
140
        }
141 bca81f4c gaqhf
142 39a2a688 gaqhf
        public static void ConvertSPPIDPoint(ref double dX, ref double dY, double dDwgX, double dDwgY, double SPPID_Width, double SPPID_Height)
143
        {
144 1b261371 gaqhf
            decimal calcX = 0;
145
            decimal calcY = 0;
146
            decimal tempX = Convert.ToDecimal(dX);
147
            decimal tempY = Convert.ToDecimal(dY);
148
            decimal tempWidth = Convert.ToDecimal(SPPID_Width);
149
            decimal tempHeight = Convert.ToDecimal(SPPID_Height);
150
            decimal tempDwgX = Convert.ToDecimal(dDwgX);
151
            decimal tempDwgY = Convert.ToDecimal(dDwgY);
152
153
            calcX = (tempX * tempWidth) / tempDwgX;
154
            calcY = tempHeight - ((tempY * tempHeight) / tempDwgY);
155 c3d2e266 gaqhf
            dX = Convert.ToDouble(calcX);
156
            dY = Convert.ToDouble(calcY);
157 39a2a688 gaqhf
        }
158 bca81f4c gaqhf
159 06b40010 gaqhf
        public static void ConvertGridPoint(ref double x, ref double y)
160
        {
161
            GridSetting _GridSetting = GridSetting.GetInstance();
162
            if (_GridSetting.UseSnapGrid)
163
            {
164
                if (_GridSetting.Unit == GridUnit.Inch)
165
                {
166
                    double length = _GridSetting.Density * 0.0254;
167
                    double tempX = x;
168
                    double tempY = y;
169
                    x = Math.Round(tempX / length) * length;
170
                    y = Math.Round(tempY / length) * length;
171 b66a2996 gaqhf
                }
172
            }
173
        }
174 4d2571ab gaqhf
175 b66a2996 gaqhf
        public static void ConvertGridPointOnlyOnePoint(ref double value)
176
        {
177
            GridSetting _GridSetting = GridSetting.GetInstance();
178
            if (_GridSetting.UseSnapGrid)
179
            {
180
                if (_GridSetting.Unit == GridUnit.Inch)
181
                {
182
                    double temp = value;
183 5fed7052 esham21
                    value = Math.Round(value / _GridSetting.Length) * _GridSetting.Length;
184 06b40010 gaqhf
                }
185
            }
186
        }
187 a0e3dca4 gaqhf
        public static double ConvertGridPointOnlyOnePoint(double value)
188
        {
189
            GridSetting _GridSetting = GridSetting.GetInstance();
190
            if (_GridSetting.UseSnapGrid)
191
            {
192
                if (_GridSetting.Unit == GridUnit.Inch)
193
                {
194
                    double temp = value;
195
                    value = Math.Round(value / _GridSetting.Length) * _GridSetting.Length;
196
                }
197
            }
198
199
            return value;
200
        }
201 06b40010 gaqhf
202 20f9fa83 Denny
        public static bool EqualSpacing(double value1, double value2)
203
        {
204
            GridSetting _GridSetting = GridSetting.GetInstance();
205
            double multiplier = 100000000000000;
206
            value1 = Math.Truncate(value1 * multiplier) / multiplier;
207
            value2 = Math.Truncate(value2 * multiplier) / multiplier;
208
209
            return value1 == value2;
210
        }
211
212 c3e8fa8e gaqhf
        public static SlopeType CalcSlope(double x1, double y1, double x2, double y2, double degree = 15)
213 5dfb8a24 gaqhf
        {
214
            if (x1 - x2 == 0)
215
            {
216
                return SlopeType.VERTICAL;
217
            }
218
            else
219
            {
220
                double angle = Math.Atan(Math.Abs(y2 - y1) / Math.Abs(x2 - x1)) * 180 / Math.PI;
221 c3e8fa8e gaqhf
                if (angle <= degree)
222 5dfb8a24 gaqhf
                    return SlopeType.HORIZONTAL;
223 c3e8fa8e gaqhf
                else if (angle >= 90 - degree)
224 5dfb8a24 gaqhf
                    return SlopeType.VERTICAL;
225
                else
226
                    return SlopeType.Slope;
227
            }
228
        }
229 32205389 gaqhf
        public static double CalcAngle(double x1, double y1, double x2, double y2)
230
        {
231 60f4405d gaqhf
            double result = 90;
232 32205389 gaqhf
            if (x1 - x2 != 0)
233
            {
234
                result = Math.Atan(Math.Abs(y2 - y1) / Math.Abs(x2 - x1)) * 180 / Math.PI;
235
            }
236
            return result;
237
        }
238 5e6ecf05 gaqhf
        public static double CalcLineToPointDistance(double lineX1, double lineY1, double lineX2, double lineY2, double x, double y)
239
        {
240
241
            double distance = 0;
242
            if (lineX1 == lineX2)
243
                distance = Math.Abs(x - lineX1);
244
            else
245
            {
246
                double a;
247
                double b;
248
                double c;
249
250
                a = (lineY2 - lineY1) / (lineX2 - lineX1);
251
                b = -1;
252
                c = -a * lineX1 + lineY1;
253
254
                distance = Math.Abs(a * x + b * y + c) / Math.Pow(a * a + b * b, 0.5);
255
            }
256
            return distance;
257
        }
258
259 56bc67e1 gaqhf
        public static double[] CalcLineCrossingPoint(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
260
        {
261
            double a1;
262
            double a2;
263
            double b1;
264
            double b2;
265
266
            if (x1 == x2)
267
                a1 = 0;
268
            else
269
                a1 = (y2 - y1) / (x2 - x1);
270
            if (x3 == x4)
271
                a2 = 0;
272
            else
273
                a2 = (y4 - y3) / (x4 - x3);
274
275
            b1 = -a1 * x1 + y1;
276
            b2 = -a2 * x3 + y3;
277
278 32205389 gaqhf
            if (x1 == x2 && x3 == x4)
279 56bc67e1 gaqhf
            {
280
                return null;
281
            }
282
            else if (x1 == x2)
283
            {
284
                return new double[] { x1, a2*x1 + b2 };
285
            }
286
            else if (x3 == x4)
287
            {
288
                return new double[] { x3, a1 * x3 + b1 };
289
            }
290
            else
291
            {
292 32205389 gaqhf
                return new double[] { -(b1 - b2) / (a1 - a2), a1 * -(b1 - b2) / (a1 - a2) + b1 };
293
            }            
294
        }
295
296
        public static double CalcGradient(double x1, double y1, double x2, double y2)
297
        {
298
            double result = double.NaN;
299
300
            if (x1 != x2)
301
                result = (y2 - y1) / (x2 - x1);
302
303
            return result;
304 56bc67e1 gaqhf
        }
305 d1eac84d gaqhf
306 30a9ffce gaqhf
        public static double CalcPointToPointdDistance(double x1, double y1, double x2, double y2)
307
        {
308
            return Math.Pow(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2), 0.5);
309
        }
310
311 bca81f4c gaqhf
        public static object FindObjectByUID(Document document, string UID)
312
        {
313 d63050d6 gaqhf
            if (!string.IsNullOrEmpty(UID) && UID != "None")
314 bca81f4c gaqhf
            {
315 d63050d6 gaqhf
                foreach (Symbol item in document.SYMBOLS)
316
                {
317
                    if (item.UID == UID)
318
                        return item;
319
                }
320 bca81f4c gaqhf
321 d63050d6 gaqhf
                foreach (Line item in document.LINES)
322
                {
323
                    if (item.UID == UID)
324
                        return item;
325
                }
326 bca81f4c gaqhf
327 d63050d6 gaqhf
                foreach (Text item in document.TEXTINFOS)
328
                {
329
                    if (item.UID == UID)
330
                        return item;
331
                }
332 bca81f4c gaqhf
333 d63050d6 gaqhf
                foreach (Note item in document.NOTES)
334
                {
335
                    if (item.UID == UID)
336
                        return item;
337
                }
338 bca81f4c gaqhf
339 d63050d6 gaqhf
                foreach (LineNumber item in document.LINENUMBERS)
340
                {
341
                    if (item.UID == UID)
342
                        return item;
343
                }
344 bca81f4c gaqhf
345 d63050d6 gaqhf
                foreach (Equipment item in document.Equipments)
346
                {
347
                    if (item.UID == UID)
348
                        return item;
349
                }
350 30ba9ae0 gaqhf
351
                foreach (SpecBreak item in document.SpecBreaks)
352
                {
353
                    if (item.UID == UID)
354
                        return item;
355
                }
356
357
                foreach (EndBreak item in document.EndBreaks)
358
                {
359
                    if (item.UID == UID)
360
                        return item;
361
                }
362 fb2d9638 gaqhf
363
                foreach (VendorPackage item in document.VendorPackages)
364
                {
365
                    if (item.UID == UID)
366
                        return item;
367
                }
368 809a7640 gaqhf
            }
369
370 bca81f4c gaqhf
            return null;
371
        }
372 d1eac84d gaqhf
373 335b7a24 gaqhf
        public static List<Line> FindLinesByModelId(Document document, string ModelItemId)
374
        {
375
            List<Line> lines = new List<Line>();
376
            foreach (Line item in document.LINES)
377
            {
378
                if (item.SPPID.ModelItemId == ModelItemId)
379
                    lines.Add(item);
380
            }
381
382
            return lines;
383
        }
384 d1eac84d gaqhf
385 4d2571ab gaqhf
        public static void FindConnectedSymbolGroup(Document document, Symbol symbol, List<Symbol> group)
386 b9cc9254 gaqhf
        {
387 f1a7faf9 gaqhf
            if (!group.Contains(symbol))
388
                group.Add(symbol);
389
390 4d2571ab gaqhf
            foreach (var connector in symbol.CONNECTORS)
391 b9cc9254 gaqhf
            {
392 4d2571ab gaqhf
                object connectedItem = FindObjectByUID(document, connector.CONNECTEDITEM);
393
                if (connectedItem != null && connectedItem.GetType() == typeof(Symbol))
394 b9cc9254 gaqhf
                {
395 4d2571ab gaqhf
                    Symbol connSymbol = connectedItem as Symbol;
396
                    if (!group.Contains(connSymbol))
397 b9cc9254 gaqhf
                    {
398 4d2571ab gaqhf
                        group.Add(connSymbol);
399
                        FindConnectedSymbolGroup(document, connSymbol, group);
400 b9cc9254 gaqhf
                    }
401
                }
402
            }
403
        }
404
405 4d2571ab gaqhf
        public static Symbol FindCenterAtThreeSymbols(Document document, List<Symbol> group)
406 d1eac84d gaqhf
        {
407 4d2571ab gaqhf
            Symbol result = null;
408
409
            // Group의 가운데 찾기
410
            if (group.Count == 3)
411 d1eac84d gaqhf
            {
412 4d2571ab gaqhf
                foreach (var symbol in group)
413
                {
414
                    int count = 0;
415
                    foreach (var connector in symbol.CONNECTORS)
416
                    {
417
                        object item = FindObjectByUID(document, connector.CONNECTEDITEM);
418
                        if (item != null && item.GetType() == typeof(Symbol) && group.Contains(item as Symbol))
419
                            count++;
420
                    }
421 d1eac84d gaqhf
422 4d2571ab gaqhf
                    if (count == 2)
423
                    {
424
                        result = symbol;
425
                        break;
426
                    }
427
                }
428 d1eac84d gaqhf
            }
429
430 4d2571ab gaqhf
            return result;
431 d1eac84d gaqhf
        }
432
433
        private static void GetConnectedSymbol(Document document, Symbol symbol, List<Symbol> symbolGroup)
434
        {
435
            foreach (Connector connector in symbol.CONNECTORS)
436
            {
437
                object item = FindObjectByUID(document, connector.CONNECTEDITEM);
438
                if (item != null && item.GetType() == typeof(Symbol))
439
                {
440
                    Symbol connSymbol = item as Symbol;
441
                    if (connSymbol != null && !symbolGroup.Contains(connSymbol))
442
                    {
443
                        symbolGroup.Add(connSymbol);
444
                        GetConnectedSymbol(document, connSymbol, symbolGroup);
445
                    }
446
                }
447
            }
448
        }
449 2fdb56bf gaqhf
450 20f9fa83 Denny
        public static int SortSymbolPriority(Symbol a, Symbol b)
451
        {
452
            int resultValue = a.SPPID.ORIGINAL_Y.CompareTo(b.SPPID.ORIGINAL_Y);
453
            if (resultValue == 0)
454
                resultValue = a.SPPID.ORIGINAL_X.CompareTo(b.SPPID.ORIGINAL_X);
455
            return resultValue;
456
        }
457
458 2fdb56bf gaqhf
        public static Connector FindSymbolConnectorByUID(Document document, string uid, Symbol targetSymbol)
459
        {
460
            foreach (var connector in targetSymbol.CONNECTORS)
461
            {
462
                if (connector.CONNECTEDITEM == uid)
463
                {
464
                    return connector;
465
                }
466
            }
467
468
            return null;
469
        }
470 71ba1ca3 gaqhf
471
        public static Symbol FindSymbolByRepresentationID(Document document, string repID)
472
        {
473
            Symbol findSymbol = null;
474
            foreach (var symbol in document.SYMBOLS)
475
            {
476
                if (symbol.SPPID.RepresentationId == repID)
477
                {
478
                    findSymbol = symbol;
479
                }
480
                else
481
                {
482
                    ChildSymbol childSymbol = FindChildSymbolByRepresentationID(document, symbol, repID);
483
                    if (childSymbol != null)
484
                        findSymbol = symbol;
485
                }
486
487
                if (findSymbol != null)
488
                    break;
489
            }
490
491
            return findSymbol;
492
        }
493
494
        public static ChildSymbol FindChildSymbolByRepresentationID(Document document, Symbol symbol, string repID)
495
        {
496
            ChildSymbol childSymbol = null;
497
498
            foreach (ChildSymbol loopChild in symbol.ChildSymbols)
499
            {
500
                if (loopChild.SPPID.RepresentationId == repID)
501
                {
502
                    childSymbol = loopChild;
503
                    break;
504
                }
505
                else
506
                {
507
                    childSymbol = FindChildSymbolByRepresentationIDLoop(document, repID, loopChild);
508
                    if (childSymbol != null)
509
                        break;
510
                }
511
            }
512
513
            return childSymbol;
514
        }
515
516
        private static ChildSymbol FindChildSymbolByRepresentationIDLoop(Document document, string repID, ChildSymbol childSymbol)
517
        {
518
            ChildSymbol findChild = null;
519
520
            foreach (var item in childSymbol.ChildSymbols)
521
            {
522
                if (item.SPPID.RepresentationId == repID)
523
                {
524
                    findChild = item;
525
                    break;
526
                }
527
                else
528
                {
529
                    findChild = FindChildSymbolByRepresentationIDLoop(document, repID, item);
530
                    if (findChild != null)
531
                        break;
532
                }
533
            }
534
535
            return findChild;
536
        }
537 d9794a6c gaqhf
538
        public static bool IsBranchLine(Line line1, Line line2)
539
        {
540
            bool result = true;
541
542
            Connector conn1 = line1.CONNECTORS.Find(x => x.CONNECTEDITEM == line2.UID);
543
            Connector conn2 = line2.CONNECTORS.Find(x => x.CONNECTEDITEM == line1.UID);
544
545
            if (conn1 != null && conn2 != null)
546
                result = false;
547
548
            return result;
549
        }
550
551 a0e3dca4 gaqhf
        public static bool IsBranchLine(Line line)
552
        {
553 cf210438 gaqhf
            Connector connector = line.CONNECTORS.Find(x =>
554
            x.ConnectedObject != null &&
555
            x.ConnectedObject.GetType() == typeof(Line) &&
556 a0e3dca4 gaqhf
            IsBranchLine(line, x.ConnectedObject as Line));
557
            return connector != null ? true : false;
558
        }
559 cf210438 gaqhf
560
        public static bool IsBranchedLine(Document document,Line line)
561
        {
562
            return document.LINES.Find(x => x.CONNECTORS.Find(y => y.CONNECTEDITEM == line.UID && IsBranchLine(x, y.ConnectedObject as Line)) != null) != null ? true : false;
563
        }
564
565 6d12a734 gaqhf
        public static void CalcOverlap(double[] range1, double[] range2, ref double x, ref double y, ref bool overlapX, ref bool overlapY)
566 d9794a6c gaqhf
        {
567
            if (range1[0] <= range2[2] && range1[2] >= range2[0])
568
            {
569 6d12a734 gaqhf
                overlapX = true;
570 d9794a6c gaqhf
                x = Math.Min(Math.Abs(range1[0] - range2[2]), Math.Abs(range1[2] - range2[0]));
571
            }
572
573
            if (range1[1] <= range2[3] && range1[3] >= range2[1])
574
            {
575 6d12a734 gaqhf
                overlapY = true;
576 d9794a6c gaqhf
                y = Math.Min(Math.Abs(range1[1] - range2[3]), Math.Abs(range1[3] - range2[1]));
577
            }
578
        }
579
580 1299077b gaqhf
        public static bool IsOverlap(double[] range1, double[] range2)
581
        {
582
            if (range1[0] <= range2[2] && range1[2] >= range2[0] && range1[1] <= range2[3] && range1[3] >= range2[1])
583
                return true;
584
            else
585
                return false;
586
        }
587
588 d9794a6c gaqhf
        public static void CalcNewCoordinateForSymbol(Symbol symbol, Symbol prevSymbol, double distanceX, double distanceY)
589
        {
590
            SlopeType slopeType = SPPIDUtil.CalcSlope(prevSymbol.SPPID.ORIGINAL_X, prevSymbol.SPPID.ORIGINAL_Y, symbol.SPPID.ORIGINAL_X, symbol.SPPID.ORIGINAL_Y);
591
            GridSetting _GridSetting = GridSetting.GetInstance();
592
            if (slopeType == SlopeType.HORIZONTAL)
593
            {
594
                double length = (Math.Ceiling(distanceX / _GridSetting.Length) + 1) * _GridSetting.Length;
595
                if (prevSymbol.SPPID.ORIGINAL_X < symbol.SPPID.ORIGINAL_X)
596
                    symbol.SPPID.ORIGINAL_X = symbol.SPPID.ORIGINAL_X + length;
597
                else
598
                    symbol.SPPID.ORIGINAL_X = symbol.SPPID.ORIGINAL_X - length;
599
            }
600
            else if (slopeType == SlopeType.VERTICAL)
601
            {
602
                double length = (Math.Ceiling(distanceY / _GridSetting.Length) + 1) * _GridSetting.Length;
603
                if (prevSymbol.SPPID.ORIGINAL_Y < symbol.SPPID.ORIGINAL_Y)
604
                    symbol.SPPID.ORIGINAL_Y = symbol.SPPID.ORIGINAL_Y + length;
605
                else
606
                    symbol.SPPID.ORIGINAL_Y = symbol.SPPID.ORIGINAL_Y - length;
607
            }
608
        }
609 a0e3dca4 gaqhf
610 b2064e69 gaqhf
        public static Line GetConnectedLine(Symbol symbol1, Symbol symbol2)
611
        {
612
            Line line = null;
613
            Connector connector1 = symbol1.CONNECTORS.Find(x => x.ConnectedObject != null && x.ConnectedObject.GetType() == typeof(Line) &&
614
            ((Line)x.ConnectedObject).CONNECTORS.Find(y => y.ConnectedObject == symbol2) != null);
615
            Connector connector2 = symbol2.CONNECTORS.Find(x => x.ConnectedObject != null && x.ConnectedObject.GetType() == typeof(Line) &&
616
            ((Line)x.ConnectedObject).CONNECTORS.Find(y => y.ConnectedObject == symbol1) != null);
617
            if (connector1 != null && connector2 != null)
618
                line = connector1.ConnectedObject as Line;
619
620
            return line;
621
        }
622
623
        public static int GetBranchLineCount(Document document, Line line)
624
        {
625
            return document.LINES.FindAll(x => IsBranchLine(line, x) && x.CONNECTORS.Find(y => y.ConnectedObject == line) != null).Count;
626
        }
627
628 a0e3dca4 gaqhf
        public static bool GetLineConnectorPoint(Line line, Connector connector, ref double x, ref double y)
629
        {
630
            bool bStart = false;
631
            int index = line.CONNECTORS.IndexOf(connector);
632
            if (index == 0)
633
            {
634
                x = line.SPPID.START_X;
635
                y = line.SPPID.START_Y;
636
                bStart = true;
637
            }
638
            else
639
            {
640
                x = line.SPPID.END_X;
641
                y = line.SPPID.END_Y;
642
            }
643
            return bStart;
644
        }
645 dfac4553 gaqhf
646 d9fc7084 gaqhf
        public static bool IsSegment(Document document, Line line1, Line line2)
647 dfac4553 gaqhf
        {
648
            bool result = false;
649
650
            SpecBreak specBreak = document.SpecBreaks.Find(x =>
651 d9fc7084 gaqhf
                (x.DownStreamUID == line1.UID && x.UpStreamUID == line2.UID) || 
652
                (x.DownStreamUID == line2.UID && x.UpStreamUID == line1.UID));
653 dfac4553 gaqhf
654
            EndBreak endBreak = document.EndBreaks.Find(x =>
655 d9fc7084 gaqhf
            (x.OWNER == line1.UID && x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == line2.UID) ||
656
            (x.OWNER == line2.UID && x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == line1.UID));
657 dfac4553 gaqhf
658
            if (specBreak != null || endBreak != null)
659
                result = true;
660
661
            return result;
662
        }
663 d23fe61b gaqhf
664 d9fc7084 gaqhf
        public static bool IsSegment(Document document, Symbol symbol1, Symbol symbol2)
665 32205389 gaqhf
        {
666
            bool result = false;
667
            SpecBreak startSpecBreak = document.SpecBreaks.Find(x =>
668 d9fc7084 gaqhf
            (x.DownStreamUID == symbol1.UID && x.UpStreamUID == symbol2.UID) ||
669
            (x.DownStreamUID == symbol2.UID && x.UpStreamUID == symbol1.UID));
670 32205389 gaqhf
671
            EndBreak startEndBreak = document.EndBreaks.Find(x =>
672 d9fc7084 gaqhf
            (x.OWNER == symbol1.UID && x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == symbol2.UID) ||
673
            (x.OWNER == symbol2.UID && x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == symbol1.UID));
674 32205389 gaqhf
675
            if (startSpecBreak != null || startEndBreak != null)
676
                result = true;
677
678
            return result;
679
        }
680 ea54adc8 gaqhf
        public static void test()
681
        {
682
            Placement placement = new Placement();
683
            LMADataSource dataSource = new LMADataSource();
684 518c7651 gaqhf
            LMSymbol symbol = dataSource.GetSymbol("BBAB475FA9AF4C01AACF4C51F56241F8");
685
686
            string[] array1 = new string[] { "", "Top" };
687
            string[] array2 = new string[] { "", "0.005" };
688
            placement.PIDApplyParameters(symbol.AsLMRepresentation(), array1, array2);
689 ea54adc8 gaqhf
690
            ReleaseCOMObjects(dataSource);
691
        }
692
        public static DataTable GetUnitInfo()
693
        {
694
            LMADataSource dataSource = new LMADataSource();
695 9c451472 gaqhf
            LMPlantGroups units = new LMPlantGroups();
696 ea54adc8 gaqhf
            units.Collect(dataSource);
697
            DataTable dt = new DataTable();
698
            dt.Columns.Add("LEVEL", typeof(string));
699
            dt.Columns.Add("SP_ID", typeof(string));
700
            dt.Columns.Add("PARENTID", typeof(string));
701
            dt.Columns.Add("NAME", typeof(string));
702 9c451472 gaqhf
703
            foreach (LMPlantGroup unit in units)
704 ea54adc8 gaqhf
            {
705 4d4dce52 esham21
                object tt = unit.get_Dir_Path();
706 9c451472 gaqhf
                if (tt.Equals(DBNull.Value))
707
                    continue;
708 4d4dce52 esham21
                string dir = unit.get_Dir_Path();
709 ea54adc8 gaqhf
                string[] array = dir.Split('\\');
710
                List<string> parents = new List<string>();
711
                string prevId = "-1";
712
                for (int i = 1; i < array.Length; i++)
713
                {
714
                    string name = array[i];
715
                    string uid = Guid.NewGuid().ToString();
716
                    DataRow[] rows = dt.Select(string.Format("LEVEL = '{0}' AND NAME = '{1}' AND PARENTID = '{2}'", i, name, prevId));
717
                    if (rows.Length == 0)
718
                        dt.Rows.Add(i, uid, prevId, name);
719
                    else
720
                        uid = rows[0]["SP_ID"].ToString();
721
                    prevId = uid;
722
                }
723
            }
724
725
            dt.Columns.Remove("LEVEL");
726
727
            ReleaseCOMObjects(units);
728
            ReleaseCOMObjects(dataSource);
729
730
            return dt;
731
        }
732
        public static string T_OPTIONSETTING_Value(string name)
733
        {
734
            string result = string.Empty;
735
            LMADataSource dataSource = new LMADataSource();
736
            LMOptionSettings settings = new LMOptionSettings();
737
738
            LMAFilter filter = new LMAFilter();
739
            LMACriterion criterion = new LMACriterion();
740
            filter.ItemType = "OptionSetting";
741
            criterion.SourceAttributeName = "NAME";
742
            criterion.Operator = "=";
743 4d4dce52 esham21
            criterion.set_ValueAttribute(name);
744
            filter.get_Criteria().Add(criterion);
745 ea54adc8 gaqhf
            settings.Collect(dataSource, Filter: filter);
746
747
            foreach (LMOptionSetting item in settings)
748
            {
749 4d4dce52 esham21
                result = item.get_Value();
750 ea54adc8 gaqhf
                break;
751
            }
752
753
            ReleaseCOMObjects(criterion);
754
            ReleaseCOMObjects(filter);
755
            ReleaseCOMObjects(settings);
756
            ReleaseCOMObjects(dataSource);
757
            return result;
758
        }
759
760 a80baec5 gaqhf
        public static string T_PLANTSETTING_Value(string name)
761
        {
762
            string result = string.Empty;
763
            LMADataSource dataSource = new LMADataSource();
764
            LMPlantSettings settings = new LMPlantSettings();
765
766
            LMAFilter filter = new LMAFilter();
767
            LMACriterion criterion = new LMACriterion();
768
            filter.ItemType = "PlantSetting";
769
            criterion.SourceAttributeName = "NAME";
770
            criterion.Operator = "=";
771 4d4dce52 esham21
            criterion.set_ValueAttribute(name);
772
            filter.get_Criteria().Add(criterion);
773 a80baec5 gaqhf
            settings.Collect(dataSource, Filter: filter);
774
775
            foreach (LMPlantSetting item in settings)
776
            {
777 4d4dce52 esham21
                result = item.get_Value();
778 a80baec5 gaqhf
                break;
779
            }
780
781
            ReleaseCOMObjects(criterion);
782
            ReleaseCOMObjects(filter);
783
            ReleaseCOMObjects(settings);
784
            ReleaseCOMObjects(dataSource);
785
            return result;
786
        }
787
788 ea54adc8 gaqhf
        public static void ReleaseCOMObjects(params object[] objVars)
789
        {
790
            int intNewRefCount = 0;
791
            foreach (object obj in objVars)
792
            {
793
                if (!Information.IsNothing(obj) && System.Runtime.InteropServices.Marshal.IsComObject(obj))
794
                    intNewRefCount = intNewRefCount + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj);
795
            }
796
        }
797 86c0a45e gaqhf
798
        public static void BulkAttribute(LMADataSource dataSource, List<BulkAttribute> attributes, BulkAttributeItemType type)
799
        {
800
            switch (type)
801
            {
802
                case BulkAttributeItemType.PipeRun:
803
                    BulkAttribute_PipeRun();
804
                    break;
805
                case BulkAttributeItemType.Symbol:
806
                    BulkAttribute_Symbol();
807
                    break;
808
                default:
809
                    break;
810
            }
811
            void BulkAttribute_PipeRun()
812
            {
813
                string drawingId = dataSource.PIDMgr.Drawing.ID;
814
815
                LMAFilter filter = new LMAFilter();
816
817
                LMACriterion criterion = new LMACriterion();
818
                criterion.SourceAttributeName = "REPRESENTATION.SP_DRAWINGID";
819
                criterion.Operator = "=";
820 4d4dce52 esham21
                criterion.set_ValueAttribute(drawingId);
821
                filter.get_Criteria().Add(criterion);
822 86c0a45e gaqhf
                filter.ItemType = "PIPERUN";
823
824
                LMACriterion criterion2 = new LMACriterion();
825
                criterion2.SourceAttributeName = "REPRESENTATION.INSTOCKPILE";
826
                criterion2.Operator = "=";
827 4d4dce52 esham21
                criterion2.set_ValueAttribute("1");
828 86c0a45e gaqhf
                criterion2.Conjunctive = true;
829 4d4dce52 esham21
                filter.get_Criteria().Add(criterion2);
830 86c0a45e gaqhf
831
                LMACriterion criterion3 = new LMACriterion();
832
                criterion3.SourceAttributeName = "REPRESENTATION.ITEMSTATUS";
833
                criterion3.Operator = "=";
834 4d4dce52 esham21
                criterion3.set_ValueAttribute("1");
835 86c0a45e gaqhf
                criterion3.Conjunctive = true;
836 4d4dce52 esham21
                filter.get_Criteria().Add(criterion3);
837 86c0a45e gaqhf
838
                LMPipeRuns items = new LMPipeRuns();
839
                items.Collect(dataSource, Filter: filter);
840
841
                foreach (LMPipeRun item in items)
842
                {
843
                    foreach (var attribute in attributes)
844
                    {
845
                        if (item.Attributes[attribute.SPPIDAttributeName] != null)
846 4d4dce52 esham21
                            item.Attributes[attribute.SPPIDAttributeName].set_Value(attribute.Value);
847 86c0a45e gaqhf
                    }
848
                    item.Commit();
849
                }
850
851
                ReleaseCOMObjects(items);
852
                ReleaseCOMObjects(filter);
853
                ReleaseCOMObjects(criterion);
854
                ReleaseCOMObjects(criterion2);
855
                ReleaseCOMObjects(criterion3);
856
            }
857
            void BulkAttribute_Symbol()
858
            {
859
                string drawingId = dataSource.PIDMgr.Drawing.ID;
860
861
                LMAFilter filter = new LMAFilter();
862
863
                LMACriterion criterion = new LMACriterion();
864
                criterion.SourceAttributeName = "SP_DRAWINGID";
865
                criterion.Operator = "=";
866 4d4dce52 esham21
                criterion.set_ValueAttribute(drawingId);
867
                filter.get_Criteria().Add(criterion);
868 86c0a45e gaqhf
                filter.ItemType = "SYMBOL";
869
870
                LMACriterion criterion2 = new LMACriterion();
871
                criterion2.SourceAttributeName = "INSTOCKPILE";
872
                criterion2.Operator = "=";
873 4d4dce52 esham21
                criterion2.set_ValueAttribute("1");
874 86c0a45e gaqhf
                criterion2.Conjunctive = true;
875 4d4dce52 esham21
                filter.get_Criteria().Add(criterion2);
876 86c0a45e gaqhf
877
                LMACriterion criterion3 = new LMACriterion();
878
                criterion3.SourceAttributeName = "ITEMSTATUS";
879
                criterion3.Operator = "=";
880 4d4dce52 esham21
                criterion3.set_ValueAttribute("1");
881 86c0a45e gaqhf
                criterion3.Conjunctive = true;
882 4d4dce52 esham21
                filter.get_Criteria().Add(criterion3);
883 86c0a45e gaqhf
884
                LMSymbols items = new LMSymbols();
885
                items.Collect(dataSource, Filter: filter);
886
887
                foreach (LMSymbol item in items)
888
                {
889
                    foreach (var attribute in attributes)
890
                    {
891
                        if (item.Attributes[attribute.SPPIDAttributeName] != null)
892 4d4dce52 esham21
                            item.Attributes[attribute.SPPIDAttributeName].set_Value(attribute.Value);
893 86c0a45e gaqhf
                    }
894
                    item.Commit();
895
                }
896
897
                ReleaseCOMObjects(items);
898
                ReleaseCOMObjects(filter);
899
                ReleaseCOMObjects(criterion);
900
                ReleaseCOMObjects(criterion2);
901
                ReleaseCOMObjects(criterion3);
902
            }
903
        }
904 6b60e542 Denny
        public static void UpdatePipeRunProperty(LMADataSource dataSource, Model.SPPID_PipeRunPropSetting setting)
905
        {
906
            string drawingId = dataSource.PIDMgr.Drawing.ID;
907
            string type = setting.DataType.Substring(0, 1);
908
            LMAFilter filter = new LMAFilter();
909
            filter.ItemType = "PIPERUN";
910
911
            LMACriterion criterionID = new LMACriterion();
912
            criterionID.SourceAttributeName = "REPRESENTATION.SP_DRAWINGID";
913
            criterionID.Operator = "=";
914
            criterionID.set_ValueAttribute(drawingId);
915
            filter.get_Criteria().Add(criterionID);
916
917
            SetCriterionPipeRun(setting.Cond1_Name, setting.Cond1_Value, setting.Cond1_DataType);
918
            if (!string.IsNullOrWhiteSpace(setting.Cond2_Name))
919
                SetCriterionPipeRun(setting.Cond2_Name, setting.Cond2_Value, setting.Cond2_DataType);
920
921
            LMPipeRuns items = new LMPipeRuns();
922
            items.Collect(dataSource, Filter: filter);
923
924
            foreach (LMPipeRun item in items)
925
            {
926
                if (item.Attributes[setting.Name] != null)
927
                {
928
                    object oValue = null;
929
                    if (type == "S" || type == "C")
930
                        oValue = setting.Value;
931
                    else
932
                        oValue = Convert.ToDouble(setting.Value);
933
934
                    item.Attributes[setting.Name].set_Value(oValue);
935
                }
936
                try
937
                {
938
                    item.Commit();
939
                }
940
                catch (Exception ex)
941
                {
942
                }
943
            }
944
945
            ReleaseCOMObjects(items);
946
            ReleaseCOMObjects(filter);
947
948
            void SetCriterionPipeRun(string condName, string condValue, string condDataType)
949
            {
950
                if (condValue.Contains("~"))
951
                {
952
                    string[] value_Arr = condValue.Split('~');
953
954
                    object fromValue = GetPipeRunSiValue(dataSource, condName, value_Arr[0]);
955
                    if (fromValue.GetType() == typeof(double))
956
                    {
957
                        double dfrom = Convert.ToDouble(fromValue);
958
                        dfrom -= 0.000000000001;
959
                        fromValue = dfrom;
960
                    }
961
                    object toValue = null;
962
                    if (value_Arr.Length > 1)
963
                    {
964
                        toValue = GetPipeRunSiValue(dataSource, condName, value_Arr[1]);
965
                        if (toValue.GetType() == typeof(double))
966
                        {
967
                            double dTo = Convert.ToDouble(toValue);
968
                            dTo += 0.000000000001;
969
                            toValue = dTo;
970
                        }
971
                    }
972
973
                    LMACriterion criterionFrom = new LMACriterion();
974
                    criterionFrom.SourceAttributeName = condName;
975
                    criterionFrom.Operator = ">";
976
                    criterionFrom.set_ValueAttribute(fromValue);
977
                    criterionFrom.Conjunctive = true;
978
                    filter.get_Criteria().Add(criterionFrom);
979
                    ReleaseCOMObjects(criterionFrom);
980
981
                    if (toValue != null)
982
                    {
983
                        LMACriterion criterionTo = new LMACriterion();
984
                        criterionTo.SourceAttributeName = condName;
985
                        criterionTo.Operator = "<";
986
                        criterionTo.set_ValueAttribute(toValue);
987
                        criterionTo.Conjunctive = true;
988
                        filter.get_Criteria().Add(criterionTo);
989
990
                        ReleaseCOMObjects(criterionTo);
991
                    }
992
                }
993
                else
994
                {
995
                    LMACriterion criterion = new LMACriterion();
996
                    criterion.SourceAttributeName = condName;
997
                    criterion.Operator = "=";
998
                    double dValue = 0;
999
                    object oValue = condValue;
1000
                    if (condDataType.StartsWith("C"))
1001
                    {
1002
                        oValue = GetCodeIndex(condDataType, condValue.Trim());
1003
                    }
1004
                    else if (double.TryParse(condValue.Trim(), out dValue))
1005
                    {
1006
                        oValue = dValue;
1007
                    }
1008
                    else
1009
                    {
1010
                        oValue = GetPipeRunSiValue(dataSource, condName, condValue);
1011
                    }
1012
                    criterion.set_ValueAttribute(oValue);
1013
                    criterion.Conjunctive = true;
1014
                    filter.get_Criteria().Add(criterion);
1015
                    ReleaseCOMObjects(criterion);
1016
                }
1017
                ReleaseCOMObjects(criterionID);
1018
            }
1019
        }
1020
1021
        private static object GetPipeRunSiValue(LMADataSource dataSource, string attributeName, string displayValue)
1022
        {
1023
            object valueObject = null;
1024
1025
            if (PipeRun == null)
1026
            {
1027
                string drawingId = dataSource.PIDMgr.Drawing.ID;
1028
                LMAFilter filter = new LMAFilter();
1029
                LMACriterion criterion = new LMACriterion();
1030
                criterion.SourceAttributeName = "REPRESENTATION.SP_DRAWINGID";
1031
                criterion.Operator = "=";
1032
                criterion.set_ValueAttribute(drawingId);
1033
                filter.get_Criteria().Add(criterion);
1034
                filter.ItemType = "PIPERUN";
1035
1036
                LMPipeRuns items = new LMPipeRuns();
1037
                items.Collect(dataSource, Filter: filter);
1038
1039
                foreach (LMPipeRun run in items)
1040
                {
1041
                    PipeRun = run;
1042
                    break;
1043
                }
1044
                ReleaseCOMObjects(criterion);
1045
                ReleaseCOMObjects(criterion);
1046
                ReleaseCOMObjects(items);
1047
            }
1048
1049
            if (PipeRun != null)
1050
            {
1051
                if (PipeRun.Attributes[attributeName] != null)
1052
                {
1053
                    object prevValue = PipeRun.Attributes[attributeName].get_Value();
1054
                    PipeRun.Attributes[attributeName].set_Value(displayValue);
1055
                    valueObject = PipeRun.Attributes[attributeName].SIValue;                    
1056
                    PipeRun.Attributes[attributeName].set_Value(prevValue);
1057
                }
1058
            }
1059
1060
            if (valueObject == null)
1061
            {
1062
                valueObject = displayValue;
1063
            }
1064
            return valueObject;
1065
        }
1066
1067
        private static void InitCodeList()
1068
        {
1069
            if (CodeListSet == null || CodeListSet.Count == 0)
1070
            {
1071
                CodeListSet = new List<SPPIDCodeList>();
1072
                DataTable dt = SPPID_DB.GetSPPIDCodeList();
1073
                try
1074
                {
1075
                    Plaice.Placement placement = new Plaice.Placement();
1076
                    LMADataSource dataSource = placement.PIDDataSource;
1077
                    foreach (LMAEnumAttList item in dataSource.CodeLists)
1078
                    {
1079
                        DataRow[] rows = dt.Select(string.Format("ATTRIBUTE_DATATYPE = '{0}'", item.Name));
1080
                        foreach (DataRow row in rows)
1081
                        {
1082
                            string name = row["ATTRIBUTE_NAME"].ToString();
1083
                            if (CodeListSet.FirstOrDefault(x => x.Name.Equals(name)) == null)
1084
                            {
1085
                                SPPIDCodeList code = new SPPIDCodeList();
1086
                                code.Name = name;
1087
                                code.CodeName = item.Name;
1088
                                int nullIndex = item.EnumeratedAttributes.GetItemIndex("");
1089
                                if (nullIndex >= 0)
1090
                                {
1091
                                    code.Values.Add(nullIndex, "");
1092
                                }
1093
                                foreach (LMAEnumeratedAttribute attr in item.EnumeratedAttributes)
1094
                                {
1095
                                    if (attr.Name == "") continue;
1096
                                    code.Values.Add(attr.Index, attr.Name);
1097
                                }
1098
1099
                                CodeListSet.Add(code);
1100
                            }
1101
                        }
1102
                        SPPIDUtil.ReleaseCOMObjects(item);
1103
                    }
1104
                    SPPIDUtil.ReleaseCOMObjects(dataSource);
1105
                    SPPIDUtil.ReleaseCOMObjects(placement);
1106
                }
1107
                catch (Exception ex)
1108
                {
1109
                    MessageBox.Show(ex.Message);
1110
                }
1111
            }
1112
        }
1113
        public static SPPIDCodeList GetCodeList(string codeName)
1114
        {
1115
            InitCodeList();
1116
            SPPIDCodeList findCodeList = CodeListSet.FirstOrDefault(f => f.CodeName == codeName);
1117
            if (findCodeList == null)
1118
            {
1119
                findCodeList = CodeListSet.FirstOrDefault(f => f.Name == codeName);
1120
            }
1121
1122
            return findCodeList;
1123
        }
1124
        public static int GetCodeIndex(string codeName, string codeText)
1125
        {
1126
            int codeIndex = -1;
1127
            InitCodeList();
1128
            SPPIDCodeList findCodeList = CodeListSet.FirstOrDefault(f => f.CodeName == codeName);
1129
            if (findCodeList != null && findCodeList.Values.ContainsValue(codeText))
1130
            {
1131
                codeIndex = findCodeList.Values.Where(w => w.Value == codeText).Select(s => s.Key).FirstOrDefault();
1132
            }
1133
            return codeIndex;
1134
        }
1135 23eb98bf gaqhf
    }
1136
}
클립보드 이미지 추가 (최대 크기: 500 MB)