feat(dm): migrated all the dm topics
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 4m26s
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 4m26s
This commit is contained in:
26
backend/prodSql/queries/datamart.bulkOrderArticleInfo.sql
Normal file
26
backend/prodSql/queries/datamart.bulkOrderArticleInfo.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
USE [test1_AlplaPROD2.0_Read]
|
||||
SELECT
|
||||
x.HumanReadableId as av
|
||||
,x.Name
|
||||
,Alias
|
||||
,CustomerDescription
|
||||
,CustomerArticleNumber
|
||||
,LoadingUnitPieces
|
||||
,LoadingUnitsPerTruck
|
||||
,LoadingUnitPieces * LoadingUnitsPerTruck as totalTruckLoad
|
||||
FROM [masterData].[Article] (nolock) as x
|
||||
|
||||
--get the sales price stuff
|
||||
left join
|
||||
(select * from (select *
|
||||
,ROW_NUMBER() OVER (PARTITION BY articleId ORDER BY validAfter DESC) as rn
|
||||
from [masterData].[SalesPrice] (nolock))as b
|
||||
where rn = 1) as s on
|
||||
x.id = s.ArticleId
|
||||
|
||||
-- link pkg info
|
||||
left join
|
||||
[masterData].[PackagingInstruction] (nolock) as p on
|
||||
s.PackagingId = p.id
|
||||
|
||||
where x.HumanReadableId in ([articles])
|
||||
15
backend/prodSql/queries/datamart.invoiceAddress.sql
Normal file
15
backend/prodSql/queries/datamart.invoiceAddress.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
use [test1_AlplaPROD2.0_Read]
|
||||
|
||||
SELECT deliveryAddress.humanreadableid as deliveryAddress
|
||||
,invoice.HumanReadableId as invoiceAddress
|
||||
,[Default]
|
||||
|
||||
FROM [masterData].[InvoiceAddress] (nolock) as d
|
||||
|
||||
join
|
||||
[masterData].[Address] deliveryAddress (nolock) on deliveryAddress.id = d.AddressId
|
||||
|
||||
join
|
||||
[masterData].[Address] invoice (nolock) on invoice.id = d.InvoiceAddressId
|
||||
|
||||
where [Default] = 1
|
||||
@@ -27,7 +27,15 @@ left join
|
||||
[order].Header as h (nolock) on
|
||||
h.id = l.HeaderId
|
||||
|
||||
WHERE releasestate not in (1, 2, 4)
|
||||
/*
|
||||
0 = open
|
||||
1 = shipped
|
||||
2 = customer canceled
|
||||
3 = shipped
|
||||
4 = internal canceled
|
||||
*/
|
||||
|
||||
WHERE releasestate not in (1, 2,3, 4)
|
||||
AND r.deliverydate between getDate() + -[startDay] and getdate() + [endDay]
|
||||
|
||||
order by r.deliverydate
|
||||
27
backend/prodSql/queries/datamart.orderState.sql
Normal file
27
backend/prodSql/queries/datamart.orderState.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
use [test1_AlplaPROD2.0_Read]
|
||||
|
||||
SELECT
|
||||
CustomerOrderNumber
|
||||
,r.CustomerReleaseNumber
|
||||
, OrderState
|
||||
, r.ReleaseState
|
||||
, h.CreatedByEdi
|
||||
,r.AdditionalInformation1 -- the info for od exists here, this will be mapped over to an email sending out saying someoen tryied to update an od release
|
||||
|
||||
--, *
|
||||
FROM [order].[Header] (nolock) h
|
||||
|
||||
/* get the line items to link to the headers */
|
||||
left join
|
||||
[order].[LineItem] (nolock) l on
|
||||
l.HeaderId = h.id
|
||||
|
||||
/* get the releases to link to the headers */
|
||||
left join
|
||||
[order].[Release] (nolock) r on
|
||||
r.LineItemId = l.id
|
||||
|
||||
where
|
||||
--h.CreatedByEdi = 1
|
||||
r.ReleaseState >= 1
|
||||
--and CustomerOrderNumber in ( '2358392')
|
||||
10
backend/prodSql/queries/prod.auditlog.sql
Normal file
10
backend/prodSql/queries/prod.auditlog.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
USE [test1_AlplaPROD2.0_Read]
|
||||
|
||||
DECLARE @lastId BIGINT = [lstId];
|
||||
|
||||
SELECT TOP (500)
|
||||
*
|
||||
FROM [support].[AuditLog] WITH (NOLOCK)
|
||||
WHERE ActorName NOT IN ('SCHEDULER', 'SCAN')
|
||||
AND Id > @lastId
|
||||
ORDER BY Id ASC;
|
||||
Reference in New Issue
Block a user