Commit 2dedec14 by qinjianhui

feat: 商品申请补胚功能

parent 3a03af12
...@@ -399,6 +399,12 @@ export function completeDeliveryApi(ids: (number | string)[]) { ...@@ -399,6 +399,12 @@ export function completeDeliveryApi(ids: (number | string)[]) {
) )
} }
export function applyForProductByIdApi(id: string, url: string) {
return axios.get<never, BaseRespData<operateOrderListData[]>>(url, {
params: { podProductId: id },
})
}
export function getByOperationNoLogApi(operationNo: string) { export function getByOperationNoLogApi(operationNo: string) {
return axios.get<never, BaseRespData<operateOrderListData>>( return axios.get<never, BaseRespData<operateOrderListData>>(
'factory/podOrderOperation/getByOperationNoLog', 'factory/podOrderOperation/getByOperationNoLog',
......
...@@ -128,16 +128,6 @@ ...@@ -128,16 +128,6 @@
> >
{{ item.customizedQuantity === 1 ? '单' : '多' }} {{ item.customizedQuantity === 1 ? '单' : '多' }}
</div> </div>
<Icon name="caozuorizhi" style="width: 28px; height: 28px">
<template #title>
<title>操作日志</title>
</template>
</Icon>
<Icon name="chakanxiangqing">
<template #title>
<title>查看详情</title>
</template>
</Icon>
</div> </div>
</template> </template>
<template #info> <template #info>
...@@ -216,7 +206,7 @@ ...@@ -216,7 +206,7 @@
</div> </div>
<div class="card-info-row" style="color: red"> <div class="card-info-row" style="color: red">
<span class="info-label">状态:</span> <span class="info-label">状态:</span>
<span class="info-value">{{ item.statusName }}</span> <span class="info-value ellipsis">{{ item.statusName }}</span>
</div> </div>
</div> </div>
</template> </template>
...@@ -230,12 +220,7 @@ ...@@ -230,12 +220,7 @@
<template #footer> <template #footer>
<div style="text-align: center"> <div style="text-align: center">
<ElButton @click="visible = false">取消</ElButton> <ElButton @click="visible = false">取消</ElButton>
<ElButton <ElButton type="primary" :loading="submitting" @click="handleConfirm">
v-if="pickable"
type="primary"
:loading="submitting"
@click="handleConfirm"
>
确定 确定
</ElButton> </ElButton>
</div> </div>
...@@ -247,7 +232,10 @@ ...@@ -247,7 +232,10 @@
import { ref } from 'vue' import { ref } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import CommonCard from '@/components/CommonCard.vue' import CommonCard from '@/components/CommonCard.vue'
import { applyForReplenishByIdApi } from '@/api/factoryOrderNew' import {
applyForProductByIdApi,
applyForReplenishByIdApi,
} from '@/api/factoryOrderNew'
import platformJson from '../../../../json/platform.json' import platformJson from '../../../../json/platform.json'
import type { import type {
operateOrderListData, operateOrderListData,
...@@ -255,7 +243,7 @@ import type { ...@@ -255,7 +243,7 @@ import type {
} from '@/types/api/factoryOrderNew' } from '@/types/api/factoryOrderNew'
const emit = defineEmits(['adjustPickOrderSuccess']) const emit = defineEmits(['adjustPickOrderSuccess'])
defineProps<{ const props = defineProps<{
title: string title: string
pickable?: boolean pickable?: boolean
}>() }>()
...@@ -297,7 +285,9 @@ const open = async ({ ...@@ -297,7 +285,9 @@ const open = async ({
cardList.value = [] cardList.value = []
loading.value = true loading.value = true
try { try {
const res = await applyForReplenishByIdApi(ids, url) const res = props.pickable
? await applyForReplenishByIdApi(ids, url)
: await applyForProductByIdApi(ids[0] as string, url)
if (res.code !== 200) return if (res.code !== 200) return
cardList.value = Array.isArray(res.data) ? res.data : [] cardList.value = Array.isArray(res.data) ? res.data : []
if (row.availableOrderIds?.length) { if (row.availableOrderIds?.length) {
...@@ -328,24 +318,26 @@ const handleConfirm = async () => { ...@@ -328,24 +318,26 @@ const handleConfirm = async () => {
if (!selectedItems.value.length) { if (!selectedItems.value.length) {
return ElMessage.warning('请选择操作单') return ElMessage.warning('请选择操作单')
} }
if ( if (props.pickable) {
selectedItems.value.length > if (
(selectedRow.value?.availableOrderIds?.length ?? 0) selectedItems.value.length >
) { (selectedRow.value?.availableOrderIds?.length ?? 0)
return ElMessageBox.confirm( ) {
`<div> return ElMessageBox.confirm(
`<div>
<span>当前库存数量: ${selectedRow.value?.inventory}</span> <span>当前库存数量: ${selectedRow.value?.inventory}</span>
<span style="margin: 0 4px">生产中数量: ${selectedRow.value?.producingQuantity}</span> <span style="margin: 0 4px">生产中数量: ${selectedRow.value?.producingQuantity}</span>
<span>最多只能拣胚 ${selectedRow.value?.availableOrderIds?.length} </span> <span>最多只能拣胚 ${selectedRow.value?.availableOrderIds?.length} </span>
<div>请重新选择!</div> <div>请重新选择!</div>
</div>`, </div>`,
'提示', '提示',
{ {
type: 'warning', type: 'warning',
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
confirmButtonText: '确定', confirmButtonText: '确定',
}, },
) )
}
} }
emit( emit(
'adjustPickOrderSuccess', 'adjustPickOrderSuccess',
...@@ -398,7 +390,7 @@ defineExpose({ open }) ...@@ -398,7 +390,7 @@ defineExpose({ open })
.card-info-grid { .card-info-grid {
display: grid; display: grid;
grid-template-columns: 1fr 80px; grid-template-columns: 1fr 90px;
gap: 4px; gap: 4px;
font-size: 12px; font-size: 12px;
margin-top: 6px; margin-top: 6px;
......
...@@ -848,7 +848,7 @@ ...@@ -848,7 +848,7 @@
<OperateDetailsDialog <OperateDetailsDialog
ref="operateDetailsDialogRef" ref="operateDetailsDialogRef"
title="申请补胚" title="申请补胚"
@success="() => refreshCurrentView({ isRefreshTree: true })" @adjust-pick-order-success="adjustPickOrderSuccess"
/> />
<PodMakeOrder <PodMakeOrder
...@@ -1344,21 +1344,32 @@ const productColumns = computed(() => { ...@@ -1344,21 +1344,32 @@ const productColumns = computed(() => {
key: 'operation', key: 'operation',
prop: 'operation', prop: 'operation',
label: '操作', label: '操作',
width: 120, width: 160,
fixed: 'center', align: 'center',
render: ({ row }: { row: ProductListData }) => { fixed: 'right',
render: (row: ProductListData) => {
return ( return (
<el-button <div>
type="warning" <span class="item">
link <el-button
size="small" type="primary"
onClick={(e: Event) => { link
e.stopPropagation() size="small"
handleSubApplyReplenish(row) onClick={(e: Event) => {
}} e.stopPropagation()
> handleSubApplyReplenish(row)
申请补胚 }}
</el-button> >
申请补胚
</el-button>
</span>
<span class="item">
<el-button type="primary" link size="small">
下载素材
</el-button>
</span>
</div>
) )
}, },
}, },
...@@ -1408,7 +1419,11 @@ const handleEditRemark = async (row: ProductListData) => { ...@@ -1408,7 +1419,11 @@ const handleEditRemark = async (row: ProductListData) => {
} }
const handleSubApplyReplenish = (row: ProductListData) => { const handleSubApplyReplenish = (row: ProductListData) => {
operateDetailsDialogRef.value?.open({ ids: [row.id], url: '' }) operateDetailsDialogRef.value?.open({
row,
ids: [row.id],
url: 'factory/podOrderOperation/getListByPodProductId',
})
} }
const handleConfirmOrder = () => { const handleConfirmOrder = () => {
...@@ -1700,6 +1715,16 @@ const handleApplyReplenish = async () => { ...@@ -1700,6 +1715,16 @@ const handleApplyReplenish = async () => {
refreshTree: true, refreshTree: true,
}) })
} }
const adjustPickOrderSuccess = async (_: unknown, selectionOperationIds: number[]) => {
try {
const res = await applyReplenishApi(selectionOperationIds)
if (res.code !== 200) return
ElMessage.success('申请补胚成功')
refreshCurrentView({ isRefreshTree: true })
} catch (e) {
console.error(e)
}
}
const handleProductionComplete = async () => { const handleProductionComplete = async () => {
await executeBatchAction({ await executeBatchAction({
getIds: getSelectedIds, getIds: 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