Commit 1ca4d66a by wusiyi

feat: 工厂订单new 快捷生产修改 #1008656

parent fb972b49
......@@ -54,6 +54,7 @@ declare module 'vue' {
ElTag: typeof import('element-plus/es')['ElTag']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
......
......@@ -558,6 +558,13 @@ export function getByOperationNoLogApi(operationNo: string) {
)
}
// 校验库存
export function checkInventoryApi(id: number | string, status: string) {
return axios.get<never, BaseRespData<never>>(
'factory/podOrderOperation/check-inventory',
{ params: { id, status } },
)
}
export function listByNoPodOrderApi(params: {
type: string
no: string
......
......@@ -320,6 +320,7 @@ import {
downloadMaterialApi,
} from '@/api/podCnOrder'
import { cardImages, PodOrderRes } from '@/types/api/podCnOrder'
import { checkInventoryApi } from '@/api/factoryOrderNew'
import { showConfirm } from '@/utils/ui'
import { filePath } from '@/api/axios'
import { computed, ref, watch } from 'vue'
......@@ -779,6 +780,7 @@ const trackCodeInput = async () => {
}
detail.value = normalizeDetail(res.data)
// 扫码后限制
if (props.isLimitScan) {
if (
detail.value.productMark &&
......@@ -786,6 +788,9 @@ const trackCodeInput = async () => {
) {
detail.value = { id: -1, podJomallOrderCnId: -1, imgList: [] }
localStorage.setItem(props.historyStorageKey, JSON.stringify([]))
trackingNumberRef.value && trackingNumberRef.value.focus()
TrackingNumber.value = ''
return showConfirm(props.limitScanMessage || '', {
confirmButtonText: '确定',
cancelButtonText: '取消',
......@@ -797,6 +802,41 @@ const trackCodeInput = async () => {
if (isDownloadImage.value) {
download()
}
// 工厂订单new 校验库存
if (props.fastKey === 'productionScan') {
try {
await checkInventoryApi(
detail.value.id,
String(detail.value.status ?? ''),
)
} catch (inventoryErr) {
const err = inventoryErr as BaseRespData<{
inventory: number
producingQuantity: number
availableInventory: number
}>
if (err?.code === 301) {
historyData.value = []
localStorage.setItem(props.historyStorageKey, JSON.stringify([]))
detail.value = emptyDetail()
playAudio('weight_search_error', props.searchInputAudioTip)
trackingNumberRef.value && trackingNumberRef.value.focus()
TrackingNumber.value = ''
await ElMessageBox.alert(
`库存不足,无法进入生产!请联系仓库管理人员核对库存。<br/>库存数量:${err.data?.inventory},生产中的数量:${err.data?.producingQuantity}<span style="color: red">可调配库存:${err.data?.availableInventory}</span>`,
'提示',
{
type: 'warning',
dangerouslyUseHTMLString: true,
},
)
return
}
throw inventoryErr
}
}
playAudio('weight_search_success')
trackingNumberRef.value && trackingNumberRef.value.focus()
......
......@@ -579,14 +579,7 @@
>申请补胚</ElButton
>
</span>
<span
v-if="
['PENDING_PICK', 'PENDING_REPLENISH', 'IN_PRODUCTION'].includes(
status,
)
"
class="item"
>
<span v-if="['IN_PRODUCTION'].includes(status)" class="item">
<ElButton type="success" @click="handleQuickProduction()"
>快捷生产</ElButton
>
......@@ -2847,10 +2840,21 @@ const handleReplenishFail = () => {
}
const getOperationByNo = (operationNo: string) =>
getByOperationNoLogApi(operationNo) as Promise<{ data?: unknown }>
const completeOperationById = (ids: number[]) =>
fastKey.value === 'productionScan'
? productionScanApi(ids[0], status.value)
: completeDeliveryApi(ids)
const completeOperationById = (
ids: number[],
detailData?: Record<string, unknown>,
) => {
const detailStatus = String(detailData?.status ?? '')
// 快捷生产 生产扫码
if (
fastKey.value === 'productionScan' &&
(detailStatus === 'PENDING_PICK' || detailStatus === 'PENDING_REPLENISH')
) {
return productionScanApi(ids[0], detailStatus)
}
return completeDeliveryApi(ids)
}
const downloadOperationById = (ids: number[]) =>
downloadOperationMaterialApi(ids)
const handleFastProductionSuccess = (data: ResultInfoDataItem[]) => {
......@@ -2909,9 +2913,7 @@ const handleViewDetail = async (item: operateOrderListData) => {
const isLimitScan = ref(false)
const handleQuickProduction = () => {
detailVisible.value = true
fastKey.value = ['PENDING_PICK', 'PENDING_REPLENISH'].includes(status.value)
? 'productionScan'
: 'fastProduction'
fastKey.value = 'productionScan'
isLimitScan.value = true
detailData.value = {}
}
......
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