From 51dd9cbbae5844a53d68ee0f425830bf4a4ee29c Mon Sep 17 00:00:00 2001 From: Cizz22 Date: Wed, 8 Oct 2025 16:37:47 +0700 Subject: [PATCH] fix --- src/maximo/service.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/maximo/service.py b/src/maximo/service.py index b5192de..4c4d97f 100644 --- a/src/maximo/service.py +++ b/src/maximo/service.py @@ -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,