DB 경로

DB_CONFIG = { "host": "100.105.75.47", "port": 5432, "dbname": "postgres", "user": "postgres", "password": "",}

스키마 : d1_machine_log

a. 테이블 : FCT1_machine_log, FCT2_machine_log, FCT3_machine_log, FCT4_machine_log

b. 테이블 : Main_machine_log

c. 테이블 : Vision1_machine_log, Vision2_machine_log

스키마 : b1_sparepart_usage

e.테이블 : after_sparepart_contents

스키마 : a2_fct_vision_testlog_json_processing

f.테이블 : fct_vision_testlog_json_processing


목적 : 조립 불량에 낭비되는 시간을 구할 것

  1. 조립 불량 소요 시간 출력

    1) a.테이블들을 컬럼 time의 속성값 오름차순으로 정렬
    

2)a.테이블 별 컬럼 station을 추가하여 FCT1~4로 나눌 것

  1. a.테이블의 contents : 제품 감지 NG 에 해당하는 행

→ 다른 contents의 속성값없이 연속일 경우 제일 첫번째 데이터 기준

→ contents : Manual mode 전환 과 contents : Auto mode 전환 이 포함된 행사이에 있는 경우 제외

→ 새로운 컬럼 from_contents에 제품 감지 NG 를 넣을 것

→ 새로운 컬럼 from_time에 컬럼 time의 속성값을 넣을 것

→ from_dorn과 to_dorn을 추가하여 해당 컬럼 dayornight의 속성값을 가지고 올 것

  1. 3번 조건에 해당하는 행 시간 순서로 그 이후로 a.테이블의 contents : 제품 검사 투입 요구 OFF 에 해당하는 행

→ 새로운 컬럼 to_contents에 제품 검사 투입 요구 OFF 를 넣을 것

5)컬럼 from_time, to_time의 시간차를 새로운 wasted_time을 추가하여 속성값으로 넣을 것

  1. 첨부파일과 같이 출력될 것

id end_day station from_contents from_time to_contents to_time wasted_time
1 20251014 FCT1 제품 감지 NG 11:06:30 제품 검사 투입 요구 OFF 11:07:00 1.00
2 20251014 FCT2
3 20251014 FCT3 ..

※ from_time, to_time의 속성값은 hh:mm:ss.ss 형태로 소수점 둘째까지 나타낼 것 - 첨부파일참조 from_time, to_time의 속성값은 hh:mm:ss.ss 형태 from_time의 속성값과 to_time의 속성값을 빼서 wasted_time의 속성값을 넣을때 예시 ) 19:26:54.98 - 19:27:19.48 = -24.50 > 24.50로 들어갈 것

  1. 해당 dataframe 아래의 스키마의 테이블을 생성하여 저장

    스키마 : d1_machine_log

    테이블 : afa_fail_wasted_time