| | |
| | | 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) { |
| | |
| | | ); |
| | | } |
| | | |
| | | // 区块8:可选扩展(采购来源 / 销售去向 / 加工流转),有数据才展示 |
| | | // 区块8:可选扩展(采购来源 / 种子流向信息(销售出库) / 加工流转),有数据才展示 |
| | | function buildOptionalCard(d) { |
| | | var html = ''; |
| | | if (!isEmptyList(d.purchaseSources)) { |
| | |
| | | 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>'; |
| | | if (!isEmptyList(d.seedFlows)) { |
| | | 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) { |
| | | 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>'; |