The file /home/project/src/components/warehouse/ProductForm.tsx has been updated. Made 1 replacement. Here's the result of running `cat -n` on a snippet of the edited file: 246→ return `${prefix}1`; 247→ } 248→ }; 249→ 250→ // 从数据库查询已存在的最大色号数字,生成下一个 251→ const generateNextColorCode = async ( 252→ companyId: string, 253→ productName: string, 254→ totalWeight: number | null, 255→ color: string 256→ ): Promise => { 257→ try { 258→ // 查询该产品名称-克重-颜色组合下的所有色号 259→ const { data, error } = await supabase 260→ .from('products') 261→ .select('color_code') 262→ .eq('company_id', companyId) 263→ .eq('product_name', productName) 264→ .eq('total_weight', totalWeight || 0) 265→ .eq('color', color); 266→ 267→ if (error || !data || data.length === 0) { 268→ // 如果没有匹配的产品,从01开始 269→ return '01'; 270→ } 271→ 272→ // 提取所有色号中的数字,找出最大值 273→ let maxNum = 0; 274→ data.forEach(item => { 275→ const code = item.color_code; 276→ const num = parseInt(code, 10); 277→ if (!isNaN(num) && num > maxNum) { 278→ maxNum = num; 279→ } 280→ }); 281→ 282→ // 返回最大数字 + 1,保持两位数格式 283→ const nextNum = maxNum + 1; 284→ return nextNum < 10 ? `0${nextNum}` : String(nextNum); 285→ } catch (err) { 286→ console.error('生成色号失败:', err); 287→ return '01'; 288→ } 289→ }; 290→ 291→ // 选择产品建议 292→ const selectProductSuggestion = async (suggestion: ProductSuggestion) => { 293→ // 获取该产品的纱线配比 294→ const ratios = productRatios[suggestion.id] || [];