





















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






const WorkCenters = db.work_centers;

const Machines = db.machines;

const MaintenanceWorkOrders = db.maintenance_work_orders;

const Suppliers = db.suppliers;

const UnitsOfMeasure = db.units_of_measure;

const Materials = db.materials;

const Warehouses = db.warehouses;

const StorageLocations = db.storage_locations;

const InventoryLots = db.inventory_lots;

const InventoryBalances = db.inventory_balances;

const InventoryTransactions = db.inventory_transactions;

const Boms = db.boms;

const BomItems = db.bom_items;

const Routings = db.routings;

const RoutingSteps = db.routing_steps;

const ProductionOrders = db.production_orders;

const ProductionOperations = db.production_operations;

const ProductionMaterialIssues = db.production_material_issues;

const ProductionLots = db.production_lots;

const QaInspections = db.qa_inspections;

const QaChecklists = db.qa_checklists;

const QaChecklistItems = db.qa_checklist_items;

const QaMeasurements = db.qa_measurements;

const Nonconformances = db.nonconformances;

const Documents = db.documents;

const AuditEvents = db.audit_events;







const WorkCentersData = [
    
    {
    
        
        
            
                "code": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "location": "Marie Curie",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "code": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "location": "Ada Lovelace",
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "code": "Alan Turing",
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "location": "Grace Hopper",
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "code": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "location": "Alan Turing",
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
    },
    
];



const MachinesData = [
    
    {
    
        
        
            
                "asset_tag": "Alan Turing",
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "status": "retired",
            
        
    
        
        
            
                "manufacturer": "Ada Lovelace",
            
        
    
        
        
            
                "model": "Grace Hopper",
            
        
    
        
        
            
                "serial_number": "Marie Curie",
            
        
    
        
        
            
                "commissioned_on": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "asset_tag": "Alan Turing",
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "status": "retired",
            
        
    
        
        
            
                "manufacturer": "Marie Curie",
            
        
    
        
        
            
                "model": "Alan Turing",
            
        
    
        
        
            
                "serial_number": "Grace Hopper",
            
        
    
        
        
            
                "commissioned_on": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "asset_tag": "Grace Hopper",
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "status": "maintenance",
            
        
    
        
        
            
                "manufacturer": "Ada Lovelace",
            
        
    
        
        
            
                "model": "Ada Lovelace",
            
        
    
        
        
            
                "serial_number": "Alan Turing",
            
        
    
        
        
            
                "commissioned_on": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "asset_tag": "Marie Curie",
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "status": "maintenance",
            
        
    
        
        
            
                "manufacturer": "Marie Curie",
            
        
    
        
        
            
                "model": "Grace Hopper",
            
        
    
        
        
            
                "serial_number": "Marie Curie",
            
        
    
        
        
            
                "commissioned_on": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
];



const MaintenanceWorkOrdersData = [
    
    {
    
        
        
            
                "work_order_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "calibration",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "status": "scheduled",
            
        
    
        
        
            
                "requested_at": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "problem_description": "Marie Curie",
            
        
    
        
        
            
                "resolution_summary": "Marie Curie",
            
        
    
        
        
            
                "labor_hours": 5.87,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "inspection",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "requested_at": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "problem_description": "Grace Hopper",
            
        
    
        
        
            
                "resolution_summary": "Marie Curie",
            
        
    
        
        
            
                "labor_hours": 8.6,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "corrective",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "requested_at": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "problem_description": "Grace Hopper",
            
        
    
        
        
            
                "resolution_summary": "Grace Hopper",
            
        
    
        
        
            
                "labor_hours": 6.8,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "work_type": "preventive",
            
        
    
        
        
            
                "priority": "medium",
            
        
    
        
        
            
                "status": "scheduled",
            
        
    
        
        
            
                "requested_at": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "problem_description": "Marie Curie",
            
        
    
        
        
            
                "resolution_summary": "Ada Lovelace",
            
        
    
        
        
            
                "labor_hours": 2.37,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const SuppliersData = [
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "supplier_code": "Ada Lovelace",
            
        
    
        
        
            
                "contact_name": "Marie Curie",
            
        
    
        
        
            
                "email": "Grace Hopper",
            
        
    
        
        
            
                "phone": "Grace Hopper",
            
        
    
        
        
            
                "address": "Ada Lovelace",
            
        
    
        
        
            
                "approved": true,
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "supplier_code": "Marie Curie",
            
        
    
        
        
            
                "contact_name": "Marie Curie",
            
        
    
        
        
            
                "email": "Alan Turing",
            
        
    
        
        
            
                "phone": "Marie Curie",
            
        
    
        
        
            
                "address": "Marie Curie",
            
        
    
        
        
            
                "approved": false,
            
        
    
    },
    
    {
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "supplier_code": "Ada Lovelace",
            
        
    
        
        
            
                "contact_name": "Ada Lovelace",
            
        
    
        
        
            
                "email": "Alan Turing",
            
        
    
        
        
            
                "phone": "Marie Curie",
            
        
    
        
        
            
                "address": "Alan Turing",
            
        
    
        
        
            
                "approved": false,
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "supplier_code": "Ada Lovelace",
            
        
    
        
        
            
                "contact_name": "Ada Lovelace",
            
        
    
        
        
            
                "email": "Marie Curie",
            
        
    
        
        
            
                "phone": "Ada Lovelace",
            
        
    
        
        
            
                "address": "Grace Hopper",
            
        
    
        
        
            
                "approved": true,
            
        
    
    },
    
];



const UnitsOfMeasureData = [
    
    {
    
        
        
            
                "code": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "uom_type": "length",
            
        
    
    },
    
    {
    
        
        
            
                "code": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "uom_type": "area",
            
        
    
    },
    
    {
    
        
        
            
                "code": "Alan Turing",
            
        
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "uom_type": "length",
            
        
    
    },
    
    {
    
        
        
            
                "code": "Alan Turing",
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "uom_type": "volume",
            
        
    
    },
    
];



const MaterialsData = [
    
    {
    
        
        
            
                "material_code": "Marie Curie",
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "material_type": "finished_good",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "standard_cost": 8.37,
            
        
    
        
        
            
                "standard_lead_time_days": 4.24,
            
        
    
        
        
            
                "lot_tracked": false,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "reorder_point": 5.24,
            
        
    
        
        
            
                "reorder_quantity": 0.76,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "specification": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "material_code": "Marie Curie",
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "material_type": "raw",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "standard_cost": 1.28,
            
        
    
        
        
            
                "standard_lead_time_days": 9.24,
            
        
    
        
        
            
                "lot_tracked": false,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "reorder_point": 4.52,
            
        
    
        
        
            
                "reorder_quantity": 0.09,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "specification": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "material_code": "Grace Hopper",
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "material_type": "consumable",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "standard_cost": 9.78,
            
        
    
        
        
            
                "standard_lead_time_days": 1.06,
            
        
    
        
        
            
                "lot_tracked": false,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "reorder_point": 8.51,
            
        
    
        
        
            
                "reorder_quantity": 6.92,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "specification": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "material_code": "Alan Turing",
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "material_type": "consumable",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "standard_cost": 3.56,
            
        
    
        
        
            
                "standard_lead_time_days": 7.31,
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": false,
            
        
    
        
        
            
                "reorder_point": 8.98,
            
        
    
        
        
            
                "reorder_quantity": 3.86,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "specification": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const WarehousesData = [
    
    {
    
        
        
            
                "code": "Marie Curie",
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "address": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "code": "Grace Hopper",
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "address": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "code": "Alan Turing",
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "address": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "code": "Alan Turing",
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                "address": "Alan Turing",
            
        
    
    },
    
];



const StorageLocationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "code": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "location_type": "scrap",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "code": "Ada Lovelace",
            
        
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "location_type": "quarantine",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "code": "Grace Hopper",
            
        
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "location_type": "raw_storage",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "code": "Grace Hopper",
            
        
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
        
        
            
                "location_type": "shipping",
            
        
    
    },
    
];



const InventoryLotsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "Marie Curie",
            
        
    
        
        
            
                "supplier_lot_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_on": new Date(Date.now()),
            
        
    
        
        
            
                "manufactured_on": new Date(Date.now()),
            
        
    
        
        
            
                "expires_on": new Date(Date.now()),
            
        
    
        
        
            
                "lot_status": "released",
            
        
    
        
        
            
                "certificate_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "Grace Hopper",
            
        
    
        
        
            
                "supplier_lot_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_on": new Date(Date.now()),
            
        
    
        
        
            
                "manufactured_on": new Date(Date.now()),
            
        
    
        
        
            
                "expires_on": new Date(Date.now()),
            
        
    
        
        
            
                "lot_status": "quarantine",
            
        
    
        
        
            
                "certificate_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "Grace Hopper",
            
        
    
        
        
            
                "supplier_lot_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_on": new Date(Date.now()),
            
        
    
        
        
            
                "manufactured_on": new Date(Date.now()),
            
        
    
        
        
            
                "expires_on": new Date(Date.now()),
            
        
    
        
        
            
                "lot_status": "released",
            
        
    
        
        
            
                "certificate_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "Grace Hopper",
            
        
    
        
        
            
                "supplier_lot_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_on": new Date(Date.now()),
            
        
    
        
        
            
                "manufactured_on": new Date(Date.now()),
            
        
    
        
        
            
                "expires_on": new Date(Date.now()),
            
        
    
        
        
            
                "lot_status": "consumed",
            
        
    
        
        
            
                "certificate_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
];



const InventoryBalancesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 0.8,
            
        
    
        
        
            
                "quantity_reserved": 7.85,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 0.05,
            
        
    
        
        
            
                "quantity_reserved": 9.47,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 8.87,
            
        
    
        
        
            
                "quantity_reserved": 5.59,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 4.82,
            
        
    
        
        
            
                "quantity_reserved": 8.66,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
];



const InventoryTransactionsData = [
    
    {
    
        
        
            
                "transaction_number": "Marie Curie",
            
        
    
        
        
            
                "transaction_type": "adjustment",
            
        
    
        
        
            
                "transaction_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 9.25,
            
        
    
        
        
            
                "reference": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "transaction_number": "Ada Lovelace",
            
        
    
        
        
            
                "transaction_type": "issue_to_production",
            
        
    
        
        
            
                "transaction_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 4.72,
            
        
    
        
        
            
                "reference": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "transaction_number": "Alan Turing",
            
        
    
        
        
            
                "transaction_type": "receipt",
            
        
    
        
        
            
                "transaction_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1.47,
            
        
    
        
        
            
                "reference": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "transaction_number": "Ada Lovelace",
            
        
    
        
        
            
                "transaction_type": "scrap",
            
        
    
        
        
            
                "transaction_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 0.22,
            
        
    
        
        
            
                "reference": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reason": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const BomsData = [
    
    {
    
        
        
            
                "bom_code": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "effective_from": new Date(Date.now()),
            
        
    
        
        
            
                "effective_to": new Date(Date.now()),
            
        
    
        
        
            
                "revision": "Alan Turing",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "bom_code": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "effective_from": new Date(Date.now()),
            
        
    
        
        
            
                "effective_to": new Date(Date.now()),
            
        
    
        
        
            
                "revision": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "bom_code": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "effective_from": new Date(Date.now()),
            
        
    
        
        
            
                "effective_to": new Date(Date.now()),
            
        
    
        
        
            
                "revision": "Marie Curie",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "bom_code": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "obsolete",
            
        
    
        
        
            
                "effective_from": new Date(Date.now()),
            
        
    
        
        
            
                "effective_to": new Date(Date.now()),
            
        
    
        
        
            
                "revision": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const BomItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 9.5,
            
        
    
        
        
            
                "scrap_factor": 6.73,
            
        
    
        
        
            
                "reference_designator": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 3.06,
            
        
    
        
        
            
                "scrap_factor": 4.91,
            
        
    
        
        
            
                "reference_designator": "Alan Turing",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 5.97,
            
        
    
        
        
            
                "scrap_factor": 0.43,
            
        
    
        
        
            
                "reference_designator": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 0.03,
            
        
    
        
        
            
                "scrap_factor": 7.15,
            
        
    
        
        
            
                "reference_designator": "Alan Turing",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const RoutingsData = [
    
    {
    
        
        
            
                "routing_code": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "revision": "Marie Curie",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "routing_code": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "revision": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "routing_code": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "revision": "Marie Curie",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "routing_code": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "revision": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
];



const RoutingStepsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_number": 9,
            
        
    
        
        
            
                "step_name": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_time_minutes": 4.11,
            
        
    
        
        
            
                "run_time_minutes": 0.26,
            
        
    
        
        
            
                "work_instructions": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_number": 8,
            
        
    
        
        
            
                "step_name": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_time_minutes": 0.92,
            
        
    
        
        
            
                "run_time_minutes": 0.36,
            
        
    
        
        
            
                "work_instructions": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_number": 2,
            
        
    
        
        
            
                "step_name": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_time_minutes": 0.57,
            
        
    
        
        
            
                "run_time_minutes": 4.13,
            
        
    
        
        
            
                "work_instructions": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_number": 1,
            
        
    
        
        
            
                "step_name": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_time_minutes": 2.84,
            
        
    
        
        
            
                "run_time_minutes": 5.55,
            
        
    
        
        
            
                "work_instructions": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ProductionOrdersData = [
    
    {
    
        
        
            
                "order_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "planned_quantity": 6.76,
            
        
    
        
        
            
                "completed_quantity": 7.73,
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                "planned_start": new Date(Date.now()),
            
        
    
        
        
            
                "planned_end": new Date(Date.now()),
            
        
    
        
        
            
                "actual_start": new Date(Date.now()),
            
        
    
        
        
            
                "actual_end": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_reference": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "order_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "planned_quantity": 3.82,
            
        
    
        
        
            
                "completed_quantity": 5.86,
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "planned_start": new Date(Date.now()),
            
        
    
        
        
            
                "planned_end": new Date(Date.now()),
            
        
    
        
        
            
                "actual_start": new Date(Date.now()),
            
        
    
        
        
            
                "actual_end": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_reference": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "order_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "planned_quantity": 7.14,
            
        
    
        
        
            
                "completed_quantity": 3.68,
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "planned_start": new Date(Date.now()),
            
        
    
        
        
            
                "planned_end": new Date(Date.now()),
            
        
    
        
        
            
                "actual_start": new Date(Date.now()),
            
        
    
        
        
            
                "actual_end": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_reference": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "order_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "planned_quantity": 3.67,
            
        
    
        
        
            
                "completed_quantity": 0.47,
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "planned_start": new Date(Date.now()),
            
        
    
        
        
            
                "planned_end": new Date(Date.now()),
            
        
    
        
        
            
                "actual_start": new Date(Date.now()),
            
        
    
        
        
            
                "actual_end": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_reference": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const ProductionOperationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 3,
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "planned_start": new Date(Date.now()),
            
        
    
        
        
            
                "planned_end": new Date(Date.now()),
            
        
    
        
        
            
                "actual_start": new Date(Date.now()),
            
        
    
        
        
            
                "actual_end": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 0.88,
            
        
    
        
        
            
                "scrap_quantity": 5.76,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 9,
            
        
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "not_started",
            
        
    
        
        
            
                "planned_start": new Date(Date.now()),
            
        
    
        
        
            
                "planned_end": new Date(Date.now()),
            
        
    
        
        
            
                "actual_start": new Date(Date.now()),
            
        
    
        
        
            
                "actual_end": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 0.25,
            
        
    
        
        
            
                "scrap_quantity": 8.12,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 3,
            
        
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "not_started",
            
        
    
        
        
            
                "planned_start": new Date(Date.now()),
            
        
    
        
        
            
                "planned_end": new Date(Date.now()),
            
        
    
        
        
            
                "actual_start": new Date(Date.now()),
            
        
    
        
        
            
                "actual_end": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 2.6,
            
        
    
        
        
            
                "scrap_quantity": 4.9,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_number": 1,
            
        
    
        
        
            
                "name": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "planned_start": new Date(Date.now()),
            
        
    
        
        
            
                "planned_end": new Date(Date.now()),
            
        
    
        
        
            
                "actual_start": new Date(Date.now()),
            
        
    
        
        
            
                "actual_end": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 5.85,
            
        
    
        
        
            
                "scrap_quantity": 6.24,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const ProductionMaterialIssuesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_issued": 5.39,
            
        
    
        
        
            
                "issued_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_issued": 1.8,
            
        
    
        
        
            
                "issued_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_issued": 8.76,
            
        
    
        
        
            
                "issued_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_issued": 1.11,
            
        
    
        
        
            
                "issued_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
];



const ProductionLotsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "Ada Lovelace",
            
        
    
        
        
            
                "started_on": new Date(Date.now()),
            
        
    
        
        
            
                "completed_on": new Date(Date.now()),
            
        
    
        
        
            
                "quantity_produced": 4.52,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "release_status": "scrapped",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "Alan Turing",
            
        
    
        
        
            
                "started_on": new Date(Date.now()),
            
        
    
        
        
            
                "completed_on": new Date(Date.now()),
            
        
    
        
        
            
                "quantity_produced": 2.11,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "release_status": "quarantine",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "Grace Hopper",
            
        
    
        
        
            
                "started_on": new Date(Date.now()),
            
        
    
        
        
            
                "completed_on": new Date(Date.now()),
            
        
    
        
        
            
                "quantity_produced": 1.85,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "release_status": "scrapped",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_number": "Ada Lovelace",
            
        
    
        
        
            
                "started_on": new Date(Date.now()),
            
        
    
        
        
            
                "completed_on": new Date(Date.now()),
            
        
    
        
        
            
                "quantity_produced": 6.23,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "release_status": "scrapped",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const QaInspectionsData = [
    
    {
    
        
        
            
                "inspection_number": "Alan Turing",
            
        
    
        
        
            
                "inspection_type": "in_process",
            
        
    
        
        
            
                "status": "planned",
            
        
    
        
        
            
                "scheduled_at": new Date(Date.now()),
            
        
    
        
        
            
                "performed_at": new Date(Date.now()),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "result": "pass",
            
        
    
        
        
            
                "summary": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "Marie Curie",
            
        
    
        
        
            
                "inspection_type": "final",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "scheduled_at": new Date(Date.now()),
            
        
    
        
        
            
                "performed_at": new Date(Date.now()),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "result": "pass",
            
        
    
        
        
            
                "summary": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "Alan Turing",
            
        
    
        
        
            
                "inspection_type": "audit",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "scheduled_at": new Date(Date.now()),
            
        
    
        
        
            
                "performed_at": new Date(Date.now()),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "result": "fail",
            
        
    
        
        
            
                "summary": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "Alan Turing",
            
        
    
        
        
            
                "inspection_type": "audit",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "scheduled_at": new Date(Date.now()),
            
        
    
        
        
            
                "performed_at": new Date(Date.now()),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "result": "fail",
            
        
    
        
        
            
                "summary": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const QaChecklistsData = [
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "checklist_type": "audit",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "checklist_type": "final",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
        
        
            
                "checklist_type": "incoming",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
        
        
            
                "checklist_type": "in_process",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
    },
    
];



const QaChecklistItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_number": 8,
            
        
    
        
        
            
                "check_name": "Alan Turing",
            
        
    
        
        
            
                "value_type": "pass_fail",
            
        
    
        
        
            
                "lower_limit": 1.11,
            
        
    
        
        
            
                "upper_limit": 3.23,
            
        
    
        
        
            
                "instructions": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_number": 1,
            
        
    
        
        
            
                "check_name": "Grace Hopper",
            
        
    
        
        
            
                "value_type": "numeric",
            
        
    
        
        
            
                "lower_limit": 8.88,
            
        
    
        
        
            
                "upper_limit": 1.69,
            
        
    
        
        
            
                "instructions": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_number": 7,
            
        
    
        
        
            
                "check_name": "Ada Lovelace",
            
        
    
        
        
            
                "value_type": "pass_fail",
            
        
    
        
        
            
                "lower_limit": 4.48,
            
        
    
        
        
            
                "upper_limit": 9.15,
            
        
    
        
        
            
                "instructions": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_number": 4,
            
        
    
        
        
            
                "check_name": "Grace Hopper",
            
        
    
        
        
            
                "value_type": "pass_fail",
            
        
    
        
        
            
                "lower_limit": 4.6,
            
        
    
        
        
            
                "upper_limit": 1.95,
            
        
    
        
        
            
                "instructions": "Alan Turing",
            
        
    
    },
    
];



const QaMeasurementsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "pass",
            
        
    
        
        
            
                "numeric_value": 4.85,
            
        
    
        
        
            
                "text_value": "Grace Hopper",
            
        
    
        
        
            
                "recorded_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "fail",
            
        
    
        
        
            
                "numeric_value": 0.77,
            
        
    
        
        
            
                "text_value": "Marie Curie",
            
        
    
        
        
            
                "recorded_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "fail",
            
        
    
        
        
            
                "numeric_value": 3.33,
            
        
    
        
        
            
                "text_value": "Alan Turing",
            
        
    
        
        
            
                "recorded_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "pass",
            
        
    
        
        
            
                "numeric_value": 7.18,
            
        
    
        
        
            
                "text_value": "Ada Lovelace",
            
        
    
        
        
            
                "recorded_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const NonconformancesData = [
    
    {
    
        
        
            
                "ncr_number": "Marie Curie",
            
        
    
        
        
            
                "source": "incoming",
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "problem_statement": "Marie Curie",
            
        
    
        
        
            
                "containment_action": "Grace Hopper",
            
        
    
        
        
            
                "root_cause": "Ada Lovelace",
            
        
    
        
        
            
                "corrective_action": "Marie Curie",
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "Ada Lovelace",
            
        
    
        
        
            
                "source": "customer",
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "status": "investigating",
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "problem_statement": "Grace Hopper",
            
        
    
        
        
            
                "containment_action": "Ada Lovelace",
            
        
    
        
        
            
                "root_cause": "Alan Turing",
            
        
    
        
        
            
                "corrective_action": "Marie Curie",
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "Ada Lovelace",
            
        
    
        
        
            
                "source": "audit",
            
        
    
        
        
            
                "severity": "major",
            
        
    
        
        
            
                "status": "contained",
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "problem_statement": "Alan Turing",
            
        
    
        
        
            
                "containment_action": "Alan Turing",
            
        
    
        
        
            
                "root_cause": "Ada Lovelace",
            
        
    
        
        
            
                "corrective_action": "Grace Hopper",
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "Grace Hopper",
            
        
    
        
        
            
                "source": "customer",
            
        
    
        
        
            
                "severity": "minor",
            
        
    
        
        
            
                "status": "void",
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "problem_statement": "Ada Lovelace",
            
        
    
        
        
            
                "containment_action": "Marie Curie",
            
        
    
        
        
            
                "root_cause": "Ada Lovelace",
            
        
    
        
        
            
                "corrective_action": "Marie Curie",
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const DocumentsData = [
    
    {
    
        
        
            
                "document_number": "Grace Hopper",
            
        
    
        
        
            
                "title": "Alan Turing",
            
        
    
        
        
            
                "document_type": "certificate",
            
        
    
        
        
            
                "revision": "Alan Turing",
            
        
    
        
        
            
                "status": "effective",
            
        
    
        
        
            
                "effective_from": new Date(Date.now()),
            
        
    
        
        
            
                "effective_to": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "summary": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "document_number": "Marie Curie",
            
        
    
        
        
            
                "title": "Marie Curie",
            
        
    
        
        
            
                "document_type": "work_instruction",
            
        
    
        
        
            
                "revision": "Marie Curie",
            
        
    
        
        
            
                "status": "effective",
            
        
    
        
        
            
                "effective_from": new Date(Date.now()),
            
        
    
        
        
            
                "effective_to": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "summary": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "document_number": "Marie Curie",
            
        
    
        
        
            
                "title": "Ada Lovelace",
            
        
    
        
        
            
                "document_type": "work_instruction",
            
        
    
        
        
            
                "revision": "Grace Hopper",
            
        
    
        
        
            
                "status": "obsolete",
            
        
    
        
        
            
                "effective_from": new Date(Date.now()),
            
        
    
        
        
            
                "effective_to": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "summary": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "document_number": "Alan Turing",
            
        
    
        
        
            
                "title": "Ada Lovelace",
            
        
    
        
        
            
                "document_type": "other",
            
        
    
        
        
            
                "revision": "Alan Turing",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "effective_from": new Date(Date.now()),
            
        
    
        
        
            
                "effective_to": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "summary": "Alan Turing",
            
        
    
    },
    
];



const AuditEventsData = [
    
    {
    
        
        
            
                "event_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_name": "Marie Curie",
            
        
    
        
        
            
                "record_reference": "Marie Curie",
            
        
    
        
        
            
                "action": "update",
            
        
    
        
        
            
                "details": "Marie Curie",
            
        
    
        
        
            
                "ip_address": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "event_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_name": "Alan Turing",
            
        
    
        
        
            
                "record_reference": "Alan Turing",
            
        
    
        
        
            
                "action": "reject",
            
        
    
        
        
            
                "details": "Alan Turing",
            
        
    
        
        
            
                "ip_address": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "event_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_name": "Ada Lovelace",
            
        
    
        
        
            
                "record_reference": "Alan Turing",
            
        
    
        
        
            
                "action": "status_change",
            
        
    
        
        
            
                "details": "Grace Hopper",
            
        
    
        
        
            
                "ip_address": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "event_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_name": "Alan Turing",
            
        
    
        
        
            
                "record_reference": "Grace Hopper",
            
        
    
        
        
            
                "action": "approve",
            
        
    
        
        
            
                "details": "Grace Hopper",
            
        
    
        
        
            
                "ip_address": "Marie Curie",
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
    
    
        
    
        
    
        
    
        
    

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

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

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateMaterialWithUom() {
            
                const relatedUom0 = await UnitsOfMeasure.findOne({
                    offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
                });
                const Material0 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Material0?.setUom)
                {
                    await
                    Material0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await UnitsOfMeasure.findOne({
                    offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
                });
                const Material1 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Material1?.setUom)
                {
                    await
                    Material1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await UnitsOfMeasure.findOne({
                    offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
                });
                const Material2 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Material2?.setUom)
                {
                    await
                    Material2.
                    setUom(relatedUom2);
                }
            
                const relatedUom3 = await UnitsOfMeasure.findOne({
                    offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
                });
                const Material3 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Material3?.setUom)
                {
                    await
                    Material3.
                    setUom(relatedUom3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateMaterialWithPreferred_supplier() {
            
                const relatedPreferred_supplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Material0 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Material0?.setPreferred_supplier)
                {
                    await
                    Material0.
                    setPreferred_supplier(relatedPreferred_supplier0);
                }
            
                const relatedPreferred_supplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Material1 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Material1?.setPreferred_supplier)
                {
                    await
                    Material1.
                    setPreferred_supplier(relatedPreferred_supplier1);
                }
            
                const relatedPreferred_supplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Material2 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Material2?.setPreferred_supplier)
                {
                    await
                    Material2.
                    setPreferred_supplier(relatedPreferred_supplier2);
                }
            
                const relatedPreferred_supplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Material3 = await Materials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Material3?.setPreferred_supplier)
                {
                    await
                    Material3.
                    setPreferred_supplier(relatedPreferred_supplier3);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateStorageLocationWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const StorageLocation0 = await StorageLocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StorageLocation0?.setWarehouse)
                {
                    await
                    StorageLocation0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const StorageLocation1 = await StorageLocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StorageLocation1?.setWarehouse)
                {
                    await
                    StorageLocation1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const StorageLocation2 = await StorageLocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StorageLocation2?.setWarehouse)
                {
                    await
                    StorageLocation2.
                    setWarehouse(relatedWarehouse2);
                }
            
                const relatedWarehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const StorageLocation3 = await StorageLocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (StorageLocation3?.setWarehouse)
                {
                    await
                    StorageLocation3.
                    setWarehouse(relatedWarehouse3);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateInventoryLotWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryLot0 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryLot0?.setMaterial)
                {
                    await
                    InventoryLot0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryLot1 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryLot1?.setMaterial)
                {
                    await
                    InventoryLot1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryLot2 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryLot2?.setMaterial)
                {
                    await
                    InventoryLot2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryLot3 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryLot3?.setMaterial)
                {
                    await
                    InventoryLot3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateInventoryLotWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryLot0 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryLot0?.setSupplier)
                {
                    await
                    InventoryLot0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryLot1 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryLot1?.setSupplier)
                {
                    await
                    InventoryLot1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryLot2 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryLot2?.setSupplier)
                {
                    await
                    InventoryLot2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryLot3 = await InventoryLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryLot3?.setSupplier)
                {
                    await
                    InventoryLot3.
                    setSupplier(relatedSupplier3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateInventoryBalanceWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setMaterial)
                {
                    await
                    InventoryBalance0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setMaterial)
                {
                    await
                    InventoryBalance1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setMaterial)
                {
                    await
                    InventoryBalance2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setMaterial)
                {
                    await
                    InventoryBalance3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateInventoryBalanceWithLocation() {
            
                const relatedLocation0 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setLocation)
                {
                    await
                    InventoryBalance0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setLocation)
                {
                    await
                    InventoryBalance1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setLocation)
                {
                    await
                    InventoryBalance2.
                    setLocation(relatedLocation2);
                }
            
                const relatedLocation3 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setLocation)
                {
                    await
                    InventoryBalance3.
                    setLocation(relatedLocation3);
                }
            
        }
        
    
        
            
            async function associateInventoryBalanceWithInventory_lot() {
            
                const relatedInventory_lot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setInventory_lot)
                {
                    await
                    InventoryBalance0.
                    setInventory_lot(relatedInventory_lot0);
                }
            
                const relatedInventory_lot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setInventory_lot)
                {
                    await
                    InventoryBalance1.
                    setInventory_lot(relatedInventory_lot1);
                }
            
                const relatedInventory_lot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setInventory_lot)
                {
                    await
                    InventoryBalance2.
                    setInventory_lot(relatedInventory_lot2);
                }
            
                const relatedInventory_lot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setInventory_lot)
                {
                    await
                    InventoryBalance3.
                    setInventory_lot(relatedInventory_lot3);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateInventoryTransactionWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setMaterial)
                {
                    await
                    InventoryTransaction0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setMaterial)
                {
                    await
                    InventoryTransaction1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setMaterial)
                {
                    await
                    InventoryTransaction2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setMaterial)
                {
                    await
                    InventoryTransaction3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithInventory_lot() {
            
                const relatedInventory_lot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setInventory_lot)
                {
                    await
                    InventoryTransaction0.
                    setInventory_lot(relatedInventory_lot0);
                }
            
                const relatedInventory_lot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setInventory_lot)
                {
                    await
                    InventoryTransaction1.
                    setInventory_lot(relatedInventory_lot1);
                }
            
                const relatedInventory_lot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setInventory_lot)
                {
                    await
                    InventoryTransaction2.
                    setInventory_lot(relatedInventory_lot2);
                }
            
                const relatedInventory_lot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setInventory_lot)
                {
                    await
                    InventoryTransaction3.
                    setInventory_lot(relatedInventory_lot3);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithFrom_location() {
            
                const relatedFrom_location0 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setFrom_location)
                {
                    await
                    InventoryTransaction0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setFrom_location)
                {
                    await
                    InventoryTransaction1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setFrom_location)
                {
                    await
                    InventoryTransaction2.
                    setFrom_location(relatedFrom_location2);
                }
            
                const relatedFrom_location3 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setFrom_location)
                {
                    await
                    InventoryTransaction3.
                    setFrom_location(relatedFrom_location3);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithTo_location() {
            
                const relatedTo_location0 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setTo_location)
                {
                    await
                    InventoryTransaction0.
                    setTo_location(relatedTo_location0);
                }
            
                const relatedTo_location1 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setTo_location)
                {
                    await
                    InventoryTransaction1.
                    setTo_location(relatedTo_location1);
                }
            
                const relatedTo_location2 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setTo_location)
                {
                    await
                    InventoryTransaction2.
                    setTo_location(relatedTo_location2);
                }
            
                const relatedTo_location3 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setTo_location)
                {
                    await
                    InventoryTransaction3.
                    setTo_location(relatedTo_location3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateInventoryTransactionWithPerformed_by() {
            
                const relatedPerformed_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setPerformed_by)
                {
                    await
                    InventoryTransaction0.
                    setPerformed_by(relatedPerformed_by0);
                }
            
                const relatedPerformed_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setPerformed_by)
                {
                    await
                    InventoryTransaction1.
                    setPerformed_by(relatedPerformed_by1);
                }
            
                const relatedPerformed_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setPerformed_by)
                {
                    await
                    InventoryTransaction2.
                    setPerformed_by(relatedPerformed_by2);
                }
            
                const relatedPerformed_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryTransaction3 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryTransaction3?.setPerformed_by)
                {
                    await
                    InventoryTransaction3.
                    setPerformed_by(relatedPerformed_by3);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateBomWithParent_material() {
            
                const relatedParent_material0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Bom0 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Bom0?.setParent_material)
                {
                    await
                    Bom0.
                    setParent_material(relatedParent_material0);
                }
            
                const relatedParent_material1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Bom1 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Bom1?.setParent_material)
                {
                    await
                    Bom1.
                    setParent_material(relatedParent_material1);
                }
            
                const relatedParent_material2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Bom2 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Bom2?.setParent_material)
                {
                    await
                    Bom2.
                    setParent_material(relatedParent_material2);
                }
            
                const relatedParent_material3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Bom3 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Bom3?.setParent_material)
                {
                    await
                    Bom3.
                    setParent_material(relatedParent_material3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateBomItemWithBom() {
            
                const relatedBom0 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomItem0 = await BomItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomItem0?.setBom)
                {
                    await
                    BomItem0.
                    setBom(relatedBom0);
                }
            
                const relatedBom1 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomItem1 = await BomItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomItem1?.setBom)
                {
                    await
                    BomItem1.
                    setBom(relatedBom1);
                }
            
                const relatedBom2 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomItem2 = await BomItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomItem2?.setBom)
                {
                    await
                    BomItem2.
                    setBom(relatedBom2);
                }
            
                const relatedBom3 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomItem3 = await BomItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomItem3?.setBom)
                {
                    await
                    BomItem3.
                    setBom(relatedBom3);
                }
            
        }
        
    
        
            
            async function associateBomItemWithComponent_material() {
            
                const relatedComponent_material0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomItem0 = await BomItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomItem0?.setComponent_material)
                {
                    await
                    BomItem0.
                    setComponent_material(relatedComponent_material0);
                }
            
                const relatedComponent_material1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomItem1 = await BomItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomItem1?.setComponent_material)
                {
                    await
                    BomItem1.
                    setComponent_material(relatedComponent_material1);
                }
            
                const relatedComponent_material2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomItem2 = await BomItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomItem2?.setComponent_material)
                {
                    await
                    BomItem2.
                    setComponent_material(relatedComponent_material2);
                }
            
                const relatedComponent_material3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const BomItem3 = await BomItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BomItem3?.setComponent_material)
                {
                    await
                    BomItem3.
                    setComponent_material(relatedComponent_material3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

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

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

    
    
    
        
    
        
            
            async function associateProductionOrderWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setMaterial)
                {
                    await
                    ProductionOrder0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setMaterial)
                {
                    await
                    ProductionOrder1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setMaterial)
                {
                    await
                    ProductionOrder2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setMaterial)
                {
                    await
                    ProductionOrder3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateProductionOrderWithBom() {
            
                const relatedBom0 = await 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);
                }
            
        }
        
    
        
            
            async function associateProductionOrderWithRouting() {
            
                const relatedRouting0 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setRouting)
                {
                    await
                    ProductionOrder0.
                    setRouting(relatedRouting0);
                }
            
                const relatedRouting1 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setRouting)
                {
                    await
                    ProductionOrder1.
                    setRouting(relatedRouting1);
                }
            
                const relatedRouting2 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setRouting)
                {
                    await
                    ProductionOrder2.
                    setRouting(relatedRouting2);
                }
            
                const relatedRouting3 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setRouting)
                {
                    await
                    ProductionOrder3.
                    setRouting(relatedRouting3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductionOrderWithPlanner() {
            
                const relatedPlanner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder0 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOrder0?.setPlanner)
                {
                    await
                    ProductionOrder0.
                    setPlanner(relatedPlanner0);
                }
            
                const relatedPlanner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder1 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOrder1?.setPlanner)
                {
                    await
                    ProductionOrder1.
                    setPlanner(relatedPlanner1);
                }
            
                const relatedPlanner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder2 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOrder2?.setPlanner)
                {
                    await
                    ProductionOrder2.
                    setPlanner(relatedPlanner2);
                }
            
                const relatedPlanner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOrder3 = await ProductionOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOrder3?.setPlanner)
                {
                    await
                    ProductionOrder3.
                    setPlanner(relatedPlanner3);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateProductionOperationWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionOperation0 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOperation0?.setProduction_order)
                {
                    await
                    ProductionOperation0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionOperation1 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOperation1?.setProduction_order)
                {
                    await
                    ProductionOperation1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionOperation2 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOperation2?.setProduction_order)
                {
                    await
                    ProductionOperation2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionOperation3 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOperation3?.setProduction_order)
                {
                    await
                    ProductionOperation3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateProductionOperationWithWork_center() {
            
                const relatedWork_center0 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOperation0 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOperation0?.setWork_center)
                {
                    await
                    ProductionOperation0.
                    setWork_center(relatedWork_center0);
                }
            
                const relatedWork_center1 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOperation1 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOperation1?.setWork_center)
                {
                    await
                    ProductionOperation1.
                    setWork_center(relatedWork_center1);
                }
            
                const relatedWork_center2 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOperation2 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOperation2?.setWork_center)
                {
                    await
                    ProductionOperation2.
                    setWork_center(relatedWork_center2);
                }
            
                const relatedWork_center3 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionOperation3 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOperation3?.setWork_center)
                {
                    await
                    ProductionOperation3.
                    setWork_center(relatedWork_center3);
                }
            
        }
        
    
        
            
            async function associateProductionOperationWithMachine() {
            
                const relatedMachine0 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const ProductionOperation0 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOperation0?.setMachine)
                {
                    await
                    ProductionOperation0.
                    setMachine(relatedMachine0);
                }
            
                const relatedMachine1 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const ProductionOperation1 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOperation1?.setMachine)
                {
                    await
                    ProductionOperation1.
                    setMachine(relatedMachine1);
                }
            
                const relatedMachine2 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const ProductionOperation2 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOperation2?.setMachine)
                {
                    await
                    ProductionOperation2.
                    setMachine(relatedMachine2);
                }
            
                const relatedMachine3 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const ProductionOperation3 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOperation3?.setMachine)
                {
                    await
                    ProductionOperation3.
                    setMachine(relatedMachine3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductionOperationWithOperator() {
            
                const relatedOperator0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOperation0 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionOperation0?.setOperator)
                {
                    await
                    ProductionOperation0.
                    setOperator(relatedOperator0);
                }
            
                const relatedOperator1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOperation1 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionOperation1?.setOperator)
                {
                    await
                    ProductionOperation1.
                    setOperator(relatedOperator1);
                }
            
                const relatedOperator2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOperation2 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionOperation2?.setOperator)
                {
                    await
                    ProductionOperation2.
                    setOperator(relatedOperator2);
                }
            
                const relatedOperator3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionOperation3 = await ProductionOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionOperation3?.setOperator)
                {
                    await
                    ProductionOperation3.
                    setOperator(relatedOperator3);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateProductionMaterialIssueWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionMaterialIssue0 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionMaterialIssue0?.setProduction_order)
                {
                    await
                    ProductionMaterialIssue0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionMaterialIssue1 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionMaterialIssue1?.setProduction_order)
                {
                    await
                    ProductionMaterialIssue1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionMaterialIssue2 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionMaterialIssue2?.setProduction_order)
                {
                    await
                    ProductionMaterialIssue2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionMaterialIssue3 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionMaterialIssue3?.setProduction_order)
                {
                    await
                    ProductionMaterialIssue3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
            
            async function associateProductionMaterialIssueWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionMaterialIssue0 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionMaterialIssue0?.setMaterial)
                {
                    await
                    ProductionMaterialIssue0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionMaterialIssue1 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionMaterialIssue1?.setMaterial)
                {
                    await
                    ProductionMaterialIssue1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionMaterialIssue2 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionMaterialIssue2?.setMaterial)
                {
                    await
                    ProductionMaterialIssue2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const ProductionMaterialIssue3 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionMaterialIssue3?.setMaterial)
                {
                    await
                    ProductionMaterialIssue3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateProductionMaterialIssueWithInventory_lot() {
            
                const relatedInventory_lot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ProductionMaterialIssue0 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionMaterialIssue0?.setInventory_lot)
                {
                    await
                    ProductionMaterialIssue0.
                    setInventory_lot(relatedInventory_lot0);
                }
            
                const relatedInventory_lot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ProductionMaterialIssue1 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionMaterialIssue1?.setInventory_lot)
                {
                    await
                    ProductionMaterialIssue1.
                    setInventory_lot(relatedInventory_lot1);
                }
            
                const relatedInventory_lot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ProductionMaterialIssue2 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionMaterialIssue2?.setInventory_lot)
                {
                    await
                    ProductionMaterialIssue2.
                    setInventory_lot(relatedInventory_lot2);
                }
            
                const relatedInventory_lot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const ProductionMaterialIssue3 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionMaterialIssue3?.setInventory_lot)
                {
                    await
                    ProductionMaterialIssue3.
                    setInventory_lot(relatedInventory_lot3);
                }
            
        }
        
    
        
            
            async function associateProductionMaterialIssueWithFrom_location() {
            
                const relatedFrom_location0 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const ProductionMaterialIssue0 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionMaterialIssue0?.setFrom_location)
                {
                    await
                    ProductionMaterialIssue0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const ProductionMaterialIssue1 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionMaterialIssue1?.setFrom_location)
                {
                    await
                    ProductionMaterialIssue1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const ProductionMaterialIssue2 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionMaterialIssue2?.setFrom_location)
                {
                    await
                    ProductionMaterialIssue2.
                    setFrom_location(relatedFrom_location2);
                }
            
                const relatedFrom_location3 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const ProductionMaterialIssue3 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionMaterialIssue3?.setFrom_location)
                {
                    await
                    ProductionMaterialIssue3.
                    setFrom_location(relatedFrom_location3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateProductionMaterialIssueWithIssued_by() {
            
                const relatedIssued_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionMaterialIssue0 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionMaterialIssue0?.setIssued_by)
                {
                    await
                    ProductionMaterialIssue0.
                    setIssued_by(relatedIssued_by0);
                }
            
                const relatedIssued_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionMaterialIssue1 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionMaterialIssue1?.setIssued_by)
                {
                    await
                    ProductionMaterialIssue1.
                    setIssued_by(relatedIssued_by1);
                }
            
                const relatedIssued_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionMaterialIssue2 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionMaterialIssue2?.setIssued_by)
                {
                    await
                    ProductionMaterialIssue2.
                    setIssued_by(relatedIssued_by2);
                }
            
                const relatedIssued_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProductionMaterialIssue3 = await ProductionMaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionMaterialIssue3?.setIssued_by)
                {
                    await
                    ProductionMaterialIssue3.
                    setIssued_by(relatedIssued_by3);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateProductionLotWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionLot0 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionLot0?.setProduction_order)
                {
                    await
                    ProductionLot0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionLot1 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionLot1?.setProduction_order)
                {
                    await
                    ProductionLot1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionLot2 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionLot2?.setProduction_order)
                {
                    await
                    ProductionLot2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const ProductionLot3 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionLot3?.setProduction_order)
                {
                    await
                    ProductionLot3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductionLotWithStored_location() {
            
                const relatedStored_location0 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const ProductionLot0 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionLot0?.setStored_location)
                {
                    await
                    ProductionLot0.
                    setStored_location(relatedStored_location0);
                }
            
                const relatedStored_location1 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const ProductionLot1 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionLot1?.setStored_location)
                {
                    await
                    ProductionLot1.
                    setStored_location(relatedStored_location1);
                }
            
                const relatedStored_location2 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const ProductionLot2 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionLot2?.setStored_location)
                {
                    await
                    ProductionLot2.
                    setStored_location(relatedStored_location2);
                }
            
                const relatedStored_location3 = await StorageLocations.findOne({
                    offset: Math.floor(Math.random() * (await StorageLocations.count())),
                });
                const ProductionLot3 = await ProductionLots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProductionLot3?.setStored_location)
                {
                    await
                    ProductionLot3.
                    setStored_location(relatedStored_location3);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateQaInspectionWithInspector() {
            
                const relatedInspector0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setInspector)
                {
                    await
                    QaInspection0.
                    setInspector(relatedInspector0);
                }
            
                const relatedInspector1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setInspector)
                {
                    await
                    QaInspection1.
                    setInspector(relatedInspector1);
                }
            
                const relatedInspector2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setInspector)
                {
                    await
                    QaInspection2.
                    setInspector(relatedInspector2);
                }
            
                const relatedInspector3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaInspection3 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspection3?.setInspector)
                {
                    await
                    QaInspection3.
                    setInspector(relatedInspector3);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setMaterial)
                {
                    await
                    QaInspection0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setMaterial)
                {
                    await
                    QaInspection1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setMaterial)
                {
                    await
                    QaInspection2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const QaInspection3 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspection3?.setMaterial)
                {
                    await
                    QaInspection3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithInventory_lot() {
            
                const relatedInventory_lot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setInventory_lot)
                {
                    await
                    QaInspection0.
                    setInventory_lot(relatedInventory_lot0);
                }
            
                const relatedInventory_lot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setInventory_lot)
                {
                    await
                    QaInspection1.
                    setInventory_lot(relatedInventory_lot1);
                }
            
                const relatedInventory_lot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setInventory_lot)
                {
                    await
                    QaInspection2.
                    setInventory_lot(relatedInventory_lot2);
                }
            
                const relatedInventory_lot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const QaInspection3 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspection3?.setInventory_lot)
                {
                    await
                    QaInspection3.
                    setInventory_lot(relatedInventory_lot3);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setProduction_order)
                {
                    await
                    QaInspection0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setProduction_order)
                {
                    await
                    QaInspection1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setProduction_order)
                {
                    await
                    QaInspection2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const QaInspection3 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspection3?.setProduction_order)
                {
                    await
                    QaInspection3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithProduction_lot() {
            
                const relatedProduction_lot0 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setProduction_lot)
                {
                    await
                    QaInspection0.
                    setProduction_lot(relatedProduction_lot0);
                }
            
                const relatedProduction_lot1 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setProduction_lot)
                {
                    await
                    QaInspection1.
                    setProduction_lot(relatedProduction_lot1);
                }
            
                const relatedProduction_lot2 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setProduction_lot)
                {
                    await
                    QaInspection2.
                    setProduction_lot(relatedProduction_lot2);
                }
            
                const relatedProduction_lot3 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const QaInspection3 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaInspection3?.setProduction_lot)
                {
                    await
                    QaInspection3.
                    setProduction_lot(relatedProduction_lot3);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateQaChecklistItemWithQa_checklist() {
            
                const relatedQa_checklist0 = await QaChecklists.findOne({
                    offset: Math.floor(Math.random() * (await QaChecklists.count())),
                });
                const QaChecklistItem0 = await QaChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaChecklistItem0?.setQa_checklist)
                {
                    await
                    QaChecklistItem0.
                    setQa_checklist(relatedQa_checklist0);
                }
            
                const relatedQa_checklist1 = await QaChecklists.findOne({
                    offset: Math.floor(Math.random() * (await QaChecklists.count())),
                });
                const QaChecklistItem1 = await QaChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaChecklistItem1?.setQa_checklist)
                {
                    await
                    QaChecklistItem1.
                    setQa_checklist(relatedQa_checklist1);
                }
            
                const relatedQa_checklist2 = await QaChecklists.findOne({
                    offset: Math.floor(Math.random() * (await QaChecklists.count())),
                });
                const QaChecklistItem2 = await QaChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaChecklistItem2?.setQa_checklist)
                {
                    await
                    QaChecklistItem2.
                    setQa_checklist(relatedQa_checklist2);
                }
            
                const relatedQa_checklist3 = await QaChecklists.findOne({
                    offset: Math.floor(Math.random() * (await QaChecklists.count())),
                });
                const QaChecklistItem3 = await QaChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaChecklistItem3?.setQa_checklist)
                {
                    await
                    QaChecklistItem3.
                    setQa_checklist(relatedQa_checklist3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateQaMeasurementWithQa_inspection() {
            
                const relatedQa_inspection0 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const QaMeasurement0 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaMeasurement0?.setQa_inspection)
                {
                    await
                    QaMeasurement0.
                    setQa_inspection(relatedQa_inspection0);
                }
            
                const relatedQa_inspection1 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const QaMeasurement1 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaMeasurement1?.setQa_inspection)
                {
                    await
                    QaMeasurement1.
                    setQa_inspection(relatedQa_inspection1);
                }
            
                const relatedQa_inspection2 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const QaMeasurement2 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaMeasurement2?.setQa_inspection)
                {
                    await
                    QaMeasurement2.
                    setQa_inspection(relatedQa_inspection2);
                }
            
                const relatedQa_inspection3 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const QaMeasurement3 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaMeasurement3?.setQa_inspection)
                {
                    await
                    QaMeasurement3.
                    setQa_inspection(relatedQa_inspection3);
                }
            
        }
        
    
        
            
            async function associateQaMeasurementWithQa_checklist_item() {
            
                const relatedQa_checklist_item0 = await QaChecklistItems.findOne({
                    offset: Math.floor(Math.random() * (await QaChecklistItems.count())),
                });
                const QaMeasurement0 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaMeasurement0?.setQa_checklist_item)
                {
                    await
                    QaMeasurement0.
                    setQa_checklist_item(relatedQa_checklist_item0);
                }
            
                const relatedQa_checklist_item1 = await QaChecklistItems.findOne({
                    offset: Math.floor(Math.random() * (await QaChecklistItems.count())),
                });
                const QaMeasurement1 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaMeasurement1?.setQa_checklist_item)
                {
                    await
                    QaMeasurement1.
                    setQa_checklist_item(relatedQa_checklist_item1);
                }
            
                const relatedQa_checklist_item2 = await QaChecklistItems.findOne({
                    offset: Math.floor(Math.random() * (await QaChecklistItems.count())),
                });
                const QaMeasurement2 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaMeasurement2?.setQa_checklist_item)
                {
                    await
                    QaMeasurement2.
                    setQa_checklist_item(relatedQa_checklist_item2);
                }
            
                const relatedQa_checklist_item3 = await QaChecklistItems.findOne({
                    offset: Math.floor(Math.random() * (await QaChecklistItems.count())),
                });
                const QaMeasurement3 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaMeasurement3?.setQa_checklist_item)
                {
                    await
                    QaMeasurement3.
                    setQa_checklist_item(relatedQa_checklist_item3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateQaMeasurementWithRecorded_by() {
            
                const relatedRecorded_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaMeasurement0 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaMeasurement0?.setRecorded_by)
                {
                    await
                    QaMeasurement0.
                    setRecorded_by(relatedRecorded_by0);
                }
            
                const relatedRecorded_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaMeasurement1 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaMeasurement1?.setRecorded_by)
                {
                    await
                    QaMeasurement1.
                    setRecorded_by(relatedRecorded_by1);
                }
            
                const relatedRecorded_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaMeasurement2 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaMeasurement2?.setRecorded_by)
                {
                    await
                    QaMeasurement2.
                    setRecorded_by(relatedRecorded_by2);
                }
            
                const relatedRecorded_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const QaMeasurement3 = await QaMeasurements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QaMeasurement3?.setRecorded_by)
                {
                    await
                    QaMeasurement3.
                    setRecorded_by(relatedRecorded_by3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateNonconformanceWithReported_by() {
            
                const relatedReported_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setReported_by)
                {
                    await
                    Nonconformance0.
                    setReported_by(relatedReported_by0);
                }
            
                const relatedReported_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setReported_by)
                {
                    await
                    Nonconformance1.
                    setReported_by(relatedReported_by1);
                }
            
                const relatedReported_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setReported_by)
                {
                    await
                    Nonconformance2.
                    setReported_by(relatedReported_by2);
                }
            
                const relatedReported_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setReported_by)
                {
                    await
                    Nonconformance3.
                    setReported_by(relatedReported_by3);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithMaterial() {
            
                const relatedMaterial0 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setMaterial)
                {
                    await
                    Nonconformance0.
                    setMaterial(relatedMaterial0);
                }
            
                const relatedMaterial1 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setMaterial)
                {
                    await
                    Nonconformance1.
                    setMaterial(relatedMaterial1);
                }
            
                const relatedMaterial2 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setMaterial)
                {
                    await
                    Nonconformance2.
                    setMaterial(relatedMaterial2);
                }
            
                const relatedMaterial3 = await Materials.findOne({
                    offset: Math.floor(Math.random() * (await Materials.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setMaterial)
                {
                    await
                    Nonconformance3.
                    setMaterial(relatedMaterial3);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithInventory_lot() {
            
                const relatedInventory_lot0 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setInventory_lot)
                {
                    await
                    Nonconformance0.
                    setInventory_lot(relatedInventory_lot0);
                }
            
                const relatedInventory_lot1 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setInventory_lot)
                {
                    await
                    Nonconformance1.
                    setInventory_lot(relatedInventory_lot1);
                }
            
                const relatedInventory_lot2 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setInventory_lot)
                {
                    await
                    Nonconformance2.
                    setInventory_lot(relatedInventory_lot2);
                }
            
                const relatedInventory_lot3 = await InventoryLots.findOne({
                    offset: Math.floor(Math.random() * (await InventoryLots.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setInventory_lot)
                {
                    await
                    Nonconformance3.
                    setInventory_lot(relatedInventory_lot3);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithProduction_order() {
            
                const relatedProduction_order0 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setProduction_order)
                {
                    await
                    Nonconformance0.
                    setProduction_order(relatedProduction_order0);
                }
            
                const relatedProduction_order1 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setProduction_order)
                {
                    await
                    Nonconformance1.
                    setProduction_order(relatedProduction_order1);
                }
            
                const relatedProduction_order2 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setProduction_order)
                {
                    await
                    Nonconformance2.
                    setProduction_order(relatedProduction_order2);
                }
            
                const relatedProduction_order3 = await ProductionOrders.findOne({
                    offset: Math.floor(Math.random() * (await ProductionOrders.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setProduction_order)
                {
                    await
                    Nonconformance3.
                    setProduction_order(relatedProduction_order3);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithProduction_lot() {
            
                const relatedProduction_lot0 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setProduction_lot)
                {
                    await
                    Nonconformance0.
                    setProduction_lot(relatedProduction_lot0);
                }
            
                const relatedProduction_lot1 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setProduction_lot)
                {
                    await
                    Nonconformance1.
                    setProduction_lot(relatedProduction_lot1);
                }
            
                const relatedProduction_lot2 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setProduction_lot)
                {
                    await
                    Nonconformance2.
                    setProduction_lot(relatedProduction_lot2);
                }
            
                const relatedProduction_lot3 = await ProductionLots.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLots.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setProduction_lot)
                {
                    await
                    Nonconformance3.
                    setProduction_lot(relatedProduction_lot3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

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

    
    
    
        
    
        
            
            async function associateAuditEventWithActor() {
            
                const relatedActor0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent0 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditEvent0?.setActor)
                {
                    await
                    AuditEvent0.
                    setActor(relatedActor0);
                }
            
                const relatedActor1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent1 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditEvent1?.setActor)
                {
                    await
                    AuditEvent1.
                    setActor(relatedActor1);
                }
            
                const relatedActor2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent2 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditEvent2?.setActor)
                {
                    await
                    AuditEvent2.
                    setActor(relatedActor2);
                }
            
                const relatedActor3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent3 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuditEvent3?.setActor)
                {
                    await
                    AuditEvent3.
                    setActor(relatedActor3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await WorkCenters.bulkCreate(WorkCentersData);
                
            
            
                
                await Machines.bulkCreate(MachinesData);
                
            
            
                
                await MaintenanceWorkOrders.bulkCreate(MaintenanceWorkOrdersData);
                
            
            
                
                await Suppliers.bulkCreate(SuppliersData);
                
            
            
                
                await UnitsOfMeasure.bulkCreate(UnitsOfMeasureData);
                
            
            
                
                await Materials.bulkCreate(MaterialsData);
                
            
            
                
                await Warehouses.bulkCreate(WarehousesData);
                
            
            
                
                await StorageLocations.bulkCreate(StorageLocationsData);
                
            
            
                
                await InventoryLots.bulkCreate(InventoryLotsData);
                
            
            
                
                await InventoryBalances.bulkCreate(InventoryBalancesData);
                
            
            
                
                await InventoryTransactions.bulkCreate(InventoryTransactionsData);
                
            
            
                
                await Boms.bulkCreate(BomsData);
                
            
            
                
                await BomItems.bulkCreate(BomItemsData);
                
            
            
                
                await Routings.bulkCreate(RoutingsData);
                
            
            
                
                await RoutingSteps.bulkCreate(RoutingStepsData);
                
            
            
                
                await ProductionOrders.bulkCreate(ProductionOrdersData);
                
            
            
                
                await ProductionOperations.bulkCreate(ProductionOperationsData);
                
            
            
                
                await ProductionMaterialIssues.bulkCreate(ProductionMaterialIssuesData);
                
            
            
                
                await ProductionLots.bulkCreate(ProductionLotsData);
                
            
            
                
                await QaInspections.bulkCreate(QaInspectionsData);
                
            
            
                
                await QaChecklists.bulkCreate(QaChecklistsData);
                
            
            
                
                await QaChecklistItems.bulkCreate(QaChecklistItemsData);
                
            
            
                
                await QaMeasurements.bulkCreate(QaMeasurementsData);
                
            
            
                
                await Nonconformances.bulkCreate(NonconformancesData);
                
            
            
                
                await Documents.bulkCreate(DocumentsData);
                
            
            
                
                await AuditEvents.bulkCreate(AuditEventsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMachineWithWork_center(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithRequested_by(),
                    
                
                    
                        
                        await associateMaintenanceWorkOrderWithAssigned_to(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaterialWithUom(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMaterialWithPreferred_supplier(),
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateStorageLocationWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInventoryLotWithMaterial(),
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryLotWithSupplier(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInventoryBalanceWithMaterial(),
                    
                
                    
                        
                        await associateInventoryBalanceWithLocation(),
                    
                
                    
                        
                        await associateInventoryBalanceWithInventory_lot(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryTransactionWithMaterial(),
                    
                
                    
                        
                        await associateInventoryTransactionWithInventory_lot(),
                    
                
                    
                        
                        await associateInventoryTransactionWithFrom_location(),
                    
                
                    
                        
                        await associateInventoryTransactionWithTo_location(),
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryTransactionWithPerformed_by(),
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateBomWithParent_material(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateBomItemWithBom(),
                    
                
                    
                        
                        await associateBomItemWithComponent_material(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateRoutingWithMaterial(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateRoutingStepWithRouting(),
                    
                
                    
                
                    
                
                    
                        
                        await associateRoutingStepWithWork_center(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateProductionOrderWithMaterial(),
                    
                
                    
                        
                        await associateProductionOrderWithBom(),
                    
                
                    
                        
                        await associateProductionOrderWithRouting(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionOrderWithPlanner(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateProductionOperationWithProduction_order(),
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionOperationWithWork_center(),
                    
                
                    
                        
                        await associateProductionOperationWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionOperationWithOperator(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateProductionMaterialIssueWithProduction_order(),
                    
                
                    
                        
                        await associateProductionMaterialIssueWithMaterial(),
                    
                
                    
                        
                        await associateProductionMaterialIssueWithInventory_lot(),
                    
                
                    
                        
                        await associateProductionMaterialIssueWithFrom_location(),
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionMaterialIssueWithIssued_by(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateProductionLotWithProduction_order(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductionLotWithStored_location(),
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateQaInspectionWithInspector(),
                    
                
                    
                        
                        await associateQaInspectionWithMaterial(),
                    
                
                    
                        
                        await associateQaInspectionWithInventory_lot(),
                    
                
                    
                        
                        await associateQaInspectionWithProduction_order(),
                    
                
                    
                        
                        await associateQaInspectionWithProduction_lot(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateQaChecklistItemWithQa_checklist(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateQaMeasurementWithQa_inspection(),
                    
                
                    
                        
                        await associateQaMeasurementWithQa_checklist_item(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateQaMeasurementWithRecorded_by(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithReported_by(),
                    
                
                    
                        
                        await associateNonconformanceWithMaterial(),
                    
                
                    
                        
                        await associateNonconformanceWithInventory_lot(),
                    
                
                    
                        
                        await associateNonconformanceWithProduction_order(),
                    
                
                    
                        
                        await associateNonconformanceWithProduction_lot(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDocumentWithOwner(),
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateAuditEventWithActor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('work_centers', null, {});
            
            
            await queryInterface.bulkDelete('machines', null, {});
            
            
            await queryInterface.bulkDelete('maintenance_work_orders', null, {});
            
            
            await queryInterface.bulkDelete('suppliers', null, {});
            
            
            await queryInterface.bulkDelete('units_of_measure', null, {});
            
            
            await queryInterface.bulkDelete('materials', null, {});
            
            
            await queryInterface.bulkDelete('warehouses', null, {});
            
            
            await queryInterface.bulkDelete('storage_locations', null, {});
            
            
            await queryInterface.bulkDelete('inventory_lots', null, {});
            
            
            await queryInterface.bulkDelete('inventory_balances', null, {});
            
            
            await queryInterface.bulkDelete('inventory_transactions', null, {});
            
            
            await queryInterface.bulkDelete('boms', null, {});
            
            
            await queryInterface.bulkDelete('bom_items', null, {});
            
            
            await queryInterface.bulkDelete('routings', null, {});
            
            
            await queryInterface.bulkDelete('routing_steps', null, {});
            
            
            await queryInterface.bulkDelete('production_orders', null, {});
            
            
            await queryInterface.bulkDelete('production_operations', null, {});
            
            
            await queryInterface.bulkDelete('production_material_issues', null, {});
            
            
            await queryInterface.bulkDelete('production_lots', null, {});
            
            
            await queryInterface.bulkDelete('qa_inspections', null, {});
            
            
            await queryInterface.bulkDelete('qa_checklists', null, {});
            
            
            await queryInterface.bulkDelete('qa_checklist_items', null, {});
            
            
            await queryInterface.bulkDelete('qa_measurements', null, {});
            
            
            await queryInterface.bulkDelete('nonconformances', null, {});
            
            
            await queryInterface.bulkDelete('documents', null, {});
            
            
            await queryInterface.bulkDelete('audit_events', null, {});
            
        
    },
};