refactor(sql): moved new queries to there own folder to make it more easy to work and migrate
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
checks the age of an inventory dose not exceed x time
|
||||
*/
|
||||
|
||||
use AlplaPROD_test1
|
||||
DECLARE @timeCheck INT = [timeTest]
|
||||
|
||||
select
|
||||
w.IdWarenLager as idWarehouse
|
||||
,w.KurzBezeichnung as warehouse
|
||||
,b.IdLagerAbteilung as locationId
|
||||
,x.KurzBezeichnung as 'location'
|
||||
--,case when b.upd_date < Dateadd(minute, -(@timeCheck * 1.5), getdate()) then 'OVERDUE' else 'In-Progress' end as invStatus
|
||||
,format(b.Upd_Date, 'M/d/yyyy HH:mm') as cycleCountStartAt
|
||||
,b.Upd_User as blockedBy
|
||||
|
||||
--,*
|
||||
|
||||
from [dbo].[V_LagerAbteilungenInventuren] (nolock) as b
|
||||
|
||||
-- get the loction name
|
||||
left join
|
||||
dbo.T_LagerAbteilungen (nolock) as x
|
||||
on x.IdLagerAbteilung = b.IdLagerAbteilung
|
||||
|
||||
-- get the whse
|
||||
left join
|
||||
dbo.T_WarenLager (nolock) as w
|
||||
on x.idWarenLager = w.idWarenLager
|
||||
|
||||
|
||||
where status = 1
|
||||
and b.Upd_Date < Dateadd(minute, -@timeCheck, getdate())
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
disables sql jobs.
|
||||
*/
|
||||
|
||||
DECLARE @JobName varchar(max) = '[jobName]'
|
||||
UPDATE msdb.dbo.sysjobs
|
||||
SET enabled = 0
|
||||
WHERE name = @JobName;
|
||||
@@ -1,14 +1,21 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
export type SqlQuery = {
|
||||
query: string;
|
||||
success: boolean;
|
||||
message: string;
|
||||
};
|
||||
|
||||
export const sqlQuerySelector = (name: string) => {
|
||||
try {
|
||||
const queryFile = readFileSync(
|
||||
new URL(`../querys/${name}.sql`, import.meta.url),
|
||||
new URL(`../querys/newQueries/${name}.sql`, import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `Query for: ${name}`,
|
||||
query: queryFile,
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user