Commit 1ca4d66a by wusiyi

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

parent fb972b49
...@@ -54,6 +54,7 @@ declare module 'vue' { ...@@ -54,6 +54,7 @@ declare module 'vue' {
ElTag: typeof import('element-plus/es')['ElTag'] ElTag: typeof import('element-plus/es')['ElTag']
ElTimeline: typeof import('element-plus/es')['ElTimeline'] ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem'] ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree'] ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect'] ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
......
...@@ -558,6 +558,13 @@ export function getByOperationNoLogApi(operationNo: string) { ...@@ -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: { export function listByNoPodOrderApi(params: {
type: string type: string
no: string no: string
......
...@@ -320,6 +320,7 @@ import { ...@@ -320,6 +320,7 @@ import {
downloadMaterialApi, downloadMaterialApi,
} from '@/api/podCnOrder' } from '@/api/podCnOrder'
import { cardImages, PodOrderRes } from '@/types/api/podCnOrder' import { cardImages, PodOrderRes } from '@/types/api/podCnOrder'
import { checkInventoryApi } from '@/api/factoryOrderNew'
import { showConfirm } from '@/utils/ui' import { showConfirm } from '@/utils/ui'
import { filePath } from '@/api/axios' import { filePath } from '@/api/axios'
import { computed, ref, watch } from 'vue' import { computed, ref, watch } from 'vue'
...@@ -779,6 +780,7 @@ const trackCodeInput = async () => { ...@@ -779,6 +780,7 @@ const trackCodeInput = async () => {
} }
detail.value = normalizeDetail(res.data) detail.value = normalizeDetail(res.data)
// 扫码后限制
if (props.isLimitScan) { if (props.isLimitScan) {
if ( if (
detail.value.productMark && detail.value.productMark &&
...@@ -786,6 +788,9 @@ const trackCodeInput = async () => { ...@@ -786,6 +788,9 @@ const trackCodeInput = async () => {
) { ) {
detail.value = { id: -1, podJomallOrderCnId: -1, imgList: [] } detail.value = { id: -1, podJomallOrderCnId: -1, imgList: [] }
localStorage.setItem(props.historyStorageKey, JSON.stringify([])) localStorage.setItem(props.historyStorageKey, JSON.stringify([]))
trackingNumberRef.value && trackingNumberRef.value.focus()
TrackingNumber.value = ''
return showConfirm(props.limitScanMessage || '', { return showConfirm(props.limitScanMessage || '', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -797,6 +802,41 @@ const trackCodeInput = async () => { ...@@ -797,6 +802,41 @@ const trackCodeInput = async () => {
if (isDownloadImage.value) { if (isDownloadImage.value) {
download() 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') playAudio('weight_search_success')
trackingNumberRef.value && trackingNumberRef.value.focus() trackingNumberRef.value && trackingNumberRef.value.focus()
......
...@@ -579,14 +579,7 @@ ...@@ -579,14 +579,7 @@
>申请补胚</ElButton >申请补胚</ElButton
> >
</span> </span>
<span <span v-if="['IN_PRODUCTION'].includes(status)" class="item">
v-if="
['PENDING_PICK', 'PENDING_REPLENISH', 'IN_PRODUCTION'].includes(
status,
)
"
class="item"
>
<ElButton type="success" @click="handleQuickProduction()" <ElButton type="success" @click="handleQuickProduction()"
>快捷生产</ElButton >快捷生产</ElButton
> >
...@@ -2847,10 +2840,21 @@ const handleReplenishFail = () => { ...@@ -2847,10 +2840,21 @@ const handleReplenishFail = () => {
} }
const getOperationByNo = (operationNo: string) => const getOperationByNo = (operationNo: string) =>
getByOperationNoLogApi(operationNo) as Promise<{ data?: unknown }> getByOperationNoLogApi(operationNo) as Promise<{ data?: unknown }>
const completeOperationById = (ids: number[]) => const completeOperationById = (
fastKey.value === 'productionScan' ids: number[],
? productionScanApi(ids[0], status.value) detailData?: Record<string, unknown>,
: completeDeliveryApi(ids) ) => {
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[]) => const downloadOperationById = (ids: number[]) =>
downloadOperationMaterialApi(ids) downloadOperationMaterialApi(ids)
const handleFastProductionSuccess = (data: ResultInfoDataItem[]) => { const handleFastProductionSuccess = (data: ResultInfoDataItem[]) => {
...@@ -2909,9 +2913,7 @@ const handleViewDetail = async (item: operateOrderListData) => { ...@@ -2909,9 +2913,7 @@ const handleViewDetail = async (item: operateOrderListData) => {
const isLimitScan = ref(false) const isLimitScan = ref(false)
const handleQuickProduction = () => { const handleQuickProduction = () => {
detailVisible.value = true detailVisible.value = true
fastKey.value = ['PENDING_PICK', 'PENDING_REPLENISH'].includes(status.value) fastKey.value = 'productionScan'
? 'productionScan'
: 'fastProduction'
isLimitScan.value = true isLimitScan.value = true
detailData.value = {} 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