feat(lstv2 move): moved lstv2 into this app to keep them combined and easier to maintain

This commit is contained in:
2025-09-19 22:22:05 -05:00
parent caf2315191
commit e4477402ad
847 changed files with 165801 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
export const notconnectedToMachine = `
select distinct HumanReadableId as machineId
,Location as location
,name
--,[SiloHumanReadableId]
from [test1_AlplaPROD2.0_Read].[masterData].[Machine] (nolock) m
left join
[test1_AlplaPROD2.0_Read].[issueMaterial].[SiloAssignment] (nolock) s
on s.MachineId = m.id
where m.id not in (
SELECT
[MachineId]
FROM [test1_AlplaPROD2.0_Read].[issueMaterial].[SiloAssignment]
where [SiloHumanReadableId] = [siloID]
)
and name not like '%REWORK%'
`;
export const connectedToMachine = `
SELECT
[SiloHumanReadableId]
,[SiloDescription]
,[MaterialHumanReadableId]
,[MaterialDescription]
,[ConnectionDate]
,m.HumanReadableId as machineId
,m.Location as location
,m.Name as name
FROM [test1_AlplaPROD2.0_Read].[issueMaterial].[SiloAssignment] s
left join
[test1_AlplaPROD2.0_Read].[masterData].[Machine] m
on m.id = s.MachineId
where [SiloHumanReadableId] = [siloID]
`;

View File

@@ -0,0 +1,32 @@
export const siloQuery = `
SELECT
V_LagerAbteilungen.Bezeichnung AS Description,
V_LagerAbteilungen.IdWarenLager AS WarehouseID,
V_LagerAbteilungen.IdLagerAbteilung AS LocationID,
case when ROUND(SUM(einlagerungsmengesum), 2) is null then 0 else ROUND(SUM(einlagerungsmengesum), 2) end AS Stock_Total
,case when ROUND(SUM(einlagerungsmengesum), 2) is null then COALESCE(b.upd_Date, '1900-01-01') else COALESCE(LastAdjustment, '1900-01-01') end AS LastAdjustment
FROM AlplaPROD_test1.dbo.V_LagerAbteilungen (NOLOCK)
left JOIN
AlplaPROD_test1.dbo.V_LagerPositionenBarcodes ON
AlplaPROD_test1.dbo.V_LagerAbteilungen.IdLagerAbteilung =
AlplaPROD_test1.dbo.V_LagerPositionenBarcodes.IdLagerAbteilung
LEFT JOIN (
SELECT
IdLagerAbteilung,
MAX(CASE WHEN CONVERT(CHAR(10), Buchungsdatum, 120) IS NULL THEN '1900-01-01' ELSE CONVERT(CHAR(10), Buchungsdatum, 120) END) AS LastAdjustment
FROM AlplaPROD_test1.dbo.V_LagerBuchungen (NOLOCK)
WHERE urheber = 2900
GROUP BY IdLagerAbteilung
) AS LastAdj ON AlplaPROD_test1.dbo.V_LagerAbteilungen.IdLagerAbteilung = LastAdj.IdLagerAbteilung
/* add the actual inventory now that we will display an empty silo and need to add this date */
left join
AlplaPROD_test1.dbo.V_LagerAbteilungenInventuren as b on
AlplaPROD_test1.dbo.V_LagerAbteilungen.IdLagerAbteilung = b.IdLagerAbteilung
WHERE materialsilo = 1
AND aktiv = 1
GROUP BY V_LagerAbteilungen.Bezeichnung, V_LagerAbteilungen.IdWarenLager, V_LagerAbteilungen.IdLagerAbteilung, LastAdjustment, b.upd_Date
ORDER BY V_LagerAbteilungen.Bezeichnung
`;