





















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






const Suppliers = db.suppliers;

const Customers = db.customers;

const Uoms = db.uoms;

const Warehouses = db.warehouses;

const Locations = db.locations;

const Items = db.items;

const ApprovedVendors = db.approved_vendors;

const Boms = db.boms;

const BomLines = db.bom_lines;

const Routings = db.routings;

const WorkCenters = db.work_centers;

const RoutingOperations = db.routing_operations;

const Machines = db.machines;

const MachineEvents = db.machine_events;

const ReasonCodes = db.reason_codes;

const WorkOrders = db.work_orders;

const WorkOrderOperations = db.work_order_operations;

const Lots = db.lots;

const Serials = db.serials;

const InventoryBalances = db.inventory_balances;

const InventoryMovements = db.inventory_movements;

const PurchaseOrders = db.purchase_orders;

const PurchaseOrderLines = db.purchase_order_lines;

const InspectionPlans = db.inspection_plans;

const InspectionCharacteristics = db.inspection_characteristics;

const Inspections = db.inspections;

const InspectionResults = db.inspection_results;

const Nonconformances = db.nonconformances;

const DispositionCodes = db.disposition_codes;

const CapaActions = db.capa_actions;

const AuditLogs = db.audit_logs;







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



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



const UomsData = [
    
    {
    
        
        
            
                "uom_name": "Alan Turing",
            
        
    
        
        
            
                "uom_code": "Alan Turing",
            
        
    
        
        
            
                "base_multiplier": 9.76,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "uom_name": "Marie Curie",
            
        
    
        
        
            
                "uom_code": "Alan Turing",
            
        
    
        
        
            
                "base_multiplier": 1.24,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "uom_name": "Grace Hopper",
            
        
    
        
        
            
                "uom_code": "Grace Hopper",
            
        
    
        
        
            
                "base_multiplier": 4.79,
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "uom_name": "Alan Turing",
            
        
    
        
        
            
                "uom_code": "Grace Hopper",
            
        
    
        
        
            
                "base_multiplier": 7.8,
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "uom_name": "Marie Curie",
            
        
    
        
        
            
                "uom_code": "Ada Lovelace",
            
        
    
        
        
            
                "base_multiplier": 1.06,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



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



const LocationsData = [
    
    {
    
        
        
            
                "location_name": "Marie Curie",
            
        
    
        
        
            
                "location_code": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "location_name": "Grace Hopper",
            
        
    
        
        
            
                "location_code": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "location_name": "Alan Turing",
            
        
    
        
        
            
                "location_code": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "location_name": "Marie Curie",
            
        
    
        
        
            
                "location_code": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "location_name": "Grace Hopper",
            
        
    
        
        
            
                "location_code": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
];



const ItemsData = [
    
    {
    
        
        
            
                "item_name": "Ada Lovelace",
            
        
    
        
        
            
                "item_code": "Ada Lovelace",
            
        
    
        
        
            
                "item_type": "raw_material",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_tracked": false,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "standard_cost": 7.19,
            
        
    
        
        
            
                "shelf_life_days": 8,
            
        
    
        
        
            
                "description": "Marie Curie",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "item_name": "Alan Turing",
            
        
    
        
        
            
                "item_code": "Marie Curie",
            
        
    
        
        
            
                "item_type": "subassembly",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "standard_cost": 6.64,
            
        
    
        
        
            
                "shelf_life_days": 7,
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "item_name": "Marie Curie",
            
        
    
        
        
            
                "item_code": "Ada Lovelace",
            
        
    
        
        
            
                "item_type": "raw_material",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "standard_cost": 5.24,
            
        
    
        
        
            
                "shelf_life_days": 9,
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "item_name": "Ada Lovelace",
            
        
    
        
        
            
                "item_code": "Marie Curie",
            
        
    
        
        
            
                "item_type": "consumable",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": true,
            
        
    
        
        
            
                "standard_cost": 1.02,
            
        
    
        
        
            
                "shelf_life_days": 5,
            
        
    
        
        
            
                "description": "Ada Lovelace",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "item_name": "Grace Hopper",
            
        
    
        
        
            
                "item_code": "Alan Turing",
            
        
    
        
        
            
                "item_type": "packaging",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lot_tracked": true,
            
        
    
        
        
            
                "serial_tracked": false,
            
        
    
        
        
            
                "standard_cost": 4.59,
            
        
    
        
        
            
                "shelf_life_days": 7,
            
        
    
        
        
            
                "description": "Alan Turing",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
];



const ApprovedVendorsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_item_code": "Grace Hopper",
            
        
    
        
        
            
                "lead_time_days": 2,
            
        
    
        
        
            
                "last_price": 3.02,
            
        
    
        
        
            
                "preferred": false,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_item_code": "Ada Lovelace",
            
        
    
        
        
            
                "lead_time_days": 6,
            
        
    
        
        
            
                "last_price": 4.89,
            
        
    
        
        
            
                "preferred": true,
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_item_code": "Ada Lovelace",
            
        
    
        
        
            
                "lead_time_days": 2,
            
        
    
        
        
            
                "last_price": 5.96,
            
        
    
        
        
            
                "preferred": false,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_item_code": "Grace Hopper",
            
        
    
        
        
            
                "lead_time_days": 3,
            
        
    
        
        
            
                "last_price": 7.94,
            
        
    
        
        
            
                "preferred": false,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_item_code": "Marie Curie",
            
        
    
        
        
            
                "lead_time_days": 1,
            
        
    
        
        
            
                "last_price": 9.76,
            
        
    
        
        
            
                "preferred": true,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



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



const BomLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 8.36,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scrap_factor_ppm": 9,
            
        
    
        
        
            
                "issue_method": "backflush",
            
        
    
        
        
            
                "line_no": 4,
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 5.63,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scrap_factor_ppm": 3,
            
        
    
        
        
            
                "issue_method": "manual",
            
        
    
        
        
            
                "line_no": 8,
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 2.55,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scrap_factor_ppm": 8,
            
        
    
        
        
            
                "issue_method": "manual",
            
        
    
        
        
            
                "line_no": 2,
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 4.51,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scrap_factor_ppm": 7,
            
        
    
        
        
            
                "issue_method": "backflush",
            
        
    
        
        
            
                "line_no": 8,
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_per": 6.03,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scrap_factor_ppm": 8,
            
        
    
        
        
            
                "issue_method": "backflush",
            
        
    
        
        
            
                "line_no": 7,
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



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



const WorkCentersData = [
    
    {
    
        
        
            
                "work_center_name": "Ada Lovelace",
            
        
    
        
        
            
                "work_center_code": "Ada Lovelace",
            
        
    
        
        
            
                "default_labor_rate": 0.81,
            
        
    
        
        
            
                "default_machine_rate": 2.79,
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "work_center_name": "Grace Hopper",
            
        
    
        
        
            
                "work_center_code": "Marie Curie",
            
        
    
        
        
            
                "default_labor_rate": 1.26,
            
        
    
        
        
            
                "default_machine_rate": 1.39,
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "work_center_name": "Ada Lovelace",
            
        
    
        
        
            
                "work_center_code": "Grace Hopper",
            
        
    
        
        
            
                "default_labor_rate": 9.89,
            
        
    
        
        
            
                "default_machine_rate": 9.9,
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "work_center_name": "Grace Hopper",
            
        
    
        
        
            
                "work_center_code": "Grace Hopper",
            
        
    
        
        
            
                "default_labor_rate": 1.59,
            
        
    
        
        
            
                "default_machine_rate": 6.22,
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "work_center_name": "Alan Turing",
            
        
    
        
        
            
                "work_center_code": "Grace Hopper",
            
        
    
        
        
            
                "default_labor_rate": 8.59,
            
        
    
        
        
            
                "default_machine_rate": 2.55,
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
];



const RoutingOperationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_no": 9,
            
        
    
        
        
            
                "operation_name": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_minutes": 6.33,
            
        
    
        
        
            
                "run_minutes_per_unit": 8.45,
            
        
    
        
        
            
                "work_instructions": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_no": 7,
            
        
    
        
        
            
                "operation_name": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_minutes": 6.74,
            
        
    
        
        
            
                "run_minutes_per_unit": 8.67,
            
        
    
        
        
            
                "work_instructions": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_no": 9,
            
        
    
        
        
            
                "operation_name": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_minutes": 0.54,
            
        
    
        
        
            
                "run_minutes_per_unit": 3.29,
            
        
    
        
        
            
                "work_instructions": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_no": 6,
            
        
    
        
        
            
                "operation_name": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_minutes": 1.27,
            
        
    
        
        
            
                "run_minutes_per_unit": 4.98,
            
        
    
        
        
            
                "work_instructions": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_no": 7,
            
        
    
        
        
            
                "operation_name": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "setup_minutes": 9.72,
            
        
    
        
        
            
                "run_minutes_per_unit": 3.07,
            
        
    
        
        
            
                "work_instructions": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const MachinesData = [
    
    {
    
        
        
            
                "machine_name": "Marie Curie",
            
        
    
        
        
            
                "machine_code": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "idle",
            
        
    
        
        
            
                "commissioned_on": new Date(Date.now()),
            
        
    
        
        
            
                "manufacturer": "Grace Hopper",
            
        
    
        
        
            
                "model": "Alan Turing",
            
        
    
        
        
            
                "serial_number": "Marie Curie",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "machine_name": "Ada Lovelace",
            
        
    
        
        
            
                "machine_code": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "offline",
            
        
    
        
        
            
                "commissioned_on": new Date(Date.now()),
            
        
    
        
        
            
                "manufacturer": "Grace Hopper",
            
        
    
        
        
            
                "model": "Ada Lovelace",
            
        
    
        
        
            
                "serial_number": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "machine_name": "Marie Curie",
            
        
    
        
        
            
                "machine_code": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "maintenance",
            
        
    
        
        
            
                "commissioned_on": new Date(Date.now()),
            
        
    
        
        
            
                "manufacturer": "Ada Lovelace",
            
        
    
        
        
            
                "model": "Ada Lovelace",
            
        
    
        
        
            
                "serial_number": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "machine_name": "Marie Curie",
            
        
    
        
        
            
                "machine_code": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "offline",
            
        
    
        
        
            
                "commissioned_on": new Date(Date.now()),
            
        
    
        
        
            
                "manufacturer": "Grace Hopper",
            
        
    
        
        
            
                "model": "Grace Hopper",
            
        
    
        
        
            
                "serial_number": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "machine_name": "Marie Curie",
            
        
    
        
        
            
                "machine_code": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "idle",
            
        
    
        
        
            
                "commissioned_on": new Date(Date.now()),
            
        
    
        
        
            
                "manufacturer": "Marie Curie",
            
        
    
        
        
            
                "model": "Grace Hopper",
            
        
    
        
        
            
                "serial_number": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
];



const MachineEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "setup",
            
        
    
        
        
            
                "status": "offline",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "maintenance",
            
        
    
        
        
            
                "status": "running",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "maintenance",
            
        
    
        
        
            
                "status": "offline",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "maintenance",
            
        
    
        
        
            
                "status": "maintenance",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "downtime",
            
        
    
        
        
            
                "status": "down",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
];



const ReasonCodesData = [
    
    {
    
        
        
            
                "reason_name": "Ada Lovelace",
            
        
    
        
        
            
                "reason_code": "Grace Hopper",
            
        
    
        
        
            
                "category": "quality",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "reason_name": "Marie Curie",
            
        
    
        
        
            
                "reason_code": "Marie Curie",
            
        
    
        
        
            
                "category": "quality",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "reason_name": "Ada Lovelace",
            
        
    
        
        
            
                "reason_code": "Alan Turing",
            
        
    
        
        
            
                "category": "downtime",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "reason_name": "Alan Turing",
            
        
    
        
        
            
                "reason_code": "Alan Turing",
            
        
    
        
        
            
                "category": "scrap",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "reason_name": "Grace Hopper",
            
        
    
        
        
            
                "reason_code": "Ada Lovelace",
            
        
    
        
        
            
                "category": "quality",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



const WorkOrdersData = [
    
    {
    
        
        
            
                "work_order_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "planned_quantity": 8.76,
            
        
    
        
        
            
                "completed_quantity": 4.25,
            
        
    
        
        
            
                "scrap_quantity": 5.48,
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "released_at": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "planned_quantity": 6.88,
            
        
    
        
        
            
                "completed_quantity": 2.6,
            
        
    
        
        
            
                "scrap_quantity": 3.24,
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "released_at": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "Marie Curie",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "released",
            
        
    
        
        
            
                "planned_quantity": 2.61,
            
        
    
        
        
            
                "completed_quantity": 2.33,
            
        
    
        
        
            
                "scrap_quantity": 1.58,
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "released_at": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "Alan Turing",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "planned_quantity": 2.71,
            
        
    
        
        
            
                "completed_quantity": 6.73,
            
        
    
        
        
            
                "scrap_quantity": 5.44,
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "released_at": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "work_order_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "planned_quantity": 4.72,
            
        
    
        
        
            
                "completed_quantity": 2.7,
            
        
    
        
        
            
                "scrap_quantity": 7.67,
            
        
    
        
        
            
                "scheduled_start": new Date(Date.now()),
            
        
    
        
        
            
                "scheduled_end": new Date(Date.now()),
            
        
    
        
        
            
                "released_at": new Date(Date.now()),
            
        
    
        
        
            
                "completed_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "priority": "Marie Curie",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const WorkOrderOperationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_no": 6,
            
        
    
        
        
            
                "operation_name": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 7.76,
            
        
    
        
        
            
                "scrap_quantity": 7.11,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_no": 5,
            
        
    
        
        
            
                "operation_name": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "skipped",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 9.08,
            
        
    
        
        
            
                "scrap_quantity": 7.46,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_no": 3,
            
        
    
        
        
            
                "operation_name": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 1.51,
            
        
    
        
        
            
                "scrap_quantity": 6.66,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_no": 6,
            
        
    
        
        
            
                "operation_name": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "skipped",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 9.61,
            
        
    
        
        
            
                "scrap_quantity": 0.61,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "operation_no": 7,
            
        
    
        
        
            
                "operation_name": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "started_at": new Date(Date.now()),
            
        
    
        
        
            
                "ended_at": new Date(Date.now()),
            
        
    
        
        
            
                "good_quantity": 5.12,
            
        
    
        
        
            
                "scrap_quantity": 8.87,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
];



const LotsData = [
    
    {
    
        
        
            
                "lot_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "expires_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_lot_number": "Marie Curie",
            
        
    
        
        
            
                "status": "consumed",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "lot_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "expires_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_lot_number": "Ada Lovelace",
            
        
    
        
        
            
                "status": "released",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "lot_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "expires_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_lot_number": "Alan Turing",
            
        
    
        
        
            
                "status": "available",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "lot_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "expires_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_lot_number": "Marie Curie",
            
        
    
        
        
            
                "status": "released",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "lot_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "expires_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "supplier_lot_number": "Marie Curie",
            
        
    
        
        
            
                "status": "scrapped",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
];



const SerialsData = [
    
    {
    
        
        
            
                "serial_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "available",
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "serial_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "shipped",
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "serial_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "consumed",
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "serial_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "released",
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "serial_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "available",
            
        
    
        
        
            
                "manufactured_at": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const InventoryBalancesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "on_hand_quantity": 4.65,
            
        
    
        
        
            
                "allocated_quantity": 3.41,
            
        
    
        
        
            
                "available_quantity": 1.07,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "on_hand_quantity": 7.11,
            
        
    
        
        
            
                "allocated_quantity": 8.05,
            
        
    
        
        
            
                "available_quantity": 1.07,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "on_hand_quantity": 2.51,
            
        
    
        
        
            
                "allocated_quantity": 5.7,
            
        
    
        
        
            
                "available_quantity": 0.53,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "on_hand_quantity": 0.48,
            
        
    
        
        
            
                "allocated_quantity": 1.36,
            
        
    
        
        
            
                "available_quantity": 0.8,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "on_hand_quantity": 6.21,
            
        
    
        
        
            
                "allocated_quantity": 8.22,
            
        
    
        
        
            
                "available_quantity": 8.64,
            
        
    
        
        
            
                "last_counted_at": new Date(Date.now()),
            
        
    
    },
    
];



const InventoryMovementsData = [
    
    {
    
        
        
            
                "movement_number": "Alan Turing",
            
        
    
        
        
            
                "movement_type": "scrap",
            
        
    
        
        
            
                "movement_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 9.47,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "reference": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "movement_number": "Alan Turing",
            
        
    
        
        
            
                "movement_type": "adjustment",
            
        
    
        
        
            
                "movement_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 4.84,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "reference": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "movement_number": "Grace Hopper",
            
        
    
        
        
            
                "movement_type": "scrap",
            
        
    
        
        
            
                "movement_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 2.58,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "reference": "Ada Lovelace",
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "movement_number": "Marie Curie",
            
        
    
        
        
            
                "movement_type": "issue",
            
        
    
        
        
            
                "movement_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 2.17,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "reference": "Grace Hopper",
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "movement_number": "Alan Turing",
            
        
    
        
        
            
                "movement_type": "customer_return",
            
        
    
        
        
            
                "movement_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 6.95,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "reference": "Marie Curie",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const PurchaseOrdersData = [
    
    {
    
        
        
            
                "purchase_order_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "ordered_at": new Date(Date.now()),
            
        
    
        
        
            
                "expected_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "purchase_order_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "submitted",
            
        
    
        
        
            
                "ordered_at": new Date(Date.now()),
            
        
    
        
        
            
                "expected_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "purchase_order_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "partially_received",
            
        
    
        
        
            
                "ordered_at": new Date(Date.now()),
            
        
    
        
        
            
                "expected_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "purchase_order_number": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "ordered_at": new Date(Date.now()),
            
        
    
        
        
            
                "expected_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                "purchase_order_number": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "ordered_at": new Date(Date.now()),
            
        
    
        
        
            
                "expected_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const PurchaseOrderLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_no": 3,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 3.05,
            
        
    
        
        
            
                "received_quantity": 0.22,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 3.53,
            
        
    
        
        
            
                "need_by": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_no": 6,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 0.97,
            
        
    
        
        
            
                "received_quantity": 9.54,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 3.98,
            
        
    
        
        
            
                "need_by": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_no": 5,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 4.02,
            
        
    
        
        
            
                "received_quantity": 8.75,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 4.08,
            
        
    
        
        
            
                "need_by": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_no": 5,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 2.0,
            
        
    
        
        
            
                "received_quantity": 9.59,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 3.91,
            
        
    
        
        
            
                "need_by": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_no": 5,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "ordered_quantity": 7.62,
            
        
    
        
        
            
                "received_quantity": 1.58,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "unit_price": 9.8,
            
        
    
        
        
            
                "need_by": new Date(Date.now()),
            
        
    
        
        
            
                "notes": "Alan Turing",
            
        
    
    },
    
];



const InspectionPlansData = [
    
    {
    
        
        
            
                "plan_name": "Alan Turing",
            
        
    
        
        
            
                "plan_code": "Ada Lovelace",
            
        
    
        
        
            
                "plan_type": "in_process",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "instructions": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "plan_name": "Grace Hopper",
            
        
    
        
        
            
                "plan_code": "Marie Curie",
            
        
    
        
        
            
                "plan_type": "in_process",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "obsolete",
            
        
    
        
        
            
                "instructions": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "plan_name": "Marie Curie",
            
        
    
        
        
            
                "plan_code": "Marie Curie",
            
        
    
        
        
            
                "plan_type": "incoming",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "instructions": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "plan_name": "Marie Curie",
            
        
    
        
        
            
                "plan_code": "Grace Hopper",
            
        
    
        
        
            
                "plan_type": "in_process",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "instructions": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "plan_name": "Alan Turing",
            
        
    
        
        
            
                "plan_code": "Ada Lovelace",
            
        
    
        
        
            
                "plan_type": "in_process",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "obsolete",
            
        
    
        
        
            
                "instructions": "Grace Hopper",
            
        
    
    },
    
];



const InspectionCharacteristicsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_no": 3,
            
        
    
        
        
            
                "characteristic_name": "Marie Curie",
            
        
    
        
        
            
                "data_type": "attribute",
            
        
    
        
        
            
                "target_value": 4.7,
            
        
    
        
        
            
                "lower_limit": 7.95,
            
        
    
        
        
            
                "upper_limit": 3.69,
            
        
    
        
        
            
                "unit": "Ada Lovelace",
            
        
    
        
        
            
                "critical": false,
            
        
    
        
        
            
                "method": "Grace Hopper",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_no": 3,
            
        
    
        
        
            
                "characteristic_name": "Ada Lovelace",
            
        
    
        
        
            
                "data_type": "attribute",
            
        
    
        
        
            
                "target_value": 0.73,
            
        
    
        
        
            
                "lower_limit": 7.04,
            
        
    
        
        
            
                "upper_limit": 7.04,
            
        
    
        
        
            
                "unit": "Ada Lovelace",
            
        
    
        
        
            
                "critical": false,
            
        
    
        
        
            
                "method": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_no": 9,
            
        
    
        
        
            
                "characteristic_name": "Grace Hopper",
            
        
    
        
        
            
                "data_type": "attribute",
            
        
    
        
        
            
                "target_value": 2.91,
            
        
    
        
        
            
                "lower_limit": 8.2,
            
        
    
        
        
            
                "upper_limit": 7.52,
            
        
    
        
        
            
                "unit": "Grace Hopper",
            
        
    
        
        
            
                "critical": true,
            
        
    
        
        
            
                "method": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_no": 9,
            
        
    
        
        
            
                "characteristic_name": "Marie Curie",
            
        
    
        
        
            
                "data_type": "attribute",
            
        
    
        
        
            
                "target_value": 8.57,
            
        
    
        
        
            
                "lower_limit": 8.53,
            
        
    
        
        
            
                "upper_limit": 6.04,
            
        
    
        
        
            
                "unit": "Marie Curie",
            
        
    
        
        
            
                "critical": false,
            
        
    
        
        
            
                "method": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sequence_no": 3,
            
        
    
        
        
            
                "characteristic_name": "Ada Lovelace",
            
        
    
        
        
            
                "data_type": "numeric",
            
        
    
        
        
            
                "target_value": 3.43,
            
        
    
        
        
            
                "lower_limit": 2.94,
            
        
    
        
        
            
                "upper_limit": 6.35,
            
        
    
        
        
            
                "unit": "Grace Hopper",
            
        
    
        
        
            
                "critical": false,
            
        
    
        
        
            
                "method": "Marie Curie",
            
        
    
    },
    
];



const InspectionsData = [
    
    {
    
        
        
            
                "inspection_number": "Marie Curie",
            
        
    
        
        
            
                "inspection_type": "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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspected_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "pass",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "Ada Lovelace",
            
        
    
        
        
            
                "inspection_type": "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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspected_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "pending",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "Grace Hopper",
            
        
    
        
        
            
                "inspection_type": "final",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspected_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "pending",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "Marie Curie",
            
        
    
        
        
            
                "inspection_type": "in_process",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspected_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "pass",
            
        
    
        
        
            
                "notes": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "inspection_number": "Grace Hopper",
            
        
    
        
        
            
                "inspection_type": "final",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "inspected_at": new Date(Date.now()),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result": "conditional",
            
        
    
        
        
            
                "notes": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const InspectionResultsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_value": 4.53,
            
        
    
        
        
            
                "attribute_value": "na",
            
        
    
        
        
            
                "judgement": "na",
            
        
    
        
        
            
                "comments": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_value": 4.74,
            
        
    
        
        
            
                "attribute_value": "pass",
            
        
    
        
        
            
                "judgement": "na",
            
        
    
        
        
            
                "comments": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_value": 0.06,
            
        
    
        
        
            
                "attribute_value": "pass",
            
        
    
        
        
            
                "judgement": "fail",
            
        
    
        
        
            
                "comments": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_value": 4.62,
            
        
    
        
        
            
                "attribute_value": "na",
            
        
    
        
        
            
                "judgement": "pass",
            
        
    
        
        
            
                "comments": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_value": 8.91,
            
        
    
        
        
            
                "attribute_value": "na",
            
        
    
        
        
            
                "judgement": "pass",
            
        
    
        
        
            
                "comments": "Grace Hopper",
            
        
    
    },
    
];



const NonconformancesData = [
    
    {
    
        
        
            
                "ncr_number": "Marie Curie",
            
        
    
        
        
            
                "source": "customer",
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                "problem_description": "Alan Turing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "containment_actions": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "Marie Curie",
            
        
    
        
        
            
                "source": "final",
            
        
    
        
        
            
                "severity": "minor",
            
        
    
        
        
            
                "status": "under_review",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                "problem_description": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "containment_actions": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "Alan Turing",
            
        
    
        
        
            
                "source": "internal_audit",
            
        
    
        
        
            
                "severity": "minor",
            
        
    
        
        
            
                "status": "under_review",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                "problem_description": "Marie Curie",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "containment_actions": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "Ada Lovelace",
            
        
    
        
        
            
                "source": "final",
            
        
    
        
        
            
                "severity": "minor",
            
        
    
        
        
            
                "status": "under_review",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                "problem_description": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "containment_actions": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "ncr_number": "Ada Lovelace",
            
        
    
        
        
            
                "source": "internal_audit",
            
        
    
        
        
            
                "severity": "major",
            
        
    
        
        
            
                "status": "void",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reported_at": new Date(Date.now()),
            
        
    
        
        
            
                "problem_description": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "containment_actions": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const DispositionCodesData = [
    
    {
    
        
        
            
                "disposition_name": "Alan Turing",
            
        
    
        
        
            
                "disposition_code": "Marie Curie",
            
        
    
        
        
            
                "category": "repair",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "disposition_name": "Marie Curie",
            
        
    
        
        
            
                "disposition_code": "Alan Turing",
            
        
    
        
        
            
                "category": "use_as_is",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "disposition_name": "Grace Hopper",
            
        
    
        
        
            
                "disposition_code": "Grace Hopper",
            
        
    
        
        
            
                "category": "return_to_supplier",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
    {
    
        
        
            
                "disposition_name": "Ada Lovelace",
            
        
    
        
        
            
                "disposition_code": "Ada Lovelace",
            
        
    
        
        
            
                "category": "repair",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                "disposition_name": "Marie Curie",
            
        
    
        
        
            
                "disposition_code": "Alan Turing",
            
        
    
        
        
            
                "category": "return_to_supplier",
            
        
    
        
        
            
                "active": false,
            
        
    
    },
    
];



const CapaActionsData = [
    
    {
    
        
        
            
                "capa_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "corrective",
            
        
    
        
        
            
                "status": "implementing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                "root_cause": "Grace Hopper",
            
        
    
        
        
            
                "action_plan": "Grace Hopper",
            
        
    
        
        
            
                "effectiveness_check": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "capa_number": "Grace Hopper",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "preventive",
            
        
    
        
        
            
                "status": "verifying",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                "root_cause": "Marie Curie",
            
        
    
        
        
            
                "action_plan": "Grace Hopper",
            
        
    
        
        
            
                "effectiveness_check": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "capa_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "corrective",
            
        
    
        
        
            
                "status": "implementing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                "root_cause": "Grace Hopper",
            
        
    
        
        
            
                "action_plan": "Ada Lovelace",
            
        
    
        
        
            
                "effectiveness_check": "Marie Curie",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "capa_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "preventive",
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                "root_cause": "Ada Lovelace",
            
        
    
        
        
            
                "action_plan": "Ada Lovelace",
            
        
    
        
        
            
                "effectiveness_check": "Alan Turing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                "capa_number": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "corrective",
            
        
    
        
        
            
                "status": "investigating",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date(Date.now()),
            
        
    
        
        
            
                "closed_at": new Date(Date.now()),
            
        
    
        
        
            
                "root_cause": "Ada Lovelace",
            
        
    
        
        
            
                "action_plan": "Grace Hopper",
            
        
    
        
        
            
                "effectiveness_check": "Ada Lovelace",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



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




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
    
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

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

    
    
    
        
    
        
    
        
    
        
            
            async function associateItemWithDefault_uom() {
            
                const relatedDefault_uom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item0 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Item0?.setDefault_uom)
                {
                    await
                    Item0.
                    setDefault_uom(relatedDefault_uom0);
                }
            
                const relatedDefault_uom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item1 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Item1?.setDefault_uom)
                {
                    await
                    Item1.
                    setDefault_uom(relatedDefault_uom1);
                }
            
                const relatedDefault_uom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item2 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Item2?.setDefault_uom)
                {
                    await
                    Item2.
                    setDefault_uom(relatedDefault_uom2);
                }
            
                const relatedDefault_uom3 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item3 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Item3?.setDefault_uom)
                {
                    await
                    Item3.
                    setDefault_uom(relatedDefault_uom3);
                }
            
                const relatedDefault_uom4 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const Item4 = await Items.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Item4?.setDefault_uom)
                {
                    await
                    Item4.
                    setDefault_uom(relatedDefault_uom4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateApprovedVendorWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ApprovedVendor0 = await ApprovedVendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovedVendor0?.setItem)
                {
                    await
                    ApprovedVendor0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ApprovedVendor1 = await ApprovedVendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovedVendor1?.setItem)
                {
                    await
                    ApprovedVendor1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ApprovedVendor2 = await ApprovedVendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovedVendor2?.setItem)
                {
                    await
                    ApprovedVendor2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ApprovedVendor3 = await ApprovedVendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ApprovedVendor3?.setItem)
                {
                    await
                    ApprovedVendor3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const ApprovedVendor4 = await ApprovedVendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ApprovedVendor4?.setItem)
                {
                    await
                    ApprovedVendor4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
            
            async function associateApprovedVendorWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const ApprovedVendor0 = await ApprovedVendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovedVendor0?.setSupplier)
                {
                    await
                    ApprovedVendor0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const ApprovedVendor1 = await ApprovedVendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovedVendor1?.setSupplier)
                {
                    await
                    ApprovedVendor1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const ApprovedVendor2 = await ApprovedVendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovedVendor2?.setSupplier)
                {
                    await
                    ApprovedVendor2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const ApprovedVendor3 = await ApprovedVendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ApprovedVendor3?.setSupplier)
                {
                    await
                    ApprovedVendor3.
                    setSupplier(relatedSupplier3);
                }
            
                const relatedSupplier4 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const ApprovedVendor4 = await ApprovedVendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ApprovedVendor4?.setSupplier)
                {
                    await
                    ApprovedVendor4.
                    setSupplier(relatedSupplier4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

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

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

    
    
    
        
    
        
    
        
            
            async function associateRoutingWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Routing0 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Routing0?.setItem)
                {
                    await
                    Routing0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Routing1 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Routing1?.setItem)
                {
                    await
                    Routing1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Routing2 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Routing2?.setItem)
                {
                    await
                    Routing2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Routing3 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Routing3?.setItem)
                {
                    await
                    Routing3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Routing4 = await Routings.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Routing4?.setItem)
                {
                    await
                    Routing4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateRoutingOperationWithRouting() {
            
                const relatedRouting0 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const RoutingOperation0 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoutingOperation0?.setRouting)
                {
                    await
                    RoutingOperation0.
                    setRouting(relatedRouting0);
                }
            
                const relatedRouting1 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const RoutingOperation1 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoutingOperation1?.setRouting)
                {
                    await
                    RoutingOperation1.
                    setRouting(relatedRouting1);
                }
            
                const relatedRouting2 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const RoutingOperation2 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoutingOperation2?.setRouting)
                {
                    await
                    RoutingOperation2.
                    setRouting(relatedRouting2);
                }
            
                const relatedRouting3 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const RoutingOperation3 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoutingOperation3?.setRouting)
                {
                    await
                    RoutingOperation3.
                    setRouting(relatedRouting3);
                }
            
                const relatedRouting4 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const RoutingOperation4 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (RoutingOperation4?.setRouting)
                {
                    await
                    RoutingOperation4.
                    setRouting(relatedRouting4);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateRoutingOperationWithWork_center() {
            
                const relatedWork_center0 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingOperation0 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoutingOperation0?.setWork_center)
                {
                    await
                    RoutingOperation0.
                    setWork_center(relatedWork_center0);
                }
            
                const relatedWork_center1 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingOperation1 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoutingOperation1?.setWork_center)
                {
                    await
                    RoutingOperation1.
                    setWork_center(relatedWork_center1);
                }
            
                const relatedWork_center2 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingOperation2 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoutingOperation2?.setWork_center)
                {
                    await
                    RoutingOperation2.
                    setWork_center(relatedWork_center2);
                }
            
                const relatedWork_center3 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingOperation3 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoutingOperation3?.setWork_center)
                {
                    await
                    RoutingOperation3.
                    setWork_center(relatedWork_center3);
                }
            
                const relatedWork_center4 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const RoutingOperation4 = await RoutingOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (RoutingOperation4?.setWork_center)
                {
                    await
                    RoutingOperation4.
                    setWork_center(relatedWork_center4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

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

    
    
    
        
            
            async function associateMachineEventWithMachine() {
            
                const relatedMachine0 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineEvent0 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MachineEvent0?.setMachine)
                {
                    await
                    MachineEvent0.
                    setMachine(relatedMachine0);
                }
            
                const relatedMachine1 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineEvent1 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MachineEvent1?.setMachine)
                {
                    await
                    MachineEvent1.
                    setMachine(relatedMachine1);
                }
            
                const relatedMachine2 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineEvent2 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MachineEvent2?.setMachine)
                {
                    await
                    MachineEvent2.
                    setMachine(relatedMachine2);
                }
            
                const relatedMachine3 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineEvent3 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MachineEvent3?.setMachine)
                {
                    await
                    MachineEvent3.
                    setMachine(relatedMachine3);
                }
            
                const relatedMachine4 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const MachineEvent4 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MachineEvent4?.setMachine)
                {
                    await
                    MachineEvent4.
                    setMachine(relatedMachine4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateMachineEventWithWork_order() {
            
                const relatedWork_order0 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const MachineEvent0 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MachineEvent0?.setWork_order)
                {
                    await
                    MachineEvent0.
                    setWork_order(relatedWork_order0);
                }
            
                const relatedWork_order1 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const MachineEvent1 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MachineEvent1?.setWork_order)
                {
                    await
                    MachineEvent1.
                    setWork_order(relatedWork_order1);
                }
            
                const relatedWork_order2 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const MachineEvent2 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MachineEvent2?.setWork_order)
                {
                    await
                    MachineEvent2.
                    setWork_order(relatedWork_order2);
                }
            
                const relatedWork_order3 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const MachineEvent3 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MachineEvent3?.setWork_order)
                {
                    await
                    MachineEvent3.
                    setWork_order(relatedWork_order3);
                }
            
                const relatedWork_order4 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const MachineEvent4 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MachineEvent4?.setWork_order)
                {
                    await
                    MachineEvent4.
                    setWork_order(relatedWork_order4);
                }
            
        }
        
    
        
            
            async function associateMachineEventWithReason_code() {
            
                const relatedReason_code0 = await ReasonCodes.findOne({
                    offset: Math.floor(Math.random() * (await ReasonCodes.count())),
                });
                const MachineEvent0 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MachineEvent0?.setReason_code)
                {
                    await
                    MachineEvent0.
                    setReason_code(relatedReason_code0);
                }
            
                const relatedReason_code1 = await ReasonCodes.findOne({
                    offset: Math.floor(Math.random() * (await ReasonCodes.count())),
                });
                const MachineEvent1 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MachineEvent1?.setReason_code)
                {
                    await
                    MachineEvent1.
                    setReason_code(relatedReason_code1);
                }
            
                const relatedReason_code2 = await ReasonCodes.findOne({
                    offset: Math.floor(Math.random() * (await ReasonCodes.count())),
                });
                const MachineEvent2 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MachineEvent2?.setReason_code)
                {
                    await
                    MachineEvent2.
                    setReason_code(relatedReason_code2);
                }
            
                const relatedReason_code3 = await ReasonCodes.findOne({
                    offset: Math.floor(Math.random() * (await ReasonCodes.count())),
                });
                const MachineEvent3 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MachineEvent3?.setReason_code)
                {
                    await
                    MachineEvent3.
                    setReason_code(relatedReason_code3);
                }
            
                const relatedReason_code4 = await ReasonCodes.findOne({
                    offset: Math.floor(Math.random() * (await ReasonCodes.count())),
                });
                const MachineEvent4 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MachineEvent4?.setReason_code)
                {
                    await
                    MachineEvent4.
                    setReason_code(relatedReason_code4);
                }
            
        }
        
    
        
            
            async function associateMachineEventWithReported_by() {
            
                const relatedReported_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MachineEvent0 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MachineEvent0?.setReported_by)
                {
                    await
                    MachineEvent0.
                    setReported_by(relatedReported_by0);
                }
            
                const relatedReported_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MachineEvent1 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MachineEvent1?.setReported_by)
                {
                    await
                    MachineEvent1.
                    setReported_by(relatedReported_by1);
                }
            
                const relatedReported_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MachineEvent2 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MachineEvent2?.setReported_by)
                {
                    await
                    MachineEvent2.
                    setReported_by(relatedReported_by2);
                }
            
                const relatedReported_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MachineEvent3 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MachineEvent3?.setReported_by)
                {
                    await
                    MachineEvent3.
                    setReported_by(relatedReported_by3);
                }
            
                const relatedReported_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MachineEvent4 = await MachineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MachineEvent4?.setReported_by)
                {
                    await
                    MachineEvent4.
                    setReported_by(relatedReported_by4);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            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);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const WorkOrder3 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WorkOrder3?.setItem)
                {
                    await
                    WorkOrder3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const WorkOrder4 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WorkOrder4?.setItem)
                {
                    await
                    WorkOrder4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
            
            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);
                }
            
                const relatedBom3 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const WorkOrder3 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WorkOrder3?.setBom)
                {
                    await
                    WorkOrder3.
                    setBom(relatedBom3);
                }
            
                const relatedBom4 = await Boms.findOne({
                    offset: Math.floor(Math.random() * (await Boms.count())),
                });
                const WorkOrder4 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WorkOrder4?.setBom)
                {
                    await
                    WorkOrder4.
                    setBom(relatedBom4);
                }
            
        }
        
    
        
            
            async function associateWorkOrderWithRouting() {
            
                const relatedRouting0 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const WorkOrder0 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrder0?.setRouting)
                {
                    await
                    WorkOrder0.
                    setRouting(relatedRouting0);
                }
            
                const relatedRouting1 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const WorkOrder1 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrder1?.setRouting)
                {
                    await
                    WorkOrder1.
                    setRouting(relatedRouting1);
                }
            
                const relatedRouting2 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const WorkOrder2 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrder2?.setRouting)
                {
                    await
                    WorkOrder2.
                    setRouting(relatedRouting2);
                }
            
                const relatedRouting3 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const WorkOrder3 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WorkOrder3?.setRouting)
                {
                    await
                    WorkOrder3.
                    setRouting(relatedRouting3);
                }
            
                const relatedRouting4 = await Routings.findOne({
                    offset: Math.floor(Math.random() * (await Routings.count())),
                });
                const WorkOrder4 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WorkOrder4?.setRouting)
                {
                    await
                    WorkOrder4.
                    setRouting(relatedRouting4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            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);
                }
            
                const relatedCustomer3 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const WorkOrder3 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WorkOrder3?.setCustomer)
                {
                    await
                    WorkOrder3.
                    setCustomer(relatedCustomer3);
                }
            
                const relatedCustomer4 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const WorkOrder4 = await WorkOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WorkOrder4?.setCustomer)
                {
                    await
                    WorkOrder4.
                    setCustomer(relatedCustomer4);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            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);
                }
            
                const relatedWork_order3 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const WorkOrderOperation3 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WorkOrderOperation3?.setWork_order)
                {
                    await
                    WorkOrderOperation3.
                    setWork_order(relatedWork_order3);
                }
            
                const relatedWork_order4 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const WorkOrderOperation4 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WorkOrderOperation4?.setWork_order)
                {
                    await
                    WorkOrderOperation4.
                    setWork_order(relatedWork_order4);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateWorkOrderOperationWithWork_center() {
            
                const relatedWork_center0 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const WorkOrderOperation0 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrderOperation0?.setWork_center)
                {
                    await
                    WorkOrderOperation0.
                    setWork_center(relatedWork_center0);
                }
            
                const relatedWork_center1 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const WorkOrderOperation1 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrderOperation1?.setWork_center)
                {
                    await
                    WorkOrderOperation1.
                    setWork_center(relatedWork_center1);
                }
            
                const relatedWork_center2 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const WorkOrderOperation2 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrderOperation2?.setWork_center)
                {
                    await
                    WorkOrderOperation2.
                    setWork_center(relatedWork_center2);
                }
            
                const relatedWork_center3 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const WorkOrderOperation3 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WorkOrderOperation3?.setWork_center)
                {
                    await
                    WorkOrderOperation3.
                    setWork_center(relatedWork_center3);
                }
            
                const relatedWork_center4 = await WorkCenters.findOne({
                    offset: Math.floor(Math.random() * (await WorkCenters.count())),
                });
                const WorkOrderOperation4 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WorkOrderOperation4?.setWork_center)
                {
                    await
                    WorkOrderOperation4.
                    setWork_center(relatedWork_center4);
                }
            
        }
        
    
        
            
            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);
                }
            
                const relatedMachine3 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const WorkOrderOperation3 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WorkOrderOperation3?.setMachine)
                {
                    await
                    WorkOrderOperation3.
                    setMachine(relatedMachine3);
                }
            
                const relatedMachine4 = await Machines.findOne({
                    offset: Math.floor(Math.random() * (await Machines.count())),
                });
                const WorkOrderOperation4 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WorkOrderOperation4?.setMachine)
                {
                    await
                    WorkOrderOperation4.
                    setMachine(relatedMachine4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateWorkOrderOperationWithPerformed_by() {
            
                const relatedPerformed_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkOrderOperation0 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WorkOrderOperation0?.setPerformed_by)
                {
                    await
                    WorkOrderOperation0.
                    setPerformed_by(relatedPerformed_by0);
                }
            
                const relatedPerformed_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkOrderOperation1 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WorkOrderOperation1?.setPerformed_by)
                {
                    await
                    WorkOrderOperation1.
                    setPerformed_by(relatedPerformed_by1);
                }
            
                const relatedPerformed_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkOrderOperation2 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WorkOrderOperation2?.setPerformed_by)
                {
                    await
                    WorkOrderOperation2.
                    setPerformed_by(relatedPerformed_by2);
                }
            
                const relatedPerformed_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkOrderOperation3 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (WorkOrderOperation3?.setPerformed_by)
                {
                    await
                    WorkOrderOperation3.
                    setPerformed_by(relatedPerformed_by3);
                }
            
                const relatedPerformed_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const WorkOrderOperation4 = await WorkOrderOperations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (WorkOrderOperation4?.setPerformed_by)
                {
                    await
                    WorkOrderOperation4.
                    setPerformed_by(relatedPerformed_by4);
                }
            
        }
        
    
        
    

    
    
    
        
    
        
            
            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);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Lot3 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Lot3?.setItem)
                {
                    await
                    Lot3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Lot4 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Lot4?.setItem)
                {
                    await
                    Lot4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateLotWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot0 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lot0?.setSupplier)
                {
                    await
                    Lot0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot1 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lot1?.setSupplier)
                {
                    await
                    Lot1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot2 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lot2?.setSupplier)
                {
                    await
                    Lot2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot3 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Lot3?.setSupplier)
                {
                    await
                    Lot3.
                    setSupplier(relatedSupplier3);
                }
            
                const relatedSupplier4 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Lot4 = await Lots.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Lot4?.setSupplier)
                {
                    await
                    Lot4.
                    setSupplier(relatedSupplier4);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateSerialWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Serial0 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Serial0?.setItem)
                {
                    await
                    Serial0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Serial1 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Serial1?.setItem)
                {
                    await
                    Serial1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Serial2 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Serial2?.setItem)
                {
                    await
                    Serial2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Serial3 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Serial3?.setItem)
                {
                    await
                    Serial3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Serial4 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Serial4?.setItem)
                {
                    await
                    Serial4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
            
            async function associateSerialWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Serial0 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Serial0?.setLot)
                {
                    await
                    Serial0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Serial1 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Serial1?.setLot)
                {
                    await
                    Serial1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Serial2 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Serial2?.setLot)
                {
                    await
                    Serial2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Serial3 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Serial3?.setLot)
                {
                    await
                    Serial3.
                    setLot(relatedLot3);
                }
            
                const relatedLot4 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Serial4 = await Serials.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Serial4?.setLot)
                {
                    await
                    Serial4.
                    setLot(relatedLot4);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateInventoryBalanceWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setItem)
                {
                    await
                    InventoryBalance0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setItem)
                {
                    await
                    InventoryBalance1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setItem)
                {
                    await
                    InventoryBalance2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setItem)
                {
                    await
                    InventoryBalance3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryBalance4 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryBalance4?.setItem)
                {
                    await
                    InventoryBalance4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
            
            async function associateInventoryBalanceWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setLocation)
                {
                    await
                    InventoryBalance0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setLocation)
                {
                    await
                    InventoryBalance1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setLocation)
                {
                    await
                    InventoryBalance2.
                    setLocation(relatedLocation2);
                }
            
                const relatedLocation3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setLocation)
                {
                    await
                    InventoryBalance3.
                    setLocation(relatedLocation3);
                }
            
                const relatedLocation4 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryBalance4 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryBalance4?.setLocation)
                {
                    await
                    InventoryBalance4.
                    setLocation(relatedLocation4);
                }
            
        }
        
    
        
            
            async function associateInventoryBalanceWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setLot)
                {
                    await
                    InventoryBalance0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setLot)
                {
                    await
                    InventoryBalance1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setLot)
                {
                    await
                    InventoryBalance2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setLot)
                {
                    await
                    InventoryBalance3.
                    setLot(relatedLot3);
                }
            
                const relatedLot4 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryBalance4 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryBalance4?.setLot)
                {
                    await
                    InventoryBalance4.
                    setLot(relatedLot4);
                }
            
        }
        
    
        
            
            async function associateInventoryBalanceWithSerial() {
            
                const relatedSerial0 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const InventoryBalance0 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryBalance0?.setSerial)
                {
                    await
                    InventoryBalance0.
                    setSerial(relatedSerial0);
                }
            
                const relatedSerial1 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const InventoryBalance1 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryBalance1?.setSerial)
                {
                    await
                    InventoryBalance1.
                    setSerial(relatedSerial1);
                }
            
                const relatedSerial2 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const InventoryBalance2 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryBalance2?.setSerial)
                {
                    await
                    InventoryBalance2.
                    setSerial(relatedSerial2);
                }
            
                const relatedSerial3 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const InventoryBalance3 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryBalance3?.setSerial)
                {
                    await
                    InventoryBalance3.
                    setSerial(relatedSerial3);
                }
            
                const relatedSerial4 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const InventoryBalance4 = await InventoryBalances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryBalance4?.setSerial)
                {
                    await
                    InventoryBalance4.
                    setSerial(relatedSerial4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateInventoryMovementWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setItem)
                {
                    await
                    InventoryMovement0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setItem)
                {
                    await
                    InventoryMovement1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setItem)
                {
                    await
                    InventoryMovement2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setItem)
                {
                    await
                    InventoryMovement3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InventoryMovement4 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryMovement4?.setItem)
                {
                    await
                    InventoryMovement4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
    
        
            
            async function associateInventoryMovementWithUom() {
            
                const relatedUom0 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setUom)
                {
                    await
                    InventoryMovement0.
                    setUom(relatedUom0);
                }
            
                const relatedUom1 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setUom)
                {
                    await
                    InventoryMovement1.
                    setUom(relatedUom1);
                }
            
                const relatedUom2 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setUom)
                {
                    await
                    InventoryMovement2.
                    setUom(relatedUom2);
                }
            
                const relatedUom3 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setUom)
                {
                    await
                    InventoryMovement3.
                    setUom(relatedUom3);
                }
            
                const relatedUom4 = await Uoms.findOne({
                    offset: Math.floor(Math.random() * (await Uoms.count())),
                });
                const InventoryMovement4 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryMovement4?.setUom)
                {
                    await
                    InventoryMovement4.
                    setUom(relatedUom4);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithFrom_location() {
            
                const relatedFrom_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setFrom_location)
                {
                    await
                    InventoryMovement0.
                    setFrom_location(relatedFrom_location0);
                }
            
                const relatedFrom_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setFrom_location)
                {
                    await
                    InventoryMovement1.
                    setFrom_location(relatedFrom_location1);
                }
            
                const relatedFrom_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setFrom_location)
                {
                    await
                    InventoryMovement2.
                    setFrom_location(relatedFrom_location2);
                }
            
                const relatedFrom_location3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setFrom_location)
                {
                    await
                    InventoryMovement3.
                    setFrom_location(relatedFrom_location3);
                }
            
                const relatedFrom_location4 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryMovement4 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryMovement4?.setFrom_location)
                {
                    await
                    InventoryMovement4.
                    setFrom_location(relatedFrom_location4);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithTo_location() {
            
                const relatedTo_location0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setTo_location)
                {
                    await
                    InventoryMovement0.
                    setTo_location(relatedTo_location0);
                }
            
                const relatedTo_location1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setTo_location)
                {
                    await
                    InventoryMovement1.
                    setTo_location(relatedTo_location1);
                }
            
                const relatedTo_location2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setTo_location)
                {
                    await
                    InventoryMovement2.
                    setTo_location(relatedTo_location2);
                }
            
                const relatedTo_location3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setTo_location)
                {
                    await
                    InventoryMovement3.
                    setTo_location(relatedTo_location3);
                }
            
                const relatedTo_location4 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const InventoryMovement4 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryMovement4?.setTo_location)
                {
                    await
                    InventoryMovement4.
                    setTo_location(relatedTo_location4);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setLot)
                {
                    await
                    InventoryMovement0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setLot)
                {
                    await
                    InventoryMovement1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setLot)
                {
                    await
                    InventoryMovement2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setLot)
                {
                    await
                    InventoryMovement3.
                    setLot(relatedLot3);
                }
            
                const relatedLot4 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const InventoryMovement4 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryMovement4?.setLot)
                {
                    await
                    InventoryMovement4.
                    setLot(relatedLot4);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithSerial() {
            
                const relatedSerial0 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setSerial)
                {
                    await
                    InventoryMovement0.
                    setSerial(relatedSerial0);
                }
            
                const relatedSerial1 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setSerial)
                {
                    await
                    InventoryMovement1.
                    setSerial(relatedSerial1);
                }
            
                const relatedSerial2 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setSerial)
                {
                    await
                    InventoryMovement2.
                    setSerial(relatedSerial2);
                }
            
                const relatedSerial3 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setSerial)
                {
                    await
                    InventoryMovement3.
                    setSerial(relatedSerial3);
                }
            
                const relatedSerial4 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const InventoryMovement4 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryMovement4?.setSerial)
                {
                    await
                    InventoryMovement4.
                    setSerial(relatedSerial4);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithWork_order() {
            
                const relatedWork_order0 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setWork_order)
                {
                    await
                    InventoryMovement0.
                    setWork_order(relatedWork_order0);
                }
            
                const relatedWork_order1 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setWork_order)
                {
                    await
                    InventoryMovement1.
                    setWork_order(relatedWork_order1);
                }
            
                const relatedWork_order2 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setWork_order)
                {
                    await
                    InventoryMovement2.
                    setWork_order(relatedWork_order2);
                }
            
                const relatedWork_order3 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setWork_order)
                {
                    await
                    InventoryMovement3.
                    setWork_order(relatedWork_order3);
                }
            
                const relatedWork_order4 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const InventoryMovement4 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryMovement4?.setWork_order)
                {
                    await
                    InventoryMovement4.
                    setWork_order(relatedWork_order4);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setSupplier)
                {
                    await
                    InventoryMovement0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setSupplier)
                {
                    await
                    InventoryMovement1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setSupplier)
                {
                    await
                    InventoryMovement2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setSupplier)
                {
                    await
                    InventoryMovement3.
                    setSupplier(relatedSupplier3);
                }
            
                const relatedSupplier4 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const InventoryMovement4 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryMovement4?.setSupplier)
                {
                    await
                    InventoryMovement4.
                    setSupplier(relatedSupplier4);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setCustomer)
                {
                    await
                    InventoryMovement0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setCustomer)
                {
                    await
                    InventoryMovement1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setCustomer)
                {
                    await
                    InventoryMovement2.
                    setCustomer(relatedCustomer2);
                }
            
                const relatedCustomer3 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setCustomer)
                {
                    await
                    InventoryMovement3.
                    setCustomer(relatedCustomer3);
                }
            
                const relatedCustomer4 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const InventoryMovement4 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryMovement4?.setCustomer)
                {
                    await
                    InventoryMovement4.
                    setCustomer(relatedCustomer4);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithReason_code() {
            
                const relatedReason_code0 = await ReasonCodes.findOne({
                    offset: Math.floor(Math.random() * (await ReasonCodes.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setReason_code)
                {
                    await
                    InventoryMovement0.
                    setReason_code(relatedReason_code0);
                }
            
                const relatedReason_code1 = await ReasonCodes.findOne({
                    offset: Math.floor(Math.random() * (await ReasonCodes.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setReason_code)
                {
                    await
                    InventoryMovement1.
                    setReason_code(relatedReason_code1);
                }
            
                const relatedReason_code2 = await ReasonCodes.findOne({
                    offset: Math.floor(Math.random() * (await ReasonCodes.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setReason_code)
                {
                    await
                    InventoryMovement2.
                    setReason_code(relatedReason_code2);
                }
            
                const relatedReason_code3 = await ReasonCodes.findOne({
                    offset: Math.floor(Math.random() * (await ReasonCodes.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setReason_code)
                {
                    await
                    InventoryMovement3.
                    setReason_code(relatedReason_code3);
                }
            
                const relatedReason_code4 = await ReasonCodes.findOne({
                    offset: Math.floor(Math.random() * (await ReasonCodes.count())),
                });
                const InventoryMovement4 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryMovement4?.setReason_code)
                {
                    await
                    InventoryMovement4.
                    setReason_code(relatedReason_code4);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithPerformed_by() {
            
                const relatedPerformed_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setPerformed_by)
                {
                    await
                    InventoryMovement0.
                    setPerformed_by(relatedPerformed_by0);
                }
            
                const relatedPerformed_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setPerformed_by)
                {
                    await
                    InventoryMovement1.
                    setPerformed_by(relatedPerformed_by1);
                }
            
                const relatedPerformed_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setPerformed_by)
                {
                    await
                    InventoryMovement2.
                    setPerformed_by(relatedPerformed_by2);
                }
            
                const relatedPerformed_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setPerformed_by)
                {
                    await
                    InventoryMovement3.
                    setPerformed_by(relatedPerformed_by3);
                }
            
                const relatedPerformed_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryMovement4 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryMovement4?.setPerformed_by)
                {
                    await
                    InventoryMovement4.
                    setPerformed_by(relatedPerformed_by4);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associatePurchaseOrderWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setSupplier)
                {
                    await
                    PurchaseOrder0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setSupplier)
                {
                    await
                    PurchaseOrder1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setSupplier)
                {
                    await
                    PurchaseOrder2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder3 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrder3?.setSupplier)
                {
                    await
                    PurchaseOrder3.
                    setSupplier(relatedSupplier3);
                }
            
                const relatedSupplier4 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const PurchaseOrder4 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (PurchaseOrder4?.setSupplier)
                {
                    await
                    PurchaseOrder4.
                    setSupplier(relatedSupplier4);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associatePurchaseOrderWithCreated_by_user() {
            
                const relatedCreated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder0 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PurchaseOrder0?.setCreated_by_user)
                {
                    await
                    PurchaseOrder0.
                    setCreated_by_user(relatedCreated_by_user0);
                }
            
                const relatedCreated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder1 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PurchaseOrder1?.setCreated_by_user)
                {
                    await
                    PurchaseOrder1.
                    setCreated_by_user(relatedCreated_by_user1);
                }
            
                const relatedCreated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder2 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PurchaseOrder2?.setCreated_by_user)
                {
                    await
                    PurchaseOrder2.
                    setCreated_by_user(relatedCreated_by_user2);
                }
            
                const relatedCreated_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder3 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PurchaseOrder3?.setCreated_by_user)
                {
                    await
                    PurchaseOrder3.
                    setCreated_by_user(relatedCreated_by_user3);
                }
            
                const relatedCreated_by_user4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PurchaseOrder4 = await PurchaseOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (PurchaseOrder4?.setCreated_by_user)
                {
                    await
                    PurchaseOrder4.
                    setCreated_by_user(relatedCreated_by_user4);
                }
            
        }
        
    
        
    

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

    
    
    
        
    
        
    
        
    
        
            
            async function associateInspectionPlanWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InspectionPlan0 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InspectionPlan0?.setItem)
                {
                    await
                    InspectionPlan0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InspectionPlan1 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InspectionPlan1?.setItem)
                {
                    await
                    InspectionPlan1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InspectionPlan2 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InspectionPlan2?.setItem)
                {
                    await
                    InspectionPlan2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InspectionPlan3 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InspectionPlan3?.setItem)
                {
                    await
                    InspectionPlan3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const InspectionPlan4 = await InspectionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InspectionPlan4?.setItem)
                {
                    await
                    InspectionPlan4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
    
        
    

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

    
    
    
        
    
        
    
        
            
            async function associateInspectionWithInspection_plan() {
            
                const relatedInspection_plan0 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setInspection_plan)
                {
                    await
                    Inspection0.
                    setInspection_plan(relatedInspection_plan0);
                }
            
                const relatedInspection_plan1 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setInspection_plan)
                {
                    await
                    Inspection1.
                    setInspection_plan(relatedInspection_plan1);
                }
            
                const relatedInspection_plan2 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setInspection_plan)
                {
                    await
                    Inspection2.
                    setInspection_plan(relatedInspection_plan2);
                }
            
                const relatedInspection_plan3 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setInspection_plan)
                {
                    await
                    Inspection3.
                    setInspection_plan(relatedInspection_plan3);
                }
            
                const relatedInspection_plan4 = await InspectionPlans.findOne({
                    offset: Math.floor(Math.random() * (await InspectionPlans.count())),
                });
                const Inspection4 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Inspection4?.setInspection_plan)
                {
                    await
                    Inspection4.
                    setInspection_plan(relatedInspection_plan4);
                }
            
        }
        
    
        
            
            async function associateInspectionWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setItem)
                {
                    await
                    Inspection0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setItem)
                {
                    await
                    Inspection1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setItem)
                {
                    await
                    Inspection2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setItem)
                {
                    await
                    Inspection3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Inspection4 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Inspection4?.setItem)
                {
                    await
                    Inspection4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
            
            async function associateInspectionWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setLot)
                {
                    await
                    Inspection0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setLot)
                {
                    await
                    Inspection1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setLot)
                {
                    await
                    Inspection2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setLot)
                {
                    await
                    Inspection3.
                    setLot(relatedLot3);
                }
            
                const relatedLot4 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Inspection4 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Inspection4?.setLot)
                {
                    await
                    Inspection4.
                    setLot(relatedLot4);
                }
            
        }
        
    
        
            
            async function associateInspectionWithSerial() {
            
                const relatedSerial0 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setSerial)
                {
                    await
                    Inspection0.
                    setSerial(relatedSerial0);
                }
            
                const relatedSerial1 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setSerial)
                {
                    await
                    Inspection1.
                    setSerial(relatedSerial1);
                }
            
                const relatedSerial2 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setSerial)
                {
                    await
                    Inspection2.
                    setSerial(relatedSerial2);
                }
            
                const relatedSerial3 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setSerial)
                {
                    await
                    Inspection3.
                    setSerial(relatedSerial3);
                }
            
                const relatedSerial4 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const Inspection4 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Inspection4?.setSerial)
                {
                    await
                    Inspection4.
                    setSerial(relatedSerial4);
                }
            
        }
        
    
        
            
            async function associateInspectionWithWork_order() {
            
                const relatedWork_order0 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setWork_order)
                {
                    await
                    Inspection0.
                    setWork_order(relatedWork_order0);
                }
            
                const relatedWork_order1 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setWork_order)
                {
                    await
                    Inspection1.
                    setWork_order(relatedWork_order1);
                }
            
                const relatedWork_order2 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setWork_order)
                {
                    await
                    Inspection2.
                    setWork_order(relatedWork_order2);
                }
            
                const relatedWork_order3 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setWork_order)
                {
                    await
                    Inspection3.
                    setWork_order(relatedWork_order3);
                }
            
                const relatedWork_order4 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const Inspection4 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Inspection4?.setWork_order)
                {
                    await
                    Inspection4.
                    setWork_order(relatedWork_order4);
                }
            
        }
        
    
        
            
            async function associateInspectionWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setSupplier)
                {
                    await
                    Inspection0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setSupplier)
                {
                    await
                    Inspection1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setSupplier)
                {
                    await
                    Inspection2.
                    setSupplier(relatedSupplier2);
                }
            
                const relatedSupplier3 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setSupplier)
                {
                    await
                    Inspection3.
                    setSupplier(relatedSupplier3);
                }
            
                const relatedSupplier4 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Inspection4 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Inspection4?.setSupplier)
                {
                    await
                    Inspection4.
                    setSupplier(relatedSupplier4);
                }
            
        }
        
    
        
    
        
            
            async function associateInspectionWithInspected_by() {
            
                const relatedInspected_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Inspection0 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Inspection0?.setInspected_by)
                {
                    await
                    Inspection0.
                    setInspected_by(relatedInspected_by0);
                }
            
                const relatedInspected_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Inspection1 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Inspection1?.setInspected_by)
                {
                    await
                    Inspection1.
                    setInspected_by(relatedInspected_by1);
                }
            
                const relatedInspected_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Inspection2 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Inspection2?.setInspected_by)
                {
                    await
                    Inspection2.
                    setInspected_by(relatedInspected_by2);
                }
            
                const relatedInspected_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Inspection3 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Inspection3?.setInspected_by)
                {
                    await
                    Inspection3.
                    setInspected_by(relatedInspected_by3);
                }
            
                const relatedInspected_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Inspection4 = await Inspections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Inspection4?.setInspected_by)
                {
                    await
                    Inspection4.
                    setInspected_by(relatedInspected_by4);
                }
            
        }
        
    
        
    
        
    
        
    

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

    
    
    
        
    
        
    
        
    
        
    
        
            
            async function associateNonconformanceWithItem() {
            
                const relatedItem0 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setItem)
                {
                    await
                    Nonconformance0.
                    setItem(relatedItem0);
                }
            
                const relatedItem1 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setItem)
                {
                    await
                    Nonconformance1.
                    setItem(relatedItem1);
                }
            
                const relatedItem2 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setItem)
                {
                    await
                    Nonconformance2.
                    setItem(relatedItem2);
                }
            
                const relatedItem3 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setItem)
                {
                    await
                    Nonconformance3.
                    setItem(relatedItem3);
                }
            
                const relatedItem4 = await Items.findOne({
                    offset: Math.floor(Math.random() * (await Items.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setItem)
                {
                    await
                    Nonconformance4.
                    setItem(relatedItem4);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithLot() {
            
                const relatedLot0 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setLot)
                {
                    await
                    Nonconformance0.
                    setLot(relatedLot0);
                }
            
                const relatedLot1 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setLot)
                {
                    await
                    Nonconformance1.
                    setLot(relatedLot1);
                }
            
                const relatedLot2 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setLot)
                {
                    await
                    Nonconformance2.
                    setLot(relatedLot2);
                }
            
                const relatedLot3 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setLot)
                {
                    await
                    Nonconformance3.
                    setLot(relatedLot3);
                }
            
                const relatedLot4 = await Lots.findOne({
                    offset: Math.floor(Math.random() * (await Lots.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setLot)
                {
                    await
                    Nonconformance4.
                    setLot(relatedLot4);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithSerial() {
            
                const relatedSerial0 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setSerial)
                {
                    await
                    Nonconformance0.
                    setSerial(relatedSerial0);
                }
            
                const relatedSerial1 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setSerial)
                {
                    await
                    Nonconformance1.
                    setSerial(relatedSerial1);
                }
            
                const relatedSerial2 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setSerial)
                {
                    await
                    Nonconformance2.
                    setSerial(relatedSerial2);
                }
            
                const relatedSerial3 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setSerial)
                {
                    await
                    Nonconformance3.
                    setSerial(relatedSerial3);
                }
            
                const relatedSerial4 = await Serials.findOne({
                    offset: Math.floor(Math.random() * (await Serials.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setSerial)
                {
                    await
                    Nonconformance4.
                    setSerial(relatedSerial4);
                }
            
        }
        
    
        
            
            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);
                }
            
                const relatedWork_order3 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setWork_order)
                {
                    await
                    Nonconformance3.
                    setWork_order(relatedWork_order3);
                }
            
                const relatedWork_order4 = await WorkOrders.findOne({
                    offset: Math.floor(Math.random() * (await WorkOrders.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setWork_order)
                {
                    await
                    Nonconformance4.
                    setWork_order(relatedWork_order4);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithInspection() {
            
                const relatedInspection0 = await Inspections.findOne({
                    offset: Math.floor(Math.random() * (await Inspections.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setInspection)
                {
                    await
                    Nonconformance0.
                    setInspection(relatedInspection0);
                }
            
                const relatedInspection1 = await Inspections.findOne({
                    offset: Math.floor(Math.random() * (await Inspections.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setInspection)
                {
                    await
                    Nonconformance1.
                    setInspection(relatedInspection1);
                }
            
                const relatedInspection2 = await Inspections.findOne({
                    offset: Math.floor(Math.random() * (await Inspections.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setInspection)
                {
                    await
                    Nonconformance2.
                    setInspection(relatedInspection2);
                }
            
                const relatedInspection3 = await Inspections.findOne({
                    offset: Math.floor(Math.random() * (await Inspections.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setInspection)
                {
                    await
                    Nonconformance3.
                    setInspection(relatedInspection3);
                }
            
                const relatedInspection4 = await Inspections.findOne({
                    offset: Math.floor(Math.random() * (await Inspections.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setInspection)
                {
                    await
                    Nonconformance4.
                    setInspection(relatedInspection4);
                }
            
        }
        
    
        
            
            async function associateNonconformanceWithReported_by() {
            
                const relatedReported_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setReported_by)
                {
                    await
                    Nonconformance0.
                    setReported_by(relatedReported_by0);
                }
            
                const relatedReported_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setReported_by)
                {
                    await
                    Nonconformance1.
                    setReported_by(relatedReported_by1);
                }
            
                const relatedReported_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setReported_by)
                {
                    await
                    Nonconformance2.
                    setReported_by(relatedReported_by2);
                }
            
                const relatedReported_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setReported_by)
                {
                    await
                    Nonconformance3.
                    setReported_by(relatedReported_by3);
                }
            
                const relatedReported_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setReported_by)
                {
                    await
                    Nonconformance4.
                    setReported_by(relatedReported_by4);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateNonconformanceWithDisposition_code() {
            
                const relatedDisposition_code0 = await DispositionCodes.findOne({
                    offset: Math.floor(Math.random() * (await DispositionCodes.count())),
                });
                const Nonconformance0 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Nonconformance0?.setDisposition_code)
                {
                    await
                    Nonconformance0.
                    setDisposition_code(relatedDisposition_code0);
                }
            
                const relatedDisposition_code1 = await DispositionCodes.findOne({
                    offset: Math.floor(Math.random() * (await DispositionCodes.count())),
                });
                const Nonconformance1 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Nonconformance1?.setDisposition_code)
                {
                    await
                    Nonconformance1.
                    setDisposition_code(relatedDisposition_code1);
                }
            
                const relatedDisposition_code2 = await DispositionCodes.findOne({
                    offset: Math.floor(Math.random() * (await DispositionCodes.count())),
                });
                const Nonconformance2 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Nonconformance2?.setDisposition_code)
                {
                    await
                    Nonconformance2.
                    setDisposition_code(relatedDisposition_code2);
                }
            
                const relatedDisposition_code3 = await DispositionCodes.findOne({
                    offset: Math.floor(Math.random() * (await DispositionCodes.count())),
                });
                const Nonconformance3 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Nonconformance3?.setDisposition_code)
                {
                    await
                    Nonconformance3.
                    setDisposition_code(relatedDisposition_code3);
                }
            
                const relatedDisposition_code4 = await DispositionCodes.findOne({
                    offset: Math.floor(Math.random() * (await DispositionCodes.count())),
                });
                const Nonconformance4 = await Nonconformances.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Nonconformance4?.setDisposition_code)
                {
                    await
                    Nonconformance4.
                    setDisposition_code(relatedDisposition_code4);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

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

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


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Suppliers.bulkCreate(SuppliersData);
                
            
            
                
                await Customers.bulkCreate(CustomersData);
                
            
            
                
                await Uoms.bulkCreate(UomsData);
                
            
            
                
                await Warehouses.bulkCreate(WarehousesData);
                
            
            
                
                await Locations.bulkCreate(LocationsData);
                
            
            
                
                await Items.bulkCreate(ItemsData);
                
            
            
                
                await ApprovedVendors.bulkCreate(ApprovedVendorsData);
                
            
            
                
                await Boms.bulkCreate(BomsData);
                
            
            
                
                await BomLines.bulkCreate(BomLinesData);
                
            
            
                
                await Routings.bulkCreate(RoutingsData);
                
            
            
                
                await WorkCenters.bulkCreate(WorkCentersData);
                
            
            
                
                await RoutingOperations.bulkCreate(RoutingOperationsData);
                
            
            
                
                await Machines.bulkCreate(MachinesData);
                
            
            
                
                await MachineEvents.bulkCreate(MachineEventsData);
                
            
            
                
                await ReasonCodes.bulkCreate(ReasonCodesData);
                
            
            
                
                await WorkOrders.bulkCreate(WorkOrdersData);
                
            
            
                
                await WorkOrderOperations.bulkCreate(WorkOrderOperationsData);
                
            
            
                
                await Lots.bulkCreate(LotsData);
                
            
            
                
                await Serials.bulkCreate(SerialsData);
                
            
            
                
                await InventoryBalances.bulkCreate(InventoryBalancesData);
                
            
            
                
                await InventoryMovements.bulkCreate(InventoryMovementsData);
                
            
            
                
                await PurchaseOrders.bulkCreate(PurchaseOrdersData);
                
            
            
                
                await PurchaseOrderLines.bulkCreate(PurchaseOrderLinesData);
                
            
            
                
                await InspectionPlans.bulkCreate(InspectionPlansData);
                
            
            
                
                await InspectionCharacteristics.bulkCreate(InspectionCharacteristicsData);
                
            
            
                
                await Inspections.bulkCreate(InspectionsData);
                
            
            
                
                await InspectionResults.bulkCreate(InspectionResultsData);
                
            
            
                
                await Nonconformances.bulkCreate(NonconformancesData);
                
            
            
                
                await DispositionCodes.bulkCreate(DispositionCodesData);
                
            
            
                
                await CapaActions.bulkCreate(CapaActionsData);
                
            
            
                
                await AuditLogs.bulkCreate(AuditLogsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateLocationWithWarehouse(),
                    
                
                    
                        
                        await associateLocationWithParent_location(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateItemWithDefault_uom(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateApprovedVendorWithItem(),
                    
                
                    
                        
                        await associateApprovedVendorWithSupplier(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateBomWithParent_item(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateBomLineWithBom(),
                    
                
                    
                        
                        await associateBomLineWithComponent_item(),
                    
                
                    
                
                    
                        
                        await associateBomLineWithUom(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateRoutingWithItem(),
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateRoutingOperationWithRouting(),
                    
                
                    
                
                    
                
                    
                        
                        await associateRoutingOperationWithWork_center(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateMachineWithWork_center(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateMachineEventWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMachineEventWithWork_order(),
                    
                
                    
                        
                        await associateMachineEventWithReason_code(),
                    
                
                    
                        
                        await associateMachineEventWithReported_by(),
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateWorkOrderWithItem(),
                    
                
                    
                        
                        await associateWorkOrderWithBom(),
                    
                
                    
                        
                        await associateWorkOrderWithRouting(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWorkOrderWithCustomer(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateWorkOrderOperationWithWork_order(),
                    
                
                    
                
                    
                
                    
                        
                        await associateWorkOrderOperationWithWork_center(),
                    
                
                    
                        
                        await associateWorkOrderOperationWithMachine(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWorkOrderOperationWithPerformed_by(),
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateLotWithItem(),
                    
                
                    
                
                    
                
                    
                        
                        await associateLotWithSupplier(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateSerialWithItem(),
                    
                
                    
                        
                        await associateSerialWithLot(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInventoryBalanceWithItem(),
                    
                
                    
                        
                        await associateInventoryBalanceWithLocation(),
                    
                
                    
                        
                        await associateInventoryBalanceWithLot(),
                    
                
                    
                        
                        await associateInventoryBalanceWithSerial(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryMovementWithItem(),
                    
                
                    
                
                    
                        
                        await associateInventoryMovementWithUom(),
                    
                
                    
                        
                        await associateInventoryMovementWithFrom_location(),
                    
                
                    
                        
                        await associateInventoryMovementWithTo_location(),
                    
                
                    
                        
                        await associateInventoryMovementWithLot(),
                    
                
                    
                        
                        await associateInventoryMovementWithSerial(),
                    
                
                    
                        
                        await associateInventoryMovementWithWork_order(),
                    
                
                    
                        
                        await associateInventoryMovementWithSupplier(),
                    
                
                    
                        
                        await associateInventoryMovementWithCustomer(),
                    
                
                    
                        
                        await associateInventoryMovementWithReason_code(),
                    
                
                    
                        
                        await associateInventoryMovementWithPerformed_by(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associatePurchaseOrderWithSupplier(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderWithCreated_by_user(),
                    
                
                    
                
            
                
                
                    
                        
                        await associatePurchaseOrderLineWithPurchase_order(),
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderLineWithItem(),
                    
                
                    
                
                    
                
                    
                        
                        await associatePurchaseOrderLineWithUom(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInspectionPlanWithItem(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInspectionCharacteristicWithInspection_plan(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                        
                        await associateInspectionWithInspection_plan(),
                    
                
                    
                        
                        await associateInspectionWithItem(),
                    
                
                    
                        
                        await associateInspectionWithLot(),
                    
                
                    
                        
                        await associateInspectionWithSerial(),
                    
                
                    
                        
                        await associateInspectionWithWork_order(),
                    
                
                    
                        
                        await associateInspectionWithSupplier(),
                    
                
                    
                
                    
                        
                        await associateInspectionWithInspected_by(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInspectionResultWithInspection(),
                    
                
                    
                        
                        await associateInspectionResultWithCharacteristic(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithItem(),
                    
                
                    
                        
                        await associateNonconformanceWithLot(),
                    
                
                    
                        
                        await associateNonconformanceWithSerial(),
                    
                
                    
                        
                        await associateNonconformanceWithWork_order(),
                    
                
                    
                        
                        await associateNonconformanceWithInspection(),
                    
                
                    
                        
                        await associateNonconformanceWithReported_by(),
                    
                
                    
                
                    
                
                    
                        
                        await associateNonconformanceWithDisposition_code(),
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateCapaActionWithNonconformance(),
                    
                
                    
                
                    
                
                    
                        
                        await associateCapaActionWithOwner(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateAuditLogWithActor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('suppliers', null, {});
            
            
            await queryInterface.bulkDelete('customers', null, {});
            
            
            await queryInterface.bulkDelete('uoms', null, {});
            
            
            await queryInterface.bulkDelete('warehouses', null, {});
            
            
            await queryInterface.bulkDelete('locations', null, {});
            
            
            await queryInterface.bulkDelete('items', null, {});
            
            
            await queryInterface.bulkDelete('approved_vendors', null, {});
            
            
            await queryInterface.bulkDelete('boms', null, {});
            
            
            await queryInterface.bulkDelete('bom_lines', null, {});
            
            
            await queryInterface.bulkDelete('routings', null, {});
            
            
            await queryInterface.bulkDelete('work_centers', null, {});
            
            
            await queryInterface.bulkDelete('routing_operations', null, {});
            
            
            await queryInterface.bulkDelete('machines', null, {});
            
            
            await queryInterface.bulkDelete('machine_events', null, {});
            
            
            await queryInterface.bulkDelete('reason_codes', null, {});
            
            
            await queryInterface.bulkDelete('work_orders', null, {});
            
            
            await queryInterface.bulkDelete('work_order_operations', null, {});
            
            
            await queryInterface.bulkDelete('lots', null, {});
            
            
            await queryInterface.bulkDelete('serials', null, {});
            
            
            await queryInterface.bulkDelete('inventory_balances', null, {});
            
            
            await queryInterface.bulkDelete('inventory_movements', null, {});
            
            
            await queryInterface.bulkDelete('purchase_orders', null, {});
            
            
            await queryInterface.bulkDelete('purchase_order_lines', null, {});
            
            
            await queryInterface.bulkDelete('inspection_plans', null, {});
            
            
            await queryInterface.bulkDelete('inspection_characteristics', null, {});
            
            
            await queryInterface.bulkDelete('inspections', null, {});
            
            
            await queryInterface.bulkDelete('inspection_results', null, {});
            
            
            await queryInterface.bulkDelete('nonconformances', null, {});
            
            
            await queryInterface.bulkDelete('disposition_codes', null, {});
            
            
            await queryInterface.bulkDelete('capa_actions', null, {});
            
            
            await queryInterface.bulkDelete('audit_logs', null, {});
            
        
    },
};