| @@ -648,8 +648,8 @@ open class ProductionScheduleService( | |||||
| i.pendingJobQty, | i.pendingJobQty, | ||||
| ((i.stockQty * 1.0) + ifnull(i.pendingJobQty, 0) ) / i.avgQtyLastMonth as daysLeft, | ((i.stockQty * 1.0) + ifnull(i.pendingJobQty, 0) ) / i.avgQtyLastMonth as daysLeft, | ||||
| -- i.baseScore as priority, | |||||
| 25 + 25 + markDark + markFloat + markDense + markAS + markTimeSequence + markComplexity as priority, | |||||
| ifnull(i.baseScore, 0) as priority, | |||||
| -- 25 + 25 + markDark + markFloat + markDense + markAS + markTimeSequence + markComplexity as priority, | |||||
| i.* | i.* | ||||
| FROM | FROM | ||||
| (SELECT | (SELECT | ||||
| @@ -665,7 +665,7 @@ open class ProductionScheduleService( | |||||
| do.deleted = 0 and | do.deleted = 0 and | ||||
| dol.itemId = items.id | dol.itemId = items.id | ||||
| -- AND MONTH(do.estimatedArrivalDate) = MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) | -- AND MONTH(do.estimatedArrivalDate) = MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) | ||||
| AND do.estimatedArrivalDate >= '2026-01-08' AND do.estimatedArrivalDate < '2026-01-18' | |||||
| AND do.estimatedArrivalDate >= '2026-01-08' AND do.estimatedArrivalDate < '2026-01-31' | |||||
| GROUP BY do.estimatedArrivalDate) AS d) AS avgQtyLastMonth, | GROUP BY do.estimatedArrivalDate) AS d) AS avgQtyLastMonth, | ||||
| (select sum(reqQty) from job_order where bomId = bom.id and status != 'completed') AS pendingJobQty, | (select sum(reqQty) from job_order where bomId = bom.id and status != 'completed') AS pendingJobQty, | ||||
| @@ -718,8 +718,9 @@ open class ProductionScheduleService( | |||||
| LEFT JOIN items ON bom.itemId = items.id | LEFT JOIN items ON bom.itemId = items.id | ||||
| LEFT JOIN inventory ON items.id = inventory.itemId | LEFT JOIN inventory ON items.id = inventory.itemId | ||||
| left join item_fake_onhand on items.code = item_fake_onhand.itemCode | left join item_fake_onhand on items.code = item_fake_onhand.itemCode | ||||
| WHERE | |||||
| bom.itemId != 16771) AS i | |||||
| WHERE 1 | |||||
| and bom.itemId != 16771 | |||||
| ) AS i | |||||
| WHERE 1 | WHERE 1 | ||||
| and i.avgQtyLastMonth is not null | and i.avgQtyLastMonth is not null | ||||
| and i.onHandQty is not null | and i.onHandQty is not null | ||||