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:
 208→      setProductSuggestions([]);
 209→    }
 210→  };
 211→
 212→  // 从数据库查询已存在的最大产品码数字，生成下一个
 213→  const generateNextFabricCode = async (companyId: string, prefix: string): Promise<string> => {
 214→    if (!prefix) return '';
 215→
 216→    try {
 217→      // 查询该公司所有以该前缀开头的产品码
 218→      const { data, error } = await supabase
 219→        .from('products')
 220→        .select('fabric_code')
 221→        .eq('company_id', companyId)
 222→        .ilike('fabric_code', `${prefix}%`);
 223→
 224→      if (error || !data || data.length === 0) {
 225→        // 如果没有匹配的产品，从1开始
 226→        return `${prefix}1`;
 227→      }
 228→
 229→      // 提取所有产品码中的数字，找出最大值
 230→      let maxNum = 0;
 231→      data.forEach(item => {
 232→        const code = item.fabric_code;
 233→        const match = code.match(/^(.*?)(\d+)$/);
 234→        if (match && match[1].toUpperCase() === prefix.toUpperCase()) {
 235→          const num = parseInt(match[2], 10);
 236→          if (num > maxNum) {
 237→            maxNum = num;
 238→          }
 239→        }
 240→      });
 241→
 242→      // 返回前缀 + (最大数字 + 1)
 243→      return `${prefix}${maxNum + 1}`;
 244→    } catch (err) {
 245→      console.error('生成产品码失败:', err);
 246→      return `${prefix}1`;
 247→    }
 248→  };
 249→
 250→  // 生成递增的色号（如 02 → 03）
 251→  const generateNextColorCode = (currentCode: string): string => {
 252→    if (!currentCode) return '01';
 253→    const num = parseInt(currentCode, 10);