inventory1
This commit is contained in:
@@ -11,6 +11,8 @@ const permissionDescriptions: Record<PermissionKey, string> = {
|
||||
[permissions.companyWrite]: "Update company settings",
|
||||
[permissions.crmRead]: "View CRM records",
|
||||
[permissions.crmWrite]: "Manage CRM records",
|
||||
[permissions.inventoryRead]: "View inventory items and BOMs",
|
||||
[permissions.inventoryWrite]: "Manage inventory items and BOMs",
|
||||
[permissions.filesRead]: "View attached files",
|
||||
[permissions.filesWrite]: "Upload and manage attached files",
|
||||
[permissions.ganttRead]: "View gantt timelines",
|
||||
@@ -160,5 +162,72 @@ export async function bootstrapAppData() {
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ((await prisma.inventoryItem.count()) === 0) {
|
||||
const plate = await prisma.inventoryItem.create({
|
||||
data: {
|
||||
sku: "RM-PLATE-AL-125",
|
||||
name: "Aluminum Plate 1/8in",
|
||||
description: "Raw aluminum plate stock for fabricated assemblies.",
|
||||
type: "PURCHASED",
|
||||
status: "ACTIVE",
|
||||
unitOfMeasure: "EA",
|
||||
isSellable: false,
|
||||
isPurchasable: true,
|
||||
defaultCost: 42.5,
|
||||
notes: "Primary sheet stock for enclosure fabrication.",
|
||||
},
|
||||
});
|
||||
|
||||
const fastener = await prisma.inventoryItem.create({
|
||||
data: {
|
||||
sku: "HW-SCREW-832",
|
||||
name: "8-32 Socket Head Screw",
|
||||
description: "Standard socket head cap screw for enclosure assemblies.",
|
||||
type: "PURCHASED",
|
||||
status: "ACTIVE",
|
||||
unitOfMeasure: "EA",
|
||||
isSellable: false,
|
||||
isPurchasable: true,
|
||||
defaultCost: 0.18,
|
||||
notes: "Bulk hardware item.",
|
||||
},
|
||||
});
|
||||
|
||||
const assembly = await prisma.inventoryItem.create({
|
||||
data: {
|
||||
sku: "FG-CTRL-BASE",
|
||||
name: "Control Base Assembly",
|
||||
description: "Base enclosure assembly for standard control packages.",
|
||||
type: "ASSEMBLY",
|
||||
status: "ACTIVE",
|
||||
unitOfMeasure: "EA",
|
||||
isSellable: true,
|
||||
isPurchasable: false,
|
||||
defaultCost: 118,
|
||||
notes: "Starter BOM for the inventory foundation slice.",
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.inventoryBomLine.createMany({
|
||||
data: [
|
||||
{
|
||||
parentItemId: assembly.id,
|
||||
componentItemId: plate.id,
|
||||
quantity: 2,
|
||||
unitOfMeasure: "EA",
|
||||
notes: "Side panel blanks",
|
||||
position: 10,
|
||||
},
|
||||
{
|
||||
parentItemId: assembly.id,
|
||||
componentItemId: fastener.id,
|
||||
quantity: 12,
|
||||
unitOfMeasure: "EA",
|
||||
notes: "General assembly hardware",
|
||||
position: 20,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user