From 8d6de2178a5c7eb87c41ff93c4a69f8b70282ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A5=98=ED=98=B8=EC=84=B1?= Date: Wed, 24 Jun 2026 20:25:30 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BF=BC=EB=A6=AC=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...260622_접수없이결재완료건_접수상태로수정.sql | 40 ++++++++++++++++++ 쿼리/Template/청구수량과발주수량차이조회.sql | 41 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 쿼리/2026/06/20260622_접수없이결재완료건_접수상태로수정.sql create mode 100644 쿼리/Template/청구수량과발주수량차이조회.sql diff --git a/쿼리/2026/06/20260622_접수없이결재완료건_접수상태로수정.sql b/쿼리/2026/06/20260622_접수없이결재완료건_접수상태로수정.sql new file mode 100644 index 0000000..6d13850 --- /dev/null +++ b/쿼리/2026/06/20260622_접수없이결재완료건_접수상태로수정.sql @@ -0,0 +1,40 @@ +-- ========================================== +-- 작업일자: 2026-06-22 +-- 작 성 자: 류호성 +-- 작업목적: [전자결재완료건을 결재상태를 접수상태로 수정하여 검토부서로 결재 상신 가능한 상태로 수정한다.] +-- 요청자/티켓번호: [전미현과장 / 요청번호 5953번] +-- 데이타베이스 : MY-SQL +-- ========================================== + +-- [0] 결재정보에서 해당 전표번호로 조회하여 RT_Sanction(결재라인설정), RT_SanctionState(결재상태) 내용 확인하기 +SELECT * FROM sanctiondoc_tbl WHERE detail2 LIKE '20260530-XE48-0002%' + +-- [1] 결재진행상태 정보에서 해당 문서번호로 조회하여 결재상태 확인하기 +SELECT * FROM sanctionstate_tbl WHERE docsn = '2026-11633-HF02560' + +-- [2] 결재정보에서 RT_Sanction(결재라인설정), RT_SanctionState(결재상태)를 접수(RECEIVE) 가능한 상태로 수정하기 +/* +START TRANSACTION; + +UPDATE + sanctiondoc_tbl +SET + RT_Sanction = SUBSTRING(RT_Sanction, 1, INSTR(RT_Sanction,'RECEIVE')+6) + , RT_SanctionState = REPLACE(RT_SanctionState, '11:FINISH', '6:RECEIVE') +WHERE + docsn = '2026-11633-HF02560'; + +-- 결과가 올바르다면 반영, 잘못되었다면 되돌리기(ROLLBACK) +-- COMMIT; +-- ROLLBACK; +*/ + +-- [3] 결재상태정보에서 생성된 RECEIVE 행 삭제 - 참고)하위의 진행된 내역이 있으면 내용 검토 후 별도 조치해야 함. +-- SELECT * FROM sanctionstate_tbl WHERE docsn = '2026-11633-HF02560' AND SanctionState = 'RECEIVE' +/* +DELETE FROM + sanctionstate_tbl +WHERE + docsn = '2026-11633-HF02560' AND SanctionState = 'RECEIVE'; +*/ + diff --git a/쿼리/Template/청구수량과발주수량차이조회.sql b/쿼리/Template/청구수량과발주수량차이조회.sql new file mode 100644 index 0000000..7fc9989 --- /dev/null +++ b/쿼리/Template/청구수량과발주수량차이조회.sql @@ -0,0 +1,41 @@ +-- ========================================== +-- 작업일자: YYYY-MM-DD [쿼리 작성 및 실행 날짜를 기록합니다.] +-- 작 성 자: [실행자 이름을 기록합니다.] +-- 작업목적: [발주의뢰서 수량과 구매발주서 수량이 다른 것 조회하여 실무자에게 엑셀파일로 제공하여 수정하게 합니다.] +-- 요청자/티켓번호: [현업 혹은 매일 점검으로 자료 제공합니다.] +-- 데이타베이스 : MS-SQL +-- ========================================== + +-- 발주의뢰서 수량과 구매발주서 수량이 다른 것 조회하기 +select + '발주의뢰서 수량과 구매발주서 수량이 다른 것', a.por_no, a.por_seq, a.pjt_no, a.main, a.sub, a.bud_seq, a.item_name, a.qty, a.w_amt, b.qty, b.w_amt, (select emp from HPOIMS.dbo.gm_poim where poim = c.poim) emp_id +from + HPOIMS.dbo.gm_por_detail a +join +( + select + por_no, por_seq, sum(qty) qty, sum(w_amt) w_amt + from + HPOIMS.dbo.gm_po_detail + where + isnull(u_stat, '') <> 'D' + group by + por_no, por_seq +) b +on + a.por_no = b.por_no + and a.por_seq = b.por_seq +join +( + select distinct b.por_no, b.por_seq, a.poim from HPOIMS.dbo.gm_po a join HPOIMS.dbo.gm_po_detail b on a.po_no = b.po_no +) c +on + a.por_no = c.por_no + and a.por_seq = c.por_seq +where + a.pjt_no like 'V%' + and a.pjt_no in (select pjt_no from HPOIMS.dbo.ys_project where closing_yn = 'N' and pjt_no like 'V%') + and a.qty < b.qty +-- and a.qty <> b.qty +order by + a.por_no \ No newline at end of file