feat(lstv2): added zechetti stuff in so we can print :D

This commit is contained in:
2025-09-25 12:28:45 -05:00
parent e706e78d43
commit 1c40b6aa82
4 changed files with 66 additions and 45 deletions

View File

@@ -55,13 +55,32 @@ MaterialHumanReadableId
,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
,case when IsMainMaterial = 1 then
case when (case when x.ProvidedAmount <> 0
then x.ProvidedAmount else x.EffectiveConsumption end) >
(case when cp.Pieces >= 0.001 then (lot.TotalProducedQuantity+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)
then 'mmGood'
else 'noMM' end else null end as noMMShortage
,CASE
WHEN IsMainMaterial = 1 THEN
CASE
WHEN
(CASE
WHEN x.ProvidedAmount > 0
THEN x.ProvidedAmount
ELSE x.EffectiveConsumption
END)
>
(CASE
WHEN cp.Pieces >= 0.001
THEN (lot.TotalProducedQuantity + 1) * cp.Pieces
ELSE
(a.Weight *
(CASE
WHEN cp.Percentage IS NULL THEN 80
ELSE cp.Percentage
END) / 100
) * (lot.TotalProducedQuantity + 1) / 1000
END)
THEN 'mmGood'
ELSE 'noMM'
END
ELSE NULL
END AS noMMShortage
-- pkg check auto
,case when pkg.QuantityPosition is null then null else