diff --git a/inventory-web/src/api/inbound/return.ts b/inventory-web/src/api/inbound/return.ts new file mode 100644 index 0000000..9d7b6f5 --- /dev/null +++ b/inventory-web/src/api/inbound/return.ts @@ -0,0 +1,86 @@ +import request from '@/utils/request' + +// ============================================================================ +// 逆向物流(原单退回 + 不良品在管台账) +// +// 后端路由见 inventory-backend/app/api/v1/inbound/stock.py +// 设计要点: +// · 良品退回 → 直接加回原库存行 +// · 不良品退回 → 不进库存表,转入 trans_defective_goods 在管台账, +// 修好后回库 / 无法维修则报废销毁 +// ============================================================================ + +/** + * 原单退回。 + * + * @param data { + * outbound_id: number 必填,trans_outbound.id(出库**明细行**主键,非单号) + * return_qty: number 必填,本次退回数量(>0) + * is_defective: boolean 必填,true=不良品转在管台账,false=良品加回库存 + * reason: string 可选,退回原因 + * } + */ +export function returnFromOutbound(data: { + outbound_id: number + return_qty: number + is_defective: boolean + reason?: string +}) { + return request({ + url: '/inbound/stock/return-from-outbound', + method: 'post', + data + }) +} + +/** + * 不良品在管台账分页查询。 + * + * @param params { page, page_size, status?, keyword?, start_date?, end_date? } + * status 传 '全部' 或留空表示不过滤 + */ +export function getDefectiveList(params: { + page?: number + page_size?: number + status?: string + keyword?: string + start_date?: string + end_date?: string + company_name?: string +}) { + return request({ + url: '/inbound/stock/defective', + method: 'get', + params + }) +} + +/** + * 修复回库:把修好的数量加回原库存行。 + * + * @param id 在管台账 id + * @param data { restock_qty?: number, remark?: string } + * restock_qty 缺省 = 全部剩余在管量 + */ +export function restockDefective(id: number, data: { restock_qty?: number; remark?: string }) { + return request({ + url: `/inbound/stock/defective/${id}/restock`, + method: 'post', + data + }) +} + +/** + * 报废销毁:在管坏件确认无法维修时销毁。 + * + * @param id 在管台账 id + * @param data { scrap_qty?: number, reason: string } + * reason 必填;scrap_qty 缺省 = 全部剩余在管量 + */ +export function scrapDefective(id: number, data: { scrap_qty?: number; reason: string }) { + return request({ + url: `/inbound/stock/defective/${id}/scrap`, + method: 'post', + data + }) +} diff --git a/inventory-web/src/router/index.ts b/inventory-web/src/router/index.ts index 87de087..382d5a1 100644 --- a/inventory-web/src/router/index.ts +++ b/inventory-web/src/router/index.ts @@ -106,6 +106,14 @@ const routes: Array = [ name: 'RepairManagement', component: () => import('@/views/stock/inbound/repair.vue'), meta: { title: '维修管理', permission: 'inbound_repair' } + }, + // ★ 不良品在管台账(逆向物流):退回的坏件不入库存表, + // 实物在仓但不在库存行中,故单独成页承载其去向与处置。 + { + path: 'defective', + name: 'DefectiveGoods', + component: () => import('@/views/stock/defective/index.vue'), + meta: { title: '不良品在管台账', permission: 'inventory_stocktake' } } ] }, diff --git a/inventory-web/src/views/outbound/index.vue b/inventory-web/src/views/outbound/index.vue index 9f09a7e..8c9c88e 100644 --- a/inventory-web/src/views/outbound/index.vue +++ b/inventory-web/src/views/outbound/index.vue @@ -120,6 +120,28 @@ ¥{{ row.subtotal.toFixed(2) }} + + + + + @@ -183,18 +205,94 @@ @current-change="handlePageChange" /> + + + + + + + {{ returnDialog.row?.name || '-' }} + / {{ returnDialog.row?.sku || '-' }} + + + + {{ returnDialog.row?.quantity ?? 0 }} + + + {{ returnDialog.row?.returned_quantity ?? 0 }} + + + + {{ returnDialog.row?.returnable_quantity ?? 0 }} + + + + + + + + + + + + + + + + + + + + + + +