修改上架作业、面单补打、复核发货页面

This commit is contained in:
zm2000 2026-07-04 14:09:23 +08:00
parent 4d98e54b8e
commit 37715ce396
4 changed files with 105 additions and 89 deletions

View File

@ -57,6 +57,12 @@ export default {
auth: true, auth: true,
method: "POST", method: "POST",
isSystemApi: true isSystemApi: true
},
toOrder: {
path: "index.toOrder",
auth: true,
method: "POST",
isSystemApi: true
} }
}, },
/** 用户 ↓ **/ /** 用户 ↓ **/
@ -157,20 +163,26 @@ export default {
method: "POST", method: "POST",
isSystemApi: true isSystemApi: true
}, },
get: {
path: "storage.entry.get",
auth: true,
method: "POST",
isSystemApi: true
},
containerList: { containerList: {
path: "storage.entry.containerList", path: "storage.entry.containerList",
auth: true, auth: true,
method: "POST", method: "POST",
isSystemApi: true isSystemApi: true
}, },
addDirectInboundItem: { addItem: {
path: "storage.entry.addDirectInboundItem", path: "storage.entry.addItem",
auth: true, auth: true,
method: "POST", method: "POST",
isSystemApi: true isSystemApi: true
}, },
commitDirectInbound: { commit: {
path: "storage.entry.commitDirectInbound", path: "storage.entry.commit",
auth: true, auth: true,
method: "POST", method: "POST",
isSystemApi: true isSystemApi: true
@ -197,12 +209,6 @@ export default {
} }
}, },
directInbound: { directInbound: {
getItems: {
path: "storage.directInbound.getItems",
auth: true,
method: "POST",
isSystemApi: true
},
inbound: { inbound: {
path: "storage.directInbound.inbound", path: "storage.directInbound.inbound",
auth: true, auth: true,

View File

@ -447,7 +447,7 @@ import voice from '@/core/utils/voice';
uni.showLoading({ title: '查询订单中...' }); uni.showLoading({ title: '查询订单中...' });
try { try {
// 1. 查询订单(按快递单号) // 1. 查询订单(按快递单号)
const scanResponse = await this.$http('order.pendingOrder.list', this.buildScanOrderParams(normalizedKeyword)); const scanResponse = await this.$http('common.toOrder', this.buildScanOrderParams(normalizedKeyword));
if (scanResponse?.flag === 'failure') { if (scanResponse?.flag === 'failure') {
const errMsg = String(scanResponse?.message || scanResponse?.msg || '订单查询失败'); const errMsg = String(scanResponse?.message || scanResponse?.msg || '订单查询失败');
uni.hideLoading(); uni.hideLoading();
@ -459,29 +459,21 @@ import voice from '@/core/utils/voice';
let orderIds; let orderIds;
if (this.reprintMode === 'wave') { if (this.reprintMode === 'wave') {
// 整波模式:先取波次号,再查整个波次的所有订单 // 整波模式:取所有波次下的订单ID
const waveNo = this.extractWaveNoFromList(scanResponse); const waves = this.extractWavesFromResponse(scanResponse);
if (!waveNo) { if (!waves.length) {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ title: '未查询到波次号', icon: 'none' }); uni.showToast({ title: '未查询到波次信息', icon: 'none' });
this.addPrintMsg('未查询到波次号'); this.addPrintMsg('未查询到波次信息');
this.speakVoice('无记录'); this.speakVoice('无记录');
return; return;
} }
this.addPrintMsg(`查询到波次: ${waveNo}`); const waveNos = waves.map(w => w.wave_no).filter(Boolean);
const waveResponse = await this.$http('order.pendingOrder.list', this.buildWaveNoParams(waveNo)); this.addPrintMsg(`查询到波次: ${waveNos.join(', ')}`);
if (waveResponse?.flag === 'failure') { orderIds = this.extractOrderIdsFromWaves(waves);
const errMsg = String(waveResponse?.message || waveResponse?.msg || '波次订单查询失败');
uni.hideLoading();
uni.showToast({ title: errMsg, icon: 'none' });
this.addPrintMsg(`波次查询失败: ${errMsg}`);
this.speakVoice('无记录');
return;
}
orderIds = this.extractOrderIdsFromPendingList(waveResponse);
} else { } else {
// 单张模式:直接取当前订单ID // 单张模式:直接取当前订单ID
orderIds = this.extractOrderIdsFromPendingList(scanResponse); orderIds = this.extractOrderIdFromResponse(scanResponse);
} }
if (!orderIds.length) { if (!orderIds.length) {
uni.hideLoading(); uni.hideLoading();
@ -530,38 +522,29 @@ import voice from '@/core/utils/voice';
/* ===== 补打辅助方法 ===== */ /* ===== 补打辅助方法 ===== */
buildScanOrderParams(keyword) { buildScanOrderParams(keyword) {
return { return {
where: { waybill_code: this.normalizeKeyword(keyword)
waybill_codes: {
operator: 'eq',
type: 'text',
value: this.normalizeKeyword(keyword)
}
}
}; };
}, },
buildWaveNoParams(waveNo) { extractOrderIdFromResponse(response) {
return { const id = Number(response?.order_id || 0);
where: { return id > 0 ? [id] : [];
wave_no: { },
operator: 'eq', extractWavesFromResponse(response) {
type: 'text', const waves = Array.isArray(response?.waves) ? response.waves : [];
value: waveNo return waves.filter(w => w && (w.wave_id || w.wave_no));
} },
extractOrderIdsFromWaves(waves) {
if (!Array.isArray(waves)) return [];
const idSet = new Set();
waves.forEach(wave => {
if (Array.isArray(wave?.order_ids)) {
wave.order_ids.forEach(id => {
const nid = Number(id);
if (nid > 0) idSet.add(nid);
});
} }
}; });
}, return [...idSet];
extractOrderIdsFromPendingList(response) {
const list = response?.data?.list || response?.data?.data?.list || response?.list;
if (!Array.isArray(list)) return [];
return list
.map(item => Number(item?.id || 0))
.filter(id => id > 0);
},
extractWaveNoFromList(response) {
const list = response?.data?.list || response?.data?.data?.list || response?.list;
if (!Array.isArray(list) || !list.length) return '';
const first = list.find(item => item && item.wave_no);
return first ? String(first.wave_no).trim() : '';
}, },
extractOrderPrintPayload(response) { extractOrderPrintPayload(response) {
const candidates = [response?.data?.data, response?.data, response?.result, response]; const candidates = [response?.data?.data, response?.data, response?.result, response];

View File

@ -1017,7 +1017,7 @@ import voice from '@/core/utils/voice';
display: flex; display: flex;
align-items: center; align-items: center;
padding: 16rpx 12rpx; padding: 16rpx 12rpx;
border-bottom: 1rpx solid #f2f3f5; border-bottom: 1rpx solid #000000;
} }
.list-table-row:active { .list-table-row:active {
@ -1028,6 +1028,10 @@ import voice from '@/core/utils/voice';
background: #f0f7ff; background: #f0f7ff;
} }
.list-table-row--active .list-table-col {
color: #0050B3;
}
.list-table-row--matched { .list-table-row--matched {
background: #07c160; background: #07c160;
} }
@ -1037,14 +1041,14 @@ import voice from '@/core/utils/voice';
} }
.list-table-col { .list-table-col {
font-size: 30rpx; font-size: 34rpx;
color: #303133; color: #303133;
} }
.list-table-header .list-table-col { .list-table-header .list-table-col {
color: #909399; color: #909399;
font-weight: 500; font-weight: 500;
font-size: 28rpx; font-size: 32rpx;
} }
.list-table-col--no { .list-table-col--no {
@ -1112,19 +1116,19 @@ import voice from '@/core/utils/voice';
} }
.package-info-label { .package-info-label {
font-size: 30rpx; font-size: 34rpx;
color: #909399; color: #909399;
flex-shrink: 0; flex-shrink: 0;
} }
.package-info-value { .package-info-value {
font-size: 30rpx; font-size: 34rpx;
color: #2979ff; color: #2979ff;
font-weight: 500; font-weight: 500;
} }
.package-info-spec { .package-info-spec {
font-size: 30rpx; font-size: 34rpx;
color: #c0c4cc; color: #c0c4cc;
} }

View File

@ -493,6 +493,10 @@ export default {
onResult: this.handleBroadcastResult onResult: this.handleBroadcastResult
}); });
this.safeDispatchBroadcast('resume'); this.safeDispatchBroadcast('resume');
// 每次进入页面时如果数据已清空(如完成入库后)但有关键词,则重新加载
if (!this.hasInboundOrder && this.entryOrderCode && !this.loading) {
this.handleInboundOrderScan(this.entryOrderCode);
}
}, },
onHide() { onHide() {
this.safeDispatchBroadcast('pause'); this.safeDispatchBroadcast('pause');
@ -860,7 +864,7 @@ export default {
} }
uni.showLoading({ title: '提交中...' }); uni.showLoading({ title: '提交中...' });
try { try {
const res = await this.$http('storage.entry.addDirectInboundItem', { const res = await this.$http('storage.entry.addItem', {
entry_order_id: this.entryOrderId, entry_order_id: this.entryOrderId,
stock_id: stockId, stock_id: stockId,
quantity: Number(this.selectedDetail?.actual_quantity || 0), quantity: Number(this.selectedDetail?.actual_quantity || 0),
@ -980,31 +984,58 @@ export default {
}); });
}, },
async handleInboundOrderScan(code) { async handleInboundOrderScan(code) {
// 先清除旧数据,避免页面缓存导致显示陈旧内容
this.handleClearOrder();
uni.showLoading({ title: '查询入库单...' }); uni.showLoading({ title: '查询入库单...' });
try { try {
const res = await this.$http('storage.directInbound.getItems', { entry_order_code: code }); // 1. 先通过 storage.entry.list 按编码查找入库单,获取 ID
if (res?.flag === 'failure') { const listRes = await this.$http('storage.entry.list', {
where: {
entry_order_code: {
field: 'entry_order_code',
operator: 'eq',
type: 'string',
value: code
}
}
});
const listData = listRes?.data?.data || listRes?.data || {};
const entryList = Array.isArray(listData.list) ? listData.list : [];
if (!entryList.length) {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ title: res?.message || '未找到入库单', icon: 'none' }); uni.showToast({ title: '未找到入库单', icon: 'none' });
this.speakVoice('无记录'); this.speakVoice('无记录');
return; return;
} }
const rawData = res?.data?.data ?? res?.data ?? res?.result; const entryId = Number(entryList[0].id);
let items = []; if (!entryId) {
let entryOrder = {}; uni.hideLoading();
let summary = null; uni.showToast({ title: '入库单ID无效', icon: 'none' });
if (Array.isArray(rawData)) { return;
items = rawData;
} else if (rawData && typeof rawData === 'object') {
items = rawData.items || rawData.entryOrderItems || [];
entryOrder = rawData.entryOrder || {};
summary = rawData.summary || null;
} }
// 2. 通过 storage.entry.get 查询入库单详情
const res = await this.$http('storage.entry.get', { id: entryId });
if (res?.flag === 'failure') {
uni.hideLoading();
uni.showToast({ title: res?.message || '查询入库单详情失败', icon: 'none' });
this.speakVoice('无记录');
return;
}
const detailData = res?.data ?? res?.result;
if (!detailData) {
uni.hideLoading();
uni.showToast({ title: '未找到入库单数据', icon: 'none' });
this.speakVoice('无记录');
return;
}
const items = Array.isArray(detailData.items) ? detailData.items : [];
const entryOrder = detailData.entryOrder || {};
const summary = detailData.summary || null;
this.hasInboundOrder = true; this.hasInboundOrder = true;
this.entryOrderId = this.parseEntryOrderId(rawData, entryOrder, items); this.entryOrderId = entryId;
this.entryOrderStoreRemask = String(entryOrder?.store_remask || entryOrder?.store?.store_remask || ''); this.entryOrderStoreRemask = String(entryOrder?.store_remask || entryOrder?.store?.store_remask || '');
this.inboundOrderNo = entryOrder.entry_order_code || code; this.inboundOrderNo = entryOrder.entry_order_code || code;
this.inboundOrderData = rawData; this.inboundOrderData = detailData;
this.summaryData = summary; this.summaryData = summary;
this.inboundItems = this.normalizeInboundItems(items); this.inboundItems = this.normalizeInboundItems(items);
this.currentItemIndex = 0; this.currentItemIndex = 0;
@ -1019,15 +1050,6 @@ export default {
uni.showToast({ title: msg, icon: 'none' }); uni.showToast({ title: msg, icon: 'none' });
} }
}, },
parseEntryOrderId(rawData, entryOrder, items) {
const direct = Number(
entryOrder?.id
?? rawData?.entry_order_id
?? rawData?.entryOrder?.id
?? (Array.isArray(items) && items.length ? items[0]?.entry_order_id : 0)
);
return Number.isFinite(direct) && direct > 0 ? direct : 0;
},
normalizeInboundItems(items) { normalizeInboundItems(items) {
if (!Array.isArray(items)) return []; if (!Array.isArray(items)) return [];
return items return items
@ -1130,7 +1152,7 @@ export default {
if (!res.confirm) return; if (!res.confirm) return;
uni.showLoading({ title: '提交中...' }); uni.showLoading({ title: '提交中...' });
try { try {
const result = await this.$http('storage.entry.commitDirectInbound', { entry_order_id: this.entryOrderId }); const result = await this.$http('storage.entry.commit', { entry_order_id: this.entryOrderId });
uni.hideLoading(); uni.hideLoading();
const isFail = result?.flag === 'failure' || String(result?.code || '') === '500'; const isFail = result?.flag === 'failure' || String(result?.code || '') === '500';
if (isFail) { if (isFail) {
@ -1145,6 +1167,7 @@ export default {
this.speakVoice('入库完成'); this.speakVoice('入库完成');
uni.setStorageSync('random_storage_need_refresh', Date.now()); uni.setStorageSync('random_storage_need_refresh', Date.now());
this.handleClearOrder(); this.handleClearOrder();
setTimeout(() => uni.navigateBack({ delta: 1 }), 300);
} catch (error) { } catch (error) {
uni.hideLoading(); uni.hideLoading();
const msg = String(error?.message || error?.msg || '提交失败'); const msg = String(error?.message || error?.msg || '提交失败');