feat(lstv2 move): moved lstv2 into this app to keep them combined and easier to maintain
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
export const activeWarehouseLanes = `
|
||||
select
|
||||
w.IdWarenLager as warehouseId,
|
||||
w.Bezeichnung as warehouseDescription,
|
||||
IdLagerAbteilung as laneId,
|
||||
b.Bezeichnung as laneDescription
|
||||
--,*
|
||||
from [AlplaPROD_test1].[dbo].[T_LagerAbteilungen] (nolock) b
|
||||
|
||||
left join
|
||||
AlplaPROD_test1.dbo.T_WarenLager (nolock) as w
|
||||
on b.IdWarenLager = w.IdWarenLager
|
||||
|
||||
where b.aktiv = 1 and w.idwarenlager not in (5,6)
|
||||
`;
|
||||
@@ -0,0 +1,80 @@
|
||||
export const cycleCountCheck = `
|
||||
-- Define the structure of the result set from the stored procedure
|
||||
DECLARE @results TABLE (
|
||||
IdLocation INT,
|
||||
LastMoveDate Date
|
||||
|
||||
)
|
||||
-- insert into the temp table
|
||||
insert into @results
|
||||
select IdLagerAbteilung, MAX(CaSE WHEN CONVERT(char(10), Buchungsdatum, 120) IS NULL THEN '1900-01-01' ELSE CONVERT(char(10), Buchungsdatum, 120) END) AS LastLocMov
|
||||
from AlplaPROD_test1.dbo.V_LagerBuchungen x(nolock)
|
||||
|
||||
group by IdLagerAbteilung
|
||||
|
||||
select * from (
|
||||
select x.IdLagerAbteilung as laneID,
|
||||
x.IdWarenLager as warehouseID,
|
||||
w.Bezeichnung as warehouseName,
|
||||
w.LagerTyp as warehouseIDTyp,
|
||||
w.Standort as warehouseLocation,
|
||||
x.Bezeichnung as Description,
|
||||
LastMoveDate,
|
||||
CASE WHEN CONVERT(char(10), i.Datum, 120) is null then getdate() - 365 else CONVERT(char(10), i.Datum, 120) end as LastInv,
|
||||
--create the types of warehouses to choose from
|
||||
case
|
||||
-- empty
|
||||
when (sum(EinlagerungsMengeSum) is null and Datum < LastMoveDate) or (
|
||||
(sum(EinlagerungsMengeSum) is null and Datum < DATEADD(day, -[ageOfRow], getdate()))
|
||||
) then 'EMPTY'
|
||||
-- finished goods
|
||||
when w.LagerTyp = 2 and w.Standort = 10 then 'FG'
|
||||
-- external finished goods
|
||||
when w.LagerTyp = 2 and w.Standort = 20 then 'EXTERNAL'
|
||||
-- silos
|
||||
when w.LagerTyp in (3) and x.MaterialSilo = 1 then 'BULK'
|
||||
-- MATERIALS
|
||||
when w.LagerTyp = 3 and x.MaterialSilo = 0 then 'MATERIALS'
|
||||
|
||||
-- MATERIALS
|
||||
when w.LagerTyp = 11 then 'WASTE'
|
||||
-- MATERIALS
|
||||
when w.LagerTyp = 9 then 'PACKAGING'
|
||||
|
||||
end as rowType,
|
||||
CASE WHEN DateDiff(DAY,i.Datum,getDate()) is null then 1000 else DateDiff(DAY,i.Datum,getDate()) end as DaysSinceLast
|
||||
|
||||
from AlplaPROD_test1.dbo.T_LagerAbteilungen as x (NOLOCK)
|
||||
|
||||
-- last move
|
||||
left join
|
||||
@results as b on
|
||||
x.IdLagerAbteilung = b.IdLocation
|
||||
|
||||
-- last inv
|
||||
left join
|
||||
(select * from [AlplaPROD_test1].[dbo].[T_LagerAbteilungenInventuren] (nolock)) as i on x.IdLagerAbteilung =
|
||||
i.IdLagerAbteilung
|
||||
|
||||
-- useing this to determin only if the lane is empty
|
||||
left join
|
||||
(select * from [AlplaPROD_test1].dbo.V_LagerPositionenBarcodes (nolock)) as y on x.IdLagerAbteilung =
|
||||
y.IdLagerAbteilung
|
||||
|
||||
-- get the warehosue type
|
||||
left join
|
||||
(select * from [AlplaPROD_test1].dbo.T_WarenLager (nolock)) as w on x.IdWarenLager = w.IdWarenLager
|
||||
|
||||
where x.aktiv = 1 and x.IdWarenLager not in (1,5,6)
|
||||
|
||||
group by x.IdLagerAbteilung,
|
||||
x.IdWarenLager,
|
||||
w.LagerTyp,
|
||||
w.Standort,
|
||||
x.Bezeichnung,
|
||||
LastMoveDate,
|
||||
i.Datum,
|
||||
x.MaterialSilo,
|
||||
w.Bezeichnung
|
||||
) xb
|
||||
`;
|
||||
@@ -0,0 +1,36 @@
|
||||
export const labelInfo = `
|
||||
declare @runningNumber nvarchar(max) = [runningNr]
|
||||
|
||||
select e.Barcode,
|
||||
e.RunningNumber as runnungNumber,
|
||||
externalRunningNumber= null,
|
||||
e.ArticleHumanReadableId as av,
|
||||
e.LabelManagementHumanReadableId as labelLayout,
|
||||
case when EinlagerungsMengeSum IS NULL then 'notOnStock' else 'onStock' end as stockStatus
|
||||
from [test1_AlplaPROD2.0_Read].[labelling].[InternalLabel] (nolock) as e
|
||||
|
||||
left join
|
||||
alplaprod_test1.dbo.V_LagerPositionenBarcodes (nolock) as l on
|
||||
e.RunningNumber = l.Lfdnr
|
||||
|
||||
WHERE e.RunningNumber IN (@runningNumber)
|
||||
|
||||
union all
|
||||
|
||||
select ext.Barcode
|
||||
,RunningNumber as runnungNumber
|
||||
,SsccEanRunningNumber as externalRunningNumber
|
||||
,ArticleHumanReadableId
|
||||
,case when LabelManagementHumanReadableId is null then (select HumanReadableId from [test1_AlplaPROD2.0_Read].[masterData].[LabelManagement] (nolock) where LabelMarkerId = 7 and Active = 1) else LabelManagementHumanReadableId end as labelLayout
|
||||
,case when EinlagerungsMengeSum IS NULL then 'notOnStock' else 'onStock' end as stockStatus
|
||||
from [test1_AlplaPROD2.0_Read].[labelling].[ExternalLabel] (nolock) as ext
|
||||
|
||||
left join
|
||||
alplaprod_test1.dbo.V_LagerPositionenBarcodes (nolock) as l on
|
||||
ext.RunningNumber = l.Lfdnr
|
||||
|
||||
WHERE ext.SsccEanRunningNumber IN (@runningNumber) and
|
||||
ext.RunningNumber NOT IN (
|
||||
SELECT RunningNumber FROM [test1_AlplaPROD2.0_Read].[labelling].[InternalLabel] WHERE RunningNumber IN (@runningNumber)
|
||||
)
|
||||
`;
|
||||
@@ -0,0 +1,13 @@
|
||||
export const ppooQuery = `
|
||||
select MachineLocation,
|
||||
[RunningNumber],
|
||||
ArticleHumanReadableId,
|
||||
ArticleDescription,
|
||||
convert(Date, ProductionDay) as productionDay,
|
||||
ProductionDate
|
||||
FROM [test1_AlplaPROD2.0_Reporting].[reporting_productionControlling].[ScannedUnit] (nolock)
|
||||
|
||||
where [RunningNumber] in (select Lfdnr from AlplaPROD_test1.dbo.V_LagerPositionenBarcodes (nolock) where IdLagerAbteilung = 00000)
|
||||
|
||||
order by ProductionDate
|
||||
`;
|
||||
Reference in New Issue
Block a user