Commit fc7768a6 by qinjianhui

feat: 缺货标记

parent f922e81d
...@@ -196,6 +196,17 @@ export function restockCheckApi( ...@@ -196,6 +196,17 @@ export function restockCheckApi(
) )
} }
/** 按仓库标记缺货:同一仓库一次请求,多个 SKU 传 warehouseSkuList */
export function markStockOutOfApi(data: {
warehouseId: number | string
warehouseSkuList: string[]
}) {
return axios.post<never, BaseRespData<void>>(
'factory/podOrder/outOfStock/batchAutoMark',
data,
)
}
export function pickCompleteByIdsDataApi(ids: (number | string)[]) { export function pickCompleteByIdsDataApi(ids: (number | string)[]) {
return axios.post< return axios.post<
never, never,
......
...@@ -226,7 +226,7 @@ export interface RestockData { ...@@ -226,7 +226,7 @@ export interface RestockData {
export interface PickCompleteData { export interface PickCompleteData {
id: number id: number
warehouseId?: number warehouseId: number
warehouseName?: string warehouseName?: string
skuImage?: string skuImage?: string
productName?: string productName?: string
......
...@@ -26,6 +26,26 @@ ...@@ -26,6 +26,26 @@
{{ item.operationNo }} {{ item.operationNo }}
</span> </span>
</template> </template>
<template #top_left>
<el-tooltip
v-if="item.outOfStock"
effect="light"
content="缺货"
placement="bottom"
>
<div
style="
background-color: #F56C6C;
color: #fff;
padding: 2px 4px;
border-radius: 4px;
font-size: 12px;
"
>
</div>
</el-tooltip>
</template>
<template #top_right> <template #top_right>
<img <img
v-if="item.craftCode && ['ZPZY', 'CXZY', 'THZY'].includes(item.craftCode as string)" v-if="item.craftCode && ['ZPZY', 'CXZY', 'THZY'].includes(item.craftCode as string)"
...@@ -249,7 +269,10 @@ ...@@ -249,7 +269,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { getCardLayoutListApi, getFactoryOrderNewLogApi } from '@/api/factoryOrderNew' import {
getCardLayoutListApi,
getFactoryOrderNewLogApi,
} from '@/api/factoryOrderNew'
import type { PaginationData } from '@/types/api' import type { PaginationData } from '@/types/api'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import { operateOrderListData } from '@/types/api/factoryOrderNew' import { operateOrderListData } from '@/types/api/factoryOrderNew'
......
...@@ -121,6 +121,7 @@ import { ...@@ -121,6 +121,7 @@ import {
pickCompleteByIdsDataApi, pickCompleteByIdsDataApi,
pickCompleteApi, pickCompleteApi,
replenishmentCompleteApi, replenishmentCompleteApi,
markStockOutOfApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import type { PickCompleteData } from '@/types/api/factoryOrderNew' import type { PickCompleteData } from '@/types/api/factoryOrderNew'
import type { BaseRespData } from '@/types/api' import type { BaseRespData } from '@/types/api'
...@@ -536,6 +537,35 @@ const handleSubmit = async () => { ...@@ -536,6 +537,35 @@ const handleSubmit = async () => {
try { try {
const res = await submitApi.value(orderIds as (number | string)[]) const res = await submitApi.value(orderIds as (number | string)[])
if (res.code !== 200) return if (res.code !== 200) return
const pickFailedOrderList = pickData.value?.pickingSituationList?.filter(
(item) => item.pickingStatus !== 'success',
)
if (pickFailedOrderList && pickFailedOrderList.length > 0) {
const warehouseMap: Record<number, PickCompleteData[]> = {}
for (const item of pickFailedOrderList) {
const wid = item.warehouseId
if (!warehouseMap[wid]) warehouseMap[wid] = []
warehouseMap[wid].push(item)
}
try {
for (const [widStr, rows] of Object.entries(warehouseMap)) {
const warehouseSkuList = [
...new Set(
rows
.map((r) => r.thirdSkuCode)
.filter((s): s is string => typeof s === 'string' && s !== ''),
),
]
const markRes = await markStockOutOfApi({
warehouseId: widStr,
warehouseSkuList,
})
if (markRes.code !== 200) return
}
} catch (e) {
console.error(e)
}
}
ElMessage.success(dialogTitle.value) ElMessage.success(dialogTitle.value)
visible.value = false visible.value = false
emit('success') emit('success')
......
...@@ -65,19 +65,19 @@ ...@@ -65,19 +65,19 @@
<CreateOutboundDialog <CreateOutboundDialog
ref="createOutboundDialogRef" ref="createOutboundDialogRef"
@success="() => { @success="
visible = false () => {
emit('success') visible = false
}" emit('success')
}
"
/> />
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { ref } from 'vue' import { ref } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { import { applyForReplenishByIdApi } from '@/api/factoryOrderNew'
applyForReplenishByIdApi,
} from '@/api/factoryOrderNew'
import type { operateOrderListData } from '@/types/api/factoryOrderNew' import type { operateOrderListData } from '@/types/api/factoryOrderNew'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import _ from 'lodash' import _ from 'lodash'
...@@ -117,7 +117,7 @@ const columns = [ ...@@ -117,7 +117,7 @@ const columns = [
key: 'batchArrangeNumber', key: 'batchArrangeNumber',
prop: 'batchArrangeNumber', prop: 'batchArrangeNumber',
label: '款号', label: '款号',
width: 100, width: 140,
align: 'center', align: 'center',
}, },
{ {
...@@ -280,7 +280,9 @@ const handleCreateOutbound = () => { ...@@ -280,7 +280,9 @@ const handleCreateOutbound = () => {
.filter((item) => item.suggestOutQuantity !== 0) .filter((item) => item.suggestOutQuantity !== 0)
if (items.length === 0) { if (items.length === 0) {
ElMessage.warning('建议出库数量=0,无法快速创建出库单!') ElMessageBox.alert('建议出库数量=0,无法快速创建出库单!', '提示', {
type: 'warning',
})
return return
} }
......
...@@ -478,11 +478,11 @@ ...@@ -478,11 +478,11 @@
>更新报关信息</ElButton >更新报关信息</ElButton
> >
</span> </span>
<span v-if="status === 'PENDING_RECEIVE'" class="item"> <!-- <span v-if="status === 'PENDING_RECEIVE'" class="item">
<ElButton type="warning" @click="handleTransferOldFlow" <ElButton type="warning" @click="handleTransferOldFlow"
>转旧流程</ElButton >转旧流程</ElButton
> >
</span> </span> -->
<span v-if="status === 'PENDING_SCHEDULE'" class="item"> <span v-if="status === 'PENDING_SCHEDULE'" class="item">
<ElButton type="primary" @click="handleArrange">排单</ElButton> <ElButton type="primary" @click="handleArrange">排单</ElButton>
</span> </span>
...@@ -903,7 +903,7 @@ import type { ...@@ -903,7 +903,7 @@ import type {
import platformJson from '../../../json/platform.json' import platformJson from '../../../json/platform.json'
import { import {
refreshProductInfoApi, refreshProductInfoApi,
transferOldFlowApi, // transferOldFlowApi,
cancelSuspendApi, cancelSuspendApi,
archiveOrderApi, archiveOrderApi,
printPickOrderApi, printPickOrderApi,
...@@ -1490,19 +1490,19 @@ const handleRefreshProductInfo = async () => { ...@@ -1490,19 +1490,19 @@ const handleRefreshProductInfo = async () => {
loading.close() loading.close()
} }
} }
const handleTransferOldFlow = async () => { // const handleTransferOldFlow = async () => {
try { // try {
await executeBatchAction({ // await executeBatchAction({
getIds: getSelectedIds, // getIds: getSelectedIds,
api: transferOldFlowApi, // api: transferOldFlowApi,
confirmText: '确定转旧流程吗?', // confirmText: '确定转旧流程吗?',
successText: '转旧流程成功', // successText: '转旧流程成功',
refreshTree: true, // refreshTree: true,
}) // })
} catch (e: unknown) { // } catch (e: unknown) {
ElMessage.error((e as Error)?.message || '转旧流程失败') // ElMessage.error((e as Error)?.message || '转旧流程失败')
} // }
} // }
const handleLogisticsCommand = async (command: string) => { const handleLogisticsCommand = async (command: string) => {
if (!ensureSelection()) return if (!ensureSelection()) return
const ids = getSelectedIds() const ids = getSelectedIds()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment