18 lines
602 B
TypeScript
18 lines
602 B
TypeScript
export const mmQuery = `
|
|
SELECT lot.ProductionLotHumanReadableId,
|
|
case when SourcingState in (1, 2) then 1
|
|
when x.ProvidedAmount > 0 then 1
|
|
when x.EffectiveConsumption > 0 then 1
|
|
else 0 end as Staged,
|
|
x.ProvidedAmount as Provided,
|
|
x.EffectiveConsumption as consumption,
|
|
x.IsManualProcess as isManual,
|
|
MaterialHumanReadableId
|
|
FROM [test1_AlplaPROD2.0_Read].[issueMaterial].[MaterialDemand] x (nolock)
|
|
left join
|
|
[test1_AlplaPROD2.0_Read].[issueMaterial].[ProductionLot] as lot on
|
|
x.ProductionLotId = lot.Id
|
|
where lot.ProductionLotHumanReadableId = [lotNumber]
|
|
and IsMainMaterial = 1
|
|
`;
|