-- 补充各月份测试数据，确保图表完整展示
-- 采购订单：补充2025-07~2025-12、2026-02、2026-04~2026-06
-- RFQ：补充2025-07~2025-11

SET NAMES utf8mb4;

-- === 补充采购订单（缺失月份）===
INSERT INTO biz_purchase_order (tenant_id, po_no, rfq_id, supplier_id, total_amount, currency, status, delivery_date, create_by, create_time) VALUES
(1, 'PO-2025-0701', 1, 1, 38500.00, 'CNY', 'confirmed', '2025-08-15', 'admin', '2025-07-10 10:00:00'),
(1, 'PO-2025-0801', 1, 2, 52300.00, 'CNY', 'confirmed', '2025-09-20', 'admin', '2025-08-12 11:00:00'),
(1, 'PO-2025-0901', 1, 3, 41800.00, 'CNY', 'confirmed', '2025-10-18', 'admin', '2025-09-05 09:30:00'),
(1, 'PO-2025-1001', 1, 1, 67200.00, 'CNY', 'confirmed', '2025-11-22', 'admin', '2025-10-08 14:00:00'),
(1, 'PO-2025-1101', 1, 4, 29400.00, 'CNY', 'confirmed', '2025-12-15', 'admin', '2025-11-03 10:30:00'),
(1, 'PO-2025-1201', 1, 5, 45600.00, 'CNY', 'confirmed', '2026-01-20', 'admin', '2025-12-07 13:00:00'),
(1, 'PO-2026-0201', 1, 2, 33800.00, 'CNY', 'confirmed', '2026-03-10', 'admin', '2026-02-14 10:00:00'),
(1, 'PO-2026-0401', 1, 3, 51200.00, 'CNY', 'confirmed', '2026-05-18', 'admin', '2026-04-09 11:30:00'),
(1, 'PO-2026-0501', 1, 1, 44900.00, 'CNY', 'confirmed', '2026-06-22', 'admin', '2026-05-11 09:00:00'),
(1, 'PO-2026-0601', 1, 5, 38700.00, 'CNY', 'confirmed', '2026-07-15', 'admin', '2026-06-05 14:30:00');

-- === 补充RFQ（缺失月份2025-07~2025-11）===
INSERT INTO biz_rfq (tenant_id, rfq_no, rfq_title, status, deadline, create_by, create_time) VALUES
(1, 'RFQ-2025-0701', '7月办公设备采购', 'closed', '2025-07-20 00:00:00', 'admin', '2025-07-05 10:00:00'),
(1, 'RFQ-2025-0801', '8月IT设备采购', 'closed', '2025-08-20 00:00:00', 'admin', '2025-08-05 10:00:00'),
(1, 'RFQ-2025-0901', '9月工业耗材采购', 'closed', '2025-09-20 00:00:00', 'admin', '2025-09-05 10:00:00'),
(1, 'RFQ-2025-1001', '10月电子元器件采购', 'closed', '2025-10-20 00:00:00', 'admin', '2025-10-05 10:00:00'),
(1, 'RFQ-2025-1101', '11月机械配件采购', 'closed', '2025-11-20 00:00:00', 'admin', '2025-11-05 10:00:00');

-- === 补充报价数据（缺失月份）===
INSERT INTO biz_quotation (tenant_id, rfq_id, supplier_id, quote_no, total_amount, currency, status, submit_time, create_by) VALUES
(1, 1, 1, 'QT-2025-0701', 36500.00, 'CNY', 'rejected', '2025-07-15 10:00:00', 'admin'),
(1, 1, 2, 'QT-2025-0702', 35200.00, 'CNY', 'accepted', '2025-07-15 11:00:00', 'admin'),
(1, 1, 3, 'QT-2025-0801', 51800.00, 'CNY', 'accepted', '2025-08-15 10:00:00', 'admin'),
(1, 1, 1, 'QT-2025-0802', 53500.00, 'CNY', 'rejected', '2025-08-15 11:00:00', 'admin'),
(1, 1, 4, 'QT-2025-0901', 41200.00, 'CNY', 'accepted', '2025-09-12 10:00:00', 'admin'),
(1, 1, 2, 'QT-2025-0902', 42500.00, 'CNY', 'rejected', '2025-09-12 11:00:00', 'admin'),
(1, 1, 5, 'QT-2025-1001', 66800.00, 'CNY', 'accepted', '2025-10-12 10:00:00', 'admin'),
(1, 1, 3, 'QT-2025-1002', 67500.00, 'CNY', 'rejected', '2025-10-12 11:00:00', 'admin'),
(1, 1, 1, 'QT-2025-1101', 29000.00, 'CNY', 'rejected', '2025-11-10 10:00:00', 'admin'),
(1, 1, 4, 'QT-2025-1102', 28500.00, 'CNY', 'accepted', '2025-11-10 11:00:00', 'admin'),
(1, 1, 2, 'QT-2026-0201', 33500.00, 'CNY', 'accepted', '2026-02-20 10:00:00', 'admin'),
(1, 1, 5, 'QT-2026-0202', 34200.00, 'CNY', 'rejected', '2026-02-20 11:00:00', 'admin'),
(1, 1, 3, 'QT-2026-0401', 50800.00, 'CNY', 'accepted', '2026-04-15 10:00:00', 'admin'),
(1, 1, 1, 'QT-2026-0402', 52000.00, 'CNY', 'rejected', '2026-04-15 11:00:00', 'admin'),
(1, 1, 5, 'QT-2026-0501', 44500.00, 'CNY', 'accepted', '2026-05-15 10:00:00', 'admin'),
(1, 1, 2, 'QT-2026-0502', 45200.00, 'CNY', 'rejected', '2026-05-15 11:00:00', 'admin'),
(1, 1, 1, 'QT-2026-0601', 38200.00, 'CNY', 'rejected', '2026-06-10 10:00:00', 'admin'),
(1, 1, 4, 'QT-2026-0602', 38500.00, 'CNY', 'accepted', '2026-06-10 11:00:00', 'admin');

-- === 验证 ===
SELECT '=== 采购订单月度分布 ===' AS info;
SELECT DATE_FORMAT(create_time,'%Y-%m') AS month, COUNT(*) AS cnt, SUM(total_amount) AS amt FROM biz_purchase_order GROUP BY month ORDER BY month;
SELECT '=== RFQ月度分布 ===' AS info;
SELECT DATE_FORMAT(create_time,'%Y-%m') AS month, COUNT(*) AS cnt FROM biz_rfq GROUP BY month ORDER BY month;
SELECT '=== 报价月度分布 ===' AS info;
SELECT DATE_FORMAT(submit_time,'%Y-%m') AS month, COUNT(*) AS cnt FROM biz_quotation WHERE submit_time IS NOT NULL GROUP BY month ORDER BY month;
