Unify material supplier and balance controls
This commit is contained in:
@@ -158,6 +158,26 @@ const listMaterialDetails = async () => {
|
||||
return result.rows.map(mapMaterialDetails);
|
||||
};
|
||||
|
||||
const listKnownSuppliers = async () => {
|
||||
const result = await pool.query(`
|
||||
SELECT DISTINCT supplier
|
||||
FROM (
|
||||
SELECT preferred_supplier AS supplier FROM supply_material_details
|
||||
UNION ALL
|
||||
SELECT supplier FROM supply_lots
|
||||
UNION ALL
|
||||
SELECT supplier FROM supply_receipts
|
||||
UNION ALL
|
||||
SELECT supplier FROM supply_fabric_plans
|
||||
UNION ALL
|
||||
SELECT supplier FROM production_yield_supplier_recommendations
|
||||
) sources
|
||||
WHERE NULLIF(BTRIM(supplier), '') IS NOT NULL
|
||||
ORDER BY supplier;
|
||||
`);
|
||||
return result.rows.map(row => row.supplier);
|
||||
};
|
||||
|
||||
const saveMaterialDetails = async (materialKey, payload) => {
|
||||
const normalizedKey = normalizeKey(materialKey);
|
||||
if (!normalizedKey) throw createValidationError('Material inválido para edição.');
|
||||
@@ -1062,6 +1082,7 @@ module.exports = {
|
||||
buildPurchaseNeeds,
|
||||
listFabricPlans,
|
||||
listMaterialDetails,
|
||||
listKnownSuppliers,
|
||||
listLots,
|
||||
listMovements,
|
||||
listPurchaseNeeds,
|
||||
|
||||
Reference in New Issue
Block a user