From f7273277023f3497ac071bf98f556a569cb4dd25 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 17 九月 2026 16:24:10 +0800
Subject: [PATCH] feat(mes): 重构袋码生成与物料分类功能
---
yudao-server/src/main/resources/static/trace.html | 128 +-----------------------------------------
1 files changed, 5 insertions(+), 123 deletions(-)
diff --git a/yudao-server/src/main/resources/static/trace.html b/yudao-server/src/main/resources/static/trace.html
index ef2439c..2ff37d7 100644
--- a/yudao-server/src/main/resources/static/trace.html
+++ b/yudao-server/src/main/resources/static/trace.html
@@ -229,10 +229,6 @@
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: '璋冩嫧鍏ュ簱',
@@ -327,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' });
@@ -394,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('璐d换浜�', 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)) {
@@ -515,9 +395,11 @@
rows += '</tbody></table>';
html += card('閲囪喘鏉ユ簮', null, rows, { collapsible: true, open: false });
}
- if (!isEmptyList(d.seedFlows)) {
+ // 鍙睍绀洪攢鍞嚭搴擄紙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>';
- d.seedFlows.forEach(function (f) {
+ 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) +
--
Gitblit v1.9.3