Commit b9e42c95 by qinjianhui

feat: 生产完成入库接口联调

parent 7bb0575c
......@@ -2,6 +2,7 @@ import axios from './axios'
import type { BasePaginationData, BaseRespData } from '@/types/api'
import type { CancelOrderProcessStateGroupMap } from '@/types/api/cancelOrderProcess'
import type { operateOrderListData } from '@/types/api/factoryOrderNew'
import { InterskuList } from '@/types/api/warehouse'
function normalizePodOrderQueryPayload(
data: Record<string, unknown>,
......@@ -51,3 +52,10 @@ export function completeDeliveryByCancelOrderProcessApi(data: {
data,
)
}
export function getBySkuAndUserMarkAndInboundTypeApi(operationNo: string[]) {
return axios.post<never, BaseRespData<InterskuList[]>>(
'factory/podOrderOperationForReclaim/getProductByOperationNo',
operationNo,
)
}
......@@ -151,11 +151,11 @@ const menu: MenuItem[] = [
id: 12,
label: '工厂订单(NEW)',
},
// {
// index: '/order/cancel-order-process',
// id: 13,
// label: '取消后订单处理',
// },
{
index: '/order/cancel-order-process',
id: 13,
label: '取消后订单处理',
},
],
},
{
......
......@@ -385,6 +385,7 @@ import {
getCancelOrderProcessStateGroupMapApi,
getOperationInfoByNoApi,
completeDeliveryByCancelOrderProcessApi,
getBySkuAndUserMarkAndInboundTypeApi
} from '@/api/cancelOrderProcess'
import type { CardLayoutListFetcher } from '@/types/api/factoryOrderNew'
import LogisticsWaySelect from '@/views/logistics/components/LogisticsWaySelect'
......@@ -562,6 +563,7 @@ const fastClose = () => {
detailVisible.value = false
if (fastKey.value === 'detail') return
search()
loadOrderStatusCounts()
}
const {
userMarkList,
......@@ -641,7 +643,7 @@ function mapInterskuToProduct(val: InterskuList): InterProductList {
}
const handleEmbryoInStock = async () => {
if (cardSelectList.value.length !== 0) {
handleEmbryoInStockByCard()
handleEmbryoInStockByCard('embryoInStock')
} else {
handleEmbryoInFastStock(0)
}
......@@ -652,7 +654,9 @@ const handleEmbryoInFastStock = (inboundType: number) => {
detailVisible.value = true
detailData.value = {}
}
const handleEmbryoInStockByCard = async () => {
const handleEmbryoInStockByCard = async (
type: 'completeProduction' | 'embryoInStock',
) => {
const firstWid = cardSelectList.value[0].warehouseId
if (cardSelectList.value.some((r) => r.warehouseId !== firstWid)) {
return ElMessage.error('请选择相同仓库的库存SKU!')
......@@ -686,7 +690,10 @@ const handleEmbryoInStockByCard = async () => {
})
try {
const skus = cardSelectList.value.map((r) => r.thirdSkuCode as string)
const res = await getBySkuAndUserMarkApi(firstWid, skus.join(','), null)
const res =
type === 'embryoInStock'
? await getBySkuAndUserMarkApi(firstWid, skus.join(','), null)
: await getBySkuAndUserMarkAndInboundTypeApi(cardSelectList.value.map((r) => r.operationNo as string))
if (res.code !== 200) return
otherPurchaseData.value = res.data.map((item: InterskuList) =>
mapInterskuToProduct(item),
......@@ -791,6 +798,8 @@ const handleReceiptSave = async () => {
await addInRecordApi(params)
ElMessage.success('保存成功')
receiptDialogVisible.value = false
search()
loadOrderStatusCounts()
} catch (e) {
console.error(e)
} finally {
......@@ -801,10 +810,10 @@ const handleProductionCompleteInStock = () => {
// 客户定制的单子不能操作生产完成入库,提示:客户定制商品,不能入库!
if (cardSelectList.value.length !== 0) {
if (cardSelectList.value.some((r) => r.inboundType === 2)) {
ElMessage.error('客户定制商品,不能入库!')
ElMessage.error('您选择的操作单包含客户定制商品,不能入库!')
return
}
handleEmbryoInStockByCard()
handleEmbryoInStockByCard('completeProduction')
} else {
handleEmbryoInFastStock(1)
}
......
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