fix(materials): more fixes to try and please all plants to use this version and not call me

This commit is contained in:
2025-09-09 21:20:23 -05:00
parent 99ecf52218
commit 00899a5b77
4 changed files with 129 additions and 61 deletions

View File

@@ -23,7 +23,7 @@
export const mmQuery = `
use [test1_AlplaPROD2.0_Read]
declare @lot as NVARCHAR(max) = [lotNumber]
declare @lot as NVARCHAR(max) = [lotNumber]
/*
checks all needed material including pkg
@@ -63,9 +63,12 @@ MaterialHumanReadableId
then 'mmGood'
else 'noMM' end else null end as noMMShortage
-- pkg check
-- pkg check auto
,case when pkg.QuantityPosition is null then null else
(case when l.qty > ((lot.TotalProducedLoadingUnits+1) * pkg.QuantityPosition) then 'pkgGood' else 'noPkg' end) end as noPKGShortage
(case when l.qty > ((lot.TotalProducedLoadingUnits+1) * pkg.QuantityPosition) and IsManualProcess = 0 then 'pkgAutoGood' else 'noAutoPkg' end) end as noPKGAutoShortage
-- plg check manual
,case when pkg.QuantityPosition is null then null else
(case when x.EffectiveConsumption > ((lot.TotalProducedLoadingUnits+1) * pkg.QuantityPosition) and IsManualProcess = 1 then 'pkgManGood' else 'noManPkg' end) end as noPKGManualShortage
-- manualMateiral
,case when IsMainMaterial = 0 and IsManualProcess = 1 then
case when (case when x.ProvidedAmount <> 0
@@ -131,5 +134,5 @@ group by IdArtikelVarianten,ArtikelVariantenBez
) as l on
l.IdArtikelVarianten = MaterialHumanReadableId
where lot.ProductionLotHumanReadableId = @lot
where lot.ProductionLotHumanReadableId = @lot and MaterialDescription not like '%nopal%'
`;