Obsidian/Recognition/Work Related/1.업무메모/2022.01/22.01.25.md

153 lines
4.3 KiB
Markdown

vw_napreq db 구분 추가
select pjt_cd, sum(ioqty) as qty
from imhist
where iogbn = 'O02'
and io_date like '202201%'
and pjt_cd is not null
group by pjt_cd
select *
from imhist
where iogbn = 'O02'
and io_date like '202201%'
and pjt_cd is not null
select *
from imhist
where pjt_cd like 'W02201031082%'
and itnbr = '7211467831ERG P'
select *
from napreq
where jpno like 'W02201031082%'
and itnbr = '7211467831ERG P'
select *
from erpman.scm_barcode
where JPNO like 'W02201031082%'
and itnbr = '7211467831ERG P'
union all
select *
from erpman.scm_barcode
where TMP_JPNO like 'W02201031082%'
and itnbr = '7211467831ERG P'
---
sp_create_napreq
---
dw_detail
SELECT "POBLKT"."BALJPNO",
"POBLKT"."BALSEQ",
"POBLKT_HIST"."ITNBR",
"POBLKT_HIST"."SAUPJ",
"ITEMAS"."ITDSC",
"ITEMAS"."ISPEC",
"ITEMAS"."JIJIL" AS JIJIL,
"ITEMAS"."FILSK",
"ITEMAS"."UNMSR",
"ITEMAS"."STDNBR",
"ITEMAS"."GRITU",
"ITEMAS"."DUTYYN",
Fun_Danmst_pumsr( "POBLKT"."ITNBR","POMAST"."CVCOD", "POBLKT"."OPSEQ","POBLKT"."TUNCU", :arg_date) as pumsr,
DECODE("POBLKT"."PSPEC", NULL, '.', "POBLKT"."PSPEC") AS PSPEC,
DECODE("POBLKT"."OPSEQ", NULL, '9999', "POBLKT"."OPSEQ") AS OPSEQ ,
"POBLKT"."BALQTY",
"POBLKT"."BALQTY" as old_balqty,
"POBLKT"."UNPRC",
"POBLKT"."UNPRC" as old_unprc,
"POBLKT"."UNAMT",
"POBLKT"."TUNCU",
"POBLKT"."RCQTY",
"POBLKT"."BFAQTY",
"POBLKT"."BCUQTY",
"POBLKT"."BQCQTY",
"POBLKT"."BIPWQTY",
"POBLKT"."NADAT",
"POBLKT"."NADAT" as old_nadat,
"POBLKT"."BALSTS",
"POBLKT"."BALSTS" AS OLD_BALSTS,
"POBLKT"."LCOQTY",
"POBLKT"."PORDNO",
DECODE(POBLKT_HIST.HEATNO, null, DECODE("POBLKT"."IPDPT", NULL, 'ZD20', "POBLKT"."IPDPT"), POBLKT_HIST.HEATNO) AS "IPDPT",
"POBLKT"."ACCOD",
DECODE("POBLKT"."WAIGB", NULL, 'N',"POBLKT"."WAIGB" ) AS WAIGB,
"POBLKT"."PROJECT_NO",
"POBLKT"."CRT_USER",
"POBLKT"."CRT_DATE",
"POBLKT"."CRT_TIME",
"POBLKT"."UPD_USER",
"POBLKT"."UPD_DATE",
"POBLKT"."UPD_TIME",
fun_get_opdsc("POBLKT_HIST"."ITNBR", "POBLKT_HIST"."SAUPJ", '9999') AS OPDSC,
POBLKT.BALQTY + POBLKT.BFAQTY - ( POBLKT.RCQTY ) AS BALJU,
POBLKT_HIST.NAQTY,
POBLKT_HIST.BPEQTY,
POBLKT_HIST.HEAT_KG AS inwaight,
POBLKT_HIST.LOTNO AS LOTSNO,
POBLKT_HIST.SKIP_YN AS SKIP_YN,
POBLKT.BALGU,
POBLKT_HIST.JPNO,
POBLKT_HIST.NAQTY AS INQTY,
FUN_GET_MAIP_SAUPJ( "POBLKT_HIST"."SAUPJ", "POBLKT_HIST"."CVCOD", "POBLKT_HIST"."ITNBR", '9999' ) AS MAIP_SAUPJ,
0 AS INAMT,
DECODE("POMAST"."CVCOD", NULL, POBLKT_HIST.CVCOD, "POMAST"."CVCOD") AS CVCOD,
Fun_Get_Qcgub("POBLKT_HIST"."ITNBR", "POBLKT_HIST"."CVCOD", '9999') AS QCGUB,
Fun_Danmst_Danga( "POBLKT_HIST"."ITNBR","POBLKT_HIST"."CVCOD",'9999', 'KRW', :arg_date) as ipdanga,
'2' AS YEBI6,
'N' AS CHK,
'Y' AS CHK2,
"ITEMAS"."ITTYP",
"ITEMAS"."BALRATE",
"POBLKT_HIST"."GAGONG_LOTNO" as barcode,
'' AS DIR_DEPOT,
'' AS DIR_DEPOTNM,
decode(POBLKT_HIST.HEAT_KG, 0, 0, POBLKT_HIST.NAQTY / POBLKT_HIST.HEAT_KG) as cnvqty
FROM "POBLKT", "ITEMAS", "POMAST", "POBLKT_HIST"
WHERE "POBLKT_HIST"."PRT_JPNO" = :arg_prtjpno
/* AND "POBLKT_HIST"."STATUS" = '1'
and "POBLKT"."BALSTS" = '1' */
AND "POBLKT_HIST"."BALJPNO" = "POMAST"."BALJPNO"(+)
AND "POBLKT_HIST"."ITNBR" = "ITEMAS"."ITNBR"
AND "POBLKT_HIST"."BALJPNO" = "POBLKT"."BALJPNO"(+)
AND "POBLKT_HIST"."BALSEQ" = "POBLKT"."BALSEQ"(+)
and "POBLKT_HIST"."PRT_JPNO" is not null
and "POBLKT_HIST"."RCQTY" = 0
/* AND "POBLKT"."BALQTY" - ("POBLKT"."BQCQTY" + "POBLKT"."BCUQTY" + "POBLKT"."BPEQTY" + "POBLKT"."CNVENT") > 0 */
ORDER BY "POBLKT_HIST"."JPNO"
---
select b.gritu
, a.itnbr
, b.stdnbr
, b.itdsc
, b.ispec
, b.filsk
, a.lotno
, a.print_qty
, 0 as prc
, Fun_Get_Qcgub(a.itnbr, :ar_cvcod, '9999') AS QCGUB
, a.jpno as jpno
from vw_scm_barcode a, itemas b
where a.itnbr = b.itnbr
and a.dbgbn = :ar_dbgbn
and a.jpno like :ar_jpno