프로젝트

일반

사용자정보

개정판 a346916f

IDa346916fe2d287413c26f7180682ebecce423878
상위 816f941c
하위 77df149e, d695194d

백흠경이(가) 4년 이상 전에 추가함

issue #1489: HMB, Streamline 데이터 로딩 구현

Change-Id: I53276d68346abdf3024386ba5826fb734c015faa

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
2656 2656
                                                               sys.exc_info()[-1].tb_lineno)
2657 2657
                App.mainWnd().addMessage.emit(MessageType.Error, message)
2658 2658

  
2659
    @staticmethod
2660
    def save_stream_line_data(stream_line_list: list):
2661
        import uuid
2662

  
2663
        app_doc_data = AppDocData.instance()
2664
        with app_doc_data.project.database.connect() as conn:
2665
            try:
2666
                cursor = conn.cursor()
2667
                for stream_line in stream_line_list:
2668
                    sql = f"insert into Streamlines(HMB_UID,[From],[To]) values" \
2669
                          f"((select UID from HMB where StreamNumber=?),?,?)"
2670
                    params = (stream_line[0], stream_line[1], stream_line[2])
2671
                    affected = cursor.execute(sql, params)
2672
            except Exception as ex:
2673
                # Roll back any change if something goes wrong
2674
                conn.rollback()
2675

  
2676
                from App import App
2677
                message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
2678
                          f"{sys.exc_info()[-1].tb_lineno}"
2679
                App.mainWnd().addMessage.emit(MessageType.Error, message)
2680

  
2681
    def get_stream_lines(self, hmb_uid: str) -> list:
2682
        """get stream lines related to hmb"""
2683

  
2684
        with self.project.database.connect() as conn:
2685
            try:
2686
                # Get a cursor object
2687
                cursor = conn.cursor()
2688

  
2689
                sql = f"select * from Streamlines where HMB_UID = ?"
2690
                sql = self.project.database.to_sql(sql)
2691
                params = (hmb_uid,)
2692
                cursor.execute(sql, params)
2693
                return cursor.fetchall()
2694
            # Catch the exception
2695
            except Exception as ex:
2696
                # Roll back any change if something goes wrong
2697
                conn.rollback()
2698

  
2699
                from App import App
2700
                message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
2701
                          f"{sys.exc_info()[-1].tb_lineno}"
2702
                App.mainWnd().addMessage.emit(MessageType.Error, message)
2703

  
2659 2704

  
2660 2705
    def saveCustomCodes(self, tables):
2661 2706
        ''' save custom code tables and codes '''

내보내기 Unified diff

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