refactor(biome): more format changes
This commit is contained in:
109
app/src/pkg/prodSql/querys/scheduler/scheduler.ts
Normal file
109
app/src/pkg/prodSql/querys/scheduler/scheduler.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
export const scheduler = `
|
||||
use AlplaPROD_test1
|
||||
/*
|
||||
This query will combine both the incoming goods and the deliveries in 1 as it will be the query that populates into lst db then later updated
|
||||
*/
|
||||
DECLARE @checkDateString NVARCHAR(MAX) = '[dateCheck]' --'2025-10-14 08:00'; -- will be passed over to validate new updates.
|
||||
DECLARE @checkDate DATETIME2 = CONVERT(datetime2, @checkDateString);
|
||||
|
||||
-- orders
|
||||
select * from (select
|
||||
type = 'orders'
|
||||
,l.ArticleHumanReadableId as av
|
||||
,l.ArticleDescription as description
|
||||
,[ReleaseNumber] as orderNumber
|
||||
,h.CustomerOrderNumber as header
|
||||
,l.CustomerLineItemNumber as lineItemNumber
|
||||
,CustomerReleaseNumber as customerReleaseNumber
|
||||
,FORMAT(r.[Deliverydate], 'yyyy-MM-dd HH:mm') as deliveryDate
|
||||
,FORMAT([LoadingDate], 'yyyy-MM-dd HH:mm') as loadingDate
|
||||
,[Quantity] as orderQTY
|
||||
,[LoadingUnits] as orderLu
|
||||
,case when t.GelieferteMenge is null then 0 else t.GelieferteMenge end as deliveredQTY
|
||||
,case when t.GelieferteMengeVPK is null then 0 else t.GelieferteMengeVPK end as deliveredLu
|
||||
,r.Remark as remark
|
||||
,h.CreatedByEdi as createdAsEDI -- if 1 then we run the new function to change this in true edi as well as lstdb.
|
||||
,r.ReleaseState as currentState -- anything other than 0 should lock this and not allow for changes
|
||||
--,lstDate = getdate() --'this is a place holder for date see edi comment'
|
||||
--,dock = 'dock3' --another place holder for what dock we will go to'
|
||||
--,orderType = 'maunal or prod' -- this is for if we manually add in the order from lst. this way the dates will be ignored if this is manual.
|
||||
,h.CustomerHumanReadableId as addressId
|
||||
,h.CustomerDescription as customer
|
||||
,orderType = 20
|
||||
,r.[Add_User]
|
||||
,r.[Add_Date]
|
||||
,r.[Upd_User]
|
||||
,r.[Upd_Date]
|
||||
FROM [test1_AlplaPROD2.0_Reporting].[reporting_order].[Release] as r
|
||||
|
||||
left join
|
||||
[test1_AlplaPROD2.0_Reporting].[reporting_order].LineItem as l on
|
||||
l.id = r.LineItemId
|
||||
|
||||
left join
|
||||
[test1_AlplaPROD2.0_Read].[order].Header as h on
|
||||
h.Id = l.HeaderId
|
||||
|
||||
left join
|
||||
dbo.V_TrackerAuftragsAbrufe (nolock) as t on
|
||||
t.IdAuftragsAbruf = r.ReleaseNumber
|
||||
|
||||
--where r.[Upd_Date] >= getdate() -@age
|
||||
where CAST(r.[Upd_Date] AS datetime2) >= @checkDate
|
||||
|
||||
|
||||
union all
|
||||
-- incoming goods
|
||||
select
|
||||
type = 'incoming'
|
||||
,inc.IdArtikelVarianten as av
|
||||
,av.Bezeichnung as description
|
||||
,IdBestellung as orderNumber
|
||||
,case when inc.Bemerkung <> '' then case when CHARINDEX(',',inc.Bemerkung) = 0 then inc.Bemerkung else left(inc.Bemerkung, CHARINDEX(',',inc.Bemerkung) -1) end else 'Missing PO' end as header
|
||||
,case when inc.Bemerkung <> '' then case when CHARINDEX(',',inc.Bemerkung) = 0 then inc.Bemerkung else left(inc.Bemerkung, CHARINDEX(',',inc.Bemerkung) -1) end else 'Missing PO' end as lineItemNumber
|
||||
,case when inc.Bemerkung <> '' then case when CHARINDEX(',',inc.Bemerkung) = 0 then inc.Bemerkung else left(inc.Bemerkung, CHARINDEX(',',inc.Bemerkung) -1) end else 'Missing PO' end as customerReleaseNumber
|
||||
,FORMAT(inc.Datum, 'yyyy-MM-dd HH:mm') as deliveryDate
|
||||
,FORMAT(inc.Datum, 'yyyy-MM-dd HH:mm') as loadingDate
|
||||
,sollMenge as orderQty
|
||||
,sollmengevpk as orderLu
|
||||
,case when l.EntladeMenge is null then 0 else l.EntladeMenge end as deliveredQTY
|
||||
,case when l.EntladeMengeVPK is null then 0 else l.EntladeMengeVPK end as deliveredLu
|
||||
,inc.Bemerkung as remark
|
||||
,createdAsEDI = 0
|
||||
,inc.Status as currentState -- anything other than 0 should lock this and not allow for changes
|
||||
--,lstDate = getdate() --'this is a place holder for date see edi comment'
|
||||
--,dock = 'dock3' --another place holder for what dock we will go to'
|
||||
--,orderType = 'maunal or prod' -- this is for if we manually add in the order from lst. this way the dates will be ignored if this is manual.
|
||||
,inc.IdAdresse as addressId
|
||||
,a.Bezeichnung
|
||||
,inc.Typ as orderType -- this is just the id
|
||||
,inc.Add_User
|
||||
,inc.Add_Date
|
||||
,inc.Upd_User
|
||||
,inc.Upd_Date
|
||||
from T_Wareneingaenge (nolock) as inc
|
||||
|
||||
--article stuff
|
||||
left join
|
||||
T_Artikelvarianten (nolock) as av on
|
||||
av.IdArtikelvarianten = inc.IdArtikelVarianten
|
||||
|
||||
left join
|
||||
T_WareneingangAuftraege (nolock) as w on
|
||||
w.Beleg = inc.Beleg
|
||||
|
||||
left join
|
||||
T_WareneingangPlanungen (nolock) as l on
|
||||
l.IdWareneingangAuftrag = w.IdWareneingangAuftrag
|
||||
|
||||
left join
|
||||
T_adressen as a on
|
||||
a.idadressen = inc.IdAdresse
|
||||
|
||||
--where inc.Upd_Date >= getdate() -@age
|
||||
where inc.Upd_Date >= @checkDate
|
||||
--and inc.Typ not in (40)
|
||||
)a
|
||||
|
||||
order by upd_date desc
|
||||
`;
|
||||
15
app/src/pkg/utils/corsController.ts
Normal file
15
app/src/pkg/utils/corsController.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { validateEnv } from "./envValidator.js";
|
||||
|
||||
const env = validateEnv(process.env);
|
||||
// export const allowedOrigins = [
|
||||
// /^https?:\/\/localhost:(5173|5500|4200|3000|4000)$/, // all the allowed backend ports
|
||||
// /^http?:\/\/localhost:(5173|5500|4200|3000|4000)$/,
|
||||
// /^https?:\/\/.*\.alpla\.net$/,
|
||||
// env.BETTER_AUTH_URL, // prod
|
||||
// ];
|
||||
|
||||
export const allowedOrigins: (string | RegExp)[] = [
|
||||
/^https?:\/\/localhost:(5173|5500|4200|3000|4000)$/, // all local dev ports
|
||||
/^https?:\/\/.*\.alpla\.net$/, // any subdomain of alpla.net
|
||||
env.BETTER_AUTH_URL, // production URL
|
||||
];
|
||||
Reference in New Issue
Block a user