Commit 9d73f448 by qinjianhui

fix: POD订单优化

parent 0c9aa467
......@@ -82,14 +82,10 @@ export function getOrderBySubOrderNumber(orderNumber: string) {
},
)
}
export function applyForReplenishmentApi(productIds: string) {
return axios.get<never, BaseRespData<never>>(
export function applyForReplenishmentApi(data: unknown) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderProduct/applyForReplenishment',
{
params: {
productIds,
},
},
data,
)
}
// 发货保存
......@@ -193,21 +189,27 @@ export function updateRemarkApi(id: number, remark: string) {
},
)
}
export function getInProductionCount(productionFileId: unknown, baseSku: unknown) {
export function getInProductionCount(
productionFileId: unknown,
baseSku: unknown,
) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderProduct/getInProductionCount',
{
productionFileId,
baseSku
baseSku,
},
)
}
export function getWaitShipmentCount(productionFileId: unknown, baseSku: unknown) {
export function getWaitShipmentCount(
productionFileId: unknown,
baseSku: unknown,
) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderProduct/getWaitShipmentCount',
{
productionFileId,
baseSku
baseSku,
},
)
}
......@@ -3,7 +3,13 @@
<div class="commodity-card-image">
<div class="before"></div>
<div class="image">
<img :src="typeof cardItem.variantImage === 'string' ? cardItem.variantImage : ''" />
<img
:src="
typeof cardItem.variantImage === 'string'
? cardItem.variantImage
: ''
"
/>
</div>
<div class="img_top_left">
<span class="select-icon"></span>
......@@ -37,6 +43,12 @@ defineProps({
</script>
<style lang="scss" scoped>
.commodity-card {
height: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
}
.commodity-card-image {
position: relative;
.img_top_left {
......@@ -90,6 +102,7 @@ defineProps({
}
.commodity-card-info {
flex: 1;
padding: 10px;
font-size: 14px;
background: linear-gradient(
......
......@@ -106,6 +106,8 @@ export interface ProductList {
thirdSubOrderNumber?: string
namespace?: string
factorySubOrderNumber?: string
podOrderId?: number | string
isProduction?: boolean
}
export interface MemoList {
......
......@@ -54,7 +54,7 @@
}}</span>
</div>
</div>
<div class="shipment-info-item-content">
<div v-if="currentRow" class="shipment-info-item-content">
<div
v-for="item in o.productList"
:key="item.id"
......@@ -141,7 +141,7 @@
</div>
</div>
</div>
<div class="shipment-order-detail_info">
<div v-if="currentRow" class="shipment-order-detail_info">
<div class="shipment-order-detail_info_image">
<img :src="currentRow.variantImage" style="width: 100%" />
</div>
......
......@@ -46,7 +46,9 @@ export default function useShipment(callback?: () => void) {
const code1 = code?.split('_')[0]
for (const item of orderList.value) {
// rowData = item.productList?.find((jj) => jj.factorySubOrderNumber === code1)
rowData = item.productList?.find((jj) => `${item.userMark}-${jj.thirdSubOrderNumber}` === code1)
rowData = item.productList?.find(
(jj) => `${item.userMark}-${jj.thirdSubOrderNumber}` === code1,
)
if (rowData) {
rowData.factoryOrderNumber = item.factoryOrderNumber
break
......@@ -58,14 +60,23 @@ export default function useShipment(callback?: () => void) {
(rowData.num || 0) -
(rowData.shipmentNum || 0) +
(rowData.notPassNum || 0)
if (unShipmentNum > (rowData.count || 0)) {
rowData.count = (rowData.count || 0) + 1
playAudio('picking_check_success')
if (rowData.isProduction) {
if (unShipmentNum > (rowData.count || 0)) {
rowData.count = (rowData.count || 0) + 1
playAudio('picking_check_success')
} else {
playAudio('picking_beyond')
ElMessage({
message: '拣货数不能大于未发数',
type: 'warning',
offset: window.innerHeight / 2,
})
}
} else {
playAudio('picking_beyond')
ElMessage({
message: '拣货数不能大于未发数',
type: 'warning',
message: `单号:${rowData.factorySubOrderNumber}未生产,请生产后再发货`,
type: 'error',
offset: window.innerHeight / 2,
})
}
......@@ -74,8 +85,6 @@ export default function useShipment(callback?: () => void) {
isLock.value = false
await nextTick()
if (shipmentOrderRef.value) {
console.log("shipmentOrderRef.value",shipmentOrderRef.value);
const rowEl = shipmentOrderRef.value.listRef?.querySelector(
`div[data-id="${rowData.id}"]`,
)
......@@ -124,8 +133,17 @@ export default function useShipment(callback?: () => void) {
for (const item of data.productList || []) {
item.count = 0
// if (item.factorySubOrderNumber === code1) {
if (`${data.userMark}-${item.thirdSubOrderNumber}` === code1) {
item.count = 1
if (`${data.userMark}-${item.thirdSubOrderNumber}` === code1) {
if (item.isProduction) {
item.count = 1
} else {
playAudio('picking_beyond')
ElMessage({
message: `单号:${item.factorySubOrderNumber}未生产,请生产后再发货`,
type: 'error',
offset: window.innerHeight / 2,
})
}
currentRow.value = item
if (currentRow.value) {
currentRow.value.factoryOrderNumber = data.factoryOrderNumber
......@@ -207,26 +225,26 @@ export default function useShipment(callback?: () => void) {
try {
const res = await saveOrder(data, shipmentForm.value)
fetch(res.message || '')
// .then((response) => {
// // 确保响应是 OK
// if (!response.ok) {
// throw new Error('网络响应错误')
// }
// // 返回图片的二进制数据(Blob)
// return response.blob()
// })
// .then((blob) => {
// const a = document.createElement('a')
// a.href = window.URL.createObjectURL(blob)
// a.target = '_blank'
// a.download = (res.message as string).split('/')[
// (res.message as string).split('/').length - 1
// ]
// a.click()
// })
// .catch((error) => {
// console.error('下载图片时出错:', error)
// })
// .then((response) => {
// // 确保响应是 OK
// if (!response.ok) {
// throw new Error('网络响应错误')
// }
// // 返回图片的二进制数据(Blob)
// return response.blob()
// })
// .then((blob) => {
// const a = document.createElement('a')
// a.href = window.URL.createObjectURL(blob)
// a.target = '_blank'
// a.download = (res.message as string).split('/')[
// (res.message as string).split('/').length - 1
// ]
// a.click()
// })
// .catch((error) => {
// console.error('下载图片时出错:', error)
// })
ElMessage.success('发货成功')
shipmentVisible.value = false
callback && callback()
......
......@@ -287,9 +287,7 @@
</div>
</template>
<template #info>
<div
style="height: 100px; font-size: 12px; padding: 14px 5px 0"
>
<div style="font-size: 12px; padding: 14px 5px 0">
<el-row class="el_row">
<el-col :span="14" :offset="0">
<el-tooltip
......@@ -316,29 +314,32 @@
<span v-if="status === 'INVALID'">
数量:{{ cardItem?.num }}
</span>
<el-tooltip
v-else
class="item"
effect="dark"
:content="
['TO_BE_REPLENISHMENT', 'IN_PRODUCTION'].includes(
status,
)
? '未生产数量'
: '已生产数量'
"
placement="bottom"
>
<span
>数量:{{
<template v-else>
<el-tooltip
v-if="status !== 'TO_BE_REPLENISHMENT'"
class="item"
effect="dark"
:content="
['TO_BE_REPLENISHMENT', 'IN_PRODUCTION'].includes(
status,
)
? cardItem?.notPassNum
: cardItem?.passNum
}}</span
? '未生产数量'
: '已生产数量'
"
placement="bottom"
>
</el-tooltip>
<span
>数量:{{
[
'TO_BE_REPLENISHMENT',
'IN_PRODUCTION',
].includes(status)
? cardItem?.notPassNum
: cardItem?.passNum
}}</span
>
</el-tooltip>
</template>
</el-col>
</el-row>
<el-row style="margin-top: 5px">
......@@ -363,14 +364,23 @@
{{ cardItem?.variantSku }}
</span>
</el-col>
<el-col :span="10" :offset="0" style="text-align: right">
<el-col
v-if="status === 'TO_BE_REPLENISHMENT'"
:span="10"
:offset="0"
style="text-align: right"
>
<el-tooltip
class="item"
effect="dark"
:content="'货号'"
:content="'补胚数量'"
placement="bottom"
>
<span>货号:{{ cardItem?.supplierItemNo }}</span>
<span
>补胚数量:{{
cardItem?.replenishmentNum || '--'
}}</span
>
</el-tooltip>
</el-col>
</el-row>
......@@ -398,14 +408,19 @@
</span>
</el-col>
<el-col :span="12" :offset="0" style="text-align: right">
<span title="期望交货时间">
{{ cardItem?.expectDeliveryTime }}
</span>
<el-tooltip
class="item"
effect="dark"
:content="'货号'"
placement="bottom"
>
<span>货号:{{ cardItem?.supplierItemNo }}</span>
</el-tooltip>
</el-col>
</el-row>
<el-row style="margin-top: 5px">
<el-col
:span="14"
:span="12"
:offset="0"
style="white-space: nowrap"
>
......@@ -421,6 +436,13 @@
{{ cardItem?.shopNumber }}
</span>
</el-col>
<el-col :span="12" :offset="0" style="text-align: right">
<span title="期望交货时间">
{{ cardItem?.expectDeliveryTime }}
</span>
</el-col>
</el-row>
<el-row style="margin-top: 5px">
<el-col
:span="10"
:offset="0"
......@@ -491,15 +513,26 @@
v-if="status === 'TO_BE_RECEIPT'"
class="operation-item"
>
<el-button size="small" type="warning"
<el-button
size="small"
type="warning"
@click="applyEmbryoReplenishment(productItem)"
>申请补胚</el-button
>
</div>
<div
v-if="status === 'TO_BE_RECEIPT'"
v-if="
status === 'TO_BE_RECEIPT' ||
status === 'TO_BE_CONFIRMED'
"
class="operation-item"
>
<el-button size="small" type="danger">作废</el-button>
<el-button
size="small"
type="danger"
@click="invalidOrder(productItem)"
>作废</el-button
>
</div>
</template>
</ProductInfo>
......@@ -870,7 +903,7 @@ import dayjs from 'dayjs'
import useElTableColumnWidth from '@/utils/hooks/useElTableColumnWidth'
import ProductInfo from '../ProductInfo.vue'
import { SpanMethodProps } from '@/types/api/order'
import useShipment from '../hook/podUseShipMent'
import useShipment from '../hook/usePodShipment'
import Shipment from '../Shipment.vue'
import {
SearchForm,
......@@ -1416,20 +1449,30 @@ const applyForReplacement = async () => {
offset: window.innerHeight / 2,
})
}
let value
try {
await showConfirm('是否申请补胚', {
value = await ElMessageBox.prompt('', '补胚数量', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
inputPlaceholder: '请输入补胚数量',
inputPattern: /^\d+$/,
inputErrorMessage: '补胚数量不能为空且只能输入数字',
})
} catch {
return
}
const ids = selection.value
.map((item: CardOrderData | PodProductList) => item.id)
.join(',')
const data = selection.value.map((item: CardOrderData | PodProductList) => {
return {
id: item.podOrderId,
productId: item.id,
factorySubOrderNumber: item.factorySubOrderNumber,
thirdSubOrderNumber: item.thirdSubOrderNumber,
replenishmentNum: Number(value.value),
}
})
try {
const res = await applyForReplenishmentApi(ids)
const res = await applyForReplenishmentApi(data)
loadDiffList()
await loadTabData()
ElMessage.success(res.message)
......@@ -1710,6 +1753,57 @@ const getSafeImages = (item: PodProductList | CardOrderData): cardImages[] => {
const listenerKeydown = (e: KeyboardEvent) => {
keyCode.value = e?.key
}
const applyEmbryoReplenishment = async (row: ProductList) => {
let res
try {
res = await ElMessageBox.prompt('', '补胚数量', {
confirmButtonText: '确认',
cancelButtonText: '取消',
inputPlaceholder: '请输入补胚数量',
inputPattern: /^\d+$/,
inputErrorMessage: '补胚数量不能为空且只能输入数字',
})
} catch {
return
}
const data = [
{
id: row.podOrderId,
productId: row.id,
factorySubOrderNumber: row.factorySubOrderNumber,
thirdSubOrderNumber: row.thirdSubOrderNumber,
replenishmentNum: Number(res.value),
},
]
try {
const res = await applyForReplenishmentApi(data)
loadDiffList()
await loadTabData()
ElMessage.success(res.message)
} catch (e) {
// showError(e)
}
}
const invalidOrder = async (row: ProductList) => {
ElMessageBox.prompt('', '作废', {
confirmButtonText: '确认',
cancelButtonText: '取消',
inputPlaceholder: '请输入作废原因',
inputPattern: /.+/,
inputErrorMessage: '作废原因不能为空',
}).then(async ({ value }: { value: string }) => {
try {
const res = await reasonInvalidationApi([row.id as number], value)
ElMessage.success(res.message)
loadTabData()
loadDiffList()
} catch (e) {
// showError(e)
}
})
}
onMounted(() => {
document.addEventListener('keydown', listenerKeydown)
......
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