fix(materials): changes for consuming peices vs units

This commit is contained in:
2025-09-18 11:00:54 -05:00
parent c892348d19
commit 99b3ad633c

View File

@@ -52,7 +52,7 @@ MaterialHumanReadableId
,x.EffectiveConsumption as consumption -- this is how much was consummed via cmd 112 ,x.EffectiveConsumption as consumption -- this is how much was consummed via cmd 112
,x.TotalDemand as totalDemand -- the total demand needed to finish the lot out ,x.TotalDemand as totalDemand -- the total demand needed to finish the lot out
,case when cp.Pieces >= 0.001 then (lot.TotalProducedQuantity+1) * cp.Pieces else ,case when cp.Pieces >= 0.001 then (lot.TotalProducedLoadingUnits+1) * cp.Pieces else
(a.Weight *((case when cp.Percentage is null then 80 else cp.Percentage end) / 100) * ((lot.TotalProducedLoadingUnits+1) * p.LoadingUnitPieces)) / 1000 end totalNeeded (a.Weight *((case when cp.Percentage is null then 80 else cp.Percentage end) / 100) * ((lot.TotalProducedLoadingUnits+1) * p.LoadingUnitPieces)) / 1000 end totalNeeded
,case when IsMainMaterial = 1 then ,case when IsMainMaterial = 1 then
@@ -134,8 +134,7 @@ group by IdArtikelVarianten,ArtikelVariantenBez
) as l on ) as l on
l.IdArtikelVarianten = MaterialHumanReadableId l.IdArtikelVarianten = MaterialHumanReadableId
where lot.ProductionLotHumanReadableId = @lot and where lot.ProductionLotHumanReadableId = @lot and MaterialDescription not like '%nopal%'
MaterialDescription NOT LIKE '%nopal%'
and MaterialDescription NOT LIKE '%bb%' and MaterialDescription NOT LIKE '%bb%'
and MaterialDescription NOT LIKE '%mcg%' and MaterialDescription NOT LIKE '%mcg%'
`; `;