2690 lines
49 KiB
JavaScript
2690 lines
49 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Panels = db.panels;
|
|
|
|
const TileResults = db.tile_results;
|
|
|
|
const PhysicalPieces = db.physical_pieces;
|
|
|
|
const ScrapPools = db.scrap_pools;
|
|
|
|
const OptimizationRuns = db.optimization_runs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const PanelsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Panel A - Project Alpha",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"width_mm": 2400.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"height_mm": 1200.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"piece_length_mm": 300.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"piece_height_mm": 300.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"joint_mm": 2.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"padding_mm": 10.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vinyl_height_mm": 15.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rotation_deg": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grid_visible": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"anchor_smart": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grid_size_cm": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Panel B - Bathroom Set",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"width_mm": 1800.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"height_mm": 900.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"piece_length_mm": 200.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"piece_height_mm": 200.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"joint_mm": 3.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"padding_mm": 8.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vinyl_height_mm": 10.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rotation_deg": 15.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grid_visible": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"anchor_smart": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grid_size_cm": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Panel C - Living Room",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"width_mm": 3000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"height_mm": 1200.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"piece_length_mm": 400.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"piece_height_mm": 300.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"joint_mm": 2.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"padding_mm": 12.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vinyl_height_mm": 20.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rotation_deg": 90.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grid_visible": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"anchor_smart": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grid_size_cm": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Panel D - Kitchen Backsplash",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"width_mm": 1500.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"height_mm": 600.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"piece_length_mm": 150.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"piece_height_mm": 150.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"joint_mm": 2.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"padding_mm": 6.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vinyl_height_mm": 8.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rotation_deg": 45.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grid_visible": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"anchor_smart": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grid_size_cm": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Panel E - Sample Board",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"width_mm": 1200.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"height_mm": 1200.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"piece_length_mm": 300.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"piece_height_mm": 300.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"joint_mm": 2.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"padding_mm": 5.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vinyl_height_mm": 12.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rotation_deg": 5.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grid_visible": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"anchor_smart": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"grid_size_cm": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TileResultsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"original_tile_index": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"points": "[[0,0],[300,0],[300,300],[0,300]]",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_full": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"area_mm2": 90000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label_x": 150.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label_y": 150.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"z_index": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"original_tile_index": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"points": "[[300,0],[600,0],[600,200],[300,200]]",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_full": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"area_mm2": 60000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label_x": 450.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label_y": 100.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"z_index": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"original_tile_index": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"points": "[[0,300],[400,300],[400,600],[0,600]]",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_full": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"area_mm2": 120000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label_x": 200.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label_y": 450.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"z_index": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"original_tile_index": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"points": "[[600,0],[750,0],[750,150],[600,150]]",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_full": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"area_mm2": 22500.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label_x": 675.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label_y": 75.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"z_index": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"original_tile_index": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"points": "[[0,0],[150,0],[150,150],[0,150]]",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_full": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"area_mm2": 22500.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label_x": 75.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label_y": 75.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"z_index": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PhysicalPiecesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "PP-1001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_area": 900000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"used_area": 200000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stock_quantity": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "allocated",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metadata": "{batch:B-2025-01,material:porcelain,thickness_mm:9}",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "PP-1002",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_area": 750000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"used_area": 500000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stock_quantity": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_stock",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metadata": "{batch:B-2024-11,material:ceramic,finish:matte}",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "PP-1003",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_area": 1200000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"used_area": 1100000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stock_quantity": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "scrap",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metadata": "{batch:B-2023-06,material:stoneware,notes:edge chipped}",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "PP-1004",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_area": 600000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"used_area": 100000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stock_quantity": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "depleted",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metadata": "{batch:B-2025-02,material:porcelain,color:ivory}",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "PP-1005",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_area": 500000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"used_area": 500000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stock_quantity": 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "scrap",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"metadata": "{batch:B-2022-12,material:ceramic,notes:used fully}",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ScrapPoolsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"label": "Scrap A - PP-1002",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_area": 250000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"available_area": 200000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"utilization_percent": 80.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"label": "Scrap B - PP-1003",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_area": 100000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"available_area": 50000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"utilization_percent": 50.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"label": "Scrap C - PP-1004",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_area": 50000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"available_area": 45000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"utilization_percent": 90.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"label": "Scrap D - PP-1001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_area": 70000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"available_area": 70000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"utilization_percent": 100.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"label": "Scrap E - Mixed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scrap_area": 30000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"available_area": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"utilization_percent": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const OptimizationRunsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Run 2026-01-10 Alpha",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_start": new Date('2026-01-10T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_end": new Date('2026-01-10T09:02:30Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"assigned_count": 8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"efficiency": 87.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"full_pieces_count": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cut_pieces_count": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Run 2026-01-12 Bathroom Test",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_start": new Date('2026-01-12T14:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_end": new Date('2026-01-12T14:21:10Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"assigned_count": 6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"efficiency": 82.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"full_pieces_count": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cut_pieces_count": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Run 2026-01-15 LivingRoom Large",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_start": new Date('2026-01-15T07:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_end": new Date('2026-01-15T07:33:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"assigned_count": 12,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"efficiency": 91.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"full_pieces_count": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cut_pieces_count": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Run 2026-01-18 Kitchen Quick",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_start": new Date('2026-01-18T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_end": new Date('2026-01-18T11:00:45Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"assigned_count": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"efficiency": 76.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"full_pieces_count": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cut_pieces_count": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Run 2026-01-20 Sample Board",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_start": new Date('2026-01-20T16:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"run_end": new Date('2026-01-20T16:46:20Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"assigned_count": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"efficiency": 85.4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"full_pieces_count": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cut_pieces_count": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePanelWithOwner() {
|
|
|
|
const relatedOwner0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Panel0 = await Panels.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Panel0?.setOwner)
|
|
{
|
|
await
|
|
Panel0.
|
|
setOwner(relatedOwner0);
|
|
}
|
|
|
|
const relatedOwner1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Panel1 = await Panels.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Panel1?.setOwner)
|
|
{
|
|
await
|
|
Panel1.
|
|
setOwner(relatedOwner1);
|
|
}
|
|
|
|
const relatedOwner2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Panel2 = await Panels.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Panel2?.setOwner)
|
|
{
|
|
await
|
|
Panel2.
|
|
setOwner(relatedOwner2);
|
|
}
|
|
|
|
const relatedOwner3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Panel3 = await Panels.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Panel3?.setOwner)
|
|
{
|
|
await
|
|
Panel3.
|
|
setOwner(relatedOwner3);
|
|
}
|
|
|
|
const relatedOwner4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Panel4 = await Panels.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Panel4?.setOwner)
|
|
{
|
|
await
|
|
Panel4.
|
|
setOwner(relatedOwner4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTileResultWithPanel() {
|
|
|
|
const relatedPanel0 = await Panels.findOne({
|
|
offset: Math.floor(Math.random() * (await Panels.count())),
|
|
});
|
|
const TileResult0 = await TileResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TileResult0?.setPanel)
|
|
{
|
|
await
|
|
TileResult0.
|
|
setPanel(relatedPanel0);
|
|
}
|
|
|
|
const relatedPanel1 = await Panels.findOne({
|
|
offset: Math.floor(Math.random() * (await Panels.count())),
|
|
});
|
|
const TileResult1 = await TileResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TileResult1?.setPanel)
|
|
{
|
|
await
|
|
TileResult1.
|
|
setPanel(relatedPanel1);
|
|
}
|
|
|
|
const relatedPanel2 = await Panels.findOne({
|
|
offset: Math.floor(Math.random() * (await Panels.count())),
|
|
});
|
|
const TileResult2 = await TileResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TileResult2?.setPanel)
|
|
{
|
|
await
|
|
TileResult2.
|
|
setPanel(relatedPanel2);
|
|
}
|
|
|
|
const relatedPanel3 = await Panels.findOne({
|
|
offset: Math.floor(Math.random() * (await Panels.count())),
|
|
});
|
|
const TileResult3 = await TileResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (TileResult3?.setPanel)
|
|
{
|
|
await
|
|
TileResult3.
|
|
setPanel(relatedPanel3);
|
|
}
|
|
|
|
const relatedPanel4 = await Panels.findOne({
|
|
offset: Math.floor(Math.random() * (await Panels.count())),
|
|
});
|
|
const TileResult4 = await TileResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (TileResult4?.setPanel)
|
|
{
|
|
await
|
|
TileResult4.
|
|
setPanel(relatedPanel4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateTileResultWithPhysical_piece() {
|
|
|
|
const relatedPhysical_piece0 = await PhysicalPieces.findOne({
|
|
offset: Math.floor(Math.random() * (await PhysicalPieces.count())),
|
|
});
|
|
const TileResult0 = await TileResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TileResult0?.setPhysical_piece)
|
|
{
|
|
await
|
|
TileResult0.
|
|
setPhysical_piece(relatedPhysical_piece0);
|
|
}
|
|
|
|
const relatedPhysical_piece1 = await PhysicalPieces.findOne({
|
|
offset: Math.floor(Math.random() * (await PhysicalPieces.count())),
|
|
});
|
|
const TileResult1 = await TileResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TileResult1?.setPhysical_piece)
|
|
{
|
|
await
|
|
TileResult1.
|
|
setPhysical_piece(relatedPhysical_piece1);
|
|
}
|
|
|
|
const relatedPhysical_piece2 = await PhysicalPieces.findOne({
|
|
offset: Math.floor(Math.random() * (await PhysicalPieces.count())),
|
|
});
|
|
const TileResult2 = await TileResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TileResult2?.setPhysical_piece)
|
|
{
|
|
await
|
|
TileResult2.
|
|
setPhysical_piece(relatedPhysical_piece2);
|
|
}
|
|
|
|
const relatedPhysical_piece3 = await PhysicalPieces.findOne({
|
|
offset: Math.floor(Math.random() * (await PhysicalPieces.count())),
|
|
});
|
|
const TileResult3 = await TileResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (TileResult3?.setPhysical_piece)
|
|
{
|
|
await
|
|
TileResult3.
|
|
setPhysical_piece(relatedPhysical_piece3);
|
|
}
|
|
|
|
const relatedPhysical_piece4 = await PhysicalPieces.findOne({
|
|
offset: Math.floor(Math.random() * (await PhysicalPieces.count())),
|
|
});
|
|
const TileResult4 = await TileResults.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (TileResult4?.setPhysical_piece)
|
|
{
|
|
await
|
|
TileResult4.
|
|
setPhysical_piece(relatedPhysical_piece4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateScrapPoolWithOrigin_piece() {
|
|
|
|
const relatedOrigin_piece0 = await PhysicalPieces.findOne({
|
|
offset: Math.floor(Math.random() * (await PhysicalPieces.count())),
|
|
});
|
|
const ScrapPool0 = await ScrapPools.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ScrapPool0?.setOrigin_piece)
|
|
{
|
|
await
|
|
ScrapPool0.
|
|
setOrigin_piece(relatedOrigin_piece0);
|
|
}
|
|
|
|
const relatedOrigin_piece1 = await PhysicalPieces.findOne({
|
|
offset: Math.floor(Math.random() * (await PhysicalPieces.count())),
|
|
});
|
|
const ScrapPool1 = await ScrapPools.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ScrapPool1?.setOrigin_piece)
|
|
{
|
|
await
|
|
ScrapPool1.
|
|
setOrigin_piece(relatedOrigin_piece1);
|
|
}
|
|
|
|
const relatedOrigin_piece2 = await PhysicalPieces.findOne({
|
|
offset: Math.floor(Math.random() * (await PhysicalPieces.count())),
|
|
});
|
|
const ScrapPool2 = await ScrapPools.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ScrapPool2?.setOrigin_piece)
|
|
{
|
|
await
|
|
ScrapPool2.
|
|
setOrigin_piece(relatedOrigin_piece2);
|
|
}
|
|
|
|
const relatedOrigin_piece3 = await PhysicalPieces.findOne({
|
|
offset: Math.floor(Math.random() * (await PhysicalPieces.count())),
|
|
});
|
|
const ScrapPool3 = await ScrapPools.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ScrapPool3?.setOrigin_piece)
|
|
{
|
|
await
|
|
ScrapPool3.
|
|
setOrigin_piece(relatedOrigin_piece3);
|
|
}
|
|
|
|
const relatedOrigin_piece4 = await PhysicalPieces.findOne({
|
|
offset: Math.floor(Math.random() * (await PhysicalPieces.count())),
|
|
});
|
|
const ScrapPool4 = await ScrapPools.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (ScrapPool4?.setOrigin_piece)
|
|
{
|
|
await
|
|
ScrapPool4.
|
|
setOrigin_piece(relatedOrigin_piece4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateScrapPoolWithCreated_by() {
|
|
|
|
const relatedCreated_by0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const ScrapPool0 = await ScrapPools.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ScrapPool0?.setCreated_by)
|
|
{
|
|
await
|
|
ScrapPool0.
|
|
setCreated_by(relatedCreated_by0);
|
|
}
|
|
|
|
const relatedCreated_by1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const ScrapPool1 = await ScrapPools.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ScrapPool1?.setCreated_by)
|
|
{
|
|
await
|
|
ScrapPool1.
|
|
setCreated_by(relatedCreated_by1);
|
|
}
|
|
|
|
const relatedCreated_by2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const ScrapPool2 = await ScrapPools.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ScrapPool2?.setCreated_by)
|
|
{
|
|
await
|
|
ScrapPool2.
|
|
setCreated_by(relatedCreated_by2);
|
|
}
|
|
|
|
const relatedCreated_by3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const ScrapPool3 = await ScrapPools.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ScrapPool3?.setCreated_by)
|
|
{
|
|
await
|
|
ScrapPool3.
|
|
setCreated_by(relatedCreated_by3);
|
|
}
|
|
|
|
const relatedCreated_by4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const ScrapPool4 = await ScrapPools.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (ScrapPool4?.setCreated_by)
|
|
{
|
|
await
|
|
ScrapPool4.
|
|
setCreated_by(relatedCreated_by4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateOptimizationRunWithCreated_by() {
|
|
|
|
const relatedCreated_by0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const OptimizationRun0 = await OptimizationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (OptimizationRun0?.setCreated_by)
|
|
{
|
|
await
|
|
OptimizationRun0.
|
|
setCreated_by(relatedCreated_by0);
|
|
}
|
|
|
|
const relatedCreated_by1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const OptimizationRun1 = await OptimizationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (OptimizationRun1?.setCreated_by)
|
|
{
|
|
await
|
|
OptimizationRun1.
|
|
setCreated_by(relatedCreated_by1);
|
|
}
|
|
|
|
const relatedCreated_by2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const OptimizationRun2 = await OptimizationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (OptimizationRun2?.setCreated_by)
|
|
{
|
|
await
|
|
OptimizationRun2.
|
|
setCreated_by(relatedCreated_by2);
|
|
}
|
|
|
|
const relatedCreated_by3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const OptimizationRun3 = await OptimizationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (OptimizationRun3?.setCreated_by)
|
|
{
|
|
await
|
|
OptimizationRun3.
|
|
setCreated_by(relatedCreated_by3);
|
|
}
|
|
|
|
const relatedCreated_by4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const OptimizationRun4 = await OptimizationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (OptimizationRun4?.setCreated_by)
|
|
{
|
|
await
|
|
OptimizationRun4.
|
|
setCreated_by(relatedCreated_by4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateOptimizationRunWithPanel() {
|
|
|
|
const relatedPanel0 = await Panels.findOne({
|
|
offset: Math.floor(Math.random() * (await Panels.count())),
|
|
});
|
|
const OptimizationRun0 = await OptimizationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (OptimizationRun0?.setPanel)
|
|
{
|
|
await
|
|
OptimizationRun0.
|
|
setPanel(relatedPanel0);
|
|
}
|
|
|
|
const relatedPanel1 = await Panels.findOne({
|
|
offset: Math.floor(Math.random() * (await Panels.count())),
|
|
});
|
|
const OptimizationRun1 = await OptimizationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (OptimizationRun1?.setPanel)
|
|
{
|
|
await
|
|
OptimizationRun1.
|
|
setPanel(relatedPanel1);
|
|
}
|
|
|
|
const relatedPanel2 = await Panels.findOne({
|
|
offset: Math.floor(Math.random() * (await Panels.count())),
|
|
});
|
|
const OptimizationRun2 = await OptimizationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (OptimizationRun2?.setPanel)
|
|
{
|
|
await
|
|
OptimizationRun2.
|
|
setPanel(relatedPanel2);
|
|
}
|
|
|
|
const relatedPanel3 = await Panels.findOne({
|
|
offset: Math.floor(Math.random() * (await Panels.count())),
|
|
});
|
|
const OptimizationRun3 = await OptimizationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (OptimizationRun3?.setPanel)
|
|
{
|
|
await
|
|
OptimizationRun3.
|
|
setPanel(relatedPanel3);
|
|
}
|
|
|
|
const relatedPanel4 = await Panels.findOne({
|
|
offset: Math.floor(Math.random() * (await Panels.count())),
|
|
});
|
|
const OptimizationRun4 = await OptimizationRuns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (OptimizationRun4?.setPanel)
|
|
{
|
|
await
|
|
OptimizationRun4.
|
|
setPanel(relatedPanel4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Panels.bulkCreate(PanelsData);
|
|
|
|
|
|
|
|
|
|
await TileResults.bulkCreate(TileResultsData);
|
|
|
|
|
|
|
|
|
|
await PhysicalPieces.bulkCreate(PhysicalPiecesData);
|
|
|
|
|
|
|
|
|
|
await ScrapPools.bulkCreate(ScrapPoolsData);
|
|
|
|
|
|
|
|
|
|
await OptimizationRuns.bulkCreate(OptimizationRunsData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePanelWithOwner(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTileResultWithPanel(),
|
|
|
|
|
|
|
|
|
|
await associateTileResultWithPhysical_piece(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateScrapPoolWithOrigin_piece(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateScrapPoolWithCreated_by(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateOptimizationRunWithCreated_by(),
|
|
|
|
|
|
|
|
|
|
await associateOptimizationRunWithPanel(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('panels', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('tile_results', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('physical_pieces', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('scrap_pools', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('optimization_runs', null, {});
|
|
|
|
|
|
},
|
|
}; |