-- ============================================================
-- SEED DATA: Manufacturing Orders for PO-HM-2024-001
-- PO: 12,000 Basic Cotton T-Shirts (Black), Sizes S/M/L/XL
-- Delivery: Aug 29, 2026 (ETD) / Sep 29, 2026 (ETA)
-- ============================================================

-- ========================================
-- 1. MASTER DATA: Production Lines
-- ========================================
INSERT IGNORE INTO master_production_lines (company_id, factory_id, line_name, line_code, capacity_per_day, section, status, notes) VALUES
(1, 1, 'Sewing Line A - T-Shirt', 'SL-A', 1200, 'sewing', 'active', 'Main t-shirt production line, 30 operators'),
(1, 1, 'Sewing Line B - T-Shirt', 'SL-B', 1000, 'sewing', 'active', 'Secondary t-shirt line, 25 operators'),
(1, 1, 'Cutting Section', 'CS-1', 5000, 'cutting', 'active', 'Auto spreading + manual cutting'),
(1, 1, 'Finishing & Packing', 'FP-1', 3000, 'finishing', 'active', 'Iron, fold, polybag, carton'),
(1, 3, 'Dyeing Line 1', 'DL-1', 2000, 'dyeing', 'active', 'Jet dyeing machine, 2000kg capacity'),
(1, 3, 'Washing Line 1', 'WL-1', 1500, 'washing', 'active', 'Industrial washing, enzyme wash capable');

-- ========================================
-- 2. MASTER DATA: Work Centers / Machines
-- ========================================
INSERT IGNORE INTO master_work_centers (company_id, factory_id, line_id, work_center_name, work_center_code, machine_type, category, hourly_rate, capacity_per_hour, status, notes) VALUES
(1, 1, 3, 'Auto Spreader SM-200', 'CUT-01', 'Auto Spreader', 'cutting', 15.00, 500.00, 'available', 'Gerber spreader, 200cm width'),
(1, 1, 3, 'Straight Knife LK-3', 'CUT-02', 'Straight Knife', 'cutting', 8.00, 150.00, 'available', 'Eastman straight knife cutter'),
(1, 1, 1, 'Overlock 5-Thread Juki', 'SEW-01', 'Overlock 5-thread', 'sewing', 12.00, 25.00, 'available', 'Juki MO-6814S'),
(1, 1, 1, 'Overlock 5-Thread Juki', 'SEW-02', 'Overlock 5-thread', 'sewing', 12.00, 25.00, 'in_use', 'Juki MO-6814S'),
(1, 1, 1, 'Coverstitch Juki', 'SEW-03', 'Coverstitch', 'sewing', 14.00, 22.00, 'available', 'Juki W4-100'),
(1, 1, 1, 'Coverstitch Juki', 'SEW-04', 'Coverstitch', 'sewing', 14.00, 22.00, 'in_use', 'Juki W4-100'),
(1, 1, 1, 'Single Needle Juki', 'SEW-05', 'Single Needle', 'sewing', 10.00, 30.00, 'available', 'Juki DDL-8100'),
(1, 1, 2, 'Overlock 5-Thread Juki', 'SEW-06', 'Overlock 5-thread', 'sewing', 12.00, 25.00, 'available', 'Backup line'),
(1, 1, 4, 'Steam Iron Station', 'FIN-01', 'Steam Iron', 'finishing', 8.00, 40.00, 'available', 'Industrial steam iron'),
(1, 3, 5, 'Jet Dyeing Machine 2T', 'DYE-01', 'Jet Dyeing Machine', 'dyeing', 50.00, 80.00, 'available', 'Thies iCone 2000kg'),
(1, 3, 5, 'Jet Dyeing Machine 1T', 'DYE-02', 'Jet Dyeing Machine', 'dyeing', 35.00, 45.00, 'in_use', 'Thies iCone 1000kg'),
(1, 3, 6, 'Industrial Washer BF-120', 'WASH-01', 'Industrial Washer', 'washing', 25.00, 60.00, 'available', 'Braun 120kg');

-- ========================================
-- 3. PRODUCTION ORDERS
-- ========================================

INSERT IGNORE INTO production_orders (company_id, prod_order_no, order_type, buyer_po_id, style_id, color, size, description,
  planned_qty, completed_qty, rejected_qty, scrapped_qty, uom, factory_id, line_id, work_center_id,
  planned_start_date, planned_end_date, actual_start_date, actual_end_date,
  priority, status, completion_pct, total_smv, total_sam, estimated_cost, actual_cost, notes, created_by) VALUES
(1, 'PROD-2026-000001', 'production', 1, 1, 'Black', '30', 'Batch 1: Size 30, 4000 pcs for Jakarta shipment',
 4000, 4000, 45, 0, 'PCS', 1, 1, 5, '2026-07-15', '2026-08-05', '2026-07-15', '2026-08-02',
 'high', 'completed', 100.00, 5.25, 5.25, 33600.00, 32800.00, 'First batch — size 30. Jakarta delivery.', 1),
(1, 'PROD-2026-000002', 'production', 1, 1, 'Black', '32', 'Batch 2: Size 32, 4000 pcs for Colombo shipment',
 4000, 3650, 38, 0, 'PCS', 1, 1, 5, '2026-07-20', '2026-08-12', '2026-07-20', NULL,
 'high', 'in_progress', 91.25, 5.25, 5.25, 33600.00, 30450.00, 'Second batch — size 32 in progress.', 1),
(1, 'PROD-2026-000003', 'production', 1, 1, 'Black', '34', 'Batch 3: Size 34, 4000 pcs for Barcelona shipment',
 4000, 2100, 22, 0, 'PCS', 1, 2, 6, '2026-08-01', '2026-08-20', '2026-08-01', NULL,
 'medium', 'in_progress', 52.50, 5.25, 5.25, 33600.00, 17640.00, 'Third batch — size 34 mid-production.', 1);

-- ========================================
-- 4. PRODUCTION ORDER OPERATIONS
-- ========================================

-- PROD-1 (COMPLETED — all 13 ops)
INSERT IGNORE INTO production_order_operations (company_id, prod_order_id, sequence, operation_name, operation_type, work_center_id, machine_type,
  planned_qty, completed_qty, rejected_qty, operators_required, smv, sam, planned_hours, actual_hours, status, actual_start_date, actual_end_date, notes) VALUES
(1, 1, 10, 'Front Panel Cut', 'cutting', 1, 'Straight Knife', 4000, 4000, 5, 2, 0.80, 0.80, 133.3, 128.5, 'completed', '2026-07-15', '2026-07-16', NULL),
(1, 1, 20, 'Back Panel Cut', 'cutting', 1, 'Straight Knife', 4000, 4000, 3, 2, 0.70, 0.70, 116.7, 112.0, 'completed', '2026-07-16', '2026-07-17', NULL),
(1, 1, 30, 'Sleeve Cut', 'cutting', 1, 'Straight Knife', 4000, 4000, 2, 2, 0.50, 0.50, 83.3, 80.0, 'completed', '2026-07-17', '2026-07-17', NULL),
(1, 1, 40, 'Shoulder Seam', 'sewing', 3, 'Overlock 5-thread', 4000, 4000, 8, 3, 0.45, 0.45, 75.0, 72.0, 'completed', '2026-07-18', '2026-07-19', NULL),
(1, 1, 50, 'Neck Collar Attach', 'sewing', 5, 'Coverstitch', 4000, 4000, 12, 3, 0.60, 0.60, 100.0, 96.0, 'completed', '2026-07-19', '2026-07-21', 'Rib collar binding'),
(1, 1, 60, 'Sleeve Set-in', 'sewing', 3, 'Overlock 5-thread', 4000, 4000, 6, 3, 0.75, 0.75, 125.0, 120.0, 'completed', '2026-07-21', '2026-07-23', NULL),
(1, 1, 70, 'Side Seam', 'sewing', 3, 'Overlock 5-thread', 4000, 4000, 4, 2, 0.55, 0.55, 91.7, 88.0, 'completed', '2026-07-23', '2026-07-24', NULL),
(1, 1, 80, 'Hem Bottom', 'sewing', 5, 'Coverstitch', 4000, 4000, 3, 2, 0.40, 0.40, 66.7, 64.0, 'completed', '2026-07-24', '2026-07-25', NULL),
(1, 1, 90, 'Sleeve Hem', 'sewing', 5, 'Coverstitch', 4000, 4000, 2, 2, 0.35, 0.35, 58.3, 56.0, 'completed', '2026-07-25', '2026-07-26', NULL),
(1, 1, 100, 'Label Attach', 'sewing', 7, 'Single Needle', 4000, 4000, 0, 1, 0.20, 0.20, 33.3, 32.0, 'completed', '2026-07-26', '2026-07-26', NULL),
(1, 1, 110, 'Trim & Thread Cut', 'finishing', 9, 'Manual', 4000, 4000, 0, 2, 0.30, 0.30, 50.0, 48.0, 'completed', '2026-07-27', '2026-07-28', NULL),
(1, 1, 120, 'Quality Check', 'quality', NULL, 'Manual', 4000, 4000, 45, 3, 0.40, 0.40, 66.7, 65.0, 'completed', '2026-07-28', '2026-07-29', '100% inline check'),
(1, 1, 130, 'Fold & Polybag', 'packing', NULL, 'Manual', 4000, 4000, 0, 4, 0.25, 0.25, 41.7, 40.0, 'completed', '2026-07-29', '2026-07-30', NULL);

-- PROD-2 (IN PROGRESS — at Sleeve Set-in)
INSERT IGNORE INTO production_order_operations (company_id, prod_order_id, sequence, operation_name, operation_type, work_center_id, machine_type,
  planned_qty, completed_qty, rejected_qty, operators_required, smv, sam, planned_hours, actual_hours, status, actual_start_date, actual_end_date, notes) VALUES
(1, 2, 10, 'Front Panel Cut', 'cutting', 1, 'Straight Knife', 4000, 4000, 3, 2, 0.80, 0.80, 133.3, 130.0, 'completed', '2026-07-20', '2026-07-21', NULL),
(1, 2, 20, 'Back Panel Cut', 'cutting', 1, 'Straight Knife', 4000, 4000, 4, 2, 0.70, 0.70, 116.7, 114.0, 'completed', '2026-07-21', '2026-07-22', NULL),
(1, 2, 30, 'Sleeve Cut', 'cutting', 1, 'Straight Knife', 4000, 4000, 2, 2, 0.50, 0.50, 83.3, 81.0, 'completed', '2026-07-22', '2026-07-23', NULL),
(1, 2, 40, 'Shoulder Seam', 'sewing', 3, 'Overlock 5-thread', 4000, 3800, 10, 3, 0.45, 0.45, 75.0, 72.0, 'completed', '2026-07-23', '2026-07-25', NULL),
(1, 2, 50, 'Neck Collar Attach', 'sewing', 5, 'Coverstitch', 4000, 3500, 8, 3, 0.60, 0.60, 100.0, 90.0, 'completed', '2026-07-25', '2026-07-27', 'Rib collar binding'),
(1, 2, 60, 'Sleeve Set-in', 'sewing', 3, 'Overlock 5-thread', 4000, 2800, 6, 3, 0.75, 0.75, 125.0, 85.0, 'in_progress', '2026-07-27', NULL, NULL),
(1, 2, 70, 'Side Seam', 'sewing', 3, 'Overlock 5-thread', 4000, 0, 0, 2, 0.55, 0.55, 91.7, NULL, 'pending', NULL, NULL, NULL),
(1, 2, 80, 'Hem Bottom', 'sewing', 5, 'Coverstitch', 4000, 0, 0, 2, 0.40, 0.40, 66.7, NULL, 'pending', NULL, NULL, NULL),
(1, 2, 90, 'Sleeve Hem', 'sewing', 5, 'Coverstitch', 4000, 0, 0, 2, 0.35, 0.35, 58.3, NULL, 'pending', NULL, NULL, NULL),
(1, 2, 100, 'Label Attach', 'sewing', 7, 'Single Needle', 4000, 0, 0, 1, 0.20, 0.20, 33.3, NULL, 'pending', NULL, NULL, NULL),
(1, 2, 110, 'Trim & Thread Cut', 'finishing', 9, 'Manual', 4000, 0, 0, 2, 0.30, 0.30, 50.0, NULL, 'pending', NULL, NULL, NULL),
(1, 2, 120, 'Quality Check', 'quality', NULL, 'Manual', 4000, 0, 0, 3, 0.40, 0.40, 66.7, NULL, 'pending', NULL, NULL, '100% inline check'),
(1, 2, 130, 'Fold & Polybag', 'packing', NULL, 'Manual', 4000, 0, 0, 4, 0.25, 0.25, 41.7, NULL, 'pending', NULL, NULL, NULL);

-- PROD-3 (IN PROGRESS — at Sleeve Cut)
INSERT IGNORE INTO production_order_operations (company_id, prod_order_id, sequence, operation_name, operation_type, work_center_id, machine_type,
  planned_qty, completed_qty, rejected_qty, operators_required, smv, sam, planned_hours, actual_hours, status, actual_start_date, actual_end_date, notes) VALUES
(1, 3, 10, 'Front Panel Cut', 'cutting', 2, 'Straight Knife', 4000, 4000, 2, 2, 0.80, 0.80, 133.3, 131.0, 'completed', '2026-08-01', '2026-08-02', NULL),
(1, 3, 20, 'Back Panel Cut', 'cutting', 2, 'Straight Knife', 4000, 4000, 3, 2, 0.70, 0.70, 116.7, 114.0, 'completed', '2026-08-02', '2026-08-03', NULL),
(1, 3, 30, 'Sleeve Cut', 'cutting', 2, 'Straight Knife', 4000, 3800, 2, 2, 0.50, 0.50, 83.3, 78.0, 'in_progress', '2026-08-03', NULL, NULL),
(1, 3, 40, 'Shoulder Seam', 'sewing', 4, 'Overlock 5-thread', 4000, 0, 0, 3, 0.45, 0.45, 75.0, NULL, 'pending', NULL, NULL, NULL),
(1, 3, 50, 'Neck Collar Attach', 'sewing', 6, 'Coverstitch', 4000, 0, 0, 3, 0.60, 0.60, 100.0, NULL, 'pending', NULL, NULL, 'Rib collar binding'),
(1, 3, 60, 'Sleeve Set-in', 'sewing', 4, 'Overlock 5-thread', 4000, 0, 0, 3, 0.75, 0.75, 125.0, NULL, 'pending', NULL, NULL, NULL),
(1, 3, 70, 'Side Seam', 'sewing', 4, 'Overlock 5-thread', 4000, 0, 0, 2, 0.55, 0.55, 91.7, NULL, 'pending', NULL, NULL, NULL),
(1, 3, 80, 'Hem Bottom', 'sewing', 6, 'Coverstitch', 4000, 0, 0, 2, 0.40, 0.40, 66.7, NULL, 'pending', NULL, NULL, NULL),
(1, 3, 90, 'Sleeve Hem', 'sewing', 6, 'Coverstitch', 4000, 0, 0, 2, 0.35, 0.35, 58.3, NULL, 'pending', NULL, NULL, NULL),
(1, 3, 100, 'Label Attach', 'sewing', 7, 'Single Needle', 4000, 0, 0, 1, 0.20, 0.20, 33.3, NULL, 'pending', NULL, NULL, NULL),
(1, 3, 110, 'Trim & Thread Cut', 'finishing', 9, 'Manual', 4000, 0, 0, 2, 0.30, 0.30, 50.0, NULL, 'pending', NULL, NULL, NULL),
(1, 3, 120, 'Quality Check', 'quality', NULL, 'Manual', 4000, 0, 0, 3, 0.40, 0.40, 66.7, NULL, 'pending', NULL, NULL, '100% inline check'),
(1, 3, 130, 'Fold & Polybag', 'packing', NULL, 'Manual', 4000, 0, 0, 4, 0.25, 0.25, 41.7, NULL, 'pending', NULL, NULL, NULL);

-- ========================================
-- 5. PRODUCTION ORDER MATERIALS
-- ========================================

INSERT IGNORE INTO production_order_materials (company_id, prod_order_id, item_id, material_name, material_type, color, size, uom,
  required_qty, issued_qty, consumed_qty, returned_qty, wastage_qty, rate, total_cost, warehouse_id, status, notes) VALUES
-- PROD-1 (consumed)
(1, 1, 1, '100% Combed Cotton Jersey 180gsm', 'fabric', 'Black', '30', 'Kg', 4800.00, 4900.00, 4680.00, 0, 220.00, 4.50, 22050.00, NULL, 'consumed', '1.2kg/pc + 5% wastage'),
(1, 1, NULL, 'Rib Neck Collar 1x1', 'trim', 'Black', '30', 'Kg', 600.00, 610.00, 590.00, 0, 20.00, 8.00, 4880.00, NULL, 'consumed', NULL),
(1, 1, NULL, 'Shoulder Tape 15mm', 'trim', 'Black', '30', 'Kg', 200.00, 205.00, 195.00, 0, 10.00, 2.50, 512.50, NULL, 'consumed', NULL),
(1, 1, NULL, 'Woven Label 30x50mm', 'accessory', 'Black', '30', 'Pcs', 4000, 4000, 4000, 0, 0, 0.12, 480.00, NULL, 'consumed', NULL),
(1, 1, NULL, 'Care Label SAT-001', 'accessory', 'Black', '30', 'Pcs', 4000, 4000, 4000, 0, 0, 0.08, 320.00, NULL, 'consumed', NULL),
(1, 1, NULL, 'Polybag 30x40cm', 'packaging', 'Black', '30', 'Pcs', 4000, 4000, 4000, 0, 0, 0.03, 120.00, NULL, 'consumed', NULL),
(1, 1, NULL, 'Carton Box 60x40x40cm', 'packaging', 'Black', '30', 'Pcs', 250, 250, 250, 0, 0, 0.85, 212.50, NULL, 'consumed', '16 pcs/carton'),
-- PROD-2 (partial)
(1, 2, 1, '100% Combed Cotton Jersey 180gsm', 'fabric', 'Black', '32', 'Kg', 4800.00, 4900.00, 4200.00, 0, 700.00, 4.50, 22050.00, NULL, 'partial_issued', NULL),
(1, 2, NULL, 'Rib Neck Collar 1x1', 'trim', 'Black', '32', 'Kg', 600.00, 610.00, 520.00, 0, 90.00, 8.00, 4880.00, NULL, 'partial_issued', NULL),
(1, 2, NULL, 'Shoulder Tape 15mm', 'trim', 'Black', '32', 'Kg', 200.00, 205.00, 175.00, 0, 30.00, 2.50, 512.50, NULL, 'partial_issued', NULL),
(1, 2, NULL, 'Woven Label 30x50mm', 'accessory', 'Black', '32', 'Pcs', 4000, 4000, 3650, 0, 0, 0.12, 480.00, NULL, 'partial_issued', NULL),
(1, 2, NULL, 'Care Label SAT-001', 'accessory', 'Black', '32', 'Pcs', 4000, 4000, 3650, 0, 0, 0.08, 320.00, NULL, 'partial_issued', NULL),
(1, 2, NULL, 'Polybag 30x40cm', 'packaging', 'Black', '32', 'Pcs', 4000, 2000, 0, 0, 0, 0.03, 120.00, NULL, 'partial_issued', 'Not yet packed'),
(1, 2, NULL, 'Carton Box 60x40x40cm', 'packaging', 'Black', '32', 'Pcs', 250, 0, 0, 0, 0, 0.85, 212.50, NULL, 'planned', NULL),
-- PROD-3 (partial)
(1, 3, 1, '100% Combed Cotton Jersey 180gsm', 'fabric', 'Black', '34', 'Kg', 4800.00, 4800.00, 2000.00, 0, 2800.00, 4.50, 21600.00, NULL, 'partial_issued', NULL),
(1, 3, NULL, 'Rib Neck Collar 1x1', 'trim', 'Black', '34', 'Kg', 600.00, 600.00, 250.00, 0, 350.00, 8.00, 4800.00, NULL, 'partial_issued', NULL),
(1, 3, NULL, 'Shoulder Tape 15mm', 'trim', 'Black', '34', 'Kg', 200.00, 200.00, 80.00, 0, 120.00, 2.50, 500.00, NULL, 'partial_issued', NULL),
(1, 3, NULL, 'Woven Label 30x50mm', 'accessory', 'Black', '34', 'Pcs', 4000, 4000, 2100, 0, 0, 0.12, 480.00, NULL, 'partial_issued', NULL),
(1, 3, NULL, 'Care Label SAT-001', 'accessory', 'Black', '34', 'Pcs', 4000, 4000, 2100, 0, 0, 0.08, 320.00, NULL, 'partial_issued', NULL),
(1, 3, NULL, 'Polybag 30x40cm', 'packaging', 'Black', '34', 'Pcs', 4000, 1000, 0, 0, 0, 0.03, 120.00, NULL, 'partial_issued', NULL),
(1, 3, NULL, 'Carton Box 60x40x40cm', 'packaging', 'Black', '34', 'Pcs', 250, 0, 0, 0, 0, 0.85, 212.50, NULL, 'planned', NULL);

-- ========================================
-- 6. BUNDLES (QR tracking)
-- ========================================

-- PROD-1 (20 bundles — all completed)
INSERT IGNORE INTO production_order_bundles (company_id, prod_order_id, bundle_no, qr_code, color, size, quantity, status) VALUES
(1, 1, 'B-20260715-0001', 'QR-PROD1-B001', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0002', 'QR-PROD1-B002', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0003', 'QR-PROD1-B003', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0004', 'QR-PROD1-B004', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0005', 'QR-PROD1-B005', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0006', 'QR-PROD1-B006', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0007', 'QR-PROD1-B007', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0008', 'QR-PROD1-B008', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0009', 'QR-PROD1-B009', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0010', 'QR-PROD1-B010', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0011', 'QR-PROD1-B011', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0012', 'QR-PROD1-B012', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0013', 'QR-PROD1-B013', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0014', 'QR-PROD1-B014', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0015', 'QR-PROD1-B015', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0016', 'QR-PROD1-B016', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0017', 'QR-PROD1-B017', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0018', 'QR-PROD1-B018', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0019', 'QR-PROD1-B019', 'Black', '30', 200, 'completed'),
(1, 1, 'B-20260715-0020', 'QR-PROD1-B020', 'Black', '30', 200, 'completed');

-- PROD-2 (20 bundles — mixed status)
INSERT IGNORE INTO production_order_bundles (company_id, prod_order_id, bundle_no, qr_code, color, size, quantity, status) VALUES
(1, 2, 'B-20260720-0001', 'QR-PROD2-B001', 'Black', '32', 200, 'completed'),
(1, 2, 'B-20260720-0002', 'QR-PROD2-B002', 'Black', '32', 200, 'completed'),
(1, 2, 'B-20260720-0003', 'QR-PROD2-B003', 'Black', '32', 200, 'completed'),
(1, 2, 'B-20260720-0004', 'QR-PROD2-B004', 'Black', '32', 200, 'completed'),
(1, 2, 'B-20260720-0005', 'QR-PROD2-B005', 'Black', '32', 200, 'completed'),
(1, 2, 'B-20260720-0006', 'QR-PROD2-B006', 'Black', '32', 200, 'completed'),
(1, 2, 'B-20260720-0007', 'QR-PROD2-B007', 'Black', '32', 200, 'completed'),
(1, 2, 'B-20260720-0008', 'QR-PROD2-B008', 'Black', '32', 200, 'completed'),
(1, 2, 'B-20260720-0009', 'QR-PROD2-B009', 'Black', '32', 200, 'completed'),
(1, 2, 'B-20260720-0010', 'QR-PROD2-B010', 'Black', '32', 200, 'completed'),
(1, 2, 'B-20260720-0011', 'QR-PROD2-B011', 'Black', '32', 200, 'completed'),
(1, 2, 'B-20260720-0012', 'QR-PROD2-B012', 'Black', '32', 200, 'in_process'),
(1, 2, 'B-20260720-0013', 'QR-PROD2-B013', 'Black', '32', 200, 'in_process'),
(1, 2, 'B-20260720-0014', 'QR-PROD2-B014', 'Black', '32', 200, 'in_process'),
(1, 2, 'B-20260720-0015', 'QR-PROD2-B015', 'Black', '32', 200, 'in_process'),
(1, 2, 'B-20260720-0016', 'QR-PROD2-B016', 'Black', '32', 200, 'in_process'),
(1, 2, 'B-20260720-0017', 'QR-PROD2-B017', 'Black', '32', 200, 'in_process'),
(1, 2, 'B-20260720-0018', 'QR-PROD2-B018', 'Black', '32', 200, 'in_process'),
(1, 2, 'B-20260720-0019', 'QR-PROD2-B019', 'Black', '32', 200, 'in_process'),
(1, 2, 'B-20260720-0020', 'QR-PROD2-B020', 'Black', '32', 200, 'in_process');

-- ========================================
-- 7. QC RECORDS
-- ========================================

INSERT IGNORE INTO production_order_qc (company_id, prod_order_id, operation_id, inspection_type, inspector_name, sample_size, passed_qty, rejected_qty, defects, result, remarks, inspected_at) VALUES
(1, 1, 50, 'inline', 'Rahim Uddin', 50, 48, 2, '[{"defect":"Open seam","count":1},{"defect":"Skip stitch","count":1}]', 'conditional', 'Minor open seam at shoulder, reworkable', '2026-07-19 14:30:00'),
(1, 1, 70, 'inline', 'Rahim Uddin', 50, 47, 3, '[{"defect":"Skip stitch","count":2},{"defect":"Puckering","count":1}]', 'conditional', 'Side seam puckering', '2026-07-23 15:00:00'),
(1, 1, 120, 'final', 'Fatima Begum', 200, 195, 5, '[{"defect":"Stain","count":2},{"defect":"Size deviation","count":2},{"defect":"Loose thread","count":1}]', 'passed', 'Final audit passed AQL 2.5', '2026-07-29 10:00:00'),
(1, 1, 120, 'final', 'Fatima Begum', 200, 198, 2, '[{"defect":"Loose thread","count":2}]', 'passed', NULL, '2026-07-29 11:30:00'),
(1, 1, 120, 'final', 'Fatima Begum', 200, 196, 4, '[{"defect":"Open seam","count":1},{"defect":"Label misaligned","count":2},{"defect":"Stain","count":1}]', 'passed', 'Within AQL limits', '2026-07-29 13:00:00'),
(1, 2, 40, 'inline', 'Rahim Uddin', 50, 49, 1, '[{"defect":"Skip stitch","count":1}]', 'passed', 'Good quality', '2026-07-25 14:00:00'),
(1, 2, 50, 'inline', 'Rahim Uddin', 50, 48, 2, '[{"defect":"Puckering","count":1},{"defect":"Open seam","count":1}]', 'conditional', 'Collar needs rework on 2 pcs', '2026-07-27 10:30:00');

-- ========================================
-- 8. WIP SNAPSHOTS
-- ========================================

INSERT IGNORE INTO production_order_wip (company_id, prod_order_id, operation_id, snapshot_date, qty_at_station, qty_completed, qty_rejected, wait_time_hours, efficiency_pct, notes) VALUES
(1, 2, 10, '2026-08-01', 0, 3996, 4, 0, 95.50, 'Cutting complete'),
(1, 2, 40, '2026-08-01', 0, 3990, 10, 0, 92.30, 'Shoulder seam complete'),
(1, 2, 50, '2026-08-01', 0, 3500, 8, 0, 88.50, 'Collar attach complete'),
(1, 2, 60, '2026-08-01', 1200, 2800, 6, 2.5, 85.00, 'Sleeve set-in in progress'),
(1, 2, 70, '2026-08-01', 0, 0, 0, 0, NULL, 'Waiting'),
(1, 2, 120, '2026-08-01', 0, 0, 0, 0, NULL, 'No QC yet');

-- ========================================
-- 9. LABOR RECORDS
-- ========================================

INSERT IGNORE INTO production_order_labor (company_id, prod_order_id, operation_id, worker_name, worker_id, role, shift, hours_worked, pieces_produced, rate_per_hour, total_cost, date) VALUES
(1, 1, 40, 'Kamal Hossain', 'OPR-001', 'operator', 'day', 8.0, 80, 3.50, 28.00, '2026-07-18'),
(1, 1, 40, 'Nasrin Akter', 'OPR-002', 'operator', 'day', 8.0, 75, 3.50, 28.00, '2026-07-18'),
(1, 1, 40, 'Jamal Miah', 'OPR-003', 'operator', 'day', 8.0, 78, 3.50, 28.00, '2026-07-18'),
(1, 1, 50, 'Rafiq Hasan', 'OPR-004', 'operator', 'day', 8.0, 65, 4.00, 32.00, '2026-07-19'),
(1, 1, 50, 'Salma Khatun', 'OPR-005', 'operator', 'day', 8.0, 62, 4.00, 32.00, '2026-07-19'),
(1, 1, 50, 'Abdul Hamid', 'OPR-006', 'operator', 'day', 8.0, 68, 4.00, 32.00, '2026-07-19'),
(1, 1, 120, 'Fatima Begum', 'QC-001', 'inspector', 'day', 8.0, NULL, 4.50, 36.00, '2026-07-29'),
(1, 1, 120, 'Rahim Uddin', 'QC-002', 'inspector', 'day', 8.0, NULL, 4.50, 36.00, '2026-07-29'),
(1, 2, 40, 'Kamal Hossain', 'OPR-001', 'operator', 'day', 8.0, 72, 3.50, 28.00, '2026-07-23'),
(1, 2, 40, 'Nasrin Akter', 'OPR-002', 'operator', 'day', 8.0, 70, 3.50, 28.00, '2026-07-23'),
(1, 2, 60, 'Jamal Miah', 'OPR-003', 'operator', 'day', 8.0, 60, 3.50, 28.00, '2026-07-28'),
(1, 2, 60, 'Rafiq Hasan', 'OPR-004', 'operator', 'day', 8.0, 58, 4.00, 32.00, '2026-07-28');

-- ========================================
-- 10. MACHINE LOGS (Production)
-- ========================================

INSERT IGNORE INTO production_order_machine_logs (company_id, prod_order_id, operation_id, work_center_id, machine_status, start_time, end_time, runtime_minutes, downtime_minutes, downtime_reason, operator_name, notes) VALUES
(1, 1, 10, 2, 'running', '2026-07-15 08:00:00', '2026-07-15 18:00:00', 540, 60, 'Lunch break', 'Kamal Hossain', NULL),
(1, 1, 10, 2, 'maintenance', '2026-07-15 14:00:00', '2026-07-15 14:30:00', 0, 30, 'Blade sharpening', 'Kamal Hossain', NULL),
(1, 1, 40, 3, 'running', '2026-07-18 08:00:00', '2026-07-18 18:00:00', 540, 60, 'Lunch break', 'Kamal Hossain', NULL),
(1, 1, 50, 5, 'running', '2026-07-19 08:00:00', '2026-07-19 18:00:00', 540, 60, 'Lunch break', 'Rafiq Hasan', NULL),
(1, 1, 50, 5, 'idle', '2026-07-19 11:00:00', '2026-07-19 11:20:00', 0, 20, 'Thread break', 'Rafiq Hasan', 'Re-threaded coverstitch'),
(1, 2, 40, 3, 'running', '2026-07-23 08:00:00', '2026-07-23 18:00:00', 540, 60, 'Lunch break', 'Kamal Hossain', NULL),
(1, 2, 60, 3, 'running', '2026-07-28 08:00:00', '2026-07-28 18:00:00', 540, 60, 'Lunch break', 'Jamal Miah', NULL),
(1, 2, 60, 3, 'idle', '2026-07-29 10:00:00', '2026-07-29 10:15:00', 0, 15, 'Needle break', 'Jamal Miah', NULL);

-- ========================================
-- 11. PROCESS ORDERS
-- ========================================

INSERT IGNORE INTO process_orders (company_id, process_order_no, order_type, buyer_po_id, style_id, material_name, fabric_type, batch_no,
  planned_qty, completed_qty, rejected_qty, uom, color, shade,
  machine_id, factory_id,
  planned_start_date, planned_end_date, actual_start_date, actual_end_date,
  priority, status, completion_pct, estimated_cost, actual_cost, shrinkage_pct, weight_loss_pct, ph_level,
  notes, created_by) VALUES
(1, 'PROC-2026-000001', 'dyeing', 1, 1, '100% Combed Cotton Jersey 180gsm', 'Single Jersey', 'DYE-BLK-001',
 14400.00, 14400.00, 0.00, 'Kg', 'Black', 'Jet Black', 11, 3,
 '2026-07-10', '2026-07-14', '2026-07-10', '2026-07-13',
 'high', 'completed', 100.00, 18000.00, 17500.00, 3.20, 1.80, 7.2,
 'All 12,000 pcs fabric dyed jet black. Reactive dye, 60C process.', 1),
(1, 'PROC-2026-000002', 'washing', 1, 1, '100% Combed Cotton Jersey 180gsm', 'Single Jersey', 'WASH-BLK-001',
 14400.00, 14400.00, 0.00, 'Kg', 'Black', 'Jet Black', 12, 3,
 '2026-07-14', '2026-07-15', '2026-07-14', '2026-07-15',
 'high', 'completed', 100.00, 8000.00, 7800.00, 2.10, 1.20, 6.8,
 'Enzyme wash + compacting completed. Hand-feel improved.', 1),
(1, 'PROC-2026-000003', 'dyeing', 1, 1, '100% Combed Cotton Jersey 180gsm', 'Single Jersey', 'DYE-BLK-002',
 5000.00, 3200.00, 50.00, 'Kg', 'Black', 'Jet Black', 12, 3,
 '2026-08-10', '2026-08-14', '2026-08-10', NULL,
 'medium', 'in_progress', 64.00, 6250.00, 4000.00, NULL, NULL, 7.0,
 'Second dye lot in progress — replenishment fabric.', 1);

-- ========================================
-- 12. PROCESS ORDER OPERATIONS
-- ========================================

-- PROC-1 (Dyeing — COMPLETED)
INSERT IGNORE INTO process_order_operations (company_id, process_order_id, sequence, operation_name, machine_id, machine_name,
  target_temp_c, actual_temp_c, target_duration_min, actual_duration_min, target_ph, actual_ph,
  speed_rpm, liquor_ratio, planned_start_date, planned_end_date, actual_start_date, actual_end_date,
  status, operator_name, notes) VALUES
(1, 1, 10, 'Fabric Loading', 11, 'Jet Dyeing Machine 2T', NULL, NULL, 30, 28, NULL, NULL, NULL, '1:8', '2026-07-10', '2026-07-10', '2026-07-10', '2026-07-10', 'completed', 'Kabir Rahman', 'Loaded 14,400kg'),
(1, 1, 20, 'Pre-wash & Wetting', 11, 'Jet Dyeing Machine 2T', 40, 40, 15, 15, 7.0, 7.0, NULL, '1:8', '2026-07-10', '2026-07-10', '2026-07-10', '2026-07-10', 'completed', 'Kabir Rahman', NULL),
(1, 1, 30, 'Dyeing Cycle', 11, 'Jet Dyeing Machine 2T', 60, 60, 120, 125, 11.0, 11.2, 35, '1:8', '2026-07-10', '2026-07-10', '2026-07-10', '2026-07-10', 'completed', 'Kabir Rahman', 'Reactive black dye + salt + soda ash'),
(1, 1, 40, 'Hot Rinse', 11, 'Jet Dyeing Machine 2T', 80, 80, 30, 30, 7.0, 7.1, NULL, '1:8', '2026-07-10', '2026-07-10', '2026-07-10', '2026-07-10', 'completed', 'Kabir Rahman', NULL),
(1, 1, 50, 'Soaping', 11, 'Jet Dyeing Machine 2T', 95, 95, 20, 22, 7.0, 7.0, NULL, '1:8', '2026-07-10', '2026-07-10', '2026-07-10', '2026-07-10', 'completed', 'Kabir Rahman', NULL),
(1, 1, 60, 'Cold Rinse', 11, 'Jet Dyeing Machine 2T', 25, 25, 15, 15, 7.0, 7.0, NULL, '1:8', '2026-07-10', '2026-07-10', '2026-07-10', '2026-07-10', 'completed', 'Kabir Rahman', NULL),
(1, 1, 70, 'Dye Fixation', 11, 'Jet Dyeing Machine 2T', 40, 40, 20, 20, 4.5, 4.5, NULL, '1:8', '2026-07-10', '2026-07-10', '2026-07-10', '2026-07-10', 'completed', 'Kabir Rahman', NULL),
(1, 1, 80, 'Hydro-extraction', NULL, NULL, NULL, NULL, 10, 10, NULL, NULL, NULL, NULL, '2026-07-10', '2026-07-10', '2026-07-10', '2026-07-10', 'completed', 'Kabir Rahman', NULL),
(1, 1, 90, 'Unloading & Inspection', NULL, NULL, NULL, NULL, 45, 40, NULL, NULL, NULL, NULL, '2026-07-10', '2026-07-10', '2026-07-10', '2026-07-10', 'completed', 'Kabir Rahman', 'Shade check');

-- PROC-2 (Washing — COMPLETED)
INSERT IGNORE INTO process_order_operations (company_id, process_order_id, sequence, operation_name, machine_id, machine_name,
  target_temp_c, actual_temp_c, target_duration_min, actual_duration_min, target_ph, actual_ph,
  speed_rpm, liquor_ratio, planned_start_date, planned_end_date, actual_start_date, actual_end_date,
  status, operator_name, notes) VALUES
(1, 2, 10, 'Fabric Loading', 13, 'Industrial Washer BF-120', NULL, NULL, 20, 18, NULL, NULL, NULL, '1:6', '2026-07-14', '2026-07-14', '2026-07-14', '2026-07-14', 'completed', 'Monir Hossain', NULL),
(1, 2, 20, 'Enzyme Wash', 13, 'Industrial Washer BF-120', 55, 55, 45, 48, 6.5, 6.5, 30, '1:6', '2026-07-14', '2026-07-14', '2026-07-14', '2026-07-14', 'completed', 'Monir Hossain', 'Cellulase enzyme'),
(1, 2, 30, 'Hot Rinse', 13, 'Industrial Washer BF-120', 60, 60, 15, 15, 7.0, 7.0, NULL, '1:6', '2026-07-14', '2026-07-14', '2026-07-14', '2026-07-14', 'completed', 'Monir Hossain', NULL),
(1, 2, 40, 'Softener Treatment', 13, 'Industrial Washer BF-120', 40, 40, 20, 20, 5.5, 5.5, NULL, '1:6', '2026-07-14', '2026-07-14', '2026-07-14', '2026-07-14', 'completed', 'Monir Hossain', 'Silicone softener'),
(1, 2, 50, 'Hydro-extraction', NULL, NULL, NULL, NULL, 10, 10, NULL, NULL, NULL, NULL, '2026-07-14', '2026-07-14', '2026-07-14', '2026-07-14', 'completed', 'Monir Hossain', NULL),
(1, 2, 60, 'Tumble Dry & Compact', NULL, NULL, 80, 80, 30, 35, NULL, NULL, NULL, NULL, '2026-07-14', '2026-07-14', '2026-07-14', '2026-07-14', 'completed', 'Monir Hossain', NULL),
(1, 2, 70, 'Inspection & Roll-up', NULL, NULL, NULL, NULL, 40, 35, NULL, NULL, NULL, NULL, '2026-07-14', '2026-07-14', '2026-07-14', '2026-07-14', 'completed', 'Monir Hossain', 'Shade approved');

-- PROC-3 (Dyeing — IN PROGRESS)
INSERT IGNORE INTO process_order_operations (company_id, process_order_id, sequence, operation_name, machine_id, machine_name,
  target_temp_c, actual_temp_c, target_duration_min, actual_duration_min, target_ph, actual_ph,
  speed_rpm, liquor_ratio, planned_start_date, planned_end_date, actual_start_date, actual_end_date,
  status, operator_name, notes) VALUES
(1, 3, 10, 'Fabric Loading', 11, 'Jet Dyeing Machine 2T', NULL, NULL, 20, 18, NULL, NULL, NULL, '1:8', '2026-08-10', '2026-08-10', '2026-08-10', '2026-08-10', 'completed', 'Kabir Rahman', NULL),
(1, 3, 20, 'Pre-wash & Wetting', 11, 'Jet Dyeing Machine 2T', 40, 40, 15, 14, 7.0, 7.0, NULL, '1:8', '2026-08-10', '2026-08-10', '2026-08-10', '2026-08-10', 'completed', 'Kabir Rahman', NULL),
(1, 3, 30, 'Dyeing Cycle', 11, 'Jet Dyeing Machine 2T', 60, 60, 120, NULL, 11.0, NULL, 35, '1:8', '2026-08-10', '2026-08-10', '2026-08-10', NULL, 'in_progress', 'Kabir Rahman', '50% complete'),
(1, 3, 40, 'Hot Rinse', 11, 'Jet Dyeing Machine 2T', 80, NULL, 30, NULL, 7.0, NULL, NULL, '1:8', '2026-08-10', '2026-08-10', NULL, NULL, 'pending', NULL, NULL),
(1, 3, 50, 'Soaping', 11, 'Jet Dyeing Machine 2T', 95, NULL, 20, NULL, 7.0, NULL, NULL, '1:8', '2026-08-10', '2026-08-10', NULL, NULL, 'pending', NULL, NULL),
(1, 3, 60, 'Cold Rinse', 11, 'Jet Dyeing Machine 2T', 25, NULL, 15, NULL, 7.0, NULL, NULL, '1:8', '2026-08-10', '2026-08-10', NULL, NULL, 'pending', NULL, NULL),
(1, 3, 70, 'Dye Fixation', 11, 'Jet Dyeing Machine 2T', 40, NULL, 20, NULL, 4.5, NULL, NULL, '1:8', '2026-08-10', '2026-08-10', NULL, NULL, 'pending', NULL, NULL),
(1, 3, 80, 'Hydro-extraction', NULL, NULL, NULL, NULL, 10, NULL, NULL, NULL, NULL, NULL, '2026-08-10', '2026-08-10', NULL, NULL, 'pending', NULL, NULL),
(1, 3, 90, 'Unloading & Inspection', NULL, NULL, NULL, NULL, 45, NULL, NULL, NULL, NULL, NULL, '2026-08-10', '2026-08-10', NULL, NULL, 'pending', NULL, NULL);

-- ========================================
-- 13. PROCESS ORDER RECIPES
-- ========================================

INSERT IGNORE INTO process_order_recipes (company_id, process_order_id, recipe_name, material_name, material_type, concentration, required_qty, actual_qty, uom, rate, total_cost, sequence, notes) VALUES
(1, 1, 'Reactive Dye Bath', 'Remazol Black B', 'dye', 2.50, 360.00, 362.50, 'Kg', 12.00, 4350.00, 10, '2.5% owf'),
(1, 1, 'Reactive Dye Bath', 'Glauber Salt', 'salt', 60.00, 8640.00, 8685.00, 'Kg', 0.30, 2605.50, 20, 'Electrolyte'),
(1, 1, 'Reactive Dye Bath', 'Soda Ash', 'chemical', 2.00, 288.00, 285.00, 'Kg', 0.50, 142.50, 30, 'Alkali'),
(1, 1, 'Reactive Dye Bath', 'Sequestering Agent', 'agent', 1.00, 144.00, 145.00, 'Kg', 2.00, 290.00, 40, NULL),
(1, 1, 'Reactive Dye Bath', 'Leveling Agent', 'auxiliary', 0.50, 72.00, 73.00, 'Kg', 4.00, 292.00, 50, NULL),
(1, 1, 'Fixation', 'Dye Fixative', 'chemical', 2.00, 288.00, 290.00, 'Kg', 3.50, 1015.00, 60, NULL),
(1, 1, 'Soaping', 'Soaping Agent', 'chemical', 1.00, 144.00, 146.00, 'Kg', 2.50, 365.00, 70, NULL),
(1, 2, 'Enzyme Wash', 'Cellulase Enzyme', 'chemical', 0.50, 72.00, 72.50, 'Kg', 8.00, 580.00, 10, 'Bio-polish'),
(1, 2, 'Enzyme Wash', 'Acetic Acid', 'chemical', 0.30, 43.20, 44.00, 'Kg', 1.50, 66.00, 20, 'pH buffer'),
(1, 2, 'Softener', 'Silicone Softener', 'chemical', 3.00, 432.00, 435.00, 'Kg', 4.00, 1740.00, 30, 'Hand-feel'),
(1, 2, 'Softener', 'Anti-crease Agent', 'auxiliary', 1.00, 144.00, 143.00, 'Kg', 2.50, 357.50, 40, NULL);

-- ========================================
-- 14. PROCESS ORDER BATCHES
-- ========================================

INSERT IGNORE INTO process_order_batches (company_id, process_order_id, batch_no, input_qty, output_qty, rejected_qty, shrinkage_pct, status, started_at, completed_at, notes) VALUES
(1, 1, 'DYE-BLK-001-B1', 4800.00, 4680.00, 0, 2.50, 'completed', '2026-07-10 08:00', '2026-07-10 14:00', 'Sizes S/M'),
(1, 1, 'DYE-BLK-001-B2', 4800.00, 4700.00, 0, 2.08, 'completed', '2026-07-11 08:00', '2026-07-11 14:00', 'Size L'),
(1, 1, 'DYE-BLK-001-B3', 4800.00, 4690.00, 0, 2.29, 'completed', '2026-07-12 08:00', '2026-07-12 14:00', 'Size XL'),
(1, 2, 'WASH-BLK-001-B1', 7200.00, 7100.00, 0, 1.39, 'completed', '2026-07-14 08:00', '2026-07-14 14:00', 'First half'),
(1, 2, 'WASH-BLK-001-B2', 7200.00, 7120.00, 0, 1.11, 'completed', '2026-07-14 14:00', '2026-07-14 20:00', 'Second half'),
(1, 3, 'DYE-BLK-002-B1', 2500.00, 1600.00, 25.00, NULL, 'in_process', '2026-08-10 08:00', NULL, 'In dyeing cycle'),
(1, 3, 'DYE-BLK-002-B2', 2500.00, 1600.00, 25.00, NULL, 'in_process', '2026-08-10 08:00', NULL, 'Parallel batch');

-- ========================================
-- 15. PROCESS ORDER CONSUMPTION
-- ========================================

INSERT IGNORE INTO process_order_consumption (company_id, process_order_id, batch_id, material_name, planned_qty, actual_qty, uom, batch_no, notes) VALUES
(1, 1, 1, 'Remazol Black B', 120.00, 122.50, 'Kg', 'DYE-BLK-001-B1', 'Slight overdye'),
(1, 1, 1, 'Glauber Salt', 2880.00, 2900.00, 'Kg', 'DYE-BLK-001-B1', NULL),
(1, 1, 1, 'Soda Ash', 96.00, 95.00, 'Kg', 'DYE-BLK-001-B1', NULL),
(1, 1, 2, 'Remazol Black B', 120.00, 119.00, 'Kg', 'DYE-BLK-001-B2', NULL),
(1, 1, 2, 'Glauber Salt', 2880.00, 2890.00, 'Kg', 'DYE-BLK-001-B2', NULL),
(1, 1, 3, 'Remazol Black B', 120.00, 121.00, 'Kg', 'DYE-BLK-001-B3', NULL),
(1, 1, 3, 'Glauber Salt', 2880.00, 2895.00, 'Kg', 'DYE-BLK-001-B3', NULL),
(1, 2, 4, 'Cellulase Enzyme', 36.00, 37.50, 'Kg', 'WASH-BLK-001-B1', NULL),
(1, 2, 4, 'Silicone Softener', 216.00, 220.00, 'Kg', 'WASH-BLK-001-B1', NULL),
(1, 2, 5, 'Cellulase Enzyme', 36.00, 35.00, 'Kg', 'WASH-BLK-001-B2', NULL),
(1, 2, 5, 'Silicone Softener', 216.00, 215.00, 'Kg', 'WASH-BLK-001-B2', NULL);

-- ========================================
-- 16. PROCESS ORDER OUTPUT
-- ========================================

INSERT IGNORE INTO process_order_output (company_id, process_order_id, batch_id, output_qty, output_uom, quality_grade, shrinkage_pct, notes) VALUES
(1, 1, 1, 4680.00, 'Kg', 'a', 2.50, 'Excellent shade depth'),
(1, 1, 2, 4700.00, 'Kg', 'a', 2.08, 'Consistent with batch 1'),
(1, 1, 3, 4690.00, 'Kg', 'a', 2.29, 'All batches shade-matched'),
(1, 2, 4, 7100.00, 'Kg', 'a', 1.39, 'Good hand-feel'),
(1, 2, 5, 7120.00, 'Kg', 'a', 1.11, 'Excellent finish');

-- ========================================
-- 17. PROCESS ORDER QUALITY
-- ========================================

INSERT IGNORE INTO process_order_quality (company_id, process_order_id, batch_id, inspection_type, inspector_name,
  color_shade, color_fastness_wash, color_fastness_rub, color_fastness_light,
  shrinkage_pct, gsm, ph_value, hand_feel, pilling_rating, result, remarks, inspected_at) VALUES
(1, 1, 1, 'final', 'Nasrin Akter', 'Jet Black', '4-5', '3-4', '4', -3.0, 178, 7.2, 'Good', '4', 'pass', 'All parameters within tolerance', '2026-07-10 15:00:00'),
(1, 1, 2, 'final', 'Nasrin Akter', 'Jet Black', '4-5', '3-4', '4', -3.2, 177, 7.1, 'Good', '4', 'pass', 'Consistent with batch 1', '2026-07-11 15:00:00'),
(1, 1, 3, 'final', 'Nasrin Akter', 'Jet Black', '4-5', '3', '4', -2.8, 179, 7.3, 'Good', '4', 'pass', 'Shade-matched under D65', '2026-07-12 15:00:00'),
(1, 2, 4, 'final', 'Nasrin Akter', 'Jet Black', '4', '3', '3-4', -2.0, 175, 6.8, 'Excellent', '4', 'pass', 'Enzyme wash improved hand-feel', '2026-07-14 15:00:00'),
(1, 2, 5, 'final', 'Nasrin Akter', 'Jet Black', '4', '3', '3-4', -2.1, 174, 6.8, 'Excellent', '4', 'pass', 'Consistent with batch 1', '2026-07-14 21:00:00');

-- ========================================
-- 18. PROCESS ORDER MACHINE LOGS
-- ========================================

INSERT IGNORE INTO process_order_machine_logs (company_id, process_order_id, machine_id, machine_status, start_time, end_time, runtime_minutes, downtime_minutes, downtime_reason, operator_name, notes) VALUES
(1, 1, 11, 'running', '2026-07-10 08:00', '2026-07-10 14:00', 360, 0, NULL, 'Kabir Rahman', 'Batch 1'),
(1, 1, 11, 'running', '2026-07-11 08:00', '2026-07-11 14:00', 360, 0, NULL, 'Kabir Rahman', 'Batch 2'),
(1, 1, 11, 'maintenance', '2026-07-11 14:00', '2026-07-11 14:45', 0, 45, 'Pump seal replacement', 'Kabir Rahman', NULL),
(1, 1, 11, 'running', '2026-07-12 08:00', '2026-07-12 14:00', 360, 0, NULL, 'Kabir Rahman', 'Batch 3'),
(1, 2, 13, 'running', '2026-07-14 08:00', '2026-07-14 20:00', 720, 0, NULL, 'Monir Hossain', 'Both batches');
