From 4e55415475e14158227f1fed7f60096b1e547337 Mon Sep 17 00:00:00 2001 From: bleeson Date: Thu, 22 May 2025 09:26:55 -0700 Subject: [PATCH] Fix to SQL mapping on S lines of receipts. --- import_944s.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/import_944s.py b/import_944s.py index cd6d771..617d8ac 100644 --- a/import_944s.py +++ b/import_944s.py @@ -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 """