云
17 小时以前 04795d615c7ebbd4ddb9b5637772ea9151c6e4f8
yudao-server/src/main/resources/static/trace.html
@@ -169,6 +169,12 @@
  .card.collapsible .card-bd { display: none; }
  .card.collapsible.open .card-bd { display: block; }
  /* 企业简介 */
  .company-bd { font-size: 14px; color: #4b5563; line-height: 1.85; text-align: justify; }
  .company-bd p + p { margin-top: 10px; }
  .company-stats { margin-bottom: 12px; }
  .company-stats .pill { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
  footer {
    max-width: 480px; margin: 0 auto;
    padding: 20px 16px 28px; text-align: center;
@@ -191,6 +197,26 @@
  </div>
  <section id="state" class="state"></section>
  <!-- 企业简介(常驻底部,默认展开) -->
  <div class="card collapsible open">
    <div class="card-hd" onclick="this.parentNode.classList.toggle('open')">
      <span class="bar"></span>企业简介
      <span class="count">新疆 · 国有控股</span>
    </div>
    <div class="card-bd">
      <div class="pill-list company-stats">
        <span class="pill">成立 2002 年</span>
        <span class="pill">注册资本 1.1 亿元</span>
        <span class="pill">自主品种 61 个</span>
        <span class="pill">研发团队 16 人</span>
      </div>
      <div class="company-bd">
        <p>新疆塔里木河种业股份有限公司于2002年12月30日在新疆维吾尔自治区工商局注册成立,是一家集农作物种子(棉花、小麦、水稻等)育、繁、推、加、销、科服为一体的国有控股公司。公司起始注册资本6500万元,2015年增资后注册资本达1.1亿元,由新农开发、隆平高科、塔里木大学科技公司、巴楚丰和种业四家股东单位组成。旗下拥有两家控股子公司,分别是主营生产、加工、批发销售农作物种子包衣剂的塔河勤丰全资子公司,以及以农作物种子生产、经营及农业技术开发、推广、服务为主的伽师塔河种业公司。</p>
        <p>公司自成立以来,始终坚持以农业种子产业化经营为目标,全力打造“育种能力强、生产加工技术先进、市场营销网络健全、技术推广服务到位”,“育繁推”一体化、“产学研”相结合的现代农作物种子经营企业。公司拥有强有力的16人研发团队,坚持科研创新的原创性,坚持自育为主,同时通过建立联合生态试验站,柔性引智,常年外聘中科院院士、中国农大、浙大、中棉所等12名国内含博导在内的顶级棉花专家团队,与一师农科所开展了连续十五年的院企合作,解决产业前沿信息和优质种质资源“短板”问题。目前,公司拥有自有知识产权品种61个,其中棉花品种46个,粮食品种15个。凭借在种业领域的突出表现,公司相继荣获兵团和国家农业产业化重点龙头企业、高新技术企业、3A信用企业、新疆名牌、中国名牌;国家、自治区3A级标准化良好行为试点企业、中国种业信用骨干企业、自治区企业技术中心、新疆产学研联合开发示范基地、兵团首批创新型企业、全国农垦农作物良种展示示范基地等荣誉称号。自2020年起,公司棉花商品种子销售连续位居全国榜首,2022年入选国家农作物种业棉花补短板阵型企业,2023年1月荣获新疆农作物种业优势企业,2025年7月荣获兵团创新型和“专精特新”企业称号,2025年8月“机采棉新品种选育及提质增效关键技术集成应用”获得兵团科技进步奖一等奖,2026年荣获全国棉花种子育繁推生产经营A证。</p>
      </div>
    </div>
  </div>
</div>
<footer>本系统数据仅用于产品溯源,请通过正规渠道购买。</footer>
@@ -203,10 +229,14 @@
  var CODE_INPUT = document.getElementById('codeInput');
  var SEARCH_BTN = document.getElementById('searchBtn');
  var BATCH_STATUS = { 10: ['草稿', 'gray'], 20: ['生产中', 'blue'], 30: ['已完成', 'green'], 40: ['已作废', 'red'] };
  var BAG_STATUS = { 10: ['已生成', 'gray'], 20: ['已导出印刷', 'blue'], 30: ['已作废', 'red'] };
  var QUALITY_RESULT = { 0: ['处理中', 'gray'], 1: ['合格', 'green'], 2: ['不合格', 'red'] };
  var WORKER_TYPE = { 10: '组长', 20: '操作工', 30: '包装工', 40: '质检员', 50: '其他' };
  var FLOW_DIRECTION = { 1: ['入库', 'green'], 2: ['出库', 'blue'] };
  var FLOW_BIZ_TYPE = {
    110: '采购入库', 111: '采购入库取消', 112: '调拨出库', 113: '调拨入库',
    114: '其他出库', 115: '其他入库', 116: '生产领料', 117: '生产退料',
    118: '生产入库', 119: '销售出库', 120: '销售退货入库', 121: '外协发料',
    122: '外协入库', 123: '生产消耗', 124: '产品产出', 125: '供应商退货出库',
    126: '库存调整入库', 127: '库存调整出库'
  };
  // ========== 工具函数 ==========
  function esc(v) {
@@ -293,12 +323,6 @@
    var html = '';
    html += buildVerifyCard(d);
    html += buildItemCard(d);
    html += buildBatchCard(d);
    html += buildQualityCard(d);
    html += buildWorkerCard(d);
    html += buildInboundCard(d);
    html += buildPalletCard(d);
    html += buildBagCard(d);
    html += buildOptionalCard(d);
    STATE.innerHTML = html || '<div class="empty-tip">暂无追溯数据</div>';
    window.scrollTo({ top: 0, behavior: 'smooth' });
@@ -360,117 +384,7 @@
    );
  }
  // 区块2:生产批次
  function buildBatchCard(d) {
    if (!d.batchCode && !d.tempCode) return '';
    var status = statusBadge(BATCH_STATUS, d.batchStatus);
    return card('生产批次', status,
      kv('批次号', text(d.batchCode)) +
      kv('状态', status) +
      kv('生产日期', fmtDate(d.produceDate)) +
      kv('产线', text(d.lineName ? (d.lineName + (d.lineCode ? ' / ' + d.lineCode : '')) : d.lineCode)) +
      kv('责任人', text(d.ownerUserName)) +
      kv('计划数量', fmtNum(d.planQuantity) === '-' ? '-' : fmtNum(d.planQuantity)) +
      kv('已生成袋码', fmtNum(d.bagQuantity)) +
      kv('已生成托盘', fmtNum(d.palletQuantity)) +
      kv('入库时间', fmtDate(d.inboundTime)) +
      (d.remark ? kv('备注', text(d.remark)) : ''),
      { collapsible: true, open: true }
    );
  }
  // 区块3:种子质检
  function buildQualityCard(d) {
    var q = d.quality;
    if (!q) return '';
    var result = QUALITY_RESULT[q.result];
    var badge = result
      ? '<span class="badge-big ' + result[1] + '">' + esc(result[0]) + '</span>'
      : '<span class="badge-big gray">未知</span>';
    var rows = '';
    if (q.indicators && q.indicators.length) {
      rows = '<table class="mini-table"><thead><tr><th>指标</th><th>检测值</th><th>标准范围</th><th>结果</th></tr></thead><tbody>';
      q.indicators.forEach(function (i) {
        var range = (i.minValue !== null && i.minValue !== undefined && i.maxValue !== null && i.maxValue !== undefined)
          ? esc(i.minValue) + ' ~ ' + esc(i.maxValue) : '-';
        var pass = (i.pass === true)
          ? '<span class="badge green">合格</span>'
          : (i.pass === false ? '<span class="badge red">不合格</span>' : '<span class="badge gray">--</span>');
        rows += '<tr><td>' + text(i.indicatorName) + '</td><td>' + text(i.value) + '</td><td>' + range + '</td><td>' + pass + '</td></tr>';
      });
      rows += '</tbody></table>';
    }
    return card('种子质检', badge,
      kv('检验结论', badge) +
      kv('检验员', text(q.inspectorName)) +
      kv('检验时间', fmtDate(q.inspectedAt)) +
      (q.reason ? kv('不合格原因', text(q.reason)) : '') +
      (rows ? '<div style="margin-top:8px">' + rows + '</div>' : ''),
      { collapsible: true, open: false }
    );
  }
  // 区块4:生产人员
  function buildWorkerCard(d) {
    if (isEmptyList(d.workers)) return '';
    var html = '<div class="pill-list">';
    d.workers.forEach(function (w) {
      var name = w.userName || '-';
      var type = w.workerTypeName || (WORKER_TYPE[w.workerType] || '');
      var color = { 10: 'var(--blue)', 20: 'var(--green)', 30: 'var(--primary-light)', 40: 'var(--red)', 50: 'var(--gray)' }[w.workerType] || 'var(--gray)';
      html += '<span class="pill"><span class="dot" style="background:' + color + '"></span>' +
        esc(type) + ':' + esc(name) + '</span>';
    });
    html += '</div>';
    return card('生产人员', null, html, { collapsible: true, open: false });
  }
  // 区块5:扫码入库事件
  function buildInboundCard(d) {
    var e = d.inbound;
    if (!e) return '';
    return card('扫码入库', null,
      kv('事件号', text(e.eventId)) +
      kv('入库数量', fmtNum(e.quantity)) +
      kv('设备编码', text(e.deviceCode)) +
      kv('产线', text(e.lineCode)) +
      kv('入库时间', fmtDate(e.eventTime)),
      { collapsible: true, open: false }
    );
  }
  // 区块6:托盘
  function buildPalletCard(d) {
    if (isEmptyList(d.pallets)) return '';
    var countHtml = '共 ' + esc(d.palletCount || d.pallets.length) + ' 个';
    var rows = '<table class="mini-table"><thead><tr><th>托盘码</th><th>序号</th><th>已装/可装</th></tr></thead><tbody>';
    d.pallets.forEach(function (p) {
      rows += '<tr><td>' + text(p.code) + '</td><td>' + fmtNum(p.palletNo) + '</td><td>' +
        fmtNum(p.bagCount) + ' / ' + fmtNum(p.capacity) + '</td></tr>';
    });
    rows += '</tbody></table>';
    return card('托盘信息', countHtml, rows, { collapsible: true, open: false });
  }
  // 区块7:袋码(一袋一码)
  function buildBagCard(d) {
    if (d.bagTotal === null || d.bagTotal === undefined || d.bagTotal === 0) return '';
    var countHtml = '共 ' + esc(d.bagTotal) + ' 个' + (d.bags && d.bags.length < d.bagTotal ? '(展示前 ' + esc(d.bags.length) + ' 个)' : '');
    var rows = '<table class="mini-table"><thead><tr><th>袋码</th><th>袋号</th><th>托盘</th><th>状态</th></tr></thead><tbody>';
    (d.bags || []).forEach(function (b) {
      rows += '<tr><td>' + text(b.code) + '</td><td>' + fmtNum(b.bagNo) + '</td><td>' + text(b.palletCode) + '</td><td>' +
        statusBadge(BAG_STATUS, b.status) + '</td></tr>';
    });
    rows += '</tbody></table>';
    return card('袋码信息', countHtml,
      '<div class="scroll-list">' + rows + '</div>',
      { collapsible: true, open: false }
    );
  }
  // 区块8:可选扩展(采购来源 / 销售去向 / 加工流转),有数据才展示
  // 区块2:可选扩展(采购来源 / 种子流向信息(仅销售出库) / 加工流转),有数据才展示
  function buildOptionalCard(d) {
    var html = '';
    if (!isEmptyList(d.purchaseSources)) {
@@ -481,13 +395,26 @@
      rows += '</tbody></table>';
      html += card('采购来源', null, rows, { collapsible: true, open: false });
    }
    if (!isEmptyList(d.salesTargets)) {
      var rows2 = '<table class="mini-table"><thead><tr><th>销售出库单</th><th>客户</th><th>数量</th><th>日期</th></tr></thead><tbody>';
      d.salesTargets.forEach(function (s) {
        rows2 += '<tr><td>' + text(s.outCode || s.salesOrderCode || '') + '</td><td>' + text(s.customerName) + '</td><td>' + fmtNum(s.quantity) + '</td><td>' + fmtDate(s.outTime) + '</td></tr>';
    // 只展示销售出库(bizType=119)的流水,生产入库/产品产出等不展示
    var salesFlows = (d.seedFlows || []).filter(function (f) { return f.bizType === 119; });
    if (!isEmptyList(salesFlows)) {
      var rows2 = '<table class="mini-table"><thead><tr><th>方向</th><th>业务</th><th>来源单号</th><th>客户</th><th>数量</th><th>时间</th><th>仓库/库区</th></tr></thead><tbody>';
      salesFlows.forEach(function (f) {
        var qty = (f.quantity === null || f.quantity === undefined) ? '-' : fmtNum(Math.abs(Number(f.quantity)));
        var wh = [f.warehouseName, f.locationName].filter(Boolean).join(' / ') || '-';
        rows2 += '<tr><td>' + statusBadge(FLOW_DIRECTION, f.type) + '</td><td>' + text(FLOW_BIZ_TYPE[f.bizType] || f.bizType) +
          '</td><td>' + text(f.bizCode) + '</td><td>' + text(f.clientName) + '</td><td>' + qty + '</td><td>' +
          fmtDate(f.transactionTime) + '</td><td>' + text(wh) + '</td></tr>';
      });
      rows2 += '</tbody></table>';
      html += card('销售去向', null, rows2, { collapsible: true, open: false });
      html += card('种子流向信息', null, rows2, { collapsible: true, open: false });
    } else if (!isEmptyList(d.salesTargets)) {
      var rows2b = '<table class="mini-table"><thead><tr><th>销售出库单</th><th>客户</th><th>数量</th><th>日期</th></tr></thead><tbody>';
      d.salesTargets.forEach(function (s) {
        rows2b += '<tr><td>' + text(s.salesCode || s.salesOrderCode || '') + '</td><td>' + text(s.clientName) + '</td><td>' + fmtNum(s.quantity) + '</td><td>' + fmtDate(s.salesDate) + '</td></tr>';
      });
      rows2b += '</tbody></table>';
      html += card('种子流向信息', null, rows2b, { collapsible: true, open: false });
    }
    if (!isEmptyList(d.processTraces)) {
      var rows3 = '<table class="mini-table"><thead><tr><th>节点</th><th>说明</th><th>时间</th></tr></thead><tbody>';