





















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






const Organizations = db.organizations;

const Plants = db.plants;

const Warehouses = db.warehouses;

const WorkCenters = db.work_centers;

const Machines = db.machines;

const MaintenanceWorkOrders = db.maintenance_work_orders;

const DowntimeEvents = db.downtime_events;

const Items = db.items;

const ItemFiles = db.item_files;

const Boms = db.boms;

const BomLines = db.bom_lines;

const Suppliers = db.suppliers;

const PurchaseOrders = db.purchase_orders;

const PurchaseOrderLines = db.purchase_order_lines;

const InventoryLots = db.inventory_lots;

const InventoryTransactions = db.inventory_transactions;

const ProductionOrders = db.production_orders;

const ProductionOperations = db.production_operations;

const MaterialAllocations = db.material_allocations;

const QualityInspections = db.quality_inspections;

const Nonconformances = db.nonconformances;

const CapaActions = db.capa_actions;

const AuditLogs = db.audit_logs;







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



const PlantsData = [
    
    {
    
        
        
            
                "name": "North Plant",
            
        
    
        
        
            
                "code": "NP01",
            
        
    
        
        
            
                "address": "1000 Industrial Way, Dayton, OH",
            
        
    
        
        
            
                "time_zone": "America/New_York",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "South Plant",
            
        
    
        
        
            
                "code": "SP01",
            
        
    
        
        
            
                "address": "2500 Manufacturing Blvd, Nashville, TN",
            
        
    
        
        
            
                "time_zone": "America/Chicago",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "West Plant",
            
        
    
        
        
            
                "code": "WP01",
            
        
    
        
        
            
                "address": "88 Commerce Park Rd, Reno, NV",
            
        
    
        
        
            
                "time_zone": "America/Los_Angeles",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "East Plant",
            
        
    
        
        
            
                "code": "EP01",
            
        
    
        
        
            
                "address": "12 Foundry Lane, Allentown, PA",
            
        
    
        
        
            
                "time_zone": "America/New_York",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Central Plant",
            
        
    
        
        
            
                "code": "CP01",
            
        
    
        
        
            
                "address": "600 Supply Chain Dr, Indianapolis, IN",
            
        
    
        
        
            
                "time_zone": "America/Indiana/Indianapolis",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WarehousesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "NP Main Warehouse",
            
        
    
        
        
            
                "code": "NP-WH1",
            
        
    
        
        
            
                "description": "Primary raw materials and finished goods storage",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "SP Receiving",
            
        
    
        
        
            
                "code": "SP-WH1",
            
        
    
        
        
            
                "description": "Receiving and quarantine staging area",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "WP Finished Goods",
            
        
    
        
        
            
                "code": "WP-WH2",
            
        
    
        
        
            
                "description": "Finished goods storage and shipping",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "EP Components",
            
        
    
        
        
            
                "code": "EP-WH1",
            
        
    
        
        
            
                "description": "Component kitting and line-side replenishment",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "CP Bulk Storage",
            
        
    
        
        
            
                "code": "CP-WH1",
            
        
    
        
        
            
                "description": "Bulk pallets and overflow storage",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WorkCentersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Machining Cell A",
            
        
    
        
        
            
                "code": "NP-WC-MACH-A",
            
        
    
        
        
            
                "center_type": "packaging",
            
        
    
        
        
            
                "description": "CNC machining for aluminum housings",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Assembly Line 1",
            
        
    
        
        
            
                "code": "NP-WC-ASM-1",
            
        
    
        
        
            
                "center_type": "molding",
            
        
    
        
        
            
                "description": "Final assembly and torque verification",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Packaging Line 2",
            
        
    
        
        
            
                "code": "SP-WC-PACK-2",
            
        
    
        
        
            
                "center_type": "machining",
            
        
    
        
        
            
                "description": "Cartoning and labeling line",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Inspection Lab",
            
        
    
        
        
            
                "code": "WP-WC-INSP-1",
            
        
    
        
        
            
                "center_type": "utility",
            
        
    
        
        
            
                "description": "Dimensional inspection and QA audits",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Molding Cell B",
            
        
    
        
        
            
                "code": "EP-WC-MOLD-B",
            
        
    
        
        
            
                "center_type": "packaging",
            
        
    
        
        
            
                "description": "Injection molding for polymer covers",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const MachinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "CNC Mill 01",
            
        
    
        
        
            
                "asset_tag": "NP-CNC-001",
            
        
    
        
        
            
                "serial_number": "CNCX-77421",
            
        
    
        
        
            
                "machine_type": "lathe",
            
        
    
        
        
            
                "status": "down",
            
        
    
        
        
            
                "nominal_rate_per_hour": 12.5,
            
        
    
        
        
            
                "commissioned_at": new Date('2022-06-15T00:00:00Z'),
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "CNC Lathe 02",
            
        
    
        
        
            
                "asset_tag": "NP-LAT-002",
            
        
    
        
        
            
                "serial_number": "LATZ-44310",
            
        
    
        
        
            
                "machine_type": "lathe",
            
        
    
        
        
            
                "status": "setup",
            
        
    
        
        
            
                "nominal_rate_per_hour": 10.0,
            
        
    
        
        
            
                "commissioned_at": new Date('2021-03-10T00:00:00Z'),
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Torque Station A",
            
        
    
        
        
            
                "asset_tag": "NP-ASM-010",
            
        
    
        
        
            
                "serial_number": "TRQ-22019",
            
        
    
        
        
            
                "machine_type": "inspection",
            
        
    
        
        
            
                "status": "down",
            
        
    
        
        
            
                "nominal_rate_per_hour": 30.0,
            
        
    
        
        
            
                "commissioned_at": new Date('2023-01-05T00:00:00Z'),
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Labeler 02",
            
        
    
        
        
            
                "asset_tag": "SP-PACK-022",
            
        
    
        
        
            
                "serial_number": "LBL-89211",
            
        
    
        
        
            
                "machine_type": "press",
            
        
    
        
        
            
                "status": "offline",
            
        
    
        
        
            
                "nominal_rate_per_hour": 55.0,
            
        
    
        
        
            
                "commissioned_at": new Date('2020-09-01T00:00:00Z'),
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Injection Press 03",
            
        
    
        
        
            
                "asset_tag": "EP-MOLD-003",
            
        
    
        
        
            
                "serial_number": "PRS-55102",
            
        
    
        
        
            
                "machine_type": "mixer",
            
        
    
        
        
            
                "status": "offline",
            
        
    
        
        
            
                "nominal_rate_per_hour": 18.0,
            
        
    
        
        
            
                "commissioned_at": new Date('2019-11-20T00:00:00Z'),
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const MaintenanceWorkOrdersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Replace label sensor and recalibrate",
            
        
    
        
        
            
                "description": "Intermittent misreads on roll feed; replace sensor and perform calibration per vendor guide",
            
        
    
        
        
            
                "priority": "medium",
            
        
    
        
        
            
                "status": "requested",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-20T14:10:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-03-25T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-26T13:30:00Z'),
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                "title": "Hydraulic leak inspection",
            
        
    
        
        
            
                "description": "Small oil residue near manifold; inspect hoses and fittings, verify pressure stability",
            
        
    
        
        
            
                "priority": "medium",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-19T09:05:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-03-21T18:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-21T16:40:00Z'),
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                "title": "Preventive maintenance service",
            
        
    
        
        
            
                "description": "Quarterly PM: coolant change, spindle inspection, axis lubrication",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "status": "blocked",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-10T11:20:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-03-15T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-14T12:10:00Z'),
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                "title": "Verify torque transducer accuracy",
            
        
    
        
        
            
                "description": "QA requested verification after drift observed in last calibration check",
            
        
    
        
        
            
                "priority": "medium",
            
        
    
        
        
            
                "status": "requested",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-22T08:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-03-27T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-27T11:20:00Z'),
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                "title": "Replace worn vise jaws",
            
        
    
        
        
            
                "description": "Workholding slippage reported on part family HSG-100; replace jaws and requalify setup",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "status": "requested",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-05T13:15:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-03-08T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-07T10:05:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DowntimeEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason_category": "other",
            
        
    
        
        
            
                "reason_detail": "Label sensor fault causing stop",
            
        
    
        
        
            
                "start_at": new Date('2026-03-20T13:40:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-03-20T16:05:00Z'),
            
        
    
        
        
            
                "planned": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason_category": "breakdown",
            
        
    
        
        
            
                "reason_detail": "Changeover to HSG-200 fixtures",
            
        
    
        
        
            
                "start_at": new Date('2026-03-18T07:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-03-18T08:10:00Z'),
            
        
    
        
        
            
                "planned": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason_category": "utilities",
            
        
    
        
        
            
                "reason_detail": "Hydraulic inspection and cleanup",
            
        
    
        
        
            
                "start_at": new Date('2026-03-19T10:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-03-19T12:30:00Z'),
            
        
    
        
        
            
                "planned": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason_category": "unplanned_maintenance",
            
        
    
        
        
            
                "reason_detail": "Paused for torque verification check",
            
        
    
        
        
            
                "start_at": new Date('2026-03-22T08:15:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-03-22T09:05:00Z'),
            
        
    
        
        
            
                "planned": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason_category": "other",
            
        
    
        
        
            
                "reason_detail": "Waiting on aluminum bar stock delivery",
            
        
    
        
        
            
                "start_at": new Date('2026-03-21T14:20:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-03-21T15:10:00Z'),
            
        
    
        
        
            
                "planned": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ItemsData = [
    
    {
    
        
        
            
                "name": "Aluminum Housing HSG-100",
            
        
    
        
        
            
                "sku": "HSG-100",
            
        
    
        
        
            
                "revision": "B",
            
        
    
        
        
            
                "item_type": "raw_material",
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": false,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "description": "Machined aluminum housing for actuator assembly",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Polymer Cover COV-200",
            
        
    
        
        
            
                "sku": "COV-200",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "item_type": "component",
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "description": "Injection molded protective cover",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Fastener Kit FST-10",
            
        
    
        
        
            
                "sku": "FST-10",
            
        
    
        
        
            
                "revision": "C",
            
        
    
        
        
            
                "item_type": "consumable",
            
        
    
        
        
            
                "uom": "KIT",
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": false,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "description": "Standard fastener kit for assembly",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Aluminum Bar Stock AL-6061",
            
        
    
        
        
            
                "sku": "AL-6061-1IN",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "item_type": "packaging",
            
        
    
        
        
            
                "uom": "FT",
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "description": "6061 aluminum bar stock 1 inch diameter",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Carton Box BX-01",
            
        
    
        
        
            
                "sku": "BX-01",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "item_type": "consumable",
            
        
    
        
        
            
                "uom": "EA",
            
        
    
        
        
            
                "lot_tracked": false,
            
        
    
        
        
            
                "serial_tracked": false,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "description": "Single unit ship carton with inserts",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ItemFilesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "file_type": "certificate",
            
        
    
        
        
            
                "title": "HSG-100 Drawing",
            
        
    
        
        
            
                "revision": "B",
            
        
    
        
        
            
                "effective_from": new Date('2025-01-10T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-01-10T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "file_type": "drawing",
            
        
    
        
        
            
                "title": "COV-200 Material Spec",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "effective_from": new Date('2024-08-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2028-08-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "file_type": "certificate",
            
        
    
        
        
            
                "title": "6061 Mill Certificate Template",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "effective_from": new Date('2023-05-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2029-05-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "file_type": "drawing",
            
        
    
        
        
            
                "title": "Fastener Kitting Work Instruction",
            
        
    
        
        
            
                "revision": "C",
            
        
    
        
        
            
                "effective_from": new Date('2025-11-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-11-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "file_type": "drawing",
            
        
    
        
        
            
                "title": "Packaging Spec BX-01",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "effective_from": new Date('2024-02-15T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-02-15T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const BomsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bom_code": "BOM-HSG-100",
            
        
    
        
        
            
                "revision": "B",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "effective_from": new Date('2025-01-10T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-01-10T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Standard BOM for HSG-100 build",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bom_code": "BOM-COV-200",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "effective_from": new Date('2024-08-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2028-08-01T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Molding BOM including resin and colorant",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bom_code": "BOM-FST-10",
            
        
    
        
        
            
                "revision": "C",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "effective_from": new Date('2025-11-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-11-01T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Kitting BOM for standard fasteners",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bom_code": "BOM-BX-01",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "effective_from": new Date('2024-02-15T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-02-15T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Packaging BOM pending supplier update",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bom_code": "BOM-HSG-100-OBSOLETE",
            
        
    
        
        
            
                "revision": "A",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "effective_from": new Date('2023-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2024-12-31T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Replaced by revision B",
            
        
    
        
        
            
                // 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": 3.5,
            
        
    
        
        
            
                "scrap_factor": 0.05,
            
        
    
        
        
            
                "reference_designator": "RM-AL6061",
            
        
    
        
        
            
                "notes": "Cut length per router",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 1,
            
        
    
        
        
            
                "scrap_factor": 0,
            
        
    
        
        
            
                "reference_designator": "KIT-FST10",
            
        
    
        
        
            
                "notes": "Installed at 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,
            
        
    
        
        
            
                "scrap_factor": 0.02,
            
        
    
        
        
            
                "reference_designator": "COV-200",
            
        
    
        
        
            
                "notes": "Snap-fit cover after machining",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 1,
            
        
    
        
        
            
                "scrap_factor": 0.01,
            
        
    
        
        
            
                "reference_designator": "PKG-BX01",
            
        
    
        
        
            
                "notes": "Pack with insert",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 0.1,
            
        
    
        
        
            
                "scrap_factor": 0,
            
        
    
        
        
            
                "reference_designator": "PKG-SHARE",
            
        
    
        
        
            
                "notes": "Shared packaging usage allocation",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SuppliersData = [
    
    {
    
        
        
            
                "name": "Metro Metals Supply",
            
        
    
        
        
            
                "code": "SUP-METRO",
            
        
    
        
        
            
                "contact_name": "Casey Nguyen",
            
        
    
        
        
            
                "contact_email": "casey.nguyen@metrometals.example",
            
        
    
        
        
            
                "contact_phone": "+1-937-555-0142",
            
        
    
        
        
            
                "address": "4100 Steel Ave, Dayton, OH",
            
        
    
        
        
            
                "approved": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "PolyForm Plastics",
            
        
    
        
        
            
                "code": "SUP-POLY",
            
        
    
        
        
            
                "contact_name": "Riley Brooks",
            
        
    
        
        
            
                "contact_email": "riley.brooks@polyform.example",
            
        
    
        
        
            
                "contact_phone": "+1-615-555-0199",
            
        
    
        
        
            
                "address": "900 Resin Rd, Nashville, TN",
            
        
    
        
        
            
                "approved": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "FastenRight Co",
            
        
    
        
        
            
                "code": "SUP-FAST",
            
        
    
        
        
            
                "contact_name": "Jamie Ortiz",
            
        
    
        
        
            
                "contact_email": "jamie.ortiz@fastenright.example",
            
        
    
        
        
            
                "contact_phone": "+1-775-555-0110",
            
        
    
        
        
            
                "address": "77 Bolt St, Reno, NV",
            
        
    
        
        
            
                "approved": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "PackPro Packaging",
            
        
    
        
        
            
                "code": "SUP-PACK",
            
        
    
        
        
            
                "contact_name": "Drew Allen",
            
        
    
        
        
            
                "contact_email": "drew.allen@packpro.example",
            
        
    
        
        
            
                "contact_phone": "+1-610-555-0133",
            
        
    
        
        
            
                "address": "18 Carton Ct, Allentown, PA",
            
        
    
        
        
            
                "approved": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "CalibTek Services",
            
        
    
        
        
            
                "code": "SUP-CALIB",
            
        
    
        
        
            
                "contact_name": "Quinn Harper",
            
        
    
        
        
            
                "contact_email": "quinn.harper@calibtek.example",
            
        
    
        
        
            
                "contact_phone": "+1-317-555-0168",
            
        
    
        
        
            
                "address": "220 Precision Pkwy, Indianapolis, IN",
            
        
    
        
        
            
                "approved": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PurchaseOrdersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "po_number": "PO-2026-0007",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "order_date": new Date('2026-03-10T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-21T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Bar stock for HSG-100 March builds",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                "po_number": "PO-2026-0008",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "order_date": new Date('2026-03-12T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-26T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Resin for COV-200 molding campaign",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                "po_number": "PO-2026-0009",
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "order_date": new Date('2026-03-05T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-18T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Fastener kits for assembly lines",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                "po_number": "PO-2026-0010",
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "order_date": new Date('2026-03-15T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-29T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Cartons for finished goods shipping",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                "po_number": "PO-2026-0011",
            
        
    
        
        
            
                "status": "submitted",
            
        
    
        
        
            
                "order_date": new Date('2026-02-25T00:00:00Z'),
            
        
    
        
        
            
                "expected_at": new Date('2026-03-08T00:00:00Z'),
            
        
    
        
        
            
                "notes": "Bulk aluminum replenishment",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PurchaseOrderLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_qty": 1200,
            
        
    
        
        
            
                "received_qty": 0,
            
        
    
        
        
            
                "unit_price": 4.25,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-21T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_qty": 2000,
            
        
    
        
        
            
                "received_qty": 0,
            
        
    
        
        
            
                "unit_price": 1.15,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-26T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_qty": 800,
            
        
    
        
        
            
                "received_qty": 400,
            
        
    
        
        
            
                "unit_price": 2.35,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-18T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_qty": 5000,
            
        
    
        
        
            
                "received_qty": 0,
            
        
    
        
        
            
                "unit_price": 0.42,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-29T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_qty": 3000,
            
        
    
        
        
            
                "received_qty": 3000,
            
        
    
        
        
            
                "unit_price": 4.1,
            
        
    
        
        
            
                "need_by_at": new Date('2026-03-08T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InventoryLotsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "AL6061-260308-A",
            
        
    
        
        
            
                "supplier_lot_number": "MMS-AL-88321",
            
        
    
        
        
            
                "received_at": new Date('2026-03-08T11:30:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2028-03-08T00:00:00Z'),
            
        
    
        
        
            
                "quality_status": "hold",
            
        
    
        
        
            
                "on_hand_qty": 2800,
            
        
    
        
        
            
                "allocated_qty": 900,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "COV200-260315-Q",
            
        
    
        
        
            
                "supplier_lot_number": "PF-RES-11209",
            
        
    
        
        
            
                "received_at": new Date('2026-03-15T09:10:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2027-03-15T00:00:00Z'),
            
        
    
        
        
            
                "quality_status": "rejected",
            
        
    
        
        
            
                "on_hand_qty": 1200,
            
        
    
        
        
            
                "allocated_qty": 0,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "FST10-260310-R",
            
        
    
        
        
            
                "supplier_lot_number": "FR-77018",
            
        
    
        
        
            
                "received_at": new Date('2026-03-10T16:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2029-03-10T00:00:00Z'),
            
        
    
        
        
            
                "quality_status": "released",
            
        
    
        
        
            
                "on_hand_qty": 600,
            
        
    
        
        
            
                "allocated_qty": 250,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "BX01-260312-R",
            
        
    
        
        
            
                "supplier_lot_number": "PP-CTN-55001",
            
        
    
        
        
            
                "received_at": new Date('2026-03-12T13:20:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2030-03-12T00:00:00Z'),
            
        
    
        
        
            
                "quality_status": "rejected",
            
        
    
        
        
            
                "on_hand_qty": 4500,
            
        
    
        
        
            
                "allocated_qty": 1200,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "HSG100-260320-R",
            
        
    
        
        
            
                "supplier_lot_number": "N-A",
            
        
    
        
        
            
                "received_at": new Date('2026-03-20T18:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2028-03-20T00:00:00Z'),
            
        
    
        
        
            
                "quality_status": "rejected",
            
        
    
        
        
            
                "on_hand_qty": 320,
            
        
    
        
        
            
                "allocated_qty": 40,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InventoryTransactionsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "transaction_type": "issue_to_production",
            
        
    
        
        
            
                "quantity": 3000,
            
        
    
        
        
            
                "transaction_at": new Date('2026-03-08T11:30:00Z'),
            
        
    
        
        
            
                "reference": "RCV-PO-2026-0011",
            
        
    
        
        
            
                "notes": "Received per PO-2026-0011",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "transaction_type": "adjustment",
            
        
    
        
        
            
                "quantity": 500,
            
        
    
        
        
            
                "transaction_at": new Date('2026-03-18T09:00:00Z'),
            
        
    
        
        
            
                "reference": "ISS-MO-10021",
            
        
    
        
        
            
                "notes": "Issued to production order",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "transaction_type": "adjustment",
            
        
    
        
        
            
                "quantity": 400,
            
        
    
        
        
            
                "transaction_at": new Date('2026-03-10T16:00:00Z'),
            
        
    
        
        
            
                "reference": "RCV-PO-2026-0009",
            
        
    
        
        
            
                "notes": "Partial receipt for PO-2026-0009",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "transaction_type": "return_from_production",
            
        
    
        
        
            
                "quantity": -25,
            
        
    
        
        
            
                "transaction_at": new Date('2026-03-16T15:20:00Z'),
            
        
    
        
        
            
                "reference": "ADJ-CYCLE-0316",
            
        
    
        
        
            
                "notes": "Cycle count variance correction",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "transaction_type": "transfer_in",
            
        
    
        
        
            
                "quantity": 320,
            
        
    
        
        
            
                "transaction_at": new Date('2026-03-20T18:00:00Z'),
            
        
    
        
        
            
                "reference": "RCV-MO-10021",
            
        
    
        
        
            
                "notes": "Received finished goods from production",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ProductionOrdersData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "order_number": "MO-10021",
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                "planned_qty": 500,
            
        
    
        
        
            
                "completed_qty": 320,
            
        
    
        
        
            
                "scrap_qty": 8,
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-15T07:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-22T17:00:00Z'),
            
        
    
        
        
            
                "actual_start_at": new Date('2026-03-15T07:12:00Z'),
            
        
    
        
        
            
                "actual_end_at": new Date('2026-03-20T18:00:00Z'),
            
        
    
        
        
            
                "notes": "Priority order for March shipment",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "MO-10022",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "planned_qty": 1200,
            
        
    
        
        
            
                "completed_qty": 0,
            
        
    
        
        
            
                "scrap_qty": 0,
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-20T06:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-23T18:00:00Z'),
            
        
    
        
        
            
                "actual_start_at": new Date('2026-03-20T06:10:00Z'),
            
        
    
        
        
            
                "actual_end_at": new Date('2026-03-20T08:00:00Z'),
            
        
    
        
        
            
                "notes": "Hold pending resin release from QA",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "order_number": "MO-10023",
            
        
    
        
        
            
                "status": "released",
            
        
    
        
        
            
                "planned_qty": 400,
            
        
    
        
        
            
                "completed_qty": 0,
            
        
    
        
        
            
                "scrap_qty": 0,
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-23T07:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-27T17:00:00Z'),
            
        
    
        
        
            
                "actual_start_at": new Date('2026-03-23T07:00:00Z'),
            
        
    
        
        
            
                "actual_end_at": new Date('2026-03-23T07:00:00Z'),
            
        
    
        
        
            
                "notes": "Assembly run after machining 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
            
        
    
        
        
            
                "order_number": "MO-10024",
            
        
    
        
        
            
                "status": "released",
            
        
    
        
        
            
                "planned_qty": 5000,
            
        
    
        
        
            
                "completed_qty": 0,
            
        
    
        
        
            
                "scrap_qty": 0,
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-28T07:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-29T17:00:00Z'),
            
        
    
        
        
            
                "actual_start_at": new Date('2026-03-28T07:00:00Z'),
            
        
    
        
        
            
                "actual_end_at": new Date('2026-03-28T07:00:00Z'),
            
        
    
        
        
            
                "notes": "Dependent on labeler repair 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
            
        
    
        
        
            
                "order_number": "MO-10025",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "planned_qty": 200,
            
        
    
        
        
            
                "completed_qty": 200,
            
        
    
        
        
            
                "scrap_qty": 0,
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-03-10T08:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-03-10T12:00:00Z'),
            
        
    
        
        
            
                "actual_start_at": new Date('2026-03-10T08:05:00Z'),
            
        
    
        
        
            
                "actual_end_at": new Date('2026-03-10T11:30:00Z'),
            
        
    
        
        
            
                "notes": "Audit kitting lot for compliance sampling",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ProductionOperationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_name": "Rough Mill Housing",
            
        
    
        
        
            
                "sequence": 10,
            
        
    
        
        
            
                "status": "running",
            
        
    
        
        
            
                "planned_run_hours": 18,
            
        
    
        
        
            
                "actual_run_hours": 16.5,
            
        
    
        
        
            
                "start_at": new Date('2026-03-15T07:30:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-03-17T12:00:00Z'),
            
        
    
        
        
            
                "work_instructions": "Use fixture HSG-A; verify tool offsets before run",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_name": "Turn Bearing Seats",
            
        
    
        
        
            
                "sequence": 20,
            
        
    
        
        
            
                "status": "ready",
            
        
    
        
        
            
                "planned_run_hours": 12,
            
        
    
        
        
            
                "actual_run_hours": 6.2,
            
        
    
        
        
            
                "start_at": new Date('2026-03-18T08:20:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-03-22T17:00:00Z'),
            
        
    
        
        
            
                "work_instructions": "Inspect first article; hold dimensions within print tolerance",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_name": "Final Assembly Torque",
            
        
    
        
        
            
                "sequence": 30,
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "planned_run_hours": 10,
            
        
    
        
        
            
                "actual_run_hours": 0,
            
        
    
        
        
            
                "start_at": new Date('2026-03-23T07:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-03-23T07:00:00Z'),
            
        
    
        
        
            
                "work_instructions": "Apply threadlocker; record torque values per station checklist",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_name": "Label and Carton",
            
        
    
        
        
            
                "sequence": 40,
            
        
    
        
        
            
                "status": "skipped",
            
        
    
        
        
            
                "planned_run_hours": 8,
            
        
    
        
        
            
                "actual_run_hours": 0,
            
        
    
        
        
            
                "start_at": new Date('2026-03-28T07:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-03-29T17:00:00Z'),
            
        
    
        
        
            
                "work_instructions": "Verify label template; perform barcode scan verification every 30 minutes",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_name": "Mold Polymer Cover",
            
        
    
        
        
            
                "sequence": 10,
            
        
    
        
        
            
                "status": "paused",
            
        
    
        
        
            
                "planned_run_hours": 14,
            
        
    
        
        
            
                "actual_run_hours": 1.8,
            
        
    
        
        
            
                "start_at": new Date('2026-03-20T06:10:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-03-23T18:00:00Z'),
            
        
    
        
        
            
                "work_instructions": "Dry resin per spec; monitor shot weight and visual defects",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "allocated_qty": 900,
            
        
    
        
        
            
                "issued_qty": 500,
            
        
    
        
        
            
                "allocated_at": new Date('2026-03-14T16:00:00Z'),
            
        
    
        
        
            
                "issued_at": new Date('2026-03-18T09:00:00Z'),
            
        
    
        
        
            
                "status": "allocated",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "allocated_qty": 250,
            
        
    
        
        
            
                "issued_qty": 0,
            
        
    
        
        
            
                "allocated_at": new Date('2026-03-18T10:00:00Z'),
            
        
    
        
        
            
                "issued_at": new Date('2026-03-18T10:00:00Z'),
            
        
    
        
        
            
                "status": "allocated",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "allocated_qty": 200,
            
        
    
        
        
            
                "issued_qty": 0,
            
        
    
        
        
            
                "allocated_at": new Date('2026-03-22T14:00:00Z'),
            
        
    
        
        
            
                "issued_at": new Date('2026-03-22T14:00:00Z'),
            
        
    
        
        
            
                "status": "consumed",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "allocated_qty": 1200,
            
        
    
        
        
            
                "issued_qty": 0,
            
        
    
        
        
            
                "allocated_at": new Date('2026-03-19T17:30:00Z'),
            
        
    
        
        
            
                "issued_at": new Date('2026-03-19T17:30:00Z'),
            
        
    
        
        
            
                "status": "consumed",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "allocated_qty": 1200,
            
        
    
        
        
            
                "issued_qty": 0,
            
        
    
        
        
            
                "allocated_at": new Date('2026-03-20T09:15:00Z'),
            
        
    
        
        
            
                "issued_at": new Date('2026-03-20T09:15:00Z'),
            
        
    
        
        
            
                "status": "returned",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const QualityInspectionsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "inspection_type": "final",
            
        
    
        
        
            
                "inspection_at": new Date('2026-03-08T14:00:00Z'),
            
        
    
        
        
            
                "result": "fail",
            
        
    
        
        
            
                "summary": "Incoming aluminum cert review and dimensions OK",
            
        
    
        
        
            
                "notes": "Verified mill cert matches alloy and temper; spot check diameter within tolerance",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "incoming",
            
        
    
        
        
            
                "inspection_at": new Date('2026-03-15T11:00:00Z'),
            
        
    
        
        
            
                "result": "fail",
            
        
    
        
        
            
                "summary": "Resin lot pending COA upload",
            
        
    
        
        
            
                "notes": "Quarantine until supplier COA received and reviewed",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "in_process",
            
        
    
        
        
            
                "inspection_at": new Date('2026-03-20T16:30:00Z'),
            
        
    
        
        
            
                "result": "fail",
            
        
    
        
        
            
                "summary": "Final dimensional check passed",
            
        
    
        
        
            
                "notes": "Sampled per plan AQL; no nonconformances observed",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "in_process",
            
        
    
        
        
            
                "inspection_at": new Date('2026-03-10T10:00:00Z'),
            
        
    
        
        
            
                "result": "pass",
            
        
    
        
        
            
                "summary": "Audit sampling of kitting accuracy passed",
            
        
    
        
        
            
                "notes": "Count and part numbers matched; packaging integrity OK",
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "final",
            
        
    
        
        
            
                "inspection_at": new Date('2026-03-12T15:00:00Z'),
            
        
    
        
        
            
                "result": "fail",
            
        
    
        
        
            
                "summary": "Carton burst strength and print quality OK",
            
        
    
        
        
            
                "notes": "Spot check labeling area and barcode readability",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const NonconformancesData = [
    
    {
    
        
        
            
                // 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": "under_investigation",
            
        
    
        
        
            
                "title": "Missing supplier COA for resin lot",
            
        
    
        
        
            
                "description": "Resin received without certificate of analysis; cannot release to production until documentation verified",
            
        
    
        
        
            
                "containment_action": "Quarantine lot in SP Receiving; notify supplier and purchasing",
            
        
    
        
        
            
                "detected_at": new Date('2026-03-15T11:05:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-18T09:30:00Z'),
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "status": "capa_in_progress",
            
        
    
        
        
            
                "title": "Mill cert format mismatch",
            
        
    
        
        
            
                "description": "Certificate provided in alternate format; values present but required template not used",
            
        
    
        
        
            
                "containment_action": "Accepted with documented deviation; supplier requested to use standard template next shipment",
            
        
    
        
        
            
                "detected_at": new Date('2026-03-08T14:10:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-09T10:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "major",
            
        
    
        
        
            
                "status": "capa_in_progress",
            
        
    
        
        
            
                "title": "Tool wear causing surface finish variation",
            
        
    
        
        
            
                "description": "Operators reported roughness variation on cavity wall; investigate tooling and process parameters",
            
        
    
        
        
            
                "containment_action": "Segregate last 50 units for additional inspection",
            
        
    
        
        
            
                "detected_at": new Date('2026-03-20T17:10:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-26T14:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "minor",
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                "title": "Carton glue seam inconsistency",
            
        
    
        
        
            
                "description": "Observed occasional weak glue seam during packout trial; verify supplier batch consistency",
            
        
    
        
        
            
                "containment_action": "Increase in-process checks on seam integrity",
            
        
    
        
        
            
                "detected_at": new Date('2026-03-16T09:40:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-27T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "minor",
            
        
    
        
        
            
                "status": "under_investigation",
            
        
    
        
        
            
                "title": "Kitting label alignment concern",
            
        
    
        
        
            
                "description": "Initial concern about label placement; determined within acceptable range after review",
            
        
    
        
        
            
                "containment_action": "No action required; document review result",
            
        
    
        
        
            
                "detected_at": new Date('2026-03-10T10:15:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-10T10:45:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CapaActionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "corrective",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "title": "Update receiving checklist for COA verification",
            
        
    
        
        
            
                "description": "Revise receiving SOP to require COA attachment and QA signoff before material release",
            
        
    
        
        
            
                "due_at": new Date('2026-03-25T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-22T16:00:00Z'),
            
        
    
        
        
            
                "effectiveness_check_at": new Date('2026-04-05T12:00:00Z'),
            
        
    
        
        
            
                "effectiveness_notes": "Next resin receipt included COA and was released within same day",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "corrective",
            
        
    
        
        
            
                "status": "planned",
            
        
    
        
        
            
                "title": "Replace finishing tool and adjust inspection frequency",
            
        
    
        
        
            
                "description": "Replace finishing end mill; add hourly surface finish check until stable",
            
        
    
        
        
            
                "due_at": new Date('2026-03-28T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-27T15:00:00Z'),
            
        
    
        
        
            
                "effectiveness_check_at": new Date('2026-04-03T12:00:00Z'),
            
        
    
        
        
            
                "effectiveness_notes": "Post-change samples met surface finish requirement",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "preventive",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "title": "Supplier process audit for carton gluing",
            
        
    
        
        
            
                "description": "Schedule supplier audit focusing on glue application and curing controls",
            
        
    
        
        
            
                "due_at": new Date('2026-04-10T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-04-09T13:00:00Z'),
            
        
    
        
        
            
                "effectiveness_check_at": new Date('2026-04-24T12:00:00Z'),
            
        
    
        
        
            
                "effectiveness_notes": "Improved seam consistency observed in subsequent lot",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "corrective",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "title": "Standardize mill cert template request on POs",
            
        
    
        
        
            
                "description": "Add template requirement to PO notes and supplier portal instructions",
            
        
    
        
        
            
                "due_at": new Date('2026-03-20T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-12T09:30:00Z'),
            
        
    
        
        
            
                "effectiveness_check_at": new Date('2026-04-01T12:00:00Z'),
            
        
    
        
        
            
                "effectiveness_notes": "Supplier provided correct format on next delivery",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "correction",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "title": "Adjust label placement guide",
            
        
    
        
        
            
                "description": "No longer needed after review confirmed compliance",
            
        
    
        
        
            
                "due_at": new Date('2026-03-15T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-10T10:45:00Z'),
            
        
    
        
        
            
                "effectiveness_check_at": new Date('2026-03-20T12:00:00Z'),
            
        
    
        
        
            
                "effectiveness_notes": "Canceled; issue voided",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AuditLogsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_name": "production_orders",
            
        
    
        
        
            
                "entity_reference": "MO-10021",
            
        
    
        
        
            
                "action": "login",
            
        
    
        
        
            
                "occurred_at": new Date('2026-03-18T09:05:00Z'),
            
        
    
        
        
            
                "ip_address": "10.0.4.12",
            
        
    
        
        
            
                "user_agent": "Chrome on Windows",
            
        
    
        
        
            
                "details": "Updated status to in_progress and confirmed material issue",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_name": "quality_inspections",
            
        
    
        
        
            
                "entity_reference": "Incoming aluminum cert review and dimensions OK",
            
        
    
        
        
            
                "action": "login",
            
        
    
        
        
            
                "occurred_at": new Date('2026-03-08T14:02:00Z'),
            
        
    
        
        
            
                "ip_address": "10.0.6.21",
            
        
    
        
        
            
                "user_agent": "Chrome on macOS",
            
        
    
        
        
            
                "details": "Logged incoming inspection for lot AL6061-260308-A",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_name": "inventory_transactions",
            
        
    
        
        
            
                "entity_reference": "ADJ-CYCLE-0316",
            
        
    
        
        
            
                "action": "approve",
            
        
    
        
        
            
                "occurred_at": new Date('2026-03-16T15:22:00Z'),
            
        
    
        
        
            
                "ip_address": "10.0.5.18",
            
        
    
        
        
            
                "user_agent": "Edge on Windows",
            
        
    
        
        
            
                "details": "Recorded cycle count adjustment for BX-01",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_name": "maintenance_work_orders",
            
        
    
        
        
            
                "entity_reference": "Replace label sensor and recalibrate",
            
        
    
        
        
            
                "action": "login",
            
        
    
        
        
            
                "occurred_at": new Date('2026-03-21T08:30:00Z'),
            
        
    
        
        
            
                "ip_address": "10.0.7.9",
            
        
    
        
        
            
                "user_agent": "Chrome on Android",
            
        
    
        
        
            
                "details": "Set work order to in_progress and added parts requirement",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_name": "purchase_orders",
            
        
    
        
        
            
                "entity_reference": "PO-2026-0007",
            
        
    
        
        
            
                "action": "login",
            
        
    
        
        
            
                "occurred_at": new Date('2026-03-10T16:10:00Z'),
            
        
    
        
        
            
                "ip_address": "10.0.3.44",
            
        
    
        
        
            
                "user_agent": "Chrome on Windows",
            
        
    
        
        
            
                "details": "Approved PO for aluminum bar stock",
            
        
    
        
        
            
                // 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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User4 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (User4?.setOrganization)
                {
                    await
                    User4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Plant4 = await Plants.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Plant4?.setOrganization)
                {
                    await
                    Plant4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            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);
                }
            
                const relatedPlant4 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const Warehous4 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Warehous4?.setPlant)
                {
                    await
                    Warehous4.
                    setPlant(relatedPlant4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous4 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Warehous4?.setOrganization)
                {
                    await
                    Warehous4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            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);
                }
            
                const relatedPlant4 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const WorkCenter4 = await WorkCenters.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WorkCenter4?.setPlant)
                {
                    await
                    WorkCenter4.
                    setPlant(relatedPlant4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WorkCenter4 = await WorkCenters.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WorkCenter4?.setOrganization)
                {
                    await
                    WorkCenter4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            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);
                }
            
                const relatedWork_center4 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const Machine4 = await Machines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Machine4?.setWork_center)
                {
                    await
                    Machine4.
                    setWork_center(relatedWork_center4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Machine4 = await Machines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Machine4?.setOrganization)
                {
                    await
                    Machine4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            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);
                }
            
                const relatedMachine4 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MaintenanceWorkOrder4 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MaintenanceWorkOrder4?.setMachine)
                {
                    await
                    MaintenanceWorkOrder4.
                    setMachine(relatedMachine4);
                }
            
        }
        
    
        
            
            async function associateMaintenanceWorkOrderWithReported_by() {
            
                const relatedReported_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder0 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaintenanceWorkOrder0?.setReported_by)
                {
                    await
                    MaintenanceWorkOrder0.
                    setReported_by(relatedReported_by0);
                }
            
                const relatedReported_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder1 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaintenanceWorkOrder1?.setReported_by)
                {
                    await
                    MaintenanceWorkOrder1.
                    setReported_by(relatedReported_by1);
                }
            
                const relatedReported_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder2 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaintenanceWorkOrder2?.setReported_by)
                {
                    await
                    MaintenanceWorkOrder2.
                    setReported_by(relatedReported_by2);
                }
            
                const relatedReported_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder3 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaintenanceWorkOrder3?.setReported_by)
                {
                    await
                    MaintenanceWorkOrder3.
                    setReported_by(relatedReported_by3);
                }
            
                const relatedReported_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder4 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MaintenanceWorkOrder4?.setReported_by)
                {
                    await
                    MaintenanceWorkOrder4.
                    setReported_by(relatedReported_by4);
                }
            
        }
        
    
        
            
            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);
                }
            
                const relatedAssigned_to4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaintenanceWorkOrder4 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MaintenanceWorkOrder4?.setAssigned_to)
                {
                    await
                    MaintenanceWorkOrder4.
                    setAssigned_to(relatedAssigned_to4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MaintenanceWorkOrder4 = await MaintenanceWorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MaintenanceWorkOrder4?.setOrganization)
                {
                    await
                    MaintenanceWorkOrder4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            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);
                }
            
                const relatedMachine4 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const DowntimeEvent4 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (DowntimeEvent4?.setMachine)
                {
                    await
                    DowntimeEvent4.
                    setMachine(relatedMachine4);
                }
            
        }
        
    
        
            
            async function associateDowntimeEventWithLogged_by() {
            
                const relatedLogged_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DowntimeEvent0 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DowntimeEvent0?.setLogged_by)
                {
                    await
                    DowntimeEvent0.
                    setLogged_by(relatedLogged_by0);
                }
            
                const relatedLogged_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DowntimeEvent1 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DowntimeEvent1?.setLogged_by)
                {
                    await
                    DowntimeEvent1.
                    setLogged_by(relatedLogged_by1);
                }
            
                const relatedLogged_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DowntimeEvent2 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DowntimeEvent2?.setLogged_by)
                {
                    await
                    DowntimeEvent2.
                    setLogged_by(relatedLogged_by2);
                }
            
                const relatedLogged_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DowntimeEvent3 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DowntimeEvent3?.setLogged_by)
                {
                    await
                    DowntimeEvent3.
                    setLogged_by(relatedLogged_by3);
                }
            
                const relatedLogged_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DowntimeEvent4 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (DowntimeEvent4?.setLogged_by)
                {
                    await
                    DowntimeEvent4.
                    setLogged_by(relatedLogged_by4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DowntimeEvent4 = await DowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (DowntimeEvent4?.setOrganization)
                {
                    await
                    DowntimeEvent4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Item0 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Item0?.setOrganization)
                {
                    await
                    Item0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Item1 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Item1?.setOrganization)
                {
                    await
                    Item1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Item2 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Item2?.setOrganization)
                {
                    await
                    Item2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Item3 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Item3?.setOrganization)
                {
                    await
                    Item3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Item4 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Item4?.setOrganization)
                {
                    await
                    Item4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateItemFileWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ItemFile0 = await ItemFiles.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ItemFile0?.setItem)
                {
                    await
                    ItemFile0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ItemFile1 = await ItemFiles.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ItemFile1?.setItem)
                {
                    await
                    ItemFile1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ItemFile2 = await ItemFiles.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ItemFile2?.setItem)
                {
                    await
                    ItemFile2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ItemFile3 = await ItemFiles.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ItemFile3?.setItem)
                {
                    await
                    ItemFile3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ItemFile4 = await ItemFiles.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ItemFile4?.setItem)
                {
                    await
                    ItemFile4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateItemFileWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ItemFile0 = await ItemFiles.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ItemFile0?.setOrganization)
                {
                    await
                    ItemFile0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ItemFile1 = await ItemFiles.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ItemFile1?.setOrganization)
                {
                    await
                    ItemFile1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ItemFile2 = await ItemFiles.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ItemFile2?.setOrganization)
                {
                    await
                    ItemFile2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ItemFile3 = await ItemFiles.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ItemFile3?.setOrganization)
                {
                    await
                    ItemFile3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ItemFile4 = await ItemFiles.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ItemFile4?.setOrganization)
                {
                    await
                    ItemFile4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateBomWithParent_item() {
            
                const relatedParent_item0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Bom0 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Bom0?.setParent_item)
                {
                    await
                    Bom0.
                    setParent_item(relatedParent_item0);
                }
            
                const relatedParent_item1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Bom1 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Bom1?.setParent_item)
                {
                    await
                    Bom1.
                    setParent_item(relatedParent_item1);
                }
            
                const relatedParent_item2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Bom2 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Bom2?.setParent_item)
                {
                    await
                    Bom2.
                    setParent_item(relatedParent_item2);
                }
            
                const relatedParent_item3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Bom3 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Bom3?.setParent_item)
                {
                    await
                    Bom3.
                    setParent_item(relatedParent_item3);
                }
            
                const relatedParent_item4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Bom4 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Bom4?.setParent_item)
                {
                    await
                    Bom4.
                    setParent_item(relatedParent_item4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateBomWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Bom0 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Bom0?.setOrganization)
                {
                    await
                    Bom0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Bom1 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Bom1?.setOrganization)
                {
                    await
                    Bom1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Bom2 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Bom2?.setOrganization)
                {
                    await
                    Bom2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Bom3 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Bom3?.setOrganization)
                {
                    await
                    Bom3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Bom4 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Bom4?.setOrganization)
                {
                    await
                    Bom4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateBomLineWithBom() {
            
                const relatedBom0 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomLine0 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomLine0?.setBom)
                {
                    await
                    BomLine0.
                    setBom(relatedBom0);
                }
            
                const relatedBom1 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomLine1 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomLine1?.setBom)
                {
                    await
                    BomLine1.
                    setBom(relatedBom1);
                }
            
                const relatedBom2 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomLine2 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomLine2?.setBom)
                {
                    await
                    BomLine2.
                    setBom(relatedBom2);
                }
            
                const relatedBom3 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomLine3 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomLine3?.setBom)
                {
                    await
                    BomLine3.
                    setBom(relatedBom3);
                }
            
                const relatedBom4 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomLine4 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (BomLine4?.setBom)
                {
                    await
                    BomLine4.
                    setBom(relatedBom4);
                }
            
        }
        
    
        
            
            async function associateBomLineWithComponent_item() {
            
                const relatedComponent_item0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine0 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomLine0?.setComponent_item)
                {
                    await
                    BomLine0.
                    setComponent_item(relatedComponent_item0);
                }
            
                const relatedComponent_item1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine1 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomLine1?.setComponent_item)
                {
                    await
                    BomLine1.
                    setComponent_item(relatedComponent_item1);
                }
            
                const relatedComponent_item2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine2 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomLine2?.setComponent_item)
                {
                    await
                    BomLine2.
                    setComponent_item(relatedComponent_item2);
                }
            
                const relatedComponent_item3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine3 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomLine3?.setComponent_item)
                {
                    await
                    BomLine3.
                    setComponent_item(relatedComponent_item3);
                }
            
                const relatedComponent_item4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine4 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (BomLine4?.setComponent_item)
                {
                    await
                    BomLine4.
                    setComponent_item(relatedComponent_item4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BomLine4 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (BomLine4?.setOrganization)
                {
                    await
                    BomLine4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Supplier4 = await Suppliers.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Supplier4?.setOrganization)
                {
                    await
                    Supplier4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePurchaseOrderWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setSupplier)
                {
                    await
                    PurchaseOrder0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setSupplier)
                {
                    await
                    PurchaseOrder1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setSupplier)
                {
                    await
                    PurchaseOrder2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder3 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrder3?.setSupplier)
                {
                    await
                    PurchaseOrder3.
                    setSupplier(relatedSupplier3);
                }
            
                const relatedSupplier4 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder4 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (PurchaseOrder4?.setSupplier)
                {
                    await
                    PurchaseOrder4.
                    setSupplier(relatedSupplier4);
                }
            
        }
        
    
        
            
            async function associatePurchaseOrderWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setWarehouse)
                {
                    await
                    PurchaseOrder0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setWarehouse)
                {
                    await
                    PurchaseOrder1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setWarehouse)
                {
                    await
                    PurchaseOrder2.
                    setWarehouse(relatedWarehouse2);
                }
            
                const relatedWarehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const PurchaseOrder3 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrder3?.setWarehouse)
                {
                    await
                    PurchaseOrder3.
                    setWarehouse(relatedWarehouse3);
                }
            
                const relatedWarehouse4 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const PurchaseOrder4 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (PurchaseOrder4?.setWarehouse)
                {
                    await
                    PurchaseOrder4.
                    setWarehouse(relatedWarehouse4);
                }
            
        }
        
    
        
            
            async function associatePurchaseOrderWithRequested_by() {
            
                const relatedRequested_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setRequested_by)
                {
                    await
                    PurchaseOrder0.
                    setRequested_by(relatedRequested_by0);
                }
            
                const relatedRequested_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setRequested_by)
                {
                    await
                    PurchaseOrder1.
                    setRequested_by(relatedRequested_by1);
                }
            
                const relatedRequested_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setRequested_by)
                {
                    await
                    PurchaseOrder2.
                    setRequested_by(relatedRequested_by2);
                }
            
                const relatedRequested_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder3 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrder3?.setRequested_by)
                {
                    await
                    PurchaseOrder3.
                    setRequested_by(relatedRequested_by3);
                }
            
                const relatedRequested_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder4 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (PurchaseOrder4?.setRequested_by)
                {
                    await
                    PurchaseOrder4.
                    setRequested_by(relatedRequested_by4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePurchaseOrderWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setOrganization)
                {
                    await
                    PurchaseOrder0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setOrganization)
                {
                    await
                    PurchaseOrder1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setOrganization)
                {
                    await
                    PurchaseOrder2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrder3 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrder3?.setOrganization)
                {
                    await
                    PurchaseOrder3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrder4 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (PurchaseOrder4?.setOrganization)
                {
                    await
                    PurchaseOrder4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePurchaseOrderLineWithPurchase_order() {
            
                const relatedPurchase_order0 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrderLine0?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine0.
                    setPurchase_order(relatedPurchase_order0);
                }
            
                const relatedPurchase_order1 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrderLine1?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine1.
                    setPurchase_order(relatedPurchase_order1);
                }
            
                const relatedPurchase_order2 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrderLine2?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine2.
                    setPurchase_order(relatedPurchase_order2);
                }
            
                const relatedPurchase_order3 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine3 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrderLine3?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine3.
                    setPurchase_order(relatedPurchase_order3);
                }
            
                const relatedPurchase_order4 = await PurchaseOrders.findOne({
                    offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
                });
                const PurchaseOrderLine4 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (PurchaseOrderLine4?.setPurchase_order)
                {
                    await
                    PurchaseOrderLine4.
                    setPurchase_order(relatedPurchase_order4);
                }
            
        }
        
    
        
            
            async function associatePurchaseOrderLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrderLine0?.setItem)
                {
                    await
                    PurchaseOrderLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrderLine1?.setItem)
                {
                    await
                    PurchaseOrderLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrderLine2?.setItem)
                {
                    await
                    PurchaseOrderLine2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine3 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrderLine3?.setItem)
                {
                    await
                    PurchaseOrderLine3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const PurchaseOrderLine4 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (PurchaseOrderLine4?.setItem)
                {
                    await
                    PurchaseOrderLine4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePurchaseOrderLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrderLine0?.setOrganization)
                {
                    await
                    PurchaseOrderLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrderLine1?.setOrganization)
                {
                    await
                    PurchaseOrderLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrderLine2?.setOrganization)
                {
                    await
                    PurchaseOrderLine2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrderLine3 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrderLine3?.setOrganization)
                {
                    await
                    PurchaseOrderLine3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PurchaseOrderLine4 = await PurchaseOrderLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (PurchaseOrderLine4?.setOrganization)
                {
                    await
                    PurchaseOrderLine4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInventoryLotWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryLot0 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryLot0?.setItem)
                {
                    await
                    InventoryLot0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryLot1 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryLot1?.setItem)
                {
                    await
                    InventoryLot1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryLot2 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryLot2?.setItem)
                {
                    await
                    InventoryLot2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryLot3 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryLot3?.setItem)
                {
                    await
                    InventoryLot3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryLot4 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryLot4?.setItem)
                {
                    await
                    InventoryLot4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
            
            async function associateInventoryLotWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryLot0 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryLot0?.setWarehouse)
                {
                    await
                    InventoryLot0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryLot1 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryLot1?.setWarehouse)
                {
                    await
                    InventoryLot1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryLot2 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryLot2?.setWarehouse)
                {
                    await
                    InventoryLot2.
                    setWarehouse(relatedWarehouse2);
                }
            
                const relatedWarehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryLot3 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryLot3?.setWarehouse)
                {
                    await
                    InventoryLot3.
                    setWarehouse(relatedWarehouse3);
                }
            
                const relatedWarehouse4 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryLot4 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryLot4?.setWarehouse)
                {
                    await
                    InventoryLot4.
                    setWarehouse(relatedWarehouse4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInventoryLotWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryLot0 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryLot0?.setOrganization)
                {
                    await
                    InventoryLot0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryLot1 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryLot1?.setOrganization)
                {
                    await
                    InventoryLot1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryLot2 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryLot2?.setOrganization)
                {
                    await
                    InventoryLot2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryLot3 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryLot3?.setOrganization)
                {
                    await
                    InventoryLot3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryLot4 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryLot4?.setOrganization)
                {
                    await
                    InventoryLot4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInventoryTransactionWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setWarehouse)
                {
                    await
                    InventoryTransaction0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setWarehouse)
                {
                    await
                    InventoryTransaction1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setWarehouse)
                {
                    await
                    InventoryTransaction2.
                    setWarehouse(relatedWarehouse2);
                }
            
                const relatedWarehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setWarehouse)
                {
                    await
                    InventoryTransaction3.
                    setWarehouse(relatedWarehouse3);
                }
            
                const relatedWarehouse4 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryTransaction4 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryTransaction4?.setWarehouse)
                {
                    await
                    InventoryTransaction4.
                    setWarehouse(relatedWarehouse4);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setItem)
                {
                    await
                    InventoryTransaction0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setItem)
                {
                    await
                    InventoryTransaction1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setItem)
                {
                    await
                    InventoryTransaction2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setItem)
                {
                    await
                    InventoryTransaction3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction4 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryTransaction4?.setItem)
                {
                    await
                    InventoryTransaction4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithLot() {
            
                const relatedLot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setLot)
                {
                    await
                    InventoryTransaction0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setLot)
                {
                    await
                    InventoryTransaction1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setLot)
                {
                    await
                    InventoryTransaction2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setLot)
                {
                    await
                    InventoryTransaction3.
                    setLot(relatedLot3);
                }
            
                const relatedLot4 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction4 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryTransaction4?.setLot)
                {
                    await
                    InventoryTransaction4.
                    setLot(relatedLot4);
                }
            
        }
        
    
        
            
            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);
                }
            
                const relatedPerformed_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransaction4 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryTransaction4?.setPerformed_by)
                {
                    await
                    InventoryTransaction4.
                    setPerformed_by(relatedPerformed_by4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryTransaction4 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryTransaction4?.setOrganization)
                {
                    await
                    InventoryTransaction4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            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);
                }
            
                const relatedPlant4 = await Plants.findOne({
                    offset: Math.floor(Math.random() * (await Plants.count())),
                });
                const ProductionOrder4 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ProductionOrder4?.setPlant)
                {
                    await
                    ProductionOrder4.
                    setPlant(relatedPlant4);
                }
            
        }
        
    
        
            
            async function associateProductionOrderWithBom() {
            
                const relatedBom0 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setBom)
                {
                    await
                    ProductionOrder0.
                    setBom(relatedBom0);
                }
            
                const relatedBom1 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setBom)
                {
                    await
                    ProductionOrder1.
                    setBom(relatedBom1);
                }
            
                const relatedBom2 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setBom)
                {
                    await
                    ProductionOrder2.
                    setBom(relatedBom2);
                }
            
                const relatedBom3 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setBom)
                {
                    await
                    ProductionOrder3.
                    setBom(relatedBom3);
                }
            
                const relatedBom4 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const ProductionOrder4 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ProductionOrder4?.setBom)
                {
                    await
                    ProductionOrder4.
                    setBom(relatedBom4);
                }
            
        }
        
    
        
            
            async function associateProductionOrderWithWork_center() {
            
                const relatedWork_center0 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setWork_center)
                {
                    await
                    ProductionOrder0.
                    setWork_center(relatedWork_center0);
                }
            
                const relatedWork_center1 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setWork_center)
                {
                    await
                    ProductionOrder1.
                    setWork_center(relatedWork_center1);
                }
            
                const relatedWork_center2 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setWork_center)
                {
                    await
                    ProductionOrder2.
                    setWork_center(relatedWork_center2);
                }
            
                const relatedWork_center3 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setWork_center)
                {
                    await
                    ProductionOrder3.
                    setWork_center(relatedWork_center3);
                }
            
                const relatedWork_center4 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOrder4 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ProductionOrder4?.setWork_center)
                {
                    await
                    ProductionOrder4.
                    setWork_center(relatedWork_center4);
                }
            
        }
        
    
        
            
            async function associateProductionOrderWithPlanned_by() {
            
                const relatedPlanned_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setPlanned_by)
                {
                    await
                    ProductionOrder0.
                    setPlanned_by(relatedPlanned_by0);
                }
            
                const relatedPlanned_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setPlanned_by)
                {
                    await
                    ProductionOrder1.
                    setPlanned_by(relatedPlanned_by1);
                }
            
                const relatedPlanned_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setPlanned_by)
                {
                    await
                    ProductionOrder2.
                    setPlanned_by(relatedPlanned_by2);
                }
            
                const relatedPlanned_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setPlanned_by)
                {
                    await
                    ProductionOrder3.
                    setPlanned_by(relatedPlanned_by3);
                }
            
                const relatedPlanned_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder4 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ProductionOrder4?.setPlanned_by)
                {
                    await
                    ProductionOrder4.
                    setPlanned_by(relatedPlanned_by4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionOrder4 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ProductionOrder4?.setOrganization)
                {
                    await
                    ProductionOrder4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            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);
                }
            
                const relatedProduction_order4 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionOperation4 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ProductionOperation4?.setProduction_order)
                {
                    await
                    ProductionOperation4.
                    setProduction_order(relatedProduction_order4);
                }
            
        }
        
    
        
            
            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);
                }
            
                const relatedMachine4 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const ProductionOperation4 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ProductionOperation4?.setMachine)
                {
                    await
                    ProductionOperation4.
                    setMachine(relatedMachine4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProductionOperation4 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ProductionOperation4?.setOrganization)
                {
                    await
                    ProductionOperation4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            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);
                }
            
                const relatedProduction_order4 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const MaterialAllocation4 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MaterialAllocation4?.setProduction_order)
                {
                    await
                    MaterialAllocation4.
                    setProduction_order(relatedProduction_order4);
                }
            
        }
        
    
        
            
            async function associateMaterialAllocationWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialAllocation0 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialAllocation0?.setItem)
                {
                    await
                    MaterialAllocation0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialAllocation1 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialAllocation1?.setItem)
                {
                    await
                    MaterialAllocation1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialAllocation2 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialAllocation2?.setItem)
                {
                    await
                    MaterialAllocation2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialAllocation3 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialAllocation3?.setItem)
                {
                    await
                    MaterialAllocation3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialAllocation4 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MaterialAllocation4?.setItem)
                {
                    await
                    MaterialAllocation4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
            
            async function associateMaterialAllocationWithLot() {
            
                const relatedLot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const MaterialAllocation0 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialAllocation0?.setLot)
                {
                    await
                    MaterialAllocation0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const MaterialAllocation1 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialAllocation1?.setLot)
                {
                    await
                    MaterialAllocation1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const MaterialAllocation2 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialAllocation2?.setLot)
                {
                    await
                    MaterialAllocation2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const MaterialAllocation3 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MaterialAllocation3?.setLot)
                {
                    await
                    MaterialAllocation3.
                    setLot(relatedLot3);
                }
            
                const relatedLot4 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const MaterialAllocation4 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MaterialAllocation4?.setLot)
                {
                    await
                    MaterialAllocation4.
                    setLot(relatedLot4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MaterialAllocation4 = await MaterialAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MaterialAllocation4?.setOrganization)
                {
                    await
                    MaterialAllocation4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateQualityInspectionWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QualityInspection0 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QualityInspection0?.setItem)
                {
                    await
                    QualityInspection0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QualityInspection1 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QualityInspection1?.setItem)
                {
                    await
                    QualityInspection1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QualityInspection2 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QualityInspection2?.setItem)
                {
                    await
                    QualityInspection2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QualityInspection3 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QualityInspection3?.setItem)
                {
                    await
                    QualityInspection3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QualityInspection4 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (QualityInspection4?.setItem)
                {
                    await
                    QualityInspection4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
            
            async function associateQualityInspectionWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QualityInspection0 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QualityInspection0?.setProduction_order)
                {
                    await
                    QualityInspection0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QualityInspection1 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QualityInspection1?.setProduction_order)
                {
                    await
                    QualityInspection1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QualityInspection2 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QualityInspection2?.setProduction_order)
                {
                    await
                    QualityInspection2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QualityInspection3 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QualityInspection3?.setProduction_order)
                {
                    await
                    QualityInspection3.
                    setProduction_order(relatedProduction_order3);
                }
            
                const relatedProduction_order4 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QualityInspection4 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (QualityInspection4?.setProduction_order)
                {
                    await
                    QualityInspection4.
                    setProduction_order(relatedProduction_order4);
                }
            
        }
        
    
        
            
            async function associateQualityInspectionWithLot() {
            
                const relatedLot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QualityInspection0 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QualityInspection0?.setLot)
                {
                    await
                    QualityInspection0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QualityInspection1 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QualityInspection1?.setLot)
                {
                    await
                    QualityInspection1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QualityInspection2 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QualityInspection2?.setLot)
                {
                    await
                    QualityInspection2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QualityInspection3 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QualityInspection3?.setLot)
                {
                    await
                    QualityInspection3.
                    setLot(relatedLot3);
                }
            
                const relatedLot4 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QualityInspection4 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (QualityInspection4?.setLot)
                {
                    await
                    QualityInspection4.
                    setLot(relatedLot4);
                }
            
        }
        
    
        
            
            async function associateQualityInspectionWithInspected_by() {
            
                const relatedInspected_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QualityInspection0 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QualityInspection0?.setInspected_by)
                {
                    await
                    QualityInspection0.
                    setInspected_by(relatedInspected_by0);
                }
            
                const relatedInspected_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QualityInspection1 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QualityInspection1?.setInspected_by)
                {
                    await
                    QualityInspection1.
                    setInspected_by(relatedInspected_by1);
                }
            
                const relatedInspected_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QualityInspection2 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QualityInspection2?.setInspected_by)
                {
                    await
                    QualityInspection2.
                    setInspected_by(relatedInspected_by2);
                }
            
                const relatedInspected_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QualityInspection3 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QualityInspection3?.setInspected_by)
                {
                    await
                    QualityInspection3.
                    setInspected_by(relatedInspected_by3);
                }
            
                const relatedInspected_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QualityInspection4 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (QualityInspection4?.setInspected_by)
                {
                    await
                    QualityInspection4.
                    setInspected_by(relatedInspected_by4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateQualityInspectionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QualityInspection0 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QualityInspection0?.setOrganization)
                {
                    await
                    QualityInspection0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QualityInspection1 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QualityInspection1?.setOrganization)
                {
                    await
                    QualityInspection1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QualityInspection2 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QualityInspection2?.setOrganization)
                {
                    await
                    QualityInspection2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QualityInspection3 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QualityInspection3?.setOrganization)
                {
                    await
                    QualityInspection3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QualityInspection4 = await QualityInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (QualityInspection4?.setOrganization)
                {
                    await
                    QualityInspection4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateNonconformanceWithQuality_inspection() {
            
                const relatedQuality_inspection0 = await QualityInspections.findOne({
                    offset: Math.floor(Math.random() * (await QualityInspections.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setQuality_inspection)
                {
                    await
                    Nonconformance0.
                    setQuality_inspection(relatedQuality_inspection0);
                }
            
                const relatedQuality_inspection1 = await QualityInspections.findOne({
                    offset: Math.floor(Math.random() * (await QualityInspections.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setQuality_inspection)
                {
                    await
                    Nonconformance1.
                    setQuality_inspection(relatedQuality_inspection1);
                }
            
                const relatedQuality_inspection2 = await QualityInspections.findOne({
                    offset: Math.floor(Math.random() * (await QualityInspections.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setQuality_inspection)
                {
                    await
                    Nonconformance2.
                    setQuality_inspection(relatedQuality_inspection2);
                }
            
                const relatedQuality_inspection3 = await QualityInspections.findOne({
                    offset: Math.floor(Math.random() * (await QualityInspections.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setQuality_inspection)
                {
                    await
                    Nonconformance3.
                    setQuality_inspection(relatedQuality_inspection3);
                }
            
                const relatedQuality_inspection4 = await QualityInspections.findOne({
                    offset: Math.floor(Math.random() * (await QualityInspections.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setQuality_inspection)
                {
                    await
                    Nonconformance4.
                    setQuality_inspection(relatedQuality_inspection4);
                }
            
        }
        
    
        
            
            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);
                }
            
                const relatedReported_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setReported_by)
                {
                    await
                    Nonconformance4.
                    setReported_by(relatedReported_by4);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setItem)
                {
                    await
                    Nonconformance0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setItem)
                {
                    await
                    Nonconformance1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setItem)
                {
                    await
                    Nonconformance2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setItem)
                {
                    await
                    Nonconformance3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setItem)
                {
                    await
                    Nonconformance4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithLot() {
            
                const relatedLot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setLot)
                {
                    await
                    Nonconformance0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setLot)
                {
                    await
                    Nonconformance1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setLot)
                {
                    await
                    Nonconformance2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setLot)
                {
                    await
                    Nonconformance3.
                    setLot(relatedLot3);
                }
            
                const relatedLot4 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setLot)
                {
                    await
                    Nonconformance4.
                    setLot(relatedLot4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setOrganization)
                {
                    await
                    Nonconformance4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCapaActionWithNonconformance() {
            
                const relatedNonconformance0 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CapaAction0 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CapaAction0?.setNonconformance)
                {
                    await
                    CapaAction0.
                    setNonconformance(relatedNonconformance0);
                }
            
                const relatedNonconformance1 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CapaAction1 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CapaAction1?.setNonconformance)
                {
                    await
                    CapaAction1.
                    setNonconformance(relatedNonconformance1);
                }
            
                const relatedNonconformance2 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CapaAction2 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CapaAction2?.setNonconformance)
                {
                    await
                    CapaAction2.
                    setNonconformance(relatedNonconformance2);
                }
            
                const relatedNonconformance3 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CapaAction3 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CapaAction3?.setNonconformance)
                {
                    await
                    CapaAction3.
                    setNonconformance(relatedNonconformance3);
                }
            
                const relatedNonconformance4 = await Nonconformances.findOne({
                    offset: Math.floor(Math.random() * (await Nonconformances.count())),
                });
                const CapaAction4 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (CapaAction4?.setNonconformance)
                {
                    await
                    CapaAction4.
                    setNonconformance(relatedNonconformance4);
                }
            
        }
        
    
        
            
            async function associateCapaActionWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction0 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CapaAction0?.setOwner)
                {
                    await
                    CapaAction0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction1 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CapaAction1?.setOwner)
                {
                    await
                    CapaAction1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction2 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CapaAction2?.setOwner)
                {
                    await
                    CapaAction2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction3 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CapaAction3?.setOwner)
                {
                    await
                    CapaAction3.
                    setOwner(relatedOwner3);
                }
            
                const relatedOwner4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CapaAction4 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (CapaAction4?.setOwner)
                {
                    await
                    CapaAction4.
                    setOwner(relatedOwner4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCapaActionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CapaAction0 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CapaAction0?.setOrganization)
                {
                    await
                    CapaAction0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CapaAction1 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CapaAction1?.setOrganization)
                {
                    await
                    CapaAction1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CapaAction2 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CapaAction2?.setOrganization)
                {
                    await
                    CapaAction2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CapaAction3 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CapaAction3?.setOrganization)
                {
                    await
                    CapaAction3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CapaAction4 = await CapaActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (CapaAction4?.setOrganization)
                {
                    await
                    CapaAction4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAuditLogWithActor() {
            
                const relatedActor0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setActor)
                {
                    await
                    AuditLog0.
                    setActor(relatedActor0);
                }
            
                const relatedActor1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setActor)
                {
                    await
                    AuditLog1.
                    setActor(relatedActor1);
                }
            
                const relatedActor2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setActor)
                {
                    await
                    AuditLog2.
                    setActor(relatedActor2);
                }
            
                const relatedActor3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog3 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuditLog3?.setActor)
                {
                    await
                    AuditLog3.
                    setActor(relatedActor3);
                }
            
                const relatedActor4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog4 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (AuditLog4?.setActor)
                {
                    await
                    AuditLog4.
                    setActor(relatedActor4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAuditLogWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setOrganization)
                {
                    await
                    AuditLog0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setOrganization)
                {
                    await
                    AuditLog1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setOrganization)
                {
                    await
                    AuditLog2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog3 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuditLog3?.setOrganization)
                {
                    await
                    AuditLog3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog4 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (AuditLog4?.setOrganization)
                {
                    await
                    AuditLog4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Plants.bulkCreate(PlantsData);
                
            
            
                
                await Warehouses.bulkCreate(WarehousesData);
                
            
            
                
                await WorkCenters.bulkCreate(WorkCentersData);
                
            
            
                
                await Machines.bulkCreate(MachinesData);
                
            
            
                
                await MaintenanceWorkOrders.bulkCreate(MaintenanceWorkOrdersData);
                
            
            
                
                await DowntimeEvents.bulkCreate(DowntimeEventsData);
                
            
            
                
                await Items.bulkCreate(ItemsData);
                
            
            
                
                await ItemFiles.bulkCreate(ItemFilesData);
                
            
            
                
                await Boms.bulkCreate(BomsData);
                
            
            
                
                await BomLines.bulkCreate(BomLinesData);
                
            
            
                
                await Suppliers.bulkCreate(SuppliersData);
                
            
            
                
                await PurchaseOrders.bulkCreate(PurchaseOrdersData);
                
            
            
                
                await PurchaseOrderLines.bulkCreate(PurchaseOrderLinesData);
                
            
            
                
                await InventoryLots.bulkCreate(InventoryLotsData);
                
            
            
                
                await InventoryTransactions.bulkCreate(InventoryTransactionsData);
                
            
            
                
                await ProductionOrders.bulkCreate(ProductionOrdersData);
                
            
            
                
                await ProductionOperations.bulkCreate(ProductionOperationsData);
                
            
            
                
                await MaterialAllocations.bulkCreate(MaterialAllocationsData);
                
            
            
                
                await QualityInspections.bulkCreate(QualityInspectionsData);
                
            
            
                
                await Nonconformances.bulkCreate(NonconformancesData);
                
            
            
                
                await CapaActions.bulkCreate(CapaActionsData);
                
            
            
                
                await AuditLogs.bulkCreate(AuditLogsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePlantWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateWarehousWithPlant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWarehousWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateWorkCenterWithPlant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWorkCenterWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateMachineWithWork_center(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMachineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateMaintenanceWorkOrderWithMachine(),
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithReported_by(),
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithAssigned_to(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDowntimeEventWithMachine(),
                    
                
                    
                        
                        await associateDowntimeEventWithLogged_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDowntimeEventWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateItemFileWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateItemFileWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateBomWithParent_item(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateBomWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateBomLineWithBom(),
                    
                
                    
                        
                        await associateBomLineWithComponent_item(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateBomLineWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSupplierWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePurchaseOrderWithSupplier(),
                    
                
                    
                        
                        await associatePurchaseOrderWithWarehouse(),
                    
                
                    
                        
                        await associatePurchaseOrderWithRequested_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePurchaseOrderLineWithPurchase_order(),
                    
                
                    
                        
                        await associatePurchaseOrderLineWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInventoryLotWithItem(),
                    
                
                    
                        
                        await associateInventoryLotWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryLotWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInventoryTransactionWithWarehouse(),
                    
                
                    
                        
                        await associateInventoryTransactionWithItem(),
                    
                
                    
                        
                        await associateInventoryTransactionWithLot(),
                    
                
                    
                        
                        await associateInventoryTransactionWithPerformed_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryTransactionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateProductionOrderWithPlant(),
                    
                
                    
                        
                        await associateProductionOrderWithBom(),
                    
                
                    
                        
                        await associateProductionOrderWithWork_center(),
                    
                
                    
                        
                        await associateProductionOrderWithPlanned_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionOrderWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateProductionOperationWithProduction_order(),
                    
                
                    
                        
                        await associateProductionOperationWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionOperationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateMaterialAllocationWithProduction_order(),
                    
                
                    
                        
                        await associateMaterialAllocationWithItem(),
                    
                
                    
                        
                        await associateMaterialAllocationWithLot(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaterialAllocationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateQualityInspectionWithItem(),
                    
                
                    
                        
                        await associateQualityInspectionWithProduction_order(),
                    
                
                    
                        
                        await associateQualityInspectionWithLot(),
                    
                
                    
                        
                        await associateQualityInspectionWithInspected_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateQualityInspectionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateNonconformanceWithQuality_inspection(),
                    
                
                    
                        
                        await associateNonconformanceWithReported_by(),
                    
                
                    
                        
                        await associateNonconformanceWithItem(),
                    
                
                    
                        
                        await associateNonconformanceWithLot(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCapaActionWithNonconformance(),
                    
                
                    
                        
                        await associateCapaActionWithOwner(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCapaActionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateAuditLogWithActor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAuditLogWithOrganization(),
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('plants', null, {});
            
            
            await queryInterface.bulkDelete('warehouses', null, {});
            
            
            await queryInterface.bulkDelete('work_centers', null, {});
            
            
            await queryInterface.bulkDelete('machines', null, {});
            
            
            await queryInterface.bulkDelete('maintenance_work_orders', null, {});
            
            
            await queryInterface.bulkDelete('downtime_events', null, {});
            
            
            await queryInterface.bulkDelete('items', null, {});
            
            
            await queryInterface.bulkDelete('item_files', null, {});
            
            
            await queryInterface.bulkDelete('boms', null, {});
            
            
            await queryInterface.bulkDelete('bom_lines', null, {});
            
            
            await queryInterface.bulkDelete('suppliers', null, {});
            
            
            await queryInterface.bulkDelete('purchase_orders', null, {});
            
            
            await queryInterface.bulkDelete('purchase_order_lines', null, {});
            
            
            await queryInterface.bulkDelete('inventory_lots', null, {});
            
            
            await queryInterface.bulkDelete('inventory_transactions', null, {});
            
            
            await queryInterface.bulkDelete('production_orders', null, {});
            
            
            await queryInterface.bulkDelete('production_operations', null, {});
            
            
            await queryInterface.bulkDelete('material_allocations', null, {});
            
            
            await queryInterface.bulkDelete('quality_inspections', null, {});
            
            
            await queryInterface.bulkDelete('nonconformances', null, {});
            
            
            await queryInterface.bulkDelete('capa_actions', null, {});
            
            
            await queryInterface.bulkDelete('audit_logs', null, {});
            
        
    },
};