Commit b9e42c95 by qinjianhui

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

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