feat: 更新出仓扫码页并升至1.1.18

This commit is contained in:
2026-11-02 14:24:06 +08:00
parent 61bb43f759
commit 804e1a8f2b
7 changed files with 283 additions and 167 deletions
+45 -1
View File
@@ -125,7 +125,8 @@ export function getFineCodeDisplayWeight(fineCode) {
*/
export function normalizeOrder(order) {
if (!order) return null;
const itemData = groupItemData((order.item_data || []).map((item) => normalizeItem(item)));
const normalizedItems = (order.item_data || []).map((item) => normalizeItem(item));
const itemData = groupItemData(normalizedItems);
return {
id: order.id,
order_no: order.order_no || '',
@@ -149,10 +150,52 @@ export function normalizeOrder(order) {
total_roll: formatRoll(order.total_roll),
total_weight: formatWeightKg(order.total_weight),
item_data: itemData,
summary_rows: buildSummaryRows(normalizedItems),
_raw: order,
};
}
/** 扫码区下方汇总表列(与出仓明细表一致,可横向滑动) */
export const SUMMARY_TABLE_COLUMNS = [
{ label: '坯布编号', key: 'grey_fabric_code', width: 200 },
{ label: '坯布名称', key: 'grey_fabric_name', width: 240 },
{ label: '纱批', key: 'yarn_batch', width: 180 },
{ label: '机台号', key: 'machine_number', width: 160 },
{ label: '条数', key: 'roll', width: 140 },
{ label: '重量', key: 'weight', width: 160 },
];
/** 汇总行归类:坯布编号 + 名称 + 纱批 + 机台号 */
export function getSummaryGroupKey(item) {
return [
item.grey_fabric_code || '',
item.grey_fabric_name || '',
item.yarn_batch || '',
item.machine_number || '',
].join('|');
}
/** 按坯布、纱批、机台号汇总条数和重量,供扫码区表格展示 */
export function buildSummaryRows(items) {
const grouped = new Map();
(items || []).forEach((item) => {
const groupKey = getSummaryGroupKey(item);
const existing = grouped.get(groupKey);
if (!existing) {
grouped.set(groupKey, {
...item,
group_key: groupKey,
fine_codes: [...(item.fine_codes || [])],
});
return;
}
existing.fine_codes.push(...(item.fine_codes || []));
existing.roll = Number((Number(existing.roll || 0) + Number(item.roll || 0)).toFixed(2));
existing.weight = Number((Number(existing.weight || 0) + Number(item.weight || 0)).toFixed(2));
});
return Array.from(grouped.values());
}
/** 扫码详情区汇总维度(勾选后随扫码请求把对应 lock 字段传给后端) */
export const SCAN_GROUP_OPTIONS = [
{ key: 'produce_order_no', label: '合同' },
@@ -441,6 +484,7 @@ export function orderToFormFields(order) {
delivery_time: order.delivery_time,
remark: order.remark,
item_data: order.item_data,
summary_rows: order.summary_rows || [],
};
}