18663 lines
411 KiB
JavaScript
18663 lines
411 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Suppliers = db.suppliers;
|
|
|
|
const Customers = db.customers;
|
|
|
|
const Plants = db.plants;
|
|
|
|
const Warehouses = db.warehouses;
|
|
|
|
const StorageLocations = db.storage_locations;
|
|
|
|
const UnitsOfMeasure = db.units_of_measure;
|
|
|
|
const Materials = db.materials;
|
|
|
|
const MaterialRevisions = db.material_revisions;
|
|
|
|
const Boms = db.boms;
|
|
|
|
const BomLines = db.bom_lines;
|
|
|
|
const Routings = db.routings;
|
|
|
|
const Operations = db.operations;
|
|
|
|
const WorkCenters = db.work_centers;
|
|
|
|
const Machines = db.machines;
|
|
|
|
const MachineReadings = db.machine_readings;
|
|
|
|
const MaintenanceWorkOrders = db.maintenance_work_orders;
|
|
|
|
const Shifts = db.shifts;
|
|
|
|
const ProductionOrders = db.production_orders;
|
|
|
|
const WorkOrderOperations = db.work_order_operations;
|
|
|
|
const InventoryLots = db.inventory_lots;
|
|
|
|
const InventoryTransactions = db.inventory_transactions;
|
|
|
|
const PurchaseOrders = db.purchase_orders;
|
|
|
|
const PurchaseOrderLines = db.purchase_order_lines;
|
|
|
|
const QualityStandards = db.quality_standards;
|
|
|
|
const InspectionPlans = db.inspection_plans;
|
|
|
|
const Inspections = db.inspections;
|
|
|
|
const Nonconformances = db.nonconformances;
|
|
|
|
const Capas = db.capas;
|
|
|
|
const Alerts = db.alerts;
|
|
|
|
const CsvImportJobs = db.csv_import_jobs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SuppliersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"supplier_name": "North River Metals",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_code": "NRM-001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Elena Ortiz",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "elena.ortiz@northrivermetals.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "555-0201",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "2450 Riverbend Ave, Dayton, OH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Provides aluminum sheet and bar stock.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"supplier_name": "Precision Bearings Co",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_code": "PBC-014",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Samir Gupta",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "samir.gupta@precisionbearings.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "555-0202",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "880 Industrial Park Rd, Toledo, OH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "on_hold",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Preferred supplier for bearings and seals.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"supplier_name": "SafeChem Supplies",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_code": "SCS-033",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Hannah Brooks",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "hannah.brooks@safechem.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "555-0203",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "19 Commerce Way, Columbus, OH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "on_hold",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Consumables and cleaning chemicals with SDS documentation.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"supplier_name": "Omega Controls",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_code": "OMC-207",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Victor Nguyen",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "victor.nguyen@omegacontrols.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "555-0204",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "5100 Tech Blvd, Ann Arbor, MI",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Supplier on hold pending corrective action response.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"supplier_name": "IronPeak Packaging",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_code": "IPP-089",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Naomi Reed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "naomi.reed@ironpeakpackaging.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "555-0205",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "3000 Boxwood Dr, Fort Wayne, IN",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "on_hold",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Cartons, labels, and pallets.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CustomersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"customer_name": "Apex Hydraulics",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_code": "APX-100",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Derek Hall",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "derek.hall@apexhydraulics.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "555-0301",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "1200 Assembly Ln, Indianapolis, IN",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ships weekly with ASN required.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"customer_name": "Summit Ag Equipment",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_code": "SAE-240",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Priya Nair",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "priya.nair@summitageq.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "555-0302",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "75 Fieldstone Rd, Des Moines, IA",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "on_hold",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Requires certificate of conformance per lot.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"customer_name": "BlueLine Robotics",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_code": "BLR-055",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Owen Price",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "owen.price@bluelinerobotics.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "555-0303",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "900 Innovation Dr, Pittsburgh, PA",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Prototype orders with frequent revision changes.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"customer_name": "Harbor Energy Systems",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_code": "HES-312",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Mei Tan",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "mei.tan@harborenergy.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "555-0304",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "4100 Grid Ave, Cleveland, OH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "on_hold",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Credit hold until account review complete.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"customer_name": "Canyon Industrial Supply",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_code": "CIS-078",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Luis Romero",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "luis.romero@canyonindustrial.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "555-0305",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "600 Warehouse Pkwy, Louisville, KY",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Distributor account with mixed SKU shipments.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PlantsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"plant_name": "Dayton Main Plant",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"plant_code": "DMP",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "America/New_York",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "100 Foundry Rd, Dayton, OH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"plant_name": "Toledo Fabrication",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"plant_code": "TFB",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "America/New_York",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "44 Steel St, Toledo, OH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"plant_name": "Columbus Assembly",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"plant_code": "CAS",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "America/New_York",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "2100 Line Dr, Columbus, OH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"plant_name": "Fort Wayne Packaging",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"plant_code": "FWP",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "America/Indiana/Indianapolis",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "88 Carton Ct, Fort Wayne, IN",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"plant_name": "Ann Arbor Test Lab",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"plant_code": "AAT",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "America/Detroit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address": "12 QA Way, Ann Arbor, MI",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const WarehousesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"warehouse_name": "DMP Raw Materials",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_code": "DMP-RM",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_type": "spares",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Receiving and raw storage.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"warehouse_name": "DMP WIP",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_code": "DMP-WIP",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_type": "finished_goods",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "In-process staging locations.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"warehouse_name": "DMP Finished Goods",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_code": "DMP-FG",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_type": "finished_goods",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Shipping and finished goods storage.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"warehouse_name": "DMP Quarantine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_code": "DMP-QA",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_type": "quarantine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Hold area for inspections and NCRs.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"warehouse_name": "TFB Spares",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_code": "TFB-SP",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_type": "raw_materials",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Maintenance parts for fabrication plant.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const StorageLocationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"location_code": "RM-A01-B01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_name": "Raw Aisle 01 Bin 01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_type": "staging",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Aluminum sheet storage.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"location_code": "RM-A01-B02",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_name": "Raw Aisle 01 Bin 02",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_type": "floor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Steel bar stock storage.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"location_code": "WIP-STAGE-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_name": "WIP Staging 01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_type": "bin",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Stage for Operation 20.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"location_code": "FG-RACK-02",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_name": "Finished Goods Rack 02",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_type": "quarantine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Palletized finished goods.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"location_code": "QA-HOLD-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_name": "Quarantine Hold 01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_type": "receiving",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Material on quality hold.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const UnitsOfMeasureData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"uom_name": "Each",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom_code": "EA",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom_type": "count",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"base_multiplier": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Discrete units.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"uom_name": "Kilogram",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom_code": "KG",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom_type": "volume",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"base_multiplier": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Metric weight.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"uom_name": "Meter",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom_code": "M",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom_type": "volume",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"base_multiplier": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Metric length.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"uom_name": "Hour",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom_code": "HR",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom_type": "time",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"base_multiplier": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Labor and machine time.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"uom_name": "Liter",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom_code": "L",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom_type": "count",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"base_multiplier": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Liquids and coolants.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MaterialsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"material_code": "RM-AL-6061-SH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material_name": "Aluminum Sheet 6061",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material_type": "subassembly",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_cost": 4.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_price": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planning_method": "make_to_stock",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_lot_tracked": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_serial_tracked": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_inspection": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shelf_life_days": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"specification": "6061-T6 aluminum sheet per ASTM B209.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "obsolete",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"material_code": "RM-ST-1018-BAR",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material_name": "Steel Bar 1018",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material_type": "consumable",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_cost": 1.9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_price": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planning_method": "make_to_order",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_lot_tracked": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_serial_tracked": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_inspection": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shelf_life_days": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"specification": "1018 cold finished bar stock.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "obsolete",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"material_code": "CP-BRG-6204",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material_name": "Bearing 6204",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material_type": "spare_part",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_cost": 2.35,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_price": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planning_method": "make_to_order",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_lot_tracked": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_serial_tracked": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_inspection": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shelf_life_days": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"specification": "Deep groove bearing 6204, sealed.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "obsolete",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"material_code": "FG-PMP-ASSY-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material_name": "Hydraulic Pump Assembly",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material_type": "consumable",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_cost": 85.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_price": 125,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planning_method": "make_to_stock",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_lot_tracked": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_serial_tracked": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_inspection": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shelf_life_days": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"specification": "Pump assembly with pressure test required.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "obsolete",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"material_code": "CN-CLN-IPA-99",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material_name": "Isopropyl Alcohol 99%",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material_type": "raw",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_cost": 3.1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_price": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planning_method": "make_to_stock",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_lot_tracked": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_serial_tracked": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_inspection": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shelf_life_days": 730,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"specification": "IPA for cleaning, SDS on file.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "obsolete",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MaterialRevisionsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision_code": "A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date('2025-10-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date('2026-12-31T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lifecycle_state": "obsolete",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"change_summary": "Initial released configuration for pump assembly.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approved_at": new Date('2025-09-25T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision_code": "B",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date('2026-01-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date('2027-12-31T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lifecycle_state": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"change_summary": "Updated torque spec and added inspection step.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approved_at": new Date('2025-12-20T10:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision_code": "A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date('2025-01-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date('2027-12-31T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lifecycle_state": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"change_summary": "Material spec baseline for 6061 sheet.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approved_at": new Date('2024-12-15T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision_code": "A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date('2025-01-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date('2027-12-31T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lifecycle_state": "released",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"change_summary": "Approved component bearing spec and supplier.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approved_at": new Date('2024-12-18T11:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision_code": "A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date('2025-06-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date('2027-12-31T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lifecycle_state": "released",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"change_summary": "SDS updated and handling notes revised.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approved_at": new Date('2025-05-20T15:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const BomsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"bom_code": "BOM-PMP-01-MFG",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bom_type": "manufacturing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date('2026-01-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date('2027-12-31T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Manufacturing BOM for pump assembly rev B.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"bom_code": "BOM-PMP-01-ENG",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bom_type": "manufacturing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date('2026-01-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date('2027-12-31T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Engineering BOM aligned to drawing set.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"bom_code": "BOM-AL-SUB-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bom_type": "manufacturing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date('2025-10-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date('2025-12-31T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Deprecated configuration replaced by rev B.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"bom_code": "BOM-PMP-01-PROT",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bom_type": "manufacturing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date('2025-08-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date('2025-09-30T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Prototype BOM for early builds.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"bom_code": "BOM-PMP-01-SERVICE",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bom_type": "manufacturing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date('2026-01-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date('2027-12-31T23:59:59Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Service BOM for field replacements.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const BomLinesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_per": 2.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_factor": 0.02,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "backflush",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference_designator": "AL-SHIELD",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Cut sheet for housing shield.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_per": 1.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_factor": 0.03,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "backflush",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference_designator": "ST-SHAFT",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Shaft bar stock.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_per": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_factor": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "manual",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference_designator": "BRG-SET",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Bearing set installed at assembly.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_per": 0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_factor": 0.05,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "backflush",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference_designator": "IPA-CLEAN",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Cleaning prior to final assembly.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_per": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_factor": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "backflush",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference_designator": "BRG-SET",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Engineering equivalent line item.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const RoutingsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"routing_code": "RTE-PMP-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_batch_size": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Primary routing for pump assembly.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"routing_code": "RTE-PMP-01-PROT",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_batch_size": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Prototype routing with extra checks.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"routing_code": "RTE-RM-CUT-AL",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_batch_size": 50,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Cutting process reference.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"routing_code": "RTE-RM-CUT-ST",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_batch_size": 50,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Draft routing for steel cutting.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"routing_code": "RTE-PMP-01-REWORK",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_batch_size": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Rework routing for failed tests.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const OperationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_number": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_name": "Cut and Prep Components",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_type": "run",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"setup_time_minutes": 30,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_time_minutes_per_unit": 6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"queue_time_minutes": 15,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"move_time_minutes": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_instructions": "Prepare cut blanks and deburr edges to spec.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_number": 20,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_name": "Machine Housing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_type": "setup",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"setup_time_minutes": 45,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_time_minutes_per_unit": 12,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"queue_time_minutes": 20,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"move_time_minutes": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_instructions": "CNC machine housing per program PMP-HSG-02.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_number": 30,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_name": "Assembly",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_type": "setup",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"setup_time_minutes": 20,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_time_minutes_per_unit": 15,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"queue_time_minutes": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"move_time_minutes": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_instructions": "Assemble bearings and shaft, apply torque to spec.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_number": 40,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_name": "Pressure Test",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_type": "setup",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"setup_time_minutes": 15,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_time_minutes_per_unit": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"queue_time_minutes": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"move_time_minutes": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_instructions": "Test to 210 bar for 60 seconds, no leaks allowed.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_number": 50,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_name": "Pack and Label",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_type": "move",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"setup_time_minutes": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_time_minutes_per_unit": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"queue_time_minutes": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"move_time_minutes": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_instructions": "Pack with foam inserts and apply serialized label.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const WorkCentersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"work_center_name": "Cutting Cell A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_center_code": "WC-CUT-A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"center_type": "packaging",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity_units_per_hour": 20,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Saw and deburr station.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"work_center_name": "CNC Machining",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_center_code": "WC-CNC-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"center_type": "inspection",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity_units_per_hour": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "CNC mills for housing and shaft.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"work_center_name": "Assembly Line 1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_center_code": "WC-ASM-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"center_type": "assembly",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity_units_per_hour": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Mechanical assembly benches.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"work_center_name": "Test Stand",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_center_code": "WC-TST-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"center_type": "packaging",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity_units_per_hour": 6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Pressure and leak testing.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"work_center_name": "Packaging",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_center_code": "WC-PKG-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"center_type": "warehouse",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capacity_units_per_hour": 12,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Boxing and labeling.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MachinesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"machine_name": "CNC Mill Haas VF2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_code": "MCH-CNC-001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufacturer": "Haas",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"model": "VF-2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"serial_number": "HF2-11983",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"commissioned_at": new Date('2022-03-10T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_status": "running",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"criticality": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rated_capacity_per_hour": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Primary machining center for housings.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"machine_name": "Bandsaw Kasto A3",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_code": "MCH-CUT-003",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufacturer": "Kasto",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"model": "A3",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"serial_number": "KA3-55821",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"commissioned_at": new Date('2020-07-15T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_status": "maintenance",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"criticality": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rated_capacity_per_hour": 18,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Cuts bar and sheet stock to length.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"machine_name": "Torque Station Atlas",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_code": "MCH-ASM-007",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufacturer": "Atlas Copco",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"model": "STwrench",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"serial_number": "AC-77012",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"commissioned_at": new Date('2021-11-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_status": "running",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"criticality": "high",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rated_capacity_per_hour": 8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Calibration due this month.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"machine_name": "Pressure Test Rig PR-210",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_code": "MCH-TST-002",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufacturer": "Omega Controls",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"model": "PR-210",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"serial_number": "PR210-2209",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"commissioned_at": new Date('2019-05-20T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_status": "down",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"criticality": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rated_capacity_per_hour": 6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Uses data logger for test results.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"machine_name": "Label Printer ZT410",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_code": "MCH-PKG-011",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufacturer": "Zebra",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"model": "ZT410",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"serial_number": "ZB-410-9901",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"commissioned_at": new Date('2023-02-05T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_status": "down",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"criticality": "high",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rated_capacity_per_hour": 30,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Print head replacement scheduled.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MachineReadingsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reading_at": new Date('2026-01-10T09:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metric": "power_kw",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metric_value": 42.6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"source": "edge_gateway_01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Stable temperature during run.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reading_at": new Date('2026-01-10T09:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metric": "parts_count",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metric_value": 2.1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"source": "edge_gateway_01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Within normal range.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reading_at": new Date('2026-01-10T08:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metric": "parts_count",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metric_value": 210,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"source": "test_logger_01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Target pressure reached for test cycle.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reading_at": new Date('2026-01-10T07:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metric": "power_kw",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metric_value": 120,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"source": "operator_entry",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Shift count entry.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reading_at": new Date('2026-01-10T06:50:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metric": "vibration_mm_s",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metric_value": 35,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"source": "maintenance_app",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Downtime due to print head fault.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MaintenanceWorkOrdersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"maintenance_code": "MWO-2026-0012",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"maintenance_type": "preventive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "high",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "requested",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-09T15:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date('2026-01-10T13:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date('2026-01-10T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-01-10T14:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"problem_description": "Label printer is down with print head error.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_performed": "Replaced print head and cleaned platen roller.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"labor_hours": 1.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"maintenance_code": "MWO-2026-0013",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"maintenance_type": "preventive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "medium",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-08T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date('2026-01-10T08:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date('2026-01-10T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-01-10T12:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"problem_description": "Torque station calibration due for compliance.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_performed": "Performed calibration and updated certificate.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"labor_hours": 3.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"maintenance_code": "MWO-2026-0014",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"maintenance_type": "preventive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "requested",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-07T09:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date('2026-01-11T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date('2026-01-11T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-01-11T16:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"problem_description": "Quarterly PM for CNC mill.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_performed": "Inspected lubrication, checked coolant, cleaned filters.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"labor_hours": 2.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"maintenance_code": "MWO-2026-0015",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"maintenance_type": "inspection",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-06T13:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date('2026-01-07T08:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date('2026-01-07T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-01-07T09:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"problem_description": "Monthly inspection of hoses and fittings.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_performed": "Replaced worn O-ring and verified leak free.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"labor_hours": 0.8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"maintenance_code": "MWO-2026-0016",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"maintenance_type": "inspection",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "requested",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-10T07:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date('2026-01-12T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date('2026-01-12T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-01-12T11:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"problem_description": "Saw blade wear indicator triggered.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_performed": "Replaced blade and verified cut accuracy.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"labor_hours": 1.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ShiftsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"shift_name": "DMP Day Shift",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shift_type": "swing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date('2026-01-10T13:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date('2026-01-10T21:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Standard weekday day shift.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"shift_name": "DMP Night Shift",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shift_type": "night",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date('2026-01-10T21:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date('2026-01-11T05:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Reduced staffing after 10pm.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"shift_name": "TFB Day Shift",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shift_type": "day",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date('2026-01-10T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date('2026-01-10T20:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Machining team shift.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"shift_name": "CAS Day Shift",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shift_type": "night",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date('2026-01-10T13:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date('2026-01-10T21:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Assembly line standard shift.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"shift_name": "FWP Day Shift",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shift_type": "swing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date('2026-01-10T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date('2026-01-10T22:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Packaging and shipping shift.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ProductionOrdersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"order_number": "PO-100245",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_type": "mts",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_quantity": 25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_quantity": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_start_at": new Date('2026-01-08T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_end_at": new Date('2026-01-12T20:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"released_at": new Date('2026-01-08T11:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-01-13T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Priority build for Apex Hydraulics.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"order_number": "PO-100246",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_type": "rework",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_quantity": 15,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_quantity": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_start_at": new Date('2026-01-11T13:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_end_at": new Date('2026-01-14T21:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"released_at": new Date('2026-01-10T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-01-15T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Include CoC with shipment.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"order_number": "PO-100247",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_type": "trial",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_quantity": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_quantity": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_start_at": new Date('2026-01-13T13:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_end_at": new Date('2026-01-13T20:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"released_at": new Date('2026-01-12T15:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-01-14T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Rework after failed pressure test on prior lot.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"order_number": "PO-100248",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_type": "mto",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "on_hold",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_quantity": 40,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_quantity": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_start_at": new Date('2026-01-15T13:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_end_at": new Date('2026-01-20T21:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"released_at": new Date('2026-01-14T15:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-01-22T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "On hold pending label printer repair confirmation.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"order_number": "PO-100249",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_type": "mts",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "released",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_quantity": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_quantity": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_start_at": new Date('2026-01-02T13:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_end_at": new Date('2026-01-06T21:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"released_at": new Date('2026-01-02T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-01-07T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Completed and shipped on time.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const WorkOrderOperationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date('2026-01-08T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date('2026-01-08T18:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-08T14:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ended_at": new Date('2026-01-08T17:50:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"good_quantity": 25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_quantity": 0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operator_notes": "Minor burrs removed, within scrap allowance.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date('2026-01-09T13:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date('2026-01-10T18:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-09T13:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ended_at": new Date('2026-01-10T17:40:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"good_quantity": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_quantity": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operator_notes": "Program ran stable, tool change after part 8.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "ready",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date('2026-01-10T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date('2026-01-10T21:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-10T14:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ended_at": new Date('2026-01-10T20:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"good_quantity": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_quantity": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operator_notes": "Waiting for calibrated torque station signoff.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "paused",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date('2026-01-11T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date('2026-01-11T18:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-11T14:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ended_at": new Date('2026-01-11T17:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"good_quantity": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_quantity": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operator_notes": "Test stand reserved for afternoon.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "blocked",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date('2026-01-12T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date('2026-01-12T18:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-12T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ended_at": new Date('2026-01-12T14:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"good_quantity": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_quantity": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operator_notes": "Blocked due to label printer downtime.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const InventoryLotsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"lot_number": "LOT-AL-260110-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lot_status": "consumed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_on_hand": 1250,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"received_at": new Date('2026-01-10T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufactured_at": new Date('2025-12-15T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2027-12-15T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"certificate_number": "COC-NRM-88921",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Received with full COC and mill test report.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"lot_number": "LOT-ST-260108-02",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lot_status": "expired",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_on_hand": 800,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"received_at": new Date('2026-01-08T10:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufactured_at": new Date('2025-12-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2027-12-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"certificate_number": "COC-NRM-88710",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "In quarantine pending incoming inspection.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"lot_number": "LOT-BRG-260109-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lot_status": "quarantine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_on_hand": 500,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"received_at": new Date('2026-01-09T09:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufactured_at": new Date('2025-11-20T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2027-11-20T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"certificate_number": "COC-PBC-12044",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Random sample inspected, passed.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"lot_number": "LOT-IPA-260101-03",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lot_status": "consumed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_on_hand": 120,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"received_at": new Date('2026-01-01T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufactured_at": new Date('2025-10-15T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2027-10-15T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"certificate_number": "SDS-SCS-5510",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Store away from ignition sources.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"lot_number": "LOT-FG-PMP-260106-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lot_status": "consumed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_on_hand": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"received_at": new Date('2026-01-06T19:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufactured_at": new Date('2026-01-06T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2028-01-06T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"certificate_number": "COC-INTERNAL-260106",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Blocked due to pressure test retest required.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const InventoryTransactionsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"transaction_at": new Date('2026-01-10T11:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "receipt",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1250,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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": "RCV-77821",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason": "Supplier delivery receipt.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"transaction_at": new Date('2026-01-09T09:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "shipment",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 500,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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": "RCV-77710",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason": "Receipt against purchase order.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"transaction_at": new Date('2026-01-09T14:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "shipment",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 20,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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": "ISS-PO-100245",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason": "Kitting for assembly operation.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"transaction_at": new Date('2026-01-08T10:25:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "move",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 800,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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": "RCV-77555",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason": "Receipt placed into quarantine for inspection.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"transaction_at": new Date('2026-01-06T19:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "adjustment",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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": "MOVE-FG-260106",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason": "Move to finished goods after packaging.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PurchaseOrdersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"po_number": "PUR-50091",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "cancelled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_at": new Date('2025-12-28T15:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expected_at": new Date('2026-01-10T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Aluminum sheet replenishment.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"po_number": "PUR-50092",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "closed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_at": new Date('2026-01-03T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expected_at": new Date('2026-01-09T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Bearings for January schedule.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"po_number": "PUR-50093",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "received",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_at": new Date('2026-01-06T09:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expected_at": new Date('2026-01-14T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "IPA and cleaning wipes.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"po_number": "PUR-50094",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "received",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_at": new Date('2026-01-08T13:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expected_at": new Date('2026-01-16T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Boxes and labels for pump shipments.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"po_number": "PUR-50095",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "partially_received",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_at": new Date('2025-12-20T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expected_at": new Date('2025-12-30T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Cancelled due to supplier issue.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PurchaseOrderLinesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_quantity": 1250,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 4.15,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"need_by_at": new Date('2026-01-10T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_notes": "Deliver with mill test report.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_quantity": 600,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 2.3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"need_by_at": new Date('2026-01-09T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_notes": "Sealed bearings only.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_quantity": 400,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 2.25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"need_by_at": new Date('2026-01-16T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_notes": "Second batch for late January builds.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_quantity": 200,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 3.05,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"need_by_at": new Date('2026-01-14T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_notes": "Include SDS document in shipment.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_quantity": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"need_by_at": new Date('2026-01-16T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_notes": "Placeholder line for packaging components.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const QualityStandardsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"standard_name": "Pump Assembly Final Inspection",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_code": "QS-PMP-FINAL",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"inspection_type": "audit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requirements": "Verify torque, serialization, pressure test record, and visual inspection.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"standard_name": "Incoming Metals Verification",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_code": "QS-IN-RM",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"inspection_type": "incoming",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requirements": "Check COC, thickness, and surface defects on receipt.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"standard_name": "Bearing Incoming Inspection",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_code": "QS-IN-BRG",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"inspection_type": "audit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requirements": "Verify part marking, seal integrity, and AQL sampling.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"standard_name": "In-Process Machining Check",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_code": "QS-IP-CNC",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"inspection_type": "incoming",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requirements": "Measure critical dimensions after Operation 20.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"standard_name": "Internal Audit Checklist",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_code": "QS-AUD-001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"inspection_type": "audit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requirements": "Audit documentation completeness and training records.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const InspectionPlansData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"plan_name": "Final Inspection Plan Pump Rev B",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sampling_method": "100_percent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Inspect every unit, attach pressure test record and label verification.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"plan_name": "Incoming Aluminum AQL",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sampling_method": "100_percent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 32,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Sample per AQL 1.0, verify COC and surface condition.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"plan_name": "Incoming Bearing AQL",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sampling_method": "fixed_n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 20,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Check marking, packaging integrity, and random spin test.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"plan_name": "In-Process CNC Dimensional",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sampling_method": "aql",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Measure first article and every fifth part.",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"plan_name": "Quarterly Documentation Audit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sampling_method": "aql",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Review 10 randomly selected completed orders.",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const InspectionsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"inspection_number": "INSP-260110-001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-10T11:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-01-10T12:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result": "pending",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 32,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "COC verified, surface acceptable, thickness within tolerance.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"inspection_number": "INSP-260108-002",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-08T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-01-08T11:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result": "fail",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 32,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Awaiting micrometer calibration check before final disposition.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"inspection_number": "INSP-260109-003",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-09T09:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-01-09T10:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result": "fail",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 20,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Packaging intact, markings correct, sample spin test passed.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"inspection_number": "INSP-260110-004",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-10T15:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-01-10T15:25:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result": "fail",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "One dimension near upper limit; continue with increased monitoring.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"inspection_number": "INSP-260106-005",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-06T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-01-06T18:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result": "pending",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Pressure test record missing for serialized unit.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const NonconformancesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"ncr_number": "NCR-260106-001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "critical",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "open",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Missing pressure test record for one serialized unit in lot.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"containment_action": "Moved affected units to blocked status and initiated record trace.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date('2026-01-06T18:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date('2026-01-09T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"ncr_number": "NCR-260110-002",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "major",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "closed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Dimensional reading near limit on CNC operation sample.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"containment_action": "Added extra in-process checks every third part.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date('2026-01-10T15:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date('2026-01-12T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"ncr_number": "NCR-260108-003",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "minor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "closed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Incoming steel bar inspection not completed within SLA.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"containment_action": "Kept material in quarantine; expedited inspection scheduling.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date('2026-01-08T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date('2026-01-11T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"ncr_number": "NCR-260109-004",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "minor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "open",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "One bearing carton had minor outer packaging damage.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"containment_action": "Inspected contents and repacked; no part damage found.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date('2026-01-09T10:25:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date('2026-01-09T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"ncr_number": "NCR-260110-005",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "major",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "open",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Surface scuff observed on two sheets in sample.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"containment_action": "Marked sheets for non-cosmetic internal use only.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date('2026-01-10T12:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date('2026-01-10T13:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CapasData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"capa_number": "CAPA-260106-001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capa_type": "preventive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "closed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date('2026-01-07T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-01-21T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date('2026-01-22T15:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"root_cause": "Test record attachment step not enforced before move to finished goods.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action_plan": "Update workflow checklist and add required record verification at Operation 40.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effectiveness_notes": "Monitor next 20 units for complete records.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"capa_number": "CAPA-260110-002",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capa_type": "preventive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "open",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date('2026-01-10T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-01-24T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date('2026-01-25T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"root_cause": "Tool wear trending not captured early enough.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action_plan": "Implement tool life tracking and add SPC chart review daily.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effectiveness_notes": "Verify trend alerts reduce near-limit measurements.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"capa_number": "CAPA-260108-003",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capa_type": "corrective",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "closed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date('2026-01-08T13:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-01-15T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date('2026-01-18T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"root_cause": "Inspection capacity mismatch during schedule peak.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action_plan": "Add backup inspector coverage and auto alert for aging quarantine lots.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effectiveness_notes": "Quarantine aging reduced below 24 hours for two weeks.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"capa_number": "CAPA-260109-004",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capa_type": "preventive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "open",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date('2026-01-09T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-01-16T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date('2026-01-14T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"root_cause": "Receiving handling practices caused carton abrasion.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action_plan": "Train receiving team on pallet strapping and corner protection.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effectiveness_notes": "No repeat damage in subsequent receipts.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"capa_number": "CAPA-260110-005",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capa_type": "preventive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date('2026-01-10T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-01-17T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date('2026-01-12T08:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"root_cause": "Supplier packaging insufficient for transit.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action_plan": "Request improved interleaving and protective film from supplier.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effectiveness_notes": "Supplier confirmed packaging update for next shipment.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AlertsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"alert_type": "certificate_missing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "warning",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "acknowledged",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title_text": "Label printer down",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Packaging label printer MCH-PKG-011 is down; shipments may be delayed.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"triggered_at": new Date('2026-01-10T06:55:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"acknowledged_at": new Date('2026-01-10T07:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"resolved_at": new Date('2026-01-10T14:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"alert_type": "order_late",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "critical",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "acknowledged",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title_text": "Final inspection failed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Final inspection INSP-260106-005 failed due to missing pressure test record.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"triggered_at": new Date('2026-01-06T18:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"acknowledged_at": new Date('2026-01-06T18:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"resolved_at": new Date('2026-01-09T16:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"alert_type": "qa_failure",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "info",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "acknowledged",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title_text": "Bearing stock low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Bearing 6204 on-hand trending below reorder point for next week schedule.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"triggered_at": new Date('2026-01-10T08:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"acknowledged_at": new Date('2026-01-10T08:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"resolved_at": new Date('2026-01-12T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"alert_type": "temperature_high",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "critical",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "resolved",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title_text": "Torque station calibration overdue",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Torque station MCH-ASM-007 calibration due for compliance.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"triggered_at": new Date('2026-01-08T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"acknowledged_at": new Date('2026-01-08T09:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"resolved_at": new Date('2026-01-10T12:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"alert_type": "maintenance_overdue",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "warning",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "open",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title_text": "COC document missing on receipt",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Lot LOT-ST-260108-02 is missing complete documentation; keep in quarantine.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"triggered_at": new Date('2026-01-08T10:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"acknowledged_at": new Date('2026-01-08T10:40:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"resolved_at": new Date('2026-01-11T10:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CsvImportJobsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"import_entity": "operations",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "failed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-05T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-05T09:02:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"finished_at": new Date('2026-01-05T09:04:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"records_processed": 48,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"records_failed": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"error_log": "None",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"import_entity": "machines",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "failed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-05T09:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-05T09:11:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"finished_at": new Date('2026-01-05T09:12:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"records_processed": 12,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"records_failed": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"error_log": "None",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"import_entity": "boms",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "failed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-05T09:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-05T09:16:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"finished_at": new Date('2026-01-05T09:17:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"records_processed": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"records_failed": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"error_log": "Row 7 missing component material code; Row 9 invalid quantity; Row 10 unknown UoM code",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"import_entity": "boms",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "failed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-07T08:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-07T08:31:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"finished_at": new Date('2026-01-07T08:33:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"records_processed": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"records_failed": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"error_log": "None",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"import_entity": "routings",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "running",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-10T06:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2026-01-10T06:01:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"finished_at": new Date('2026-01-10T06:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"records_processed": 120,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"records_failed": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"error_log": "Row 52 invalid warehouse code; Row 88 missing lot number",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWarehousWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Warehous0 = await Warehouses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Warehous0?.setPlant)
|
|
{
|
|
await
|
|
Warehous0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Warehous1 = await Warehouses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Warehous1?.setPlant)
|
|
{
|
|
await
|
|
Warehous1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Warehous2 = await Warehouses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Warehous2?.setPlant)
|
|
{
|
|
await
|
|
Warehous2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Warehous3 = await Warehouses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Warehous3?.setPlant)
|
|
{
|
|
await
|
|
Warehous3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
const relatedPlant4 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Warehous4 = await Warehouses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Warehous4?.setPlant)
|
|
{
|
|
await
|
|
Warehous4.
|
|
setPlant(relatedPlant4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateStorageLocationWithWarehouse() {
|
|
|
|
const relatedWarehouse0 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const StorageLocation0 = await StorageLocations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (StorageLocation0?.setWarehouse)
|
|
{
|
|
await
|
|
StorageLocation0.
|
|
setWarehouse(relatedWarehouse0);
|
|
}
|
|
|
|
const relatedWarehouse1 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const StorageLocation1 = await StorageLocations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (StorageLocation1?.setWarehouse)
|
|
{
|
|
await
|
|
StorageLocation1.
|
|
setWarehouse(relatedWarehouse1);
|
|
}
|
|
|
|
const relatedWarehouse2 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const StorageLocation2 = await StorageLocations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (StorageLocation2?.setWarehouse)
|
|
{
|
|
await
|
|
StorageLocation2.
|
|
setWarehouse(relatedWarehouse2);
|
|
}
|
|
|
|
const relatedWarehouse3 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const StorageLocation3 = await StorageLocations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (StorageLocation3?.setWarehouse)
|
|
{
|
|
await
|
|
StorageLocation3.
|
|
setWarehouse(relatedWarehouse3);
|
|
}
|
|
|
|
const relatedWarehouse4 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const StorageLocation4 = await StorageLocations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (StorageLocation4?.setWarehouse)
|
|
{
|
|
await
|
|
StorageLocation4.
|
|
setWarehouse(relatedWarehouse4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaterialWithDefault_uom() {
|
|
|
|
const relatedDefault_uom0 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const Material0 = await Materials.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Material0?.setDefault_uom)
|
|
{
|
|
await
|
|
Material0.
|
|
setDefault_uom(relatedDefault_uom0);
|
|
}
|
|
|
|
const relatedDefault_uom1 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const Material1 = await Materials.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Material1?.setDefault_uom)
|
|
{
|
|
await
|
|
Material1.
|
|
setDefault_uom(relatedDefault_uom1);
|
|
}
|
|
|
|
const relatedDefault_uom2 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const Material2 = await Materials.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Material2?.setDefault_uom)
|
|
{
|
|
await
|
|
Material2.
|
|
setDefault_uom(relatedDefault_uom2);
|
|
}
|
|
|
|
const relatedDefault_uom3 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const Material3 = await Materials.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Material3?.setDefault_uom)
|
|
{
|
|
await
|
|
Material3.
|
|
setDefault_uom(relatedDefault_uom3);
|
|
}
|
|
|
|
const relatedDefault_uom4 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const Material4 = await Materials.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Material4?.setDefault_uom)
|
|
{
|
|
await
|
|
Material4.
|
|
setDefault_uom(relatedDefault_uom4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaterialWithPreferred_supplier() {
|
|
|
|
const relatedPreferred_supplier0 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const Material0 = await Materials.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Material0?.setPreferred_supplier)
|
|
{
|
|
await
|
|
Material0.
|
|
setPreferred_supplier(relatedPreferred_supplier0);
|
|
}
|
|
|
|
const relatedPreferred_supplier1 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const Material1 = await Materials.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Material1?.setPreferred_supplier)
|
|
{
|
|
await
|
|
Material1.
|
|
setPreferred_supplier(relatedPreferred_supplier1);
|
|
}
|
|
|
|
const relatedPreferred_supplier2 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const Material2 = await Materials.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Material2?.setPreferred_supplier)
|
|
{
|
|
await
|
|
Material2.
|
|
setPreferred_supplier(relatedPreferred_supplier2);
|
|
}
|
|
|
|
const relatedPreferred_supplier3 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const Material3 = await Materials.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Material3?.setPreferred_supplier)
|
|
{
|
|
await
|
|
Material3.
|
|
setPreferred_supplier(relatedPreferred_supplier3);
|
|
}
|
|
|
|
const relatedPreferred_supplier4 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const Material4 = await Materials.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Material4?.setPreferred_supplier)
|
|
{
|
|
await
|
|
Material4.
|
|
setPreferred_supplier(relatedPreferred_supplier4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaterialRevisionWithMaterial() {
|
|
|
|
const relatedMaterial0 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const MaterialRevision0 = await MaterialRevisions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialRevision0?.setMaterial)
|
|
{
|
|
await
|
|
MaterialRevision0.
|
|
setMaterial(relatedMaterial0);
|
|
}
|
|
|
|
const relatedMaterial1 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const MaterialRevision1 = await MaterialRevisions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialRevision1?.setMaterial)
|
|
{
|
|
await
|
|
MaterialRevision1.
|
|
setMaterial(relatedMaterial1);
|
|
}
|
|
|
|
const relatedMaterial2 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const MaterialRevision2 = await MaterialRevisions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialRevision2?.setMaterial)
|
|
{
|
|
await
|
|
MaterialRevision2.
|
|
setMaterial(relatedMaterial2);
|
|
}
|
|
|
|
const relatedMaterial3 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const MaterialRevision3 = await MaterialRevisions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialRevision3?.setMaterial)
|
|
{
|
|
await
|
|
MaterialRevision3.
|
|
setMaterial(relatedMaterial3);
|
|
}
|
|
|
|
const relatedMaterial4 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const MaterialRevision4 = await MaterialRevisions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MaterialRevision4?.setMaterial)
|
|
{
|
|
await
|
|
MaterialRevision4.
|
|
setMaterial(relatedMaterial4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaterialRevisionWithApproved_by_user() {
|
|
|
|
const relatedApproved_by_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaterialRevision0 = await MaterialRevisions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialRevision0?.setApproved_by_user)
|
|
{
|
|
await
|
|
MaterialRevision0.
|
|
setApproved_by_user(relatedApproved_by_user0);
|
|
}
|
|
|
|
const relatedApproved_by_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaterialRevision1 = await MaterialRevisions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialRevision1?.setApproved_by_user)
|
|
{
|
|
await
|
|
MaterialRevision1.
|
|
setApproved_by_user(relatedApproved_by_user1);
|
|
}
|
|
|
|
const relatedApproved_by_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaterialRevision2 = await MaterialRevisions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialRevision2?.setApproved_by_user)
|
|
{
|
|
await
|
|
MaterialRevision2.
|
|
setApproved_by_user(relatedApproved_by_user2);
|
|
}
|
|
|
|
const relatedApproved_by_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaterialRevision3 = await MaterialRevisions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialRevision3?.setApproved_by_user)
|
|
{
|
|
await
|
|
MaterialRevision3.
|
|
setApproved_by_user(relatedApproved_by_user3);
|
|
}
|
|
|
|
const relatedApproved_by_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaterialRevision4 = await MaterialRevisions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MaterialRevision4?.setApproved_by_user)
|
|
{
|
|
await
|
|
MaterialRevision4.
|
|
setApproved_by_user(relatedApproved_by_user4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateBomWithParent_material() {
|
|
|
|
const relatedParent_material0 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Bom0 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Bom0?.setParent_material)
|
|
{
|
|
await
|
|
Bom0.
|
|
setParent_material(relatedParent_material0);
|
|
}
|
|
|
|
const relatedParent_material1 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Bom1 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Bom1?.setParent_material)
|
|
{
|
|
await
|
|
Bom1.
|
|
setParent_material(relatedParent_material1);
|
|
}
|
|
|
|
const relatedParent_material2 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Bom2 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Bom2?.setParent_material)
|
|
{
|
|
await
|
|
Bom2.
|
|
setParent_material(relatedParent_material2);
|
|
}
|
|
|
|
const relatedParent_material3 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Bom3 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Bom3?.setParent_material)
|
|
{
|
|
await
|
|
Bom3.
|
|
setParent_material(relatedParent_material3);
|
|
}
|
|
|
|
const relatedParent_material4 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Bom4 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Bom4?.setParent_material)
|
|
{
|
|
await
|
|
Bom4.
|
|
setParent_material(relatedParent_material4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateBomWithRevision() {
|
|
|
|
const relatedRevision0 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const Bom0 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Bom0?.setRevision)
|
|
{
|
|
await
|
|
Bom0.
|
|
setRevision(relatedRevision0);
|
|
}
|
|
|
|
const relatedRevision1 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const Bom1 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Bom1?.setRevision)
|
|
{
|
|
await
|
|
Bom1.
|
|
setRevision(relatedRevision1);
|
|
}
|
|
|
|
const relatedRevision2 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const Bom2 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Bom2?.setRevision)
|
|
{
|
|
await
|
|
Bom2.
|
|
setRevision(relatedRevision2);
|
|
}
|
|
|
|
const relatedRevision3 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const Bom3 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Bom3?.setRevision)
|
|
{
|
|
await
|
|
Bom3.
|
|
setRevision(relatedRevision3);
|
|
}
|
|
|
|
const relatedRevision4 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const Bom4 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Bom4?.setRevision)
|
|
{
|
|
await
|
|
Bom4.
|
|
setRevision(relatedRevision4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_material() {
|
|
|
|
const relatedComponent_material0 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const BomLine0 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (BomLine0?.setComponent_material)
|
|
{
|
|
await
|
|
BomLine0.
|
|
setComponent_material(relatedComponent_material0);
|
|
}
|
|
|
|
const relatedComponent_material1 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const BomLine1 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (BomLine1?.setComponent_material)
|
|
{
|
|
await
|
|
BomLine1.
|
|
setComponent_material(relatedComponent_material1);
|
|
}
|
|
|
|
const relatedComponent_material2 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const BomLine2 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (BomLine2?.setComponent_material)
|
|
{
|
|
await
|
|
BomLine2.
|
|
setComponent_material(relatedComponent_material2);
|
|
}
|
|
|
|
const relatedComponent_material3 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const BomLine3 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (BomLine3?.setComponent_material)
|
|
{
|
|
await
|
|
BomLine3.
|
|
setComponent_material(relatedComponent_material3);
|
|
}
|
|
|
|
const relatedComponent_material4 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const BomLine4 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (BomLine4?.setComponent_material)
|
|
{
|
|
await
|
|
BomLine4.
|
|
setComponent_material(relatedComponent_material4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateBomLineWithUom() {
|
|
|
|
const relatedUom0 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const BomLine0 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (BomLine0?.setUom)
|
|
{
|
|
await
|
|
BomLine0.
|
|
setUom(relatedUom0);
|
|
}
|
|
|
|
const relatedUom1 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const BomLine1 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (BomLine1?.setUom)
|
|
{
|
|
await
|
|
BomLine1.
|
|
setUom(relatedUom1);
|
|
}
|
|
|
|
const relatedUom2 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const BomLine2 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (BomLine2?.setUom)
|
|
{
|
|
await
|
|
BomLine2.
|
|
setUom(relatedUom2);
|
|
}
|
|
|
|
const relatedUom3 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const BomLine3 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (BomLine3?.setUom)
|
|
{
|
|
await
|
|
BomLine3.
|
|
setUom(relatedUom3);
|
|
}
|
|
|
|
const relatedUom4 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const BomLine4 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (BomLine4?.setUom)
|
|
{
|
|
await
|
|
BomLine4.
|
|
setUom(relatedUom4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateRoutingWithMaterial() {
|
|
|
|
const relatedMaterial0 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Routing0 = await Routings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Routing0?.setMaterial)
|
|
{
|
|
await
|
|
Routing0.
|
|
setMaterial(relatedMaterial0);
|
|
}
|
|
|
|
const relatedMaterial1 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Routing1 = await Routings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Routing1?.setMaterial)
|
|
{
|
|
await
|
|
Routing1.
|
|
setMaterial(relatedMaterial1);
|
|
}
|
|
|
|
const relatedMaterial2 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Routing2 = await Routings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Routing2?.setMaterial)
|
|
{
|
|
await
|
|
Routing2.
|
|
setMaterial(relatedMaterial2);
|
|
}
|
|
|
|
const relatedMaterial3 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Routing3 = await Routings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Routing3?.setMaterial)
|
|
{
|
|
await
|
|
Routing3.
|
|
setMaterial(relatedMaterial3);
|
|
}
|
|
|
|
const relatedMaterial4 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Routing4 = await Routings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Routing4?.setMaterial)
|
|
{
|
|
await
|
|
Routing4.
|
|
setMaterial(relatedMaterial4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateRoutingWithRevision() {
|
|
|
|
const relatedRevision0 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const Routing0 = await Routings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Routing0?.setRevision)
|
|
{
|
|
await
|
|
Routing0.
|
|
setRevision(relatedRevision0);
|
|
}
|
|
|
|
const relatedRevision1 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const Routing1 = await Routings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Routing1?.setRevision)
|
|
{
|
|
await
|
|
Routing1.
|
|
setRevision(relatedRevision1);
|
|
}
|
|
|
|
const relatedRevision2 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const Routing2 = await Routings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Routing2?.setRevision)
|
|
{
|
|
await
|
|
Routing2.
|
|
setRevision(relatedRevision2);
|
|
}
|
|
|
|
const relatedRevision3 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const Routing3 = await Routings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Routing3?.setRevision)
|
|
{
|
|
await
|
|
Routing3.
|
|
setRevision(relatedRevision3);
|
|
}
|
|
|
|
const relatedRevision4 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const Routing4 = await Routings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Routing4?.setRevision)
|
|
{
|
|
await
|
|
Routing4.
|
|
setRevision(relatedRevision4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateOperationWithRouting() {
|
|
|
|
const relatedRouting0 = await Routings.findOne({
|
|
offset: Math.floor(Math.random() * (await Routings.count())),
|
|
});
|
|
const Operation0 = await Operations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Operation0?.setRouting)
|
|
{
|
|
await
|
|
Operation0.
|
|
setRouting(relatedRouting0);
|
|
}
|
|
|
|
const relatedRouting1 = await Routings.findOne({
|
|
offset: Math.floor(Math.random() * (await Routings.count())),
|
|
});
|
|
const Operation1 = await Operations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Operation1?.setRouting)
|
|
{
|
|
await
|
|
Operation1.
|
|
setRouting(relatedRouting1);
|
|
}
|
|
|
|
const relatedRouting2 = await Routings.findOne({
|
|
offset: Math.floor(Math.random() * (await Routings.count())),
|
|
});
|
|
const Operation2 = await Operations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Operation2?.setRouting)
|
|
{
|
|
await
|
|
Operation2.
|
|
setRouting(relatedRouting2);
|
|
}
|
|
|
|
const relatedRouting3 = await Routings.findOne({
|
|
offset: Math.floor(Math.random() * (await Routings.count())),
|
|
});
|
|
const Operation3 = await Operations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Operation3?.setRouting)
|
|
{
|
|
await
|
|
Operation3.
|
|
setRouting(relatedRouting3);
|
|
}
|
|
|
|
const relatedRouting4 = await Routings.findOne({
|
|
offset: Math.floor(Math.random() * (await Routings.count())),
|
|
});
|
|
const Operation4 = await Operations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Operation4?.setRouting)
|
|
{
|
|
await
|
|
Operation4.
|
|
setRouting(relatedRouting4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateOperationWithWork_center() {
|
|
|
|
const relatedWork_center0 = await WorkCenters.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkCenters.count())),
|
|
});
|
|
const Operation0 = await Operations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Operation0?.setWork_center)
|
|
{
|
|
await
|
|
Operation0.
|
|
setWork_center(relatedWork_center0);
|
|
}
|
|
|
|
const relatedWork_center1 = await WorkCenters.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkCenters.count())),
|
|
});
|
|
const Operation1 = await Operations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Operation1?.setWork_center)
|
|
{
|
|
await
|
|
Operation1.
|
|
setWork_center(relatedWork_center1);
|
|
}
|
|
|
|
const relatedWork_center2 = await WorkCenters.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkCenters.count())),
|
|
});
|
|
const Operation2 = await Operations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Operation2?.setWork_center)
|
|
{
|
|
await
|
|
Operation2.
|
|
setWork_center(relatedWork_center2);
|
|
}
|
|
|
|
const relatedWork_center3 = await WorkCenters.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkCenters.count())),
|
|
});
|
|
const Operation3 = await Operations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Operation3?.setWork_center)
|
|
{
|
|
await
|
|
Operation3.
|
|
setWork_center(relatedWork_center3);
|
|
}
|
|
|
|
const relatedWork_center4 = await WorkCenters.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkCenters.count())),
|
|
});
|
|
const Operation4 = await Operations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Operation4?.setWork_center)
|
|
{
|
|
await
|
|
Operation4.
|
|
setWork_center(relatedWork_center4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWorkCenterWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const WorkCenter0 = await WorkCenters.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkCenter0?.setPlant)
|
|
{
|
|
await
|
|
WorkCenter0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const WorkCenter1 = await WorkCenters.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkCenter1?.setPlant)
|
|
{
|
|
await
|
|
WorkCenter1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const WorkCenter2 = await WorkCenters.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkCenter2?.setPlant)
|
|
{
|
|
await
|
|
WorkCenter2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const WorkCenter3 = await WorkCenters.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkCenter3?.setPlant)
|
|
{
|
|
await
|
|
WorkCenter3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
const relatedPlant4 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const WorkCenter4 = await WorkCenters.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (WorkCenter4?.setPlant)
|
|
{
|
|
await
|
|
WorkCenter4.
|
|
setPlant(relatedPlant4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function 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 associateMachineReadingWithMachine() {
|
|
|
|
const relatedMachine0 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MachineReading0 = await MachineReadings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MachineReading0?.setMachine)
|
|
{
|
|
await
|
|
MachineReading0.
|
|
setMachine(relatedMachine0);
|
|
}
|
|
|
|
const relatedMachine1 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MachineReading1 = await MachineReadings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MachineReading1?.setMachine)
|
|
{
|
|
await
|
|
MachineReading1.
|
|
setMachine(relatedMachine1);
|
|
}
|
|
|
|
const relatedMachine2 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MachineReading2 = await MachineReadings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MachineReading2?.setMachine)
|
|
{
|
|
await
|
|
MachineReading2.
|
|
setMachine(relatedMachine2);
|
|
}
|
|
|
|
const relatedMachine3 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MachineReading3 = await MachineReadings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MachineReading3?.setMachine)
|
|
{
|
|
await
|
|
MachineReading3.
|
|
setMachine(relatedMachine3);
|
|
}
|
|
|
|
const relatedMachine4 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MachineReading4 = await MachineReadings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MachineReading4?.setMachine)
|
|
{
|
|
await
|
|
MachineReading4.
|
|
setMachine(relatedMachine4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaintenanceWorkOrderWithMachine() {
|
|
|
|
const relatedMachine0 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MaintenanceWorkOrder0 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaintenanceWorkOrder0?.setMachine)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder0.
|
|
setMachine(relatedMachine0);
|
|
}
|
|
|
|
const relatedMachine1 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MaintenanceWorkOrder1 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaintenanceWorkOrder1?.setMachine)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder1.
|
|
setMachine(relatedMachine1);
|
|
}
|
|
|
|
const relatedMachine2 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MaintenanceWorkOrder2 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaintenanceWorkOrder2?.setMachine)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder2.
|
|
setMachine(relatedMachine2);
|
|
}
|
|
|
|
const relatedMachine3 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MaintenanceWorkOrder3 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaintenanceWorkOrder3?.setMachine)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder3.
|
|
setMachine(relatedMachine3);
|
|
}
|
|
|
|
const relatedMachine4 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MaintenanceWorkOrder4 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MaintenanceWorkOrder4?.setMachine)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder4.
|
|
setMachine(relatedMachine4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaintenanceWorkOrderWithRequested_by_user() {
|
|
|
|
const relatedRequested_by_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaintenanceWorkOrder0 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaintenanceWorkOrder0?.setRequested_by_user)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder0.
|
|
setRequested_by_user(relatedRequested_by_user0);
|
|
}
|
|
|
|
const relatedRequested_by_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaintenanceWorkOrder1 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaintenanceWorkOrder1?.setRequested_by_user)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder1.
|
|
setRequested_by_user(relatedRequested_by_user1);
|
|
}
|
|
|
|
const relatedRequested_by_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaintenanceWorkOrder2 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaintenanceWorkOrder2?.setRequested_by_user)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder2.
|
|
setRequested_by_user(relatedRequested_by_user2);
|
|
}
|
|
|
|
const relatedRequested_by_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaintenanceWorkOrder3 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaintenanceWorkOrder3?.setRequested_by_user)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder3.
|
|
setRequested_by_user(relatedRequested_by_user3);
|
|
}
|
|
|
|
const relatedRequested_by_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaintenanceWorkOrder4 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MaintenanceWorkOrder4?.setRequested_by_user)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder4.
|
|
setRequested_by_user(relatedRequested_by_user4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMaintenanceWorkOrderWithAssigned_to_user() {
|
|
|
|
const relatedAssigned_to_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaintenanceWorkOrder0 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaintenanceWorkOrder0?.setAssigned_to_user)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder0.
|
|
setAssigned_to_user(relatedAssigned_to_user0);
|
|
}
|
|
|
|
const relatedAssigned_to_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaintenanceWorkOrder1 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaintenanceWorkOrder1?.setAssigned_to_user)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder1.
|
|
setAssigned_to_user(relatedAssigned_to_user1);
|
|
}
|
|
|
|
const relatedAssigned_to_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaintenanceWorkOrder2 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaintenanceWorkOrder2?.setAssigned_to_user)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder2.
|
|
setAssigned_to_user(relatedAssigned_to_user2);
|
|
}
|
|
|
|
const relatedAssigned_to_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaintenanceWorkOrder3 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaintenanceWorkOrder3?.setAssigned_to_user)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder3.
|
|
setAssigned_to_user(relatedAssigned_to_user3);
|
|
}
|
|
|
|
const relatedAssigned_to_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaintenanceWorkOrder4 = await MaintenanceWorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MaintenanceWorkOrder4?.setAssigned_to_user)
|
|
{
|
|
await
|
|
MaintenanceWorkOrder4.
|
|
setAssigned_to_user(relatedAssigned_to_user4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateShiftWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Shift0 = await Shifts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Shift0?.setPlant)
|
|
{
|
|
await
|
|
Shift0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Shift1 = await Shifts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Shift1?.setPlant)
|
|
{
|
|
await
|
|
Shift1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Shift2 = await Shifts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Shift2?.setPlant)
|
|
{
|
|
await
|
|
Shift2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Shift3 = await Shifts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Shift3?.setPlant)
|
|
{
|
|
await
|
|
Shift3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
const relatedPlant4 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Shift4 = await Shifts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Shift4?.setPlant)
|
|
{
|
|
await
|
|
Shift4.
|
|
setPlant(relatedPlant4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductionOrderWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const ProductionOrder0 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionOrder0?.setPlant)
|
|
{
|
|
await
|
|
ProductionOrder0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const ProductionOrder1 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionOrder1?.setPlant)
|
|
{
|
|
await
|
|
ProductionOrder1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const ProductionOrder2 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionOrder2?.setPlant)
|
|
{
|
|
await
|
|
ProductionOrder2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const ProductionOrder3 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionOrder3?.setPlant)
|
|
{
|
|
await
|
|
ProductionOrder3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
const relatedPlant4 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const ProductionOrder4 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (ProductionOrder4?.setPlant)
|
|
{
|
|
await
|
|
ProductionOrder4.
|
|
setPlant(relatedPlant4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateProductionOrderWithMaterial() {
|
|
|
|
const relatedMaterial0 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const ProductionOrder0 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionOrder0?.setMaterial)
|
|
{
|
|
await
|
|
ProductionOrder0.
|
|
setMaterial(relatedMaterial0);
|
|
}
|
|
|
|
const relatedMaterial1 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const ProductionOrder1 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionOrder1?.setMaterial)
|
|
{
|
|
await
|
|
ProductionOrder1.
|
|
setMaterial(relatedMaterial1);
|
|
}
|
|
|
|
const relatedMaterial2 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const ProductionOrder2 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionOrder2?.setMaterial)
|
|
{
|
|
await
|
|
ProductionOrder2.
|
|
setMaterial(relatedMaterial2);
|
|
}
|
|
|
|
const relatedMaterial3 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const ProductionOrder3 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionOrder3?.setMaterial)
|
|
{
|
|
await
|
|
ProductionOrder3.
|
|
setMaterial(relatedMaterial3);
|
|
}
|
|
|
|
const relatedMaterial4 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const ProductionOrder4 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (ProductionOrder4?.setMaterial)
|
|
{
|
|
await
|
|
ProductionOrder4.
|
|
setMaterial(relatedMaterial4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateProductionOrderWithRouting() {
|
|
|
|
const relatedRouting0 = await Routings.findOne({
|
|
offset: Math.floor(Math.random() * (await Routings.count())),
|
|
});
|
|
const ProductionOrder0 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionOrder0?.setRouting)
|
|
{
|
|
await
|
|
ProductionOrder0.
|
|
setRouting(relatedRouting0);
|
|
}
|
|
|
|
const relatedRouting1 = await Routings.findOne({
|
|
offset: Math.floor(Math.random() * (await Routings.count())),
|
|
});
|
|
const ProductionOrder1 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionOrder1?.setRouting)
|
|
{
|
|
await
|
|
ProductionOrder1.
|
|
setRouting(relatedRouting1);
|
|
}
|
|
|
|
const relatedRouting2 = await Routings.findOne({
|
|
offset: Math.floor(Math.random() * (await Routings.count())),
|
|
});
|
|
const ProductionOrder2 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionOrder2?.setRouting)
|
|
{
|
|
await
|
|
ProductionOrder2.
|
|
setRouting(relatedRouting2);
|
|
}
|
|
|
|
const relatedRouting3 = await Routings.findOne({
|
|
offset: Math.floor(Math.random() * (await Routings.count())),
|
|
});
|
|
const ProductionOrder3 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionOrder3?.setRouting)
|
|
{
|
|
await
|
|
ProductionOrder3.
|
|
setRouting(relatedRouting3);
|
|
}
|
|
|
|
const relatedRouting4 = await Routings.findOne({
|
|
offset: Math.floor(Math.random() * (await Routings.count())),
|
|
});
|
|
const ProductionOrder4 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (ProductionOrder4?.setRouting)
|
|
{
|
|
await
|
|
ProductionOrder4.
|
|
setRouting(relatedRouting4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateProductionOrderWithCustomer() {
|
|
|
|
const relatedCustomer0 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const ProductionOrder0 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionOrder0?.setCustomer)
|
|
{
|
|
await
|
|
ProductionOrder0.
|
|
setCustomer(relatedCustomer0);
|
|
}
|
|
|
|
const relatedCustomer1 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const ProductionOrder1 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionOrder1?.setCustomer)
|
|
{
|
|
await
|
|
ProductionOrder1.
|
|
setCustomer(relatedCustomer1);
|
|
}
|
|
|
|
const relatedCustomer2 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const ProductionOrder2 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionOrder2?.setCustomer)
|
|
{
|
|
await
|
|
ProductionOrder2.
|
|
setCustomer(relatedCustomer2);
|
|
}
|
|
|
|
const relatedCustomer3 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const ProductionOrder3 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionOrder3?.setCustomer)
|
|
{
|
|
await
|
|
ProductionOrder3.
|
|
setCustomer(relatedCustomer3);
|
|
}
|
|
|
|
const relatedCustomer4 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const ProductionOrder4 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (ProductionOrder4?.setCustomer)
|
|
{
|
|
await
|
|
ProductionOrder4.
|
|
setCustomer(relatedCustomer4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductionOrderWithUom() {
|
|
|
|
const relatedUom0 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const ProductionOrder0 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionOrder0?.setUom)
|
|
{
|
|
await
|
|
ProductionOrder0.
|
|
setUom(relatedUom0);
|
|
}
|
|
|
|
const relatedUom1 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const ProductionOrder1 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionOrder1?.setUom)
|
|
{
|
|
await
|
|
ProductionOrder1.
|
|
setUom(relatedUom1);
|
|
}
|
|
|
|
const relatedUom2 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const ProductionOrder2 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionOrder2?.setUom)
|
|
{
|
|
await
|
|
ProductionOrder2.
|
|
setUom(relatedUom2);
|
|
}
|
|
|
|
const relatedUom3 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const ProductionOrder3 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionOrder3?.setUom)
|
|
{
|
|
await
|
|
ProductionOrder3.
|
|
setUom(relatedUom3);
|
|
}
|
|
|
|
const relatedUom4 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const ProductionOrder4 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (ProductionOrder4?.setUom)
|
|
{
|
|
await
|
|
ProductionOrder4.
|
|
setUom(relatedUom4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductionOrderWithPlanner_user() {
|
|
|
|
const relatedPlanner_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const ProductionOrder0 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionOrder0?.setPlanner_user)
|
|
{
|
|
await
|
|
ProductionOrder0.
|
|
setPlanner_user(relatedPlanner_user0);
|
|
}
|
|
|
|
const relatedPlanner_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const ProductionOrder1 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionOrder1?.setPlanner_user)
|
|
{
|
|
await
|
|
ProductionOrder1.
|
|
setPlanner_user(relatedPlanner_user1);
|
|
}
|
|
|
|
const relatedPlanner_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const ProductionOrder2 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionOrder2?.setPlanner_user)
|
|
{
|
|
await
|
|
ProductionOrder2.
|
|
setPlanner_user(relatedPlanner_user2);
|
|
}
|
|
|
|
const relatedPlanner_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const ProductionOrder3 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionOrder3?.setPlanner_user)
|
|
{
|
|
await
|
|
ProductionOrder3.
|
|
setPlanner_user(relatedPlanner_user3);
|
|
}
|
|
|
|
const relatedPlanner_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const ProductionOrder4 = await ProductionOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (ProductionOrder4?.setPlanner_user)
|
|
{
|
|
await
|
|
ProductionOrder4.
|
|
setPlanner_user(relatedPlanner_user4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWorkOrderOperationWithProduction_order() {
|
|
|
|
const relatedProduction_order0 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const WorkOrderOperation0 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkOrderOperation0?.setProduction_order)
|
|
{
|
|
await
|
|
WorkOrderOperation0.
|
|
setProduction_order(relatedProduction_order0);
|
|
}
|
|
|
|
const relatedProduction_order1 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const WorkOrderOperation1 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkOrderOperation1?.setProduction_order)
|
|
{
|
|
await
|
|
WorkOrderOperation1.
|
|
setProduction_order(relatedProduction_order1);
|
|
}
|
|
|
|
const relatedProduction_order2 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const WorkOrderOperation2 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkOrderOperation2?.setProduction_order)
|
|
{
|
|
await
|
|
WorkOrderOperation2.
|
|
setProduction_order(relatedProduction_order2);
|
|
}
|
|
|
|
const relatedProduction_order3 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const WorkOrderOperation3 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkOrderOperation3?.setProduction_order)
|
|
{
|
|
await
|
|
WorkOrderOperation3.
|
|
setProduction_order(relatedProduction_order3);
|
|
}
|
|
|
|
const relatedProduction_order4 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const WorkOrderOperation4 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (WorkOrderOperation4?.setProduction_order)
|
|
{
|
|
await
|
|
WorkOrderOperation4.
|
|
setProduction_order(relatedProduction_order4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateWorkOrderOperationWithOperation() {
|
|
|
|
const relatedOperation0 = await Operations.findOne({
|
|
offset: Math.floor(Math.random() * (await Operations.count())),
|
|
});
|
|
const WorkOrderOperation0 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkOrderOperation0?.setOperation)
|
|
{
|
|
await
|
|
WorkOrderOperation0.
|
|
setOperation(relatedOperation0);
|
|
}
|
|
|
|
const relatedOperation1 = await Operations.findOne({
|
|
offset: Math.floor(Math.random() * (await Operations.count())),
|
|
});
|
|
const WorkOrderOperation1 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkOrderOperation1?.setOperation)
|
|
{
|
|
await
|
|
WorkOrderOperation1.
|
|
setOperation(relatedOperation1);
|
|
}
|
|
|
|
const relatedOperation2 = await Operations.findOne({
|
|
offset: Math.floor(Math.random() * (await Operations.count())),
|
|
});
|
|
const WorkOrderOperation2 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkOrderOperation2?.setOperation)
|
|
{
|
|
await
|
|
WorkOrderOperation2.
|
|
setOperation(relatedOperation2);
|
|
}
|
|
|
|
const relatedOperation3 = await Operations.findOne({
|
|
offset: Math.floor(Math.random() * (await Operations.count())),
|
|
});
|
|
const WorkOrderOperation3 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkOrderOperation3?.setOperation)
|
|
{
|
|
await
|
|
WorkOrderOperation3.
|
|
setOperation(relatedOperation3);
|
|
}
|
|
|
|
const relatedOperation4 = await Operations.findOne({
|
|
offset: Math.floor(Math.random() * (await Operations.count())),
|
|
});
|
|
const WorkOrderOperation4 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (WorkOrderOperation4?.setOperation)
|
|
{
|
|
await
|
|
WorkOrderOperation4.
|
|
setOperation(relatedOperation4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWorkOrderOperationWithAssigned_machine() {
|
|
|
|
const relatedAssigned_machine0 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const WorkOrderOperation0 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkOrderOperation0?.setAssigned_machine)
|
|
{
|
|
await
|
|
WorkOrderOperation0.
|
|
setAssigned_machine(relatedAssigned_machine0);
|
|
}
|
|
|
|
const relatedAssigned_machine1 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const WorkOrderOperation1 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkOrderOperation1?.setAssigned_machine)
|
|
{
|
|
await
|
|
WorkOrderOperation1.
|
|
setAssigned_machine(relatedAssigned_machine1);
|
|
}
|
|
|
|
const relatedAssigned_machine2 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const WorkOrderOperation2 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkOrderOperation2?.setAssigned_machine)
|
|
{
|
|
await
|
|
WorkOrderOperation2.
|
|
setAssigned_machine(relatedAssigned_machine2);
|
|
}
|
|
|
|
const relatedAssigned_machine3 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const WorkOrderOperation3 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkOrderOperation3?.setAssigned_machine)
|
|
{
|
|
await
|
|
WorkOrderOperation3.
|
|
setAssigned_machine(relatedAssigned_machine3);
|
|
}
|
|
|
|
const relatedAssigned_machine4 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const WorkOrderOperation4 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (WorkOrderOperation4?.setAssigned_machine)
|
|
{
|
|
await
|
|
WorkOrderOperation4.
|
|
setAssigned_machine(relatedAssigned_machine4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateWorkOrderOperationWithAssigned_user() {
|
|
|
|
const relatedAssigned_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WorkOrderOperation0 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkOrderOperation0?.setAssigned_user)
|
|
{
|
|
await
|
|
WorkOrderOperation0.
|
|
setAssigned_user(relatedAssigned_user0);
|
|
}
|
|
|
|
const relatedAssigned_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WorkOrderOperation1 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkOrderOperation1?.setAssigned_user)
|
|
{
|
|
await
|
|
WorkOrderOperation1.
|
|
setAssigned_user(relatedAssigned_user1);
|
|
}
|
|
|
|
const relatedAssigned_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WorkOrderOperation2 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkOrderOperation2?.setAssigned_user)
|
|
{
|
|
await
|
|
WorkOrderOperation2.
|
|
setAssigned_user(relatedAssigned_user2);
|
|
}
|
|
|
|
const relatedAssigned_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WorkOrderOperation3 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkOrderOperation3?.setAssigned_user)
|
|
{
|
|
await
|
|
WorkOrderOperation3.
|
|
setAssigned_user(relatedAssigned_user3);
|
|
}
|
|
|
|
const relatedAssigned_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WorkOrderOperation4 = await WorkOrderOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (WorkOrderOperation4?.setAssigned_user)
|
|
{
|
|
await
|
|
WorkOrderOperation4.
|
|
setAssigned_user(relatedAssigned_user4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateInventoryLotWithMaterial() {
|
|
|
|
const relatedMaterial0 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const InventoryLot0 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryLot0?.setMaterial)
|
|
{
|
|
await
|
|
InventoryLot0.
|
|
setMaterial(relatedMaterial0);
|
|
}
|
|
|
|
const relatedMaterial1 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const InventoryLot1 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryLot1?.setMaterial)
|
|
{
|
|
await
|
|
InventoryLot1.
|
|
setMaterial(relatedMaterial1);
|
|
}
|
|
|
|
const relatedMaterial2 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const InventoryLot2 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryLot2?.setMaterial)
|
|
{
|
|
await
|
|
InventoryLot2.
|
|
setMaterial(relatedMaterial2);
|
|
}
|
|
|
|
const relatedMaterial3 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const InventoryLot3 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryLot3?.setMaterial)
|
|
{
|
|
await
|
|
InventoryLot3.
|
|
setMaterial(relatedMaterial3);
|
|
}
|
|
|
|
const relatedMaterial4 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const InventoryLot4 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryLot4?.setMaterial)
|
|
{
|
|
await
|
|
InventoryLot4.
|
|
setMaterial(relatedMaterial4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryLotWithWarehouse() {
|
|
|
|
const relatedWarehouse0 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryLot0 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryLot0?.setWarehouse)
|
|
{
|
|
await
|
|
InventoryLot0.
|
|
setWarehouse(relatedWarehouse0);
|
|
}
|
|
|
|
const relatedWarehouse1 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryLot1 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryLot1?.setWarehouse)
|
|
{
|
|
await
|
|
InventoryLot1.
|
|
setWarehouse(relatedWarehouse1);
|
|
}
|
|
|
|
const relatedWarehouse2 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryLot2 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryLot2?.setWarehouse)
|
|
{
|
|
await
|
|
InventoryLot2.
|
|
setWarehouse(relatedWarehouse2);
|
|
}
|
|
|
|
const relatedWarehouse3 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryLot3 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryLot3?.setWarehouse)
|
|
{
|
|
await
|
|
InventoryLot3.
|
|
setWarehouse(relatedWarehouse3);
|
|
}
|
|
|
|
const relatedWarehouse4 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryLot4 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryLot4?.setWarehouse)
|
|
{
|
|
await
|
|
InventoryLot4.
|
|
setWarehouse(relatedWarehouse4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryLotWithLocation() {
|
|
|
|
const relatedLocation0 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryLot0 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryLot0?.setLocation)
|
|
{
|
|
await
|
|
InventoryLot0.
|
|
setLocation(relatedLocation0);
|
|
}
|
|
|
|
const relatedLocation1 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryLot1 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryLot1?.setLocation)
|
|
{
|
|
await
|
|
InventoryLot1.
|
|
setLocation(relatedLocation1);
|
|
}
|
|
|
|
const relatedLocation2 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryLot2 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryLot2?.setLocation)
|
|
{
|
|
await
|
|
InventoryLot2.
|
|
setLocation(relatedLocation2);
|
|
}
|
|
|
|
const relatedLocation3 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryLot3 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryLot3?.setLocation)
|
|
{
|
|
await
|
|
InventoryLot3.
|
|
setLocation(relatedLocation3);
|
|
}
|
|
|
|
const relatedLocation4 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryLot4 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryLot4?.setLocation)
|
|
{
|
|
await
|
|
InventoryLot4.
|
|
setLocation(relatedLocation4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateInventoryLotWithUom() {
|
|
|
|
const relatedUom0 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const InventoryLot0 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryLot0?.setUom)
|
|
{
|
|
await
|
|
InventoryLot0.
|
|
setUom(relatedUom0);
|
|
}
|
|
|
|
const relatedUom1 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const InventoryLot1 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryLot1?.setUom)
|
|
{
|
|
await
|
|
InventoryLot1.
|
|
setUom(relatedUom1);
|
|
}
|
|
|
|
const relatedUom2 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const InventoryLot2 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryLot2?.setUom)
|
|
{
|
|
await
|
|
InventoryLot2.
|
|
setUom(relatedUom2);
|
|
}
|
|
|
|
const relatedUom3 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const InventoryLot3 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryLot3?.setUom)
|
|
{
|
|
await
|
|
InventoryLot3.
|
|
setUom(relatedUom3);
|
|
}
|
|
|
|
const relatedUom4 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const InventoryLot4 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryLot4?.setUom)
|
|
{
|
|
await
|
|
InventoryLot4.
|
|
setUom(relatedUom4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateInventoryLotWithSupplier() {
|
|
|
|
const relatedSupplier0 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const InventoryLot0 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryLot0?.setSupplier)
|
|
{
|
|
await
|
|
InventoryLot0.
|
|
setSupplier(relatedSupplier0);
|
|
}
|
|
|
|
const relatedSupplier1 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const InventoryLot1 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryLot1?.setSupplier)
|
|
{
|
|
await
|
|
InventoryLot1.
|
|
setSupplier(relatedSupplier1);
|
|
}
|
|
|
|
const relatedSupplier2 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const InventoryLot2 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryLot2?.setSupplier)
|
|
{
|
|
await
|
|
InventoryLot2.
|
|
setSupplier(relatedSupplier2);
|
|
}
|
|
|
|
const relatedSupplier3 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const InventoryLot3 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryLot3?.setSupplier)
|
|
{
|
|
await
|
|
InventoryLot3.
|
|
setSupplier(relatedSupplier3);
|
|
}
|
|
|
|
const relatedSupplier4 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const InventoryLot4 = await InventoryLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryLot4?.setSupplier)
|
|
{
|
|
await
|
|
InventoryLot4.
|
|
setSupplier(relatedSupplier4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithLot() {
|
|
|
|
const relatedLot0 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setLot)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setLot(relatedLot0);
|
|
}
|
|
|
|
const relatedLot1 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setLot)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setLot(relatedLot1);
|
|
}
|
|
|
|
const relatedLot2 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setLot)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setLot(relatedLot2);
|
|
}
|
|
|
|
const relatedLot3 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setLot)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setLot(relatedLot3);
|
|
}
|
|
|
|
const relatedLot4 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const InventoryTransaction4 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryTransaction4?.setLot)
|
|
{
|
|
await
|
|
InventoryTransaction4.
|
|
setLot(relatedLot4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithMaterial() {
|
|
|
|
const relatedMaterial0 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setMaterial)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setMaterial(relatedMaterial0);
|
|
}
|
|
|
|
const relatedMaterial1 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setMaterial)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setMaterial(relatedMaterial1);
|
|
}
|
|
|
|
const relatedMaterial2 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setMaterial)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setMaterial(relatedMaterial2);
|
|
}
|
|
|
|
const relatedMaterial3 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setMaterial)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setMaterial(relatedMaterial3);
|
|
}
|
|
|
|
const relatedMaterial4 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const InventoryTransaction4 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryTransaction4?.setMaterial)
|
|
{
|
|
await
|
|
InventoryTransaction4.
|
|
setMaterial(relatedMaterial4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithUom() {
|
|
|
|
const relatedUom0 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setUom)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setUom(relatedUom0);
|
|
}
|
|
|
|
const relatedUom1 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setUom)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setUom(relatedUom1);
|
|
}
|
|
|
|
const relatedUom2 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setUom)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setUom(relatedUom2);
|
|
}
|
|
|
|
const relatedUom3 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setUom)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setUom(relatedUom3);
|
|
}
|
|
|
|
const relatedUom4 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const InventoryTransaction4 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryTransaction4?.setUom)
|
|
{
|
|
await
|
|
InventoryTransaction4.
|
|
setUom(relatedUom4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithFrom_warehouse() {
|
|
|
|
const relatedFrom_warehouse0 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setFrom_warehouse)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setFrom_warehouse(relatedFrom_warehouse0);
|
|
}
|
|
|
|
const relatedFrom_warehouse1 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setFrom_warehouse)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setFrom_warehouse(relatedFrom_warehouse1);
|
|
}
|
|
|
|
const relatedFrom_warehouse2 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setFrom_warehouse)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setFrom_warehouse(relatedFrom_warehouse2);
|
|
}
|
|
|
|
const relatedFrom_warehouse3 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setFrom_warehouse)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setFrom_warehouse(relatedFrom_warehouse3);
|
|
}
|
|
|
|
const relatedFrom_warehouse4 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryTransaction4 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryTransaction4?.setFrom_warehouse)
|
|
{
|
|
await
|
|
InventoryTransaction4.
|
|
setFrom_warehouse(relatedFrom_warehouse4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithTo_warehouse() {
|
|
|
|
const relatedTo_warehouse0 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setTo_warehouse)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setTo_warehouse(relatedTo_warehouse0);
|
|
}
|
|
|
|
const relatedTo_warehouse1 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setTo_warehouse)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setTo_warehouse(relatedTo_warehouse1);
|
|
}
|
|
|
|
const relatedTo_warehouse2 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setTo_warehouse)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setTo_warehouse(relatedTo_warehouse2);
|
|
}
|
|
|
|
const relatedTo_warehouse3 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setTo_warehouse)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setTo_warehouse(relatedTo_warehouse3);
|
|
}
|
|
|
|
const relatedTo_warehouse4 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const InventoryTransaction4 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryTransaction4?.setTo_warehouse)
|
|
{
|
|
await
|
|
InventoryTransaction4.
|
|
setTo_warehouse(relatedTo_warehouse4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithFrom_location() {
|
|
|
|
const relatedFrom_location0 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setFrom_location)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setFrom_location(relatedFrom_location0);
|
|
}
|
|
|
|
const relatedFrom_location1 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setFrom_location)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setFrom_location(relatedFrom_location1);
|
|
}
|
|
|
|
const relatedFrom_location2 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setFrom_location)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setFrom_location(relatedFrom_location2);
|
|
}
|
|
|
|
const relatedFrom_location3 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setFrom_location)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setFrom_location(relatedFrom_location3);
|
|
}
|
|
|
|
const relatedFrom_location4 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryTransaction4 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryTransaction4?.setFrom_location)
|
|
{
|
|
await
|
|
InventoryTransaction4.
|
|
setFrom_location(relatedFrom_location4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithTo_location() {
|
|
|
|
const relatedTo_location0 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setTo_location)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setTo_location(relatedTo_location0);
|
|
}
|
|
|
|
const relatedTo_location1 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setTo_location)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setTo_location(relatedTo_location1);
|
|
}
|
|
|
|
const relatedTo_location2 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setTo_location)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setTo_location(relatedTo_location2);
|
|
}
|
|
|
|
const relatedTo_location3 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setTo_location)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setTo_location(relatedTo_location3);
|
|
}
|
|
|
|
const relatedTo_location4 = await StorageLocations.findOne({
|
|
offset: Math.floor(Math.random() * (await StorageLocations.count())),
|
|
});
|
|
const InventoryTransaction4 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryTransaction4?.setTo_location)
|
|
{
|
|
await
|
|
InventoryTransaction4.
|
|
setTo_location(relatedTo_location4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithProduction_order() {
|
|
|
|
const relatedProduction_order0 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setProduction_order)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setProduction_order(relatedProduction_order0);
|
|
}
|
|
|
|
const relatedProduction_order1 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setProduction_order)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setProduction_order(relatedProduction_order1);
|
|
}
|
|
|
|
const relatedProduction_order2 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setProduction_order)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setProduction_order(relatedProduction_order2);
|
|
}
|
|
|
|
const relatedProduction_order3 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setProduction_order)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setProduction_order(relatedProduction_order3);
|
|
}
|
|
|
|
const relatedProduction_order4 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const InventoryTransaction4 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryTransaction4?.setProduction_order)
|
|
{
|
|
await
|
|
InventoryTransaction4.
|
|
setProduction_order(relatedProduction_order4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithPerformed_by_user() {
|
|
|
|
const relatedPerformed_by_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setPerformed_by_user)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setPerformed_by_user(relatedPerformed_by_user0);
|
|
}
|
|
|
|
const relatedPerformed_by_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setPerformed_by_user)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setPerformed_by_user(relatedPerformed_by_user1);
|
|
}
|
|
|
|
const relatedPerformed_by_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setPerformed_by_user)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setPerformed_by_user(relatedPerformed_by_user2);
|
|
}
|
|
|
|
const relatedPerformed_by_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setPerformed_by_user)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setPerformed_by_user(relatedPerformed_by_user3);
|
|
}
|
|
|
|
const relatedPerformed_by_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const InventoryTransaction4 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InventoryTransaction4?.setPerformed_by_user)
|
|
{
|
|
await
|
|
InventoryTransaction4.
|
|
setPerformed_by_user(relatedPerformed_by_user4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 associatePurchaseOrderWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const PurchaseOrder0 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PurchaseOrder0?.setPlant)
|
|
{
|
|
await
|
|
PurchaseOrder0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const PurchaseOrder1 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PurchaseOrder1?.setPlant)
|
|
{
|
|
await
|
|
PurchaseOrder1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const PurchaseOrder2 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PurchaseOrder2?.setPlant)
|
|
{
|
|
await
|
|
PurchaseOrder2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const PurchaseOrder3 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PurchaseOrder3?.setPlant)
|
|
{
|
|
await
|
|
PurchaseOrder3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
const relatedPlant4 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const PurchaseOrder4 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PurchaseOrder4?.setPlant)
|
|
{
|
|
await
|
|
PurchaseOrder4.
|
|
setPlant(relatedPlant4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePurchaseOrderWithBuyer_user() {
|
|
|
|
const relatedBuyer_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const PurchaseOrder0 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PurchaseOrder0?.setBuyer_user)
|
|
{
|
|
await
|
|
PurchaseOrder0.
|
|
setBuyer_user(relatedBuyer_user0);
|
|
}
|
|
|
|
const relatedBuyer_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const PurchaseOrder1 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PurchaseOrder1?.setBuyer_user)
|
|
{
|
|
await
|
|
PurchaseOrder1.
|
|
setBuyer_user(relatedBuyer_user1);
|
|
}
|
|
|
|
const relatedBuyer_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const PurchaseOrder2 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PurchaseOrder2?.setBuyer_user)
|
|
{
|
|
await
|
|
PurchaseOrder2.
|
|
setBuyer_user(relatedBuyer_user2);
|
|
}
|
|
|
|
const relatedBuyer_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const PurchaseOrder3 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PurchaseOrder3?.setBuyer_user)
|
|
{
|
|
await
|
|
PurchaseOrder3.
|
|
setBuyer_user(relatedBuyer_user3);
|
|
}
|
|
|
|
const relatedBuyer_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const PurchaseOrder4 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PurchaseOrder4?.setBuyer_user)
|
|
{
|
|
await
|
|
PurchaseOrder4.
|
|
setBuyer_user(relatedBuyer_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 associatePurchaseOrderLineWithMaterial() {
|
|
|
|
const relatedMaterial0 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PurchaseOrderLine0?.setMaterial)
|
|
{
|
|
await
|
|
PurchaseOrderLine0.
|
|
setMaterial(relatedMaterial0);
|
|
}
|
|
|
|
const relatedMaterial1 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PurchaseOrderLine1?.setMaterial)
|
|
{
|
|
await
|
|
PurchaseOrderLine1.
|
|
setMaterial(relatedMaterial1);
|
|
}
|
|
|
|
const relatedMaterial2 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PurchaseOrderLine2?.setMaterial)
|
|
{
|
|
await
|
|
PurchaseOrderLine2.
|
|
setMaterial(relatedMaterial2);
|
|
}
|
|
|
|
const relatedMaterial3 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const PurchaseOrderLine3 = await PurchaseOrderLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PurchaseOrderLine3?.setMaterial)
|
|
{
|
|
await
|
|
PurchaseOrderLine3.
|
|
setMaterial(relatedMaterial3);
|
|
}
|
|
|
|
const relatedMaterial4 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const PurchaseOrderLine4 = await PurchaseOrderLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PurchaseOrderLine4?.setMaterial)
|
|
{
|
|
await
|
|
PurchaseOrderLine4.
|
|
setMaterial(relatedMaterial4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePurchaseOrderLineWithUom() {
|
|
|
|
const relatedUom0 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const PurchaseOrderLine0 = await PurchaseOrderLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PurchaseOrderLine0?.setUom)
|
|
{
|
|
await
|
|
PurchaseOrderLine0.
|
|
setUom(relatedUom0);
|
|
}
|
|
|
|
const relatedUom1 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const PurchaseOrderLine1 = await PurchaseOrderLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PurchaseOrderLine1?.setUom)
|
|
{
|
|
await
|
|
PurchaseOrderLine1.
|
|
setUom(relatedUom1);
|
|
}
|
|
|
|
const relatedUom2 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const PurchaseOrderLine2 = await PurchaseOrderLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PurchaseOrderLine2?.setUom)
|
|
{
|
|
await
|
|
PurchaseOrderLine2.
|
|
setUom(relatedUom2);
|
|
}
|
|
|
|
const relatedUom3 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const PurchaseOrderLine3 = await PurchaseOrderLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PurchaseOrderLine3?.setUom)
|
|
{
|
|
await
|
|
PurchaseOrderLine3.
|
|
setUom(relatedUom3);
|
|
}
|
|
|
|
const relatedUom4 = await UnitsOfMeasure.findOne({
|
|
offset: Math.floor(Math.random() * (await UnitsOfMeasure.count())),
|
|
});
|
|
const PurchaseOrderLine4 = await PurchaseOrderLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PurchaseOrderLine4?.setUom)
|
|
{
|
|
await
|
|
PurchaseOrderLine4.
|
|
setUom(relatedUom4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQualityStandardWithMaterial() {
|
|
|
|
const relatedMaterial0 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const QualityStandard0 = await QualityStandards.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QualityStandard0?.setMaterial)
|
|
{
|
|
await
|
|
QualityStandard0.
|
|
setMaterial(relatedMaterial0);
|
|
}
|
|
|
|
const relatedMaterial1 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const QualityStandard1 = await QualityStandards.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QualityStandard1?.setMaterial)
|
|
{
|
|
await
|
|
QualityStandard1.
|
|
setMaterial(relatedMaterial1);
|
|
}
|
|
|
|
const relatedMaterial2 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const QualityStandard2 = await QualityStandards.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QualityStandard2?.setMaterial)
|
|
{
|
|
await
|
|
QualityStandard2.
|
|
setMaterial(relatedMaterial2);
|
|
}
|
|
|
|
const relatedMaterial3 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const QualityStandard3 = await QualityStandards.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QualityStandard3?.setMaterial)
|
|
{
|
|
await
|
|
QualityStandard3.
|
|
setMaterial(relatedMaterial3);
|
|
}
|
|
|
|
const relatedMaterial4 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const QualityStandard4 = await QualityStandards.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (QualityStandard4?.setMaterial)
|
|
{
|
|
await
|
|
QualityStandard4.
|
|
setMaterial(relatedMaterial4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateQualityStandardWithRevision() {
|
|
|
|
const relatedRevision0 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const QualityStandard0 = await QualityStandards.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QualityStandard0?.setRevision)
|
|
{
|
|
await
|
|
QualityStandard0.
|
|
setRevision(relatedRevision0);
|
|
}
|
|
|
|
const relatedRevision1 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const QualityStandard1 = await QualityStandards.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QualityStandard1?.setRevision)
|
|
{
|
|
await
|
|
QualityStandard1.
|
|
setRevision(relatedRevision1);
|
|
}
|
|
|
|
const relatedRevision2 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const QualityStandard2 = await QualityStandards.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QualityStandard2?.setRevision)
|
|
{
|
|
await
|
|
QualityStandard2.
|
|
setRevision(relatedRevision2);
|
|
}
|
|
|
|
const relatedRevision3 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const QualityStandard3 = await QualityStandards.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QualityStandard3?.setRevision)
|
|
{
|
|
await
|
|
QualityStandard3.
|
|
setRevision(relatedRevision3);
|
|
}
|
|
|
|
const relatedRevision4 = await MaterialRevisions.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialRevisions.count())),
|
|
});
|
|
const QualityStandard4 = await QualityStandards.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (QualityStandard4?.setRevision)
|
|
{
|
|
await
|
|
QualityStandard4.
|
|
setRevision(relatedRevision4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateInspectionPlanWithQuality_standard() {
|
|
|
|
const relatedQuality_standard0 = await QualityStandards.findOne({
|
|
offset: Math.floor(Math.random() * (await QualityStandards.count())),
|
|
});
|
|
const InspectionPlan0 = await InspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InspectionPlan0?.setQuality_standard)
|
|
{
|
|
await
|
|
InspectionPlan0.
|
|
setQuality_standard(relatedQuality_standard0);
|
|
}
|
|
|
|
const relatedQuality_standard1 = await QualityStandards.findOne({
|
|
offset: Math.floor(Math.random() * (await QualityStandards.count())),
|
|
});
|
|
const InspectionPlan1 = await InspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InspectionPlan1?.setQuality_standard)
|
|
{
|
|
await
|
|
InspectionPlan1.
|
|
setQuality_standard(relatedQuality_standard1);
|
|
}
|
|
|
|
const relatedQuality_standard2 = await QualityStandards.findOne({
|
|
offset: Math.floor(Math.random() * (await QualityStandards.count())),
|
|
});
|
|
const InspectionPlan2 = await InspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InspectionPlan2?.setQuality_standard)
|
|
{
|
|
await
|
|
InspectionPlan2.
|
|
setQuality_standard(relatedQuality_standard2);
|
|
}
|
|
|
|
const relatedQuality_standard3 = await QualityStandards.findOne({
|
|
offset: Math.floor(Math.random() * (await QualityStandards.count())),
|
|
});
|
|
const InspectionPlan3 = await InspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InspectionPlan3?.setQuality_standard)
|
|
{
|
|
await
|
|
InspectionPlan3.
|
|
setQuality_standard(relatedQuality_standard3);
|
|
}
|
|
|
|
const relatedQuality_standard4 = await QualityStandards.findOne({
|
|
offset: Math.floor(Math.random() * (await QualityStandards.count())),
|
|
});
|
|
const InspectionPlan4 = await InspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (InspectionPlan4?.setQuality_standard)
|
|
{
|
|
await
|
|
InspectionPlan4.
|
|
setQuality_standard(relatedQuality_standard4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 associateInspectionWithMaterial() {
|
|
|
|
const relatedMaterial0 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Inspection0 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Inspection0?.setMaterial)
|
|
{
|
|
await
|
|
Inspection0.
|
|
setMaterial(relatedMaterial0);
|
|
}
|
|
|
|
const relatedMaterial1 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Inspection1 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Inspection1?.setMaterial)
|
|
{
|
|
await
|
|
Inspection1.
|
|
setMaterial(relatedMaterial1);
|
|
}
|
|
|
|
const relatedMaterial2 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Inspection2 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Inspection2?.setMaterial)
|
|
{
|
|
await
|
|
Inspection2.
|
|
setMaterial(relatedMaterial2);
|
|
}
|
|
|
|
const relatedMaterial3 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Inspection3 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Inspection3?.setMaterial)
|
|
{
|
|
await
|
|
Inspection3.
|
|
setMaterial(relatedMaterial3);
|
|
}
|
|
|
|
const relatedMaterial4 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Inspection4 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Inspection4?.setMaterial)
|
|
{
|
|
await
|
|
Inspection4.
|
|
setMaterial(relatedMaterial4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInspectionWithLot() {
|
|
|
|
const relatedLot0 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Inspection0 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Inspection0?.setLot)
|
|
{
|
|
await
|
|
Inspection0.
|
|
setLot(relatedLot0);
|
|
}
|
|
|
|
const relatedLot1 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Inspection1 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Inspection1?.setLot)
|
|
{
|
|
await
|
|
Inspection1.
|
|
setLot(relatedLot1);
|
|
}
|
|
|
|
const relatedLot2 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Inspection2 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Inspection2?.setLot)
|
|
{
|
|
await
|
|
Inspection2.
|
|
setLot(relatedLot2);
|
|
}
|
|
|
|
const relatedLot3 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Inspection3 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Inspection3?.setLot)
|
|
{
|
|
await
|
|
Inspection3.
|
|
setLot(relatedLot3);
|
|
}
|
|
|
|
const relatedLot4 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Inspection4 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Inspection4?.setLot)
|
|
{
|
|
await
|
|
Inspection4.
|
|
setLot(relatedLot4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInspectionWithProduction_order() {
|
|
|
|
const relatedProduction_order0 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Inspection0 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Inspection0?.setProduction_order)
|
|
{
|
|
await
|
|
Inspection0.
|
|
setProduction_order(relatedProduction_order0);
|
|
}
|
|
|
|
const relatedProduction_order1 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Inspection1 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Inspection1?.setProduction_order)
|
|
{
|
|
await
|
|
Inspection1.
|
|
setProduction_order(relatedProduction_order1);
|
|
}
|
|
|
|
const relatedProduction_order2 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Inspection2 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Inspection2?.setProduction_order)
|
|
{
|
|
await
|
|
Inspection2.
|
|
setProduction_order(relatedProduction_order2);
|
|
}
|
|
|
|
const relatedProduction_order3 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Inspection3 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Inspection3?.setProduction_order)
|
|
{
|
|
await
|
|
Inspection3.
|
|
setProduction_order(relatedProduction_order3);
|
|
}
|
|
|
|
const relatedProduction_order4 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Inspection4 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Inspection4?.setProduction_order)
|
|
{
|
|
await
|
|
Inspection4.
|
|
setProduction_order(relatedProduction_order4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInspectionWithWork_order_operation() {
|
|
|
|
const relatedWork_order_operation0 = await WorkOrderOperations.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrderOperations.count())),
|
|
});
|
|
const Inspection0 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Inspection0?.setWork_order_operation)
|
|
{
|
|
await
|
|
Inspection0.
|
|
setWork_order_operation(relatedWork_order_operation0);
|
|
}
|
|
|
|
const relatedWork_order_operation1 = await WorkOrderOperations.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrderOperations.count())),
|
|
});
|
|
const Inspection1 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Inspection1?.setWork_order_operation)
|
|
{
|
|
await
|
|
Inspection1.
|
|
setWork_order_operation(relatedWork_order_operation1);
|
|
}
|
|
|
|
const relatedWork_order_operation2 = await WorkOrderOperations.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrderOperations.count())),
|
|
});
|
|
const Inspection2 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Inspection2?.setWork_order_operation)
|
|
{
|
|
await
|
|
Inspection2.
|
|
setWork_order_operation(relatedWork_order_operation2);
|
|
}
|
|
|
|
const relatedWork_order_operation3 = await WorkOrderOperations.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrderOperations.count())),
|
|
});
|
|
const Inspection3 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Inspection3?.setWork_order_operation)
|
|
{
|
|
await
|
|
Inspection3.
|
|
setWork_order_operation(relatedWork_order_operation3);
|
|
}
|
|
|
|
const relatedWork_order_operation4 = await WorkOrderOperations.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrderOperations.count())),
|
|
});
|
|
const Inspection4 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Inspection4?.setWork_order_operation)
|
|
{
|
|
await
|
|
Inspection4.
|
|
setWork_order_operation(relatedWork_order_operation4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInspectionWithInspector_user() {
|
|
|
|
const relatedInspector_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Inspection0 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Inspection0?.setInspector_user)
|
|
{
|
|
await
|
|
Inspection0.
|
|
setInspector_user(relatedInspector_user0);
|
|
}
|
|
|
|
const relatedInspector_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Inspection1 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Inspection1?.setInspector_user)
|
|
{
|
|
await
|
|
Inspection1.
|
|
setInspector_user(relatedInspector_user1);
|
|
}
|
|
|
|
const relatedInspector_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Inspection2 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Inspection2?.setInspector_user)
|
|
{
|
|
await
|
|
Inspection2.
|
|
setInspector_user(relatedInspector_user2);
|
|
}
|
|
|
|
const relatedInspector_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Inspection3 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Inspection3?.setInspector_user)
|
|
{
|
|
await
|
|
Inspection3.
|
|
setInspector_user(relatedInspector_user3);
|
|
}
|
|
|
|
const relatedInspector_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Inspection4 = await Inspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Inspection4?.setInspector_user)
|
|
{
|
|
await
|
|
Inspection4.
|
|
setInspector_user(relatedInspector_user4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 associateNonconformanceWithMaterial() {
|
|
|
|
const relatedMaterial0 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Nonconformance0 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Nonconformance0?.setMaterial)
|
|
{
|
|
await
|
|
Nonconformance0.
|
|
setMaterial(relatedMaterial0);
|
|
}
|
|
|
|
const relatedMaterial1 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Nonconformance1 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Nonconformance1?.setMaterial)
|
|
{
|
|
await
|
|
Nonconformance1.
|
|
setMaterial(relatedMaterial1);
|
|
}
|
|
|
|
const relatedMaterial2 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Nonconformance2 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Nonconformance2?.setMaterial)
|
|
{
|
|
await
|
|
Nonconformance2.
|
|
setMaterial(relatedMaterial2);
|
|
}
|
|
|
|
const relatedMaterial3 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Nonconformance3 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Nonconformance3?.setMaterial)
|
|
{
|
|
await
|
|
Nonconformance3.
|
|
setMaterial(relatedMaterial3);
|
|
}
|
|
|
|
const relatedMaterial4 = await Materials.findOne({
|
|
offset: Math.floor(Math.random() * (await Materials.count())),
|
|
});
|
|
const Nonconformance4 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Nonconformance4?.setMaterial)
|
|
{
|
|
await
|
|
Nonconformance4.
|
|
setMaterial(relatedMaterial4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateNonconformanceWithLot() {
|
|
|
|
const relatedLot0 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Nonconformance0 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Nonconformance0?.setLot)
|
|
{
|
|
await
|
|
Nonconformance0.
|
|
setLot(relatedLot0);
|
|
}
|
|
|
|
const relatedLot1 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Nonconformance1 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Nonconformance1?.setLot)
|
|
{
|
|
await
|
|
Nonconformance1.
|
|
setLot(relatedLot1);
|
|
}
|
|
|
|
const relatedLot2 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Nonconformance2 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Nonconformance2?.setLot)
|
|
{
|
|
await
|
|
Nonconformance2.
|
|
setLot(relatedLot2);
|
|
}
|
|
|
|
const relatedLot3 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Nonconformance3 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Nonconformance3?.setLot)
|
|
{
|
|
await
|
|
Nonconformance3.
|
|
setLot(relatedLot3);
|
|
}
|
|
|
|
const relatedLot4 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Nonconformance4 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Nonconformance4?.setLot)
|
|
{
|
|
await
|
|
Nonconformance4.
|
|
setLot(relatedLot4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateNonconformanceWithProduction_order() {
|
|
|
|
const relatedProduction_order0 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Nonconformance0 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Nonconformance0?.setProduction_order)
|
|
{
|
|
await
|
|
Nonconformance0.
|
|
setProduction_order(relatedProduction_order0);
|
|
}
|
|
|
|
const relatedProduction_order1 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Nonconformance1 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Nonconformance1?.setProduction_order)
|
|
{
|
|
await
|
|
Nonconformance1.
|
|
setProduction_order(relatedProduction_order1);
|
|
}
|
|
|
|
const relatedProduction_order2 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Nonconformance2 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Nonconformance2?.setProduction_order)
|
|
{
|
|
await
|
|
Nonconformance2.
|
|
setProduction_order(relatedProduction_order2);
|
|
}
|
|
|
|
const relatedProduction_order3 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Nonconformance3 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Nonconformance3?.setProduction_order)
|
|
{
|
|
await
|
|
Nonconformance3.
|
|
setProduction_order(relatedProduction_order3);
|
|
}
|
|
|
|
const relatedProduction_order4 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Nonconformance4 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Nonconformance4?.setProduction_order)
|
|
{
|
|
await
|
|
Nonconformance4.
|
|
setProduction_order(relatedProduction_order4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateNonconformanceWithOwner_user() {
|
|
|
|
const relatedOwner_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Nonconformance0 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Nonconformance0?.setOwner_user)
|
|
{
|
|
await
|
|
Nonconformance0.
|
|
setOwner_user(relatedOwner_user0);
|
|
}
|
|
|
|
const relatedOwner_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Nonconformance1 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Nonconformance1?.setOwner_user)
|
|
{
|
|
await
|
|
Nonconformance1.
|
|
setOwner_user(relatedOwner_user1);
|
|
}
|
|
|
|
const relatedOwner_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Nonconformance2 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Nonconformance2?.setOwner_user)
|
|
{
|
|
await
|
|
Nonconformance2.
|
|
setOwner_user(relatedOwner_user2);
|
|
}
|
|
|
|
const relatedOwner_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Nonconformance3 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Nonconformance3?.setOwner_user)
|
|
{
|
|
await
|
|
Nonconformance3.
|
|
setOwner_user(relatedOwner_user3);
|
|
}
|
|
|
|
const relatedOwner_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Nonconformance4 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Nonconformance4?.setOwner_user)
|
|
{
|
|
await
|
|
Nonconformance4.
|
|
setOwner_user(relatedOwner_user4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCapaWithNonconformance() {
|
|
|
|
const relatedNonconformance0 = await Nonconformances.findOne({
|
|
offset: Math.floor(Math.random() * (await Nonconformances.count())),
|
|
});
|
|
const Capa0 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Capa0?.setNonconformance)
|
|
{
|
|
await
|
|
Capa0.
|
|
setNonconformance(relatedNonconformance0);
|
|
}
|
|
|
|
const relatedNonconformance1 = await Nonconformances.findOne({
|
|
offset: Math.floor(Math.random() * (await Nonconformances.count())),
|
|
});
|
|
const Capa1 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Capa1?.setNonconformance)
|
|
{
|
|
await
|
|
Capa1.
|
|
setNonconformance(relatedNonconformance1);
|
|
}
|
|
|
|
const relatedNonconformance2 = await Nonconformances.findOne({
|
|
offset: Math.floor(Math.random() * (await Nonconformances.count())),
|
|
});
|
|
const Capa2 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Capa2?.setNonconformance)
|
|
{
|
|
await
|
|
Capa2.
|
|
setNonconformance(relatedNonconformance2);
|
|
}
|
|
|
|
const relatedNonconformance3 = await Nonconformances.findOne({
|
|
offset: Math.floor(Math.random() * (await Nonconformances.count())),
|
|
});
|
|
const Capa3 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Capa3?.setNonconformance)
|
|
{
|
|
await
|
|
Capa3.
|
|
setNonconformance(relatedNonconformance3);
|
|
}
|
|
|
|
const relatedNonconformance4 = await Nonconformances.findOne({
|
|
offset: Math.floor(Math.random() * (await Nonconformances.count())),
|
|
});
|
|
const Capa4 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Capa4?.setNonconformance)
|
|
{
|
|
await
|
|
Capa4.
|
|
setNonconformance(relatedNonconformance4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCapaWithOwner_user() {
|
|
|
|
const relatedOwner_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Capa0 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Capa0?.setOwner_user)
|
|
{
|
|
await
|
|
Capa0.
|
|
setOwner_user(relatedOwner_user0);
|
|
}
|
|
|
|
const relatedOwner_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Capa1 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Capa1?.setOwner_user)
|
|
{
|
|
await
|
|
Capa1.
|
|
setOwner_user(relatedOwner_user1);
|
|
}
|
|
|
|
const relatedOwner_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Capa2 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Capa2?.setOwner_user)
|
|
{
|
|
await
|
|
Capa2.
|
|
setOwner_user(relatedOwner_user2);
|
|
}
|
|
|
|
const relatedOwner_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Capa3 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Capa3?.setOwner_user)
|
|
{
|
|
await
|
|
Capa3.
|
|
setOwner_user(relatedOwner_user3);
|
|
}
|
|
|
|
const relatedOwner_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Capa4 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Capa4?.setOwner_user)
|
|
{
|
|
await
|
|
Capa4.
|
|
setOwner_user(relatedOwner_user4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAlertWithAcknowledged_by_user() {
|
|
|
|
const relatedAcknowledged_by_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Alert0 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Alert0?.setAcknowledged_by_user)
|
|
{
|
|
await
|
|
Alert0.
|
|
setAcknowledged_by_user(relatedAcknowledged_by_user0);
|
|
}
|
|
|
|
const relatedAcknowledged_by_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Alert1 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Alert1?.setAcknowledged_by_user)
|
|
{
|
|
await
|
|
Alert1.
|
|
setAcknowledged_by_user(relatedAcknowledged_by_user1);
|
|
}
|
|
|
|
const relatedAcknowledged_by_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Alert2 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Alert2?.setAcknowledged_by_user)
|
|
{
|
|
await
|
|
Alert2.
|
|
setAcknowledged_by_user(relatedAcknowledged_by_user2);
|
|
}
|
|
|
|
const relatedAcknowledged_by_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Alert3 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Alert3?.setAcknowledged_by_user)
|
|
{
|
|
await
|
|
Alert3.
|
|
setAcknowledged_by_user(relatedAcknowledged_by_user3);
|
|
}
|
|
|
|
const relatedAcknowledged_by_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Alert4 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Alert4?.setAcknowledged_by_user)
|
|
{
|
|
await
|
|
Alert4.
|
|
setAcknowledged_by_user(relatedAcknowledged_by_user4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateAlertWithRelated_plant() {
|
|
|
|
const relatedRelated_plant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Alert0 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Alert0?.setRelated_plant)
|
|
{
|
|
await
|
|
Alert0.
|
|
setRelated_plant(relatedRelated_plant0);
|
|
}
|
|
|
|
const relatedRelated_plant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Alert1 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Alert1?.setRelated_plant)
|
|
{
|
|
await
|
|
Alert1.
|
|
setRelated_plant(relatedRelated_plant1);
|
|
}
|
|
|
|
const relatedRelated_plant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Alert2 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Alert2?.setRelated_plant)
|
|
{
|
|
await
|
|
Alert2.
|
|
setRelated_plant(relatedRelated_plant2);
|
|
}
|
|
|
|
const relatedRelated_plant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Alert3 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Alert3?.setRelated_plant)
|
|
{
|
|
await
|
|
Alert3.
|
|
setRelated_plant(relatedRelated_plant3);
|
|
}
|
|
|
|
const relatedRelated_plant4 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Alert4 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Alert4?.setRelated_plant)
|
|
{
|
|
await
|
|
Alert4.
|
|
setRelated_plant(relatedRelated_plant4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateAlertWithRelated_machine() {
|
|
|
|
const relatedRelated_machine0 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const Alert0 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Alert0?.setRelated_machine)
|
|
{
|
|
await
|
|
Alert0.
|
|
setRelated_machine(relatedRelated_machine0);
|
|
}
|
|
|
|
const relatedRelated_machine1 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const Alert1 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Alert1?.setRelated_machine)
|
|
{
|
|
await
|
|
Alert1.
|
|
setRelated_machine(relatedRelated_machine1);
|
|
}
|
|
|
|
const relatedRelated_machine2 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const Alert2 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Alert2?.setRelated_machine)
|
|
{
|
|
await
|
|
Alert2.
|
|
setRelated_machine(relatedRelated_machine2);
|
|
}
|
|
|
|
const relatedRelated_machine3 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const Alert3 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Alert3?.setRelated_machine)
|
|
{
|
|
await
|
|
Alert3.
|
|
setRelated_machine(relatedRelated_machine3);
|
|
}
|
|
|
|
const relatedRelated_machine4 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const Alert4 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Alert4?.setRelated_machine)
|
|
{
|
|
await
|
|
Alert4.
|
|
setRelated_machine(relatedRelated_machine4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateAlertWithRelated_order() {
|
|
|
|
const relatedRelated_order0 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Alert0 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Alert0?.setRelated_order)
|
|
{
|
|
await
|
|
Alert0.
|
|
setRelated_order(relatedRelated_order0);
|
|
}
|
|
|
|
const relatedRelated_order1 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Alert1 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Alert1?.setRelated_order)
|
|
{
|
|
await
|
|
Alert1.
|
|
setRelated_order(relatedRelated_order1);
|
|
}
|
|
|
|
const relatedRelated_order2 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Alert2 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Alert2?.setRelated_order)
|
|
{
|
|
await
|
|
Alert2.
|
|
setRelated_order(relatedRelated_order2);
|
|
}
|
|
|
|
const relatedRelated_order3 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Alert3 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Alert3?.setRelated_order)
|
|
{
|
|
await
|
|
Alert3.
|
|
setRelated_order(relatedRelated_order3);
|
|
}
|
|
|
|
const relatedRelated_order4 = await ProductionOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductionOrders.count())),
|
|
});
|
|
const Alert4 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Alert4?.setRelated_order)
|
|
{
|
|
await
|
|
Alert4.
|
|
setRelated_order(relatedRelated_order4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateAlertWithRelated_lot() {
|
|
|
|
const relatedRelated_lot0 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Alert0 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Alert0?.setRelated_lot)
|
|
{
|
|
await
|
|
Alert0.
|
|
setRelated_lot(relatedRelated_lot0);
|
|
}
|
|
|
|
const relatedRelated_lot1 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Alert1 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Alert1?.setRelated_lot)
|
|
{
|
|
await
|
|
Alert1.
|
|
setRelated_lot(relatedRelated_lot1);
|
|
}
|
|
|
|
const relatedRelated_lot2 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Alert2 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Alert2?.setRelated_lot)
|
|
{
|
|
await
|
|
Alert2.
|
|
setRelated_lot(relatedRelated_lot2);
|
|
}
|
|
|
|
const relatedRelated_lot3 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Alert3 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Alert3?.setRelated_lot)
|
|
{
|
|
await
|
|
Alert3.
|
|
setRelated_lot(relatedRelated_lot3);
|
|
}
|
|
|
|
const relatedRelated_lot4 = await InventoryLots.findOne({
|
|
offset: Math.floor(Math.random() * (await InventoryLots.count())),
|
|
});
|
|
const Alert4 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Alert4?.setRelated_lot)
|
|
{
|
|
await
|
|
Alert4.
|
|
setRelated_lot(relatedRelated_lot4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateAlertWithRelated_inspection() {
|
|
|
|
const relatedRelated_inspection0 = await Inspections.findOne({
|
|
offset: Math.floor(Math.random() * (await Inspections.count())),
|
|
});
|
|
const Alert0 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Alert0?.setRelated_inspection)
|
|
{
|
|
await
|
|
Alert0.
|
|
setRelated_inspection(relatedRelated_inspection0);
|
|
}
|
|
|
|
const relatedRelated_inspection1 = await Inspections.findOne({
|
|
offset: Math.floor(Math.random() * (await Inspections.count())),
|
|
});
|
|
const Alert1 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Alert1?.setRelated_inspection)
|
|
{
|
|
await
|
|
Alert1.
|
|
setRelated_inspection(relatedRelated_inspection1);
|
|
}
|
|
|
|
const relatedRelated_inspection2 = await Inspections.findOne({
|
|
offset: Math.floor(Math.random() * (await Inspections.count())),
|
|
});
|
|
const Alert2 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Alert2?.setRelated_inspection)
|
|
{
|
|
await
|
|
Alert2.
|
|
setRelated_inspection(relatedRelated_inspection2);
|
|
}
|
|
|
|
const relatedRelated_inspection3 = await Inspections.findOne({
|
|
offset: Math.floor(Math.random() * (await Inspections.count())),
|
|
});
|
|
const Alert3 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Alert3?.setRelated_inspection)
|
|
{
|
|
await
|
|
Alert3.
|
|
setRelated_inspection(relatedRelated_inspection3);
|
|
}
|
|
|
|
const relatedRelated_inspection4 = await Inspections.findOne({
|
|
offset: Math.floor(Math.random() * (await Inspections.count())),
|
|
});
|
|
const Alert4 = await Alerts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Alert4?.setRelated_inspection)
|
|
{
|
|
await
|
|
Alert4.
|
|
setRelated_inspection(relatedRelated_inspection4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCsvImportJobWithRequested_by_user() {
|
|
|
|
const relatedRequested_by_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const CsvImportJob0 = await CsvImportJobs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (CsvImportJob0?.setRequested_by_user)
|
|
{
|
|
await
|
|
CsvImportJob0.
|
|
setRequested_by_user(relatedRequested_by_user0);
|
|
}
|
|
|
|
const relatedRequested_by_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const CsvImportJob1 = await CsvImportJobs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (CsvImportJob1?.setRequested_by_user)
|
|
{
|
|
await
|
|
CsvImportJob1.
|
|
setRequested_by_user(relatedRequested_by_user1);
|
|
}
|
|
|
|
const relatedRequested_by_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const CsvImportJob2 = await CsvImportJobs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (CsvImportJob2?.setRequested_by_user)
|
|
{
|
|
await
|
|
CsvImportJob2.
|
|
setRequested_by_user(relatedRequested_by_user2);
|
|
}
|
|
|
|
const relatedRequested_by_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const CsvImportJob3 = await CsvImportJobs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (CsvImportJob3?.setRequested_by_user)
|
|
{
|
|
await
|
|
CsvImportJob3.
|
|
setRequested_by_user(relatedRequested_by_user3);
|
|
}
|
|
|
|
const relatedRequested_by_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const CsvImportJob4 = await CsvImportJobs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (CsvImportJob4?.setRequested_by_user)
|
|
{
|
|
await
|
|
CsvImportJob4.
|
|
setRequested_by_user(relatedRequested_by_user4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Suppliers.bulkCreate(SuppliersData);
|
|
|
|
|
|
|
|
|
|
await Customers.bulkCreate(CustomersData);
|
|
|
|
|
|
|
|
|
|
await Plants.bulkCreate(PlantsData);
|
|
|
|
|
|
|
|
|
|
await Warehouses.bulkCreate(WarehousesData);
|
|
|
|
|
|
|
|
|
|
await StorageLocations.bulkCreate(StorageLocationsData);
|
|
|
|
|
|
|
|
|
|
await UnitsOfMeasure.bulkCreate(UnitsOfMeasureData);
|
|
|
|
|
|
|
|
|
|
await Materials.bulkCreate(MaterialsData);
|
|
|
|
|
|
|
|
|
|
await MaterialRevisions.bulkCreate(MaterialRevisionsData);
|
|
|
|
|
|
|
|
|
|
await Boms.bulkCreate(BomsData);
|
|
|
|
|
|
|
|
|
|
await BomLines.bulkCreate(BomLinesData);
|
|
|
|
|
|
|
|
|
|
await Routings.bulkCreate(RoutingsData);
|
|
|
|
|
|
|
|
|
|
await Operations.bulkCreate(OperationsData);
|
|
|
|
|
|
|
|
|
|
await WorkCenters.bulkCreate(WorkCentersData);
|
|
|
|
|
|
|
|
|
|
await Machines.bulkCreate(MachinesData);
|
|
|
|
|
|
|
|
|
|
await MachineReadings.bulkCreate(MachineReadingsData);
|
|
|
|
|
|
|
|
|
|
await MaintenanceWorkOrders.bulkCreate(MaintenanceWorkOrdersData);
|
|
|
|
|
|
|
|
|
|
await Shifts.bulkCreate(ShiftsData);
|
|
|
|
|
|
|
|
|
|
await ProductionOrders.bulkCreate(ProductionOrdersData);
|
|
|
|
|
|
|
|
|
|
await WorkOrderOperations.bulkCreate(WorkOrderOperationsData);
|
|
|
|
|
|
|
|
|
|
await InventoryLots.bulkCreate(InventoryLotsData);
|
|
|
|
|
|
|
|
|
|
await InventoryTransactions.bulkCreate(InventoryTransactionsData);
|
|
|
|
|
|
|
|
|
|
await PurchaseOrders.bulkCreate(PurchaseOrdersData);
|
|
|
|
|
|
|
|
|
|
await PurchaseOrderLines.bulkCreate(PurchaseOrderLinesData);
|
|
|
|
|
|
|
|
|
|
await QualityStandards.bulkCreate(QualityStandardsData);
|
|
|
|
|
|
|
|
|
|
await InspectionPlans.bulkCreate(InspectionPlansData);
|
|
|
|
|
|
|
|
|
|
await Inspections.bulkCreate(InspectionsData);
|
|
|
|
|
|
|
|
|
|
await Nonconformances.bulkCreate(NonconformancesData);
|
|
|
|
|
|
|
|
|
|
await Capas.bulkCreate(CapasData);
|
|
|
|
|
|
|
|
|
|
await Alerts.bulkCreate(AlertsData);
|
|
|
|
|
|
|
|
|
|
await CsvImportJobs.bulkCreate(CsvImportJobsData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWarehousWithPlant(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateStorageLocationWithWarehouse(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaterialWithDefault_uom(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaterialWithPreferred_supplier(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaterialRevisionWithMaterial(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaterialRevisionWithApproved_by_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateBomWithParent_material(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateBomWithRevision(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateBomLineWithBom(),
|
|
|
|
|
|
|
|
|
|
await associateBomLineWithComponent_material(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateBomLineWithUom(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateRoutingWithMaterial(),
|
|
|
|
|
|
|
|
|
|
await associateRoutingWithRevision(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateOperationWithRouting(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateOperationWithWork_center(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWorkCenterWithPlant(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMachineWithWork_center(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMachineReadingWithMachine(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaintenanceWorkOrderWithMachine(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaintenanceWorkOrderWithRequested_by_user(),
|
|
|
|
|
|
|
|
|
|
await associateMaintenanceWorkOrderWithAssigned_to_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateShiftWithPlant(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductionOrderWithPlant(),
|
|
|
|
|
|
|
|
|
|
await associateProductionOrderWithMaterial(),
|
|
|
|
|
|
|
|
|
|
await associateProductionOrderWithRouting(),
|
|
|
|
|
|
|
|
|
|
await associateProductionOrderWithCustomer(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductionOrderWithUom(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductionOrderWithPlanner_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWorkOrderOperationWithProduction_order(),
|
|
|
|
|
|
|
|
|
|
await associateWorkOrderOperationWithOperation(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWorkOrderOperationWithAssigned_machine(),
|
|
|
|
|
|
|
|
|
|
await associateWorkOrderOperationWithAssigned_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateInventoryLotWithMaterial(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryLotWithWarehouse(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryLotWithLocation(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateInventoryLotWithUom(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateInventoryLotWithSupplier(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithLot(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithMaterial(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithUom(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithFrom_warehouse(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithTo_warehouse(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithFrom_location(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithTo_location(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithProduction_order(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithPerformed_by_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderWithSupplier(),
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderWithPlant(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderWithBuyer_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderLineWithPurchase_order(),
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderLineWithMaterial(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderLineWithUom(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQualityStandardWithMaterial(),
|
|
|
|
|
|
|
|
|
|
await associateQualityStandardWithRevision(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateInspectionPlanWithQuality_standard(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateInspectionWithInspection_plan(),
|
|
|
|
|
|
|
|
|
|
await associateInspectionWithMaterial(),
|
|
|
|
|
|
|
|
|
|
await associateInspectionWithLot(),
|
|
|
|
|
|
|
|
|
|
await associateInspectionWithProduction_order(),
|
|
|
|
|
|
|
|
|
|
await associateInspectionWithWork_order_operation(),
|
|
|
|
|
|
|
|
|
|
await associateInspectionWithInspector_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithInspection(),
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithMaterial(),
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithLot(),
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithProduction_order(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithOwner_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCapaWithNonconformance(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCapaWithOwner_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAlertWithAcknowledged_by_user(),
|
|
|
|
|
|
|
|
|
|
await associateAlertWithRelated_plant(),
|
|
|
|
|
|
|
|
|
|
await associateAlertWithRelated_machine(),
|
|
|
|
|
|
|
|
|
|
await associateAlertWithRelated_order(),
|
|
|
|
|
|
|
|
|
|
await associateAlertWithRelated_lot(),
|
|
|
|
|
|
|
|
|
|
await associateAlertWithRelated_inspection(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCsvImportJobWithRequested_by_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('suppliers', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('customers', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('plants', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('warehouses', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('storage_locations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('units_of_measure', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('materials', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('material_revisions', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('boms', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('bom_lines', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('routings', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('operations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('work_centers', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('machines', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('machine_readings', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('maintenance_work_orders', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('shifts', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('production_orders', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('work_order_operations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('inventory_lots', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('inventory_transactions', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('purchase_orders', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('purchase_order_lines', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('quality_standards', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('inspection_plans', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('inspections', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('nonconformances', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('capas', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('alerts', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('csv_import_jobs', null, {});
|
|
|
|
|
|
},
|
|
}; |