Commit 9d73f448 by qinjianhui

fix: POD订单优化

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