





















const db = require('../models');
const Users = db.users;






const Suppliers = db.suppliers;

const Customers = db.customers;

const Uoms = db.uoms;

const Items = db.items;

const ItemSupplierLinks = db.item_supplier_links;

const Warehouses = db.warehouses;

const Locations = db.locations;

const InventoryLots = db.inventory_lots;

const InventoryBalances = db.inventory_balances;

const InventoryTransactions = db.inventory_transactions;

const BomHeaders = db.bom_headers;

const BomLines = db.bom_lines;

const WorkCenters = db.work_centers;

const Machines = db.machines;

const RoutingHeaders = db.routing_headers;

const RoutingOperations = db.routing_operations;

const ProductionOrders = db.production_orders;

const ProductionOperations = db.production_operations;

const MaterialIssues = db.material_issues;

const ProductionReceipts = db.production_receipts;

const QaInspectionPlans = db.qa_inspection_plans;

const QaInspections = db.qa_inspections;

const Nonconformances = db.nonconformances;

const CapaActions = db.capa_actions;

const MaintenanceWorkOrders = db.maintenance_work_orders;

const PurchaseOrders = db.purchase_orders;

const PurchaseOrderLines = db.purchase_order_lines;

const SalesOrders = db.sales_orders;

const SalesOrderLines = db.sales_order_lines;

const Shipments = db.shipments;

const ShipmentLines = db.shipment_lines;

const CostCenters = db.cost_centers;

const CostElements = db.cost_elements;

const StandardCosts = db.standard_costs;

const ProductionCosts = db.production_costs;

const PriceLists = db.price_lists;

const PriceListLines = db.price_list_lines;

const Documents = db.documents;







const SuppliersData = [
    
    {
    
        
        
            
                "supplier_code": "SUP-1001",
            
        
    
        
        
            
                "name": "Northstar Metals",
            
        
    
        
        
            
                "tax_number": "TX-NSM-8842",
            
        
    
        
        
            
                "email": "ap@northstarmetals.example",
            
        
    
        
        
            
                "phone": "555-1201",
            
        
    
        
        
            
                "address": "1200 Foundry Rd, Dayton, OH",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "notes": "Primary steel and aluminum supplier",
            
        
    
    },
    
    {
    
        
        
            
                "supplier_code": "SUP-1002",
            
        
    
        
        
            
                "name": "Precision Plastics Co",
            
        
    
        
        
            
                "tax_number": "TX-PPC-1933",
            
        
    
        
        
            
                "email": "orders@precisionplastics.example",
            
        
    
        
        
            
                "phone": "555-1202",
            
        
    
        
        
            
                "address": "45 Polymer Ave, Toledo, OH",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "notes": "Injection-molded components and pellets",
            
        
    
    },
    
    {
    
        
        
            
                "supplier_code": "SUP-1003",
            
        
    
        
        
            
                "name": "Bearings Unlimited",
            
        
    
        
        
            
                "tax_number": "TX-BU-5520",
            
        
    
        
        
            
                "email": "sales@bearingsunlimited.example",
            
        
    
        
        
            
                "phone": "555-1203",
            
        
    
        
        
            
                "address": "88 Motion Dr, Fort Wayne, IN",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "notes": "Standard bearings and power transmission",
            
        
    
    },
    
    {
    
        
        
            
                "supplier_code": "SUP-1004",
            
        
    
        
        
            
                "name": "Omega Industrial Chemicals",
            
        
    
        
        
            
                "tax_number": "TX-OIC-2207",
            
        
    
        
        
            
                "email": "service@omega-chem.example",
            
        
    
        
        
            
                "phone": "555-1204",
            
        
    
        
        
            
                "address": "310 Solvent St, Gary, IN",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "notes": "Pending updated SDS documentation",
            
        
    
    },
    
];



const CustomersData = [
    
    {
    
        
        
            
                "customer_code": "CUST-2001",
            
        
    
        
        
            
                "name": "Apex Equipment",
            
        
    
        
        
            
                "tax_number": "TX-AEQ-4411",
            
        
    
        
        
            
                "email": "purchasing@apexeq.example",
            
        
    
        
        
            
                "phone": "555-2201",
            
        
    
        
        
            
                "address": "500 Industrial Blvd, Chicago, IL",
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                "notes": "OEM customer with quarterly forecasts",
            
        
    
    },
    
    {
    
        
        
            
                "customer_code": "CUST-2002",
            
        
    
        
        
            
                "name": "Riverbend Automation",
            
        
    
        
        
            
                "tax_number": "TX-RBA-1190",
            
        
    
        
        
            
                "email": "buyer@riverbendauto.example",
            
        
    
        
        
            
                "phone": "555-2202",
            
        
    
        
        
            
                "address": "77 Control Pkwy, Milwaukee, WI",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "notes": "Small batch custom assemblies",
            
        
    
    },
    
    {
    
        
        
            
                "customer_code": "CUST-2003",
            
        
    
        
        
            
                "name": "Summit HVAC Systems",
            
        
    
        
        
            
                "tax_number": "TX-SHV-3021",
            
        
    
        
        
            
                "email": "procurement@summithvac.example",
            
        
    
        
        
            
                "phone": "555-2203",
            
        
    
        
        
            
                "address": "210 Vent Dr, Madison, WI",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "notes": "Seasonal demand peaks in summer",
            
        
    
    },
    
    {
    
        
        
            
                "customer_code": "CUST-2004",
            
        
    
        
        
            
                "name": "Bluewater Marine Supply",
            
        
    
        
        
            
                "tax_number": "TX-BMS-9087",
            
        
    
        
        
            
                "email": "orders@bluewatermarine.example",
            
        
    
        
        
            
                "phone": "555-2204",
            
        
    
        
        
            
                "address": "12 Harbor Way, Sturgeon Bay, WI",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "notes": "Credit review in progress",
            
        
    
    },
    
];



const UomsData = [
    
    {
    
        
        
            
                "code": "EA",
            
        
    
        
        
            
                "name": "Each",
            
        
    
        
        
            
                "type": "area",
            
        
    
        
        
            
                "to_base_factor": 1,
            
        
    
        
        
            
                "notes": "Base unit for discrete items",
            
        
    
    },
    
    {
    
        
        
            
                "code": "KG",
            
        
    
        
        
            
                "name": "Kilogram",
            
        
    
        
        
            
                "type": "area",
            
        
    
        
        
            
                "to_base_factor": 1,
            
        
    
        
        
            
                "notes": "Base unit for weight",
            
        
    
    },
    
    {
    
        
        
            
                "code": "M",
            
        
    
        
        
            
                "name": "Meter",
            
        
    
        
        
            
                "type": "area",
            
        
    
        
        
            
                "to_base_factor": 1,
            
        
    
        
        
            
                "notes": "Base unit for length",
            
        
    
    },
    
    {
    
        
        
            
                "code": "L",
            
        
    
        
        
            
                "name": "Liter",
            
        
    
        
        
            
                "type": "each",
            
        
    
        
        
            
                "to_base_factor": 1,
            
        
    
        
        
            
                "notes": "Base unit for volume",
            
        
    
    },
    
];



const ItemsData = [
    
    {
    
        
        
            
                "item_code": "RM-AL-6061",
            
        
    
        
        
            
                "name": "Aluminum Bar 6061",
            
        
    
        
        
            
                "item_type": "raw_material",
            
        
    
        
        
            
                "tracking": "lot",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_scrap_rate": 0.02,
            
        
    
        
        
            
                "shelf_life_days": 0,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "6061 aluminum bar stock for machining",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "item_code": "RM-STEEL-1018",
            
        
    
        
        
            
                "name": "Steel Rod 1018",
            
        
    
        
        
            
                "item_type": "finished_good",
            
        
    
        
        
            
                "tracking": "none",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_scrap_rate": 0.03,
            
        
    
        
        
            
                "shelf_life_days": 0,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "1018 steel rod for turned parts",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "item_code": "CMP-BRG-6203",
            
        
    
        
        
            
                "name": "Bearing 6203-2RS",
            
        
    
        
        
            
                "item_type": "finished_good",
            
        
    
        
        
            
                "tracking": "serial",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_scrap_rate": 0,
            
        
    
        
        
            
                "shelf_life_days": 0,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "Sealed deep groove bearing 6203",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "item_code": "SUB-HSG-100",
            
        
    
        
        
            
                "name": "Motor Housing Assembly",
            
        
    
        
        
            
                "item_type": "finished_good",
            
        
    
        
        
            
                "tracking": "none",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_scrap_rate": 0.01,
            
        
    
        
        
            
                "shelf_life_days": 0,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "Machined housing with pressed bearing",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ItemSupplierLinksData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_item_code": "NSM-AL6061-BAR",
            
        
    
        
        
            
                "last_purchase_price": 4.85,
            
        
    
        
        
            
                "lead_time_days": 10,
            
        
    
        
        
            
                "min_order_qty": 500,
            
        
    
        
        
            
                "preferred": true,
            
        
    
        
        
            
                "notes": "Standard mill cert required",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_item_code": "NSM-1018-ROD",
            
        
    
        
        
            
                "last_purchase_price": 2.35,
            
        
    
        
        
            
                "lead_time_days": 12,
            
        
    
        
        
            
                "min_order_qty": 1000,
            
        
    
        
        
            
                "preferred": true,
            
        
    
        
        
            
                "notes": "Bundle packaging preferred",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_item_code": "BU-6203-2RS",
            
        
    
        
        
            
                "last_purchase_price": 1.15,
            
        
    
        
        
            
                "lead_time_days": 7,
            
        
    
        
        
            
                "min_order_qty": 200,
            
        
    
        
        
            
                "preferred": true,
            
        
    
        
        
            
                "notes": "Accept SKF or NSK equivalents",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_item_code": "PPC-HSG-100",
            
        
    
        
        
            
                "last_purchase_price": 12.5,
            
        
    
        
        
            
                "lead_time_days": 15,
            
        
    
        
        
            
                "min_order_qty": 50,
            
        
    
        
        
            
                "preferred": false,
            
        
    
        
        
            
                "notes": "Backup supplier for molded insert",
            
        
    
    },
    
];



const WarehousesData = [
    
    {
    
        
        
            
                "code": "WH-MAIN",
            
        
    
        
        
            
                "name": "Main Warehouse",
            
        
    
        
        
            
                "address": "100 Plant Rd, Dayton, OH",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                "code": "WH-RAW",
            
        
    
        
        
            
                "name": "Raw Materials Warehouse",
            
        
    
        
        
            
                "address": "100 Plant Rd, Dayton, OH",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                "code": "WH-WIP",
            
        
    
        
        
            
                "name": "WIP Storage",
            
        
    
        
        
            
                "address": "100 Plant Rd, Dayton, OH",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                "code": "WH-FG",
            
        
    
        
        
            
                "name": "Finished Goods Warehouse",
            
        
    
        
        
            
                "address": "100 Plant Rd, Dayton, OH",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const LocationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "code": "RAW-REC",
            
        
    
        
        
            
                "name": "Raw Receiving",
            
        
    
        
        
            
                "location_type": "scrap",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "code": "RAW-STK-01",
            
        
    
        
        
            
                "name": "Raw Stock Aisle 1",
            
        
    
        
        
            
                "location_type": "shipping",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "code": "WIP-01",
            
        
    
        
        
            
                "name": "WIP Staging 1",
            
        
    
        
        
            
                "location_type": "scrap",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "code": "FG-STK-01",
            
        
    
        
        
            
                "name": "FG Rack 1",
            
        
    
        
        
            
                "location_type": "quality_hold",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const InventoryLotsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "AL6061-250301-A",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_at": new Date('2026-03-01T09:15:00Z'),
            
        
    
        
        
            
                "manufactured_at": new Date('2026-02-20T00:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2027-03-01T00:00:00Z'),
            
        
    
        
        
            
                "status": "available",
            
        
    
        
        
            
                "certificate_number": "CERT-AL-7781",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Mill cert on file",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "ST1018-250228-B",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_at": new Date('2026-02-28T10:00:00Z'),
            
        
    
        
        
            
                "manufactured_at": new Date('2026-02-18T00:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2027-02-28T00:00:00Z'),
            
        
    
        
        
            
                "status": "consumed",
            
        
    
        
        
            
                "certificate_number": "CERT-ST-4410",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Chemistry verified",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "BRG6203-250305",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_at": new Date('2026-03-05T14:30:00Z'),
            
        
    
        
        
            
                "manufactured_at": new Date('2026-01-15T00:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2029-03-05T00:00:00Z'),
            
        
    
        
        
            
                "status": "consumed",
            
        
    
        
        
            
                "certificate_number": "COC-BRG-6203-993",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "COC received",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "HSG100-250308-WIP",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_at": new Date('2026-03-08T08:45:00Z'),
            
        
    
        
        
            
                "manufactured_at": new Date('2026-03-07T00:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2027-03-08T00:00:00Z'),
            
        
    
        
        
            
                "status": "scrapped",
            
        
    
        
        
            
                "certificate_number": "N-A",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Awaiting incoming inspection",
            
        
    
    },
    
];



const InventoryBalancesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 1800,
            
        
    
        
        
            
                "quantity_allocated": 300,
            
        
    
        
        
            
                "quantity_available": 1500,
            
        
    
        
        
            
                "last_counted_at": new Date('2026-03-12T13:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 2400,
            
        
    
        
        
            
                "quantity_allocated": 0,
            
        
    
        
        
            
                "quantity_available": 2400,
            
        
    
        
        
            
                "last_counted_at": new Date('2026-03-12T13:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 800,
            
        
    
        
        
            
                "quantity_allocated": 200,
            
        
    
        
        
            
                "quantity_available": 600,
            
        
    
        
        
            
                "last_counted_at": new Date('2026-03-12T13:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 40,
            
        
    
        
        
            
                "quantity_allocated": 0,
            
        
    
        
        
            
                "quantity_available": 40,
            
        
    
        
        
            
                "last_counted_at": new Date('2026-03-11T10:30:00Z'),
            
        
    
    },
    
];



const InventoryTransactionsData = [
    
    {
    
        
        
            
                "transaction_at": new Date('2026-03-01T09:20:00Z'),
            
        
    
        
        
            
                "transaction_type": "move",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1800,
            
        
    
        
        
            
                "reference": "PO SUP-1001 45012",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Putaway completed",
            
        
    
    },
    
    {
    
        
        
            
                "transaction_at": new Date('2026-03-05T14:40:00Z'),
            
        
    
        
        
            
                "transaction_type": "scrap",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 800,
            
        
    
        
        
            
                "reference": "PO SUP-1003 45018",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Received with COC",
            
        
    
    },
    
    {
    
        
        
            
                "transaction_at": new Date('2026-03-08T09:00:00Z'),
            
        
    
        
        
            
                "transaction_type": "shipment",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 40,
            
        
    
        
        
            
                "reference": "PO SUP-1002 45025",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Moved to quarantine for inspection",
            
        
    
    },
    
    {
    
        
        
            
                "transaction_at": new Date('2026-03-12T08:10:00Z'),
            
        
    
        
        
            
                "transaction_type": "move",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 300,
            
        
    
        
        
            
                "reference": "MO-70015 consume",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Issued to production",
            
        
    
    },
    
];



const BomHeadersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bom_code": "BOM-MTR-500",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "yield_quantity": 1,
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "notes": "Initial release BOM",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-01-05T16:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bom_code": "BOM-HSG-100",
            
        
    
        
        
            
                "revision": "B",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "effective_from": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "yield_quantity": 1,
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "notes": "Updated bearing press fit notes",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-02-03T15:30:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bom_code": "BOM-MTR-500",
            
        
    
        
        
            
                "revision": "B",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "effective_from": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "yield_quantity": 1,
            
        
    
        
        
            
                "is_default": false,
            
        
    
        
        
            
                "notes": "Proposed wire harness change",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-03-10T10:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bom_code": "BOM-HSG-100",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "effective_from": new Date('2025-06-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-01-31T00:00:00Z'),
            
        
    
        
        
            
                "yield_quantity": 1,
            
        
    
        
        
            
                "is_default": false,
            
        
    
        
        
            
                "notes": "Obsoleted by Rev B",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-02-01T09:00:00Z'),
            
        
    
    },
    
];



const BomLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 10,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 1,
            
        
    
        
        
            
                "scrap_rate": 0.01,
            
        
    
        
        
            
                "issue_method": "backflush",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "remarks": "Housing assembly",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 20,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 2,
            
        
    
        
        
            
                "scrap_rate": 0,
            
        
    
        
        
            
                "issue_method": "backflush",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "remarks": "Two bearings per unit",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 10,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 2.5,
            
        
    
        
        
            
                "scrap_rate": 0.02,
            
        
    
        
        
            
                "issue_method": "backflush",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "remarks": "Bar stock for machining",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 20,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 1,
            
        
    
        
        
            
                "scrap_rate": 0,
            
        
    
        
        
            
                "issue_method": "backflush",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "remarks": "Press in bearing",
            
        
    
    },
    
];



const WorkCentersData = [
    
    {
    
        
        
            
                "code": "WC-CNC",
            
        
    
        
        
            
                "name": "CNC Machining",
            
        
    
        
        
            
                "center_type": "packaging",
            
        
    
        
        
            
                "default_setup_minutes": 30,
            
        
    
        
        
            
                "default_run_rate_per_hour": 6,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "3-axis CNC mills",
            
        
    
    },
    
    {
    
        
        
            
                "code": "WC-TURN",
            
        
    
        
        
            
                "name": "Turning",
            
        
    
        
        
            
                "center_type": "packaging",
            
        
    
        
        
            
                "default_setup_minutes": 25,
            
        
    
        
        
            
                "default_run_rate_per_hour": 8,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "CNC lathes",
            
        
    
    },
    
    {
    
        
        
            
                "code": "WC-ASSY",
            
        
    
        
        
            
                "name": "Assembly",
            
        
    
        
        
            
                "center_type": "outsourced",
            
        
    
        
        
            
                "default_setup_minutes": 10,
            
        
    
        
        
            
                "default_run_rate_per_hour": 20,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Bench assembly cells",
            
        
    
    },
    
    {
    
        
        
            
                "code": "WC-QC",
            
        
    
        
        
            
                "name": "Quality Inspection",
            
        
    
        
        
            
                "center_type": "assembly",
            
        
    
        
        
            
                "default_setup_minutes": 5,
            
        
    
        
        
            
                "default_run_rate_per_hour": 30,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Incoming and final inspections",
            
        
    
    },
    
];



const MachinesData = [
    
    {
    
        
        
            
                "asset_tag": "MC-1001",
            
        
    
        
        
            
                "name": "Haas VF2 Mill",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "retired",
            
        
    
        
        
            
                "manufacturer": "Haas",
            
        
    
        
        
            
                "model": "VF-2",
            
        
    
        
        
            
                "serial_number": "HF2-77123",
            
        
    
        
        
            
                "commissioned_at": new Date('2022-05-10T00:00:00Z'),
            
        
    
        
        
            
                "last_service_at": new Date('2026-02-20T00:00:00Z'),
            
        
    
        
        
            
                "hour_meter": 6420.5,
            
        
    
        
        
            
                "notes": "Spindle replaced in 2025",
            
        
    
    },
    
    {
    
        
        
            
                "asset_tag": "MC-1002",
            
        
    
        
        
            
                "name": "Mazak QT200 Lathe",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "available",
            
        
    
        
        
            
                "manufacturer": "Mazak",
            
        
    
        
        
            
                "model": "QT200",
            
        
    
        
        
            
                "serial_number": "MZ-55021",
            
        
    
        
        
            
                "commissioned_at": new Date('2021-09-15T00:00:00Z'),
            
        
    
        
        
            
                "last_service_at": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "hour_meter": 8122.2,
            
        
    
        
        
            
                "notes": "Monitor coolant concentration",
            
        
    
    },
    
    {
    
        
        
            
                "asset_tag": "MC-1003",
            
        
    
        
        
            
                "name": "CMM Station 1",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "available",
            
        
    
        
        
            
                "manufacturer": "Mitutoyo",
            
        
    
        
        
            
                "model": "CRYSTA-Apex",
            
        
    
        
        
            
                "serial_number": "MT-99001",
            
        
    
        
        
            
                "commissioned_at": new Date('2020-01-20T00:00:00Z'),
            
        
    
        
        
            
                "last_service_at": new Date('2026-03-10T00:00:00Z'),
            
        
    
        
        
            
                "hour_meter": 2100,
            
        
    
        
        
            
                "notes": "Awaiting calibration cert",
            
        
    
    },
    
    {
    
        
        
            
                "asset_tag": "MC-1004",
            
        
    
        
        
            
                "name": "Hydraulic Press 20T",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "maintenance",
            
        
    
        
        
            
                "manufacturer": "Enerpac",
            
        
    
        
        
            
                "model": "H-Frame 20T",
            
        
    
        
        
            
                "serial_number": "EN-20331",
            
        
    
        
        
            
                "commissioned_at": new Date('2019-07-01T00:00:00Z'),
            
        
    
        
        
            
                "last_service_at": new Date('2026-01-12T00:00:00Z'),
            
        
    
        
        
            
                "hour_meter": 1550.7,
            
        
    
        
        
            
                "notes": "Used for bearing press-fit",
            
        
    
    },
    
];



const RoutingHeadersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "routing_code": "RTE-HSG-100",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "effective_from": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-02-02T13:00:00Z'),
            
        
    
        
        
            
                "notes": "Standard machining and press-fit sequence",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "routing_code": "RTE-MTR-500",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "obsolete",
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-01-04T10:00:00Z'),
            
        
    
        
        
            
                "notes": "Assembly, test, and final inspection",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "routing_code": "RTE-MTR-500",
            
        
    
        
        
            
                "revision": "B",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "effective_from": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "is_default": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-03-10T12:00:00Z'),
            
        
    
        
        
            
                "notes": "Proposed additional in-process inspection",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "routing_code": "RTE-BRG-6203",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "effective_from": new Date('2025-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2025-01-02T09:00:00Z'),
            
        
    
        
        
            
                "notes": "Incoming inspection only",
            
        
    
    },
    
];



const RoutingOperationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 10,
            
        
    
        
        
            
                "name": "CNC Rough Mill",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_minutes": 30,
            
        
    
        
        
            
                "run_minutes_per_unit": 12,
            
        
    
        
        
            
                "queue_minutes": 60,
            
        
    
        
        
            
                "move_minutes": 10,
            
        
    
        
        
            
                "qa_required": "none",
            
        
    
        
        
            
                "work_instructions": "Load bar stock and run Program HSG100-R1",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 20,
            
        
    
        
        
            
                "name": "Deburr and Clean",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_minutes": 5,
            
        
    
        
        
            
                "run_minutes_per_unit": 4,
            
        
    
        
        
            
                "queue_minutes": 30,
            
        
    
        
        
            
                "move_minutes": 5,
            
        
    
        
        
            
                "qa_required": "in_process",
            
        
    
        
        
            
                "work_instructions": "Deburr edges and clean chips before press-fit",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 30,
            
        
    
        
        
            
                "name": "Press Bearing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_minutes": 10,
            
        
    
        
        
            
                "run_minutes_per_unit": 3,
            
        
    
        
        
            
                "queue_minutes": 30,
            
        
    
        
        
            
                "move_minutes": 5,
            
        
    
        
        
            
                "qa_required": "in_process",
            
        
    
        
        
            
                "work_instructions": "Use press fixture PF-200 and verify seating depth",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 10,
            
        
    
        
        
            
                "name": "Final Assembly",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_minutes": 10,
            
        
    
        
        
            
                "run_minutes_per_unit": 8,
            
        
    
        
        
            
                "queue_minutes": 45,
            
        
    
        
        
            
                "move_minutes": 5,
            
        
    
        
        
            
                "qa_required": "in_process",
            
        
    
        
        
            
                "work_instructions": "Assemble motor unit per WI-MTR-500-ASSY",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ProductionOrdersData = [
    
    {
    
        
        
            
                "order_number": "MO-70012",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "planned_quantity": 25,
            
        
    
        
        
            
                "completed_quantity": 25,
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "planned_start_at": new Date('2026-03-08T07:00:00Z'),
            
        
    
        
        
            
                "planned_end_at": new Date('2026-03-10T17:00:00Z'),
            
        
    
        
        
            
                "released_at": new Date('2026-03-08T06:30:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-10T16:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "High",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Build for Apex Equipment SO-51002",
            
        
    
    },
    
    {
    
        
        
            
                "order_number": "MO-70013",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "planned_quantity": 40,
            
        
    
        
        
            
                "completed_quantity": 30,
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                "planned_start_at": new Date('2026-03-11T07:00:00Z'),
            
        
    
        
        
            
                "planned_end_at": new Date('2026-03-14T17:00:00Z'),
            
        
    
        
        
            
                "released_at": new Date('2026-03-11T06:45:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-13T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "Medium",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Replenish subassembly for next motor run",
            
        
    
    },
    
    {
    
        
        
            
                "order_number": "MO-70014",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "planned_quantity": 50,
            
        
    
        
        
            
                "completed_quantity": 0,
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                "planned_start_at": new Date('2026-03-18T07:00:00Z'),
            
        
    
        
        
            
                "planned_end_at": new Date('2026-03-22T17:00:00Z'),
            
        
    
        
        
            
                "released_at": new Date('2026-03-15T10:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-15T10:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "High",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Planned build for Summit HVAC",
            
        
    
    },
    
    {
    
        
        
            
                "order_number": "MO-70015",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "planned_quantity": 60,
            
        
    
        
        
            
                "completed_quantity": 0,
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "planned_start_at": new Date('2026-03-12T07:00:00Z'),
            
        
    
        
        
            
                "planned_end_at": new Date('2026-03-16T17:00:00Z'),
            
        
    
        
        
            
                "released_at": new Date('2026-03-12T06:50:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-12T06:50:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "Low",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Hold pending machine availability",
            
        
    
    },
    
];



const ProductionOperationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 10,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "ready",
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-08T07:30:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-09T12:00:00Z'),
            
        
    
        
        
            
                "actual_start_at": new Date('2026-03-08T07:40:00Z'),
            
        
    
        
        
            
                "actual_end_at": new Date('2026-03-09T11:30:00Z'),
            
        
    
        
        
            
                "good_quantity": 25,
            
        
    
        
        
            
                "scrap_quantity": 0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Assembly completed",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 20,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "skipped",
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-09T13:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-10T16:00:00Z'),
            
        
    
        
        
            
                "actual_start_at": new Date('2026-03-09T13:15:00Z'),
            
        
    
        
        
            
                "actual_end_at": new Date('2026-03-10T15:45:00Z'),
            
        
    
        
        
            
                "good_quantity": 25,
            
        
    
        
        
            
                "scrap_quantity": 0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "All units passed final inspection",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 10,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-11T08:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-12T16:00:00Z'),
            
        
    
        
        
            
                "actual_start_at": new Date('2026-03-11T08:10:00Z'),
            
        
    
        
        
            
                "actual_end_at": new Date('2026-03-12T12:00:00Z'),
            
        
    
        
        
            
                "good_quantity": 30,
            
        
    
        
        
            
                "scrap_quantity": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "One part scrapped due to chatter marks",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 10,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "skipped",
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-12T08:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-13T16:00:00Z'),
            
        
    
        
        
            
                "actual_start_at": new Date('2026-03-12T08:30:00Z'),
            
        
    
        
        
            
                "actual_end_at": new Date('2026-03-12T10:00:00Z'),
            
        
    
        
        
            
                "good_quantity": 0,
            
        
    
        
        
            
                "scrap_quantity": 0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Paused due to tooling shortage",
            
        
    
    },
    
];



const MaterialIssuesData = [
    
    {
    
        
        
            
                "issue_number": "ISS-90001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_issued": 120,
            
        
    
        
        
            
                "issued_at": new Date('2026-03-11T08:05:00Z'),
            
        
    
        
        
            
                "issue_type": "manual",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Issued for CNC machining",
            
        
    
    },
    
    {
    
        
        
            
                "issue_number": "ISS-90002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_issued": 300,
            
        
    
        
        
            
                "issued_at": new Date('2026-03-12T08:10:00Z'),
            
        
    
        
        
            
                "issue_type": "manual",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Issued to WIP staging",
            
        
    
    },
    
    {
    
        
        
            
                "issue_number": "ISS-90003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_issued": 50,
            
        
    
        
        
            
                "issued_at": new Date('2026-03-08T07:20:00Z'),
            
        
    
        
        
            
                "issue_type": "return",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Backflushed bearings",
            
        
    
    },
    
    {
    
        
        
            
                "issue_number": "ISS-90004",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_issued": 25,
            
        
    
        
        
            
                "issued_at": new Date('2026-03-08T07:30:00Z'),
            
        
    
        
        
            
                "issue_type": "backflush",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Pulled housing assemblies",
            
        
    
    },
    
];



const ProductionReceiptsData = [
    
    {
    
        
        
            
                "receipt_number": "RCV-80001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_received": 25,
            
        
    
        
        
            
                "received_at": new Date('2026-03-10T16:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Moved to QA Hold",
            
        
    
    },
    
    {
    
        
        
            
                "receipt_number": "RCV-80002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_received": 30,
            
        
    
        
        
            
                "received_at": new Date('2026-03-12T12:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Machining complete, ready for press-fit",
            
        
    
    },
    
    {
    
        
        
            
                "receipt_number": "RCV-80003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_received": 10,
            
        
    
        
        
            
                "received_at": new Date('2026-03-13T15:45:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Submitted for in-process inspection",
            
        
    
    },
    
    {
    
        
        
            
                "receipt_number": "RCV-80004",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_received": 0,
            
        
    
        
        
            
                "received_at": new Date('2026-03-12T10:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "No output, job paused",
            
        
    
    },
    
];



const QaInspectionPlansData = [
    
    {
    
        
        
            
                "plan_code": "IP-REC-RAW",
            
        
    
        
        
            
                "name": "Incoming Raw Material Inspection",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "receiving",
            
        
    
        
        
            
                "sampling_method": "100_percent",
            
        
    
        
        
            
                "aql_level": 1.0,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "instructions": "Verify certificate, alloy, and dimensions against PO",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "plan_code": "IP-REC-BRG",
            
        
    
        
        
            
                "name": "Incoming Bearing Inspection",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "receiving",
            
        
    
        
        
            
                "sampling_method": "100_percent",
            
        
    
        
        
            
                "aql_level": 1.5,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "instructions": "Check labeling, count, and rotation smoothness",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "plan_code": "IP-IP-HSG",
            
        
    
        
        
            
                "name": "In-Process Housing Inspection",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "audit",
            
        
    
        
        
            
                "sampling_method": "aql",
            
        
    
        
        
            
                "aql_level": 0,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "instructions": "Measure bore, concentricity, and bearing seat depth",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "plan_code": "IP-FIN-MTR",
            
        
    
        
        
            
                "name": "Final Motor Inspection",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "audit",
            
        
    
        
        
            
                "sampling_method": "aql",
            
        
    
        
        
            
                "aql_level": 0,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "instructions": "Functional test and key dimensions 100 percent",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const QaInspectionsData = [
    
    {
    
        
        
            
                "inspection_number": "INSP-60001",
            
        
    
        
        
            
                "context": "final",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspected_at": new Date('2026-03-01T10:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "pass",
            
        
    
        
        
            
                "sample_size": 5,
            
        
    
        
        
            
                "defect_count": 0,
            
        
    
        
        
            
                "summary": "Cert verified and dimensions within tolerance",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "INSP-60002",
            
        
    
        
        
            
                "context": "final",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspected_at": new Date('2026-03-05T15:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "fail",
            
        
    
        
        
            
                "sample_size": 20,
            
        
    
        
        
            
                "defect_count": 0,
            
        
    
        
        
            
                "summary": "Packaging and rotation checks passed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "INSP-60003",
            
        
    
        
        
            
                "context": "receiving",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspected_at": new Date('2026-03-13T16:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "fail",
            
        
    
        
        
            
                "sample_size": 5,
            
        
    
        
        
            
                "defect_count": 1,
            
        
    
        
        
            
                "summary": "One unit marginal on surface finish, accepted with note",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "INSP-60004",
            
        
    
        
        
            
                "context": "in_process",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspected_at": new Date('2026-03-10T15:50:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "pass",
            
        
    
        
        
            
                "sample_size": 25,
            
        
    
        
        
            
                "defect_count": 0,
            
        
    
        
        
            
                "summary": "All units passed functional test",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const NonconformancesData = [
    
    {
    
        
        
            
                "ncr_number": "NCR-30001",
            
        
    
        
        
            
                "source": "in_process",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "major",
            
        
    
        
        
            
                "status": "corrective_action",
            
        
    
        
        
            
                "reported_at": new Date('2026-03-08T10:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Bore size out of tolerance on sample units",
            
        
    
        
        
            
                "containment_action": "Move lot to QA Hold and block usage",
            
        
    
        
        
            
                "disposition": "rework",
            
        
    
        
        
            
                "due_at": new Date('2026-03-18T00:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "NCR-30002",
            
        
    
        
        
            
                "source": "in_process",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "status": "corrective_action",
            
        
    
        
        
            
                "reported_at": new Date('2026-03-13T16:15:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Surface finish marginal on one unit",
            
        
    
        
        
            
                "containment_action": "Tag unit for additional polishing check",
            
        
    
        
        
            
                "disposition": "use_as_is",
            
        
    
        
        
            
                "due_at": new Date('2026-03-20T00:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "NCR-30003",
            
        
    
        
        
            
                "source": "final",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "minor",
            
        
    
        
        
            
                "status": "investigation",
            
        
    
        
        
            
                "reported_at": new Date('2026-03-10T16:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Label alignment inconsistent on two units",
            
        
    
        
        
            
                "containment_action": "Re-label affected units before shipment",
            
        
    
        
        
            
                "disposition": "rework",
            
        
    
        
        
            
                "due_at": new Date('2026-03-12T00:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-11T14:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "NCR-30004",
            
        
    
        
        
            
                "source": "audit",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "major",
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "reported_at": new Date('2026-03-14T11:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Torque record missing for one assembly station",
            
        
    
        
        
            
                "containment_action": "Verify torque on in-process units and retrain operator",
            
        
    
        
        
            
                "disposition": "rework",
            
        
    
        
        
            
                "due_at": new Date('2026-03-24T00:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const CapaActionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "capa_number": "CAPA-40001",
            
        
    
        
        
            
                "action_type": "preventive",
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "root_cause": "Tool wear not detected during setup verification",
            
        
    
        
        
            
                "action_plan": "Add tool wear check to setup checklist and SPC sampling",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-25T00:00:00Z'),
            
        
    
        
        
            
                "implemented_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "verified_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "capa_number": "CAPA-40002",
            
        
    
        
        
            
                "action_type": "corrective",
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "root_cause": "Work instruction did not specify torque record retention",
            
        
    
        
        
            
                "action_plan": "Update WI and add digital torque log requirement",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-04-05T00:00:00Z'),
            
        
    
        
        
            
                "implemented_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "verified_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "capa_number": "CAPA-40003",
            
        
    
        
        
            
                "action_type": "preventive",
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "root_cause": "Possible bearing press depth variation on one station",
            
        
    
        
        
            
                "action_plan": "Calibrate press fixture and add go-no-go check",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-30T00:00:00Z'),
            
        
    
        
        
            
                "implemented_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "verified_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "capa_number": "CAPA-40004",
            
        
    
        
        
            
                "action_type": "corrective",
            
        
    
        
        
            
                "status": "verified",
            
        
    
        
        
            
                "root_cause": "Deburr step inconsistent between shifts",
            
        
    
        
        
            
                "action_plan": "Standardize deburr tools and add training signoff",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-28T00:00:00Z'),
            
        
    
        
        
            
                "implemented_at": new Date('2026-03-15T10:30:00Z'),
            
        
    
        
        
            
                "verified_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const MaintenanceWorkOrdersData = [
    
    {
    
        
        
            
                "work_order_number": "MWO-50001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "corrective",
            
        
    
        
        
            
                "priority": "critical",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-09T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-10T08:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-10T12:00:00Z'),
            
        
    
        
        
            
                "started_at": new Date('2026-03-10T08:15:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Annual calibration and cert update",
            
        
    
        
        
            
                "resolution": "Calibration in progress with vendor",
            
        
    
        
        
            
                "downtime_minutes": 240,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "MWO-50002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "preventive",
            
        
    
        
        
            
                "priority": "critical",
            
        
    
        
        
            
                "status": "requested",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-12T14:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-16T09:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-16T11:00:00Z'),
            
        
    
        
        
            
                "started_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Replace printhead and run test labels",
            
        
    
        
        
            
                "resolution": "Awaiting parts delivery",
            
        
    
        
        
            
                "downtime_minutes": 120,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "MWO-50003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "corrective",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "status": "requested",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-01T08:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-02T07:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-02T10:00:00Z'),
            
        
    
        
        
            
                "started_at": new Date('2026-03-02T07:05:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-02T09:40:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "PM: lubrication, filters, and inspection",
            
        
    
        
        
            
                "resolution": "PM complete, no issues found",
            
        
    
        
        
            
                "downtime_minutes": 155,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "MWO-50004",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "corrective",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-13T10:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-17T07:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-17T11:00:00Z'),
            
        
    
        
        
            
                "started_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Investigate chatter and spindle vibration",
            
        
    
        
        
            
                "resolution": "Pending technician review",
            
        
    
        
        
            
                "downtime_minutes": 0,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const PurchaseOrdersData = [
    
    {
    
        
        
            
                "po_number": "PO-45012",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "order_date": new Date('2026-02-20T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 8730,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 8730,
            
        
    
        
        
            
                "notes": "Aluminum and steel replenishment",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "po_number": "PO-45018",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "order_date": new Date('2026-02-25T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-05T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 920,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 920,
            
        
    
        
        
            
                "notes": "Bearing stock for March builds",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "po_number": "PO-45025",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "order_date": new Date('2026-03-03T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-08T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 500,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 500,
            
        
    
        
        
            
                "notes": "Packaging inserts and molded parts",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "po_number": "PO-45031",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "order_date": new Date('2026-03-09T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-20T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 650,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 650,
            
        
    
        
        
            
                "notes": "Calibration service for CMM",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const PurchaseOrderLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 1800,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 4.85,
            
        
    
        
        
            
                "line_total": 8730,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Include mill cert",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 2,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 2400,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 2.35,
            
        
    
        
        
            
                "line_total": 5640,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Bundle packaging",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 800,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 1.15,
            
        
    
        
        
            
                "line_total": 920,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-05T00:00:00Z'),
            
        
    
        
        
            
                "notes": "COC required",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 40,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 12.5,
            
        
    
        
        
            
                "line_total": 500,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-08T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Inspect before release",
            
        
    
    },
    
];



const SalesOrdersData = [
    
    {
    
        
        
            
                "so_number": "SO-51002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "order_date": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "requested_ship_at": new Date('2026-03-15T00:00:00Z'),
            
        
    
        
        
            
                "promised_ship_at": new Date('2026-03-16T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 8750,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 8750,
            
        
    
        
        
            
                "notes": "Ship 25 units upon QA release",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "so_number": "SO-51003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "order_date": new Date('2026-03-10T00:00:00Z'),
            
        
    
        
        
            
                "requested_ship_at": new Date('2026-03-28T00:00:00Z'),
            
        
    
        
        
            
                "promised_ship_at": new Date('2026-03-29T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 17500,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 17500,
            
        
    
        
        
            
                "notes": "50 units for seasonal ramp-up",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "so_number": "SO-51004",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "order_date": new Date('2026-03-12T00:00:00Z'),
            
        
    
        
        
            
                "requested_ship_at": new Date('2026-03-25T00:00:00Z'),
            
        
    
        
        
            
                "promised_ship_at": new Date('2026-03-26T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 3500,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 3500,
            
        
    
        
        
            
                "notes": "10 units, include test report",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "so_number": "SO-51005",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "invoiced",
            
        
    
        
        
            
                "order_date": new Date('2026-03-14T00:00:00Z'),
            
        
    
        
        
            
                "requested_ship_at": new Date('2026-03-22T00:00:00Z'),
            
        
    
        
        
            
                "promised_ship_at": new Date('2026-03-23T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "subtotal": 5250,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 5250,
            
        
    
        
        
            
                "notes": "Packaging requirements: corner protection",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const SalesOrderLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 25,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 350,
            
        
    
        
        
            
                "discount_percent": 0,
            
        
    
        
        
            
                "line_total": 8750,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-15T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Standard labeling",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 50,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 350,
            
        
    
        
        
            
                "discount_percent": 0,
            
        
    
        
        
            
                "line_total": 17500,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-28T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Promise date based on MO-70014",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 10,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 350,
            
        
    
        
        
            
                "discount_percent": 0,
            
        
    
        
        
            
                "line_total": 3500,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-25T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Include inspection summary",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 15,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 350,
            
        
    
        
        
            
                "discount_percent": 0,
            
        
    
        
        
            
                "line_total": 5250,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-22T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Corner protection required",
            
        
    
    },
    
];



const ShipmentsData = [
    
    {
    
        
        
            
                "shipment_number": "SHP-70001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "returned",
            
        
    
        
        
            
                "packed_at": new Date('2026-03-16T09:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "carrier": "UPS Freight",
            
        
    
        
        
            
                "tracking_number": "1Z999AA10123456784",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ship_to_address": "500 Industrial Blvd, Chicago, IL",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "shipment_number": "SHP-70002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "returned",
            
        
    
        
        
            
                "packed_at": new Date('2026-03-20T10:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-03-20T14:00:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "carrier": "FedEx",
            
        
    
        
        
            
                "tracking_number": "789654123012",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ship_to_address": "77 Control Pkwy, Milwaukee, WI",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "shipment_number": "SHP-70003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "returned",
            
        
    
        
        
            
                "packed_at": new Date('2026-03-21T09:30:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "carrier": "DHL",
            
        
    
        
        
            
                "tracking_number": "JD014600006789012345",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ship_to_address": "900 Carton Ct, Rockford, IL",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "shipment_number": "SHP-70004",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "shipped",
            
        
    
        
        
            
                "packed_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-03-15T12:00:00Z'),
            
        
    
        
        
            
                "carrier": "N-A",
            
        
    
        
        
            
                "tracking_number": "N-A",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ship_to_address": "210 Vent Dr, Madison, WI",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ShipmentLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_shipped": 10,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 2,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_shipped": 15,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_shipped": 10,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_shipped": 15,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CostCentersData = [
    
    {
    
        
        
            
                "code": "CC-OPS",
            
        
    
        
        
            
                "name": "Operations",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Production and manufacturing overhead",
            
        
    
    },
    
    {
    
        
        
            
                "code": "CC-QA",
            
        
    
        
        
            
                "name": "Quality",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Quality assurance and compliance",
            
        
    
    },
    
    {
    
        
        
            
                "code": "CC-MAINT",
            
        
    
        
        
            
                "name": "Maintenance",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Equipment maintenance and repairs",
            
        
    
    },
    
    {
    
        
        
            
                "code": "CC-WH",
            
        
    
        
        
            
                "name": "Warehousing",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Warehouse labor and facilities",
            
        
    
    },
    
];



const CostElementsData = [
    
    {
    
        
        
            
                "code": "CE-MAT",
            
        
    
        
        
            
                "name": "Direct Materials",
            
        
    
        
        
            
                "element_type": "labor",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Raw and component costs",
            
        
    
    },
    
    {
    
        
        
            
                "code": "CE-LAB",
            
        
    
        
        
            
                "name": "Direct Labor",
            
        
    
        
        
            
                "element_type": "overhead",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Assembly and machining labor",
            
        
    
    },
    
    {
    
        
        
            
                "code": "CE-OH",
            
        
    
        
        
            
                "name": "Manufacturing Overhead",
            
        
    
        
        
            
                "element_type": "subcontract",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Utilities, rent, indirect labor",
            
        
    
    },
    
    {
    
        
        
            
                "code": "CE-SUB",
            
        
    
        
        
            
                "name": "Subcontract",
            
        
    
        
        
            
                "element_type": "subcontract",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "notes": "Outside processing and services",
            
        
    
    },
    
];



const StandardCostsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_version": "STD-2026-A",
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "material_cost": 140,
            
        
    
        
        
            
                "labor_cost": 55,
            
        
    
        
        
            
                "overhead_cost": 35,
            
        
    
        
        
            
                "subcontract_cost": 0,
            
        
    
        
        
            
                "total_cost": 230,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-01-10T14:00:00Z'),
            
        
    
        
        
            
                "notes": "Based on BOM rev A and routing rev A",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_version": "STD-2026-A",
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "material_cost": 16,
            
        
    
        
        
            
                "labor_cost": 18,
            
        
    
        
        
            
                "overhead_cost": 9,
            
        
    
        
        
            
                "subcontract_cost": 0,
            
        
    
        
        
            
                "total_cost": 43,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-01-10T14:30:00Z'),
            
        
    
        
        
            
                "notes": "Housing machining and press-fit",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_version": "STD-2026-A",
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "material_cost": 1.15,
            
        
    
        
        
            
                "labor_cost": 0,
            
        
    
        
        
            
                "overhead_cost": 0.05,
            
        
    
        
        
            
                "subcontract_cost": 0,
            
        
    
        
        
            
                "total_cost": 1.2,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-01-10T15:00:00Z'),
            
        
    
        
        
            
                "notes": "Includes inbound handling overhead",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_version": "STD-2026-A",
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "material_cost": 4.85,
            
        
    
        
        
            
                "labor_cost": 0,
            
        
    
        
        
            
                "overhead_cost": 0.1,
            
        
    
        
        
            
                "subcontract_cost": 0,
            
        
    
        
        
            
                "total_cost": 4.95,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-01-10T15:10:00Z'),
            
        
    
        
        
            
                "notes": "Per kilogram standard",
            
        
    
    },
    
];



const ProductionCostsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_method": "standard",
            
        
    
        
        
            
                "material_cost": 3550,
            
        
    
        
        
            
                "labor_cost": 1400,
            
        
    
        
        
            
                "overhead_cost": 900,
            
        
    
        
        
            
                "subcontract_cost": 0,
            
        
    
        
        
            
                "total_cost": 5850,
            
        
    
        
        
            
                "calculated_at": new Date('2026-03-11T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Actuals from issues and labor tickets",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_method": "standard",
            
        
    
        
        
            
                "material_cost": 3500,
            
        
    
        
        
            
                "labor_cost": 1375,
            
        
    
        
        
            
                "overhead_cost": 875,
            
        
    
        
        
            
                "subcontract_cost": 0,
            
        
    
        
        
            
                "total_cost": 5750,
            
        
    
        
        
            
                "calculated_at": new Date('2026-03-11T09:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Standard rollup comparison",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_method": "standard",
            
        
    
        
        
            
                "material_cost": 980,
            
        
    
        
        
            
                "labor_cost": 720,
            
        
    
        
        
            
                "overhead_cost": 420,
            
        
    
        
        
            
                "subcontract_cost": 0,
            
        
    
        
        
            
                "total_cost": 2120,
            
        
    
        
        
            
                "calculated_at": new Date('2026-03-14T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Partial actuals to date",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_method": "standard",
            
        
    
        
        
            
                "material_cost": 960,
            
        
    
        
        
            
                "labor_cost": 700,
            
        
    
        
        
            
                "overhead_cost": 400,
            
        
    
        
        
            
                "subcontract_cost": 0,
            
        
    
        
        
            
                "total_cost": 2060,
            
        
    
        
        
            
                "calculated_at": new Date('2026-03-14T09:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "WIP valuation standard",
            
        
    
    },
    
];



const PriceListsData = [
    
    {
    
        
        
            
                "code": "PL-STD-USD",
            
        
    
        
        
            
                "name": "Standard USD Price List",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Default pricing for most customers",
            
        
    
    },
    
    {
    
        
        
            
                "code": "PL-APEX-2026",
            
        
    
        
        
            
                "name": "Apex Contract Pricing 2026",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "effective_from": new Date('2026-01-15T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Contracted unit pricing",
            
        
    
    },
    
    {
    
        
        
            
                "code": "PL-RIVERBEND",
            
        
    
        
        
            
                "name": "Riverbend Small Batch Pricing",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "effective_from": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Higher price for low volume orders",
            
        
    
    },
    
    {
    
        
        
            
                "code": "PL-SUMMIT-Q2",
            
        
    
        
        
            
                "name": "Summit Q2 Promo",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "effective_from": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-06-30T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Proposed Q2 pricing",
            
        
    
    },
    
];



const PriceListLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 365,
            
        
    
        
        
            
                "min_quantity": 1,
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Standard price",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 350,
            
        
    
        
        
            
                "min_quantity": 10,
            
        
    
        
        
            
                "effective_from": new Date('2026-01-15T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Contract price for Apex",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 380,
            
        
    
        
        
            
                "min_quantity": 1,
            
        
    
        
        
            
                "effective_from": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Small batch premium",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 345,
            
        
    
        
        
            
                "min_quantity": 50,
            
        
    
        
        
            
                "effective_from": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-06-30T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Proposed promo pricing",
            
        
    
    },
    
];



const DocumentsData = [
    
    {
    
        
        
            
                "document_number": "DOC-1001",
            
        
    
        
        
            
                "title": "SOP Receiving Inspection",
            
        
    
        
        
            
                "category": "other",
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "revision": "2",
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-01-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-01-05T10:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "summary": "Defines steps for receiving inspection and record retention",
            
        
    
    },
    
    {
    
        
        
            
                "document_number": "DOC-1002",
            
        
    
        
        
            
                "title": "WI Motor Assembly 500W",
            
        
    
        
        
            
                "category": "specification",
            
        
    
        
        
            
                "status": "obsolete",
            
        
    
        
        
            
                "revision": "3",
            
        
    
        
        
            
                "effective_from": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-02-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-02-02T11:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "summary": "Assembly sequence and torque specifications for FG-MTR-500",
            
        
    
    },
    
    {
    
        
        
            
                "document_number": "DOC-1003",
            
        
    
        
        
            
                "title": "Drawing Housing Assembly HSG100",
            
        
    
        
        
            
                "category": "work_instruction",
            
        
    
        
        
            
                "status": "obsolete",
            
        
    
        
        
            
                "revision": "B",
            
        
    
        
        
            
                "effective_from": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2028-02-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-02-03T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "summary": "Dimensional drawing and tolerances for SUB-HSG-100",
            
        
    
    },
    
    {
    
        
        
            
                "document_number": "DOC-1004",
            
        
    
        
        
            
                "title": "Quality Policy",
            
        
    
        
        
            
                "category": "certificate",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "revision": "1",
            
        
    
        
        
            
                "effective_from": new Date('2025-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-01-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2025-01-02T08:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "summary": "Quality objectives and responsibilities across the plant",
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
            
            async function associateItemWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item0 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Item0?.setUom)
                {
                    await
                    Item0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item1 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Item1?.setUom)
                {
                    await
                    Item1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item2 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Item2?.setUom)
                {
                    await
                    Item2.
                    setUom(relatedUom2);
                }
            
                const relatedUom3 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item3 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Item3?.setUom)
                {
                    await
                    Item3.
                    setUom(relatedUom3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateItemSupplierLinkWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ItemSupplierLink0 = await ItemSupplierLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ItemSupplierLink0?.setItem)
                {
                    await
                    ItemSupplierLink0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ItemSupplierLink1 = await ItemSupplierLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ItemSupplierLink1?.setItem)
                {
                    await
                    ItemSupplierLink1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ItemSupplierLink2 = await ItemSupplierLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ItemSupplierLink2?.setItem)
                {
                    await
                    ItemSupplierLink2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ItemSupplierLink3 = await ItemSupplierLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ItemSupplierLink3?.setItem)
                {
                    await
                    ItemSupplierLink3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
            
            async function associateItemSupplierLinkWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const ItemSupplierLink0 = await ItemSupplierLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ItemSupplierLink0?.setSupplier)
                {
                    await
                    ItemSupplierLink0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const ItemSupplierLink1 = await ItemSupplierLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ItemSupplierLink1?.setSupplier)
                {
                    await
                    ItemSupplierLink1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const ItemSupplierLink2 = await ItemSupplierLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ItemSupplierLink2?.setSupplier)
                {
                    await
                    ItemSupplierLink2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const ItemSupplierLink3 = await ItemSupplierLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ItemSupplierLink3?.setSupplier)
                {
                    await
                    ItemSupplierLink3.
                    setSupplier(relatedSupplier3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateLocationWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Location0 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Location0?.setWarehouse)
                {
                    await
                    Location0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Location1 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Location1?.setWarehouse)
                {
                    await
                    Location1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Location2 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Location2?.setWarehouse)
                {
                    await
                    Location2.
                    setWarehouse(relatedWarehouse2);
                }
            
                const relatedWarehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Location3 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Location3?.setWarehouse)
                {
                    await
                    Location3.
                    setWarehouse(relatedWarehouse3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateInventoryLotWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryLot0 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryLot0?.setItem)
                {
                    await
                    InventoryLot0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryLot1 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryLot1?.setItem)
                {
                    await
                    InventoryLot1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryLot2 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryLot2?.setItem)
                {
                    await
                    InventoryLot2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryLot3 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryLot3?.setItem)
                {
                    await
                    InventoryLot3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
    
        
            
            async function associateInventoryLotWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryLot0 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryLot0?.setSupplier)
                {
                    await
                    InventoryLot0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryLot1 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryLot1?.setSupplier)
                {
                    await
                    InventoryLot1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryLot2 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryLot2?.setSupplier)
                {
                    await
                    InventoryLot2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryLot3 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryLot3?.setSupplier)
                {
                    await
                    InventoryLot3.
                    setSupplier(relatedSupplier3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateInventoryBalanceWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setItem)
                {
                    await
                    InventoryBalance0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setItem)
                {
                    await
                    InventoryBalance1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setItem)
                {
                    await
                    InventoryBalance2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setItem)
                {
                    await
                    InventoryBalance3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
            
            async function associateInventoryBalanceWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setLocation)
                {
                    await
                    InventoryBalance0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setLocation)
                {
                    await
                    InventoryBalance1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setLocation)
                {
                    await
                    InventoryBalance2.
                    setLocation(relatedLocation2);
                }
            
                const relatedLocation3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setLocation)
                {
                    await
                    InventoryBalance3.
                    setLocation(relatedLocation3);
                }
            
        }
        
    
        
            
            async function associateInventoryBalanceWithLot() {
            
                const relatedLot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setLot)
                {
                    await
                    InventoryBalance0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setLot)
                {
                    await
                    InventoryBalance1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setLot)
                {
                    await
                    InventoryBalance2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setLot)
                {
                    await
                    InventoryBalance3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateInventoryTransactionWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setItem)
                {
                    await
                    InventoryTransaction0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setItem)
                {
                    await
                    InventoryTransaction1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setItem)
                {
                    await
                    InventoryTransaction2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setItem)
                {
                    await
                    InventoryTransaction3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithLot() {
            
                const relatedLot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setLot)
                {
                    await
                    InventoryTransaction0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setLot)
                {
                    await
                    InventoryTransaction1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setLot)
                {
                    await
                    InventoryTransaction2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setLot)
                {
                    await
                    InventoryTransaction3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithFrom_location() {
            
                const relatedFrom_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setFrom_location)
                {
                    await
                    InventoryTransaction0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setFrom_location)
                {
                    await
                    InventoryTransaction1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setFrom_location)
                {
                    await
                    InventoryTransaction2.
                    setFrom_location(relatedFrom_location2);
                }
            
                const relatedFrom_location3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setFrom_location)
                {
                    await
                    InventoryTransaction3.
                    setFrom_location(relatedFrom_location3);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithTo_location() {
            
                const relatedTo_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setTo_location)
                {
                    await
                    InventoryTransaction0.
                    setTo_location(relatedTo_location0);
                }
            
                const relatedTo_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setTo_location)
                {
                    await
                    InventoryTransaction1.
                    setTo_location(relatedTo_location1);
                }
            
                const relatedTo_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setTo_location)
                {
                    await
                    InventoryTransaction2.
                    setTo_location(relatedTo_location2);
                }
            
                const relatedTo_location3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setTo_location)
                {
                    await
                    InventoryTransaction3.
                    setTo_location(relatedTo_location3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateInventoryTransactionWithPerformed_by() {
            
                const relatedPerformed_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setPerformed_by)
                {
                    await
                    InventoryTransaction0.
                    setPerformed_by(relatedPerformed_by0);
                }
            
                const relatedPerformed_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setPerformed_by)
                {
                    await
                    InventoryTransaction1.
                    setPerformed_by(relatedPerformed_by1);
                }
            
                const relatedPerformed_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setPerformed_by)
                {
                    await
                    InventoryTransaction2.
                    setPerformed_by(relatedPerformed_by2);
                }
            
                const relatedPerformed_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setPerformed_by)
                {
                    await
                    InventoryTransaction3.
                    setPerformed_by(relatedPerformed_by3);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateBomHeaderWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomHeader0 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomHeader0?.setItem)
                {
                    await
                    BomHeader0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomHeader1 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomHeader1?.setItem)
                {
                    await
                    BomHeader1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomHeader2 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomHeader2?.setItem)
                {
                    await
                    BomHeader2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomHeader3 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomHeader3?.setItem)
                {
                    await
                    BomHeader3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateBomHeaderWithApproved_by() {
            
                const relatedApproved_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const BomHeader0 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomHeader0?.setApproved_by)
                {
                    await
                    BomHeader0.
                    setApproved_by(relatedApproved_by0);
                }
            
                const relatedApproved_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const BomHeader1 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomHeader1?.setApproved_by)
                {
                    await
                    BomHeader1.
                    setApproved_by(relatedApproved_by1);
                }
            
                const relatedApproved_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const BomHeader2 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomHeader2?.setApproved_by)
                {
                    await
                    BomHeader2.
                    setApproved_by(relatedApproved_by2);
                }
            
                const relatedApproved_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const BomHeader3 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomHeader3?.setApproved_by)
                {
                    await
                    BomHeader3.
                    setApproved_by(relatedApproved_by3);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateBomLineWithBom_header() {
            
                const relatedBom_header0 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const BomLine0 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomLine0?.setBom_header)
                {
                    await
                    BomLine0.
                    setBom_header(relatedBom_header0);
                }
            
                const relatedBom_header1 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const BomLine1 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomLine1?.setBom_header)
                {
                    await
                    BomLine1.
                    setBom_header(relatedBom_header1);
                }
            
                const relatedBom_header2 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const BomLine2 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomLine2?.setBom_header)
                {
                    await
                    BomLine2.
                    setBom_header(relatedBom_header2);
                }
            
                const relatedBom_header3 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const BomLine3 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomLine3?.setBom_header)
                {
                    await
                    BomLine3.
                    setBom_header(relatedBom_header3);
                }
            
        }
        
    
        
    
        
            
            async function associateBomLineWithComponent_item() {
            
                const relatedComponent_item0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine0 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomLine0?.setComponent_item)
                {
                    await
                    BomLine0.
                    setComponent_item(relatedComponent_item0);
                }
            
                const relatedComponent_item1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine1 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomLine1?.setComponent_item)
                {
                    await
                    BomLine1.
                    setComponent_item(relatedComponent_item1);
                }
            
                const relatedComponent_item2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine2 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomLine2?.setComponent_item)
                {
                    await
                    BomLine2.
                    setComponent_item(relatedComponent_item2);
                }
            
                const relatedComponent_item3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine3 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomLine3?.setComponent_item)
                {
                    await
                    BomLine3.
                    setComponent_item(relatedComponent_item3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateBomLineWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const BomLine0 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomLine0?.setUom)
                {
                    await
                    BomLine0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const BomLine1 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomLine1?.setUom)
                {
                    await
                    BomLine1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const BomLine2 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomLine2?.setUom)
                {
                    await
                    BomLine2.
                    setUom(relatedUom2);
                }
            
                const relatedUom3 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const BomLine3 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomLine3?.setUom)
                {
                    await
                    BomLine3.
                    setUom(relatedUom3);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateMachineWithWork_center() {
            
                const relatedWork_center0 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const Machine0 = await Machines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Machine0?.setWork_center)
                {
                    await
                    Machine0.
                    setWork_center(relatedWork_center0);
                }
            
                const relatedWork_center1 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const Machine1 = await Machines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Machine1?.setWork_center)
                {
                    await
                    Machine1.
                    setWork_center(relatedWork_center1);
                }
            
                const relatedWork_center2 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const Machine2 = await Machines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Machine2?.setWork_center)
                {
                    await
                    Machine2.
                    setWork_center(relatedWork_center2);
                }
            
                const relatedWork_center3 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const Machine3 = await Machines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Machine3?.setWork_center)
                {
                    await
                    Machine3.
                    setWork_center(relatedWork_center3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateRoutingHeaderWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const RoutingHeader0 = await RoutingHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoutingHeader0?.setItem)
                {
                    await
                    RoutingHeader0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const RoutingHeader1 = await RoutingHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoutingHeader1?.setItem)
                {
                    await
                    RoutingHeader1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const RoutingHeader2 = await RoutingHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoutingHeader2?.setItem)
                {
                    await
                    RoutingHeader2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const RoutingHeader3 = await RoutingHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoutingHeader3?.setItem)
                {
                    await
                    RoutingHeader3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateRoutingHeaderWithApproved_by() {
            
                const relatedApproved_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RoutingHeader0 = await RoutingHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoutingHeader0?.setApproved_by)
                {
                    await
                    RoutingHeader0.
                    setApproved_by(relatedApproved_by0);
                }
            
                const relatedApproved_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RoutingHeader1 = await RoutingHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoutingHeader1?.setApproved_by)
                {
                    await
                    RoutingHeader1.
                    setApproved_by(relatedApproved_by1);
                }
            
                const relatedApproved_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RoutingHeader2 = await RoutingHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoutingHeader2?.setApproved_by)
                {
                    await
                    RoutingHeader2.
                    setApproved_by(relatedApproved_by2);
                }
            
                const relatedApproved_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RoutingHeader3 = await RoutingHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoutingHeader3?.setApproved_by)
                {
                    await
                    RoutingHeader3.
                    setApproved_by(relatedApproved_by3);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateRoutingOperationWithRouting_header() {
            
                const relatedRouting_header0 = await RoutingHeaders.findOne({
                    offset: Math.floor(Math.random() * (await RoutingHeaders.count())),
                });
                const RoutingOperation0 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoutingOperation0?.setRouting_header)
                {
                    await
                    RoutingOperation0.
                    setRouting_header(relatedRouting_header0);
                }
            
                const relatedRouting_header1 = await RoutingHeaders.findOne({
                    offset: Math.floor(Math.random() * (await RoutingHeaders.count())),
                });
                const RoutingOperation1 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoutingOperation1?.setRouting_header)
                {
                    await
                    RoutingOperation1.
                    setRouting_header(relatedRouting_header1);
                }
            
                const relatedRouting_header2 = await RoutingHeaders.findOne({
                    offset: Math.floor(Math.random() * (await RoutingHeaders.count())),
                });
                const RoutingOperation2 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoutingOperation2?.setRouting_header)
                {
                    await
                    RoutingOperation2.
                    setRouting_header(relatedRouting_header2);
                }
            
                const relatedRouting_header3 = await RoutingHeaders.findOne({
                    offset: Math.floor(Math.random() * (await RoutingHeaders.count())),
                });
                const RoutingOperation3 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoutingOperation3?.setRouting_header)
                {
                    await
                    RoutingOperation3.
                    setRouting_header(relatedRouting_header3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateRoutingOperationWithWork_center() {
            
                const relatedWork_center0 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingOperation0 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoutingOperation0?.setWork_center)
                {
                    await
                    RoutingOperation0.
                    setWork_center(relatedWork_center0);
                }
            
                const relatedWork_center1 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingOperation1 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoutingOperation1?.setWork_center)
                {
                    await
                    RoutingOperation1.
                    setWork_center(relatedWork_center1);
                }
            
                const relatedWork_center2 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingOperation2 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoutingOperation2?.setWork_center)
                {
                    await
                    RoutingOperation2.
                    setWork_center(relatedWork_center2);
                }
            
                const relatedWork_center3 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingOperation3 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoutingOperation3?.setWork_center)
                {
                    await
                    RoutingOperation3.
                    setWork_center(relatedWork_center3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateProductionOrderWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setItem)
                {
                    await
                    ProductionOrder0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setItem)
                {
                    await
                    ProductionOrder1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setItem)
                {
                    await
                    ProductionOrder2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setItem)
                {
                    await
                    ProductionOrder3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductionOrderWithBom() {
            
                const relatedBom0 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setBom)
                {
                    await
                    ProductionOrder0.
                    setBom(relatedBom0);
                }
            
                const relatedBom1 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setBom)
                {
                    await
                    ProductionOrder1.
                    setBom(relatedBom1);
                }
            
                const relatedBom2 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setBom)
                {
                    await
                    ProductionOrder2.
                    setBom(relatedBom2);
                }
            
                const relatedBom3 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setBom)
                {
                    await
                    ProductionOrder3.
                    setBom(relatedBom3);
                }
            
        }
        
    
        
            
            async function associateProductionOrderWithRouting() {
            
                const relatedRouting0 = await RoutingHeaders.findOne({
                    offset: Math.floor(Math.random() * (await RoutingHeaders.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setRouting)
                {
                    await
                    ProductionOrder0.
                    setRouting(relatedRouting0);
                }
            
                const relatedRouting1 = await RoutingHeaders.findOne({
                    offset: Math.floor(Math.random() * (await RoutingHeaders.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setRouting)
                {
                    await
                    ProductionOrder1.
                    setRouting(relatedRouting1);
                }
            
                const relatedRouting2 = await RoutingHeaders.findOne({
                    offset: Math.floor(Math.random() * (await RoutingHeaders.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setRouting)
                {
                    await
                    ProductionOrder2.
                    setRouting(relatedRouting2);
                }
            
                const relatedRouting3 = await RoutingHeaders.findOne({
                    offset: Math.floor(Math.random() * (await RoutingHeaders.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setRouting)
                {
                    await
                    ProductionOrder3.
                    setRouting(relatedRouting3);
                }
            
        }
        
    
        
            
            async function associateProductionOrderWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setWarehouse)
                {
                    await
                    ProductionOrder0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setWarehouse)
                {
                    await
                    ProductionOrder1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setWarehouse)
                {
                    await
                    ProductionOrder2.
                    setWarehouse(relatedWarehouse2);
                }
            
                const relatedWarehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setWarehouse)
                {
                    await
                    ProductionOrder3.
                    setWarehouse(relatedWarehouse3);
                }
            
        }
        
    
        
    
        
            
            async function associateProductionOrderWithCreated_by_user() {
            
                const relatedCreated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setCreated_by_user)
                {
                    await
                    ProductionOrder0.
                    setCreated_by_user(relatedCreated_by_user0);
                }
            
                const relatedCreated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setCreated_by_user)
                {
                    await
                    ProductionOrder1.
                    setCreated_by_user(relatedCreated_by_user1);
                }
            
                const relatedCreated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setCreated_by_user)
                {
                    await
                    ProductionOrder2.
                    setCreated_by_user(relatedCreated_by_user2);
                }
            
                const relatedCreated_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setCreated_by_user)
                {
                    await
                    ProductionOrder3.
                    setCreated_by_user(relatedCreated_by_user3);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateProductionOperationWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionOperation0 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOperation0?.setProduction_order)
                {
                    await
                    ProductionOperation0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionOperation1 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOperation1?.setProduction_order)
                {
                    await
                    ProductionOperation1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionOperation2 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOperation2?.setProduction_order)
                {
                    await
                    ProductionOperation2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionOperation3 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOperation3?.setProduction_order)
                {
                    await
                    ProductionOperation3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
    
        
            
            async function associateProductionOperationWithRouting_operation() {
            
                const relatedRouting_operation0 = await RoutingOperations.findOne({
                    offset: Math.floor(Math.random() * (await RoutingOperations.count())),
                });
                const ProductionOperation0 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOperation0?.setRouting_operation)
                {
                    await
                    ProductionOperation0.
                    setRouting_operation(relatedRouting_operation0);
                }
            
                const relatedRouting_operation1 = await RoutingOperations.findOne({
                    offset: Math.floor(Math.random() * (await RoutingOperations.count())),
                });
                const ProductionOperation1 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOperation1?.setRouting_operation)
                {
                    await
                    ProductionOperation1.
                    setRouting_operation(relatedRouting_operation1);
                }
            
                const relatedRouting_operation2 = await RoutingOperations.findOne({
                    offset: Math.floor(Math.random() * (await RoutingOperations.count())),
                });
                const ProductionOperation2 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOperation2?.setRouting_operation)
                {
                    await
                    ProductionOperation2.
                    setRouting_operation(relatedRouting_operation2);
                }
            
                const relatedRouting_operation3 = await RoutingOperations.findOne({
                    offset: Math.floor(Math.random() * (await RoutingOperations.count())),
                });
                const ProductionOperation3 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOperation3?.setRouting_operation)
                {
                    await
                    ProductionOperation3.
                    setRouting_operation(relatedRouting_operation3);
                }
            
        }
        
    
        
            
            async function associateProductionOperationWithWork_center() {
            
                const relatedWork_center0 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOperation0 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOperation0?.setWork_center)
                {
                    await
                    ProductionOperation0.
                    setWork_center(relatedWork_center0);
                }
            
                const relatedWork_center1 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOperation1 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOperation1?.setWork_center)
                {
                    await
                    ProductionOperation1.
                    setWork_center(relatedWork_center1);
                }
            
                const relatedWork_center2 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOperation2 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOperation2?.setWork_center)
                {
                    await
                    ProductionOperation2.
                    setWork_center(relatedWork_center2);
                }
            
                const relatedWork_center3 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOperation3 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOperation3?.setWork_center)
                {
                    await
                    ProductionOperation3.
                    setWork_center(relatedWork_center3);
                }
            
        }
        
    
        
            
            async function associateProductionOperationWithMachine() {
            
                const relatedMachine0 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const ProductionOperation0 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOperation0?.setMachine)
                {
                    await
                    ProductionOperation0.
                    setMachine(relatedMachine0);
                }
            
                const relatedMachine1 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const ProductionOperation1 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOperation1?.setMachine)
                {
                    await
                    ProductionOperation1.
                    setMachine(relatedMachine1);
                }
            
                const relatedMachine2 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const ProductionOperation2 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOperation2?.setMachine)
                {
                    await
                    ProductionOperation2.
                    setMachine(relatedMachine2);
                }
            
                const relatedMachine3 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const ProductionOperation3 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOperation3?.setMachine)
                {
                    await
                    ProductionOperation3.
                    setMachine(relatedMachine3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductionOperationWithPerformed_by() {
            
                const relatedPerformed_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOperation0 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOperation0?.setPerformed_by)
                {
                    await
                    ProductionOperation0.
                    setPerformed_by(relatedPerformed_by0);
                }
            
                const relatedPerformed_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOperation1 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOperation1?.setPerformed_by)
                {
                    await
                    ProductionOperation1.
                    setPerformed_by(relatedPerformed_by1);
                }
            
                const relatedPerformed_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOperation2 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOperation2?.setPerformed_by)
                {
                    await
                    ProductionOperation2.
                    setPerformed_by(relatedPerformed_by2);
                }
            
                const relatedPerformed_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOperation3 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOperation3?.setPerformed_by)
                {
                    await
                    ProductionOperation3.
                    setPerformed_by(relatedPerformed_by3);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
            
            async function associateMaterialIssueWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const MaterialIssue0 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssue0?.setProduction_order)
                {
                    await
                    MaterialIssue0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const MaterialIssue1 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssue1?.setProduction_order)
                {
                    await
                    MaterialIssue1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const MaterialIssue2 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssue2?.setProduction_order)
                {
                    await
                    MaterialIssue2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const MaterialIssue3 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialIssue3?.setProduction_order)
                {
                    await
                    MaterialIssue3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
            
            async function associateMaterialIssueWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialIssue0 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssue0?.setItem)
                {
                    await
                    MaterialIssue0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialIssue1 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssue1?.setItem)
                {
                    await
                    MaterialIssue1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialIssue2 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssue2?.setItem)
                {
                    await
                    MaterialIssue2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialIssue3 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialIssue3?.setItem)
                {
                    await
                    MaterialIssue3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
            
            async function associateMaterialIssueWithLot() {
            
                const relatedLot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const MaterialIssue0 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssue0?.setLot)
                {
                    await
                    MaterialIssue0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const MaterialIssue1 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssue1?.setLot)
                {
                    await
                    MaterialIssue1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const MaterialIssue2 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssue2?.setLot)
                {
                    await
                    MaterialIssue2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const MaterialIssue3 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialIssue3?.setLot)
                {
                    await
                    MaterialIssue3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
            
            async function associateMaterialIssueWithFrom_location() {
            
                const relatedFrom_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const MaterialIssue0 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssue0?.setFrom_location)
                {
                    await
                    MaterialIssue0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const MaterialIssue1 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssue1?.setFrom_location)
                {
                    await
                    MaterialIssue1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const MaterialIssue2 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssue2?.setFrom_location)
                {
                    await
                    MaterialIssue2.
                    setFrom_location(relatedFrom_location2);
                }
            
                const relatedFrom_location3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const MaterialIssue3 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialIssue3?.setFrom_location)
                {
                    await
                    MaterialIssue3.
                    setFrom_location(relatedFrom_location3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateMaterialIssueWithIssued_by() {
            
                const relatedIssued_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaterialIssue0 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssue0?.setIssued_by)
                {
                    await
                    MaterialIssue0.
                    setIssued_by(relatedIssued_by0);
                }
            
                const relatedIssued_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaterialIssue1 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssue1?.setIssued_by)
                {
                    await
                    MaterialIssue1.
                    setIssued_by(relatedIssued_by1);
                }
            
                const relatedIssued_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaterialIssue2 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssue2?.setIssued_by)
                {
                    await
                    MaterialIssue2.
                    setIssued_by(relatedIssued_by2);
                }
            
                const relatedIssued_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaterialIssue3 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialIssue3?.setIssued_by)
                {
                    await
                    MaterialIssue3.
                    setIssued_by(relatedIssued_by3);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
            
            async function associateProductionReceiptWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionReceipt0 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionReceipt0?.setProduction_order)
                {
                    await
                    ProductionReceipt0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionReceipt1 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionReceipt1?.setProduction_order)
                {
                    await
                    ProductionReceipt1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionReceipt2 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionReceipt2?.setProduction_order)
                {
                    await
                    ProductionReceipt2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionReceipt3 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionReceipt3?.setProduction_order)
                {
                    await
                    ProductionReceipt3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
            
            async function associateProductionReceiptWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ProductionReceipt0 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionReceipt0?.setItem)
                {
                    await
                    ProductionReceipt0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ProductionReceipt1 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionReceipt1?.setItem)
                {
                    await
                    ProductionReceipt1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ProductionReceipt2 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionReceipt2?.setItem)
                {
                    await
                    ProductionReceipt2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ProductionReceipt3 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionReceipt3?.setItem)
                {
                    await
                    ProductionReceipt3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
            
            async function associateProductionReceiptWithTo_location() {
            
                const relatedTo_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const ProductionReceipt0 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionReceipt0?.setTo_location)
                {
                    await
                    ProductionReceipt0.
                    setTo_location(relatedTo_location0);
                }
            
                const relatedTo_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const ProductionReceipt1 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionReceipt1?.setTo_location)
                {
                    await
                    ProductionReceipt1.
                    setTo_location(relatedTo_location1);
                }
            
                const relatedTo_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const ProductionReceipt2 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionReceipt2?.setTo_location)
                {
                    await
                    ProductionReceipt2.
                    setTo_location(relatedTo_location2);
                }
            
                const relatedTo_location3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const ProductionReceipt3 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionReceipt3?.setTo_location)
                {
                    await
                    ProductionReceipt3.
                    setTo_location(relatedTo_location3);
                }
            
        }
        
    
        
            
            async function associateProductionReceiptWithLot() {
            
                const relatedLot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ProductionReceipt0 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionReceipt0?.setLot)
                {
                    await
                    ProductionReceipt0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ProductionReceipt1 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionReceipt1?.setLot)
                {
                    await
                    ProductionReceipt1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ProductionReceipt2 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionReceipt2?.setLot)
                {
                    await
                    ProductionReceipt2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ProductionReceipt3 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionReceipt3?.setLot)
                {
                    await
                    ProductionReceipt3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateProductionReceiptWithReceived_by() {
            
                const relatedReceived_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionReceipt0 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionReceipt0?.setReceived_by)
                {
                    await
                    ProductionReceipt0.
                    setReceived_by(relatedReceived_by0);
                }
            
                const relatedReceived_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionReceipt1 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionReceipt1?.setReceived_by)
                {
                    await
                    ProductionReceipt1.
                    setReceived_by(relatedReceived_by1);
                }
            
                const relatedReceived_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionReceipt2 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionReceipt2?.setReceived_by)
                {
                    await
                    ProductionReceipt2.
                    setReceived_by(relatedReceived_by2);
                }
            
                const relatedReceived_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionReceipt3 = await ProductionReceipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionReceipt3?.setReceived_by)
                {
                    await
                    ProductionReceipt3.
                    setReceived_by(relatedReceived_by3);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateQaInspectionPlanWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QaInspectionPlan0 = await QaInspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspectionPlan0?.setItem)
                {
                    await
                    QaInspectionPlan0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QaInspectionPlan1 = await QaInspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspectionPlan1?.setItem)
                {
                    await
                    QaInspectionPlan1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QaInspectionPlan2 = await QaInspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspectionPlan2?.setItem)
                {
                    await
                    QaInspectionPlan2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QaInspectionPlan3 = await QaInspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspectionPlan3?.setItem)
                {
                    await
                    QaInspectionPlan3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateQaInspectionWithPlan() {
            
                const relatedPlan0 = await QaInspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setPlan)
                {
                    await
                    QaInspection0.
                    setPlan(relatedPlan0);
                }
            
                const relatedPlan1 = await QaInspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setPlan)
                {
                    await
                    QaInspection1.
                    setPlan(relatedPlan1);
                }
            
                const relatedPlan2 = await QaInspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setPlan)
                {
                    await
                    QaInspection2.
                    setPlan(relatedPlan2);
                }
            
                const relatedPlan3 = await QaInspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
                });
                const QaInspection3 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspection3?.setPlan)
                {
                    await
                    QaInspection3.
                    setPlan(relatedPlan3);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setItem)
                {
                    await
                    QaInspection0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setItem)
                {
                    await
                    QaInspection1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setItem)
                {
                    await
                    QaInspection2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QaInspection3 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspection3?.setItem)
                {
                    await
                    QaInspection3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithLot() {
            
                const relatedLot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setLot)
                {
                    await
                    QaInspection0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setLot)
                {
                    await
                    QaInspection1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setLot)
                {
                    await
                    QaInspection2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QaInspection3 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspection3?.setLot)
                {
                    await
                    QaInspection3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setProduction_order)
                {
                    await
                    QaInspection0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setProduction_order)
                {
                    await
                    QaInspection1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setProduction_order)
                {
                    await
                    QaInspection2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QaInspection3 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspection3?.setProduction_order)
                {
                    await
                    QaInspection3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithOperation() {
            
                const relatedOperation0 = await ProductionOperations.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOperations.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setOperation)
                {
                    await
                    QaInspection0.
                    setOperation(relatedOperation0);
                }
            
                const relatedOperation1 = await ProductionOperations.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOperations.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setOperation)
                {
                    await
                    QaInspection1.
                    setOperation(relatedOperation1);
                }
            
                const relatedOperation2 = await ProductionOperations.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOperations.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setOperation)
                {
                    await
                    QaInspection2.
                    setOperation(relatedOperation2);
                }
            
                const relatedOperation3 = await ProductionOperations.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOperations.count())),
                });
                const QaInspection3 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspection3?.setOperation)
                {
                    await
                    QaInspection3.
                    setOperation(relatedOperation3);
                }
            
        }
        
    
        
    
        
            
            async function associateQaInspectionWithInspector() {
            
                const relatedInspector0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setInspector)
                {
                    await
                    QaInspection0.
                    setInspector(relatedInspector0);
                }
            
                const relatedInspector1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setInspector)
                {
                    await
                    QaInspection1.
                    setInspector(relatedInspector1);
                }
            
                const relatedInspector2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setInspector)
                {
                    await
                    QaInspection2.
                    setInspector(relatedInspector2);
                }
            
                const relatedInspector3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaInspection3 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspection3?.setInspector)
                {
                    await
                    QaInspection3.
                    setInspector(relatedInspector3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateNonconformanceWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setItem)
                {
                    await
                    Nonconformance0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setItem)
                {
                    await
                    Nonconformance1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setItem)
                {
                    await
                    Nonconformance2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setItem)
                {
                    await
                    Nonconformance3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithLot() {
            
                const relatedLot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setLot)
                {
                    await
                    Nonconformance0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setLot)
                {
                    await
                    Nonconformance1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setLot)
                {
                    await
                    Nonconformance2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setLot)
                {
                    await
                    Nonconformance3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setProduction_order)
                {
                    await
                    Nonconformance0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setProduction_order)
                {
                    await
                    Nonconformance1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setProduction_order)
                {
                    await
                    Nonconformance2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setProduction_order)
                {
                    await
                    Nonconformance3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithInspection() {
            
                const relatedInspection0 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setInspection)
                {
                    await
                    Nonconformance0.
                    setInspection(relatedInspection0);
                }
            
                const relatedInspection1 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setInspection)
                {
                    await
                    Nonconformance1.
                    setInspection(relatedInspection1);
                }
            
                const relatedInspection2 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setInspection)
                {
                    await
                    Nonconformance2.
                    setInspection(relatedInspection2);
                }
            
                const relatedInspection3 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setInspection)
                {
                    await
                    Nonconformance3.
                    setInspection(relatedInspection3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateNonconformanceWithReported_by() {
            
                const relatedReported_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setReported_by)
                {
                    await
                    Nonconformance0.
                    setReported_by(relatedReported_by0);
                }
            
                const relatedReported_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setReported_by)
                {
                    await
                    Nonconformance1.
                    setReported_by(relatedReported_by1);
                }
            
                const relatedReported_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setReported_by)
                {
                    await
                    Nonconformance2.
                    setReported_by(relatedReported_by2);
                }
            
                const relatedReported_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setReported_by)
                {
                    await
                    Nonconformance3.
                    setReported_by(relatedReported_by3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateCapaActionWithNonconformance() {
            
                const relatedNonconformance0 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CapaAction0 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CapaAction0?.setNonconformance)
                {
                    await
                    CapaAction0.
                    setNonconformance(relatedNonconformance0);
                }
            
                const relatedNonconformance1 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CapaAction1 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CapaAction1?.setNonconformance)
                {
                    await
                    CapaAction1.
                    setNonconformance(relatedNonconformance1);
                }
            
                const relatedNonconformance2 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CapaAction2 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CapaAction2?.setNonconformance)
                {
                    await
                    CapaAction2.
                    setNonconformance(relatedNonconformance2);
                }
            
                const relatedNonconformance3 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CapaAction3 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CapaAction3?.setNonconformance)
                {
                    await
                    CapaAction3.
                    setNonconformance(relatedNonconformance3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCapaActionWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction0 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CapaAction0?.setOwner)
                {
                    await
                    CapaAction0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction1 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CapaAction1?.setOwner)
                {
                    await
                    CapaAction1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction2 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CapaAction2?.setOwner)
                {
                    await
                    CapaAction2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction3 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CapaAction3?.setOwner)
                {
                    await
                    CapaAction3.
                    setOwner(relatedOwner3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateCapaActionWithVerified_by() {
            
                const relatedVerified_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction0 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CapaAction0?.setVerified_by)
                {
                    await
                    CapaAction0.
                    setVerified_by(relatedVerified_by0);
                }
            
                const relatedVerified_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction1 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CapaAction1?.setVerified_by)
                {
                    await
                    CapaAction1.
                    setVerified_by(relatedVerified_by1);
                }
            
                const relatedVerified_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction2 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CapaAction2?.setVerified_by)
                {
                    await
                    CapaAction2.
                    setVerified_by(relatedVerified_by2);
                }
            
                const relatedVerified_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction3 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CapaAction3?.setVerified_by)
                {
                    await
                    CapaAction3.
                    setVerified_by(relatedVerified_by3);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
            
            async function associateMaintenanceWorkOrderWithMachine() {
            
                const relatedMachine0 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MaintenanceWorkOrder0 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaintenanceWorkOrder0?.setMachine)
                {
                    await
                    MaintenanceWorkOrder0.
                    setMachine(relatedMachine0);
                }
            
                const relatedMachine1 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MaintenanceWorkOrder1 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaintenanceWorkOrder1?.setMachine)
                {
                    await
                    MaintenanceWorkOrder1.
                    setMachine(relatedMachine1);
                }
            
                const relatedMachine2 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MaintenanceWorkOrder2 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaintenanceWorkOrder2?.setMachine)
                {
                    await
                    MaintenanceWorkOrder2.
                    setMachine(relatedMachine2);
                }
            
                const relatedMachine3 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MaintenanceWorkOrder3 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaintenanceWorkOrder3?.setMachine)
                {
                    await
                    MaintenanceWorkOrder3.
                    setMachine(relatedMachine3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateMaintenanceWorkOrderWithRequested_by() {
            
                const relatedRequested_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder0 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaintenanceWorkOrder0?.setRequested_by)
                {
                    await
                    MaintenanceWorkOrder0.
                    setRequested_by(relatedRequested_by0);
                }
            
                const relatedRequested_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder1 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaintenanceWorkOrder1?.setRequested_by)
                {
                    await
                    MaintenanceWorkOrder1.
                    setRequested_by(relatedRequested_by1);
                }
            
                const relatedRequested_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder2 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaintenanceWorkOrder2?.setRequested_by)
                {
                    await
                    MaintenanceWorkOrder2.
                    setRequested_by(relatedRequested_by2);
                }
            
                const relatedRequested_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder3 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaintenanceWorkOrder3?.setRequested_by)
                {
                    await
                    MaintenanceWorkOrder3.
                    setRequested_by(relatedRequested_by3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateMaintenanceWorkOrderWithAssigned_to() {
            
                const relatedAssigned_to0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder0 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaintenanceWorkOrder0?.setAssigned_to)
                {
                    await
                    MaintenanceWorkOrder0.
                    setAssigned_to(relatedAssigned_to0);
                }
            
                const relatedAssigned_to1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder1 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaintenanceWorkOrder1?.setAssigned_to)
                {
                    await
                    MaintenanceWorkOrder1.
                    setAssigned_to(relatedAssigned_to1);
                }
            
                const relatedAssigned_to2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder2 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaintenanceWorkOrder2?.setAssigned_to)
                {
                    await
                    MaintenanceWorkOrder2.
                    setAssigned_to(relatedAssigned_to2);
                }
            
                const relatedAssigned_to3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder3 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaintenanceWorkOrder3?.setAssigned_to)
                {
                    await
                    MaintenanceWorkOrder3.
                    setAssigned_to(relatedAssigned_to3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associatePurchaseOrderWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setSupplier)
                {
                    await
                    PurchaseOrder0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setSupplier)
                {
                    await
                    PurchaseOrder1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setSupplier)
                {
                    await
                    PurchaseOrder2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder3 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrder3?.setSupplier)
                {
                    await
                    PurchaseOrder3.
                    setSupplier(relatedSupplier3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associatePurchaseOrderWithBuyer() {
            
                const relatedBuyer0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setBuyer)
                {
                    await
                    PurchaseOrder0.
                    setBuyer(relatedBuyer0);
                }
            
                const relatedBuyer1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setBuyer)
                {
                    await
                    PurchaseOrder1.
                    setBuyer(relatedBuyer1);
                }
            
                const relatedBuyer2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setBuyer)
                {
                    await
                    PurchaseOrder2.
                    setBuyer(relatedBuyer2);
                }
            
                const relatedBuyer3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder3 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrder3?.setBuyer)
                {
                    await
                    PurchaseOrder3.
                    setBuyer(relatedBuyer3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associatePurchaseOrderLineWithPurchase_order() {
            
                const relatedPurchase_order0 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrderLine0?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine0.
                    setPurchase_order(relatedPurchase_order0);
                }
            
                const relatedPurchase_order1 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrderLine1?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine1.
                    setPurchase_order(relatedPurchase_order1);
                }
            
                const relatedPurchase_order2 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrderLine2?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine2.
                    setPurchase_order(relatedPurchase_order2);
                }
            
                const relatedPurchase_order3 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine3 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrderLine3?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine3.
                    setPurchase_order(relatedPurchase_order3);
                }
            
        }
        
    
        
    
        
            
            async function associatePurchaseOrderLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrderLine0?.setItem)
                {
                    await
                    PurchaseOrderLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrderLine1?.setItem)
                {
                    await
                    PurchaseOrderLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrderLine2?.setItem)
                {
                    await
                    PurchaseOrderLine2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine3 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrderLine3?.setItem)
                {
                    await
                    PurchaseOrderLine3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
    
        
            
            async function associatePurchaseOrderLineWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrderLine0?.setUom)
                {
                    await
                    PurchaseOrderLine0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrderLine1?.setUom)
                {
                    await
                    PurchaseOrderLine1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrderLine2?.setUom)
                {
                    await
                    PurchaseOrderLine2.
                    setUom(relatedUom2);
                }
            
                const relatedUom3 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const PurchaseOrderLine3 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrderLine3?.setUom)
                {
                    await
                    PurchaseOrderLine3.
                    setUom(relatedUom3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateSalesOrderWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SalesOrder0 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrder0?.setCustomer)
                {
                    await
                    SalesOrder0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SalesOrder1 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrder1?.setCustomer)
                {
                    await
                    SalesOrder1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SalesOrder2 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrder2?.setCustomer)
                {
                    await
                    SalesOrder2.
                    setCustomer(relatedCustomer2);
                }
            
                const relatedCustomer3 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SalesOrder3 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SalesOrder3?.setCustomer)
                {
                    await
                    SalesOrder3.
                    setCustomer(relatedCustomer3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSalesOrderWithSales_rep() {
            
                const relatedSales_rep0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SalesOrder0 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrder0?.setSales_rep)
                {
                    await
                    SalesOrder0.
                    setSales_rep(relatedSales_rep0);
                }
            
                const relatedSales_rep1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SalesOrder1 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrder1?.setSales_rep)
                {
                    await
                    SalesOrder1.
                    setSales_rep(relatedSales_rep1);
                }
            
                const relatedSales_rep2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SalesOrder2 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrder2?.setSales_rep)
                {
                    await
                    SalesOrder2.
                    setSales_rep(relatedSales_rep2);
                }
            
                const relatedSales_rep3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SalesOrder3 = await SalesOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SalesOrder3?.setSales_rep)
                {
                    await
                    SalesOrder3.
                    setSales_rep(relatedSales_rep3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateSalesOrderLineWithSales_order() {
            
                const relatedSales_order0 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const SalesOrderLine0 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrderLine0?.setSales_order)
                {
                    await
                    SalesOrderLine0.
                    setSales_order(relatedSales_order0);
                }
            
                const relatedSales_order1 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const SalesOrderLine1 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrderLine1?.setSales_order)
                {
                    await
                    SalesOrderLine1.
                    setSales_order(relatedSales_order1);
                }
            
                const relatedSales_order2 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const SalesOrderLine2 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrderLine2?.setSales_order)
                {
                    await
                    SalesOrderLine2.
                    setSales_order(relatedSales_order2);
                }
            
                const relatedSales_order3 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const SalesOrderLine3 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SalesOrderLine3?.setSales_order)
                {
                    await
                    SalesOrderLine3.
                    setSales_order(relatedSales_order3);
                }
            
        }
        
    
        
    
        
            
            async function associateSalesOrderLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const SalesOrderLine0 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrderLine0?.setItem)
                {
                    await
                    SalesOrderLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const SalesOrderLine1 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrderLine1?.setItem)
                {
                    await
                    SalesOrderLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const SalesOrderLine2 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrderLine2?.setItem)
                {
                    await
                    SalesOrderLine2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const SalesOrderLine3 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SalesOrderLine3?.setItem)
                {
                    await
                    SalesOrderLine3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
    
        
            
            async function associateSalesOrderLineWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const SalesOrderLine0 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesOrderLine0?.setUom)
                {
                    await
                    SalesOrderLine0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const SalesOrderLine1 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesOrderLine1?.setUom)
                {
                    await
                    SalesOrderLine1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const SalesOrderLine2 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesOrderLine2?.setUom)
                {
                    await
                    SalesOrderLine2.
                    setUom(relatedUom2);
                }
            
                const relatedUom3 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const SalesOrderLine3 = await SalesOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SalesOrderLine3?.setUom)
                {
                    await
                    SalesOrderLine3.
                    setUom(relatedUom3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateShipmentWithSales_order() {
            
                const relatedSales_order0 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setSales_order)
                {
                    await
                    Shipment0.
                    setSales_order(relatedSales_order0);
                }
            
                const relatedSales_order1 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setSales_order)
                {
                    await
                    Shipment1.
                    setSales_order(relatedSales_order1);
                }
            
                const relatedSales_order2 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setSales_order)
                {
                    await
                    Shipment2.
                    setSales_order(relatedSales_order2);
                }
            
                const relatedSales_order3 = await SalesOrders.findOne({
                    offset: Math.floor(Math.random() * (await SalesOrders.count())),
                });
                const Shipment3 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Shipment3?.setSales_order)
                {
                    await
                    Shipment3.
                    setSales_order(relatedSales_order3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateShipmentWithFrom_warehouse() {
            
                const relatedFrom_warehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setFrom_warehouse)
                {
                    await
                    Shipment0.
                    setFrom_warehouse(relatedFrom_warehouse0);
                }
            
                const relatedFrom_warehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setFrom_warehouse)
                {
                    await
                    Shipment1.
                    setFrom_warehouse(relatedFrom_warehouse1);
                }
            
                const relatedFrom_warehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setFrom_warehouse)
                {
                    await
                    Shipment2.
                    setFrom_warehouse(relatedFrom_warehouse2);
                }
            
                const relatedFrom_warehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Shipment3 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Shipment3?.setFrom_warehouse)
                {
                    await
                    Shipment3.
                    setFrom_warehouse(relatedFrom_warehouse3);
                }
            
        }
        
    
        
    
        
            
            async function associateShipmentWithShipped_by() {
            
                const relatedShipped_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setShipped_by)
                {
                    await
                    Shipment0.
                    setShipped_by(relatedShipped_by0);
                }
            
                const relatedShipped_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setShipped_by)
                {
                    await
                    Shipment1.
                    setShipped_by(relatedShipped_by1);
                }
            
                const relatedShipped_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setShipped_by)
                {
                    await
                    Shipment2.
                    setShipped_by(relatedShipped_by2);
                }
            
                const relatedShipped_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shipment3 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Shipment3?.setShipped_by)
                {
                    await
                    Shipment3.
                    setShipped_by(relatedShipped_by3);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateShipmentLineWithShipment() {
            
                const relatedShipment0 = await Shipments.findOne({
                    offset: Math.floor(Math.random() * (await Shipments.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setShipment)
                {
                    await
                    ShipmentLine0.
                    setShipment(relatedShipment0);
                }
            
                const relatedShipment1 = await Shipments.findOne({
                    offset: Math.floor(Math.random() * (await Shipments.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setShipment)
                {
                    await
                    ShipmentLine1.
                    setShipment(relatedShipment1);
                }
            
                const relatedShipment2 = await Shipments.findOne({
                    offset: Math.floor(Math.random() * (await Shipments.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setShipment)
                {
                    await
                    ShipmentLine2.
                    setShipment(relatedShipment2);
                }
            
                const relatedShipment3 = await Shipments.findOne({
                    offset: Math.floor(Math.random() * (await Shipments.count())),
                });
                const ShipmentLine3 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ShipmentLine3?.setShipment)
                {
                    await
                    ShipmentLine3.
                    setShipment(relatedShipment3);
                }
            
        }
        
    
        
    
        
            
            async function associateShipmentLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setItem)
                {
                    await
                    ShipmentLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setItem)
                {
                    await
                    ShipmentLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setItem)
                {
                    await
                    ShipmentLine2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ShipmentLine3 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ShipmentLine3?.setItem)
                {
                    await
                    ShipmentLine3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
            
            async function associateShipmentLineWithLot() {
            
                const relatedLot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setLot)
                {
                    await
                    ShipmentLine0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setLot)
                {
                    await
                    ShipmentLine1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setLot)
                {
                    await
                    ShipmentLine2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ShipmentLine3 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ShipmentLine3?.setLot)
                {
                    await
                    ShipmentLine3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
    
        
            
            async function associateShipmentLineWithFrom_location() {
            
                const relatedFrom_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setFrom_location)
                {
                    await
                    ShipmentLine0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setFrom_location)
                {
                    await
                    ShipmentLine1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setFrom_location)
                {
                    await
                    ShipmentLine2.
                    setFrom_location(relatedFrom_location2);
                }
            
                const relatedFrom_location3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const ShipmentLine3 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ShipmentLine3?.setFrom_location)
                {
                    await
                    ShipmentLine3.
                    setFrom_location(relatedFrom_location3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateStandardCostWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const StandardCost0 = await StandardCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StandardCost0?.setItem)
                {
                    await
                    StandardCost0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const StandardCost1 = await StandardCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StandardCost1?.setItem)
                {
                    await
                    StandardCost1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const StandardCost2 = await StandardCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StandardCost2?.setItem)
                {
                    await
                    StandardCost2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const StandardCost3 = await StandardCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (StandardCost3?.setItem)
                {
                    await
                    StandardCost3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateStandardCostWithApproved_by() {
            
                const relatedApproved_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const StandardCost0 = await StandardCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StandardCost0?.setApproved_by)
                {
                    await
                    StandardCost0.
                    setApproved_by(relatedApproved_by0);
                }
            
                const relatedApproved_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const StandardCost1 = await StandardCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StandardCost1?.setApproved_by)
                {
                    await
                    StandardCost1.
                    setApproved_by(relatedApproved_by1);
                }
            
                const relatedApproved_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const StandardCost2 = await StandardCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StandardCost2?.setApproved_by)
                {
                    await
                    StandardCost2.
                    setApproved_by(relatedApproved_by2);
                }
            
                const relatedApproved_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const StandardCost3 = await StandardCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (StandardCost3?.setApproved_by)
                {
                    await
                    StandardCost3.
                    setApproved_by(relatedApproved_by3);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateProductionCostWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionCost0 = await ProductionCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionCost0?.setProduction_order)
                {
                    await
                    ProductionCost0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionCost1 = await ProductionCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionCost1?.setProduction_order)
                {
                    await
                    ProductionCost1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionCost2 = await ProductionCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionCost2?.setProduction_order)
                {
                    await
                    ProductionCost2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionCost3 = await ProductionCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionCost3?.setProduction_order)
                {
                    await
                    ProductionCost3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductionCostWithCalculated_by() {
            
                const relatedCalculated_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionCost0 = await ProductionCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionCost0?.setCalculated_by)
                {
                    await
                    ProductionCost0.
                    setCalculated_by(relatedCalculated_by0);
                }
            
                const relatedCalculated_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionCost1 = await ProductionCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionCost1?.setCalculated_by)
                {
                    await
                    ProductionCost1.
                    setCalculated_by(relatedCalculated_by1);
                }
            
                const relatedCalculated_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionCost2 = await ProductionCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionCost2?.setCalculated_by)
                {
                    await
                    ProductionCost2.
                    setCalculated_by(relatedCalculated_by2);
                }
            
                const relatedCalculated_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionCost3 = await ProductionCosts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionCost3?.setCalculated_by)
                {
                    await
                    ProductionCost3.
                    setCalculated_by(relatedCalculated_by3);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePriceListWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const PriceList0 = await PriceLists.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PriceList0?.setCustomer)
                {
                    await
                    PriceList0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const PriceList1 = await PriceLists.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PriceList1?.setCustomer)
                {
                    await
                    PriceList1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const PriceList2 = await PriceLists.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PriceList2?.setCustomer)
                {
                    await
                    PriceList2.
                    setCustomer(relatedCustomer2);
                }
            
                const relatedCustomer3 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const PriceList3 = await PriceLists.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PriceList3?.setCustomer)
                {
                    await
                    PriceList3.
                    setCustomer(relatedCustomer3);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associatePriceListLineWithPrice_list() {
            
                const relatedPrice_list0 = await PriceLists.findOne({
                    offset: Math.floor(Math.random() * (await PriceLists.count())),
                });
                const PriceListLine0 = await PriceListLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PriceListLine0?.setPrice_list)
                {
                    await
                    PriceListLine0.
                    setPrice_list(relatedPrice_list0);
                }
            
                const relatedPrice_list1 = await PriceLists.findOne({
                    offset: Math.floor(Math.random() * (await PriceLists.count())),
                });
                const PriceListLine1 = await PriceListLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PriceListLine1?.setPrice_list)
                {
                    await
                    PriceListLine1.
                    setPrice_list(relatedPrice_list1);
                }
            
                const relatedPrice_list2 = await PriceLists.findOne({
                    offset: Math.floor(Math.random() * (await PriceLists.count())),
                });
                const PriceListLine2 = await PriceListLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PriceListLine2?.setPrice_list)
                {
                    await
                    PriceListLine2.
                    setPrice_list(relatedPrice_list2);
                }
            
                const relatedPrice_list3 = await PriceLists.findOne({
                    offset: Math.floor(Math.random() * (await PriceLists.count())),
                });
                const PriceListLine3 = await PriceListLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PriceListLine3?.setPrice_list)
                {
                    await
                    PriceListLine3.
                    setPrice_list(relatedPrice_list3);
                }
            
        }
        
    
        
            
            async function associatePriceListLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PriceListLine0 = await PriceListLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PriceListLine0?.setItem)
                {
                    await
                    PriceListLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PriceListLine1 = await PriceListLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PriceListLine1?.setItem)
                {
                    await
                    PriceListLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PriceListLine2 = await PriceListLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PriceListLine2?.setItem)
                {
                    await
                    PriceListLine2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PriceListLine3 = await PriceListLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PriceListLine3?.setItem)
                {
                    await
                    PriceListLine3.
                    setItem(relatedItem3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDocumentWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setOwner)
                {
                    await
                    Document0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setOwner)
                {
                    await
                    Document1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setOwner)
                {
                    await
                    Document2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document3 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Document3?.setOwner)
                {
                    await
                    Document3.
                    setOwner(relatedOwner3);
                }
            
        }
        
    
        
            
            async function associateDocumentWithApproved_by() {
            
                const relatedApproved_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setApproved_by)
                {
                    await
                    Document0.
                    setApproved_by(relatedApproved_by0);
                }
            
                const relatedApproved_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setApproved_by)
                {
                    await
                    Document1.
                    setApproved_by(relatedApproved_by1);
                }
            
                const relatedApproved_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setApproved_by)
                {
                    await
                    Document2.
                    setApproved_by(relatedApproved_by2);
                }
            
                const relatedApproved_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document3 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Document3?.setApproved_by)
                {
                    await
                    Document3.
                    setApproved_by(relatedApproved_by3);
                }
            
        }
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Suppliers.bulkCreate(SuppliersData);
                
            
            
                
                await Customers.bulkCreate(CustomersData);
                
            
            
                
                await Uoms.bulkCreate(UomsData);
                
            
            
                
                await Items.bulkCreate(ItemsData);
                
            
            
                
                await ItemSupplierLinks.bulkCreate(ItemSupplierLinksData);
                
            
            
                
                await Warehouses.bulkCreate(WarehousesData);
                
            
            
                
                await Locations.bulkCreate(LocationsData);
                
            
            
                
                await InventoryLots.bulkCreate(InventoryLotsData);
                
            
            
                
                await InventoryBalances.bulkCreate(InventoryBalancesData);
                
            
            
                
                await InventoryTransactions.bulkCreate(InventoryTransactionsData);
                
            
            
                
                await BomHeaders.bulkCreate(BomHeadersData);
                
            
            
                
                await BomLines.bulkCreate(BomLinesData);
                
            
            
                
                await WorkCenters.bulkCreate(WorkCentersData);
                
            
            
                
                await Machines.bulkCreate(MachinesData);
                
            
            
                
                await RoutingHeaders.bulkCreate(RoutingHeadersData);
                
            
            
                
                await RoutingOperations.bulkCreate(RoutingOperationsData);
                
            
            
                
                await ProductionOrders.bulkCreate(ProductionOrdersData);
                
            
            
                
                await ProductionOperations.bulkCreate(ProductionOperationsData);
                
            
            
                
                await MaterialIssues.bulkCreate(MaterialIssuesData);
                
            
            
                
                await ProductionReceipts.bulkCreate(ProductionReceiptsData);
                
            
            
                
                await QaInspectionPlans.bulkCreate(QaInspectionPlansData);
                
            
            
                
                await QaInspections.bulkCreate(QaInspectionsData);
                
            
            
                
                await Nonconformances.bulkCreate(NonconformancesData);
                
            
            
                
                await CapaActions.bulkCreate(CapaActionsData);
                
            
            
                
                await MaintenanceWorkOrders.bulkCreate(MaintenanceWorkOrdersData);
                
            
            
                
                await PurchaseOrders.bulkCreate(PurchaseOrdersData);
                
            
            
                
                await PurchaseOrderLines.bulkCreate(PurchaseOrderLinesData);
                
            
            
                
                await SalesOrders.bulkCreate(SalesOrdersData);
                
            
            
                
                await SalesOrderLines.bulkCreate(SalesOrderLinesData);
                
            
            
                
                await Shipments.bulkCreate(ShipmentsData);
                
            
            
                
                await ShipmentLines.bulkCreate(ShipmentLinesData);
                
            
            
                
                await CostCenters.bulkCreate(CostCentersData);
                
            
            
                
                await CostElements.bulkCreate(CostElementsData);
                
            
            
                
                await StandardCosts.bulkCreate(StandardCostsData);
                
            
            
                
                await ProductionCosts.bulkCreate(ProductionCostsData);
                
            
            
                
                await PriceLists.bulkCreate(PriceListsData);
                
            
            
                
                await PriceListLines.bulkCreate(PriceListLinesData);
                
            
            
                
                await Documents.bulkCreate(DocumentsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateItemWithUom(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateItemSupplierLinkWithItem(),
                    
                
                    
                        
                        await associateItemSupplierLinkWithSupplier(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateLocationWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInventoryLotWithItem(),
                    
                
                    
                
                    
                        
                        await associateInventoryLotWithSupplier(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInventoryBalanceWithItem(),
                    
                
                    
                        
                        await associateInventoryBalanceWithLocation(),
                    
                
                    
                        
                        await associateInventoryBalanceWithLot(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateInventoryTransactionWithItem(),
                    
                
                    
                        
                        await associateInventoryTransactionWithLot(),
                    
                
                    
                        
                        await associateInventoryTransactionWithFrom_location(),
                    
                
                    
                        
                        await associateInventoryTransactionWithTo_location(),
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryTransactionWithPerformed_by(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateBomHeaderWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateBomHeaderWithApproved_by(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateBomLineWithBom_header(),
                    
                
                    
                
                    
                        
                        await associateBomLineWithComponent_item(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateBomLineWithUom(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateMachineWithWork_center(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateRoutingHeaderWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateRoutingHeaderWithApproved_by(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateRoutingOperationWithRouting_header(),
                    
                
                    
                
                    
                
                    
                        
                        await associateRoutingOperationWithWork_center(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateProductionOrderWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionOrderWithBom(),
                    
                
                    
                        
                        await associateProductionOrderWithRouting(),
                    
                
                    
                        
                        await associateProductionOrderWithWarehouse(),
                    
                
                    
                
                    
                        
                        await associateProductionOrderWithCreated_by_user(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateProductionOperationWithProduction_order(),
                    
                
                    
                
                    
                        
                        await associateProductionOperationWithRouting_operation(),
                    
                
                    
                        
                        await associateProductionOperationWithWork_center(),
                    
                
                    
                        
                        await associateProductionOperationWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionOperationWithPerformed_by(),
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateMaterialIssueWithProduction_order(),
                    
                
                    
                        
                        await associateMaterialIssueWithItem(),
                    
                
                    
                        
                        await associateMaterialIssueWithLot(),
                    
                
                    
                        
                        await associateMaterialIssueWithFrom_location(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaterialIssueWithIssued_by(),
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateProductionReceiptWithProduction_order(),
                    
                
                    
                        
                        await associateProductionReceiptWithItem(),
                    
                
                    
                        
                        await associateProductionReceiptWithTo_location(),
                    
                
                    
                        
                        await associateProductionReceiptWithLot(),
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionReceiptWithReceived_by(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateQaInspectionPlanWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateQaInspectionWithPlan(),
                    
                
                    
                        
                        await associateQaInspectionWithItem(),
                    
                
                    
                        
                        await associateQaInspectionWithLot(),
                    
                
                    
                        
                        await associateQaInspectionWithProduction_order(),
                    
                
                    
                        
                        await associateQaInspectionWithOperation(),
                    
                
                    
                
                    
                        
                        await associateQaInspectionWithInspector(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithItem(),
                    
                
                    
                        
                        await associateNonconformanceWithLot(),
                    
                
                    
                        
                        await associateNonconformanceWithProduction_order(),
                    
                
                    
                        
                        await associateNonconformanceWithInspection(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithReported_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateCapaActionWithNonconformance(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCapaActionWithOwner(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCapaActionWithVerified_by(),
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithRequested_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithAssigned_to(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associatePurchaseOrderWithSupplier(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderWithBuyer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associatePurchaseOrderLineWithPurchase_order(),
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderLineWithItem(),
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderLineWithUom(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateSalesOrderWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSalesOrderWithSales_rep(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateSalesOrderLineWithSales_order(),
                    
                
                    
                
                    
                        
                        await associateSalesOrderLineWithItem(),
                    
                
                    
                
                    
                        
                        await associateSalesOrderLineWithUom(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateShipmentWithSales_order(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateShipmentWithFrom_warehouse(),
                    
                
                    
                
                    
                        
                        await associateShipmentWithShipped_by(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateShipmentLineWithShipment(),
                    
                
                    
                
                    
                        
                        await associateShipmentLineWithItem(),
                    
                
                    
                        
                        await associateShipmentLineWithLot(),
                    
                
                    
                
                    
                        
                        await associateShipmentLineWithFrom_location(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateStandardCostWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateStandardCostWithApproved_by(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateProductionCostWithProduction_order(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionCostWithCalculated_by(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePriceListWithCustomer(),
                    
                
                    
                
            
                
                
                    
                        
                        await associatePriceListLineWithPrice_list(),
                    
                
                    
                        
                        await associatePriceListLineWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDocumentWithOwner(),
                    
                
                    
                        
                        await associateDocumentWithApproved_by(),
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('suppliers', null, {});
            
            
            await queryInterface.bulkDelete('customers', null, {});
            
            
            await queryInterface.bulkDelete('uoms', null, {});
            
            
            await queryInterface.bulkDelete('items', null, {});
            
            
            await queryInterface.bulkDelete('item_supplier_links', null, {});
            
            
            await queryInterface.bulkDelete('warehouses', null, {});
            
            
            await queryInterface.bulkDelete('locations', null, {});
            
            
            await queryInterface.bulkDelete('inventory_lots', null, {});
            
            
            await queryInterface.bulkDelete('inventory_balances', null, {});
            
            
            await queryInterface.bulkDelete('inventory_transactions', null, {});
            
            
            await queryInterface.bulkDelete('bom_headers', null, {});
            
            
            await queryInterface.bulkDelete('bom_lines', null, {});
            
            
            await queryInterface.bulkDelete('work_centers', null, {});
            
            
            await queryInterface.bulkDelete('machines', null, {});
            
            
            await queryInterface.bulkDelete('routing_headers', null, {});
            
            
            await queryInterface.bulkDelete('routing_operations', null, {});
            
            
            await queryInterface.bulkDelete('production_orders', null, {});
            
            
            await queryInterface.bulkDelete('production_operations', null, {});
            
            
            await queryInterface.bulkDelete('material_issues', null, {});
            
            
            await queryInterface.bulkDelete('production_receipts', null, {});
            
            
            await queryInterface.bulkDelete('qa_inspection_plans', null, {});
            
            
            await queryInterface.bulkDelete('qa_inspections', null, {});
            
            
            await queryInterface.bulkDelete('nonconformances', null, {});
            
            
            await queryInterface.bulkDelete('capa_actions', null, {});
            
            
            await queryInterface.bulkDelete('maintenance_work_orders', null, {});
            
            
            await queryInterface.bulkDelete('purchase_orders', null, {});
            
            
            await queryInterface.bulkDelete('purchase_order_lines', null, {});
            
            
            await queryInterface.bulkDelete('sales_orders', null, {});
            
            
            await queryInterface.bulkDelete('sales_order_lines', null, {});
            
            
            await queryInterface.bulkDelete('shipments', null, {});
            
            
            await queryInterface.bulkDelete('shipment_lines', null, {});
            
            
            await queryInterface.bulkDelete('cost_centers', null, {});
            
            
            await queryInterface.bulkDelete('cost_elements', null, {});
            
            
            await queryInterface.bulkDelete('standard_costs', null, {});
            
            
            await queryInterface.bulkDelete('production_costs', null, {});
            
            
            await queryInterface.bulkDelete('price_lists', null, {});
            
            
            await queryInterface.bulkDelete('price_list_lines', null, {});
            
            
            await queryInterface.bulkDelete('documents', null, {});
            
        
    },
};