





















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






const Organizations = db.organizations;

const Plants = db.plants;

const WorkCenters = db.work_centers;

const Machines = db.machines;

const Materials = db.materials;

const BomHeaders = db.bom_headers;

const BomLines = db.bom_lines;

const Routings = db.routings;

const RoutingSteps = db.routing_steps;

const Suppliers = db.suppliers;

const Customers = db.customers;

const Warehouses = db.warehouses;

const Locations = db.locations;

const Lots = db.lots;

const Serials = db.serials;

const InventoryBalances = db.inventory_balances;

const InventoryTransactions = db.inventory_transactions;

const CycleCounts = db.cycle_counts;

const CycleCountLines = db.cycle_count_lines;

const ProductionOrders = db.production_orders;

const ProductionOperations = db.production_operations;

const MaterialAllocations = db.material_allocations;

const ProductionLots = db.production_lots;

const InspectionPlans = db.inspection_plans;

const InspectionCharacteristics = db.inspection_characteristics;

const Inspections = db.inspections;

const InspectionResults = db.inspection_results;

const Nonconformances = db.nonconformances;

const Dispositions = db.dispositions;

const CorrectiveActions = db.corrective_actions;

const DowntimeEvents = db.downtime_events;

const MachineReadings = db.machine_readings;

const MaintenanceWorkOrders = db.maintenance_work_orders;

const Documents = db.documents;

const Shipments = db.shipments;

const ShipmentLines = db.shipment_lines;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
    },
    
];



const PlantsData = [
    
    {
    
        
        
            
                "name": "Acme Fabrication Chicago",
            
        
    
        
        
            
                "code": "CHI-01",
            
        
    
        
        
            
                "address": "1200 W Industrial Ave, Chicago, IL",
            
        
    
        
        
            
                "timezone": "America/Chicago",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Acme Fabrication Dallas",
            
        
    
        
        
            
                "code": "DAL-01",
            
        
    
        
        
            
                "address": "5400 Foundry Rd, Dallas, TX",
            
        
    
        
        
            
                "timezone": "America/Chicago",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Acme Fabrication Phoenix",
            
        
    
        
        
            
                "code": "PHX-01",
            
        
    
        
        
            
                "address": "8000 Desert Tech Blvd, Phoenix, AZ",
            
        
    
        
        
            
                "timezone": "America/Phoenix",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Acme Fabrication Newark",
            
        
    
        
        
            
                "code": "NWK-01",
            
        
    
        
        
            
                "address": "95 Portside Dr, Newark, NJ",
            
        
    
        
        
            
                "timezone": "America/New_York",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WorkCentersData = [
    
    {
    
        
        
            
                "name": "Machining Cell A",
            
        
    
        
        
            
                "code": "WC-MACH-A",
            
        
    
        
        
            
                "type": "warehouse",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Assembly Line 1",
            
        
    
        
        
            
                "code": "WC-ASSY-01",
            
        
    
        
        
            
                "type": "packaging",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Packaging Line 1",
            
        
    
        
        
            
                "code": "WC-PACK-01",
            
        
    
        
        
            
                "type": "assembly",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Inspection Lab",
            
        
    
        
        
            
                "code": "WC-QA-01",
            
        
    
        
        
            
                "type": "machining",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const MachinesData = [
    
    {
    
        
        
            
                "name": "Haas VF-2 Mill",
            
        
    
        
        
            
                "asset_tag": "MILL-CHI-0007",
            
        
    
        
        
            
                "manufacturer": "Haas",
            
        
    
        
        
            
                "model": "VF-2",
            
        
    
        
        
            
                "serial_number": "HaasVF2-2019-7741",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "offline",
            
        
    
        
        
            
                "commissioned_on": new Date('2020-03-10T00:00:00Z'),
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Mazak QT Lathe",
            
        
    
        
        
            
                "asset_tag": "LATHE-CHI-0012",
            
        
    
        
        
            
                "manufacturer": "Mazak",
            
        
    
        
        
            
                "model": "QT-200",
            
        
    
        
        
            
                "serial_number": "MazakQT-2018-3310",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "running",
            
        
    
        
        
            
                "commissioned_on": new Date('2019-06-22T00:00:00Z'),
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Assembly Torque Station",
            
        
    
        
        
            
                "asset_tag": "ASSY-CHI-0044",
            
        
    
        
        
            
                "manufacturer": "Atlas Copco",
            
        
    
        
        
            
                "model": "Tensor ST",
            
        
    
        
        
            
                "serial_number": "ATC-Tensor-2021-1188",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "down",
            
        
    
        
        
            
                "commissioned_on": new Date('2021-11-15T00:00:00Z'),
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Case Sealer 3M",
            
        
    
        
        
            
                "asset_tag": "PACK-CHI-0020",
            
        
    
        
        
            
                "manufacturer": "3M",
            
        
    
        
        
            
                "model": "800A3",
            
        
    
        
        
            
                "serial_number": "3M800A3-2020-9022",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "setup",
            
        
    
        
        
            
                "commissioned_on": new Date('2020-09-01T00:00:00Z'),
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const MaterialsData = [
    
    {
    
        
        
            
                "name": "Aluminum Plate 6061-T6 10mm",
            
        
    
        
        
            
                "material_number": "RM-AL-6061-10",
            
        
    
        
        
            
                "material_type": "raw",
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": false,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "description": "Standard 6061-T6 plate for machining operations",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Steel Fastener M8x20 Zinc",
            
        
    
        
        
            
                "material_number": "RM-FST-M8-20",
            
        
    
        
        
            
                "material_type": "subassembly",
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "revision": "B",
            
        
    
        
        
            
                "lot_tracked": false,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "description": "Zinc plated fastener used in assemblies",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Gearbox Housing Subassembly",
            
        
    
        
        
            
                "material_number": "SA-GBX-HOUS-01",
            
        
    
        
        
            
                "material_type": "spare_part",
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "revision": "C",
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "description": "Machined housing with pressed inserts",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Industrial Pump Model P200",
            
        
    
        
        
            
                "material_number": "FG-PUMP-P200",
            
        
    
        
        
            
                "material_type": "finished_good",
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "revision": "D",
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "description": "Finished pump assembly for customer shipments",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const BomHeadersData = [
    
    {
    
        
        
            
                "name": "BOM Pump P200 Rev D",
            
        
    
        
        
            
                "bom_number": "BOM-P200",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "revision": "D",
            
        
    
        
        
            
                "status": "released",
            
        
    
        
        
            
                "effective_from": new Date('2024-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Primary BOM for Pump P200",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "BOM Gearbox Housing Rev C",
            
        
    
        
        
            
                "bom_number": "BOM-GBX-HOUS",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "revision": "C",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "effective_from": new Date('2024-02-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Subassembly BOM",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "BOM Packaging Kit P200",
            
        
    
        
        
            
                "bom_number": "BOM-P200-PACK",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "obsolete",
            
        
    
        
        
            
                "effective_from": new Date('2024-03-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Packaging components for P200",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "BOM Pump P200 Prototype",
            
        
    
        
        
            
                "bom_number": "BOM-P200-PROT",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "revision": "P1",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Prototype configuration for engineering builds",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const BomLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 1.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "scrap_factor": 0.02,
            
        
    
        
        
            
                "line_number": 10,
            
        
    
        
        
            
                "reference_designator": "GBX-HOUS",
            
        
    
        
        
            
                "notes": "Gearbox housing subassembly",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 8.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "scrap_factor": 0.01,
            
        
    
        
        
            
                "line_number": 20,
            
        
    
        
        
            
                "reference_designator": "M8-FST",
            
        
    
        
        
            
                "notes": "Fasteners for final assembly",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 1.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "scrap_factor": 0.03,
            
        
    
        
        
            
                "line_number": 10,
            
        
    
        
        
            
                "reference_designator": "AL-PLATE",
            
        
    
        
        
            
                "notes": "Primary billet/plate input",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 1.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "scrap_factor": 0.0,
            
        
    
        
        
            
                "line_number": 10,
            
        
    
        
        
            
                "reference_designator": "CARTON",
            
        
    
        
        
            
                "notes": "One carton per unit shipped",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RoutingsData = [
    
    {
    
        
        
            
                "name": "Routing Pump P200 Rev D",
            
        
    
        
        
            
                "routing_number": "RT-P200",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "revision": "D",
            
        
    
        
        
            
                "status": "obsolete",
            
        
    
        
        
            
                "effective_from": new Date('2024-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Standard production routing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Routing Gearbox Housing Rev C",
            
        
    
        
        
            
                "routing_number": "RT-GBX-HOUS",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "revision": "C",
            
        
    
        
        
            
                "status": "obsolete",
            
        
    
        
        
            
                "effective_from": new Date('2024-02-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Machining and inspection sequence",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Routing Incoming Inspection Raw",
            
        
    
        
        
            
                "routing_number": "RT-INSP-RM",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "effective_from": new Date('2024-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Incoming inspection steps",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Routing Packaging P200",
            
        
    
        
        
            
                "routing_number": "RT-P200-PACK",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "released",
            
        
    
        
        
            
                "effective_from": new Date('2024-03-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Packaging operations",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RoutingStepsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "step_number": 10,
            
        
    
        
        
            
                "name": "Kitting and Staging",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_time_minutes": 15.0,
            
        
    
        
        
            
                "run_time_minutes": 20.0,
            
        
    
        
        
            
                "labor_minutes": 30.0,
            
        
    
        
        
            
                "work_instructions": "Pick and stage components per kit list, confirm lots",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "step_number": 20,
            
        
    
        
        
            
                "name": "Final Assembly",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_time_minutes": 10.0,
            
        
    
        
        
            
                "run_time_minutes": 35.0,
            
        
    
        
        
            
                "labor_minutes": 45.0,
            
        
    
        
        
            
                "work_instructions": "Assemble pump per torque and gasket specs",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "step_number": 30,
            
        
    
        
        
            
                "name": "Final Inspection",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_time_minutes": 5.0,
            
        
    
        
        
            
                "run_time_minutes": 15.0,
            
        
    
        
        
            
                "labor_minutes": 20.0,
            
        
    
        
        
            
                "work_instructions": "Verify critical dimensions and leak test results",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "step_number": 10,
            
        
    
        
        
            
                "name": "Pack and Label",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_time_minutes": 5.0,
            
        
    
        
        
            
                "run_time_minutes": 12.0,
            
        
    
        
        
            
                "labor_minutes": 15.0,
            
        
    
        
        
            
                "work_instructions": "Pack unit in carton, apply labels and include documentation",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SuppliersData = [
    
    {
    
        
        
            
                "name": "Midwest Metals Co",
            
        
    
        
        
            
                "supplier_code": "SUP-MMC",
            
        
    
        
        
            
                "contact_name": "Avery Collins",
            
        
    
        
        
            
                "email": "orders@midwestmetals.example.com",
            
        
    
        
        
            
                "phone": "+1-773-555-0101",
            
        
    
        
        
            
                "address": "2200 Metalworks Dr, Chicago, IL",
            
        
    
        
        
            
                "approved": true,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "FastenRight Supply",
            
        
    
        
        
            
                "supplier_code": "SUP-FRS",
            
        
    
        
        
            
                "contact_name": "Noah Bennett",
            
        
    
        
        
            
                "email": "sales@fastenright.example.com",
            
        
    
        
        
            
                "phone": "+1-630-555-0199",
            
        
    
        
        
            
                "address": "77 Commerce Pkwy, Aurora, IL",
            
        
    
        
        
            
                "approved": true,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Desert Packaging",
            
        
    
        
        
            
                "supplier_code": "SUP-DPK",
            
        
    
        
        
            
                "contact_name": "Mia Ortega",
            
        
    
        
        
            
                "email": "support@desertpackaging.example.com",
            
        
    
        
        
            
                "phone": "+1-602-555-0144",
            
        
    
        
        
            
                "address": "1400 Boxline Rd, Phoenix, AZ",
            
        
    
        
        
            
                "approved": true,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Precision Castings Ltd",
            
        
    
        
        
            
                "supplier_code": "SUP-PCL",
            
        
    
        
        
            
                "contact_name": "Liam Patel",
            
        
    
        
        
            
                "email": "quality@precisioncastings.example.com",
            
        
    
        
        
            
                "phone": "+1-214-555-0118",
            
        
    
        
        
            
                "address": "500 Foundry Ct, Dallas, TX",
            
        
    
        
        
            
                "approved": false,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CustomersData = [
    
    {
    
        
        
            
                "name": "North Ridge Utilities",
            
        
    
        
        
            
                "customer_code": "CUST-NRU",
            
        
    
        
        
            
                "contact_name": "Olivia Grant",
            
        
    
        
        
            
                "email": "procurement@nru.example.com",
            
        
    
        
        
            
                "phone": "+1-414-555-0107",
            
        
    
        
        
            
                "address": "900 River Pkwy, Milwaukee, WI",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "BlueSky Process Systems",
            
        
    
        
        
            
                "customer_code": "CUST-BPS",
            
        
    
        
        
            
                "contact_name": "Daniel Cho",
            
        
    
        
        
            
                "email": "orders@blueskyps.example.com",
            
        
    
        
        
            
                "phone": "+1-303-555-0161",
            
        
    
        
        
            
                "address": "2400 Tech Center Dr, Denver, CO",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Harbor Industrial Services",
            
        
    
        
        
            
                "customer_code": "CUST-HIS",
            
        
    
        
        
            
                "contact_name": "Emma Wilson",
            
        
    
        
        
            
                "email": "receiving@harboris.example.com",
            
        
    
        
        
            
                "phone": "+1-908-555-0188",
            
        
    
        
        
            
                "address": "55 Port Blvd, Elizabeth, NJ",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Sunline Manufacturing",
            
        
    
        
        
            
                "customer_code": "CUST-SLM",
            
        
    
        
        
            
                "contact_name": "Jackson Reed",
            
        
    
        
        
            
                "email": "purchasing@sunline.example.com",
            
        
    
        
        
            
                "phone": "+1-480-555-0133",
            
        
    
        
        
            
                "address": "1200 Mesa Industrial Rd, Mesa, AZ",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WarehousesData = [
    
    {
    
        
        
            
                "name": "Chicago Main Warehouse",
            
        
    
        
        
            
                "code": "WH-CHI-MAIN",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "notes": "Primary raw and finished goods storage",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Chicago QA Hold",
            
        
    
        
        
            
                "code": "WH-CHI-QA",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "notes": "Segregated QA hold and quarantine",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Dallas Warehouse",
            
        
    
        
        
            
                "code": "WH-DAL-MAIN",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "notes": "Regional storage for Dallas plant",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Phoenix Warehouse",
            
        
    
        
        
            
                "code": "WH-PHX-MAIN",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "notes": "Regional storage for Phoenix plant",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const LocationsData = [
    
    {
    
        
        
            
                "name": "Receiving Dock",
            
        
    
        
        
            
                "code": "LOC-REC-01",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "location_type": "qa_hold",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Raw Rack A1",
            
        
    
        
        
            
                "code": "LOC-RM-A1",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "location_type": "wip",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "WIP Staging",
            
        
    
        
        
            
                "code": "LOC-WIP-01",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "location_type": "storage",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "QA Quarantine",
            
        
    
        
        
            
                "code": "LOC-QA-01",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "location_type": "scrap",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const LotsData = [
    
    {
    
        
        
            
                "lot_number": "LOT-AL6061-2026-0412",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "consumed",
            
        
    
        
        
            
                "received_at": new Date('2026-04-12T14:30:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2028-04-12T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_lot": "MMC-6061-0412",
            
        
    
        
        
            
                "quantity_received": 50.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Plate stock received with mill certs",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "lot_number": "LOT-FST-M8-2026-0503",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "scrapped",
            
        
    
        
        
            
                "received_at": new Date('2026-05-03T10:10:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2029-05-03T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_lot": "FRS-M8-0503",
            
        
    
        
        
            
                "quantity_received": 5000.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Fasteners in sealed cartons",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "lot_number": "LOT-CART-2026-0428",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "released",
            
        
    
        
        
            
                "received_at": new Date('2026-04-28T09:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2029-04-28T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_lot": "DPK-181210-0428",
            
        
    
        
        
            
                "quantity_received": 800.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Cartons received and inspected",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "lot_number": "LOT-GBX-HOUS-2026-0515",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "quarantine",
            
        
    
        
        
            
                "received_at": new Date('2026-05-15T16:45:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2028-05-15T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_lot": "PCL-GBX-0515",
            
        
    
        
        
            
                "quantity_received": 60.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Subassembly lot pending incoming inspection",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SerialsData = [
    
    {
    
        
        
            
                "serial_number": "SN-P200-CHI-000101",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "returned",
            
        
    
        
        
            
                "created_on": new Date('2026-05-21T08:05:00Z'),
            
        
    
        
        
            
                "notes": "Allocated to PO-10045",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "serial_number": "SN-P200-CHI-000102",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "scrapped",
            
        
    
        
        
            
                "created_on": new Date('2026-05-18T15:20:00Z'),
            
        
    
        
        
            
                "notes": "Ready for shipment",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "serial_number": "SN-P200-CHI-000103",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "shipped",
            
        
    
        
        
            
                "created_on": new Date('2026-05-18T15:45:00Z'),
            
        
    
        
        
            
                "notes": "Passed final inspection",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "serial_number": "SN-P200-CHI-000104",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "in_stock",
            
        
    
        
        
            
                "created_on": new Date('2026-05-19T11:10:00Z'),
            
        
    
        
        
            
                "notes": "Scrapped due to leak test failure",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InventoryBalancesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "on_hand_qty": 38.0,
            
        
    
        
        
            
                "allocated_qty": 10.0,
            
        
    
        
        
            
                "available_qty": 28.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "as_of": new Date('2026-05-22T00:00:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "on_hand_qty": 4200.0,
            
        
    
        
        
            
                "allocated_qty": 640.0,
            
        
    
        
        
            
                "available_qty": 3560.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "as_of": new Date('2026-05-22T00:00:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "on_hand_qty": 720.0,
            
        
    
        
        
            
                "allocated_qty": 120.0,
            
        
    
        
        
            
                "available_qty": 600.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "as_of": new Date('2026-05-22T00:00:00Z'),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "on_hand_qty": 60.0,
            
        
    
        
        
            
                "allocated_qty": 0.0,
            
        
    
        
        
            
                "available_qty": 60.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "as_of": new Date('2026-05-22T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InventoryTransactionsData = [
    
    {
    
        
        
            
                "transaction_number": "ITX-000120",
            
        
    
        
        
            
                "transaction_at": new Date('2026-05-03T10:15: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": 5000.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "reference": "PO-SUP-FRS-7781",
            
        
    
        
        
            
                "reason": "Supplier receipt",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "transaction_number": "ITX-000121",
            
        
    
        
        
            
                "transaction_at": new Date('2026-05-04T08:40:00Z'),
            
        
    
        
        
            
                "transaction_type": "issue",
            
        
    
        
        
            
                // 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": 5000.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "reference": "Putaway",
            
        
    
        
        
            
                "reason": "Move to storage",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "transaction_number": "ITX-000122",
            
        
    
        
        
            
                "transaction_at": new Date('2026-05-21T08:20:00Z'),
            
        
    
        
        
            
                "transaction_type": "adjustment",
            
        
    
        
        
            
                // 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": 640.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "reference": "PO-10045",
            
        
    
        
        
            
                "reason": "Issue to WIP",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "transaction_number": "ITX-000123",
            
        
    
        
        
            
                "transaction_at": new Date('2026-04-12T14:35: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": 50.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "reference": "PO-SUP-MMC-5510",
            
        
    
        
        
            
                "reason": "Supplier receipt",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CycleCountsData = [
    
    {
    
        
        
            
                "count_number": "CC-CHI-2026-001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-10T14:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-10T18:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Monthly A items cycle count",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "count_number": "CC-CHI-2026-002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-03T13:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-03T17:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Spot check for fasteners and packaging",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "count_number": "CC-CHI-2026-003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-15T15:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-15T16:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "QA hold locations verification",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "count_number": "CC-DAL-2026-001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "scheduled_at": new Date('2026-05-20T14:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-05-20T17:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Dallas quarterly count",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CycleCountLinesData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "system_qty": 38.0,
            
        
    
        
        
            
                "counted_qty": 38.0,
            
        
    
        
        
            
                "variance_qty": 0.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "notes": "Matched system",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "system_qty": 4200.0,
            
        
    
        
        
            
                "counted_qty": 4198.0,
            
        
    
        
        
            
                "variance_qty": -2.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "notes": "Two pieces missing in open carton",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "system_qty": 720.0,
            
        
    
        
        
            
                "counted_qty": 720.0,
            
        
    
        
        
            
                "variance_qty": 0.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "notes": "Matched system",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "system_qty": 60.0,
            
        
    
        
        
            
                "counted_qty": 60.0,
            
        
    
        
        
            
                "variance_qty": 0.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "notes": "Quarantine lot verified",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ProductionOrdersData = [
    
    {
    
        
        
            
                "order_number": "PO-10045",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "scheduled_start": new Date('2026-05-21T07:00:00Z'),
            
        
    
        
        
            
                "scheduled_end": new Date('2026-05-23T17:00:00Z'),
            
        
    
        
        
            
                "actual_start": new Date('2026-05-21T07:12:00Z'),
            
        
    
        
        
            
                "actual_end": new Date('2026-05-23T16:40:00Z'),
            
        
    
        
        
            
                "planned_qty": 60.0,
            
        
    
        
        
            
                "completed_qty": 22.0,
            
        
    
        
        
            
                "scrapped_qty": 1.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "High",
            
        
    
        
        
            
                "notes": "Build to replenish finished goods and meet NRU schedule",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "order_number": "PO-10046",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "scheduled_start": new Date('2026-05-27T07:00:00Z'),
            
        
    
        
        
            
                "scheduled_end": new Date('2026-05-29T17:00:00Z'),
            
        
    
        
        
            
                "actual_start": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "actual_end": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "planned_qty": 50.0,
            
        
    
        
        
            
                "completed_qty": 0.0,
            
        
    
        
        
            
                "scrapped_qty": 0.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "Medium",
            
        
    
        
        
            
                "notes": "Planned build for BlueSky",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "order_number": "PO-10047",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "scheduled_start": new Date('2026-05-10T07:00:00Z'),
            
        
    
        
        
            
                "scheduled_end": new Date('2026-05-12T17:00:00Z'),
            
        
    
        
        
            
                "actual_start": new Date('2026-05-10T07:05:00Z'),
            
        
    
        
        
            
                "actual_end": new Date('2026-05-12T15:55:00Z'),
            
        
    
        
        
            
                "planned_qty": 70.0,
            
        
    
        
        
            
                "completed_qty": 70.0,
            
        
    
        
        
            
                "scrapped_qty": 0.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "Medium",
            
        
    
        
        
            
                "notes": "Subassembly build for upcoming pump orders",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "order_number": "PO-10048",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "scheduled_start": new Date('2026-05-24T07:00:00Z'),
            
        
    
        
        
            
                "scheduled_end": new Date('2026-05-26T17:00:00Z'),
            
        
    
        
        
            
                "actual_start": new Date('2026-05-24T07:18:00Z'),
            
        
    
        
        
            
                "actual_end": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "planned_qty": 40.0,
            
        
    
        
        
            
                "completed_qty": 5.0,
            
        
    
        
        
            
                "scrapped_qty": 0.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "Urgent",
            
        
    
        
        
            
                "notes": "On hold pending NCR disposition on gearbox lot",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ProductionOperationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 10,
            
        
    
        
        
            
                "name": "Kitting and Staging",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "paused",
            
        
    
        
        
            
                "planned_start": new Date('2026-05-21T07:00:00Z'),
            
        
    
        
        
            
                "planned_end": new Date('2026-05-21T09:00:00Z'),
            
        
    
        
        
            
                "actual_start": new Date('2026-05-21T07:12:00Z'),
            
        
    
        
        
            
                "actual_end": new Date('2026-05-21T08:40:00Z'),
            
        
    
        
        
            
                "good_qty": 22.0,
            
        
    
        
        
            
                "scrap_qty": 0.0,
            
        
    
        
        
            
                "notes": "Kitted per lot availability",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 20,
            
        
    
        
        
            
                "name": "Final Assembly",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "paused",
            
        
    
        
        
            
                "planned_start": new Date('2026-05-21T09:00:00Z'),
            
        
    
        
        
            
                "planned_end": new Date('2026-05-23T12:00:00Z'),
            
        
    
        
        
            
                "actual_start": new Date('2026-05-21T09:10:00Z'),
            
        
    
        
        
            
                "actual_end": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "good_qty": 22.0,
            
        
    
        
        
            
                "scrap_qty": 1.0,
            
        
    
        
        
            
                "notes": "One unit failed torque audit and was reworked",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 30,
            
        
    
        
        
            
                "name": "Final Inspection",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "running",
            
        
    
        
        
            
                "planned_start": new Date('2026-05-23T12:00:00Z'),
            
        
    
        
        
            
                "planned_end": new Date('2026-05-23T17:00:00Z'),
            
        
    
        
        
            
                "actual_start": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "actual_end": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "good_qty": 0.0,
            
        
    
        
        
            
                "scrap_qty": 0.0,
            
        
    
        
        
            
                "notes": "Waiting for assembly completion",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 10,
            
        
    
        
        
            
                "name": "CNC Milling",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "paused",
            
        
    
        
        
            
                "planned_start": new Date('2026-05-10T07:00:00Z'),
            
        
    
        
        
            
                "planned_end": new Date('2026-05-11T16:00:00Z'),
            
        
    
        
        
            
                "actual_start": new Date('2026-05-10T07:05:00Z'),
            
        
    
        
        
            
                "actual_end": new Date('2026-05-11T15:10:00Z'),
            
        
    
        
        
            
                "good_qty": 70.0,
            
        
    
        
        
            
                "scrap_qty": 0.0,
            
        
    
        
        
            
                "notes": "Program revision verified",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const MaterialAllocationsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "required_qty": 60.0,
            
        
    
        
        
            
                "issued_qty": 22.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "issue_status": "backflushed",
            
        
    
        
        
            
                "notes": "Issuance limited due to quarantine status",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "required_qty": 480.0,
            
        
    
        
        
            
                "issued_qty": 176.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "issue_status": "backflushed",
            
        
    
        
        
            
                "notes": "Issued to WIP staging",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "required_qty": 60.0,
            
        
    
        
        
            
                "issued_qty": 0.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "issue_status": "partially_issued",
            
        
    
        
        
            
                "notes": "Pack materials to be issued near completion",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "required_qty": 40.0,
            
        
    
        
        
            
                "issued_qty": 5.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "issue_status": "issued",
            
        
    
        
        
            
                "notes": "Hold pending disposition",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ProductionLotsData = [
    
    {
    
        
        
            
                "lot_number": "PLOT-P200-2026-0521-A",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "scrapped",
            
        
    
        
        
            
                "produced_at": new Date('2026-05-21T16:30:00Z'),
            
        
    
        
        
            
                "quantity_produced": 10.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "First run awaiting final inspection",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "lot_number": "PLOT-P200-2026-0522-B",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "quarantine",
            
        
    
        
        
            
                "produced_at": new Date('2026-05-22T15:10:00Z'),
            
        
    
        
        
            
                "quantity_produced": 12.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Released after inspection pass",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "lot_number": "PLOT-GBX-2026-0512-A",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "released",
            
        
    
        
        
            
                "produced_at": new Date('2026-05-12T14:20:00Z'),
            
        
    
        
        
            
                "quantity_produced": 70.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Subassembly lot for pump builds",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "lot_number": "PLOT-P200-2026-0518-A",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "scrapped",
            
        
    
        
        
            
                "produced_at": new Date('2026-05-18T12:05:00Z'),
            
        
    
        
        
            
                "quantity_produced": 20.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Historical lot shipped to customer",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InspectionPlansData = [
    
    {
    
        
        
            
                "name": "Incoming Inspection Aluminum Plate",
            
        
    
        
        
            
                "plan_number": "IP-RM-AL-001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "audit",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "instructions": "Verify alloy certs, thickness, surface condition, and dimensions",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Incoming Inspection Fasteners M8x20",
            
        
    
        
        
            
                "plan_number": "IP-RM-FST-002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "audit",
            
        
    
        
        
            
                "revision": "B",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "instructions": "Check plating, thread gauge, and count verification",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "In-Process Inspection Gearbox Housing",
            
        
    
        
        
            
                "plan_number": "IP-SA-GBX-010",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "audit",
            
        
    
        
        
            
                "revision": "C",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "instructions": "Measure critical bore and hole pattern at first article and hourly",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Final Inspection Pump P200",
            
        
    
        
        
            
                "plan_number": "IP-FG-P200-020",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "in_process",
            
        
    
        
        
            
                "revision": "D",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "instructions": "Perform leak test, verify torque marks and labeling, record serial trace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InspectionCharacteristicsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence": 10,
            
        
    
        
        
            
                "name": "Thickness",
            
        
    
        
        
            
                "data_type": "pass_fail",
            
        
    
        
        
            
                "target_value": 10.0,
            
        
    
        
        
            
                "lower_spec_limit": 9.8,
            
        
    
        
        
            
                "upper_spec_limit": 10.2,
            
        
    
        
        
            
                "unit": "mm",
            
        
    
        
        
            
                "sampling": "per_lot",
            
        
    
        
        
            
                "required": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence": 20,
            
        
    
        
        
            
                "name": "Surface Condition",
            
        
    
        
        
            
                "data_type": "pass_fail",
            
        
    
        
        
            
                "target_value": 0.0,
            
        
    
        
        
            
                "lower_spec_limit": 0.0,
            
        
    
        
        
            
                "upper_spec_limit": 0.0,
            
        
    
        
        
            
                "unit": "NA",
            
        
    
        
        
            
                "sampling": "aql",
            
        
    
        
        
            
                "required": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence": 10,
            
        
    
        
        
            
                "name": "Main Bore Diameter",
            
        
    
        
        
            
                "data_type": "pass_fail",
            
        
    
        
        
            
                "target_value": 52.0,
            
        
    
        
        
            
                "lower_spec_limit": 51.95,
            
        
    
        
        
            
                "upper_spec_limit": 52.05,
            
        
    
        
        
            
                "unit": "mm",
            
        
    
        
        
            
                "sampling": "100_percent",
            
        
    
        
        
            
                "required": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence": 10,
            
        
    
        
        
            
                "name": "Leak Test",
            
        
    
        
        
            
                "data_type": "numeric",
            
        
    
        
        
            
                "target_value": 0.0,
            
        
    
        
        
            
                "lower_spec_limit": 0.0,
            
        
    
        
        
            
                "upper_spec_limit": 0.0,
            
        
    
        
        
            
                "unit": "NA",
            
        
    
        
        
            
                "sampling": "aql",
            
        
    
        
        
            
                "required": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InspectionsData = [
    
    {
    
        
        
            
                "inspection_number": "INSP-000901",
            
        
    
        
        
            
                "inspection_type": "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
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "started_at": new Date('2026-04-12T15:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-04-12T15:25:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "summary": "All measurements within spec, certs reviewed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "INSP-000915",
            
        
    
        
        
            
                "inspection_type": "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
            
        
    
        
        
            
                "status": "passed",
            
        
    
        
        
            
                "started_at": new Date('2026-05-03T11:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-05-03T11:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "summary": "Thread gauge OK, plating acceptable",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "INSP-000932",
            
        
    
        
        
            
                "inspection_type": "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
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "started_at": new Date('2026-05-15T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-05-15T17:35:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "summary": "Main bore out of spec on sample, lot placed in quarantine",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "INSP-000940",
            
        
    
        
        
            
                "inspection_type": "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
            
        
    
        
        
            
                "status": "planned",
            
        
    
        
        
            
                "started_at": new Date('2026-05-22T16:10:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-05-22T17:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "summary": "Final inspection started for first produced lot",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InspectionResultsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "na",
            
        
    
        
        
            
                "measured_value": 10.02,
            
        
    
        
        
            
                "notes": "Average of three points",
            
        
    
        
        
            
                "measured_at": new Date('2026-04-12T15:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "pass",
            
        
    
        
        
            
                "measured_value": 0.0,
            
        
    
        
        
            
                "notes": "No visible dents or oxidation",
            
        
    
        
        
            
                "measured_at": new Date('2026-04-12T15:12:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "na",
            
        
    
        
        
            
                "measured_value": 52.12,
            
        
    
        
        
            
                "notes": "Exceeded upper spec on part 4",
            
        
    
        
        
            
                "measured_at": new Date('2026-05-15T17:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "na",
            
        
    
        
        
            
                "measured_value": 0.0,
            
        
    
        
        
            
                "notes": "Pending leak test fixture availability",
            
        
    
        
        
            
                "measured_at": new Date('2026-05-22T16:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const NonconformancesData = [
    
    {
    
        
        
            
                "ncr_number": "NCR-2026-017",
            
        
    
        
        
            
                "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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "minor",
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "reported_at": new Date('2026-05-15T18:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Main bore diameter measured above upper spec limit during in-process inspection",
            
        
    
        
        
            
                "containment_action": "Move lot to QA quarantine location and block issuance to production orders",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "NCR-2026-018",
            
        
    
        
        
            
                "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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "status": "dispositioned",
            
        
    
        
        
            
                "reported_at": new Date('2026-05-19T11:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Leak test failure on finished unit, unable to meet acceptance criteria",
            
        
    
        
        
            
                "containment_action": "Segregate unit and review assembly records",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "NCR-2026-019",
            
        
    
        
        
            
                "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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "major",
            
        
    
        
        
            
                "status": "dispositioned",
            
        
    
        
        
            
                "reported_at": new Date('2026-05-20T14:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Surface finish inconsistent on small section of received plate",
            
        
    
        
        
            
                "containment_action": "Place lot on hold pending supplier confirmation and internal review",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "NCR-2026-020",
            
        
    
        
        
            
                "source": "customer_return",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "severity": "major",
            
        
    
        
        
            
                "status": "contained",
            
        
    
        
        
            
                "reported_at": new Date('2026-05-10T13:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Minor print smudge found on carton label area on one sample",
            
        
    
        
        
            
                "containment_action": "Increase sampling for next receipt; remainder acceptable",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DispositionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "disposition_type": "repair",
            
        
    
        
        
            
                "status": "proposed",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-05-24T17:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "instructions": "Sort quarantined lot, measure 100 percent main bore, segregate nonconforming parts",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "disposition_type": "scrap",
            
        
    
        
        
            
                "status": "proposed",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-05-20T17:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-05-20T16:30:00Z'),
            
        
    
        
        
            
                "instructions": "Scrap failed unit and record cause in CAPA",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "disposition_type": "repair",
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-05-27T17:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "instructions": "Use remaining acceptable portion after additional inspection of cut blanks",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "disposition_type": "scrap",
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-05-12T17:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-05-12T15:00:00Z'),
            
        
    
        
        
            
                "instructions": "Proceed with use; monitor next receipt",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CorrectiveActionsData = [
    
    {
    
        
        
            
                "capa_number": "CAPA-2026-006",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "type": "corrective",
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "priority": "urgent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "opened_at": new Date('2026-05-16T09:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-06T17:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "root_cause": "Tool wear not detected due to extended run without mid-shift check",
            
        
    
        
        
            
                "action_plan": "Add bore gauge check every 20 parts and update CNC program offsets checklist",
            
        
    
        
        
            
                "effectiveness_check": "Review next two lots for capability and zero escapes",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "capa_number": "CAPA-2026-007",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "type": "preventive",
            
        
    
        
        
            
                "status": "implementing",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "opened_at": new Date('2026-05-19T14:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-05-30T17:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "root_cause": "Seal installation step not followed consistently during peak shift change",
            
        
    
        
        
            
                "action_plan": "Revise work instruction, implement sign-off at seal installation, refresh training",
            
        
    
        
        
            
                "effectiveness_check": "Audit 10 consecutive builds for compliance",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "capa_number": "CAPA-2026-008",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "type": "corrective",
            
        
    
        
        
            
                "status": "investigating",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "opened_at": new Date('2026-05-21T10:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-15T17:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "root_cause": "Supplier finish variation not specified clearly in purchase notes",
            
        
    
        
        
            
                "action_plan": "Update material spec acceptance criteria and notify supplier",
            
        
    
        
        
            
                "effectiveness_check": "Incoming inspection trend review for next three receipts",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "capa_number": "CAPA-2026-009",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "type": "corrective",
            
        
    
        
        
            
                "status": "action_planning",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "opened_at": new Date('2026-05-22T18:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-05T17:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "root_cause": "Visual mark step not highlighted on traveler for new operator",
            
        
    
        
        
            
                "action_plan": "Update traveler and add training checklist sign-off",
            
        
    
        
        
            
                "effectiveness_check": "Operator observation for two shifts",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DowntimeEventsData = [
    
    {
    
        
        
            
                "event_number": "DT-CHI-00031",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason_category": "planned_maintenance",
            
        
    
        
        
            
                "reason_detail": "Tape head jam and sensor fault during carton sealing",
            
        
    
        
        
            
                "started_at": new Date('2026-05-22T09:15:00Z'),
            
        
    
        
        
            
                "ended_at": new Date('2026-05-22T10:05:00Z'),
            
        
    
        
        
            
                "planned": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "event_number": "DT-CHI-00032",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason_category": "unplanned_maintenance",
            
        
    
        
        
            
                "reason_detail": "Fixture changeover for gearbox housing revision C",
            
        
    
        
        
            
                "started_at": new Date('2026-05-10T06:40:00Z'),
            
        
    
        
        
            
                "ended_at": new Date('2026-05-10T07:05:00Z'),
            
        
    
        
        
            
                "planned": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "event_number": "DT-CHI-00033",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason_category": "unplanned_maintenance",
            
        
    
        
        
            
                "reason_detail": "Waiting on quarantined gearbox housings clearance",
            
        
    
        
        
            
                "started_at": new Date('2026-05-22T13:30:00Z'),
            
        
    
        
        
            
                "ended_at": new Date('2026-05-22T14:20:00Z'),
            
        
    
        
        
            
                "planned": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "event_number": "DT-CHI-00034",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason_category": "material_shortage",
            
        
    
        
        
            
                "reason_detail": "CMM calibration and verification",
            
        
    
        
        
            
                "started_at": new Date('2026-05-18T08:00:00Z'),
            
        
    
        
        
            
                "ended_at": new Date('2026-05-18T11:30:00Z'),
            
        
    
        
        
            
                "planned": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const MachineReadingsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "recorded_at": new Date('2026-05-22T23:59:00Z'),
            
        
    
        
        
            
                "run_minutes": 780.0,
            
        
    
        
        
            
                "down_minutes": 45.0,
            
        
    
        
        
            
                "good_count": 120.0,
            
        
    
        
        
            
                "scrap_count": 0.0,
            
        
    
        
        
            
                "cycle_time_seconds": 55.0,
            
        
    
        
        
            
                "energy_kwh": 68.5,
            
        
    
        
        
            
                "notes": "Stable run, minor stoppage for chip clearing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "recorded_at": new Date('2026-05-22T23:59:00Z'),
            
        
    
        
        
            
                "run_minutes": 640.0,
            
        
    
        
        
            
                "down_minutes": 70.0,
            
        
    
        
        
            
                "good_count": 22.0,
            
        
    
        
        
            
                "scrap_count": 1.0,
            
        
    
        
        
            
                "cycle_time_seconds": 95.0,
            
        
    
        
        
            
                "energy_kwh": 22.3,
            
        
    
        
        
            
                "notes": "Paused for material shortage window",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "recorded_at": new Date('2026-05-22T23:59:00Z'),
            
        
    
        
        
            
                "run_minutes": 410.0,
            
        
    
        
        
            
                "down_minutes": 95.0,
            
        
    
        
        
            
                "good_count": 60.0,
            
        
    
        
        
            
                "scrap_count": 0.0,
            
        
    
        
        
            
                "cycle_time_seconds": 40.0,
            
        
    
        
        
            
                "energy_kwh": 12.1,
            
        
    
        
        
            
                "notes": "Downtime due to sealer jam",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "recorded_at": new Date('2026-05-18T23:59:00Z'),
            
        
    
        
        
            
                "run_minutes": 300.0,
            
        
    
        
        
            
                "down_minutes": 210.0,
            
        
    
        
        
            
                "good_count": 0.0,
            
        
    
        
        
            
                "scrap_count": 0.0,
            
        
    
        
        
            
                "cycle_time_seconds": 0.0,
            
        
    
        
        
            
                "energy_kwh": 9.4,
            
        
    
        
        
            
                "notes": "Calibration performed during day shift",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const MaintenanceWorkOrdersData = [
    
    {
    
        
        
            
                "work_order_number": "MWO-CHI-00211",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "inspection",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "requested_at": new Date('2026-05-22T09:20:00Z'),
            
        
    
        
        
            
                "scheduled_start": new Date('2026-05-22T09:30:00Z'),
            
        
    
        
        
            
                "scheduled_end": new Date('2026-05-22T10:15:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-05-22T10:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Investigate and clear carton sealer jam, verify sensors",
            
        
    
        
        
            
                "resolution_notes": "Cleared jam, replaced worn roller, reset sensor alignment",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "MWO-CHI-00212",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "calibration",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "requested_at": new Date('2026-05-10T12:00:00Z'),
            
        
    
        
        
            
                "scheduled_start": new Date('2026-05-18T08:00:00Z'),
            
        
    
        
        
            
                "scheduled_end": new Date('2026-05-18T12:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-05-18T11:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Annual CMM calibration and verification",
            
        
    
        
        
            
                "resolution_notes": "Calibration completed, certificate uploaded to document control",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "MWO-CHI-00213",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "corrective",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "requested_at": new Date('2026-05-15T10:00:00Z'),
            
        
    
        
        
            
                "scheduled_start": new Date('2026-06-01T07:00:00Z'),
            
        
    
        
        
            
                "scheduled_end": new Date('2026-06-01T09:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Monthly spindle inspection and coolant maintenance",
            
        
    
        
        
            
                "resolution_notes": "",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "MWO-CHI-00214",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "calibration",
            
        
    
        
        
            
                "priority": "medium",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "requested_at": new Date('2026-05-17T16:20:00Z'),
            
        
    
        
        
            
                "scheduled_start": new Date('2026-05-17T16:25:00Z'),
            
        
    
        
        
            
                "scheduled_end": new Date('2026-05-17T17:15:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Check lathe power alarm and UPS logs",
            
        
    
        
        
            
                "resolution_notes": "Initial checks OK, monitoring power quality",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DocumentsData = [
    
    {
    
        
        
            
                "title": "SOP Receiving and Putaway",
            
        
    
        
        
            
                "document_type": "work_instruction",
            
        
    
        
        
            
                "document_number": "SOP-WH-001",
            
        
    
        
        
            
                "revision": "B",
            
        
    
        
        
            
                "status": "under_review",
            
        
    
        
        
            
                "effective_from": new Date('2025-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2028-12-31T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "summary": "Standard process for receiving, inspection routing, and putaway.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "title": "Work Instruction Final Assembly Pump P200",
            
        
    
        
        
            
                "document_type": "other",
            
        
    
        
        
            
                "document_number": "WI-ASSY-P200",
            
        
    
        
        
            
                "revision": "D",
            
        
    
        
        
            
                "status": "under_review",
            
        
    
        
        
            
                "effective_from": new Date('2025-06-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2028-12-31T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "summary": "Step-by-step assembly with torque specs and marking requirements.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "title": "Specification Leak Test Acceptance",
            
        
    
        
        
            
                "document_type": "sop",
            
        
    
        
        
            
                "document_number": "SPEC-QA-LEAK-01",
            
        
    
        
        
            
                "revision": "C",
            
        
    
        
        
            
                "status": "under_review",
            
        
    
        
        
            
                "effective_from": new Date('2024-08-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2028-12-31T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "summary": "Leak test method, pressure, dwell time, and pass criteria.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "title": "Calibration Record Template",
            
        
    
        
        
            
                "document_type": "policy",
            
        
    
        
        
            
                "document_number": "FRM-QA-CAL-02",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "effective_from": new Date('2024-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2028-12-31T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "summary": "Template used to record calibration activities and results.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ShipmentsData = [
    
    {
    
        
        
            
                "shipment_number": "SHP-CHI-00321",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "shipped",
            
        
    
        
        
            
                "scheduled_ship_at": new Date('2026-05-24T20:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "carrier": "FedEx Freight",
            
        
    
        
        
            
                "tracking_number": "FXF-88231045",
            
        
    
        
        
            
                "notes": "Hold until QA release for all serials in lot",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "shipment_number": "SHP-CHI-00322",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "scheduled_ship_at": new Date('2026-05-19T20:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-05-19T21:10:00Z'),
            
        
    
        
        
            
                "carrier": "UPS",
            
        
    
        
        
            
                "tracking_number": "1Z999AA10123456784",
            
        
    
        
        
            
                "notes": "Partial shipment per customer request",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "shipment_number": "SHP-NWK-00110",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "packed",
            
        
    
        
        
            
                "scheduled_ship_at": new Date('2026-05-10T20:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-05-10T21:00:00Z'),
            
        
    
        
        
            
                "carrier": "DHL",
            
        
    
        
        
            
                "tracking_number": "DHL-77441002",
            
        
    
        
        
            
                "notes": "Delivered with proof of delivery",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "shipment_number": "SHP-CHI-00323",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "delivered",
            
        
    
        
        
            
                "scheduled_ship_at": new Date('2026-05-30T20:00:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-06-04T14:17:39Z'),
            
        
    
        
        
            
                "carrier": "LTL Carrier",
            
        
    
        
        
            
                "tracking_number": "LTL-PENDING",
            
        
    
        
        
            
                "notes": "To be scheduled after completion of PO-10046",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ShipmentLinesData = [
    
    {
    
        
        
            
                // 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": 10.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "notes": "Pack with certificates and inspection summary",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "quantity": 8.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "notes": "Ship serials SN-P200-CHI-000102 and SN-P200-CHI-000103",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "quantity": 12.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "notes": "Delivered to Harbor Industrial Services",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "quantity": 0.0,
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "notes": "Awaiting production completion",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateUserWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User0 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (User0?.setOrganization)
                {
                    await
                    User0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User1 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (User1?.setOrganization)
                {
                    await
                    User1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User2 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (User2?.setOrganization)
                {
                    await
                    User2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User3 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (User3?.setOrganization)
                {
                    await
                    User3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePlantWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Plant0 = await Plants.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Plant0?.setOrganization)
                {
                    await
                    Plant0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Plant1 = await Plants.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Plant1?.setOrganization)
                {
                    await
                    Plant1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Plant2 = await Plants.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Plant2?.setOrganization)
                {
                    await
                    Plant2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Plant3 = await Plants.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Plant3?.setOrganization)
                {
                    await
                    Plant3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateWorkCenterWithPlant() {
            
                const relatedPlant0 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const WorkCenter0 = await WorkCenters.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkCenter0?.setPlant)
                {
                    await
                    WorkCenter0.
                    setPlant(relatedPlant0);
                }
            
                const relatedPlant1 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const WorkCenter1 = await WorkCenters.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkCenter1?.setPlant)
                {
                    await
                    WorkCenter1.
                    setPlant(relatedPlant1);
                }
            
                const relatedPlant2 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const WorkCenter2 = await WorkCenters.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkCenter2?.setPlant)
                {
                    await
                    WorkCenter2.
                    setPlant(relatedPlant2);
                }
            
                const relatedPlant3 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const WorkCenter3 = await WorkCenters.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WorkCenter3?.setPlant)
                {
                    await
                    WorkCenter3.
                    setPlant(relatedPlant3);
                }
            
        }
        
    
        
    
        
            
            async function associateWorkCenterWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WorkCenter0 = await WorkCenters.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkCenter0?.setOrganization)
                {
                    await
                    WorkCenter0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WorkCenter1 = await WorkCenters.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkCenter1?.setOrganization)
                {
                    await
                    WorkCenter1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WorkCenter2 = await WorkCenters.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkCenter2?.setOrganization)
                {
                    await
                    WorkCenter2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WorkCenter3 = await WorkCenters.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WorkCenter3?.setOrganization)
                {
                    await
                    WorkCenter3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
            
            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 associateMachineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Machine0 = await Machines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Machine0?.setOrganization)
                {
                    await
                    Machine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Machine1 = await Machines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Machine1?.setOrganization)
                {
                    await
                    Machine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Machine2 = await Machines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Machine2?.setOrganization)
                {
                    await
                    Machine2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Machine3 = await Machines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Machine3?.setOrganization)
                {
                    await
                    Machine3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateMaterialWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Material0 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Material0?.setOrganization)
                {
                    await
                    Material0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Material1 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Material1?.setOrganization)
                {
                    await
                    Material1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Material2 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Material2?.setOrganization)
                {
                    await
                    Material2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Material3 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Material3?.setOrganization)
                {
                    await
                    Material3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
            
            async function associateBomHeaderWithParent_material() {
            
                const relatedParent_material0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomHeader0 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomHeader0?.setParent_material)
                {
                    await
                    BomHeader0.
                    setParent_material(relatedParent_material0);
                }
            
                const relatedParent_material1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomHeader1 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomHeader1?.setParent_material)
                {
                    await
                    BomHeader1.
                    setParent_material(relatedParent_material1);
                }
            
                const relatedParent_material2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomHeader2 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomHeader2?.setParent_material)
                {
                    await
                    BomHeader2.
                    setParent_material(relatedParent_material2);
                }
            
                const relatedParent_material3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomHeader3 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomHeader3?.setParent_material)
                {
                    await
                    BomHeader3.
                    setParent_material(relatedParent_material3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateBomHeaderWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BomHeader0 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomHeader0?.setOrganization)
                {
                    await
                    BomHeader0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BomHeader1 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomHeader1?.setOrganization)
                {
                    await
                    BomHeader1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BomHeader2 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomHeader2?.setOrganization)
                {
                    await
                    BomHeader2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BomHeader3 = await BomHeaders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomHeader3?.setOrganization)
                {
                    await
                    BomHeader3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateBomLineWithBom() {
            
                const relatedBom0 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const BomLine0 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomLine0?.setBom)
                {
                    await
                    BomLine0.
                    setBom(relatedBom0);
                }
            
                const relatedBom1 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const BomLine1 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomLine1?.setBom)
                {
                    await
                    BomLine1.
                    setBom(relatedBom1);
                }
            
                const relatedBom2 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const BomLine2 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomLine2?.setBom)
                {
                    await
                    BomLine2.
                    setBom(relatedBom2);
                }
            
                const relatedBom3 = await BomHeaders.findOne({
                    offset: Math.floor(Math.random() * (await BomHeaders.count())),
                });
                const BomLine3 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomLine3?.setBom)
                {
                    await
                    BomLine3.
                    setBom(relatedBom3);
                }
            
        }
        
    
        
            
            async function associateBomLineWithComponent_material() {
            
                const relatedComponent_material0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomLine0 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomLine0?.setComponent_material)
                {
                    await
                    BomLine0.
                    setComponent_material(relatedComponent_material0);
                }
            
                const relatedComponent_material1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomLine1 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomLine1?.setComponent_material)
                {
                    await
                    BomLine1.
                    setComponent_material(relatedComponent_material1);
                }
            
                const relatedComponent_material2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomLine2 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomLine2?.setComponent_material)
                {
                    await
                    BomLine2.
                    setComponent_material(relatedComponent_material2);
                }
            
                const relatedComponent_material3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomLine3 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomLine3?.setComponent_material)
                {
                    await
                    BomLine3.
                    setComponent_material(relatedComponent_material3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateBomLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BomLine0 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomLine0?.setOrganization)
                {
                    await
                    BomLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BomLine1 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomLine1?.setOrganization)
                {
                    await
                    BomLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BomLine2 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomLine2?.setOrganization)
                {
                    await
                    BomLine2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BomLine3 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomLine3?.setOrganization)
                {
                    await
                    BomLine3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
            
            async function associateRoutingWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Routing0 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Routing0?.setMaterial)
                {
                    await
                    Routing0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Routing1 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Routing1?.setMaterial)
                {
                    await
                    Routing1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Routing2 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Routing2?.setMaterial)
                {
                    await
                    Routing2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Routing3 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Routing3?.setMaterial)
                {
                    await
                    Routing3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateRoutingWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Routing0 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Routing0?.setOrganization)
                {
                    await
                    Routing0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Routing1 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Routing1?.setOrganization)
                {
                    await
                    Routing1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Routing2 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Routing2?.setOrganization)
                {
                    await
                    Routing2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Routing3 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Routing3?.setOrganization)
                {
                    await
                    Routing3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateRoutingStepWithRouting() {
            
                const relatedRouting0 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const RoutingStep0 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoutingStep0?.setRouting)
                {
                    await
                    RoutingStep0.
                    setRouting(relatedRouting0);
                }
            
                const relatedRouting1 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const RoutingStep1 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoutingStep1?.setRouting)
                {
                    await
                    RoutingStep1.
                    setRouting(relatedRouting1);
                }
            
                const relatedRouting2 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const RoutingStep2 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoutingStep2?.setRouting)
                {
                    await
                    RoutingStep2.
                    setRouting(relatedRouting2);
                }
            
                const relatedRouting3 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const RoutingStep3 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoutingStep3?.setRouting)
                {
                    await
                    RoutingStep3.
                    setRouting(relatedRouting3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateRoutingStepWithWork_center() {
            
                const relatedWork_center0 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingStep0 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoutingStep0?.setWork_center)
                {
                    await
                    RoutingStep0.
                    setWork_center(relatedWork_center0);
                }
            
                const relatedWork_center1 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingStep1 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoutingStep1?.setWork_center)
                {
                    await
                    RoutingStep1.
                    setWork_center(relatedWork_center1);
                }
            
                const relatedWork_center2 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingStep2 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoutingStep2?.setWork_center)
                {
                    await
                    RoutingStep2.
                    setWork_center(relatedWork_center2);
                }
            
                const relatedWork_center3 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingStep3 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoutingStep3?.setWork_center)
                {
                    await
                    RoutingStep3.
                    setWork_center(relatedWork_center3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateRoutingStepWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RoutingStep0 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoutingStep0?.setOrganization)
                {
                    await
                    RoutingStep0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RoutingStep1 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoutingStep1?.setOrganization)
                {
                    await
                    RoutingStep1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RoutingStep2 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoutingStep2?.setOrganization)
                {
                    await
                    RoutingStep2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RoutingStep3 = await RoutingSteps.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoutingStep3?.setOrganization)
                {
                    await
                    RoutingStep3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSupplierWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Supplier0 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Supplier0?.setOrganization)
                {
                    await
                    Supplier0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Supplier1 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Supplier1?.setOrganization)
                {
                    await
                    Supplier1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Supplier2 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Supplier2?.setOrganization)
                {
                    await
                    Supplier2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Supplier3 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Supplier3?.setOrganization)
                {
                    await
                    Supplier3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCustomerWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setOrganization)
                {
                    await
                    Customer0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setOrganization)
                {
                    await
                    Customer1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setOrganization)
                {
                    await
                    Customer2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer3 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Customer3?.setOrganization)
                {
                    await
                    Customer3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
            
            async function associateWarehousWithPlant() {
            
                const relatedPlant0 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Warehous0 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Warehous0?.setPlant)
                {
                    await
                    Warehous0.
                    setPlant(relatedPlant0);
                }
            
                const relatedPlant1 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Warehous1 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Warehous1?.setPlant)
                {
                    await
                    Warehous1.
                    setPlant(relatedPlant1);
                }
            
                const relatedPlant2 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Warehous2 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Warehous2?.setPlant)
                {
                    await
                    Warehous2.
                    setPlant(relatedPlant2);
                }
            
                const relatedPlant3 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Warehous3 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Warehous3?.setPlant)
                {
                    await
                    Warehous3.
                    setPlant(relatedPlant3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateWarehousWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous0 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Warehous0?.setOrganization)
                {
                    await
                    Warehous0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous1 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Warehous1?.setOrganization)
                {
                    await
                    Warehous1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous2 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Warehous2?.setOrganization)
                {
                    await
                    Warehous2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous3 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Warehous3?.setOrganization)
                {
                    await
                    Warehous3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
            
            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 associateLocationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location0 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Location0?.setOrganization)
                {
                    await
                    Location0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location1 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Location1?.setOrganization)
                {
                    await
                    Location1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location2 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Location2?.setOrganization)
                {
                    await
                    Location2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location3 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Location3?.setOrganization)
                {
                    await
                    Location3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateLotWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Lot0 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lot0?.setMaterial)
                {
                    await
                    Lot0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Lot1 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lot1?.setMaterial)
                {
                    await
                    Lot1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Lot2 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lot2?.setMaterial)
                {
                    await
                    Lot2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Lot3 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Lot3?.setMaterial)
                {
                    await
                    Lot3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateLotWithPlant() {
            
                const relatedPlant0 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Lot0 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lot0?.setPlant)
                {
                    await
                    Lot0.
                    setPlant(relatedPlant0);
                }
            
                const relatedPlant1 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Lot1 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lot1?.setPlant)
                {
                    await
                    Lot1.
                    setPlant(relatedPlant1);
                }
            
                const relatedPlant2 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Lot2 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lot2?.setPlant)
                {
                    await
                    Lot2.
                    setPlant(relatedPlant2);
                }
            
                const relatedPlant3 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Lot3 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Lot3?.setPlant)
                {
                    await
                    Lot3.
                    setPlant(relatedPlant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateLotWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot0 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lot0?.setSupplier)
                {
                    await
                    Lot0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot1 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lot1?.setSupplier)
                {
                    await
                    Lot1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot2 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lot2?.setSupplier)
                {
                    await
                    Lot2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot3 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Lot3?.setSupplier)
                {
                    await
                    Lot3.
                    setSupplier(relatedSupplier3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateLotWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Lot0 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lot0?.setOrganization)
                {
                    await
                    Lot0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Lot1 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lot1?.setOrganization)
                {
                    await
                    Lot1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Lot2 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lot2?.setOrganization)
                {
                    await
                    Lot2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Lot3 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Lot3?.setOrganization)
                {
                    await
                    Lot3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateSerialWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Serial0 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Serial0?.setMaterial)
                {
                    await
                    Serial0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Serial1 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Serial1?.setMaterial)
                {
                    await
                    Serial1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Serial2 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Serial2?.setMaterial)
                {
                    await
                    Serial2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Serial3 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Serial3?.setMaterial)
                {
                    await
                    Serial3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateSerialWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Serial0 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Serial0?.setLot)
                {
                    await
                    Serial0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Serial1 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Serial1?.setLot)
                {
                    await
                    Serial1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Serial2 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Serial2?.setLot)
                {
                    await
                    Serial2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Serial3 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Serial3?.setLot)
                {
                    await
                    Serial3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
            
            async function associateSerialWithPlant() {
            
                const relatedPlant0 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Serial0 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Serial0?.setPlant)
                {
                    await
                    Serial0.
                    setPlant(relatedPlant0);
                }
            
                const relatedPlant1 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Serial1 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Serial1?.setPlant)
                {
                    await
                    Serial1.
                    setPlant(relatedPlant1);
                }
            
                const relatedPlant2 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Serial2 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Serial2?.setPlant)
                {
                    await
                    Serial2.
                    setPlant(relatedPlant2);
                }
            
                const relatedPlant3 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Serial3 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Serial3?.setPlant)
                {
                    await
                    Serial3.
                    setPlant(relatedPlant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateSerialWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Serial0 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Serial0?.setOrganization)
                {
                    await
                    Serial0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Serial1 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Serial1?.setOrganization)
                {
                    await
                    Serial1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Serial2 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Serial2?.setOrganization)
                {
                    await
                    Serial2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Serial3 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Serial3?.setOrganization)
                {
                    await
                    Serial3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInventoryBalanceWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setMaterial)
                {
                    await
                    InventoryBalance0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setMaterial)
                {
                    await
                    InventoryBalance1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setMaterial)
                {
                    await
                    InventoryBalance2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setMaterial)
                {
                    await
                    InventoryBalance3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            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 Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setLot)
                {
                    await
                    InventoryBalance0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setLot)
                {
                    await
                    InventoryBalance1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setLot)
                {
                    await
                    InventoryBalance2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setLot)
                {
                    await
                    InventoryBalance3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInventoryBalanceWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setOrganization)
                {
                    await
                    InventoryBalance0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setOrganization)
                {
                    await
                    InventoryBalance1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setOrganization)
                {
                    await
                    InventoryBalance2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setOrganization)
                {
                    await
                    InventoryBalance3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateInventoryTransactionWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setMaterial)
                {
                    await
                    InventoryTransaction0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setMaterial)
                {
                    await
                    InventoryTransaction1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setMaterial)
                {
                    await
                    InventoryTransaction2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setMaterial)
                {
                    await
                    InventoryTransaction3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setLot)
                {
                    await
                    InventoryTransaction0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setLot)
                {
                    await
                    InventoryTransaction1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setLot)
                {
                    await
                    InventoryTransaction2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.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 associateInventoryTransactionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setOrganization)
                {
                    await
                    InventoryTransaction0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setOrganization)
                {
                    await
                    InventoryTransaction1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setOrganization)
                {
                    await
                    InventoryTransaction2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setOrganization)
                {
                    await
                    InventoryTransaction3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateCycleCountWithPlant() {
            
                const relatedPlant0 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const CycleCount0 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CycleCount0?.setPlant)
                {
                    await
                    CycleCount0.
                    setPlant(relatedPlant0);
                }
            
                const relatedPlant1 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const CycleCount1 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CycleCount1?.setPlant)
                {
                    await
                    CycleCount1.
                    setPlant(relatedPlant1);
                }
            
                const relatedPlant2 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const CycleCount2 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CycleCount2?.setPlant)
                {
                    await
                    CycleCount2.
                    setPlant(relatedPlant2);
                }
            
                const relatedPlant3 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const CycleCount3 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CycleCount3?.setPlant)
                {
                    await
                    CycleCount3.
                    setPlant(relatedPlant3);
                }
            
        }
        
    
        
            
            async function associateCycleCountWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const CycleCount0 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CycleCount0?.setWarehouse)
                {
                    await
                    CycleCount0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const CycleCount1 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CycleCount1?.setWarehouse)
                {
                    await
                    CycleCount1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const CycleCount2 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CycleCount2?.setWarehouse)
                {
                    await
                    CycleCount2.
                    setWarehouse(relatedWarehouse2);
                }
            
                const relatedWarehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const CycleCount3 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CycleCount3?.setWarehouse)
                {
                    await
                    CycleCount3.
                    setWarehouse(relatedWarehouse3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateCycleCountWithAssigned_to() {
            
                const relatedAssigned_to0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CycleCount0 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CycleCount0?.setAssigned_to)
                {
                    await
                    CycleCount0.
                    setAssigned_to(relatedAssigned_to0);
                }
            
                const relatedAssigned_to1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CycleCount1 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CycleCount1?.setAssigned_to)
                {
                    await
                    CycleCount1.
                    setAssigned_to(relatedAssigned_to1);
                }
            
                const relatedAssigned_to2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CycleCount2 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CycleCount2?.setAssigned_to)
                {
                    await
                    CycleCount2.
                    setAssigned_to(relatedAssigned_to2);
                }
            
                const relatedAssigned_to3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CycleCount3 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CycleCount3?.setAssigned_to)
                {
                    await
                    CycleCount3.
                    setAssigned_to(relatedAssigned_to3);
                }
            
        }
        
    
        
    
        
            
            async function associateCycleCountWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CycleCount0 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CycleCount0?.setOrganization)
                {
                    await
                    CycleCount0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CycleCount1 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CycleCount1?.setOrganization)
                {
                    await
                    CycleCount1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CycleCount2 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CycleCount2?.setOrganization)
                {
                    await
                    CycleCount2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CycleCount3 = await CycleCounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CycleCount3?.setOrganization)
                {
                    await
                    CycleCount3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCycleCountLineWithCycle_count() {
            
                const relatedCycle_count0 = await CycleCounts.findOne({
                    offset: Math.floor(Math.random() * (await CycleCounts.count())),
                });
                const CycleCountLine0 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CycleCountLine0?.setCycle_count)
                {
                    await
                    CycleCountLine0.
                    setCycle_count(relatedCycle_count0);
                }
            
                const relatedCycle_count1 = await CycleCounts.findOne({
                    offset: Math.floor(Math.random() * (await CycleCounts.count())),
                });
                const CycleCountLine1 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CycleCountLine1?.setCycle_count)
                {
                    await
                    CycleCountLine1.
                    setCycle_count(relatedCycle_count1);
                }
            
                const relatedCycle_count2 = await CycleCounts.findOne({
                    offset: Math.floor(Math.random() * (await CycleCounts.count())),
                });
                const CycleCountLine2 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CycleCountLine2?.setCycle_count)
                {
                    await
                    CycleCountLine2.
                    setCycle_count(relatedCycle_count2);
                }
            
                const relatedCycle_count3 = await CycleCounts.findOne({
                    offset: Math.floor(Math.random() * (await CycleCounts.count())),
                });
                const CycleCountLine3 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CycleCountLine3?.setCycle_count)
                {
                    await
                    CycleCountLine3.
                    setCycle_count(relatedCycle_count3);
                }
            
        }
        
    
        
            
            async function associateCycleCountLineWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const CycleCountLine0 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CycleCountLine0?.setLocation)
                {
                    await
                    CycleCountLine0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const CycleCountLine1 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CycleCountLine1?.setLocation)
                {
                    await
                    CycleCountLine1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const CycleCountLine2 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CycleCountLine2?.setLocation)
                {
                    await
                    CycleCountLine2.
                    setLocation(relatedLocation2);
                }
            
                const relatedLocation3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const CycleCountLine3 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CycleCountLine3?.setLocation)
                {
                    await
                    CycleCountLine3.
                    setLocation(relatedLocation3);
                }
            
        }
        
    
        
            
            async function associateCycleCountLineWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const CycleCountLine0 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CycleCountLine0?.setMaterial)
                {
                    await
                    CycleCountLine0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const CycleCountLine1 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CycleCountLine1?.setMaterial)
                {
                    await
                    CycleCountLine1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const CycleCountLine2 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CycleCountLine2?.setMaterial)
                {
                    await
                    CycleCountLine2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const CycleCountLine3 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CycleCountLine3?.setMaterial)
                {
                    await
                    CycleCountLine3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateCycleCountLineWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const CycleCountLine0 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CycleCountLine0?.setLot)
                {
                    await
                    CycleCountLine0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const CycleCountLine1 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CycleCountLine1?.setLot)
                {
                    await
                    CycleCountLine1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const CycleCountLine2 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CycleCountLine2?.setLot)
                {
                    await
                    CycleCountLine2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const CycleCountLine3 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CycleCountLine3?.setLot)
                {
                    await
                    CycleCountLine3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCycleCountLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CycleCountLine0 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CycleCountLine0?.setOrganization)
                {
                    await
                    CycleCountLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CycleCountLine1 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CycleCountLine1?.setOrganization)
                {
                    await
                    CycleCountLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CycleCountLine2 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CycleCountLine2?.setOrganization)
                {
                    await
                    CycleCountLine2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CycleCountLine3 = await CycleCountLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CycleCountLine3?.setOrganization)
                {
                    await
                    CycleCountLine3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateProductionOrderWithPlant() {
            
                const relatedPlant0 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setPlant)
                {
                    await
                    ProductionOrder0.
                    setPlant(relatedPlant0);
                }
            
                const relatedPlant1 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setPlant)
                {
                    await
                    ProductionOrder1.
                    setPlant(relatedPlant1);
                }
            
                const relatedPlant2 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setPlant)
                {
                    await
                    ProductionOrder2.
                    setPlant(relatedPlant2);
                }
            
                const relatedPlant3 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setPlant)
                {
                    await
                    ProductionOrder3.
                    setPlant(relatedPlant3);
                }
            
        }
        
    
        
            
            async function associateProductionOrderWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setMaterial)
                {
                    await
                    ProductionOrder0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setMaterial)
                {
                    await
                    ProductionOrder1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setMaterial)
                {
                    await
                    ProductionOrder2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setMaterial)
                {
                    await
                    ProductionOrder3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            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 Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setRouting)
                {
                    await
                    ProductionOrder0.
                    setRouting(relatedRouting0);
                }
            
                const relatedRouting1 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setRouting)
                {
                    await
                    ProductionOrder1.
                    setRouting(relatedRouting1);
                }
            
                const relatedRouting2 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setRouting)
                {
                    await
                    ProductionOrder2.
                    setRouting(relatedRouting2);
                }
            
                const relatedRouting3 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setRouting)
                {
                    await
                    ProductionOrder3.
                    setRouting(relatedRouting3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductionOrderWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setCustomer)
                {
                    await
                    ProductionOrder0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setCustomer)
                {
                    await
                    ProductionOrder1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setCustomer)
                {
                    await
                    ProductionOrder2.
                    setCustomer(relatedCustomer2);
                }
            
                const relatedCustomer3 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setCustomer)
                {
                    await
                    ProductionOrder3.
                    setCustomer(relatedCustomer3);
                }
            
        }
        
    
        
    
        
    
        
            
            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 associateProductionOrderWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setOrganization)
                {
                    await
                    ProductionOrder0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setOrganization)
                {
                    await
                    ProductionOrder1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setOrganization)
                {
                    await
                    ProductionOrder2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setOrganization)
                {
                    await
                    ProductionOrder3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            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_step() {
            
                const relatedRouting_step0 = await RoutingSteps.findOne({
                    offset: Math.floor(Math.random() * (await RoutingSteps.count())),
                });
                const ProductionOperation0 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOperation0?.setRouting_step)
                {
                    await
                    ProductionOperation0.
                    setRouting_step(relatedRouting_step0);
                }
            
                const relatedRouting_step1 = await RoutingSteps.findOne({
                    offset: Math.floor(Math.random() * (await RoutingSteps.count())),
                });
                const ProductionOperation1 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOperation1?.setRouting_step)
                {
                    await
                    ProductionOperation1.
                    setRouting_step(relatedRouting_step1);
                }
            
                const relatedRouting_step2 = await RoutingSteps.findOne({
                    offset: Math.floor(Math.random() * (await RoutingSteps.count())),
                });
                const ProductionOperation2 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOperation2?.setRouting_step)
                {
                    await
                    ProductionOperation2.
                    setRouting_step(relatedRouting_step2);
                }
            
                const relatedRouting_step3 = await RoutingSteps.findOne({
                    offset: Math.floor(Math.random() * (await RoutingSteps.count())),
                });
                const ProductionOperation3 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOperation3?.setRouting_step)
                {
                    await
                    ProductionOperation3.
                    setRouting_step(relatedRouting_step3);
                }
            
        }
        
    
        
            
            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 associateProductionOperationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionOperation0 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOperation0?.setOrganization)
                {
                    await
                    ProductionOperation0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionOperation1 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOperation1?.setOrganization)
                {
                    await
                    ProductionOperation1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionOperation2 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOperation2?.setOrganization)
                {
                    await
                    ProductionOperation2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionOperation3 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOperation3?.setOrganization)
                {
                    await
                    ProductionOperation3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateMaterialAllocationWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const MaterialAllocation0 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialAllocation0?.setProduction_order)
                {
                    await
                    MaterialAllocation0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const MaterialAllocation1 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialAllocation1?.setProduction_order)
                {
                    await
                    MaterialAllocation1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const MaterialAllocation2 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialAllocation2?.setProduction_order)
                {
                    await
                    MaterialAllocation2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const MaterialAllocation3 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialAllocation3?.setProduction_order)
                {
                    await
                    MaterialAllocation3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
            
            async function associateMaterialAllocationWithComponent_material() {
            
                const relatedComponent_material0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const MaterialAllocation0 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialAllocation0?.setComponent_material)
                {
                    await
                    MaterialAllocation0.
                    setComponent_material(relatedComponent_material0);
                }
            
                const relatedComponent_material1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const MaterialAllocation1 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialAllocation1?.setComponent_material)
                {
                    await
                    MaterialAllocation1.
                    setComponent_material(relatedComponent_material1);
                }
            
                const relatedComponent_material2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const MaterialAllocation2 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialAllocation2?.setComponent_material)
                {
                    await
                    MaterialAllocation2.
                    setComponent_material(relatedComponent_material2);
                }
            
                const relatedComponent_material3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const MaterialAllocation3 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialAllocation3?.setComponent_material)
                {
                    await
                    MaterialAllocation3.
                    setComponent_material(relatedComponent_material3);
                }
            
        }
        
    
        
            
            async function associateMaterialAllocationWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const MaterialAllocation0 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialAllocation0?.setLot)
                {
                    await
                    MaterialAllocation0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const MaterialAllocation1 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialAllocation1?.setLot)
                {
                    await
                    MaterialAllocation1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const MaterialAllocation2 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialAllocation2?.setLot)
                {
                    await
                    MaterialAllocation2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const MaterialAllocation3 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialAllocation3?.setLot)
                {
                    await
                    MaterialAllocation3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
            
            async function associateMaterialAllocationWithFrom_location() {
            
                const relatedFrom_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const MaterialAllocation0 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialAllocation0?.setFrom_location)
                {
                    await
                    MaterialAllocation0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const MaterialAllocation1 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialAllocation1?.setFrom_location)
                {
                    await
                    MaterialAllocation1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const MaterialAllocation2 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialAllocation2?.setFrom_location)
                {
                    await
                    MaterialAllocation2.
                    setFrom_location(relatedFrom_location2);
                }
            
                const relatedFrom_location3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const MaterialAllocation3 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialAllocation3?.setFrom_location)
                {
                    await
                    MaterialAllocation3.
                    setFrom_location(relatedFrom_location3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateMaterialAllocationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MaterialAllocation0 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialAllocation0?.setOrganization)
                {
                    await
                    MaterialAllocation0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MaterialAllocation1 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialAllocation1?.setOrganization)
                {
                    await
                    MaterialAllocation1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MaterialAllocation2 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialAllocation2?.setOrganization)
                {
                    await
                    MaterialAllocation2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MaterialAllocation3 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialAllocation3?.setOrganization)
                {
                    await
                    MaterialAllocation3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateProductionLotWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionLot0 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionLot0?.setProduction_order)
                {
                    await
                    ProductionLot0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionLot1 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionLot1?.setProduction_order)
                {
                    await
                    ProductionLot1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionLot2 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionLot2?.setProduction_order)
                {
                    await
                    ProductionLot2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionLot3 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionLot3?.setProduction_order)
                {
                    await
                    ProductionLot3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
            
            async function associateProductionLotWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionLot0 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionLot0?.setMaterial)
                {
                    await
                    ProductionLot0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionLot1 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionLot1?.setMaterial)
                {
                    await
                    ProductionLot1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionLot2 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionLot2?.setMaterial)
                {
                    await
                    ProductionLot2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionLot3 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionLot3?.setMaterial)
                {
                    await
                    ProductionLot3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateProductionLotWithPlant() {
            
                const relatedPlant0 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const ProductionLot0 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionLot0?.setPlant)
                {
                    await
                    ProductionLot0.
                    setPlant(relatedPlant0);
                }
            
                const relatedPlant1 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const ProductionLot1 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionLot1?.setPlant)
                {
                    await
                    ProductionLot1.
                    setPlant(relatedPlant1);
                }
            
                const relatedPlant2 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const ProductionLot2 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionLot2?.setPlant)
                {
                    await
                    ProductionLot2.
                    setPlant(relatedPlant2);
                }
            
                const relatedPlant3 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const ProductionLot3 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionLot3?.setPlant)
                {
                    await
                    ProductionLot3.
                    setPlant(relatedPlant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductionLotWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionLot0 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionLot0?.setOrganization)
                {
                    await
                    ProductionLot0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionLot1 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionLot1?.setOrganization)
                {
                    await
                    ProductionLot1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionLot2 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionLot2?.setOrganization)
                {
                    await
                    ProductionLot2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionLot3 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionLot3?.setOrganization)
                {
                    await
                    ProductionLot3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
            
            async function associateInspectionPlanWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InspectionPlan0 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InspectionPlan0?.setMaterial)
                {
                    await
                    InspectionPlan0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InspectionPlan1 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InspectionPlan1?.setMaterial)
                {
                    await
                    InspectionPlan1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InspectionPlan2 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InspectionPlan2?.setMaterial)
                {
                    await
                    InspectionPlan2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InspectionPlan3 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InspectionPlan3?.setMaterial)
                {
                    await
                    InspectionPlan3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInspectionPlanWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionPlan0 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InspectionPlan0?.setOrganization)
                {
                    await
                    InspectionPlan0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionPlan1 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InspectionPlan1?.setOrganization)
                {
                    await
                    InspectionPlan1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionPlan2 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InspectionPlan2?.setOrganization)
                {
                    await
                    InspectionPlan2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionPlan3 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InspectionPlan3?.setOrganization)
                {
                    await
                    InspectionPlan3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInspectionCharacteristicWithInspection_plan() {
            
                const relatedInspection_plan0 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const InspectionCharacteristic0 = await InspectionCharacteristics.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InspectionCharacteristic0?.setInspection_plan)
                {
                    await
                    InspectionCharacteristic0.
                    setInspection_plan(relatedInspection_plan0);
                }
            
                const relatedInspection_plan1 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const InspectionCharacteristic1 = await InspectionCharacteristics.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InspectionCharacteristic1?.setInspection_plan)
                {
                    await
                    InspectionCharacteristic1.
                    setInspection_plan(relatedInspection_plan1);
                }
            
                const relatedInspection_plan2 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const InspectionCharacteristic2 = await InspectionCharacteristics.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InspectionCharacteristic2?.setInspection_plan)
                {
                    await
                    InspectionCharacteristic2.
                    setInspection_plan(relatedInspection_plan2);
                }
            
                const relatedInspection_plan3 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const InspectionCharacteristic3 = await InspectionCharacteristics.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InspectionCharacteristic3?.setInspection_plan)
                {
                    await
                    InspectionCharacteristic3.
                    setInspection_plan(relatedInspection_plan3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInspectionCharacteristicWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionCharacteristic0 = await InspectionCharacteristics.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InspectionCharacteristic0?.setOrganization)
                {
                    await
                    InspectionCharacteristic0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionCharacteristic1 = await InspectionCharacteristics.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InspectionCharacteristic1?.setOrganization)
                {
                    await
                    InspectionCharacteristic1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionCharacteristic2 = await InspectionCharacteristics.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InspectionCharacteristic2?.setOrganization)
                {
                    await
                    InspectionCharacteristic2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionCharacteristic3 = await InspectionCharacteristics.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InspectionCharacteristic3?.setOrganization)
                {
                    await
                    InspectionCharacteristic3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
            
            async function associateInspectionWithInspection_plan() {
            
                const relatedInspection_plan0 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setInspection_plan)
                {
                    await
                    Inspection0.
                    setInspection_plan(relatedInspection_plan0);
                }
            
                const relatedInspection_plan1 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setInspection_plan)
                {
                    await
                    Inspection1.
                    setInspection_plan(relatedInspection_plan1);
                }
            
                const relatedInspection_plan2 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setInspection_plan)
                {
                    await
                    Inspection2.
                    setInspection_plan(relatedInspection_plan2);
                }
            
                const relatedInspection_plan3 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setInspection_plan)
                {
                    await
                    Inspection3.
                    setInspection_plan(relatedInspection_plan3);
                }
            
        }
        
    
        
            
            async function associateInspectionWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setMaterial)
                {
                    await
                    Inspection0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setMaterial)
                {
                    await
                    Inspection1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setMaterial)
                {
                    await
                    Inspection2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setMaterial)
                {
                    await
                    Inspection3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateInspectionWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setLot)
                {
                    await
                    Inspection0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setLot)
                {
                    await
                    Inspection1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setLot)
                {
                    await
                    Inspection2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setLot)
                {
                    await
                    Inspection3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
            
            async function associateInspectionWithProduction_lot() {
            
                const relatedProduction_lot0 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setProduction_lot)
                {
                    await
                    Inspection0.
                    setProduction_lot(relatedProduction_lot0);
                }
            
                const relatedProduction_lot1 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setProduction_lot)
                {
                    await
                    Inspection1.
                    setProduction_lot(relatedProduction_lot1);
                }
            
                const relatedProduction_lot2 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setProduction_lot)
                {
                    await
                    Inspection2.
                    setProduction_lot(relatedProduction_lot2);
                }
            
                const relatedProduction_lot3 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setProduction_lot)
                {
                    await
                    Inspection3.
                    setProduction_lot(relatedProduction_lot3);
                }
            
        }
        
    
        
            
            async function associateInspectionWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setProduction_order)
                {
                    await
                    Inspection0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setProduction_order)
                {
                    await
                    Inspection1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setProduction_order)
                {
                    await
                    Inspection2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setProduction_order)
                {
                    await
                    Inspection3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateInspectionWithInspector() {
            
                const relatedInspector0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setInspector)
                {
                    await
                    Inspection0.
                    setInspector(relatedInspector0);
                }
            
                const relatedInspector1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setInspector)
                {
                    await
                    Inspection1.
                    setInspector(relatedInspector1);
                }
            
                const relatedInspector2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setInspector)
                {
                    await
                    Inspection2.
                    setInspector(relatedInspector2);
                }
            
                const relatedInspector3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setInspector)
                {
                    await
                    Inspection3.
                    setInspector(relatedInspector3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateInspectionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setOrganization)
                {
                    await
                    Inspection0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setOrganization)
                {
                    await
                    Inspection1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setOrganization)
                {
                    await
                    Inspection2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setOrganization)
                {
                    await
                    Inspection3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInspectionResultWithInspection() {
            
                const relatedInspection0 = await Inspections.findOne({
                    offset: Math.floor(Math.random() * (await Inspections.count())),
                });
                const InspectionResult0 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InspectionResult0?.setInspection)
                {
                    await
                    InspectionResult0.
                    setInspection(relatedInspection0);
                }
            
                const relatedInspection1 = await Inspections.findOne({
                    offset: Math.floor(Math.random() * (await Inspections.count())),
                });
                const InspectionResult1 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InspectionResult1?.setInspection)
                {
                    await
                    InspectionResult1.
                    setInspection(relatedInspection1);
                }
            
                const relatedInspection2 = await Inspections.findOne({
                    offset: Math.floor(Math.random() * (await Inspections.count())),
                });
                const InspectionResult2 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InspectionResult2?.setInspection)
                {
                    await
                    InspectionResult2.
                    setInspection(relatedInspection2);
                }
            
                const relatedInspection3 = await Inspections.findOne({
                    offset: Math.floor(Math.random() * (await Inspections.count())),
                });
                const InspectionResult3 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InspectionResult3?.setInspection)
                {
                    await
                    InspectionResult3.
                    setInspection(relatedInspection3);
                }
            
        }
        
    
        
            
            async function associateInspectionResultWithCharacteristic() {
            
                const relatedCharacteristic0 = await InspectionCharacteristics.findOne({
                    offset: Math.floor(Math.random() * (await InspectionCharacteristics.count())),
                });
                const InspectionResult0 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InspectionResult0?.setCharacteristic)
                {
                    await
                    InspectionResult0.
                    setCharacteristic(relatedCharacteristic0);
                }
            
                const relatedCharacteristic1 = await InspectionCharacteristics.findOne({
                    offset: Math.floor(Math.random() * (await InspectionCharacteristics.count())),
                });
                const InspectionResult1 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InspectionResult1?.setCharacteristic)
                {
                    await
                    InspectionResult1.
                    setCharacteristic(relatedCharacteristic1);
                }
            
                const relatedCharacteristic2 = await InspectionCharacteristics.findOne({
                    offset: Math.floor(Math.random() * (await InspectionCharacteristics.count())),
                });
                const InspectionResult2 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InspectionResult2?.setCharacteristic)
                {
                    await
                    InspectionResult2.
                    setCharacteristic(relatedCharacteristic2);
                }
            
                const relatedCharacteristic3 = await InspectionCharacteristics.findOne({
                    offset: Math.floor(Math.random() * (await InspectionCharacteristics.count())),
                });
                const InspectionResult3 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InspectionResult3?.setCharacteristic)
                {
                    await
                    InspectionResult3.
                    setCharacteristic(relatedCharacteristic3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInspectionResultWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionResult0 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InspectionResult0?.setOrganization)
                {
                    await
                    InspectionResult0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionResult1 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InspectionResult1?.setOrganization)
                {
                    await
                    InspectionResult1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionResult2 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InspectionResult2?.setOrganization)
                {
                    await
                    InspectionResult2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InspectionResult3 = await InspectionResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InspectionResult3?.setOrganization)
                {
                    await
                    InspectionResult3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
            
            async function associateNonconformanceWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setMaterial)
                {
                    await
                    Nonconformance0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setMaterial)
                {
                    await
                    Nonconformance1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setMaterial)
                {
                    await
                    Nonconformance2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setMaterial)
                {
                    await
                    Nonconformance3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setLot)
                {
                    await
                    Nonconformance0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setLot)
                {
                    await
                    Nonconformance1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setLot)
                {
                    await
                    Nonconformance2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setLot)
                {
                    await
                    Nonconformance3.
                    setLot(relatedLot3);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithProduction_lot() {
            
                const relatedProduction_lot0 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setProduction_lot)
                {
                    await
                    Nonconformance0.
                    setProduction_lot(relatedProduction_lot0);
                }
            
                const relatedProduction_lot1 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setProduction_lot)
                {
                    await
                    Nonconformance1.
                    setProduction_lot(relatedProduction_lot1);
                }
            
                const relatedProduction_lot2 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setProduction_lot)
                {
                    await
                    Nonconformance2.
                    setProduction_lot(relatedProduction_lot2);
                }
            
                const relatedProduction_lot3 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setProduction_lot)
                {
                    await
                    Nonconformance3.
                    setProduction_lot(relatedProduction_lot3);
                }
            
        }
        
    
        
            
            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 associateNonconformanceWithMachine() {
            
                const relatedMachine0 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setMachine)
                {
                    await
                    Nonconformance0.
                    setMachine(relatedMachine0);
                }
            
                const relatedMachine1 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setMachine)
                {
                    await
                    Nonconformance1.
                    setMachine(relatedMachine1);
                }
            
                const relatedMachine2 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setMachine)
                {
                    await
                    Nonconformance2.
                    setMachine(relatedMachine2);
                }
            
                const relatedMachine3 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setMachine)
                {
                    await
                    Nonconformance3.
                    setMachine(relatedMachine3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            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 associateNonconformanceWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setOrganization)
                {
                    await
                    Nonconformance0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setOrganization)
                {
                    await
                    Nonconformance1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setOrganization)
                {
                    await
                    Nonconformance2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setOrganization)
                {
                    await
                    Nonconformance3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDispositionWithNonconformance() {
            
                const relatedNonconformance0 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const Disposition0 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Disposition0?.setNonconformance)
                {
                    await
                    Disposition0.
                    setNonconformance(relatedNonconformance0);
                }
            
                const relatedNonconformance1 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const Disposition1 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Disposition1?.setNonconformance)
                {
                    await
                    Disposition1.
                    setNonconformance(relatedNonconformance1);
                }
            
                const relatedNonconformance2 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const Disposition2 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Disposition2?.setNonconformance)
                {
                    await
                    Disposition2.
                    setNonconformance(relatedNonconformance2);
                }
            
                const relatedNonconformance3 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const Disposition3 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Disposition3?.setNonconformance)
                {
                    await
                    Disposition3.
                    setNonconformance(relatedNonconformance3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateDispositionWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Disposition0 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Disposition0?.setOwner)
                {
                    await
                    Disposition0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Disposition1 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Disposition1?.setOwner)
                {
                    await
                    Disposition1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Disposition2 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Disposition2?.setOwner)
                {
                    await
                    Disposition2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Disposition3 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Disposition3?.setOwner)
                {
                    await
                    Disposition3.
                    setOwner(relatedOwner3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDispositionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Disposition0 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Disposition0?.setOrganization)
                {
                    await
                    Disposition0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Disposition1 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Disposition1?.setOrganization)
                {
                    await
                    Disposition1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Disposition2 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Disposition2?.setOrganization)
                {
                    await
                    Disposition2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Disposition3 = await Dispositions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Disposition3?.setOrganization)
                {
                    await
                    Disposition3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateCorrectiveActionWithNonconformance() {
            
                const relatedNonconformance0 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CorrectiveAction0 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CorrectiveAction0?.setNonconformance)
                {
                    await
                    CorrectiveAction0.
                    setNonconformance(relatedNonconformance0);
                }
            
                const relatedNonconformance1 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CorrectiveAction1 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CorrectiveAction1?.setNonconformance)
                {
                    await
                    CorrectiveAction1.
                    setNonconformance(relatedNonconformance1);
                }
            
                const relatedNonconformance2 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CorrectiveAction2 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CorrectiveAction2?.setNonconformance)
                {
                    await
                    CorrectiveAction2.
                    setNonconformance(relatedNonconformance2);
                }
            
                const relatedNonconformance3 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CorrectiveAction3 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CorrectiveAction3?.setNonconformance)
                {
                    await
                    CorrectiveAction3.
                    setNonconformance(relatedNonconformance3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateCorrectiveActionWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CorrectiveAction0 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CorrectiveAction0?.setOwner)
                {
                    await
                    CorrectiveAction0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CorrectiveAction1 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CorrectiveAction1?.setOwner)
                {
                    await
                    CorrectiveAction1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CorrectiveAction2 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CorrectiveAction2?.setOwner)
                {
                    await
                    CorrectiveAction2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CorrectiveAction3 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CorrectiveAction3?.setOwner)
                {
                    await
                    CorrectiveAction3.
                    setOwner(relatedOwner3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCorrectiveActionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CorrectiveAction0 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CorrectiveAction0?.setOrganization)
                {
                    await
                    CorrectiveAction0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CorrectiveAction1 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CorrectiveAction1?.setOrganization)
                {
                    await
                    CorrectiveAction1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CorrectiveAction2 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CorrectiveAction2?.setOrganization)
                {
                    await
                    CorrectiveAction2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CorrectiveAction3 = await CorrectiveActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CorrectiveAction3?.setOrganization)
                {
                    await
                    CorrectiveAction3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateDowntimeEventWithMachine() {
            
                const relatedMachine0 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const DowntimeEvent0 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DowntimeEvent0?.setMachine)
                {
                    await
                    DowntimeEvent0.
                    setMachine(relatedMachine0);
                }
            
                const relatedMachine1 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const DowntimeEvent1 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DowntimeEvent1?.setMachine)
                {
                    await
                    DowntimeEvent1.
                    setMachine(relatedMachine1);
                }
            
                const relatedMachine2 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const DowntimeEvent2 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DowntimeEvent2?.setMachine)
                {
                    await
                    DowntimeEvent2.
                    setMachine(relatedMachine2);
                }
            
                const relatedMachine3 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const DowntimeEvent3 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DowntimeEvent3?.setMachine)
                {
                    await
                    DowntimeEvent3.
                    setMachine(relatedMachine3);
                }
            
        }
        
    
        
            
            async function associateDowntimeEventWithProduction_operation() {
            
                const relatedProduction_operation0 = await ProductionOperations.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOperations.count())),
                });
                const DowntimeEvent0 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DowntimeEvent0?.setProduction_operation)
                {
                    await
                    DowntimeEvent0.
                    setProduction_operation(relatedProduction_operation0);
                }
            
                const relatedProduction_operation1 = await ProductionOperations.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOperations.count())),
                });
                const DowntimeEvent1 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DowntimeEvent1?.setProduction_operation)
                {
                    await
                    DowntimeEvent1.
                    setProduction_operation(relatedProduction_operation1);
                }
            
                const relatedProduction_operation2 = await ProductionOperations.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOperations.count())),
                });
                const DowntimeEvent2 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DowntimeEvent2?.setProduction_operation)
                {
                    await
                    DowntimeEvent2.
                    setProduction_operation(relatedProduction_operation2);
                }
            
                const relatedProduction_operation3 = await ProductionOperations.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOperations.count())),
                });
                const DowntimeEvent3 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DowntimeEvent3?.setProduction_operation)
                {
                    await
                    DowntimeEvent3.
                    setProduction_operation(relatedProduction_operation3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDowntimeEventWithReported_by() {
            
                const relatedReported_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DowntimeEvent0 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DowntimeEvent0?.setReported_by)
                {
                    await
                    DowntimeEvent0.
                    setReported_by(relatedReported_by0);
                }
            
                const relatedReported_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DowntimeEvent1 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DowntimeEvent1?.setReported_by)
                {
                    await
                    DowntimeEvent1.
                    setReported_by(relatedReported_by1);
                }
            
                const relatedReported_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DowntimeEvent2 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DowntimeEvent2?.setReported_by)
                {
                    await
                    DowntimeEvent2.
                    setReported_by(relatedReported_by2);
                }
            
                const relatedReported_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DowntimeEvent3 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DowntimeEvent3?.setReported_by)
                {
                    await
                    DowntimeEvent3.
                    setReported_by(relatedReported_by3);
                }
            
        }
        
    
        
            
            async function associateDowntimeEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DowntimeEvent0 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DowntimeEvent0?.setOrganization)
                {
                    await
                    DowntimeEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DowntimeEvent1 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DowntimeEvent1?.setOrganization)
                {
                    await
                    DowntimeEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DowntimeEvent2 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DowntimeEvent2?.setOrganization)
                {
                    await
                    DowntimeEvent2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DowntimeEvent3 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DowntimeEvent3?.setOrganization)
                {
                    await
                    DowntimeEvent3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateMachineReadingWithMachine() {
            
                const relatedMachine0 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineReading0 = await MachineReadings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MachineReading0?.setMachine)
                {
                    await
                    MachineReading0.
                    setMachine(relatedMachine0);
                }
            
                const relatedMachine1 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineReading1 = await MachineReadings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MachineReading1?.setMachine)
                {
                    await
                    MachineReading1.
                    setMachine(relatedMachine1);
                }
            
                const relatedMachine2 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineReading2 = await MachineReadings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MachineReading2?.setMachine)
                {
                    await
                    MachineReading2.
                    setMachine(relatedMachine2);
                }
            
                const relatedMachine3 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineReading3 = await MachineReadings.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MachineReading3?.setMachine)
                {
                    await
                    MachineReading3.
                    setMachine(relatedMachine3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateMachineReadingWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MachineReading0 = await MachineReadings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MachineReading0?.setOrganization)
                {
                    await
                    MachineReading0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MachineReading1 = await MachineReadings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MachineReading1?.setOrganization)
                {
                    await
                    MachineReading1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MachineReading2 = await MachineReadings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MachineReading2?.setOrganization)
                {
                    await
                    MachineReading2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MachineReading3 = await MachineReadings.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MachineReading3?.setOrganization)
                {
                    await
                    MachineReading3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            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 associateMaintenanceWorkOrderWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MaintenanceWorkOrder0 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaintenanceWorkOrder0?.setOrganization)
                {
                    await
                    MaintenanceWorkOrder0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MaintenanceWorkOrder1 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaintenanceWorkOrder1?.setOrganization)
                {
                    await
                    MaintenanceWorkOrder1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MaintenanceWorkOrder2 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaintenanceWorkOrder2?.setOrganization)
                {
                    await
                    MaintenanceWorkOrder2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MaintenanceWorkOrder3 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaintenanceWorkOrder3?.setOrganization)
                {
                    await
                    MaintenanceWorkOrder3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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 associateDocumentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setOrganization)
                {
                    await
                    Document0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setOrganization)
                {
                    await
                    Document1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setOrganization)
                {
                    await
                    Document2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document3 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Document3?.setOrganization)
                {
                    await
                    Document3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateShipmentWithPlant() {
            
                const relatedPlant0 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setPlant)
                {
                    await
                    Shipment0.
                    setPlant(relatedPlant0);
                }
            
                const relatedPlant1 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setPlant)
                {
                    await
                    Shipment1.
                    setPlant(relatedPlant1);
                }
            
                const relatedPlant2 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setPlant)
                {
                    await
                    Shipment2.
                    setPlant(relatedPlant2);
                }
            
                const relatedPlant3 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Shipment3 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Shipment3?.setPlant)
                {
                    await
                    Shipment3.
                    setPlant(relatedPlant3);
                }
            
        }
        
    
        
            
            async function associateShipmentWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setCustomer)
                {
                    await
                    Shipment0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setCustomer)
                {
                    await
                    Shipment1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setCustomer)
                {
                    await
                    Shipment2.
                    setCustomer(relatedCustomer2);
                }
            
                const relatedCustomer3 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Shipment3 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Shipment3?.setCustomer)
                {
                    await
                    Shipment3.
                    setCustomer(relatedCustomer3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateShipmentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setOrganization)
                {
                    await
                    Shipment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setOrganization)
                {
                    await
                    Shipment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setOrganization)
                {
                    await
                    Shipment2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Shipment3 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Shipment3?.setOrganization)
                {
                    await
                    Shipment3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            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 associateShipmentLineWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setMaterial)
                {
                    await
                    ShipmentLine0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setMaterial)
                {
                    await
                    ShipmentLine1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setMaterial)
                {
                    await
                    ShipmentLine2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ShipmentLine3 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ShipmentLine3?.setMaterial)
                {
                    await
                    ShipmentLine3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateShipmentLineWithProduction_lot() {
            
                const relatedProduction_lot0 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setProduction_lot)
                {
                    await
                    ShipmentLine0.
                    setProduction_lot(relatedProduction_lot0);
                }
            
                const relatedProduction_lot1 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setProduction_lot)
                {
                    await
                    ShipmentLine1.
                    setProduction_lot(relatedProduction_lot1);
                }
            
                const relatedProduction_lot2 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setProduction_lot)
                {
                    await
                    ShipmentLine2.
                    setProduction_lot(relatedProduction_lot2);
                }
            
                const relatedProduction_lot3 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const ShipmentLine3 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ShipmentLine3?.setProduction_lot)
                {
                    await
                    ShipmentLine3.
                    setProduction_lot(relatedProduction_lot3);
                }
            
        }
        
    
        
            
            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 associateShipmentLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setOrganization)
                {
                    await
                    ShipmentLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setOrganization)
                {
                    await
                    ShipmentLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setOrganization)
                {
                    await
                    ShipmentLine2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ShipmentLine3 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ShipmentLine3?.setOrganization)
                {
                    await
                    ShipmentLine3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Plants.bulkCreate(PlantsData);
                
            
            
                
                await WorkCenters.bulkCreate(WorkCentersData);
                
            
            
                
                await Machines.bulkCreate(MachinesData);
                
            
            
                
                await Materials.bulkCreate(MaterialsData);
                
            
            
                
                await BomHeaders.bulkCreate(BomHeadersData);
                
            
            
                
                await BomLines.bulkCreate(BomLinesData);
                
            
            
                
                await Routings.bulkCreate(RoutingsData);
                
            
            
                
                await RoutingSteps.bulkCreate(RoutingStepsData);
                
            
            
                
                await Suppliers.bulkCreate(SuppliersData);
                
            
            
                
                await Customers.bulkCreate(CustomersData);
                
            
            
                
                await Warehouses.bulkCreate(WarehousesData);
                
            
            
                
                await Locations.bulkCreate(LocationsData);
                
            
            
                
                await Lots.bulkCreate(LotsData);
                
            
            
                
                await Serials.bulkCreate(SerialsData);
                
            
            
                
                await InventoryBalances.bulkCreate(InventoryBalancesData);
                
            
            
                
                await InventoryTransactions.bulkCreate(InventoryTransactionsData);
                
            
            
                
                await CycleCounts.bulkCreate(CycleCountsData);
                
            
            
                
                await CycleCountLines.bulkCreate(CycleCountLinesData);
                
            
            
                
                await ProductionOrders.bulkCreate(ProductionOrdersData);
                
            
            
                
                await ProductionOperations.bulkCreate(ProductionOperationsData);
                
            
            
                
                await MaterialAllocations.bulkCreate(MaterialAllocationsData);
                
            
            
                
                await ProductionLots.bulkCreate(ProductionLotsData);
                
            
            
                
                await InspectionPlans.bulkCreate(InspectionPlansData);
                
            
            
                
                await InspectionCharacteristics.bulkCreate(InspectionCharacteristicsData);
                
            
            
                
                await Inspections.bulkCreate(InspectionsData);
                
            
            
                
                await InspectionResults.bulkCreate(InspectionResultsData);
                
            
            
                
                await Nonconformances.bulkCreate(NonconformancesData);
                
            
            
                
                await Dispositions.bulkCreate(DispositionsData);
                
            
            
                
                await CorrectiveActions.bulkCreate(CorrectiveActionsData);
                
            
            
                
                await DowntimeEvents.bulkCreate(DowntimeEventsData);
                
            
            
                
                await MachineReadings.bulkCreate(MachineReadingsData);
                
            
            
                
                await MaintenanceWorkOrders.bulkCreate(MaintenanceWorkOrdersData);
                
            
            
                
                await Documents.bulkCreate(DocumentsData);
                
            
            
                
                await Shipments.bulkCreate(ShipmentsData);
                
            
            
                
                await ShipmentLines.bulkCreate(ShipmentLinesData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePlantWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWorkCenterWithPlant(),
                    
                
                    
                
                    
                        
                        await associateWorkCenterWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMachineWithWork_center(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMachineWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaterialWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateBomHeaderWithParent_material(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateBomHeaderWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateBomLineWithBom(),
                    
                
                    
                        
                        await associateBomLineWithComponent_material(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateBomLineWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateRoutingWithMaterial(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateRoutingWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateRoutingStepWithRouting(),
                    
                
                    
                
                    
                
                    
                        
                        await associateRoutingStepWithWork_center(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateRoutingStepWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSupplierWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCustomerWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateWarehousWithPlant(),
                    
                
                    
                
                    
                
                    
                        
                        await associateWarehousWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateLocationWithWarehouse(),
                    
                
                    
                
                    
                
                    
                        
                        await associateLocationWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateLotWithMaterial(),
                    
                
                    
                        
                        await associateLotWithPlant(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateLotWithSupplier(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateLotWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateSerialWithMaterial(),
                    
                
                    
                        
                        await associateSerialWithLot(),
                    
                
                    
                        
                        await associateSerialWithPlant(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSerialWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInventoryBalanceWithMaterial(),
                    
                
                    
                        
                        await associateInventoryBalanceWithLocation(),
                    
                
                    
                        
                        await associateInventoryBalanceWithLot(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryBalanceWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryTransactionWithMaterial(),
                    
                
                    
                        
                        await associateInventoryTransactionWithLot(),
                    
                
                    
                        
                        await associateInventoryTransactionWithFrom_location(),
                    
                
                    
                        
                        await associateInventoryTransactionWithTo_location(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryTransactionWithPerformed_by(),
                    
                
                    
                
                    
                        
                        await associateInventoryTransactionWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateCycleCountWithPlant(),
                    
                
                    
                        
                        await associateCycleCountWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCycleCountWithAssigned_to(),
                    
                
                    
                
                    
                        
                        await associateCycleCountWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCycleCountLineWithCycle_count(),
                    
                
                    
                        
                        await associateCycleCountLineWithLocation(),
                    
                
                    
                        
                        await associateCycleCountLineWithMaterial(),
                    
                
                    
                        
                        await associateCycleCountLineWithLot(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCycleCountLineWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateProductionOrderWithPlant(),
                    
                
                    
                        
                        await associateProductionOrderWithMaterial(),
                    
                
                    
                        
                        await associateProductionOrderWithBom(),
                    
                
                    
                        
                        await associateProductionOrderWithRouting(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionOrderWithCustomer(),
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionOrderWithCreated_by_user(),
                    
                
                    
                        
                        await associateProductionOrderWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateProductionOperationWithProduction_order(),
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionOperationWithRouting_step(),
                    
                
                    
                        
                        await associateProductionOperationWithWork_center(),
                    
                
                    
                        
                        await associateProductionOperationWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionOperationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateMaterialAllocationWithProduction_order(),
                    
                
                    
                        
                        await associateMaterialAllocationWithComponent_material(),
                    
                
                    
                        
                        await associateMaterialAllocationWithLot(),
                    
                
                    
                        
                        await associateMaterialAllocationWithFrom_location(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaterialAllocationWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateProductionLotWithProduction_order(),
                    
                
                    
                        
                        await associateProductionLotWithMaterial(),
                    
                
                    
                        
                        await associateProductionLotWithPlant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionLotWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateInspectionPlanWithMaterial(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInspectionPlanWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInspectionCharacteristicWithInspection_plan(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInspectionCharacteristicWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateInspectionWithInspection_plan(),
                    
                
                    
                        
                        await associateInspectionWithMaterial(),
                    
                
                    
                        
                        await associateInspectionWithLot(),
                    
                
                    
                        
                        await associateInspectionWithProduction_lot(),
                    
                
                    
                        
                        await associateInspectionWithProduction_order(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInspectionWithInspector(),
                    
                
                    
                
                    
                
                    
                        
                        await associateInspectionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInspectionResultWithInspection(),
                    
                
                    
                        
                        await associateInspectionResultWithCharacteristic(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInspectionResultWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithMaterial(),
                    
                
                    
                        
                        await associateNonconformanceWithLot(),
                    
                
                    
                        
                        await associateNonconformanceWithProduction_lot(),
                    
                
                    
                        
                        await associateNonconformanceWithProduction_order(),
                    
                
                    
                        
                        await associateNonconformanceWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithReported_by(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDispositionWithNonconformance(),
                    
                
                    
                
                    
                
                    
                        
                        await associateDispositionWithOwner(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDispositionWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateCorrectiveActionWithNonconformance(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCorrectiveActionWithOwner(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCorrectiveActionWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateDowntimeEventWithMachine(),
                    
                
                    
                        
                        await associateDowntimeEventWithProduction_operation(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDowntimeEventWithReported_by(),
                    
                
                    
                        
                        await associateDowntimeEventWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateMachineReadingWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMachineReadingWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithRequested_by(),
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithAssigned_to(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDocumentWithOwner(),
                    
                
                    
                
                    
                        
                        await associateDocumentWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateShipmentWithPlant(),
                    
                
                    
                        
                        await associateShipmentWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateShipmentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateShipmentLineWithShipment(),
                    
                
                    
                        
                        await associateShipmentLineWithMaterial(),
                    
                
                    
                        
                        await associateShipmentLineWithProduction_lot(),
                    
                
                    
                        
                        await associateShipmentLineWithFrom_location(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateShipmentLineWithOrganization(),
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('plants', null, {});
            
            
            await queryInterface.bulkDelete('work_centers', null, {});
            
            
            await queryInterface.bulkDelete('machines', null, {});
            
            
            await queryInterface.bulkDelete('materials', null, {});
            
            
            await queryInterface.bulkDelete('bom_headers', null, {});
            
            
            await queryInterface.bulkDelete('bom_lines', null, {});
            
            
            await queryInterface.bulkDelete('routings', null, {});
            
            
            await queryInterface.bulkDelete('routing_steps', null, {});
            
            
            await queryInterface.bulkDelete('suppliers', null, {});
            
            
            await queryInterface.bulkDelete('customers', null, {});
            
            
            await queryInterface.bulkDelete('warehouses', null, {});
            
            
            await queryInterface.bulkDelete('locations', null, {});
            
            
            await queryInterface.bulkDelete('lots', null, {});
            
            
            await queryInterface.bulkDelete('serials', null, {});
            
            
            await queryInterface.bulkDelete('inventory_balances', null, {});
            
            
            await queryInterface.bulkDelete('inventory_transactions', null, {});
            
            
            await queryInterface.bulkDelete('cycle_counts', null, {});
            
            
            await queryInterface.bulkDelete('cycle_count_lines', null, {});
            
            
            await queryInterface.bulkDelete('production_orders', null, {});
            
            
            await queryInterface.bulkDelete('production_operations', null, {});
            
            
            await queryInterface.bulkDelete('material_allocations', null, {});
            
            
            await queryInterface.bulkDelete('production_lots', null, {});
            
            
            await queryInterface.bulkDelete('inspection_plans', null, {});
            
            
            await queryInterface.bulkDelete('inspection_characteristics', null, {});
            
            
            await queryInterface.bulkDelete('inspections', null, {});
            
            
            await queryInterface.bulkDelete('inspection_results', null, {});
            
            
            await queryInterface.bulkDelete('nonconformances', null, {});
            
            
            await queryInterface.bulkDelete('dispositions', null, {});
            
            
            await queryInterface.bulkDelete('corrective_actions', null, {});
            
            
            await queryInterface.bulkDelete('downtime_events', null, {});
            
            
            await queryInterface.bulkDelete('machine_readings', null, {});
            
            
            await queryInterface.bulkDelete('maintenance_work_orders', null, {});
            
            
            await queryInterface.bulkDelete('documents', null, {});
            
            
            await queryInterface.bulkDelete('shipments', null, {});
            
            
            await queryInterface.bulkDelete('shipment_lines', null, {});
            
        
    },
};