import { query } from "../common/sqlite" export default { async getOrdersData(orderNo){ const orderData = await query(`SELECT ROW_NUMBER() OVER (ORDER BY material_name) AS rowNum, tempOrders.orderNo, customer, material_name, createTime FROM (SELECT * FROM orders WHERE orderNo = ?) tempOrders JOIN (SELECT * FROM order_materials WHERE orderNo = ?) tempMats ON tempOrders.orderNo = tempMats.orderNo`,[orderNo, orderNo]); return orderData; }, async getOrderScanData(orderNo, matName){ const scanData = await query(`SELECT ROW_NUMBER() OVER (ORDER BY scan_time) AS rowNum, orderNo, materialName, scan_content, reference_content, scan_time FROM scan_records WHERE orderNo = ? AND materialName = ?`,[orderNo, matName]) return scanData; } }