个人编程网站

进销存(JXC)软件开发技术积累与分享

进销存系统供应商智能评估与分级管理

引言

供应商是进销存系统中非常重要的角色,优质的供应商资源是企业核心竞争力的重要组成部分。本文介绍进销存系统中供应商智能评估与分级管理的设计与实现方案。

评估指标体系

建立科学的供应商评估指标体系,涵盖多个维度:

评估维度 指标项 权重 数据来源
价格竞争力 采购价格得分 15% 历史采购数据
价格稳定性 10% 价格波动分析
折扣力度 5% 合同条款
交付能力 准时交货率 15% 入库记录
订单完成率 10% 订单数据
交付响应速度 5% 采购流程记录
质量表现 来料合格率 15% 质检数据
退货率 5% 退货记录
质量问题响应 5% 投诉处理记录

评估数据模型

// 供应商评估数据模型
const SupplierEvaluation = {
  // 供应商基础信息
  Supplier: {
    fields: {
      id: { type: 'ObjectId', primary: true },
      code: { type: 'String', unique: true },  // 供应商编码
      name: { type: 'String', required: true }, // 供应商名称
      category: { type: 'String' },  // 供应商品类
      contacts: { type: 'Array' },   // 联系方式
      address: { type: 'String' },
      status: { type: 'String', enum: ['active', 'suspended', 'blacklist'] },
      level: { type: 'String', enum: ['A', 'B', 'C', 'D'] },  // 评定等级
      createdAt: { type: 'Date' }
    }
  },

  // 评估得分记录
  EvaluationScore: {
    fields: {
      id: { type: 'ObjectId', primary: true },
      supplierId: { type: 'ObjectId', ref: 'Supplier' },
      evalDate: { type: 'Date' },  // 评估日期
      period: { type: 'String' },  // 评估周期:2025-Q1

      // 价格竞争力得分
      priceScore: { type: 'Number' },        // 采购价格得分
      priceStabilityScore: { type: 'Number' }, // 价格稳定性
      discountScore: { type: 'Number' },     // 折扣力度得分

      // 交付能力得分
      deliveryScore: { type: 'Number' },     // 准时交货率
      completionScore: { type: 'Number' },   // 订单完成率
      responseScore: { type: 'Number' },     // 响应速度

      // 质量表现得分
      qualityScore: { type: 'Number' },      // 来料合格率
      returnRateScore: { type: 'Number' },   // 退货率得分
      issueResponseScore: { type: 'Number' }, // 问题响应

      // 综合得分
      totalScore: { type: 'Number' },
      evaluator: { type: 'String' }
    }
  },

  // 价格历史记录
  PriceHistory: {
    fields: {
      id: { type: 'ObjectId', primary: true },
      supplierId: { type: 'ObjectId', ref: 'Supplier' },
      productId: { type: 'ObjectId', ref: 'Product' },
      price: { type: 'Number' },
      unit: { type: 'String' },
      startDate: { type: 'Date' },
      endDate: { type: 'Date' },
      contractNo: { type: 'String' }
    }
  }
};

评估算法实现

class SupplierEvaluationService {
  constructor(supplierModel, purchaseModel, qualityModel) {
    this.Supplier = supplierModel;
    this.Purchase = purchaseModel;
    this.Quality = qualityModel;
  }

  // 计算供应商综合得分
  async evaluateSupplier(supplierId, period) {
    // 1. 价格竞争力评估
    const priceAnalysis = await this.analyzePricePerformance(supplierId, period);

    // 2. 交付能力评估
    const deliveryAnalysis = await this.analyzeDeliveryPerformance(supplierId, period);

    // 3. 质量表现评估
    const qualityAnalysis = await this.analyzeQualityPerformance(supplierId, period);

    // 4. 计算加权得分
    const scores = {
      // 价格竞争力 (30%)
      priceScore: priceAnalysis.priceScore * 0.15,
      priceStabilityScore: priceAnalysis.stabilityScore * 0.10,
      discountScore: priceAnalysis.discountScore * 0.05,

      // 交付能力 (30%)
      deliveryScore: deliveryAnalysis.onTimeRate * 0.15,
      completionScore: deliveryAnalysis.completionRate * 0.10,
      responseScore: deliveryAnalysis.responseScore * 0.05,

      // 质量表现 (40%)
      qualityScore: qualityAnalysis.qualificationRate * 0.15,
      returnRateScore: qualityAnalysis.returnRateScore * 0.05,
      issueResponseScore: qualityAnalysis.issueResponseScore * 0.05
    };

    const totalScore = Object.values(scores).reduce((a, b) => a + b, 0);

    return {
      supplierId,
      period,
      scores,
      totalScore: Math.round(totalScore * 100) / 100,
      level: this.calculateLevel(totalScore)
    };
  }

  // 分析价格竞争力
  async analyzePricePerformance(supplierId, period) {
    const { startDate, endDate } = this.getPeriodRange(period);

    // 获取历史采购价格
    const purchases = await this.Purchase.find({
      supplierId,
      purchaseDate: { $gte: startDate, $lte: endDate }
    });

    if (purchases.length === 0) {
      return { priceScore: 60, stabilityScore: 60, discountScore: 60 };
    }

    // 计算平均价格与市场价对比
    const avgPrice = purchases.reduce((sum, p) => sum + p.unitPrice, 0) / purchases.length;
    const marketPrice = await this.getMarketPrice(purchases[0].productId);
    const priceScore = Math.min(100, (marketPrice / avgPrice) * 100);

    // 计算价格波动方差
    const prices = purchases.map(p => p.unitPrice);
    const variance = this.calculateVariance(prices);
    const stabilityScore = Math.max(0, 100 - variance * 10);

    // 折扣得分(根据合同折扣)
    const discountScore = await this.getDiscountScore(supplierId);

    return { priceScore, stabilityScore, discountScore };
  }

  // 分析交付能力
  async analyzeDeliveryPerformance(supplierId, period) {
    const { startDate, endDate } = this.getPeriodRange(period);

    const purchases = await this.Purchase.find({
      supplierId,
      purchaseDate: { $gte: startDate, $lte: endDate }
    });

    // 准时交货率
    const onTimeCount = purchases.filter(p => {
      return p.actualDeliveryDate <= p.expectedDeliveryDate;
    }).length;
    const onTimeRate = (onTimeCount / purchases.length) * 100;

    // 订单完成率(完全按量交付)
    const completeCount = purchases.filter(p => {
      return p.receivedQuantity >= p.orderQuantity * 0.98;
    }).length;
    const completionRate = (completeCount / purchases.length) * 100;

    // 响应速度(从下单到确认的时间)
    const responseTime = purchases.reduce((sum, p) => {
      const confirmTime = new Date(p.confirmedAt) - new Date(p.createdAt);
      return sum + confirmTime;
    }, 0) / purchases.length;

    // 响应速度得分(24小时内响应得满分)
    const responseScore = Math.max(0, 100 - (responseTime / (24 * 3600 * 1000)) * 20);

    return { onTimeRate, completionRate, responseScore };
  }

  // 分析质量表现
  async analyzeQualityPerformance(supplierId, period) {
    const { startDate, endDate } = this.getPeriodRange(period);

    const inspections = await this.Quality.find({
      supplierId,
      inspectDate: { $gte: startDate, $lte: endDate }
    });

    // 来料合格率
    const qualifiedCount = inspections.filter(i => i.result === 'qualified').length;
    const qualificationRate = (qualifiedCount / inspections.length) * 100;

    // 退货率得分
    const purchases = await this.Purchase.find({
      supplierId,
      purchaseDate: { $gte: startDate, $lte: endDate }
    });
    const returns = await this.PurchaseReturn.find({
      supplierId,
      returnDate: { $gte: startDate, $lte: endDate }
    });
    const totalAmount = purchases.reduce((sum, p) => sum + p.totalAmount, 0);
    const returnAmount = returns.reduce((sum, r) => sum + r.totalAmount, 0);
    const returnRate = (returnAmount / totalAmount) * 100;
    const returnRateScore = Math.max(0, 100 - returnRate * 10);

    // 问题响应得分
    const issueResponseScore = await this.calculateIssueResponseScore(supplierId, period);

    return { qualificationRate, returnRateScore, issueResponseScore };
  }

  // 计算等级
  calculateLevel(score) {
    if (score >= 90) return 'A';
    if (score >= 75) return 'B';
    if (score >= 60) return 'C';
    return 'D';
  }

  // 方差计算
  calculateVariance(values) {
    const avg = values.reduce((a, b) => a + b, 0) / values.length;
    const squareDiffs = values.map(v => Math.pow(v - avg, 2));
    return squareDiffs.reduce((a, b) => a + b, 0) / values.length;
  }

  // 获取周期范围
  getPeriodRange(period) {
    const [year, quarter] = period.split('-Q');
    const startMonth = (parseInt(quarter) - 1) * 3 + 1;
    return {
      startDate: new Date(year, startMonth - 1, 1),
      endDate: new Date(year, startMonth + 2, 0)
    };
  }
}

供应商分级策略

根据评估得分实施分级管理:

等级 得分 采购优先级 账期支持 合作策略
A级 90分以上 最高优先级 90天 战略合作,联合创新
B级 75-89分 正常采购 60天 保持合作,持续优化
C级 60-74分 限制采购 30天 需要改进,辅导提升
D级 60分以下 禁止采购 现结 列入黑名单,替换供应商

风险预警机制

// 供应商风险预警
class SupplierRiskWarning {
  // 检查风险指标
  async checkRisk(supplierId) {
    const warnings = [];

    // 1. 连续3次交货延期
    const recentDelay = await this.checkRecentDelays(supplierId);
    if (recentDelay >= 3) {
      warnings.push({
        level: 'high',
        type: 'delivery_delay',
        message: `该供应商近期已有${recentDelay}次交货延期`,
        action: '建议约谈或替换'
      });
    }

    // 2. 连续2批来料不合格
    const recentReject = await this.checkRecentRejects(supplierId);
    if (recentReject >= 2) {
      warnings.push({
        level: 'high',
        type: 'quality_issue',
        message: `该供应商近期已有${recentReject}批来料不合格`,
        action: '暂停采购并要求整改'
      });
    }

    // 3. 价格突然上涨超过20%
    const priceJump = await this.checkPriceIncrease(supplierId);
    if (priceJump > 20) {
      warnings.push({
        level: 'medium',
        type: 'price_increase',
        message: `该供应商价格较上期上涨${priceJump.toFixed(1)}%`,
        action: '需要重新议价或寻找替代供应商'
      });
    }

    // 4. 长期未合作(超过6个月)
    const inactiveDays = await this.checkInactivity(supplierId);
    if (inactiveDays > 180) {
      warnings.push({
        level: 'low',
        type: 'inactive',
        message: `该供应商已${inactiveDays}天无业务往来`,
        action: '评估是否继续合作'
      });
    }

    return warnings;
  }
}

总结

供应商智能评估与分级管理的核心价值:

通过智能化的供应商评估体系,企业可以选择更优质的供应商资源,降低采购风险,提高供应链整体竞争力。

← 下一篇:进销存系统供应商管理智能比价