feat(datamart): migrations completed remaining is the deactivation that will be ran by anylitics
Some checks failed
Build and Push LST Docker Image / docker (push) Failing after 39s
Some checks failed
Build and Push LST Docker Image / docker (push) Failing after 39s
This commit is contained in:
44
backend/prodSql/queries/datamart.inventory.sql
Normal file
44
backend/prodSql/queries/datamart.inventory.sql
Normal file
@@ -0,0 +1,44 @@
|
||||
select
|
||||
ArticleHumanReadableId as av
|
||||
,ArticleAlias as alias
|
||||
,round(sum(QuantityLoadingUnits),0) total_pallets
|
||||
,round(sum(Quantity),0) as total_palletQTY
|
||||
,round(sum(case when State = 0 then QuantityLoadingUnits else 0 end),0) avalible_Pallets
|
||||
,round(sum(case when State = 0 then Quantity else 0 end),0) available_QTY
|
||||
,sum(case when b.HumanReadableId = 864 then QuantityLoadingUnits else 0 end) as coa_Pallets
|
||||
,sum(case when b.HumanReadableId = 864 then Quantity else 0 end) as coa_QTY
|
||||
,sum(case when b.HumanReadableId <> 864 then QuantityLoadingUnits else 0 end) as held_Pallets
|
||||
,sum(case when b.HumanReadableId <> 864 then Quantity else 0 end) as held_QTY
|
||||
--,l.RunningNumber
|
||||
/** should be in line **/
|
||||
--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber
|
||||
/** should be in line **/
|
||||
--,l.WarehouseDescription,l.LaneDescription
|
||||
,articleTypeName
|
||||
|
||||
FROM [test1_AlplaPROD2.0_Read].[warehousing].[WarehouseUnit] as l
|
||||
left join
|
||||
(
|
||||
SELECT [Id]
|
||||
,[HumanReadableId]
|
||||
,d.[Description]
|
||||
,[DefectGroupId]
|
||||
,[IsActive]
|
||||
FROM [test1_AlplaPROD2.0_Read].[blocking].[BlockingDefect] as g
|
||||
|
||||
left join
|
||||
[AlplaPROD_test1].dbo.[T_BlockingDefects] as d (nolock) on
|
||||
d.IdGlobalBlockingDefect = g.HumanReadableId
|
||||
) as b on
|
||||
b.id = l.MainDefectId
|
||||
where LaneHumanReadableId not in (20000,21000)
|
||||
group by ArticleHumanReadableId,
|
||||
ArticleAlias,
|
||||
ArticleTypeName
|
||||
--,l.RunningNumber
|
||||
/** should be in line **/
|
||||
--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber
|
||||
/** should be in line **/
|
||||
--,l.WarehouseDescription,l.LaneDescription
|
||||
|
||||
order by ArticleHumanReadableId
|
||||
Reference in New Issue
Block a user