Fix to SQL mapping on S lines of receipts.

master
bleeson 2025-05-22 09:26:55 -07:00
parent 30e028609c
commit 4e55415475
1 changed files with 13 additions and 8 deletions

View File

@ -85,15 +85,20 @@ DETAIL_STATEMENT = """
"""
SUBDETAIL_STATEMENT = """
select distinct
[S]
,[sta]
,[pcu]
,[qtypcu]
,[lot]
,[bpslot]
,[sernum]
select
'S' [S],
'A' [sta],
[STJ].[PCU_0] [pcu],
cast(cast(-1*[STJ].[QTYSTU_0] as int) as nvarchar) [qtypcu],
[STJ].[LOT_0] [lot],
'' [bpslot],
'' [sernum]
from [staging].[dbo].[shandex_receipt_details]
left join x3.PROD.STOJOU STJ
on STJ.VCRNUM_0 = [shandex_receipt_details].sdhnum
and STJ.ITMREF_0 = [shandex_receipt_details].itmref
and STJ.LOT_0 = [shandex_receipt_details].lot
and STJ.VCRLIN_0 = [shandex_receipt_details].sddlin
where sdhnum = :sdhnum
and itmref = :itmref
"""