프로젝트

일반

사용자정보

개정판 a591fb54

IDa591fb540e7179e9987a99d368f6bad278750153
상위 46d5088b
하위 93b75429

함의성이(가) 약 4년 전에 추가함

isseu #000: fix line no load, hmb case on going

Change-Id: Idb55f6801827af89a31f4999d96e11f2fb1b41b3

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
2716 2716
                """up to here"""
2717 2717

  
2718 2718
                for stream_line in stream_line_list[1]:
2719
                    sql = f"insert into HMB_From_To(UID,[Drawing_UID],[From_Component_UID],[To_Component_UID],[Stream_No]) values" \
2720
                          f"(?,?,?,?,?)"
2721
                    params = (str(uuid.uuid4()), stream_line[0], stream_line[1], stream_line[2], stream_line[3])
2719
                    sql = f"insert into HMB_From_To(UID,[Drawing_UID],[From_Component_UID],[To_Component_UID],[Stream_No],[Case]) values" \
2720
                          f"(?,?,?,?,?,?)"
2721
                    params = (str(uuid.uuid4()), stream_line[0], stream_line[1], stream_line[2], stream_line[3], stream_line[4])
2722 2722
                    cursor.execute(sql, params)
2723 2723
            except Exception as ex:
2724 2724
                # Roll back any change if something goes wrong
......
2788 2788
                cursor = conn.cursor()
2789 2789

  
2790 2790
                if stream_no:
2791
                    sql = f"select h.Drawing_UID, h.From_Component_UID, h.To_Component_UID, d.Name from HMB_From_To h " \
2791
                    sql = f"select h.Drawing_UID, h.From_Component_UID, h.To_Component_UID, d.Name, h.[Case] from HMB_From_To h " \
2792 2792
                          f"inner join Drawings d on d.UID=h.Drawing_UID " \
2793 2793
                          f"where Stream_No = ?"
2794 2794
                    params = (stream_no,)
2795 2795
                else:
2796
                    sql = f"select h.From_Component_UID, h.To_Component_UID, s.Stream_No from HMB_From_To h " \
2796
                    sql = f"select h.From_Component_UID, h.To_Component_UID, s.Stream_No, h.[Case] from HMB_From_To h " \
2797 2797
                          f"inner join Stream_No s on s.Stream_No=h.Stream_No " \
2798 2798
                          f"where Drawing_UID = ?"
2799 2799
                    params = (drawing_uid,)
DTI_PID/DTI_PID/HMBDialog.py
66 66
                self.ui.buttonBox.button(QDialogButtonBox.Ok).setText(self.tr('Save'))
67 67

  
68 68
            self.ui.toolButtonHMBFilePath.clicked.connect(self.on_open_hmb_file)
69
            self.ui.pushButtonAdd.clicked.connect(self.add_stream_no)
70
            self.ui.pushButtonDelete.clicked.connect(self.delete_stream_no)
69 71
        except Exception as ex:
70 72
            from App import App
71 73
            from AppDocData import MessageType
......
74 76
                      f"{sys.exc_info()[-1].tb_lineno}"
75 77
            App.mainWnd().addMessage.emit(MessageType.Error, message)
76 78

  
79
    def add_stream_no(self):
80
        from StreamNoAddDialog import QStreamNoAddDialog
81

  
82
        if self.hmbs:
83
            stream_nos = [hmb.stream_no for hmb in self.hmbs]
84
            dlg = QStreamNoAddDialog(self, stream_nos)
85
            if QDialog.Accepted == dlg.exec_():
86
                new_stream_no = dlg.stream_no
87

  
88
    def delete_stream_no(self):
89
        pass
90

  
77 91
    def dataChanged(self, *args):
78 92
        """ when cell data change update hmb data"""
79 93
        try:
DTI_PID/DTI_PID/HMB_UI.py
30 30
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Ok)
31 31
        self.buttonBox.setCenterButtons(False)
32 32
        self.buttonBox.setObjectName("buttonBox")
33
        self.gridLayout_2.addWidget(self.buttonBox, 0, 1, 1, 1)
33
        self.gridLayout_2.addWidget(self.buttonBox, 0, 3, 1, 1)
34
        self.pushButtonAdd = QtWidgets.QPushButton(HMBDialog)
35
        self.pushButtonAdd.setObjectName("pushButtonAdd")
36
        self.gridLayout_2.addWidget(self.pushButtonAdd, 0, 1, 1, 1)
37
        self.pushButtonDelete = QtWidgets.QPushButton(HMBDialog)
38
        self.pushButtonDelete.setObjectName("pushButtonDelete")
39
        self.gridLayout_2.addWidget(self.pushButtonDelete, 0, 2, 1, 1)
34 40
        self.gridLayout.addLayout(self.gridLayout_2, 4, 0, 1, 1)
35 41
        self.gridLayout_5 = QtWidgets.QGridLayout()
36 42
        self.gridLayout_5.setObjectName("gridLayout_5")
......
98 104
    def retranslateUi(self, HMBDialog):
99 105
        _translate = QtCore.QCoreApplication.translate
100 106
        HMBDialog.setWindowTitle(_translate("HMBDialog", "HMB"))
107
        self.pushButtonAdd.setText(_translate("HMBDialog", "Add Stream No"))
108
        self.pushButtonDelete.setText(_translate("HMBDialog", "Delete Stream No"))
101 109
        self.label.setText(_translate("HMBDialog", "Liquid Phase Keyword : "))
102 110
        self.label_5.setText(_translate("HMBDialog", "Composition Keyword : "))
103 111
        self.label_4.setText(_translate("HMBDialog", "Import HMB : "))
DTI_PID/DTI_PID/MainWindow.py
2592 2592
                    assocs = match.associations()
2593 2593
                    for assoc in assocs:
2594 2594
                        if item is assoc:
2595
                            for attr in match.attrs.keys():
2595
                            keys = match.attrs.keys()
2596
                            for attr in keys:
2596 2597
                                if attr.AssocItem and str(item.uid) == str(attr.AssocItem.uid):
2597 2598
                                    attr.AssocItem = None
2598 2599
                                    match.attrs[attr] = ''
DTI_PID/DTI_PID/Scripts/MSSQL/ID2.sql
3246 3246
	[From_Component_UID] VARCHAR ( 37 ), 
3247 3247
	[To_Component_UID] VARCHAR ( 37 ), 
3248 3248
	[Stream_No] VARCHAR ( 100 ), 
3249
	[Case] VARCHAR ( 100 ), 
3249 3250
	FOREIGN KEY([From_Component_UID]) REFERENCES [Components]([UID]) ON DELETE CASCADE, 
3250 3251
	FOREIGN KEY([Drawing_UID]) REFERENCES [Drawings]([UID]) ON DELETE CASCADE, 
3251 3252
	PRIMARY KEY([UID]), 
......
3284 3285
	[From]	VARCHAR ( 100 ),
3285 3286
	[To]	VARCHAR ( 100 ),
3286 3287
	[Stream_No]	VARCHAR ( 100 ),
3288
	[Case]	VARCHAR ( 100 ),
3287 3289
	[Index]	INTEGER,
3288 3290
	FOREIGN KEY([Drawing_UID]) REFERENCES [Drawings]([UID]) ON DELETE CASCADE,
3289 3291
	PRIMARY KEY([UID])
DTI_PID/DTI_PID/Scripts/SQLite_Project.tables.sql
88 88
	`From_Component_UID` VARCHAR ( 37 ), 
89 89
	`To_Component_UID` VARCHAR ( 37 ), 
90 90
	`Stream_No` VARCHAR ( 100 ), 
91
	`Case` VARCHAR ( 100 ), 
91 92
	FOREIGN KEY(`From_Component_UID`) REFERENCES `Components`(`UID`) ON DELETE CASCADE, 
92 93
	FOREIGN KEY(`Drawing_UID`) REFERENCES `Drawings`(`UID`) ON DELETE CASCADE, 
93 94
	PRIMARY KEY(`UID`), 
......
127 128
	`From`	VARCHAR ( 100 ),
128 129
	`To`	VARCHAR ( 100 ),
129 130
	`Stream_No`	VARCHAR ( 100 ),
131
	`Case`	VARCHAR ( 100 ),
130 132
	`Index`	INTEGER,
131 133
	FOREIGN KEY(`Drawing_UID`) REFERENCES `Drawings`(`UID`) ON DELETE CASCADE,
132 134
	PRIMARY KEY(`UID`)
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py
409 409
                    if matches:
410 410
                        item._properties[matches[0]] = matches[0].parse_value(prop_node.text)
411 411

  
412
                for attr_node in node.iter('ATTRIBUTE'):
412
                for attr_node in node.iterfind('ATTRIBUTE'):
413 413
                    attr = SymbolAttr.fromXml(attr_node)
414 414
                    item.attrs[attr] = attr_node.text
415 415

  
DTI_PID/DTI_PID/StreamNoAddDialog.py
1
# coding: utf-8
2
""" This is validation dialog module """
3

  
4
import os
5
import sys
6
from PyQt5.QtCore import *
7
from PyQt5.QtGui import *
8
from PyQt5.QtWidgets import *
9
from AppDocData import AppDocData, MessageType
10

  
11
import StreamNoAddDialog_UI
12

  
13

  
14
class QStreamNoAddDialog(QDialog):
15
    """ This Training Algorithm dialog class """
16

  
17
    def __init__(self, parent, stream_nos):
18
        QDialog.__init__(self, parent)
19

  
20
        self.ui = StreamNoAddDialog_UI.Ui_StreamNoAddDialog()
21
        self.ui.setupUi(self)
22

  
23
        self.stream_nos = stream_nos
24
        self.stream_no = ''
25

  
26
        #self.ui.buttonBox.bu.clicked.connect(self.accept)
27
        #self.ui.pushButtonClose.clicked.connect(self.reject)
28

  
29
    def accept(self):
30
        self.stream_no = self.ui.lineEditStreamNo.text()
31
        if self.stream_no and self.stream_no not in self.stream_nos:
32
            QDialog.accept(self)
33
        else:
34
            QMessageBox.about(self, self.tr("Notice"), self.tr('Please check Stream No.'))
35

  
36
    def reject(self):
37
        QDialog.reject(self)
DTI_PID/DTI_PID/StreamNoAddDialog_UI.py
1
# -*- coding: utf-8 -*-
2

  
3
# Form implementation generated from reading ui file './UI/StreamNoAddDialog.ui'
4
#
5
# Created by: PyQt5 UI code generator 5.11.3
6
#
7
# WARNING! All changes made in this file will be lost!
8

  
9
from PyQt5 import QtCore, QtGui, QtWidgets
10

  
11
class Ui_StreamNoAddDialog(object):
12
    def setupUi(self, StreamNoAddDialog):
13
        StreamNoAddDialog.setObjectName("StreamNoAddDialog")
14
        StreamNoAddDialog.resize(314, 96)
15
        icon = QtGui.QIcon()
16
        icon.addPixmap(QtGui.QPixmap(":/newPrefix/ID2.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
17
        StreamNoAddDialog.setWindowIcon(icon)
18
        StreamNoAddDialog.setSizeGripEnabled(True)
19
        self.gridLayout_2 = QtWidgets.QGridLayout(StreamNoAddDialog)
20
        self.gridLayout_2.setObjectName("gridLayout_2")
21
        self.gridLayout = QtWidgets.QGridLayout()
22
        self.gridLayout.setObjectName("gridLayout")
23
        self.label = QtWidgets.QLabel(StreamNoAddDialog)
24
        self.label.setObjectName("label")
25
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
26
        self.lineEditStreamNo = QtWidgets.QLineEdit(StreamNoAddDialog)
27
        self.lineEditStreamNo.setObjectName("lineEditStreamNo")
28
        self.gridLayout.addWidget(self.lineEditStreamNo, 0, 1, 1, 1)
29
        self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
30
        self.buttonBox = QtWidgets.QDialogButtonBox(StreamNoAddDialog)
31
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
32
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
33
        self.buttonBox.setObjectName("buttonBox")
34
        self.gridLayout_2.addWidget(self.buttonBox, 1, 0, 1, 1)
35

  
36
        self.retranslateUi(StreamNoAddDialog)
37
        self.buttonBox.accepted.connect(StreamNoAddDialog.accept)
38
        self.buttonBox.rejected.connect(StreamNoAddDialog.reject)
39
        QtCore.QMetaObject.connectSlotsByName(StreamNoAddDialog)
40

  
41
    def retranslateUi(self, StreamNoAddDialog):
42
        _translate = QtCore.QCoreApplication.translate
43
        StreamNoAddDialog.setWindowTitle(_translate("StreamNoAddDialog", "Add Stream No"))
44
        self.label.setText(_translate("StreamNoAddDialog", "Stream No : "))
45

  
46
import MainWindow_rc
47

  
48
if __name__ == "__main__":
49
    import sys
50
    app = QtWidgets.QApplication(sys.argv)
51
    StreamNoAddDialog = QtWidgets.QDialog()
52
    ui = Ui_StreamNoAddDialog()
53
    ui.setupUi(StreamNoAddDialog)
54
    StreamNoAddDialog.show()
55
    sys.exit(app.exec_())
56

  
DTI_PID/DTI_PID/StreamlineDialog.py
178 178
                    for row_ in rows:
179 179
                        from_ = row_['From_Component_UID']
180 180
                        from_item = QStandardItem(from_)
181
                        from_item.setData(row_['From_Component_UID'], Qt.UserRole)
181
                        from_item.setData(from_, Qt.UserRole)
182 182

  
183 183
                        to_ = row_['To_Component_UID']
184 184
                        to_item = QStandardItem(to_)
185
                        to_item.setData(row_['To_Component_UID'], Qt.UserRole)
185
                        to_item.setData(to_, Qt.UserRole)
186 186

  
187 187
                        drawing = row_['Name']
188 188
                        drawing_item = QStandardItem(drawing)
189 189
                        drawing_item.setData(row_['Drawing_UID'], Qt.UserRole)
190 190

  
191
                        items = [drawing_item, from_item, to_item]
191
                        case = row_['Case'] if row_['Case'] else ''
192
                        case_item = QStandardItem(case)
193
                        case_item.setData(case, Qt.UserRole)
194

  
195
                        items = [drawing_item, from_item, to_item, case_item]
192 196
                        model.appendRow(items)
193 197

  
194
                model.setHorizontalHeaderLabels(['Drawing No', 'From', 'To'])
198
                model.setHorizontalHeaderLabels(['Drawing No', 'From', 'To', 'Case'])
195 199
            else:
196 200
                model = self._from_to_models[stream_no]
197 201

  
......
203 207
                i = self.ui.tableViewFromTo.model().index(row_, 1)
204 208
                data = self.ui.tableViewFromTo.model().data(i, Qt.DisplayRole)
205 209
                from_button = FromToWidget(self.ui.tableViewFromTo, 1, data)
206
                i = self.ui.tableViewFromTo.model().index(row_, 1)
207 210
                self.ui.tableViewFromTo.setIndexWidget(i, from_button)
208 211
                self._from_to_widgets[from_button] = (row_, 1)
209 212

  
......
328 331
                from_uid = from_.data(Qt.UserRole)
329 332
                to_ = model.item(row, 2)
330 333
                to_uid = to_.data(Qt.UserRole)
334
                case_ = model.item(row, 3)
335
                case_ = case_.data(Qt.UserRole)
331 336

  
332 337
                if hasattr(drawing_, '_new') and drawing_._new:
333 338
                    drawing_._new = False
......
335 340
                    from_._new = False
336 341
                if hasattr(to_, '_new') and to_._new:
337 342
                    to_._new = False
343
                if hasattr(case_, '_new') and case_._new:
344
                    case_._new = False
338 345

  
339
                from_to_data.append((drawing_uid, from_uid, to_uid, stream_no))
346
                from_to_data.append((drawing_uid, from_uid, to_uid, stream_no, case_))
340 347

  
341 348
            AppDocData.save_stream_line_data([stream_no, from_to_data])
342 349

  
DTI_PID/DTI_PID/UI/HMB.ui
28 28
     <item row="0" column="0">
29 29
      <layout class="QHBoxLayout" name="horizontalLayoutSpinnerWaiting"/>
30 30
     </item>
31
     <item row="0" column="1">
31
     <item row="0" column="3">
32 32
      <widget class="QDialogButtonBox" name="buttonBox">
33 33
       <property name="orientation">
34 34
        <enum>Qt::Horizontal</enum>
......
41 41
       </property>
42 42
      </widget>
43 43
     </item>
44
     <item row="0" column="1">
45
      <widget class="QPushButton" name="pushButtonAdd">
46
       <property name="text">
47
        <string>Add Stream No</string>
48
       </property>
49
      </widget>
50
     </item>
51
     <item row="0" column="2">
52
      <widget class="QPushButton" name="pushButtonDelete">
53
       <property name="text">
54
        <string>Delete Stream No</string>
55
       </property>
56
      </widget>
57
     </item>
44 58
    </layout>
45 59
   </item>
46 60
   <item row="0" column="0">
DTI_PID/DTI_PID/UI/StreamNoAddDialog.ui
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ui version="4.0">
3
 <class>StreamNoAddDialog</class>
4
 <widget class="QDialog" name="StreamNoAddDialog">
5
  <property name="geometry">
6
   <rect>
7
    <x>0</x>
8
    <y>0</y>
9
    <width>314</width>
10
    <height>96</height>
11
   </rect>
12
  </property>
13
  <property name="windowTitle">
14
   <string>Add Stream No</string>
15
  </property>
16
  <property name="windowIcon">
17
   <iconset resource="../res/MainWindow.qrc">
18
    <normaloff>:/newPrefix/ID2.png</normaloff>:/newPrefix/ID2.png</iconset>
19
  </property>
20
  <property name="sizeGripEnabled">
21
   <bool>true</bool>
22
  </property>
23
  <layout class="QGridLayout" name="gridLayout_2">
24
   <item row="0" column="0">
25
    <layout class="QGridLayout" name="gridLayout">
26
     <item row="0" column="0">
27
      <widget class="QLabel" name="label">
28
       <property name="text">
29
        <string>Stream No : </string>
30
       </property>
31
      </widget>
32
     </item>
33
     <item row="0" column="1">
34
      <widget class="QLineEdit" name="lineEditStreamNo"/>
35
     </item>
36
    </layout>
37
   </item>
38
   <item row="1" column="0">
39
    <widget class="QDialogButtonBox" name="buttonBox">
40
     <property name="orientation">
41
      <enum>Qt::Horizontal</enum>
42
     </property>
43
     <property name="standardButtons">
44
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
45
     </property>
46
    </widget>
47
   </item>
48
  </layout>
49
 </widget>
50
 <resources>
51
  <include location="../res/MainWindow.qrc"/>
52
 </resources>
53
 <connections>
54
  <connection>
55
   <sender>buttonBox</sender>
56
   <signal>accepted()</signal>
57
   <receiver>StreamNoAddDialog</receiver>
58
   <slot>accept()</slot>
59
   <hints>
60
    <hint type="sourcelabel">
61
     <x>248</x>
62
     <y>254</y>
63
    </hint>
64
    <hint type="destinationlabel">
65
     <x>157</x>
66
     <y>274</y>
67
    </hint>
68
   </hints>
69
  </connection>
70
  <connection>
71
   <sender>buttonBox</sender>
72
   <signal>rejected()</signal>
73
   <receiver>StreamNoAddDialog</receiver>
74
   <slot>reject()</slot>
75
   <hints>
76
    <hint type="sourcelabel">
77
     <x>316</x>
78
     <y>260</y>
79
    </hint>
80
    <hint type="destinationlabel">
81
     <x>286</x>
82
     <y>274</y>
83
    </hint>
84
   </hints>
85
  </connection>
86
 </connections>
87
</ui>

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)