프로젝트

일반

사용자정보

개정판 2ea34fba

ID2ea34fba05a83bb860f550d11cb32b3f4b5cdd59
상위 cff52b1c
하위 5cc60caa

함의성이(가) 2년 이상 전에 추가함

add run data check step, OPCRelationDialog

Change-Id: I23690976d2948d23da0e6e0e8f2ccfb6238e5308

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
3033 3033
                                                              sys.exc_info()[-1].tb_lineno)
3034 3034
                App.mainWnd().addMessage.emit(MessageType.Error, message)
3035 3035

  
3036
    def check_runs(self):
3037
        """ check run item duplication """
3038

  
3039
        with self.project.database.connect() as conn:
3040
            try:
3041
                # Get a cursor object
3042
                cursor = conn.cursor()
3043

  
3044
                sql = "select [Components_UID], count([Components_UID]) as count from [PipeRunItems] " \
3045
                      "group by [Components_UID] having count([Components_UID]) > 1"
3046

  
3047
                cursor.execute(sql)
3048

  
3049
                rows = cursor.fetchall()
3050

  
3051
                items = []
3052
                if rows:
3053
                    for row in rows:
3054
                        sql = "select c.[UID], d.[Name] from [Components] c inner join [Drawings] d on c.Drawings_UID=d.[UID]" \
3055
                              "where c.[UID]='" + row["Components_UID"] + "'"
3056
                        cursor.execute(sql)
3057

  
3058
                        _rows = cursor.fetchall()
3059
                        if _rows:
3060
                            items = items + _rows
3061

  
3062
                return items
3063
                # Catch the exception
3064
            except Exception as ex:
3065
                from App import App
3066
                message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
3067
                                                              sys.exc_info()[-1].tb_lineno)
3068
                App.mainWnd().addMessage.emit(MessageType.Error, message)
3069

  
3036 3070
    def get_opcs(self):
3037 3071
        """ get opc in project """
3038 3072
        configs = self.getConfigs('PSN', 'Symbols')
DTI_PID/DTI_PID/OPCRelationDialog.py
49 49
        self.ui.tableWidgetSource.currentItemChanged.connect(self.on_source_opc_changed)
50 50

  
51 51
        app_doc_data = AppDocData.instance()
52

  
53
        error_items = app_doc_data.check_runs()
54
        if error_items:
55
            self.error = True
56
            msg = ""
57
            for error_item in error_items:
58
                msg += 'UID : ' + error_item["UID"] + '\nDrawing : ' + error_item["Name"] + ',\n'
59
            QMessageBox.warning(self, self.tr('Warning'), 'Please check following items.\n' + msg)
60
            return
61

  
52 62
        self._opcs = app_doc_data.get_opcs()
53 63
        if not self._opcs:
54 64
            self._opcs = []

내보내기 Unified diff

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