diff --git a/core/request/apis.js b/core/request/apis.js index 45ad266..7157a52 100644 --- a/core/request/apis.js +++ b/core/request/apis.js @@ -109,6 +109,15 @@ export default { isSystemApi: true } }, + /** 仓库 ↓ **/ + warehouse: { + getSpaceInfo: { + path: "warehouse.getSpaceInfo", + auth: true, + method: "POST", + isSystemApi: true + } + }, /** 工作台 ↓ **/ workbench: { list: { @@ -307,6 +316,14 @@ export default { isSystemApi: true } }, + transaction: { + list: { + path: "storage.transaction.list", + auth: true, + method: "POST", + isSystemApi: true + } + }, directInbound: { inbound: { path: "storage.directInbound.inbound", diff --git a/pages.json b/pages.json index 747256f..ddddbf6 100644 --- a/pages.json +++ b/pages.json @@ -117,6 +117,13 @@ "titleNView": false } }, + { + "path" : "pages/warehouse/inventoryTransfer", + "style" : + { + "titleNView": false + } + }, { "path" : "pages/403", "style" : diff --git a/pages/home/edit-quick-actions.vue b/pages/home/edit-quick-actions.vue index 029eb04..02f807b 100644 --- a/pages/home/edit-quick-actions.vue +++ b/pages/home/edit-quick-actions.vue @@ -321,6 +321,7 @@ const isLabelReprint = menuName === '面单补打' || (menuName.includes('面单') && menuName.includes('补打')); const isBlockRegistration = menuName === '拦截登记'; const isPickingRecord = menuName === '拣货记录' || (menuName.includes('拣货') && menuName.includes('记录')); + const isTransferRecord = menuName === '移库记录' || (menuName.includes('移库') && menuName.includes('记录')); const rawPath = item?.component || item?.path || ''; const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : ''; const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库')); @@ -337,6 +338,10 @@ this.$tools.routerTo('/pages/work/storage/random-storage'); return; } + if (isTransferRecord) { + this.$tools.routerTo('/pages/warehouse/inventoryTransfer'); + return; + } const targetPath = isGoodsQuery ? '/pages/work/product/query' : (isOrderPicking diff --git a/pages/index/index.vue b/pages/index/index.vue index 8d638ff..408e375 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1192,6 +1192,7 @@ const isLabelReprint = menuName === '面单补打' || (menuName.includes('面单') && menuName.includes('补打')); const isBlockRegistration = menuName === '拦截登记'; const isPickingRecord = menuName === '拣货记录' || (menuName.includes('拣货') && menuName.includes('记录')); + const isTransferRecord = menuName === '移库记录' || (menuName.includes('移库') && menuName.includes('记录')); const rawPath = item?.component || item?.path || ''; const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : ''; const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库')); @@ -1212,6 +1213,10 @@ this.$tools.routerTo('/pages/warehouse/locationInquiry'); return; } + if (isTransferRecord) { + this.$tools.routerTo('/pages/warehouse/inventoryTransfer'); + return; + } const targetPath = isGoodsQuery ? '/pages/work/product/query' : (isOrderPicking diff --git a/pages/warehouse/inventoryTransfer.vue b/pages/warehouse/inventoryTransfer.vue new file mode 100644 index 0000000..f2978c3 --- /dev/null +++ b/pages/warehouse/inventoryTransfer.vue @@ -0,0 +1,655 @@ + + + + + diff --git a/pages/work/order/weighing.vue b/pages/work/order/weighing.vue index de8ec32..8bada86 100644 --- a/pages/work/order/weighing.vue +++ b/pages/work/order/weighing.vue @@ -97,7 +97,8 @@ import voice from '@/core/utils/voice'; manualWeight: '', weightFocused: false, submitting: false, - showOrderInfo: false + showOrderInfo: false, + isGroupOrder: false }; }, onLoad() { @@ -144,130 +145,95 @@ import voice from '@/core/utils/voice'; speakVoice(text) { voice.speak(text, { minInterval: 800 }); }, - async fetchOrderDetail(code) { - try { - const toOrderRes = await this.$http('common.toOrder', { waybill_code: code }, '', false); - if (toOrderRes && toOrderRes.flag !== 'failure') { - const rawOrderId = Number(toOrderRes.order_id); - if (rawOrderId > 0) { - this.orderInfo.order_id = rawOrderId; - } - this.waves = Array.isArray(toOrderRes.waves) ? toOrderRes.waves : []; - - // 调用 order.detail 获取订单详情 - try { - const detailRes = await this.$http('order.detail', { order_id: this.orderInfo.order_id, tableType: 'dispatch' }, '', false); - if (detailRes && detailRes.flag !== 'failure') { - const detailData = detailRes.data || {}; - this.orderDetail = detailData.detail || null; - this.orderItems = detailData.items || []; - this.expresses = detailData.expresses || []; - - // 从订单详情中更新商品净重(仅在扫码接口未提供子单净重时,用主单净重兜底) - if (!this.netWeight && detailData.detail && detailData.detail.items_weight !== undefined && detailData.detail.items_weight !== null) { - this.netWeight = detailData.detail.items_weight; - } - // 从运单信息中更新称重重量:仅当扫描的子单号能精确匹配到对应运单时才填充, - // 匹配不到时称重重量留空,避免误用主单/其它运单的重量,由用户手动输入 - const matchedExpress = (detailData.expresses || []).find(exp => exp.waybill_code === code); - if (matchedExpress && matchedExpress.weighing_weight !== undefined && matchedExpress.weighing_weight !== null) { - this.manualWeight = String(Math.round(matchedExpress.weighing_weight)); - } else { - this.manualWeight = ''; - } - } - } catch (e) { - console.error('获取订单详情失败', e); - } - } - } catch (e) { - console.error('获取波次信息失败', e); - } - }, async fetchOrderInfo(code) { uni.showLoading({ title: '查询中...' }); try { - const res = await this.$http('order.recheckOrder.scanOrder', { waybill_code: code }, '', false); - if (res && res.flag !== 'failure') { - const data = res.data || {}; - - if (data.list_type === 'single') { - // 散单模式 - const orderItem = (data.list || []).find( - item => item.waybill_no === code - ); - if (!orderItem) { - uni.showToast({ title: '未找到匹配订单', icon: 'none' }); - this.speakVoice('无记录'); - return; - } - if (!orderItem.is_reviewed) { - uni.showToast({ title: '订单未复核', icon: 'none' }); - this.speakVoice('订单未复核'); - this.showOrderInfo = false; - this.orderInfo = { order_id: 0, waybill_code: '' }; - this.waves = []; - this.orderDetail = null; - this.orderItems = []; - this.expresses = []; - this.netWeight = ''; - this.manualWeight = ''; - return; - } - this.orderInfo = { - order_id: orderItem.order_id || 0, - waybill_code: orderItem.waybill_no || code - }; - this.netWeight = orderItem.items_weight ?? ''; - this.manualWeight = orderItem.items_weight ? String(orderItem.items_weight) : ''; - } else { - // 团购模式 — 由后端按运单号处理 - const waveItem = (data.list || [])[0]; - const hasUnreviewed = waveItem && waveItem.unreviewed_count > 0; - if (hasUnreviewed) { - uni.showToast({ title: '订单未复核', icon: 'none' }); - this.speakVoice('订单未复核'); - this.showOrderInfo = false; - this.orderInfo = { order_id: 0, waybill_code: '' }; - this.waves = []; - this.orderDetail = null; - this.orderItems = []; - this.expresses = []; - this.netWeight = ''; - this.manualWeight = ''; - return; - } - this.orderInfo = { - order_id: 0, - waybill_code: code - }; - this.netWeight = waveItem?.items_weight ?? ''; - this.manualWeight = waveItem?.items_weight ? String(waveItem.items_weight) : ''; - } - - // 调用 index.toOrder 获取订单ID及所属波次信息(已提取到 fetchOrderDetail 方法) - await this.fetchOrderDetail(code); - - this.showOrderInfo = true; - // 自动聚焦称重重量输入框 - this.$nextTick(() => { - this.weightFocused = true; - }); - } else if (res && res.message === '接口错误: 未找到对应订单') { - // 未找到对应订单时跳过未复核检测,继续查询 - this.orderInfo = { - order_id: 0, - waybill_code: code - }; - this.showOrderInfo = true; - await this.fetchOrderDetail(code); - this.$nextTick(() => { - this.weightFocused = true; - }); - } else { - uni.showToast({ title: res.msg || '查询失败', icon: 'none' }); + // 1. 按运单号获取订单ID及所属波次信息 + const toOrderRes = await this.$http('common.toOrder', { waybill_code: code }, '', false); + if (!toOrderRes || toOrderRes.flag === 'failure') { + uni.showToast({ title: (toOrderRes && (toOrderRes.msg || toOrderRes.message)) || '查询失败', icon: 'none' }); this.speakVoice('无记录'); + return; } + const rawOrderId = Number(toOrderRes.order_id); + if (!(rawOrderId > 0)) { + uni.showToast({ title: '未找到对应订单', icon: 'none' }); + this.speakVoice('无记录'); + return; + } + this.waves = Array.isArray(toOrderRes.waves) ? toOrderRes.waves : []; + + // 2. 获取订单详情(区分散单/团单、校验复核状态、取商品净重与运单称重重量) + const detailRes = await this.$http('order.detail', { order_id: rawOrderId, tableType: 'dispatch' }, '', false); + if (!detailRes || detailRes.flag === 'failure') { + uni.showToast({ title: (detailRes && (detailRes.msg || detailRes.message)) || '查询失败', icon: 'none' }); + this.speakVoice('无记录'); + return; + } + const detailData = detailRes.data || {}; + const detail = detailData.detail || {}; + this.orderDetail = detail; + this.orderItems = detailData.items || []; + this.expresses = detailData.expresses || []; + + // 3. 区分散单/团单:团单波次号前缀为 B,其余波次前缀为散单 + const waveNo = String(detail.wave_no || '').trim(); + this.isGroupOrder = waveNo.startsWith('B'); + console.log('[称重] 波次号:', waveNo, this.isGroupOrder ? '团单' : '散单'); + + // 4. 校验:未拣货不允许称重(散单/团单均校验) + const pick = String(detail.pick_status ?? '').trim().toLowerCase(); + const pickDone = pick === 'fin' || pick === 'finished' || pick === '1'; + if (!pickDone) { + uni.showToast({ title: '订单未拣货,禁止称重', icon: 'none' }); + this.speakVoice('订单未拣货,禁止称重'); + this.clearOrderData(); + return; + } + + // 5. 校验:未复核不允许称重(散单/团单均校验) + const recheck = String(detail.recheck_status ?? '').trim().toLowerCase(); + const recheckDone = recheck === 'fin' || recheck === 'finished' || recheck === '1'; + if (!recheckDone) { + uni.showToast({ title: '订单未复核,禁止称重', icon: 'none' }); + this.speakVoice('订单未复核,禁止称重'); + this.clearOrderData(); + return; + } + + // 6. 校验:散单未打包不允许称重(仅散单校验,pack_status 为 fin 视为已打包) + if (!this.isGroupOrder) { + const packStatus = String(detail.pack_status ?? '').trim().toLowerCase(); + const packDone = packStatus === 'fin' || packStatus === 'finished' || packStatus === '1'; + if (!packDone) { + uni.showToast({ title: '订单未打包,禁止称重', icon: 'none' }); + this.speakVoice('订单未打包,禁止称重'); + this.clearOrderData(); + return; + } + } + + this.orderInfo = { + order_id: rawOrderId, + waybill_code: code + }; + + // 商品净重:散单/团单均取订单详情 items_weight + this.netWeight = detail.items_weight ?? ''; + + // 称重重量:仅当扫描的运单号能精确匹配到对应运单时才回填,否则留空由用户手动输入 + const matchedExpress = (detailData.expresses || []).find(exp => exp.waybill_code === code); + if (matchedExpress && matchedExpress.weighing_weight !== undefined && matchedExpress.weighing_weight !== null) { + this.manualWeight = String(Math.round(matchedExpress.weighing_weight)); + } else { + this.manualWeight = ''; + } + + this.showOrderInfo = true; + // 自动聚焦称重重量输入框 + this.$nextTick(() => { + this.weightFocused = true; + }); } catch (e) { uni.showToast({ title: '网络异常', icon: 'none' }); this.speakVoice('无记录'); @@ -275,6 +241,17 @@ import voice from '@/core/utils/voice'; uni.hideLoading(); } }, + clearOrderData() { + this.showOrderInfo = false; + this.orderInfo = { order_id: 0, waybill_code: '' }; + this.waves = []; + this.orderDetail = null; + this.orderItems = []; + this.expresses = []; + this.netWeight = ''; + this.manualWeight = ''; + this.isGroupOrder = false; + }, handleSubmitWeight() { if (!this.manualWeight) { uni.showToast({ title: '请输入称重重量', icon: 'none' }); @@ -322,6 +299,7 @@ import voice from '@/core/utils/voice'; this.manualWeight = ''; this.weightFocused = false; this.showOrderInfo = false; + this.isGroupOrder = false; this.scanFocused = true; } }