16712 lines
368 KiB
JavaScript
16712 lines
368 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Organizations = db.organizations;
|
|
|
|
const Companies = db.companies;
|
|
|
|
const Plants = db.plants;
|
|
|
|
const Suppliers = db.suppliers;
|
|
|
|
const Customers = db.customers;
|
|
|
|
const Items = db.items;
|
|
|
|
const Boms = db.boms;
|
|
|
|
const BomLines = db.bom_lines;
|
|
|
|
const Warehouses = db.warehouses;
|
|
|
|
const Locations = db.locations;
|
|
|
|
const Lots = db.lots;
|
|
|
|
const InventoryBalances = db.inventory_balances;
|
|
|
|
const InventoryTransactions = db.inventory_transactions;
|
|
|
|
const Machines = db.machines;
|
|
|
|
const MachineDowntimeEvents = db.machine_downtime_events;
|
|
|
|
const WorkOrders = db.work_orders;
|
|
|
|
const ProductionOperations = db.production_operations;
|
|
|
|
const MaterialIssues = db.material_issues;
|
|
|
|
const ProductionLots = db.production_lots;
|
|
|
|
const QaInspectionPlans = db.qa_inspection_plans;
|
|
|
|
const QaCharacteristics = db.qa_characteristics;
|
|
|
|
const QaInspections = db.qa_inspections;
|
|
|
|
const QaResults = db.qa_results;
|
|
|
|
const Nonconformances = db.nonconformances;
|
|
|
|
const Capas = db.capas;
|
|
|
|
const Documents = db.documents;
|
|
|
|
const AuditEvents = db.audit_events;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const OrganizationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CompaniesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"legal_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_number": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"legal_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_number": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"legal_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_number": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"legal_name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_number": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PlantsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"timezone": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const SuppliersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CustomersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "on_hold",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "on_hold",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state_region": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ItemsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_type": "subassembly",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_lot_tracked": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_expiry": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shelf_life_days": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_cost": 4.87,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_price": 8.26,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_type": "subassembly",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_lot_tracked": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_expiry": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shelf_life_days": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_cost": 7.05,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_price": 0.11,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_type": "consumable",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_lot_tracked": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_expiry": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shelf_life_days": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_cost": 1.72,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_price": 4.96,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_type": "finished_good",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_lot_tracked": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_expiry": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shelf_life_days": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_cost": 6.79,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"standard_price": 9.32,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const BomsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "obsolete",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_from": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_to": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const BomLinesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_per": 3.57,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_factor": 9.38,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "manual",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_number": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_per": 4.12,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_factor": 3.42,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "manual",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_number": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_per": 2.21,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_factor": 3.51,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "backflush",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_number": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_per": 5.17,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_factor": 2.28,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "backflush",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_number": 6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const WarehousesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_type": "finished",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_type": "wip",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_type": "raw",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"warehouse_type": "quarantine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const LocationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_type": "floor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_type": "quarantine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_type": "floor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_type": "floor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const LotsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lot_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_lot_number": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"received_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufactured_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expiry_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "quarantine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_received": 6.42,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_available": 4.05,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lot_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_lot_number": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"received_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufactured_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expiry_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "quarantine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_received": 7.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_available": 2.65,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lot_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_lot_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"received_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufactured_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expiry_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "consumed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_received": 9.72,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_available": 0.49,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lot_number": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_lot_number": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"received_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufactured_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expiry_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "quarantine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_received": 8.52,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_available": 7.79,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const InventoryBalancesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_on_hand": 4.92,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_allocated": 1.58,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_available": 4.84,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_counted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_on_hand": 8.68,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_allocated": 9.41,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_available": 7.52,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_counted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_on_hand": 9.74,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_allocated": 9.71,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_available": 6.28,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_counted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_on_hand": 9.84,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_allocated": 9.38,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_available": 4.18,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_counted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const InventoryTransactionsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "move",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 2.37,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "adjustment",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 7.04,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "issue",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 6.47,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "scrap",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 9.84,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MachinesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"asset_tag": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"serial_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufacturer": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"model": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"commissioned_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "running",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"criticality": "high",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_description": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"asset_tag": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"serial_number": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufacturer": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"model": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"commissioned_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "running",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"criticality": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_description": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"asset_tag": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"serial_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufacturer": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"model": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"commissioned_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "running",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"criticality": "medium",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_description": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"asset_tag": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"serial_number": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manufacturer": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"model": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"commissioned_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "offline",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"criticality": "medium",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"location_description": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MachineDowntimeEventsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"downtime_type": "planned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason_category": "other",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason_detail": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_minutes": 0.28,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"downtime_type": "unplanned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason_category": "software",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason_detail": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_minutes": 0.94,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"downtime_type": "planned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason_category": "quality_hold",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason_detail": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_minutes": 9.85,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"downtime_type": "planned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason_category": "operator_unavailable",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reason_detail": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration_minutes": 7.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const WorkOrdersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_order_number": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_planned": 8.37,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_completed": 3.4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "closed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_po": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_order_number": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_planned": 4.77,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_completed": 1.11,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_po": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_order_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_planned": 6.92,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_completed": 1.35,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "released",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_po": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"work_order_number": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_planned": 4.11,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_completed": 0.78,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_po": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ProductionOperationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_sequence": 8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "not_started",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"labor_minutes": 9.46,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_minutes": 6.13,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_sequence": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "paused",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"labor_minutes": 2.45,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_minutes": 4.92,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_sequence": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "blocked",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"labor_minutes": 9.39,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_minutes": 7.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"operation_sequence": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "paused",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"planned_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_start_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"actual_end_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"labor_minutes": 1.36,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"machine_minutes": 5.83,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"instructions": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MaterialIssuesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_issued": 7.98,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issued_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "backflush",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_issued": 3.66,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issued_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "backflush",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_issued": 8.25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issued_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "manual",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_issued": 0.28,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issued_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issue_method": "manual",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ProductionLotsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"produced_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_produced": 4.72,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"disposition": "quarantine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"produced_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_produced": 5.31,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"disposition": "quarantine",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"produced_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_produced": 9.91,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"disposition": "released",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"produced_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity_produced": 9.25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uom": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"disposition": "scrapped",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const QaInspectionPlansData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"inspection_type": "in_process",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sampling_method": "c_equals_0",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 0.75,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"inspection_type": "final",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sampling_method": "aql",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 7.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"inspection_type": "in_process",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sampling_method": "100_percent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 9.98,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"inspection_type": "final",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sampling_method": "fixed_n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sample_size": 9.9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const QaCharacteristicsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"data_type": "numeric",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lower_spec": 5.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"upper_spec": 4.92,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result_required": "optional",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sequence": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"method": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"data_type": "numeric",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lower_spec": 3.34,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"upper_spec": 2.91,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result_required": "optional",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sequence": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"method": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"data_type": "numeric",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lower_spec": 9.31,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"upper_spec": 8.32,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result_required": "optional",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sequence": 8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"method": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"data_type": "attribute",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"lower_spec": 0.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"upper_spec": 4.84,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result_required": "required",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sequence": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"method": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const QaInspectionsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_result": "fail",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_result": "conditional",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_result": "pending",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_result": "pass",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const QaResultsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"numeric_value": 8.63,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"attribute_value": "fail",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result": "fail",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"comment": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"numeric_value": 3.52,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"attribute_value": "pass",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result": "pass",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"comment": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"numeric_value": 6.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"attribute_value": "pass",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result": "pass",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"comment": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"numeric_value": 7.47,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"attribute_value": "fail",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"result": "fail",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"comment": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const NonconformancesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ncr_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"source": "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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "major",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "capa_required",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"containment_action": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"disposition": "return_to_supplier",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reported_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ncr_number": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"source": "incoming",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "minor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "open",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"containment_action": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"disposition": "use_as_is",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reported_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ncr_number": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"source": "final",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "critical",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "closed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"containment_action": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"disposition": "use_as_is",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reported_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ncr_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"source": "incoming",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"severity": "critical",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "closed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"containment_action": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"disposition": "use_as_is",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reported_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CapasData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capa_number": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "open",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"problem_statement": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"root_cause": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"corrective_action": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"preventive_action": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capa_number": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "action_planning",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"problem_statement": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"root_cause": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"corrective_action": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"preventive_action": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capa_number": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "action_planning",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"problem_statement": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"root_cause": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"corrective_action": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"preventive_action": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capa_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "root_cause",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"problem_statement": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"root_cause": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"corrective_action": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"preventive_action": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const DocumentsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"document_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"document_type": "other",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "obsolete",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"review_due_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"document_number": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"document_type": "sop",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"review_due_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"document_number": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"document_type": "policy",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "obsolete",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"review_due_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"document_number": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"document_type": "form",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"revision": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "approved",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"effective_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"review_due_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"summary": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AuditEventsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_type": "material_issue",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_reference": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action": "login",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ip_address": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_type": "capa",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_reference": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action": "update",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ip_address": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_type": "user",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_reference": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action": "update",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ip_address": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_type": "location",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_reference": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action": "void",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ip_address": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
async function associateUserWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User0 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (User0?.setOrganization)
|
|
{
|
|
await
|
|
User0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User1 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (User1?.setOrganization)
|
|
{
|
|
await
|
|
User1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User2 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (User2?.setOrganization)
|
|
{
|
|
await
|
|
User2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User3 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (User3?.setOrganization)
|
|
{
|
|
await
|
|
User3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCompanyWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Company0 = await Companies.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Company0?.setOrganization)
|
|
{
|
|
await
|
|
Company0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Company1 = await Companies.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Company1?.setOrganization)
|
|
{
|
|
await
|
|
Company1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Company2 = await Companies.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Company2?.setOrganization)
|
|
{
|
|
await
|
|
Company2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Company3 = await Companies.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Company3?.setOrganization)
|
|
{
|
|
await
|
|
Company3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePlantWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Plant0 = await Plants.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Plant0?.setCompany)
|
|
{
|
|
await
|
|
Plant0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Plant1 = await Plants.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Plant1?.setCompany)
|
|
{
|
|
await
|
|
Plant1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Plant2 = await Plants.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Plant2?.setCompany)
|
|
{
|
|
await
|
|
Plant2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Plant3 = await Plants.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Plant3?.setCompany)
|
|
{
|
|
await
|
|
Plant3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePlantWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Plant0 = await Plants.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Plant0?.setOrganization)
|
|
{
|
|
await
|
|
Plant0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Plant1 = await Plants.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Plant1?.setOrganization)
|
|
{
|
|
await
|
|
Plant1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Plant2 = await Plants.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Plant2?.setOrganization)
|
|
{
|
|
await
|
|
Plant2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Plant3 = await Plants.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Plant3?.setOrganization)
|
|
{
|
|
await
|
|
Plant3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSupplierWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Supplier0 = await Suppliers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Supplier0?.setCompany)
|
|
{
|
|
await
|
|
Supplier0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Supplier1 = await Suppliers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Supplier1?.setCompany)
|
|
{
|
|
await
|
|
Supplier1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Supplier2 = await Suppliers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Supplier2?.setCompany)
|
|
{
|
|
await
|
|
Supplier2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Supplier3 = await Suppliers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Supplier3?.setCompany)
|
|
{
|
|
await
|
|
Supplier3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSupplierWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Supplier0 = await Suppliers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Supplier0?.setOrganization)
|
|
{
|
|
await
|
|
Supplier0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Supplier1 = await Suppliers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Supplier1?.setOrganization)
|
|
{
|
|
await
|
|
Supplier1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Supplier2 = await Suppliers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Supplier2?.setOrganization)
|
|
{
|
|
await
|
|
Supplier2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Supplier3 = await Suppliers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Supplier3?.setOrganization)
|
|
{
|
|
await
|
|
Supplier3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCustomerWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Customer0 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Customer0?.setCompany)
|
|
{
|
|
await
|
|
Customer0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Customer1 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Customer1?.setCompany)
|
|
{
|
|
await
|
|
Customer1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Customer2 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Customer2?.setCompany)
|
|
{
|
|
await
|
|
Customer2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Customer3 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Customer3?.setCompany)
|
|
{
|
|
await
|
|
Customer3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCustomerWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Customer0 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Customer0?.setOrganization)
|
|
{
|
|
await
|
|
Customer0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Customer1 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Customer1?.setOrganization)
|
|
{
|
|
await
|
|
Customer1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Customer2 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Customer2?.setOrganization)
|
|
{
|
|
await
|
|
Customer2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Customer3 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Customer3?.setOrganization)
|
|
{
|
|
await
|
|
Customer3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateItemWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Item0 = await Items.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Item0?.setCompany)
|
|
{
|
|
await
|
|
Item0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Item1 = await Items.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Item1?.setCompany)
|
|
{
|
|
await
|
|
Item1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Item2 = await Items.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Item2?.setCompany)
|
|
{
|
|
await
|
|
Item2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Item3 = await Items.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Item3?.setCompany)
|
|
{
|
|
await
|
|
Item3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateItemWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Item0 = await Items.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Item0?.setOrganization)
|
|
{
|
|
await
|
|
Item0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Item1 = await Items.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Item1?.setOrganization)
|
|
{
|
|
await
|
|
Item1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Item2 = await Items.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Item2?.setOrganization)
|
|
{
|
|
await
|
|
Item2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Item3 = await Items.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Item3?.setOrganization)
|
|
{
|
|
await
|
|
Item3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateBomWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Bom0 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Bom0?.setCompany)
|
|
{
|
|
await
|
|
Bom0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Bom1 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Bom1?.setCompany)
|
|
{
|
|
await
|
|
Bom1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Bom2 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Bom2?.setCompany)
|
|
{
|
|
await
|
|
Bom2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Bom3 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Bom3?.setCompany)
|
|
{
|
|
await
|
|
Bom3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateBomWithParent_item() {
|
|
|
|
const relatedParent_item0 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Bom0 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Bom0?.setParent_item)
|
|
{
|
|
await
|
|
Bom0.
|
|
setParent_item(relatedParent_item0);
|
|
}
|
|
|
|
const relatedParent_item1 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Bom1 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Bom1?.setParent_item)
|
|
{
|
|
await
|
|
Bom1.
|
|
setParent_item(relatedParent_item1);
|
|
}
|
|
|
|
const relatedParent_item2 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Bom2 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Bom2?.setParent_item)
|
|
{
|
|
await
|
|
Bom2.
|
|
setParent_item(relatedParent_item2);
|
|
}
|
|
|
|
const relatedParent_item3 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Bom3 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Bom3?.setParent_item)
|
|
{
|
|
await
|
|
Bom3.
|
|
setParent_item(relatedParent_item3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateBomWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Bom0 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Bom0?.setOrganization)
|
|
{
|
|
await
|
|
Bom0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Bom1 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Bom1?.setOrganization)
|
|
{
|
|
await
|
|
Bom1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Bom2 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Bom2?.setOrganization)
|
|
{
|
|
await
|
|
Bom2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Bom3 = await Boms.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Bom3?.setOrganization)
|
|
{
|
|
await
|
|
Bom3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateBomLineWithComponent_item() {
|
|
|
|
const relatedComponent_item0 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const BomLine0 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (BomLine0?.setComponent_item)
|
|
{
|
|
await
|
|
BomLine0.
|
|
setComponent_item(relatedComponent_item0);
|
|
}
|
|
|
|
const relatedComponent_item1 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const BomLine1 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (BomLine1?.setComponent_item)
|
|
{
|
|
await
|
|
BomLine1.
|
|
setComponent_item(relatedComponent_item1);
|
|
}
|
|
|
|
const relatedComponent_item2 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const BomLine2 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (BomLine2?.setComponent_item)
|
|
{
|
|
await
|
|
BomLine2.
|
|
setComponent_item(relatedComponent_item2);
|
|
}
|
|
|
|
const relatedComponent_item3 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const BomLine3 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (BomLine3?.setComponent_item)
|
|
{
|
|
await
|
|
BomLine3.
|
|
setComponent_item(relatedComponent_item3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateBomLineWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const BomLine0 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (BomLine0?.setOrganization)
|
|
{
|
|
await
|
|
BomLine0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const BomLine1 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (BomLine1?.setOrganization)
|
|
{
|
|
await
|
|
BomLine1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const BomLine2 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (BomLine2?.setOrganization)
|
|
{
|
|
await
|
|
BomLine2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const BomLine3 = await BomLines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (BomLine3?.setOrganization)
|
|
{
|
|
await
|
|
BomLine3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWarehousWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Warehous0 = await Warehouses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Warehous0?.setOrganization)
|
|
{
|
|
await
|
|
Warehous0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Warehous1 = await Warehouses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Warehous1?.setOrganization)
|
|
{
|
|
await
|
|
Warehous1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Warehous2 = await Warehouses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Warehous2?.setOrganization)
|
|
{
|
|
await
|
|
Warehous2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Warehous3 = await Warehouses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Warehous3?.setOrganization)
|
|
{
|
|
await
|
|
Warehous3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLocationWithWarehouse() {
|
|
|
|
const relatedWarehouse0 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const Location0 = await Locations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Location0?.setWarehouse)
|
|
{
|
|
await
|
|
Location0.
|
|
setWarehouse(relatedWarehouse0);
|
|
}
|
|
|
|
const relatedWarehouse1 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const Location1 = await Locations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Location1?.setWarehouse)
|
|
{
|
|
await
|
|
Location1.
|
|
setWarehouse(relatedWarehouse1);
|
|
}
|
|
|
|
const relatedWarehouse2 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const Location2 = await Locations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Location2?.setWarehouse)
|
|
{
|
|
await
|
|
Location2.
|
|
setWarehouse(relatedWarehouse2);
|
|
}
|
|
|
|
const relatedWarehouse3 = await Warehouses.findOne({
|
|
offset: Math.floor(Math.random() * (await Warehouses.count())),
|
|
});
|
|
const Location3 = await Locations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Location3?.setWarehouse)
|
|
{
|
|
await
|
|
Location3.
|
|
setWarehouse(relatedWarehouse3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLocationWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Location0 = await Locations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Location0?.setOrganization)
|
|
{
|
|
await
|
|
Location0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Location1 = await Locations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Location1?.setOrganization)
|
|
{
|
|
await
|
|
Location1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Location2 = await Locations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Location2?.setOrganization)
|
|
{
|
|
await
|
|
Location2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Location3 = await Locations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Location3?.setOrganization)
|
|
{
|
|
await
|
|
Location3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLotWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Lot0 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Lot0?.setCompany)
|
|
{
|
|
await
|
|
Lot0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Lot1 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Lot1?.setCompany)
|
|
{
|
|
await
|
|
Lot1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Lot2 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Lot2?.setCompany)
|
|
{
|
|
await
|
|
Lot2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Lot3 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Lot3?.setCompany)
|
|
{
|
|
await
|
|
Lot3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateLotWithItem() {
|
|
|
|
const relatedItem0 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Lot0 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Lot0?.setItem)
|
|
{
|
|
await
|
|
Lot0.
|
|
setItem(relatedItem0);
|
|
}
|
|
|
|
const relatedItem1 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Lot1 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Lot1?.setItem)
|
|
{
|
|
await
|
|
Lot1.
|
|
setItem(relatedItem1);
|
|
}
|
|
|
|
const relatedItem2 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Lot2 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Lot2?.setItem)
|
|
{
|
|
await
|
|
Lot2.
|
|
setItem(relatedItem2);
|
|
}
|
|
|
|
const relatedItem3 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Lot3 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Lot3?.setItem)
|
|
{
|
|
await
|
|
Lot3.
|
|
setItem(relatedItem3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateLotWithSupplier() {
|
|
|
|
const relatedSupplier0 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const Lot0 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Lot0?.setSupplier)
|
|
{
|
|
await
|
|
Lot0.
|
|
setSupplier(relatedSupplier0);
|
|
}
|
|
|
|
const relatedSupplier1 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const Lot1 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Lot1?.setSupplier)
|
|
{
|
|
await
|
|
Lot1.
|
|
setSupplier(relatedSupplier1);
|
|
}
|
|
|
|
const relatedSupplier2 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const Lot2 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Lot2?.setSupplier)
|
|
{
|
|
await
|
|
Lot2.
|
|
setSupplier(relatedSupplier2);
|
|
}
|
|
|
|
const relatedSupplier3 = await Suppliers.findOne({
|
|
offset: Math.floor(Math.random() * (await Suppliers.count())),
|
|
});
|
|
const Lot3 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Lot3?.setSupplier)
|
|
{
|
|
await
|
|
Lot3.
|
|
setSupplier(relatedSupplier3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLotWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Lot0 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Lot0?.setOrganization)
|
|
{
|
|
await
|
|
Lot0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Lot1 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Lot1?.setOrganization)
|
|
{
|
|
await
|
|
Lot1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Lot2 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Lot2?.setOrganization)
|
|
{
|
|
await
|
|
Lot2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Lot3 = await Lots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Lot3?.setOrganization)
|
|
{
|
|
await
|
|
Lot3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateInventoryBalanceWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const InventoryBalance0 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryBalance0?.setPlant)
|
|
{
|
|
await
|
|
InventoryBalance0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const InventoryBalance1 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryBalance1?.setPlant)
|
|
{
|
|
await
|
|
InventoryBalance1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const InventoryBalance2 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryBalance2?.setPlant)
|
|
{
|
|
await
|
|
InventoryBalance2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const InventoryBalance3 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryBalance3?.setPlant)
|
|
{
|
|
await
|
|
InventoryBalance3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryBalanceWithLocation() {
|
|
|
|
const relatedLocation0 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryBalance0 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryBalance0?.setLocation)
|
|
{
|
|
await
|
|
InventoryBalance0.
|
|
setLocation(relatedLocation0);
|
|
}
|
|
|
|
const relatedLocation1 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryBalance1 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryBalance1?.setLocation)
|
|
{
|
|
await
|
|
InventoryBalance1.
|
|
setLocation(relatedLocation1);
|
|
}
|
|
|
|
const relatedLocation2 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryBalance2 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryBalance2?.setLocation)
|
|
{
|
|
await
|
|
InventoryBalance2.
|
|
setLocation(relatedLocation2);
|
|
}
|
|
|
|
const relatedLocation3 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryBalance3 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryBalance3?.setLocation)
|
|
{
|
|
await
|
|
InventoryBalance3.
|
|
setLocation(relatedLocation3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryBalanceWithItem() {
|
|
|
|
const relatedItem0 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const InventoryBalance0 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryBalance0?.setItem)
|
|
{
|
|
await
|
|
InventoryBalance0.
|
|
setItem(relatedItem0);
|
|
}
|
|
|
|
const relatedItem1 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const InventoryBalance1 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryBalance1?.setItem)
|
|
{
|
|
await
|
|
InventoryBalance1.
|
|
setItem(relatedItem1);
|
|
}
|
|
|
|
const relatedItem2 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const InventoryBalance2 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryBalance2?.setItem)
|
|
{
|
|
await
|
|
InventoryBalance2.
|
|
setItem(relatedItem2);
|
|
}
|
|
|
|
const relatedItem3 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const InventoryBalance3 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryBalance3?.setItem)
|
|
{
|
|
await
|
|
InventoryBalance3.
|
|
setItem(relatedItem3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryBalanceWithLot() {
|
|
|
|
const relatedLot0 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const InventoryBalance0 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryBalance0?.setLot)
|
|
{
|
|
await
|
|
InventoryBalance0.
|
|
setLot(relatedLot0);
|
|
}
|
|
|
|
const relatedLot1 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const InventoryBalance1 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryBalance1?.setLot)
|
|
{
|
|
await
|
|
InventoryBalance1.
|
|
setLot(relatedLot1);
|
|
}
|
|
|
|
const relatedLot2 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const InventoryBalance2 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryBalance2?.setLot)
|
|
{
|
|
await
|
|
InventoryBalance2.
|
|
setLot(relatedLot2);
|
|
}
|
|
|
|
const relatedLot3 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const InventoryBalance3 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryBalance3?.setLot)
|
|
{
|
|
await
|
|
InventoryBalance3.
|
|
setLot(relatedLot3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateInventoryBalanceWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const InventoryBalance0 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryBalance0?.setOrganization)
|
|
{
|
|
await
|
|
InventoryBalance0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const InventoryBalance1 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryBalance1?.setOrganization)
|
|
{
|
|
await
|
|
InventoryBalance1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const InventoryBalance2 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryBalance2?.setOrganization)
|
|
{
|
|
await
|
|
InventoryBalance2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const InventoryBalance3 = await InventoryBalances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryBalance3?.setOrganization)
|
|
{
|
|
await
|
|
InventoryBalance3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setPlant)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setPlant)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setPlant)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setPlant)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithItem() {
|
|
|
|
const relatedItem0 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setItem)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setItem(relatedItem0);
|
|
}
|
|
|
|
const relatedItem1 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setItem)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setItem(relatedItem1);
|
|
}
|
|
|
|
const relatedItem2 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setItem)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setItem(relatedItem2);
|
|
}
|
|
|
|
const relatedItem3 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setItem)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setItem(relatedItem3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithLot() {
|
|
|
|
const relatedLot0 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setLot)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setLot(relatedLot0);
|
|
}
|
|
|
|
const relatedLot1 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setLot)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setLot(relatedLot1);
|
|
}
|
|
|
|
const relatedLot2 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setLot)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setLot(relatedLot2);
|
|
}
|
|
|
|
const relatedLot3 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setLot)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setLot(relatedLot3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithFrom_location() {
|
|
|
|
const relatedFrom_location0 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setFrom_location)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setFrom_location(relatedFrom_location0);
|
|
}
|
|
|
|
const relatedFrom_location1 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setFrom_location)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setFrom_location(relatedFrom_location1);
|
|
}
|
|
|
|
const relatedFrom_location2 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setFrom_location)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setFrom_location(relatedFrom_location2);
|
|
}
|
|
|
|
const relatedFrom_location3 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setFrom_location)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setFrom_location(relatedFrom_location3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithTo_location() {
|
|
|
|
const relatedTo_location0 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setTo_location)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setTo_location(relatedTo_location0);
|
|
}
|
|
|
|
const relatedTo_location1 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setTo_location)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setTo_location(relatedTo_location1);
|
|
}
|
|
|
|
const relatedTo_location2 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setTo_location)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setTo_location(relatedTo_location2);
|
|
}
|
|
|
|
const relatedTo_location3 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setTo_location)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setTo_location(relatedTo_location3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithPerformed_by_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);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateInventoryTransactionWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const InventoryTransaction0 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (InventoryTransaction0?.setOrganization)
|
|
{
|
|
await
|
|
InventoryTransaction0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const InventoryTransaction1 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (InventoryTransaction1?.setOrganization)
|
|
{
|
|
await
|
|
InventoryTransaction1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const InventoryTransaction2 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (InventoryTransaction2?.setOrganization)
|
|
{
|
|
await
|
|
InventoryTransaction2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const InventoryTransaction3 = await InventoryTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (InventoryTransaction3?.setOrganization)
|
|
{
|
|
await
|
|
InventoryTransaction3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMachineWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Machine0 = await Machines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Machine0?.setPlant)
|
|
{
|
|
await
|
|
Machine0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Machine1 = await Machines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Machine1?.setPlant)
|
|
{
|
|
await
|
|
Machine1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Machine2 = await Machines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Machine2?.setPlant)
|
|
{
|
|
await
|
|
Machine2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Machine3 = await Machines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Machine3?.setPlant)
|
|
{
|
|
await
|
|
Machine3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMachineWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Machine0 = await Machines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Machine0?.setOrganization)
|
|
{
|
|
await
|
|
Machine0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Machine1 = await Machines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Machine1?.setOrganization)
|
|
{
|
|
await
|
|
Machine1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Machine2 = await Machines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Machine2?.setOrganization)
|
|
{
|
|
await
|
|
Machine2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Machine3 = await Machines.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Machine3?.setOrganization)
|
|
{
|
|
await
|
|
Machine3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMachineDowntimeEventWithMachine() {
|
|
|
|
const relatedMachine0 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MachineDowntimeEvent0 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MachineDowntimeEvent0?.setMachine)
|
|
{
|
|
await
|
|
MachineDowntimeEvent0.
|
|
setMachine(relatedMachine0);
|
|
}
|
|
|
|
const relatedMachine1 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MachineDowntimeEvent1 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MachineDowntimeEvent1?.setMachine)
|
|
{
|
|
await
|
|
MachineDowntimeEvent1.
|
|
setMachine(relatedMachine1);
|
|
}
|
|
|
|
const relatedMachine2 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MachineDowntimeEvent2 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MachineDowntimeEvent2?.setMachine)
|
|
{
|
|
await
|
|
MachineDowntimeEvent2.
|
|
setMachine(relatedMachine2);
|
|
}
|
|
|
|
const relatedMachine3 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const MachineDowntimeEvent3 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MachineDowntimeEvent3?.setMachine)
|
|
{
|
|
await
|
|
MachineDowntimeEvent3.
|
|
setMachine(relatedMachine3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMachineDowntimeEventWithReported_by_user() {
|
|
|
|
const relatedReported_by_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MachineDowntimeEvent0 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MachineDowntimeEvent0?.setReported_by_user)
|
|
{
|
|
await
|
|
MachineDowntimeEvent0.
|
|
setReported_by_user(relatedReported_by_user0);
|
|
}
|
|
|
|
const relatedReported_by_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MachineDowntimeEvent1 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MachineDowntimeEvent1?.setReported_by_user)
|
|
{
|
|
await
|
|
MachineDowntimeEvent1.
|
|
setReported_by_user(relatedReported_by_user1);
|
|
}
|
|
|
|
const relatedReported_by_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MachineDowntimeEvent2 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MachineDowntimeEvent2?.setReported_by_user)
|
|
{
|
|
await
|
|
MachineDowntimeEvent2.
|
|
setReported_by_user(relatedReported_by_user2);
|
|
}
|
|
|
|
const relatedReported_by_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MachineDowntimeEvent3 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MachineDowntimeEvent3?.setReported_by_user)
|
|
{
|
|
await
|
|
MachineDowntimeEvent3.
|
|
setReported_by_user(relatedReported_by_user3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMachineDowntimeEventWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MachineDowntimeEvent0 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MachineDowntimeEvent0?.setOrganization)
|
|
{
|
|
await
|
|
MachineDowntimeEvent0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MachineDowntimeEvent1 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MachineDowntimeEvent1?.setOrganization)
|
|
{
|
|
await
|
|
MachineDowntimeEvent1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MachineDowntimeEvent2 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MachineDowntimeEvent2?.setOrganization)
|
|
{
|
|
await
|
|
MachineDowntimeEvent2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MachineDowntimeEvent3 = await MachineDowntimeEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MachineDowntimeEvent3?.setOrganization)
|
|
{
|
|
await
|
|
MachineDowntimeEvent3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWorkOrderWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const WorkOrder0 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkOrder0?.setPlant)
|
|
{
|
|
await
|
|
WorkOrder0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const WorkOrder1 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkOrder1?.setPlant)
|
|
{
|
|
await
|
|
WorkOrder1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const WorkOrder2 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkOrder2?.setPlant)
|
|
{
|
|
await
|
|
WorkOrder2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const WorkOrder3 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkOrder3?.setPlant)
|
|
{
|
|
await
|
|
WorkOrder3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWorkOrderWithItem() {
|
|
|
|
const relatedItem0 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const WorkOrder0 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkOrder0?.setItem)
|
|
{
|
|
await
|
|
WorkOrder0.
|
|
setItem(relatedItem0);
|
|
}
|
|
|
|
const relatedItem1 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const WorkOrder1 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkOrder1?.setItem)
|
|
{
|
|
await
|
|
WorkOrder1.
|
|
setItem(relatedItem1);
|
|
}
|
|
|
|
const relatedItem2 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const WorkOrder2 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkOrder2?.setItem)
|
|
{
|
|
await
|
|
WorkOrder2.
|
|
setItem(relatedItem2);
|
|
}
|
|
|
|
const relatedItem3 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const WorkOrder3 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkOrder3?.setItem)
|
|
{
|
|
await
|
|
WorkOrder3.
|
|
setItem(relatedItem3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateWorkOrderWithBom() {
|
|
|
|
const relatedBom0 = await Boms.findOne({
|
|
offset: Math.floor(Math.random() * (await Boms.count())),
|
|
});
|
|
const WorkOrder0 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkOrder0?.setBom)
|
|
{
|
|
await
|
|
WorkOrder0.
|
|
setBom(relatedBom0);
|
|
}
|
|
|
|
const relatedBom1 = await Boms.findOne({
|
|
offset: Math.floor(Math.random() * (await Boms.count())),
|
|
});
|
|
const WorkOrder1 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkOrder1?.setBom)
|
|
{
|
|
await
|
|
WorkOrder1.
|
|
setBom(relatedBom1);
|
|
}
|
|
|
|
const relatedBom2 = await Boms.findOne({
|
|
offset: Math.floor(Math.random() * (await Boms.count())),
|
|
});
|
|
const WorkOrder2 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkOrder2?.setBom)
|
|
{
|
|
await
|
|
WorkOrder2.
|
|
setBom(relatedBom2);
|
|
}
|
|
|
|
const relatedBom3 = await Boms.findOne({
|
|
offset: Math.floor(Math.random() * (await Boms.count())),
|
|
});
|
|
const WorkOrder3 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkOrder3?.setBom)
|
|
{
|
|
await
|
|
WorkOrder3.
|
|
setBom(relatedBom3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWorkOrderWithCustomer() {
|
|
|
|
const relatedCustomer0 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const WorkOrder0 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkOrder0?.setCustomer)
|
|
{
|
|
await
|
|
WorkOrder0.
|
|
setCustomer(relatedCustomer0);
|
|
}
|
|
|
|
const relatedCustomer1 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const WorkOrder1 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkOrder1?.setCustomer)
|
|
{
|
|
await
|
|
WorkOrder1.
|
|
setCustomer(relatedCustomer1);
|
|
}
|
|
|
|
const relatedCustomer2 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const WorkOrder2 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkOrder2?.setCustomer)
|
|
{
|
|
await
|
|
WorkOrder2.
|
|
setCustomer(relatedCustomer2);
|
|
}
|
|
|
|
const relatedCustomer3 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const WorkOrder3 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkOrder3?.setCustomer)
|
|
{
|
|
await
|
|
WorkOrder3.
|
|
setCustomer(relatedCustomer3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWorkOrderWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const WorkOrder0 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkOrder0?.setOrganization)
|
|
{
|
|
await
|
|
WorkOrder0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const WorkOrder1 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkOrder1?.setOrganization)
|
|
{
|
|
await
|
|
WorkOrder1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const WorkOrder2 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkOrder2?.setOrganization)
|
|
{
|
|
await
|
|
WorkOrder2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const WorkOrder3 = await WorkOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkOrder3?.setOrganization)
|
|
{
|
|
await
|
|
WorkOrder3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductionOperationWithWork_order() {
|
|
|
|
const relatedWork_order0 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const ProductionOperation0 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionOperation0?.setWork_order)
|
|
{
|
|
await
|
|
ProductionOperation0.
|
|
setWork_order(relatedWork_order0);
|
|
}
|
|
|
|
const relatedWork_order1 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const ProductionOperation1 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionOperation1?.setWork_order)
|
|
{
|
|
await
|
|
ProductionOperation1.
|
|
setWork_order(relatedWork_order1);
|
|
}
|
|
|
|
const relatedWork_order2 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const ProductionOperation2 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionOperation2?.setWork_order)
|
|
{
|
|
await
|
|
ProductionOperation2.
|
|
setWork_order(relatedWork_order2);
|
|
}
|
|
|
|
const relatedWork_order3 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const ProductionOperation3 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionOperation3?.setWork_order)
|
|
{
|
|
await
|
|
ProductionOperation3.
|
|
setWork_order(relatedWork_order3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductionOperationWithMachine() {
|
|
|
|
const relatedMachine0 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const ProductionOperation0 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionOperation0?.setMachine)
|
|
{
|
|
await
|
|
ProductionOperation0.
|
|
setMachine(relatedMachine0);
|
|
}
|
|
|
|
const relatedMachine1 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const ProductionOperation1 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionOperation1?.setMachine)
|
|
{
|
|
await
|
|
ProductionOperation1.
|
|
setMachine(relatedMachine1);
|
|
}
|
|
|
|
const relatedMachine2 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const ProductionOperation2 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionOperation2?.setMachine)
|
|
{
|
|
await
|
|
ProductionOperation2.
|
|
setMachine(relatedMachine2);
|
|
}
|
|
|
|
const relatedMachine3 = await Machines.findOne({
|
|
offset: Math.floor(Math.random() * (await Machines.count())),
|
|
});
|
|
const ProductionOperation3 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionOperation3?.setMachine)
|
|
{
|
|
await
|
|
ProductionOperation3.
|
|
setMachine(relatedMachine3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductionOperationWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const ProductionOperation0 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionOperation0?.setOrganization)
|
|
{
|
|
await
|
|
ProductionOperation0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const ProductionOperation1 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionOperation1?.setOrganization)
|
|
{
|
|
await
|
|
ProductionOperation1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const ProductionOperation2 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionOperation2?.setOrganization)
|
|
{
|
|
await
|
|
ProductionOperation2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const ProductionOperation3 = await ProductionOperations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionOperation3?.setOrganization)
|
|
{
|
|
await
|
|
ProductionOperation3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaterialIssueWithWork_order() {
|
|
|
|
const relatedWork_order0 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const MaterialIssue0 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialIssue0?.setWork_order)
|
|
{
|
|
await
|
|
MaterialIssue0.
|
|
setWork_order(relatedWork_order0);
|
|
}
|
|
|
|
const relatedWork_order1 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const MaterialIssue1 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialIssue1?.setWork_order)
|
|
{
|
|
await
|
|
MaterialIssue1.
|
|
setWork_order(relatedWork_order1);
|
|
}
|
|
|
|
const relatedWork_order2 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const MaterialIssue2 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialIssue2?.setWork_order)
|
|
{
|
|
await
|
|
MaterialIssue2.
|
|
setWork_order(relatedWork_order2);
|
|
}
|
|
|
|
const relatedWork_order3 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const MaterialIssue3 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialIssue3?.setWork_order)
|
|
{
|
|
await
|
|
MaterialIssue3.
|
|
setWork_order(relatedWork_order3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMaterialIssueWithItem() {
|
|
|
|
const relatedItem0 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const MaterialIssue0 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialIssue0?.setItem)
|
|
{
|
|
await
|
|
MaterialIssue0.
|
|
setItem(relatedItem0);
|
|
}
|
|
|
|
const relatedItem1 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const MaterialIssue1 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialIssue1?.setItem)
|
|
{
|
|
await
|
|
MaterialIssue1.
|
|
setItem(relatedItem1);
|
|
}
|
|
|
|
const relatedItem2 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const MaterialIssue2 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialIssue2?.setItem)
|
|
{
|
|
await
|
|
MaterialIssue2.
|
|
setItem(relatedItem2);
|
|
}
|
|
|
|
const relatedItem3 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const MaterialIssue3 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialIssue3?.setItem)
|
|
{
|
|
await
|
|
MaterialIssue3.
|
|
setItem(relatedItem3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMaterialIssueWithLot() {
|
|
|
|
const relatedLot0 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const MaterialIssue0 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialIssue0?.setLot)
|
|
{
|
|
await
|
|
MaterialIssue0.
|
|
setLot(relatedLot0);
|
|
}
|
|
|
|
const relatedLot1 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const MaterialIssue1 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialIssue1?.setLot)
|
|
{
|
|
await
|
|
MaterialIssue1.
|
|
setLot(relatedLot1);
|
|
}
|
|
|
|
const relatedLot2 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const MaterialIssue2 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialIssue2?.setLot)
|
|
{
|
|
await
|
|
MaterialIssue2.
|
|
setLot(relatedLot2);
|
|
}
|
|
|
|
const relatedLot3 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const MaterialIssue3 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialIssue3?.setLot)
|
|
{
|
|
await
|
|
MaterialIssue3.
|
|
setLot(relatedLot3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMaterialIssueWithFrom_location() {
|
|
|
|
const relatedFrom_location0 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const MaterialIssue0 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialIssue0?.setFrom_location)
|
|
{
|
|
await
|
|
MaterialIssue0.
|
|
setFrom_location(relatedFrom_location0);
|
|
}
|
|
|
|
const relatedFrom_location1 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const MaterialIssue1 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialIssue1?.setFrom_location)
|
|
{
|
|
await
|
|
MaterialIssue1.
|
|
setFrom_location(relatedFrom_location1);
|
|
}
|
|
|
|
const relatedFrom_location2 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const MaterialIssue2 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialIssue2?.setFrom_location)
|
|
{
|
|
await
|
|
MaterialIssue2.
|
|
setFrom_location(relatedFrom_location2);
|
|
}
|
|
|
|
const relatedFrom_location3 = await Locations.findOne({
|
|
offset: Math.floor(Math.random() * (await Locations.count())),
|
|
});
|
|
const MaterialIssue3 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialIssue3?.setFrom_location)
|
|
{
|
|
await
|
|
MaterialIssue3.
|
|
setFrom_location(relatedFrom_location3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaterialIssueWithIssued_by_user() {
|
|
|
|
const relatedIssued_by_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaterialIssue0 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialIssue0?.setIssued_by_user)
|
|
{
|
|
await
|
|
MaterialIssue0.
|
|
setIssued_by_user(relatedIssued_by_user0);
|
|
}
|
|
|
|
const relatedIssued_by_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaterialIssue1 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialIssue1?.setIssued_by_user)
|
|
{
|
|
await
|
|
MaterialIssue1.
|
|
setIssued_by_user(relatedIssued_by_user1);
|
|
}
|
|
|
|
const relatedIssued_by_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaterialIssue2 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialIssue2?.setIssued_by_user)
|
|
{
|
|
await
|
|
MaterialIssue2.
|
|
setIssued_by_user(relatedIssued_by_user2);
|
|
}
|
|
|
|
const relatedIssued_by_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const MaterialIssue3 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialIssue3?.setIssued_by_user)
|
|
{
|
|
await
|
|
MaterialIssue3.
|
|
setIssued_by_user(relatedIssued_by_user3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaterialIssueWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialIssue0 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialIssue0?.setOrganization)
|
|
{
|
|
await
|
|
MaterialIssue0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialIssue1 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialIssue1?.setOrganization)
|
|
{
|
|
await
|
|
MaterialIssue1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialIssue2 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialIssue2?.setOrganization)
|
|
{
|
|
await
|
|
MaterialIssue2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialIssue3 = await MaterialIssues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialIssue3?.setOrganization)
|
|
{
|
|
await
|
|
MaterialIssue3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductionLotWithWork_order() {
|
|
|
|
const relatedWork_order0 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const ProductionLot0 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionLot0?.setWork_order)
|
|
{
|
|
await
|
|
ProductionLot0.
|
|
setWork_order(relatedWork_order0);
|
|
}
|
|
|
|
const relatedWork_order1 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const ProductionLot1 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionLot1?.setWork_order)
|
|
{
|
|
await
|
|
ProductionLot1.
|
|
setWork_order(relatedWork_order1);
|
|
}
|
|
|
|
const relatedWork_order2 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const ProductionLot2 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionLot2?.setWork_order)
|
|
{
|
|
await
|
|
ProductionLot2.
|
|
setWork_order(relatedWork_order2);
|
|
}
|
|
|
|
const relatedWork_order3 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const ProductionLot3 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionLot3?.setWork_order)
|
|
{
|
|
await
|
|
ProductionLot3.
|
|
setWork_order(relatedWork_order3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateProductionLotWithLot() {
|
|
|
|
const relatedLot0 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const ProductionLot0 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionLot0?.setLot)
|
|
{
|
|
await
|
|
ProductionLot0.
|
|
setLot(relatedLot0);
|
|
}
|
|
|
|
const relatedLot1 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const ProductionLot1 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionLot1?.setLot)
|
|
{
|
|
await
|
|
ProductionLot1.
|
|
setLot(relatedLot1);
|
|
}
|
|
|
|
const relatedLot2 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const ProductionLot2 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionLot2?.setLot)
|
|
{
|
|
await
|
|
ProductionLot2.
|
|
setLot(relatedLot2);
|
|
}
|
|
|
|
const relatedLot3 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const ProductionLot3 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionLot3?.setLot)
|
|
{
|
|
await
|
|
ProductionLot3.
|
|
setLot(relatedLot3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductionLotWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const ProductionLot0 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductionLot0?.setOrganization)
|
|
{
|
|
await
|
|
ProductionLot0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const ProductionLot1 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductionLot1?.setOrganization)
|
|
{
|
|
await
|
|
ProductionLot1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const ProductionLot2 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductionLot2?.setOrganization)
|
|
{
|
|
await
|
|
ProductionLot2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const ProductionLot3 = await ProductionLots.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductionLot3?.setOrganization)
|
|
{
|
|
await
|
|
ProductionLot3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQaInspectionPlanWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const QaInspectionPlan0 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaInspectionPlan0?.setCompany)
|
|
{
|
|
await
|
|
QaInspectionPlan0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const QaInspectionPlan1 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaInspectionPlan1?.setCompany)
|
|
{
|
|
await
|
|
QaInspectionPlan1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const QaInspectionPlan2 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaInspectionPlan2?.setCompany)
|
|
{
|
|
await
|
|
QaInspectionPlan2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const QaInspectionPlan3 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaInspectionPlan3?.setCompany)
|
|
{
|
|
await
|
|
QaInspectionPlan3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQaInspectionPlanWithItem() {
|
|
|
|
const relatedItem0 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const QaInspectionPlan0 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaInspectionPlan0?.setItem)
|
|
{
|
|
await
|
|
QaInspectionPlan0.
|
|
setItem(relatedItem0);
|
|
}
|
|
|
|
const relatedItem1 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const QaInspectionPlan1 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaInspectionPlan1?.setItem)
|
|
{
|
|
await
|
|
QaInspectionPlan1.
|
|
setItem(relatedItem1);
|
|
}
|
|
|
|
const relatedItem2 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const QaInspectionPlan2 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaInspectionPlan2?.setItem)
|
|
{
|
|
await
|
|
QaInspectionPlan2.
|
|
setItem(relatedItem2);
|
|
}
|
|
|
|
const relatedItem3 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const QaInspectionPlan3 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaInspectionPlan3?.setItem)
|
|
{
|
|
await
|
|
QaInspectionPlan3.
|
|
setItem(relatedItem3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQaInspectionPlanWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaInspectionPlan0 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaInspectionPlan0?.setOrganization)
|
|
{
|
|
await
|
|
QaInspectionPlan0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaInspectionPlan1 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaInspectionPlan1?.setOrganization)
|
|
{
|
|
await
|
|
QaInspectionPlan1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaInspectionPlan2 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaInspectionPlan2?.setOrganization)
|
|
{
|
|
await
|
|
QaInspectionPlan2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaInspectionPlan3 = await QaInspectionPlans.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaInspectionPlan3?.setOrganization)
|
|
{
|
|
await
|
|
QaInspectionPlan3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQaCharacteristicWithInspection_plan() {
|
|
|
|
const relatedInspection_plan0 = await QaInspectionPlans.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
|
|
});
|
|
const QaCharacteristic0 = await QaCharacteristics.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaCharacteristic0?.setInspection_plan)
|
|
{
|
|
await
|
|
QaCharacteristic0.
|
|
setInspection_plan(relatedInspection_plan0);
|
|
}
|
|
|
|
const relatedInspection_plan1 = await QaInspectionPlans.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
|
|
});
|
|
const QaCharacteristic1 = await QaCharacteristics.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaCharacteristic1?.setInspection_plan)
|
|
{
|
|
await
|
|
QaCharacteristic1.
|
|
setInspection_plan(relatedInspection_plan1);
|
|
}
|
|
|
|
const relatedInspection_plan2 = await QaInspectionPlans.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
|
|
});
|
|
const QaCharacteristic2 = await QaCharacteristics.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaCharacteristic2?.setInspection_plan)
|
|
{
|
|
await
|
|
QaCharacteristic2.
|
|
setInspection_plan(relatedInspection_plan2);
|
|
}
|
|
|
|
const relatedInspection_plan3 = await QaInspectionPlans.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
|
|
});
|
|
const QaCharacteristic3 = await QaCharacteristics.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaCharacteristic3?.setInspection_plan)
|
|
{
|
|
await
|
|
QaCharacteristic3.
|
|
setInspection_plan(relatedInspection_plan3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQaCharacteristicWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaCharacteristic0 = await QaCharacteristics.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaCharacteristic0?.setOrganization)
|
|
{
|
|
await
|
|
QaCharacteristic0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaCharacteristic1 = await QaCharacteristics.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaCharacteristic1?.setOrganization)
|
|
{
|
|
await
|
|
QaCharacteristic1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaCharacteristic2 = await QaCharacteristics.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaCharacteristic2?.setOrganization)
|
|
{
|
|
await
|
|
QaCharacteristic2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaCharacteristic3 = await QaCharacteristics.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaCharacteristic3?.setOrganization)
|
|
{
|
|
await
|
|
QaCharacteristic3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQaInspectionWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const QaInspection0 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaInspection0?.setPlant)
|
|
{
|
|
await
|
|
QaInspection0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const QaInspection1 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaInspection1?.setPlant)
|
|
{
|
|
await
|
|
QaInspection1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const QaInspection2 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaInspection2?.setPlant)
|
|
{
|
|
await
|
|
QaInspection2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const QaInspection3 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaInspection3?.setPlant)
|
|
{
|
|
await
|
|
QaInspection3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQaInspectionWithInspection_plan() {
|
|
|
|
const relatedInspection_plan0 = await QaInspectionPlans.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
|
|
});
|
|
const QaInspection0 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaInspection0?.setInspection_plan)
|
|
{
|
|
await
|
|
QaInspection0.
|
|
setInspection_plan(relatedInspection_plan0);
|
|
}
|
|
|
|
const relatedInspection_plan1 = await QaInspectionPlans.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
|
|
});
|
|
const QaInspection1 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaInspection1?.setInspection_plan)
|
|
{
|
|
await
|
|
QaInspection1.
|
|
setInspection_plan(relatedInspection_plan1);
|
|
}
|
|
|
|
const relatedInspection_plan2 = await QaInspectionPlans.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
|
|
});
|
|
const QaInspection2 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaInspection2?.setInspection_plan)
|
|
{
|
|
await
|
|
QaInspection2.
|
|
setInspection_plan(relatedInspection_plan2);
|
|
}
|
|
|
|
const relatedInspection_plan3 = await QaInspectionPlans.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspectionPlans.count())),
|
|
});
|
|
const QaInspection3 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaInspection3?.setInspection_plan)
|
|
{
|
|
await
|
|
QaInspection3.
|
|
setInspection_plan(relatedInspection_plan3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateQaInspectionWithItem() {
|
|
|
|
const relatedItem0 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const QaInspection0 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaInspection0?.setItem)
|
|
{
|
|
await
|
|
QaInspection0.
|
|
setItem(relatedItem0);
|
|
}
|
|
|
|
const relatedItem1 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const QaInspection1 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaInspection1?.setItem)
|
|
{
|
|
await
|
|
QaInspection1.
|
|
setItem(relatedItem1);
|
|
}
|
|
|
|
const relatedItem2 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const QaInspection2 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaInspection2?.setItem)
|
|
{
|
|
await
|
|
QaInspection2.
|
|
setItem(relatedItem2);
|
|
}
|
|
|
|
const relatedItem3 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const QaInspection3 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaInspection3?.setItem)
|
|
{
|
|
await
|
|
QaInspection3.
|
|
setItem(relatedItem3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateQaInspectionWithLot() {
|
|
|
|
const relatedLot0 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const QaInspection0 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaInspection0?.setLot)
|
|
{
|
|
await
|
|
QaInspection0.
|
|
setLot(relatedLot0);
|
|
}
|
|
|
|
const relatedLot1 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const QaInspection1 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaInspection1?.setLot)
|
|
{
|
|
await
|
|
QaInspection1.
|
|
setLot(relatedLot1);
|
|
}
|
|
|
|
const relatedLot2 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const QaInspection2 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaInspection2?.setLot)
|
|
{
|
|
await
|
|
QaInspection2.
|
|
setLot(relatedLot2);
|
|
}
|
|
|
|
const relatedLot3 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const QaInspection3 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaInspection3?.setLot)
|
|
{
|
|
await
|
|
QaInspection3.
|
|
setLot(relatedLot3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateQaInspectionWithWork_order() {
|
|
|
|
const relatedWork_order0 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const QaInspection0 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaInspection0?.setWork_order)
|
|
{
|
|
await
|
|
QaInspection0.
|
|
setWork_order(relatedWork_order0);
|
|
}
|
|
|
|
const relatedWork_order1 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const QaInspection1 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaInspection1?.setWork_order)
|
|
{
|
|
await
|
|
QaInspection1.
|
|
setWork_order(relatedWork_order1);
|
|
}
|
|
|
|
const relatedWork_order2 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const QaInspection2 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaInspection2?.setWork_order)
|
|
{
|
|
await
|
|
QaInspection2.
|
|
setWork_order(relatedWork_order2);
|
|
}
|
|
|
|
const relatedWork_order3 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const QaInspection3 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaInspection3?.setWork_order)
|
|
{
|
|
await
|
|
QaInspection3.
|
|
setWork_order(relatedWork_order3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQaInspectionWithInspector_user() {
|
|
|
|
const relatedInspector_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const QaInspection0 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaInspection0?.setInspector_user)
|
|
{
|
|
await
|
|
QaInspection0.
|
|
setInspector_user(relatedInspector_user0);
|
|
}
|
|
|
|
const relatedInspector_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const QaInspection1 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaInspection1?.setInspector_user)
|
|
{
|
|
await
|
|
QaInspection1.
|
|
setInspector_user(relatedInspector_user1);
|
|
}
|
|
|
|
const relatedInspector_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const QaInspection2 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaInspection2?.setInspector_user)
|
|
{
|
|
await
|
|
QaInspection2.
|
|
setInspector_user(relatedInspector_user2);
|
|
}
|
|
|
|
const relatedInspector_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const QaInspection3 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaInspection3?.setInspector_user)
|
|
{
|
|
await
|
|
QaInspection3.
|
|
setInspector_user(relatedInspector_user3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQaInspectionWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaInspection0 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaInspection0?.setOrganization)
|
|
{
|
|
await
|
|
QaInspection0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaInspection1 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaInspection1?.setOrganization)
|
|
{
|
|
await
|
|
QaInspection1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaInspection2 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaInspection2?.setOrganization)
|
|
{
|
|
await
|
|
QaInspection2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaInspection3 = await QaInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaInspection3?.setOrganization)
|
|
{
|
|
await
|
|
QaInspection3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQaResultWithInspection() {
|
|
|
|
const relatedInspection0 = await QaInspections.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspections.count())),
|
|
});
|
|
const QaResult0 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaResult0?.setInspection)
|
|
{
|
|
await
|
|
QaResult0.
|
|
setInspection(relatedInspection0);
|
|
}
|
|
|
|
const relatedInspection1 = await QaInspections.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspections.count())),
|
|
});
|
|
const QaResult1 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaResult1?.setInspection)
|
|
{
|
|
await
|
|
QaResult1.
|
|
setInspection(relatedInspection1);
|
|
}
|
|
|
|
const relatedInspection2 = await QaInspections.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspections.count())),
|
|
});
|
|
const QaResult2 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaResult2?.setInspection)
|
|
{
|
|
await
|
|
QaResult2.
|
|
setInspection(relatedInspection2);
|
|
}
|
|
|
|
const relatedInspection3 = await QaInspections.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspections.count())),
|
|
});
|
|
const QaResult3 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaResult3?.setInspection)
|
|
{
|
|
await
|
|
QaResult3.
|
|
setInspection(relatedInspection3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateQaResultWithCharacteristic() {
|
|
|
|
const relatedCharacteristic0 = await QaCharacteristics.findOne({
|
|
offset: Math.floor(Math.random() * (await QaCharacteristics.count())),
|
|
});
|
|
const QaResult0 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaResult0?.setCharacteristic)
|
|
{
|
|
await
|
|
QaResult0.
|
|
setCharacteristic(relatedCharacteristic0);
|
|
}
|
|
|
|
const relatedCharacteristic1 = await QaCharacteristics.findOne({
|
|
offset: Math.floor(Math.random() * (await QaCharacteristics.count())),
|
|
});
|
|
const QaResult1 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaResult1?.setCharacteristic)
|
|
{
|
|
await
|
|
QaResult1.
|
|
setCharacteristic(relatedCharacteristic1);
|
|
}
|
|
|
|
const relatedCharacteristic2 = await QaCharacteristics.findOne({
|
|
offset: Math.floor(Math.random() * (await QaCharacteristics.count())),
|
|
});
|
|
const QaResult2 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaResult2?.setCharacteristic)
|
|
{
|
|
await
|
|
QaResult2.
|
|
setCharacteristic(relatedCharacteristic2);
|
|
}
|
|
|
|
const relatedCharacteristic3 = await QaCharacteristics.findOne({
|
|
offset: Math.floor(Math.random() * (await QaCharacteristics.count())),
|
|
});
|
|
const QaResult3 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaResult3?.setCharacteristic)
|
|
{
|
|
await
|
|
QaResult3.
|
|
setCharacteristic(relatedCharacteristic3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQaResultWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaResult0 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QaResult0?.setOrganization)
|
|
{
|
|
await
|
|
QaResult0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaResult1 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QaResult1?.setOrganization)
|
|
{
|
|
await
|
|
QaResult1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaResult2 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QaResult2?.setOrganization)
|
|
{
|
|
await
|
|
QaResult2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QaResult3 = await QaResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QaResult3?.setOrganization)
|
|
{
|
|
await
|
|
QaResult3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateNonconformanceWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Nonconformance0 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Nonconformance0?.setPlant)
|
|
{
|
|
await
|
|
Nonconformance0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Nonconformance1 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Nonconformance1?.setPlant)
|
|
{
|
|
await
|
|
Nonconformance1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Nonconformance2 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Nonconformance2?.setPlant)
|
|
{
|
|
await
|
|
Nonconformance2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Nonconformance3 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Nonconformance3?.setPlant)
|
|
{
|
|
await
|
|
Nonconformance3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateNonconformanceWithInspection() {
|
|
|
|
const relatedInspection0 = await QaInspections.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspections.count())),
|
|
});
|
|
const Nonconformance0 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Nonconformance0?.setInspection)
|
|
{
|
|
await
|
|
Nonconformance0.
|
|
setInspection(relatedInspection0);
|
|
}
|
|
|
|
const relatedInspection1 = await QaInspections.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspections.count())),
|
|
});
|
|
const Nonconformance1 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Nonconformance1?.setInspection)
|
|
{
|
|
await
|
|
Nonconformance1.
|
|
setInspection(relatedInspection1);
|
|
}
|
|
|
|
const relatedInspection2 = await QaInspections.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspections.count())),
|
|
});
|
|
const Nonconformance2 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Nonconformance2?.setInspection)
|
|
{
|
|
await
|
|
Nonconformance2.
|
|
setInspection(relatedInspection2);
|
|
}
|
|
|
|
const relatedInspection3 = await QaInspections.findOne({
|
|
offset: Math.floor(Math.random() * (await QaInspections.count())),
|
|
});
|
|
const Nonconformance3 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Nonconformance3?.setInspection)
|
|
{
|
|
await
|
|
Nonconformance3.
|
|
setInspection(relatedInspection3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateNonconformanceWithWork_order() {
|
|
|
|
const relatedWork_order0 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const Nonconformance0 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Nonconformance0?.setWork_order)
|
|
{
|
|
await
|
|
Nonconformance0.
|
|
setWork_order(relatedWork_order0);
|
|
}
|
|
|
|
const relatedWork_order1 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const Nonconformance1 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Nonconformance1?.setWork_order)
|
|
{
|
|
await
|
|
Nonconformance1.
|
|
setWork_order(relatedWork_order1);
|
|
}
|
|
|
|
const relatedWork_order2 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const Nonconformance2 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Nonconformance2?.setWork_order)
|
|
{
|
|
await
|
|
Nonconformance2.
|
|
setWork_order(relatedWork_order2);
|
|
}
|
|
|
|
const relatedWork_order3 = await WorkOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await WorkOrders.count())),
|
|
});
|
|
const Nonconformance3 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Nonconformance3?.setWork_order)
|
|
{
|
|
await
|
|
Nonconformance3.
|
|
setWork_order(relatedWork_order3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateNonconformanceWithItem() {
|
|
|
|
const relatedItem0 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Nonconformance0 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Nonconformance0?.setItem)
|
|
{
|
|
await
|
|
Nonconformance0.
|
|
setItem(relatedItem0);
|
|
}
|
|
|
|
const relatedItem1 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Nonconformance1 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Nonconformance1?.setItem)
|
|
{
|
|
await
|
|
Nonconformance1.
|
|
setItem(relatedItem1);
|
|
}
|
|
|
|
const relatedItem2 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Nonconformance2 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Nonconformance2?.setItem)
|
|
{
|
|
await
|
|
Nonconformance2.
|
|
setItem(relatedItem2);
|
|
}
|
|
|
|
const relatedItem3 = await Items.findOne({
|
|
offset: Math.floor(Math.random() * (await Items.count())),
|
|
});
|
|
const Nonconformance3 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Nonconformance3?.setItem)
|
|
{
|
|
await
|
|
Nonconformance3.
|
|
setItem(relatedItem3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateNonconformanceWithLot() {
|
|
|
|
const relatedLot0 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const Nonconformance0 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Nonconformance0?.setLot)
|
|
{
|
|
await
|
|
Nonconformance0.
|
|
setLot(relatedLot0);
|
|
}
|
|
|
|
const relatedLot1 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const Nonconformance1 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Nonconformance1?.setLot)
|
|
{
|
|
await
|
|
Nonconformance1.
|
|
setLot(relatedLot1);
|
|
}
|
|
|
|
const relatedLot2 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const Nonconformance2 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Nonconformance2?.setLot)
|
|
{
|
|
await
|
|
Nonconformance2.
|
|
setLot(relatedLot2);
|
|
}
|
|
|
|
const relatedLot3 = await Lots.findOne({
|
|
offset: Math.floor(Math.random() * (await Lots.count())),
|
|
});
|
|
const Nonconformance3 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Nonconformance3?.setLot)
|
|
{
|
|
await
|
|
Nonconformance3.
|
|
setLot(relatedLot3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateNonconformanceWithReported_by_user() {
|
|
|
|
const relatedReported_by_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Nonconformance0 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Nonconformance0?.setReported_by_user)
|
|
{
|
|
await
|
|
Nonconformance0.
|
|
setReported_by_user(relatedReported_by_user0);
|
|
}
|
|
|
|
const relatedReported_by_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Nonconformance1 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Nonconformance1?.setReported_by_user)
|
|
{
|
|
await
|
|
Nonconformance1.
|
|
setReported_by_user(relatedReported_by_user1);
|
|
}
|
|
|
|
const relatedReported_by_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Nonconformance2 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Nonconformance2?.setReported_by_user)
|
|
{
|
|
await
|
|
Nonconformance2.
|
|
setReported_by_user(relatedReported_by_user2);
|
|
}
|
|
|
|
const relatedReported_by_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Nonconformance3 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Nonconformance3?.setReported_by_user)
|
|
{
|
|
await
|
|
Nonconformance3.
|
|
setReported_by_user(relatedReported_by_user3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateNonconformanceWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Nonconformance0 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Nonconformance0?.setOrganization)
|
|
{
|
|
await
|
|
Nonconformance0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Nonconformance1 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Nonconformance1?.setOrganization)
|
|
{
|
|
await
|
|
Nonconformance1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Nonconformance2 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Nonconformance2?.setOrganization)
|
|
{
|
|
await
|
|
Nonconformance2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Nonconformance3 = await Nonconformances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Nonconformance3?.setOrganization)
|
|
{
|
|
await
|
|
Nonconformance3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCapaWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Capa0 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Capa0?.setPlant)
|
|
{
|
|
await
|
|
Capa0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Capa1 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Capa1?.setPlant)
|
|
{
|
|
await
|
|
Capa1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Capa2 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Capa2?.setPlant)
|
|
{
|
|
await
|
|
Capa2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const Capa3 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Capa3?.setPlant)
|
|
{
|
|
await
|
|
Capa3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCapaWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Capa0 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Capa0?.setOrganization)
|
|
{
|
|
await
|
|
Capa0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Capa1 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Capa1?.setOrganization)
|
|
{
|
|
await
|
|
Capa1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Capa2 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Capa2?.setOrganization)
|
|
{
|
|
await
|
|
Capa2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Capa3 = await Capas.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Capa3?.setOrganization)
|
|
{
|
|
await
|
|
Capa3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateDocumentWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Document0 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Document0?.setCompany)
|
|
{
|
|
await
|
|
Document0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Document1 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Document1?.setCompany)
|
|
{
|
|
await
|
|
Document1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Document2 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Document2?.setCompany)
|
|
{
|
|
await
|
|
Document2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Document3 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Document3?.setCompany)
|
|
{
|
|
await
|
|
Document3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateDocumentWithOwner_user() {
|
|
|
|
const relatedOwner_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Document0 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Document0?.setOwner_user)
|
|
{
|
|
await
|
|
Document0.
|
|
setOwner_user(relatedOwner_user0);
|
|
}
|
|
|
|
const relatedOwner_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Document1 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Document1?.setOwner_user)
|
|
{
|
|
await
|
|
Document1.
|
|
setOwner_user(relatedOwner_user1);
|
|
}
|
|
|
|
const relatedOwner_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Document2 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Document2?.setOwner_user)
|
|
{
|
|
await
|
|
Document2.
|
|
setOwner_user(relatedOwner_user2);
|
|
}
|
|
|
|
const relatedOwner_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Document3 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Document3?.setOwner_user)
|
|
{
|
|
await
|
|
Document3.
|
|
setOwner_user(relatedOwner_user3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateDocumentWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Document0 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Document0?.setOrganization)
|
|
{
|
|
await
|
|
Document0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Document1 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Document1?.setOrganization)
|
|
{
|
|
await
|
|
Document1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Document2 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Document2?.setOrganization)
|
|
{
|
|
await
|
|
Document2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Document3 = await Documents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Document3?.setOrganization)
|
|
{
|
|
await
|
|
Document3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAuditEventWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const AuditEvent0 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AuditEvent0?.setCompany)
|
|
{
|
|
await
|
|
AuditEvent0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const AuditEvent1 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AuditEvent1?.setCompany)
|
|
{
|
|
await
|
|
AuditEvent1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const AuditEvent2 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AuditEvent2?.setCompany)
|
|
{
|
|
await
|
|
AuditEvent2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const AuditEvent3 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AuditEvent3?.setCompany)
|
|
{
|
|
await
|
|
AuditEvent3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateAuditEventWithPlant() {
|
|
|
|
const relatedPlant0 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const AuditEvent0 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AuditEvent0?.setPlant)
|
|
{
|
|
await
|
|
AuditEvent0.
|
|
setPlant(relatedPlant0);
|
|
}
|
|
|
|
const relatedPlant1 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const AuditEvent1 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AuditEvent1?.setPlant)
|
|
{
|
|
await
|
|
AuditEvent1.
|
|
setPlant(relatedPlant1);
|
|
}
|
|
|
|
const relatedPlant2 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const AuditEvent2 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AuditEvent2?.setPlant)
|
|
{
|
|
await
|
|
AuditEvent2.
|
|
setPlant(relatedPlant2);
|
|
}
|
|
|
|
const relatedPlant3 = await Plants.findOne({
|
|
offset: Math.floor(Math.random() * (await Plants.count())),
|
|
});
|
|
const AuditEvent3 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AuditEvent3?.setPlant)
|
|
{
|
|
await
|
|
AuditEvent3.
|
|
setPlant(relatedPlant3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateAuditEventWithActor_user() {
|
|
|
|
const relatedActor_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AuditEvent0 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AuditEvent0?.setActor_user)
|
|
{
|
|
await
|
|
AuditEvent0.
|
|
setActor_user(relatedActor_user0);
|
|
}
|
|
|
|
const relatedActor_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AuditEvent1 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AuditEvent1?.setActor_user)
|
|
{
|
|
await
|
|
AuditEvent1.
|
|
setActor_user(relatedActor_user1);
|
|
}
|
|
|
|
const relatedActor_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AuditEvent2 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AuditEvent2?.setActor_user)
|
|
{
|
|
await
|
|
AuditEvent2.
|
|
setActor_user(relatedActor_user2);
|
|
}
|
|
|
|
const relatedActor_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AuditEvent3 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AuditEvent3?.setActor_user)
|
|
{
|
|
await
|
|
AuditEvent3.
|
|
setActor_user(relatedActor_user3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAuditEventWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const AuditEvent0 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AuditEvent0?.setOrganization)
|
|
{
|
|
await
|
|
AuditEvent0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const AuditEvent1 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AuditEvent1?.setOrganization)
|
|
{
|
|
await
|
|
AuditEvent1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const AuditEvent2 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AuditEvent2?.setOrganization)
|
|
{
|
|
await
|
|
AuditEvent2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const AuditEvent3 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AuditEvent3?.setOrganization)
|
|
{
|
|
await
|
|
AuditEvent3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Organizations.bulkCreate(OrganizationsData);
|
|
|
|
|
|
|
|
|
|
await Companies.bulkCreate(CompaniesData);
|
|
|
|
|
|
|
|
|
|
await Plants.bulkCreate(PlantsData);
|
|
|
|
|
|
|
|
|
|
await Suppliers.bulkCreate(SuppliersData);
|
|
|
|
|
|
|
|
|
|
await Customers.bulkCreate(CustomersData);
|
|
|
|
|
|
|
|
|
|
await Items.bulkCreate(ItemsData);
|
|
|
|
|
|
|
|
|
|
await Boms.bulkCreate(BomsData);
|
|
|
|
|
|
|
|
|
|
await BomLines.bulkCreate(BomLinesData);
|
|
|
|
|
|
|
|
|
|
await Warehouses.bulkCreate(WarehousesData);
|
|
|
|
|
|
|
|
|
|
await Locations.bulkCreate(LocationsData);
|
|
|
|
|
|
|
|
|
|
await Lots.bulkCreate(LotsData);
|
|
|
|
|
|
|
|
|
|
await InventoryBalances.bulkCreate(InventoryBalancesData);
|
|
|
|
|
|
|
|
|
|
await InventoryTransactions.bulkCreate(InventoryTransactionsData);
|
|
|
|
|
|
|
|
|
|
await Machines.bulkCreate(MachinesData);
|
|
|
|
|
|
|
|
|
|
await MachineDowntimeEvents.bulkCreate(MachineDowntimeEventsData);
|
|
|
|
|
|
|
|
|
|
await WorkOrders.bulkCreate(WorkOrdersData);
|
|
|
|
|
|
|
|
|
|
await ProductionOperations.bulkCreate(ProductionOperationsData);
|
|
|
|
|
|
|
|
|
|
await MaterialIssues.bulkCreate(MaterialIssuesData);
|
|
|
|
|
|
|
|
|
|
await ProductionLots.bulkCreate(ProductionLotsData);
|
|
|
|
|
|
|
|
|
|
await QaInspectionPlans.bulkCreate(QaInspectionPlansData);
|
|
|
|
|
|
|
|
|
|
await QaCharacteristics.bulkCreate(QaCharacteristicsData);
|
|
|
|
|
|
|
|
|
|
await QaInspections.bulkCreate(QaInspectionsData);
|
|
|
|
|
|
|
|
|
|
await QaResults.bulkCreate(QaResultsData);
|
|
|
|
|
|
|
|
|
|
await Nonconformances.bulkCreate(NonconformancesData);
|
|
|
|
|
|
|
|
|
|
await Capas.bulkCreate(CapasData);
|
|
|
|
|
|
|
|
|
|
await Documents.bulkCreate(DocumentsData);
|
|
|
|
|
|
|
|
|
|
await AuditEvents.bulkCreate(AuditEventsData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
await associateUserWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCompanyWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePlantWithCompany(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePlantWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSupplierWithCompany(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSupplierWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCustomerWithCompany(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCustomerWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateItemWithCompany(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateItemWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateBomWithCompany(),
|
|
|
|
|
|
|
|
|
|
await associateBomWithParent_item(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateBomWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateBomLineWithBom(),
|
|
|
|
|
|
|
|
|
|
await associateBomLineWithComponent_item(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateBomLineWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWarehousWithPlant(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWarehousWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLocationWithWarehouse(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLocationWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLotWithCompany(),
|
|
|
|
|
|
|
|
|
|
await associateLotWithItem(),
|
|
|
|
|
|
|
|
|
|
await associateLotWithSupplier(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLotWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateInventoryBalanceWithPlant(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryBalanceWithLocation(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryBalanceWithItem(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryBalanceWithLot(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateInventoryBalanceWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithPlant(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithItem(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithLot(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithFrom_location(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithTo_location(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithPerformed_by_user(),
|
|
|
|
|
|
|
|
|
|
await associateInventoryTransactionWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMachineWithPlant(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMachineWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMachineDowntimeEventWithMachine(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMachineDowntimeEventWithReported_by_user(),
|
|
|
|
|
|
|
|
|
|
await associateMachineDowntimeEventWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWorkOrderWithPlant(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWorkOrderWithItem(),
|
|
|
|
|
|
|
|
|
|
await associateWorkOrderWithBom(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWorkOrderWithCustomer(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWorkOrderWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductionOperationWithWork_order(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductionOperationWithMachine(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductionOperationWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaterialIssueWithWork_order(),
|
|
|
|
|
|
|
|
|
|
await associateMaterialIssueWithItem(),
|
|
|
|
|
|
|
|
|
|
await associateMaterialIssueWithLot(),
|
|
|
|
|
|
|
|
|
|
await associateMaterialIssueWithFrom_location(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaterialIssueWithIssued_by_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaterialIssueWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductionLotWithWork_order(),
|
|
|
|
|
|
|
|
|
|
await associateProductionLotWithLot(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductionLotWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQaInspectionPlanWithCompany(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQaInspectionPlanWithItem(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQaInspectionPlanWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQaCharacteristicWithInspection_plan(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQaCharacteristicWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQaInspectionWithPlant(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQaInspectionWithInspection_plan(),
|
|
|
|
|
|
|
|
|
|
await associateQaInspectionWithItem(),
|
|
|
|
|
|
|
|
|
|
await associateQaInspectionWithLot(),
|
|
|
|
|
|
|
|
|
|
await associateQaInspectionWithWork_order(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQaInspectionWithInspector_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQaInspectionWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQaResultWithInspection(),
|
|
|
|
|
|
|
|
|
|
await associateQaResultWithCharacteristic(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQaResultWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithPlant(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithInspection(),
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithWork_order(),
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithItem(),
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithLot(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithReported_by_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateNonconformanceWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCapaWithPlant(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCapaWithNonconformance(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCapaWithOwner_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCapaWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateDocumentWithCompany(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateDocumentWithOwner_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateDocumentWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAuditEventWithCompany(),
|
|
|
|
|
|
|
|
|
|
await associateAuditEventWithPlant(),
|
|
|
|
|
|
|
|
|
|
await associateAuditEventWithActor_user(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAuditEventWithOrganization(),
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('organizations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('companies', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('plants', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('suppliers', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('customers', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('items', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('boms', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('bom_lines', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('warehouses', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('locations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('lots', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('inventory_balances', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('inventory_transactions', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('machines', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('machine_downtime_events', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('work_orders', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('production_operations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('material_issues', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('production_lots', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('qa_inspection_plans', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('qa_characteristics', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('qa_inspections', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('qa_results', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('nonconformances', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('capas', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('documents', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('audit_events', null, {});
|
|
|
|
|
|
},
|
|
}; |