|
|
|
|
@ -11,8 +11,8 @@ async def get_cm_cost_summary(collector_db: CollectorDbSession, last_oh_date:dat
|
|
|
|
|
query = text("""WITH part_costs AS (
|
|
|
|
|
SELECT
|
|
|
|
|
mu.wonum,
|
|
|
|
|
SUM(COALESCE(inv.avgcost, po.unit_cost, 0)) AS parts_total_cost
|
|
|
|
|
FROM maximo_material_use_transactions mu
|
|
|
|
|
SUM(mu.itemqty * COALESCE(inv.avgcost, po.unit_cost, 0)) AS parts_total_cost
|
|
|
|
|
FROM maximo_workorder_materials mu
|
|
|
|
|
LEFT JOIN maximo_inventory inv
|
|
|
|
|
ON mu.itemnum = inv.itemnum
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
@ -91,8 +91,8 @@ async def get_oh_cost_summary(collector_db: CollectorDbSession, last_oh_date:dat
|
|
|
|
|
WITH part_costs AS (
|
|
|
|
|
SELECT
|
|
|
|
|
mu.wonum,
|
|
|
|
|
SUM(COALESCE(inv.avgcost, po.unit_cost, 0)) AS parts_total_cost
|
|
|
|
|
FROM maximo_material_use_transactions mu
|
|
|
|
|
SUM(mu.itemqty * COALESCE(inv.avgcost, po.unit_cost, 0)) AS parts_total_cost
|
|
|
|
|
FROM maximo_workorder_materials mu
|
|
|
|
|
LEFT JOIN maximo_inventory inv
|
|
|
|
|
ON mu.itemnum = inv.itemnum
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
@ -102,8 +102,8 @@ async def get_oh_cost_summary(collector_db: CollectorDbSession, last_oh_date:dat
|
|
|
|
|
) po
|
|
|
|
|
ON mu.itemnum = po.item_num
|
|
|
|
|
GROUP BY mu.wonum
|
|
|
|
|
)
|
|
|
|
|
, wo_costs AS (
|
|
|
|
|
),
|
|
|
|
|
wo_costs AS (
|
|
|
|
|
SELECT
|
|
|
|
|
w.wonum,
|
|
|
|
|
w.asset_location,
|
|
|
|
|
|