Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat: limit the number of results to 100 for each used in field
Brad Barbin0400e8b43cde
diff --git a/apps/erp/app/modules/items/items.service.ts b/apps/erp/app/modules/items/items.service.tsindex a5d5e9eb0a..a11da8e2af 100644--- a/apps/erp/app/modules/items/items.service.ts+++ b/apps/erp/app/modules/items/items.service.ts@@ -683,21 +683,27 @@ export async function getMaterialUsedIn(.from("jobMaterial").select("id, methodType, ...job(documentReadableId:jobId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("methodMaterial").select("id, methodType, ...makeMethod!makeMethodId(documentId:id, version, ...item(documentReadableId:readableIdWithRevision, documentParentId:id, itemType:type))").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("purchaseOrderLine").select("id, ...purchaseOrder(documentReadableId:purchaseOrderId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("receiptLine").select("id, ...receipt(documentReadableId:receiptId, documentId:id)")@@ -709,26 +715,34 @@ export async function getMaterialUsedIn("id, methodType, documentParentId:quoteId, documentId:quoteLineId, ...quoteLine(...item(documentReadableId:readableIdWithRevision))").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("salesOrderLine").select("id, methodType, ...salesOrder(documentReadableId:salesOrderId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("shipmentLine").select("id, ...shipment(documentReadableId:shipmentId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("supplierQuoteLine").select("id, ...supplierQuote(documentReadableId:supplierQuoteId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),]);return {@@ -1366,64 +1380,84 @@ export async function getPartUsedIn(.from("jobMaterial").select("id, methodType, ...job(documentReadableId:jobId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("job").select("id, documentReadableId:jobId").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("methodMaterial").select("id, methodType, ...makeMethod!makeMethodId(documentId:id, version, ...item(documentReadableId:readableIdWithRevision, documentParentId:id, itemType:type))").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("purchaseOrderLine").select("id, ...purchaseOrder(documentReadableId:purchaseOrderId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("receiptLine").select("id, ...receipt(documentReadableId:receiptId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("quoteLine").select("id, methodType, ...quote(documentReadableId:quoteId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("quoteMaterial").select("id, methodType, documentParentId:quoteId, documentId:quoteLineId, ...quoteLine(...item(documentReadableId:readableIdWithRevision))").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("salesOrderLine").select("id, methodType, ...salesOrder(documentReadableId:salesOrderId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("shipmentLine").select("id, ...shipment(documentReadableId:shipmentId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),client.from("supplierQuoteLine").select("id, ...supplierQuote(documentReadableId:supplierQuoteId, documentId:id)").eq("itemId", itemId)- .eq("companyId", companyId),+ .eq("companyId", companyId)+ .limit(100)+ .order("createdAt", { ascending: false }),]);return {