





















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






const Suppliers = db.suppliers;

const Customers = db.customers;

const Uoms = db.uoms;

const ItemCategories = db.item_categories;

const Items = db.items;

const Warehouses = db.warehouses;

const Locations = db.locations;

const Lots = db.lots;

const InventoryTransactions = db.inventory_transactions;

const Boms = db.boms;

const BomLines = db.bom_lines;

const Routes = db.routes;

const Operations = db.operations;

const Machines = db.machines;

const MachineDowntimeEvents = db.machine_downtime_events;

const WorkCenters = db.work_centers;

const ProductionLines = db.production_lines;

const WorkOrders = db.work_orders;

const WorkOrderOperations = db.work_order_operations;

const MaterialIssues = db.material_issues;

const MaterialIssueLines = db.material_issue_lines;

const Receipts = db.receipts;

const ReceiptLines = db.receipt_lines;

const Shipments = db.shipments;

const ShipmentLines = db.shipment_lines;

const QaInspectionPlans = db.qa_inspection_plans;

const QaCharacteristics = db.qa_characteristics;

const QaInspections = db.qa_inspections;

const QaResults = db.qa_results;

const Nonconformances = db.nonconformances;

const AuditEvents = db.audit_events;







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



const CustomersData = [
    
    {
    
        
        
            
                "customer_name": "Marie Curie",
            
        
    
        
        
            
                "customer_code": "Ada Lovelace",
            
        
    
        
        
            
                "contact_name": "Alan Turing",
            
        
    
        
        
            
                "email": "Ada Lovelace",
            
        
    
        
        
            
                "phone": "Alan Turing",
            
        
    
        
        
            
                "billing_address": "Grace Hopper",
            
        
    
        
        
            
                "shipping_address": "Marie Curie",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "customer_name": "Marie Curie",
            
        
    
        
        
            
                "customer_code": "Ada Lovelace",
            
        
    
        
        
            
                "contact_name": "Ada Lovelace",
            
        
    
        
        
            
                "email": "Ada Lovelace",
            
        
    
        
        
            
                "phone": "Grace Hopper",
            
        
    
        
        
            
                "billing_address": "Ada Lovelace",
            
        
    
        
        
            
                "shipping_address": "Grace Hopper",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "customer_name": "Alan Turing",
            
        
    
        
        
            
                "customer_code": "Alan Turing",
            
        
    
        
        
            
                "contact_name": "Alan Turing",
            
        
    
        
        
            
                "email": "Alan Turing",
            
        
    
        
        
            
                "phone": "Grace Hopper",
            
        
    
        
        
            
                "billing_address": "Ada Lovelace",
            
        
    
        
        
            
                "shipping_address": "Ada Lovelace",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
];



const UomsData = [
    
    {
    
        
        
            
                "uom_name": "Marie Curie",
            
        
    
        
        
            
                "uom_code": "Alan Turing",
            
        
    
        
        
            
                "base_multiplier": 2.94,
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "uom_name": "Marie Curie",
            
        
    
        
        
            
                "uom_code": "Marie Curie",
            
        
    
        
        
            
                "base_multiplier": 8.91,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "uom_name": "Grace Hopper",
            
        
    
        
        
            
                "uom_code": "Ada Lovelace",
            
        
    
        
        
            
                "base_multiplier": 8.48,
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
];



const ItemCategoriesData = [
    
    {
    
        
        
            
                "category_name": "Marie Curie",
            
        
    
        
        
            
                "category_code": "Grace Hopper",
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "category_name": "Grace Hopper",
            
        
    
        
        
            
                "category_code": "Marie Curie",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "category_name": "Marie Curie",
            
        
    
        
        
            
                "category_code": "Alan Turing",
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
];



const ItemsData = [
    
    {
    
        
        
            
                "item_name": "Marie Curie",
            
        
    
        
        
            
                "item_code": "Marie Curie",
            
        
    
        
        
            
                "item_type": "raw_material",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_tracked": false,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "standard_cost": 2.16,
            
        
    
        
        
            
                "default_purchase_price": 8.92,
            
        
    
        
        
            
                "default_sale_price": 3.5,
            
        
    
        
        
            
                "shelf_life_days": 5,
            
        
    
        
        
            
                "reorder_point": 0.63,
            
        
    
        
        
            
                "reorder_qty": 1.63,
            
        
    
        
        
            
                "active": false,
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "item_name": "Grace Hopper",
            
        
    
        
        
            
                "item_code": "Marie Curie",
            
        
    
        
        
            
                "item_type": "spare_part",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_tracked": false,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "standard_cost": 7.5,
            
        
    
        
        
            
                "default_purchase_price": 2.61,
            
        
    
        
        
            
                "default_sale_price": 1.83,
            
        
    
        
        
            
                "shelf_life_days": 8,
            
        
    
        
        
            
                "reorder_point": 8.61,
            
        
    
        
        
            
                "reorder_qty": 5.72,
            
        
    
        
        
            
                "active": false,
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "item_name": "Alan Turing",
            
        
    
        
        
            
                "item_code": "Ada Lovelace",
            
        
    
        
        
            
                "item_type": "finished_good",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_tracked": false,
            
        
    
        
        
            
                "serial_tracked": false,
            
        
    
        
        
            
                "standard_cost": 3.98,
            
        
    
        
        
            
                "default_purchase_price": 2.4,
            
        
    
        
        
            
                "default_sale_price": 8.35,
            
        
    
        
        
            
                "shelf_life_days": 4,
            
        
    
        
        
            
                "reorder_point": 1.09,
            
        
    
        
        
            
                "reorder_qty": 0.44,
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const WarehousesData = [
    
    {
    
        
        
            
                "warehouse_name": "Grace Hopper",
            
        
    
        
        
            
                "warehouse_code": "Marie Curie",
            
        
    
        
        
            
                "address": "Ada Lovelace",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "warehouse_name": "Marie Curie",
            
        
    
        
        
            
                "warehouse_code": "Grace Hopper",
            
        
    
        
        
            
                "address": "Grace Hopper",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "warehouse_name": "Alan Turing",
            
        
    
        
        
            
                "warehouse_code": "Ada Lovelace",
            
        
    
        
        
            
                "address": "Marie Curie",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
];



const LocationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "location_name": "Grace Hopper",
            
        
    
        
        
            
                "location_code": "Alan Turing",
            
        
    
        
        
            
                "location_type": "scrap",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "location_name": "Grace Hopper",
            
        
    
        
        
            
                "location_code": "Ada Lovelace",
            
        
    
        
        
            
                "location_type": "receiving",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "location_name": "Ada Lovelace",
            
        
    
        
        
            
                "location_code": "Alan Turing",
            
        
    
        
        
            
                "location_type": "qa_hold",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



const LotsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_code": "Grace Hopper",
            
        
    
        
        
            
                "supplier_lot_code": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_at": new Date(Date.now()),
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "expires_at": new Date(Date.now()),
            
        
    
        
        
            
                "quality_status": "rework",
            
        
    
        
        
            
                "certificate_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_code": "Marie Curie",
            
        
    
        
        
            
                "supplier_lot_code": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_at": new Date(Date.now()),
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "expires_at": new Date(Date.now()),
            
        
    
        
        
            
                "quality_status": "rework",
            
        
    
        
        
            
                "certificate_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_code": "Grace Hopper",
            
        
    
        
        
            
                "supplier_lot_code": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_at": new Date(Date.now()),
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "expires_at": new Date(Date.now()),
            
        
    
        
        
            
                "quality_status": "rejected",
            
        
    
        
        
            
                "certificate_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
];



const InventoryTransactionsData = [
    
    {
    
        
        
            
                "transaction_number": "Alan Turing",
            
        
    
        
        
            
                "transaction_at": new Date(Date.now()),
            
        
    
        
        
            
                "transaction_type": "return_to_stock",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 8.11,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_cost": 3.9,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reference": "Alan Turing",
            
        
    
        
        
            
                "reason": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "transaction_number": "Marie Curie",
            
        
    
        
        
            
                "transaction_at": new Date(Date.now()),
            
        
    
        
        
            
                "transaction_type": "scrap",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 4.45,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_cost": 4.18,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reference": "Marie Curie",
            
        
    
        
        
            
                "reason": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "transaction_number": "Alan Turing",
            
        
    
        
        
            
                "transaction_at": new Date(Date.now()),
            
        
    
        
        
            
                "transaction_type": "adjustment",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1.62,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_cost": 2.14,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reference": "Ada Lovelace",
            
        
    
        
        
            
                "reason": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



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



const BomLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 4.53,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scrap_factor": 1.62,
            
        
    
        
        
            
                "issue_method": "backflush",
            
        
    
        
        
            
                "line_notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 6.43,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scrap_factor": 9.1,
            
        
    
        
        
            
                "issue_method": "backflush",
            
        
    
        
        
            
                "line_notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 2.17,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scrap_factor": 4.4,
            
        
    
        
        
            
                "issue_method": "backflush",
            
        
    
        
        
            
                "line_notes": "Marie Curie",
            
        
    
    },
    
];



const RoutesData = [
    
    {
    
        
        
            
                "route_name": "Alan Turing",
            
        
    
        
        
            
                "route_code": "Ada Lovelace",
            
        
    
        
        
            
                "route_status": "obsolete",
            
        
    
        
        
            
                "description": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "route_name": "Ada Lovelace",
            
        
    
        
        
            
                "route_code": "Marie Curie",
            
        
    
        
        
            
                "route_status": "active",
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "route_name": "Alan Turing",
            
        
    
        
        
            
                "route_code": "Ada Lovelace",
            
        
    
        
        
            
                "route_status": "obsolete",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
    },
    
];



const OperationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_name": "Ada Lovelace",
            
        
    
        
        
            
                "operation_code": "Grace Hopper",
            
        
    
        
        
            
                "sequence": 3,
            
        
    
        
        
            
                "setup_time_minutes": 9.19,
            
        
    
        
        
            
                "run_time_minutes_per_unit": 3.91,
            
        
    
        
        
            
                "labor_time_minutes_per_unit": 8.07,
            
        
    
        
        
            
                "work_instructions": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_name": "Ada Lovelace",
            
        
    
        
        
            
                "operation_code": "Marie Curie",
            
        
    
        
        
            
                "sequence": 3,
            
        
    
        
        
            
                "setup_time_minutes": 4.78,
            
        
    
        
        
            
                "run_time_minutes_per_unit": 9.19,
            
        
    
        
        
            
                "labor_time_minutes_per_unit": 6.51,
            
        
    
        
        
            
                "work_instructions": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_name": "Ada Lovelace",
            
        
    
        
        
            
                "operation_code": "Grace Hopper",
            
        
    
        
        
            
                "sequence": 4,
            
        
    
        
        
            
                "setup_time_minutes": 5.07,
            
        
    
        
        
            
                "run_time_minutes_per_unit": 8.65,
            
        
    
        
        
            
                "labor_time_minutes_per_unit": 4.36,
            
        
    
        
        
            
                "work_instructions": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const MachinesData = [
    
    {
    
        
        
            
                "machine_name": "Grace Hopper",
            
        
    
        
        
            
                "machine_code": "Alan Turing",
            
        
    
        
        
            
                "machine_type": "other",
            
        
    
        
        
            
                "status": "setup",
            
        
    
        
        
            
                "manufacturer": "Ada Lovelace",
            
        
    
        
        
            
                "model": "Marie Curie",
            
        
    
        
        
            
                "serial_number": "Alan Turing",
            
        
    
        
        
            
                "commissioned_at": new Date(Date.now()),
            
        
    
        
        
            
                "location_detail": "Grace Hopper",
            
        
    
        
        
            
                "active": false,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "machine_name": "Alan Turing",
            
        
    
        
        
            
                "machine_code": "Grace Hopper",
            
        
    
        
        
            
                "machine_type": "cnc",
            
        
    
        
        
            
                "status": "setup",
            
        
    
        
        
            
                "manufacturer": "Marie Curie",
            
        
    
        
        
            
                "model": "Alan Turing",
            
        
    
        
        
            
                "serial_number": "Marie Curie",
            
        
    
        
        
            
                "commissioned_at": new Date(Date.now()),
            
        
    
        
        
            
                "location_detail": "Alan Turing",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "machine_name": "Marie Curie",
            
        
    
        
        
            
                "machine_code": "Alan Turing",
            
        
    
        
        
            
                "machine_type": "packaging",
            
        
    
        
        
            
                "status": "maintenance",
            
        
    
        
        
            
                "manufacturer": "Alan Turing",
            
        
    
        
        
            
                "model": "Marie Curie",
            
        
    
        
        
            
                "serial_number": "Grace Hopper",
            
        
    
        
        
            
                "commissioned_at": new Date(Date.now()),
            
        
    
        
        
            
                "location_detail": "Marie Curie",
            
        
    
        
        
            
                "active": false,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const MachineDowntimeEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                "downtime_category": "planned_maintenance",
            
        
    
        
        
            
                "severity": "high",
            
        
    
        
        
            
                "reason": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                "downtime_category": "breakdown",
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "reason": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                "downtime_category": "breakdown",
            
        
    
        
        
            
                "severity": "low",
            
        
    
        
        
            
                "reason": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const WorkCentersData = [
    
    {
    
        
        
            
                "work_center_name": "Grace Hopper",
            
        
    
        
        
            
                "work_center_code": "Ada Lovelace",
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "work_center_name": "Alan Turing",
            
        
    
        
        
            
                "work_center_code": "Ada Lovelace",
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "work_center_name": "Ada Lovelace",
            
        
    
        
        
            
                "work_center_code": "Grace Hopper",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



const ProductionLinesData = [
    
    {
    
        
        
            
                "line_name": "Ada Lovelace",
            
        
    
        
        
            
                "line_code": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_status": "active",
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "line_name": "Grace Hopper",
            
        
    
        
        
            
                "line_code": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_status": "active",
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "line_name": "Ada Lovelace",
            
        
    
        
        
            
                "line_code": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_status": "inactive",
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
    },
    
];



const WorkOrdersData = [
    
    {
    
        
        
            
                "work_order_number": "Marie Curie",
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "planned_quantity": 1.03,
            
        
    
        
        
            
                "completed_quantity": 5.58,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "actual_start": new Date(Date.now()),
            
        
    
        
        
            
                "actual_end": 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
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "Alan Turing",
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "planned_quantity": 4.24,
            
        
    
        
        
            
                "completed_quantity": 6.67,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "actual_start": new Date(Date.now()),
            
        
    
        
        
            
                "actual_end": 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
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "Marie Curie",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "planned_quantity": 1.31,
            
        
    
        
        
            
                "completed_quantity": 3.54,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "actual_start": new Date(Date.now()),
            
        
    
        
        
            
                "actual_end": 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
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const WorkOrderOperationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence": 5,
            
        
    
        
        
            
                "status": "blocked",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 8.7,
            
        
    
        
        
            
                "scrap_quantity": 0.19,
            
        
    
        
        
            
                "operator_notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence": 2,
            
        
    
        
        
            
                "status": "skipped",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 2.66,
            
        
    
        
        
            
                "scrap_quantity": 9.66,
            
        
    
        
        
            
                "operator_notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence": 6,
            
        
    
        
        
            
                "status": "blocked",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 5.44,
            
        
    
        
        
            
                "scrap_quantity": 2.12,
            
        
    
        
        
            
                "operator_notes": "Ada Lovelace",
            
        
    
    },
    
];



const MaterialIssuesData = [
    
    {
    
        
        
            
                "issue_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issued_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_type": "return",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "issue_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issued_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_type": "manual_pick",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "issue_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issued_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_type": "backflush",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const MaterialIssueLinesData = [
    
    {
    
        
        
            
                // 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.08,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_status": "cancelled",
            
        
    
        
        
            
                "line_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": 9.85,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_status": "issued",
            
        
    
        
        
            
                "line_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": 3.01,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_status": "issued",
            
        
    
        
        
            
                "line_notes": "Ada Lovelace",
            
        
    
    },
    
];



const ReceiptsData = [
    
    {
    
        
        
            
                "receipt_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_at": new Date(Date.now()),
            
        
    
        
        
            
                "receipt_status": "pending",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_document_ref": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "receipt_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_at": new Date(Date.now()),
            
        
    
        
        
            
                "receipt_status": "put_away",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_document_ref": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "receipt_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "received_at": new Date(Date.now()),
            
        
    
        
        
            
                "receipt_status": "cancelled",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_document_ref": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ReceiptLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 3.44,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_cost": 7.2,
            
        
    
        
        
            
                "quality_status": "quarantine",
            
        
    
        
        
            
                "line_notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 3.04,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_cost": 5.25,
            
        
    
        
        
            
                "quality_status": "released",
            
        
    
        
        
            
                "line_notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 4.5,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_cost": 8.07,
            
        
    
        
        
            
                "quality_status": "released",
            
        
    
        
        
            
                "line_notes": "Ada Lovelace",
            
        
    
    },
    
];



const ShipmentsData = [
    
    {
    
        
        
            
                "shipment_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "shipped_at": new Date(Date.now()),
            
        
    
        
        
            
                "shipment_status": "packed",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "carrier": "Alan Turing",
            
        
    
        
        
            
                "tracking_number": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "shipment_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "shipped_at": new Date(Date.now()),
            
        
    
        
        
            
                "shipment_status": "delivered",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "carrier": "Alan Turing",
            
        
    
        
        
            
                "tracking_number": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "shipment_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "shipped_at": new Date(Date.now()),
            
        
    
        
        
            
                "shipment_status": "cancelled",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "carrier": "Ada Lovelace",
            
        
    
        
        
            
                "tracking_number": "Alan Turing",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ShipmentLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 7.54,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 4.3,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 7.49,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_notes": "Alan Turing",
            
        
    
    },
    
];



const QaInspectionPlansData = [
    
    {
    
        
        
            
                "plan_name": "Alan Turing",
            
        
    
        
        
            
                "plan_code": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "in_process",
            
        
    
        
        
            
                "sampling_method": "100_percent",
            
        
    
        
        
            
                "sample_size": 8.88,
            
        
    
        
        
            
                "plan_status": "draft",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "plan_name": "Grace Hopper",
            
        
    
        
        
            
                "plan_code": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "incoming",
            
        
    
        
        
            
                "sampling_method": "fixed_n",
            
        
    
        
        
            
                "sample_size": 5.05,
            
        
    
        
        
            
                "plan_status": "obsolete",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "plan_name": "Marie Curie",
            
        
    
        
        
            
                "plan_code": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspection_type": "incoming",
            
        
    
        
        
            
                "sampling_method": "100_percent",
            
        
    
        
        
            
                "sample_size": 9.26,
            
        
    
        
        
            
                "plan_status": "draft",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const QaCharacteristicsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "characteristic_name": "Ada Lovelace",
            
        
    
        
        
            
                "characteristic_code": "Marie Curie",
            
        
    
        
        
            
                "data_type": "attribute",
            
        
    
        
        
            
                "target_value": 7.98,
            
        
    
        
        
            
                "lower_limit": 7.82,
            
        
    
        
        
            
                "upper_limit": 6.93,
            
        
    
        
        
            
                "attribute_pass_value": "yes",
            
        
    
        
        
            
                "attribute_fail_value": "no",
            
        
    
        
        
            
                "test_method": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "characteristic_name": "Grace Hopper",
            
        
    
        
        
            
                "characteristic_code": "Alan Turing",
            
        
    
        
        
            
                "data_type": "numeric",
            
        
    
        
        
            
                "target_value": 9.12,
            
        
    
        
        
            
                "lower_limit": 9.43,
            
        
    
        
        
            
                "upper_limit": 9.81,
            
        
    
        
        
            
                "attribute_pass_value": "pass",
            
        
    
        
        
            
                "attribute_fail_value": "no",
            
        
    
        
        
            
                "test_method": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "characteristic_name": "Ada Lovelace",
            
        
    
        
        
            
                "characteristic_code": "Marie Curie",
            
        
    
        
        
            
                "data_type": "numeric",
            
        
    
        
        
            
                "target_value": 3.89,
            
        
    
        
        
            
                "lower_limit": 9.37,
            
        
    
        
        
            
                "upper_limit": 5.89,
            
        
    
        
        
            
                "attribute_pass_value": "pass",
            
        
    
        
        
            
                "attribute_fail_value": "no",
            
        
    
        
        
            
                "test_method": "Grace Hopper",
            
        
    
    },
    
];



const QaInspectionsData = [
    
    {
    
        
        
            
                "inspection_number": "Alan Turing",
            
        
    
        
        
            
                "inspection_type": "audit",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "scheduled_at": new Date(Date.now()),
            
        
    
        
        
            
                "performed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sample_size": 2.47,
            
        
    
        
        
            
                "defect_count": 7.43,
            
        
    
        
        
            
                "disposition": "reject",
            
        
    
        
        
            
                "summary": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "Alan Turing",
            
        
    
        
        
            
                "inspection_type": "in_process",
            
        
    
        
        
            
                "status": "planned",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "scheduled_at": new Date(Date.now()),
            
        
    
        
        
            
                "performed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sample_size": 5.58,
            
        
    
        
        
            
                "defect_count": 3.14,
            
        
    
        
        
            
                "disposition": "release",
            
        
    
        
        
            
                "summary": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "Grace Hopper",
            
        
    
        
        
            
                "inspection_type": "audit",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "scheduled_at": new Date(Date.now()),
            
        
    
        
        
            
                "performed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sample_size": 5.46,
            
        
    
        
        
            
                "defect_count": 8.5,
            
        
    
        
        
            
                "disposition": "reject",
            
        
    
        
        
            
                "summary": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const QaResultsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_value": 9.13,
            
        
    
        
        
            
                "attribute_result": "fail",
            
        
    
        
        
            
                "within_limits": false,
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_value": 1.97,
            
        
    
        
        
            
                "attribute_result": "na",
            
        
    
        
        
            
                "within_limits": true,
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_value": 6.35,
            
        
    
        
        
            
                "attribute_result": "fail",
            
        
    
        
        
            
                "within_limits": false,
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const NonconformancesData = [
    
    {
    
        
        
            
                "nc_number": "Marie Curie",
            
        
    
        
        
            
                "status": "under_review",
            
        
    
        
        
            
                "severity": "major",
            
        
    
        
        
            
                "source": "final",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "problem_description": "Ada Lovelace",
            
        
    
        
        
            
                "disposition": "hold",
            
        
    
        
        
            
                "containment_action": "Marie Curie",
            
        
    
        
        
            
                "root_cause": "Ada Lovelace",
            
        
    
        
        
            
                "corrective_action": "Ada Lovelace",
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "nc_number": "Alan Turing",
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                "severity": "major",
            
        
    
        
        
            
                "source": "incoming",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "problem_description": "Alan Turing",
            
        
    
        
        
            
                "disposition": "hold",
            
        
    
        
        
            
                "containment_action": "Alan Turing",
            
        
    
        
        
            
                "root_cause": "Marie Curie",
            
        
    
        
        
            
                "corrective_action": "Grace Hopper",
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "nc_number": "Ada Lovelace",
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                "severity": "major",
            
        
    
        
        
            
                "source": "audit",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "problem_description": "Alan Turing",
            
        
    
        
        
            
                "disposition": "use_as_is",
            
        
    
        
        
            
                "containment_action": "Grace Hopper",
            
        
    
        
        
            
                "root_cause": "Ada Lovelace",
            
        
    
        
        
            
                "corrective_action": "Ada Lovelace",
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



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




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

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

    
    
    
        
    
        
    
        
    
        
    

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

    
    
    
        
            
            async function associateLotWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Lot0 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lot0?.setItem)
                {
                    await
                    Lot0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Lot1 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lot1?.setItem)
                {
                    await
                    Lot1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Lot2 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lot2?.setItem)
                {
                    await
                    Lot2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateLotWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot0 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lot0?.setSupplier)
                {
                    await
                    Lot0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot1 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lot1?.setSupplier)
                {
                    await
                    Lot1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot2 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lot2?.setSupplier)
                {
                    await
                    Lot2.
                    setSupplier(relatedSupplier2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateInventoryTransactionWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setItem)
                {
                    await
                    InventoryTransaction0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setItem)
                {
                    await
                    InventoryTransaction1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setItem)
                {
                    await
                    InventoryTransaction2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setLot)
                {
                    await
                    InventoryTransaction0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setLot)
                {
                    await
                    InventoryTransaction1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setLot)
                {
                    await
                    InventoryTransaction2.
                    setLot(relatedLot2);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithFrom_location() {
            
                const relatedFrom_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setFrom_location)
                {
                    await
                    InventoryTransaction0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setFrom_location)
                {
                    await
                    InventoryTransaction1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setFrom_location)
                {
                    await
                    InventoryTransaction2.
                    setFrom_location(relatedFrom_location2);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithTo_location() {
            
                const relatedTo_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setTo_location)
                {
                    await
                    InventoryTransaction0.
                    setTo_location(relatedTo_location0);
                }
            
                const relatedTo_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setTo_location)
                {
                    await
                    InventoryTransaction1.
                    setTo_location(relatedTo_location1);
                }
            
                const relatedTo_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setTo_location)
                {
                    await
                    InventoryTransaction2.
                    setTo_location(relatedTo_location2);
                }
            
        }
        
    
        
    
        
            
            async function associateInventoryTransactionWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setUom)
                {
                    await
                    InventoryTransaction0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setUom)
                {
                    await
                    InventoryTransaction1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setUom)
                {
                    await
                    InventoryTransaction2.
                    setUom(relatedUom2);
                }
            
        }
        
    
        
    
        
            
            async function associateInventoryTransactionWithWork_order() {
            
                const relatedWork_order0 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setWork_order)
                {
                    await
                    InventoryTransaction0.
                    setWork_order(relatedWork_order0);
                }
            
                const relatedWork_order1 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setWork_order)
                {
                    await
                    InventoryTransaction1.
                    setWork_order(relatedWork_order1);
                }
            
                const relatedWork_order2 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setWork_order)
                {
                    await
                    InventoryTransaction2.
                    setWork_order(relatedWork_order2);
                }
            
        }
        
    
        
            
            async function associateInventoryTransactionWithQa_inspection() {
            
                const relatedQa_inspection0 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const InventoryTransaction0 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryTransaction0?.setQa_inspection)
                {
                    await
                    InventoryTransaction0.
                    setQa_inspection(relatedQa_inspection0);
                }
            
                const relatedQa_inspection1 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const InventoryTransaction1 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryTransaction1?.setQa_inspection)
                {
                    await
                    InventoryTransaction1.
                    setQa_inspection(relatedQa_inspection1);
                }
            
                const relatedQa_inspection2 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const InventoryTransaction2 = await InventoryTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryTransaction2?.setQa_inspection)
                {
                    await
                    InventoryTransaction2.
                    setQa_inspection(relatedQa_inspection2);
                }
            
        }
        
    
        
            
            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);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateBomWithParent_item() {
            
                const relatedParent_item0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Bom0 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Bom0?.setParent_item)
                {
                    await
                    Bom0.
                    setParent_item(relatedParent_item0);
                }
            
                const relatedParent_item1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Bom1 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Bom1?.setParent_item)
                {
                    await
                    Bom1.
                    setParent_item(relatedParent_item1);
                }
            
                const relatedParent_item2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Bom2 = await Boms.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Bom2?.setParent_item)
                {
                    await
                    Bom2.
                    setParent_item(relatedParent_item2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateBomLineWithBom() {
            
                const relatedBom0 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomLine0 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomLine0?.setBom)
                {
                    await
                    BomLine0.
                    setBom(relatedBom0);
                }
            
                const relatedBom1 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomLine1 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomLine1?.setBom)
                {
                    await
                    BomLine1.
                    setBom(relatedBom1);
                }
            
                const relatedBom2 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const BomLine2 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomLine2?.setBom)
                {
                    await
                    BomLine2.
                    setBom(relatedBom2);
                }
            
        }
        
    
        
            
            async function associateBomLineWithComponent_item() {
            
                const relatedComponent_item0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine0 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomLine0?.setComponent_item)
                {
                    await
                    BomLine0.
                    setComponent_item(relatedComponent_item0);
                }
            
                const relatedComponent_item1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine1 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomLine1?.setComponent_item)
                {
                    await
                    BomLine1.
                    setComponent_item(relatedComponent_item1);
                }
            
                const relatedComponent_item2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const BomLine2 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomLine2?.setComponent_item)
                {
                    await
                    BomLine2.
                    setComponent_item(relatedComponent_item2);
                }
            
        }
        
    
        
    
        
            
            async function associateBomLineWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const BomLine0 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BomLine0?.setUom)
                {
                    await
                    BomLine0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const BomLine1 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BomLine1?.setUom)
                {
                    await
                    BomLine1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const BomLine2 = await BomLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BomLine2?.setUom)
                {
                    await
                    BomLine2.
                    setUom(relatedUom2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateOperationWithRoute() {
            
                const relatedRoute0 = await Routes.findOne({
                    offset: Math.floor(Math.random() * (await Routes.count())),
                });
                const Operation0 = await Operations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Operation0?.setRoute)
                {
                    await
                    Operation0.
                    setRoute(relatedRoute0);
                }
            
                const relatedRoute1 = await Routes.findOne({
                    offset: Math.floor(Math.random() * (await Routes.count())),
                });
                const Operation1 = await Operations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Operation1?.setRoute)
                {
                    await
                    Operation1.
                    setRoute(relatedRoute1);
                }
            
                const relatedRoute2 = await Routes.findOne({
                    offset: Math.floor(Math.random() * (await Routes.count())),
                });
                const Operation2 = await Operations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Operation2?.setRoute)
                {
                    await
                    Operation2.
                    setRoute(relatedRoute2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateMachineDowntimeEventWithMachine() {
            
                const relatedMachine0 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineDowntimeEvent0 = await MachineDowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MachineDowntimeEvent0?.setMachine)
                {
                    await
                    MachineDowntimeEvent0.
                    setMachine(relatedMachine0);
                }
            
                const relatedMachine1 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineDowntimeEvent1 = await MachineDowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MachineDowntimeEvent1?.setMachine)
                {
                    await
                    MachineDowntimeEvent1.
                    setMachine(relatedMachine1);
                }
            
                const relatedMachine2 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineDowntimeEvent2 = await MachineDowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MachineDowntimeEvent2?.setMachine)
                {
                    await
                    MachineDowntimeEvent2.
                    setMachine(relatedMachine2);
                }
            
        }
        
    
        
            
            async function associateMachineDowntimeEventWithWork_order() {
            
                const relatedWork_order0 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const MachineDowntimeEvent0 = await MachineDowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MachineDowntimeEvent0?.setWork_order)
                {
                    await
                    MachineDowntimeEvent0.
                    setWork_order(relatedWork_order0);
                }
            
                const relatedWork_order1 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const MachineDowntimeEvent1 = await MachineDowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MachineDowntimeEvent1?.setWork_order)
                {
                    await
                    MachineDowntimeEvent1.
                    setWork_order(relatedWork_order1);
                }
            
                const relatedWork_order2 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const MachineDowntimeEvent2 = await MachineDowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MachineDowntimeEvent2?.setWork_order)
                {
                    await
                    MachineDowntimeEvent2.
                    setWork_order(relatedWork_order2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateMachineDowntimeEventWithReported_by() {
            
                const relatedReported_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MachineDowntimeEvent0 = await MachineDowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MachineDowntimeEvent0?.setReported_by)
                {
                    await
                    MachineDowntimeEvent0.
                    setReported_by(relatedReported_by0);
                }
            
                const relatedReported_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MachineDowntimeEvent1 = await MachineDowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MachineDowntimeEvent1?.setReported_by)
                {
                    await
                    MachineDowntimeEvent1.
                    setReported_by(relatedReported_by1);
                }
            
                const relatedReported_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MachineDowntimeEvent2 = await MachineDowntimeEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MachineDowntimeEvent2?.setReported_by)
                {
                    await
                    MachineDowntimeEvent2.
                    setReported_by(relatedReported_by2);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateProductionLineWithWork_center() {
            
                const relatedWork_center0 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionLine0 = await ProductionLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProductionLine0?.setWork_center)
                {
                    await
                    ProductionLine0.
                    setWork_center(relatedWork_center0);
                }
            
                const relatedWork_center1 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionLine1 = await ProductionLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProductionLine1?.setWork_center)
                {
                    await
                    ProductionLine1.
                    setWork_center(relatedWork_center1);
                }
            
                const relatedWork_center2 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const ProductionLine2 = await ProductionLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProductionLine2?.setWork_center)
                {
                    await
                    ProductionLine2.
                    setWork_center(relatedWork_center2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
    
        
    
        
            
            async function associateWorkOrderWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setItem)
                {
                    await
                    WorkOrder0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setItem)
                {
                    await
                    WorkOrder1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setItem)
                {
                    await
                    WorkOrder2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
            
            async function associateWorkOrderWithBom() {
            
                const relatedBom0 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setBom)
                {
                    await
                    WorkOrder0.
                    setBom(relatedBom0);
                }
            
                const relatedBom1 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setBom)
                {
                    await
                    WorkOrder1.
                    setBom(relatedBom1);
                }
            
                const relatedBom2 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setBom)
                {
                    await
                    WorkOrder2.
                    setBom(relatedBom2);
                }
            
        }
        
    
        
            
            async function associateWorkOrderWithRoute() {
            
                const relatedRoute0 = await Routes.findOne({
                    offset: Math.floor(Math.random() * (await Routes.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setRoute)
                {
                    await
                    WorkOrder0.
                    setRoute(relatedRoute0);
                }
            
                const relatedRoute1 = await Routes.findOne({
                    offset: Math.floor(Math.random() * (await Routes.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setRoute)
                {
                    await
                    WorkOrder1.
                    setRoute(relatedRoute1);
                }
            
                const relatedRoute2 = await Routes.findOne({
                    offset: Math.floor(Math.random() * (await Routes.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setRoute)
                {
                    await
                    WorkOrder2.
                    setRoute(relatedRoute2);
                }
            
        }
        
    
        
            
            async function associateWorkOrderWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setCustomer)
                {
                    await
                    WorkOrder0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setCustomer)
                {
                    await
                    WorkOrder1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setCustomer)
                {
                    await
                    WorkOrder2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateWorkOrderWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setUom)
                {
                    await
                    WorkOrder0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setUom)
                {
                    await
                    WorkOrder1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setUom)
                {
                    await
                    WorkOrder2.
                    setUom(relatedUom2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateWorkOrderWithProduction_line() {
            
                const relatedProduction_line0 = await ProductionLines.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLines.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setProduction_line)
                {
                    await
                    WorkOrder0.
                    setProduction_line(relatedProduction_line0);
                }
            
                const relatedProduction_line1 = await ProductionLines.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLines.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setProduction_line)
                {
                    await
                    WorkOrder1.
                    setProduction_line(relatedProduction_line1);
                }
            
                const relatedProduction_line2 = await ProductionLines.findOne({
                    offset: Math.floor(Math.random() * (await ProductionLines.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setProduction_line)
                {
                    await
                    WorkOrder2.
                    setProduction_line(relatedProduction_line2);
                }
            
        }
        
    
        
            
            async function associateWorkOrderWithPrimary_machine() {
            
                const relatedPrimary_machine0 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setPrimary_machine)
                {
                    await
                    WorkOrder0.
                    setPrimary_machine(relatedPrimary_machine0);
                }
            
                const relatedPrimary_machine1 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setPrimary_machine)
                {
                    await
                    WorkOrder1.
                    setPrimary_machine(relatedPrimary_machine1);
                }
            
                const relatedPrimary_machine2 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setPrimary_machine)
                {
                    await
                    WorkOrder2.
                    setPrimary_machine(relatedPrimary_machine2);
                }
            
        }
        
    
        
            
            async function associateWorkOrderWithPlanner() {
            
                const relatedPlanner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setPlanner)
                {
                    await
                    WorkOrder0.
                    setPlanner(relatedPlanner0);
                }
            
                const relatedPlanner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setPlanner)
                {
                    await
                    WorkOrder1.
                    setPlanner(relatedPlanner1);
                }
            
                const relatedPlanner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setPlanner)
                {
                    await
                    WorkOrder2.
                    setPlanner(relatedPlanner2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateWorkOrderOperationWithWork_order() {
            
                const relatedWork_order0 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const WorkOrderOperation0 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrderOperation0?.setWork_order)
                {
                    await
                    WorkOrderOperation0.
                    setWork_order(relatedWork_order0);
                }
            
                const relatedWork_order1 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const WorkOrderOperation1 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrderOperation1?.setWork_order)
                {
                    await
                    WorkOrderOperation1.
                    setWork_order(relatedWork_order1);
                }
            
                const relatedWork_order2 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const WorkOrderOperation2 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrderOperation2?.setWork_order)
                {
                    await
                    WorkOrderOperation2.
                    setWork_order(relatedWork_order2);
                }
            
        }
        
    
        
            
            async function associateWorkOrderOperationWithOperation() {
            
                const relatedOperation0 = await Operations.findOne({
                    offset: Math.floor(Math.random() * (await Operations.count())),
                });
                const WorkOrderOperation0 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrderOperation0?.setOperation)
                {
                    await
                    WorkOrderOperation0.
                    setOperation(relatedOperation0);
                }
            
                const relatedOperation1 = await Operations.findOne({
                    offset: Math.floor(Math.random() * (await Operations.count())),
                });
                const WorkOrderOperation1 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrderOperation1?.setOperation)
                {
                    await
                    WorkOrderOperation1.
                    setOperation(relatedOperation1);
                }
            
                const relatedOperation2 = await Operations.findOne({
                    offset: Math.floor(Math.random() * (await Operations.count())),
                });
                const WorkOrderOperation2 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrderOperation2?.setOperation)
                {
                    await
                    WorkOrderOperation2.
                    setOperation(relatedOperation2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateWorkOrderOperationWithMachine() {
            
                const relatedMachine0 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const WorkOrderOperation0 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrderOperation0?.setMachine)
                {
                    await
                    WorkOrderOperation0.
                    setMachine(relatedMachine0);
                }
            
                const relatedMachine1 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const WorkOrderOperation1 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrderOperation1?.setMachine)
                {
                    await
                    WorkOrderOperation1.
                    setMachine(relatedMachine1);
                }
            
                const relatedMachine2 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const WorkOrderOperation2 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrderOperation2?.setMachine)
                {
                    await
                    WorkOrderOperation2.
                    setMachine(relatedMachine2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateMaterialIssueWithWork_order() {
            
                const relatedWork_order0 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const MaterialIssue0 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssue0?.setWork_order)
                {
                    await
                    MaterialIssue0.
                    setWork_order(relatedWork_order0);
                }
            
                const relatedWork_order1 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const MaterialIssue1 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssue1?.setWork_order)
                {
                    await
                    MaterialIssue1.
                    setWork_order(relatedWork_order1);
                }
            
                const relatedWork_order2 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const MaterialIssue2 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssue2?.setWork_order)
                {
                    await
                    MaterialIssue2.
                    setWork_order(relatedWork_order2);
                }
            
        }
        
    
        
    
        
            
            async function associateMaterialIssueWithIssued_by() {
            
                const relatedIssued_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaterialIssue0 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssue0?.setIssued_by)
                {
                    await
                    MaterialIssue0.
                    setIssued_by(relatedIssued_by0);
                }
            
                const relatedIssued_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaterialIssue1 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssue1?.setIssued_by)
                {
                    await
                    MaterialIssue1.
                    setIssued_by(relatedIssued_by1);
                }
            
                const relatedIssued_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MaterialIssue2 = await MaterialIssues.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssue2?.setIssued_by)
                {
                    await
                    MaterialIssue2.
                    setIssued_by(relatedIssued_by2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateMaterialIssueLineWithMaterial_issue() {
            
                const relatedMaterial_issue0 = await MaterialIssues.findOne({
                    offset: Math.floor(Math.random() * (await MaterialIssues.count())),
                });
                const MaterialIssueLine0 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssueLine0?.setMaterial_issue)
                {
                    await
                    MaterialIssueLine0.
                    setMaterial_issue(relatedMaterial_issue0);
                }
            
                const relatedMaterial_issue1 = await MaterialIssues.findOne({
                    offset: Math.floor(Math.random() * (await MaterialIssues.count())),
                });
                const MaterialIssueLine1 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssueLine1?.setMaterial_issue)
                {
                    await
                    MaterialIssueLine1.
                    setMaterial_issue(relatedMaterial_issue1);
                }
            
                const relatedMaterial_issue2 = await MaterialIssues.findOne({
                    offset: Math.floor(Math.random() * (await MaterialIssues.count())),
                });
                const MaterialIssueLine2 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssueLine2?.setMaterial_issue)
                {
                    await
                    MaterialIssueLine2.
                    setMaterial_issue(relatedMaterial_issue2);
                }
            
        }
        
    
        
            
            async function associateMaterialIssueLineWithComponent_item() {
            
                const relatedComponent_item0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialIssueLine0 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssueLine0?.setComponent_item)
                {
                    await
                    MaterialIssueLine0.
                    setComponent_item(relatedComponent_item0);
                }
            
                const relatedComponent_item1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialIssueLine1 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssueLine1?.setComponent_item)
                {
                    await
                    MaterialIssueLine1.
                    setComponent_item(relatedComponent_item1);
                }
            
                const relatedComponent_item2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const MaterialIssueLine2 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssueLine2?.setComponent_item)
                {
                    await
                    MaterialIssueLine2.
                    setComponent_item(relatedComponent_item2);
                }
            
        }
        
    
        
            
            async function associateMaterialIssueLineWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const MaterialIssueLine0 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssueLine0?.setLot)
                {
                    await
                    MaterialIssueLine0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const MaterialIssueLine1 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssueLine1?.setLot)
                {
                    await
                    MaterialIssueLine1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const MaterialIssueLine2 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssueLine2?.setLot)
                {
                    await
                    MaterialIssueLine2.
                    setLot(relatedLot2);
                }
            
        }
        
    
        
            
            async function associateMaterialIssueLineWithFrom_location() {
            
                const relatedFrom_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const MaterialIssueLine0 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssueLine0?.setFrom_location)
                {
                    await
                    MaterialIssueLine0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const MaterialIssueLine1 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssueLine1?.setFrom_location)
                {
                    await
                    MaterialIssueLine1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const MaterialIssueLine2 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssueLine2?.setFrom_location)
                {
                    await
                    MaterialIssueLine2.
                    setFrom_location(relatedFrom_location2);
                }
            
        }
        
    
        
    
        
            
            async function associateMaterialIssueLineWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const MaterialIssueLine0 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaterialIssueLine0?.setUom)
                {
                    await
                    MaterialIssueLine0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const MaterialIssueLine1 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaterialIssueLine1?.setUom)
                {
                    await
                    MaterialIssueLine1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const MaterialIssueLine2 = await MaterialIssueLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaterialIssueLine2?.setUom)
                {
                    await
                    MaterialIssueLine2.
                    setUom(relatedUom2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateReceiptWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Receipt0 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Receipt0?.setSupplier)
                {
                    await
                    Receipt0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Receipt1 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Receipt1?.setSupplier)
                {
                    await
                    Receipt1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Receipt2 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Receipt2?.setSupplier)
                {
                    await
                    Receipt2.
                    setSupplier(relatedSupplier2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateReceiptWithReceived_by() {
            
                const relatedReceived_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Receipt0 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Receipt0?.setReceived_by)
                {
                    await
                    Receipt0.
                    setReceived_by(relatedReceived_by0);
                }
            
                const relatedReceived_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Receipt1 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Receipt1?.setReceived_by)
                {
                    await
                    Receipt1.
                    setReceived_by(relatedReceived_by1);
                }
            
                const relatedReceived_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Receipt2 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Receipt2?.setReceived_by)
                {
                    await
                    Receipt2.
                    setReceived_by(relatedReceived_by2);
                }
            
        }
        
    
        
    
        
            
            async function associateReceiptWithTo_location() {
            
                const relatedTo_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Receipt0 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Receipt0?.setTo_location)
                {
                    await
                    Receipt0.
                    setTo_location(relatedTo_location0);
                }
            
                const relatedTo_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Receipt1 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Receipt1?.setTo_location)
                {
                    await
                    Receipt1.
                    setTo_location(relatedTo_location1);
                }
            
                const relatedTo_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Receipt2 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Receipt2?.setTo_location)
                {
                    await
                    Receipt2.
                    setTo_location(relatedTo_location2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateReceiptLineWithReceipt() {
            
                const relatedReceipt0 = await Receipts.findOne({
                    offset: Math.floor(Math.random() * (await Receipts.count())),
                });
                const ReceiptLine0 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReceiptLine0?.setReceipt)
                {
                    await
                    ReceiptLine0.
                    setReceipt(relatedReceipt0);
                }
            
                const relatedReceipt1 = await Receipts.findOne({
                    offset: Math.floor(Math.random() * (await Receipts.count())),
                });
                const ReceiptLine1 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReceiptLine1?.setReceipt)
                {
                    await
                    ReceiptLine1.
                    setReceipt(relatedReceipt1);
                }
            
                const relatedReceipt2 = await Receipts.findOne({
                    offset: Math.floor(Math.random() * (await Receipts.count())),
                });
                const ReceiptLine2 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReceiptLine2?.setReceipt)
                {
                    await
                    ReceiptLine2.
                    setReceipt(relatedReceipt2);
                }
            
        }
        
    
        
            
            async function associateReceiptLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ReceiptLine0 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReceiptLine0?.setItem)
                {
                    await
                    ReceiptLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ReceiptLine1 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReceiptLine1?.setItem)
                {
                    await
                    ReceiptLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ReceiptLine2 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReceiptLine2?.setItem)
                {
                    await
                    ReceiptLine2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
            
            async function associateReceiptLineWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const ReceiptLine0 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReceiptLine0?.setLot)
                {
                    await
                    ReceiptLine0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const ReceiptLine1 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReceiptLine1?.setLot)
                {
                    await
                    ReceiptLine1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const ReceiptLine2 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReceiptLine2?.setLot)
                {
                    await
                    ReceiptLine2.
                    setLot(relatedLot2);
                }
            
        }
        
    
        
    
        
            
            async function associateReceiptLineWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const ReceiptLine0 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReceiptLine0?.setUom)
                {
                    await
                    ReceiptLine0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const ReceiptLine1 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReceiptLine1?.setUom)
                {
                    await
                    ReceiptLine1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const ReceiptLine2 = await ReceiptLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReceiptLine2?.setUom)
                {
                    await
                    ReceiptLine2.
                    setUom(relatedUom2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateShipmentWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setCustomer)
                {
                    await
                    Shipment0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setCustomer)
                {
                    await
                    Shipment1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setCustomer)
                {
                    await
                    Shipment2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateShipmentWithFrom_location() {
            
                const relatedFrom_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setFrom_location)
                {
                    await
                    Shipment0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setFrom_location)
                {
                    await
                    Shipment1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setFrom_location)
                {
                    await
                    Shipment2.
                    setFrom_location(relatedFrom_location2);
                }
            
        }
        
    
        
            
            async function associateShipmentWithShipped_by() {
            
                const relatedShipped_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shipment0 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Shipment0?.setShipped_by)
                {
                    await
                    Shipment0.
                    setShipped_by(relatedShipped_by0);
                }
            
                const relatedShipped_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shipment1 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Shipment1?.setShipped_by)
                {
                    await
                    Shipment1.
                    setShipped_by(relatedShipped_by1);
                }
            
                const relatedShipped_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Shipment2 = await Shipments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Shipment2?.setShipped_by)
                {
                    await
                    Shipment2.
                    setShipped_by(relatedShipped_by2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateShipmentLineWithShipment() {
            
                const relatedShipment0 = await Shipments.findOne({
                    offset: Math.floor(Math.random() * (await Shipments.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setShipment)
                {
                    await
                    ShipmentLine0.
                    setShipment(relatedShipment0);
                }
            
                const relatedShipment1 = await Shipments.findOne({
                    offset: Math.floor(Math.random() * (await Shipments.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setShipment)
                {
                    await
                    ShipmentLine1.
                    setShipment(relatedShipment1);
                }
            
                const relatedShipment2 = await Shipments.findOne({
                    offset: Math.floor(Math.random() * (await Shipments.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setShipment)
                {
                    await
                    ShipmentLine2.
                    setShipment(relatedShipment2);
                }
            
        }
        
    
        
            
            async function associateShipmentLineWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setItem)
                {
                    await
                    ShipmentLine0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setItem)
                {
                    await
                    ShipmentLine1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setItem)
                {
                    await
                    ShipmentLine2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
            
            async function associateShipmentLineWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setLot)
                {
                    await
                    ShipmentLine0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setLot)
                {
                    await
                    ShipmentLine1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setLot)
                {
                    await
                    ShipmentLine2.
                    setLot(relatedLot2);
                }
            
        }
        
    
        
    
        
            
            async function associateShipmentLineWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const ShipmentLine0 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ShipmentLine0?.setUom)
                {
                    await
                    ShipmentLine0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const ShipmentLine1 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ShipmentLine1?.setUom)
                {
                    await
                    ShipmentLine1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const ShipmentLine2 = await ShipmentLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ShipmentLine2?.setUom)
                {
                    await
                    ShipmentLine2.
                    setUom(relatedUom2);
                }
            
        }
        
    
        
    

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

    
    
    
        
            
            async function associateQaCharacteristicWithInspection_plan() {
            
                const relatedInspection_plan0 = await QaInspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
                });
                const QaCharacteristic0 = await QaCharacteristics.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaCharacteristic0?.setInspection_plan)
                {
                    await
                    QaCharacteristic0.
                    setInspection_plan(relatedInspection_plan0);
                }
            
                const relatedInspection_plan1 = await QaInspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
                });
                const QaCharacteristic1 = await QaCharacteristics.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaCharacteristic1?.setInspection_plan)
                {
                    await
                    QaCharacteristic1.
                    setInspection_plan(relatedInspection_plan1);
                }
            
                const relatedInspection_plan2 = await QaInspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
                });
                const QaCharacteristic2 = await QaCharacteristics.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaCharacteristic2?.setInspection_plan)
                {
                    await
                    QaCharacteristic2.
                    setInspection_plan(relatedInspection_plan2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateQaInspectionWithInspection_plan() {
            
                const relatedInspection_plan0 = await QaInspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setInspection_plan)
                {
                    await
                    QaInspection0.
                    setInspection_plan(relatedInspection_plan0);
                }
            
                const relatedInspection_plan1 = await QaInspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setInspection_plan)
                {
                    await
                    QaInspection1.
                    setInspection_plan(relatedInspection_plan1);
                }
            
                const relatedInspection_plan2 = await QaInspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setInspection_plan)
                {
                    await
                    QaInspection2.
                    setInspection_plan(relatedInspection_plan2);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setItem)
                {
                    await
                    QaInspection0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setItem)
                {
                    await
                    QaInspection1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setItem)
                {
                    await
                    QaInspection2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setLot)
                {
                    await
                    QaInspection0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setLot)
                {
                    await
                    QaInspection1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setLot)
                {
                    await
                    QaInspection2.
                    setLot(relatedLot2);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithWork_order() {
            
                const relatedWork_order0 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setWork_order)
                {
                    await
                    QaInspection0.
                    setWork_order(relatedWork_order0);
                }
            
                const relatedWork_order1 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setWork_order)
                {
                    await
                    QaInspection1.
                    setWork_order(relatedWork_order1);
                }
            
                const relatedWork_order2 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setWork_order)
                {
                    await
                    QaInspection2.
                    setWork_order(relatedWork_order2);
                }
            
        }
        
    
        
            
            async function associateQaInspectionWithOperation() {
            
                const relatedOperation0 = await Operations.findOne({
                    offset: Math.floor(Math.random() * (await Operations.count())),
                });
                const QaInspection0 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaInspection0?.setOperation)
                {
                    await
                    QaInspection0.
                    setOperation(relatedOperation0);
                }
            
                const relatedOperation1 = await Operations.findOne({
                    offset: Math.floor(Math.random() * (await Operations.count())),
                });
                const QaInspection1 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaInspection1?.setOperation)
                {
                    await
                    QaInspection1.
                    setOperation(relatedOperation1);
                }
            
                const relatedOperation2 = await Operations.findOne({
                    offset: Math.floor(Math.random() * (await Operations.count())),
                });
                const QaInspection2 = await QaInspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaInspection2?.setOperation)
                {
                    await
                    QaInspection2.
                    setOperation(relatedOperation2);
                }
            
        }
        
    
        
    
        
    
        
            
            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);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateQaResultWithQa_inspection() {
            
                const relatedQa_inspection0 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const QaResult0 = await QaResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaResult0?.setQa_inspection)
                {
                    await
                    QaResult0.
                    setQa_inspection(relatedQa_inspection0);
                }
            
                const relatedQa_inspection1 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const QaResult1 = await QaResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaResult1?.setQa_inspection)
                {
                    await
                    QaResult1.
                    setQa_inspection(relatedQa_inspection1);
                }
            
                const relatedQa_inspection2 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const QaResult2 = await QaResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaResult2?.setQa_inspection)
                {
                    await
                    QaResult2.
                    setQa_inspection(relatedQa_inspection2);
                }
            
        }
        
    
        
            
            async function associateQaResultWithCharacteristic() {
            
                const relatedCharacteristic0 = await QaCharacteristics.findOne({
                    offset: Math.floor(Math.random() * (await QaCharacteristics.count())),
                });
                const QaResult0 = await QaResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QaResult0?.setCharacteristic)
                {
                    await
                    QaResult0.
                    setCharacteristic(relatedCharacteristic0);
                }
            
                const relatedCharacteristic1 = await QaCharacteristics.findOne({
                    offset: Math.floor(Math.random() * (await QaCharacteristics.count())),
                });
                const QaResult1 = await QaResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QaResult1?.setCharacteristic)
                {
                    await
                    QaResult1.
                    setCharacteristic(relatedCharacteristic1);
                }
            
                const relatedCharacteristic2 = await QaCharacteristics.findOne({
                    offset: Math.floor(Math.random() * (await QaCharacteristics.count())),
                });
                const QaResult2 = await QaResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QaResult2?.setCharacteristic)
                {
                    await
                    QaResult2.
                    setCharacteristic(relatedCharacteristic2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
            
            async function associateNonconformanceWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setItem)
                {
                    await
                    Nonconformance0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setItem)
                {
                    await
                    Nonconformance1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setItem)
                {
                    await
                    Nonconformance2.
                    setItem(relatedItem2);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setLot)
                {
                    await
                    Nonconformance0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setLot)
                {
                    await
                    Nonconformance1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setLot)
                {
                    await
                    Nonconformance2.
                    setLot(relatedLot2);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithWork_order() {
            
                const relatedWork_order0 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setWork_order)
                {
                    await
                    Nonconformance0.
                    setWork_order(relatedWork_order0);
                }
            
                const relatedWork_order1 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setWork_order)
                {
                    await
                    Nonconformance1.
                    setWork_order(relatedWork_order1);
                }
            
                const relatedWork_order2 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setWork_order)
                {
                    await
                    Nonconformance2.
                    setWork_order(relatedWork_order2);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithQa_inspection() {
            
                const relatedQa_inspection0 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setQa_inspection)
                {
                    await
                    Nonconformance0.
                    setQa_inspection(relatedQa_inspection0);
                }
            
                const relatedQa_inspection1 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setQa_inspection)
                {
                    await
                    Nonconformance1.
                    setQa_inspection(relatedQa_inspection1);
                }
            
                const relatedQa_inspection2 = await QaInspections.findOne({
                    offset: Math.floor(Math.random() * (await QaInspections.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setQa_inspection)
                {
                    await
                    Nonconformance2.
                    setQa_inspection(relatedQa_inspection2);
                }
            
        }
        
    
        
    
        
            
            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);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateNonconformanceWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setOwner)
                {
                    await
                    Nonconformance0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setOwner)
                {
                    await
                    Nonconformance1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setOwner)
                {
                    await
                    Nonconformance2.
                    setOwner(relatedOwner2);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
    
        
    
        
            
            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);
                }
            
        }
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Suppliers.bulkCreate(SuppliersData);
                
            
            
                
                await Customers.bulkCreate(CustomersData);
                
            
            
                
                await Uoms.bulkCreate(UomsData);
                
            
            
                
                await ItemCategories.bulkCreate(ItemCategoriesData);
                
            
            
                
                await Items.bulkCreate(ItemsData);
                
            
            
                
                await Warehouses.bulkCreate(WarehousesData);
                
            
            
                
                await Locations.bulkCreate(LocationsData);
                
            
            
                
                await Lots.bulkCreate(LotsData);
                
            
            
                
                await InventoryTransactions.bulkCreate(InventoryTransactionsData);
                
            
            
                
                await Boms.bulkCreate(BomsData);
                
            
            
                
                await BomLines.bulkCreate(BomLinesData);
                
            
            
                
                await Routes.bulkCreate(RoutesData);
                
            
            
                
                await Operations.bulkCreate(OperationsData);
                
            
            
                
                await Machines.bulkCreate(MachinesData);
                
            
            
                
                await MachineDowntimeEvents.bulkCreate(MachineDowntimeEventsData);
                
            
            
                
                await WorkCenters.bulkCreate(WorkCentersData);
                
            
            
                
                await ProductionLines.bulkCreate(ProductionLinesData);
                
            
            
                
                await WorkOrders.bulkCreate(WorkOrdersData);
                
            
            
                
                await WorkOrderOperations.bulkCreate(WorkOrderOperationsData);
                
            
            
                
                await MaterialIssues.bulkCreate(MaterialIssuesData);
                
            
            
                
                await MaterialIssueLines.bulkCreate(MaterialIssueLinesData);
                
            
            
                
                await Receipts.bulkCreate(ReceiptsData);
                
            
            
                
                await ReceiptLines.bulkCreate(ReceiptLinesData);
                
            
            
                
                await Shipments.bulkCreate(ShipmentsData);
                
            
            
                
                await ShipmentLines.bulkCreate(ShipmentLinesData);
                
            
            
                
                await QaInspectionPlans.bulkCreate(QaInspectionPlansData);
                
            
            
                
                await QaCharacteristics.bulkCreate(QaCharacteristicsData);
                
            
            
                
                await QaInspections.bulkCreate(QaInspectionsData);
                
            
            
                
                await QaResults.bulkCreate(QaResultsData);
                
            
            
                
                await Nonconformances.bulkCreate(NonconformancesData);
                
            
            
                
                await AuditEvents.bulkCreate(AuditEventsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateItemWithCategory(),
                    
                
                    
                        
                        await associateItemWithUom(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateLocationWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateLotWithItem(),
                    
                
                    
                
                    
                
                    
                        
                        await associateLotWithSupplier(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryTransactionWithItem(),
                    
                
                    
                        
                        await associateInventoryTransactionWithLot(),
                    
                
                    
                        
                        await associateInventoryTransactionWithFrom_location(),
                    
                
                    
                        
                        await associateInventoryTransactionWithTo_location(),
                    
                
                    
                
                    
                        
                        await associateInventoryTransactionWithUom(),
                    
                
                    
                
                    
                        
                        await associateInventoryTransactionWithWork_order(),
                    
                
                    
                        
                        await associateInventoryTransactionWithQa_inspection(),
                    
                
                    
                        
                        await associateInventoryTransactionWithPerformed_by(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateBomWithParent_item(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateBomLineWithBom(),
                    
                
                    
                        
                        await associateBomLineWithComponent_item(),
                    
                
                    
                
                    
                        
                        await associateBomLineWithUom(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateOperationWithRoute(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateMachineDowntimeEventWithMachine(),
                    
                
                    
                        
                        await associateMachineDowntimeEventWithWork_order(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMachineDowntimeEventWithReported_by(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateProductionLineWithWork_center(),
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateWorkOrderWithItem(),
                    
                
                    
                        
                        await associateWorkOrderWithBom(),
                    
                
                    
                        
                        await associateWorkOrderWithRoute(),
                    
                
                    
                        
                        await associateWorkOrderWithCustomer(),
                    
                
                    
                
                    
                
                    
                        
                        await associateWorkOrderWithUom(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWorkOrderWithProduction_line(),
                    
                
                    
                        
                        await associateWorkOrderWithPrimary_machine(),
                    
                
                    
                        
                        await associateWorkOrderWithPlanner(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateWorkOrderOperationWithWork_order(),
                    
                
                    
                        
                        await associateWorkOrderOperationWithOperation(),
                    
                
                    
                
                    
                
                    
                        
                        await associateWorkOrderOperationWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateMaterialIssueWithWork_order(),
                    
                
                    
                
                    
                        
                        await associateMaterialIssueWithIssued_by(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateMaterialIssueLineWithMaterial_issue(),
                    
                
                    
                        
                        await associateMaterialIssueLineWithComponent_item(),
                    
                
                    
                        
                        await associateMaterialIssueLineWithLot(),
                    
                
                    
                        
                        await associateMaterialIssueLineWithFrom_location(),
                    
                
                    
                
                    
                        
                        await associateMaterialIssueLineWithUom(),
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateReceiptWithSupplier(),
                    
                
                    
                
                    
                
                    
                        
                        await associateReceiptWithReceived_by(),
                    
                
                    
                
                    
                        
                        await associateReceiptWithTo_location(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateReceiptLineWithReceipt(),
                    
                
                    
                        
                        await associateReceiptLineWithItem(),
                    
                
                    
                        
                        await associateReceiptLineWithLot(),
                    
                
                    
                
                    
                        
                        await associateReceiptLineWithUom(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateShipmentWithCustomer(),
                    
                
                    
                
                    
                
                    
                        
                        await associateShipmentWithFrom_location(),
                    
                
                    
                        
                        await associateShipmentWithShipped_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateShipmentLineWithShipment(),
                    
                
                    
                        
                        await associateShipmentLineWithItem(),
                    
                
                    
                        
                        await associateShipmentLineWithLot(),
                    
                
                    
                
                    
                        
                        await associateShipmentLineWithUom(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateQaInspectionPlanWithItem(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateQaCharacteristicWithInspection_plan(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateQaInspectionWithInspection_plan(),
                    
                
                    
                        
                        await associateQaInspectionWithItem(),
                    
                
                    
                        
                        await associateQaInspectionWithLot(),
                    
                
                    
                        
                        await associateQaInspectionWithWork_order(),
                    
                
                    
                        
                        await associateQaInspectionWithOperation(),
                    
                
                    
                
                    
                
                    
                        
                        await associateQaInspectionWithInspector(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateQaResultWithQa_inspection(),
                    
                
                    
                        
                        await associateQaResultWithCharacteristic(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithItem(),
                    
                
                    
                        
                        await associateNonconformanceWithLot(),
                    
                
                    
                        
                        await associateNonconformanceWithWork_order(),
                    
                
                    
                        
                        await associateNonconformanceWithQa_inspection(),
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithReported_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithOwner(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAuditEventWithActor(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('suppliers', null, {});
            
            
            await queryInterface.bulkDelete('customers', null, {});
            
            
            await queryInterface.bulkDelete('uoms', null, {});
            
            
            await queryInterface.bulkDelete('item_categories', null, {});
            
            
            await queryInterface.bulkDelete('items', null, {});
            
            
            await queryInterface.bulkDelete('warehouses', null, {});
            
            
            await queryInterface.bulkDelete('locations', null, {});
            
            
            await queryInterface.bulkDelete('lots', null, {});
            
            
            await queryInterface.bulkDelete('inventory_transactions', null, {});
            
            
            await queryInterface.bulkDelete('boms', null, {});
            
            
            await queryInterface.bulkDelete('bom_lines', null, {});
            
            
            await queryInterface.bulkDelete('routes', null, {});
            
            
            await queryInterface.bulkDelete('operations', null, {});
            
            
            await queryInterface.bulkDelete('machines', null, {});
            
            
            await queryInterface.bulkDelete('machine_downtime_events', null, {});
            
            
            await queryInterface.bulkDelete('work_centers', null, {});
            
            
            await queryInterface.bulkDelete('production_lines', null, {});
            
            
            await queryInterface.bulkDelete('work_orders', null, {});
            
            
            await queryInterface.bulkDelete('work_order_operations', null, {});
            
            
            await queryInterface.bulkDelete('material_issues', null, {});
            
            
            await queryInterface.bulkDelete('material_issue_lines', null, {});
            
            
            await queryInterface.bulkDelete('receipts', null, {});
            
            
            await queryInterface.bulkDelete('receipt_lines', null, {});
            
            
            await queryInterface.bulkDelete('shipments', null, {});
            
            
            await queryInterface.bulkDelete('shipment_lines', null, {});
            
            
            await queryInterface.bulkDelete('qa_inspection_plans', null, {});
            
            
            await queryInterface.bulkDelete('qa_characteristics', null, {});
            
            
            await queryInterface.bulkDelete('qa_inspections', null, {});
            
            
            await queryInterface.bulkDelete('qa_results', null, {});
            
            
            await queryInterface.bulkDelete('nonconformances', null, {});
            
            
            await queryInterface.bulkDelete('audit_events', null, {});
            
        
    },
};