Commit 2f701631 by wusiyi

feat: 新增超级播种墙配货

parent b86669c3
...@@ -274,7 +274,7 @@ export function getPodBoxListApi( ...@@ -274,7 +274,7 @@ export function getPodBoxListApi(
// 超级播种墙配货 获取pod订单拣货箱子详情 // 超级播种墙配货 获取pod订单拣货箱子详情
export function getSuperPodBoxListApi(factoryNo: number | string) { export function getSuperPodBoxListApi(factoryNo: number | string) {
return axios.get<never, BaseRespData<PodMakeOrderData[]>>( return axios.get<never, BaseRespData<PodMakeOrderData[]>>(
'super/factory/podJomallOrderCn/getSuperPodBoxOrderDetails', 'super/factory/podJomallOrderCn/getPodBoxOrderDetails',
{ params: { factoryNo } }, { params: { factoryNo } },
) )
} }
......
import { defineStore } from 'pinia'
import {
OrderData,
PodMakeOrderData,
ProductList,
} from '@/types/api/podMakeOrder'
import { getSuperPodBoxListApi } from '@/api/podCnOrder'
export interface OrderStoreState {
podBoxList?: PodMakeOrderData[]
podBoxIndex?: number | null
socketConnect?: string
}
const useOrderStore = defineStore('cnSuperOrder', {
state: () => {
return {
podBoxList: [],
podBoxIndex: null,
socketConnect: '',
} as OrderStoreState
},
actions: {
async setPodBoxList(content: {
boxList: PodMakeOrderData[] | OrderData | null
factoryNo: number | string
box?: number
data?: OrderData
}) {
console.log('???????????????????')
const { factoryNo, boxList, box, data } = content
if (Array.isArray(boxList)) {
this.podBoxList = boxList
} else {
const index = this.podBoxList?.findIndex((item) => item.box === box)
if (index === -1) {
try {
const res = await getSuperPodBoxListApi(factoryNo)
const boxList = res.data.map((item) => {
if (res.data) {
const productList = item?.data?.productList || []
const pickingNumber = productList.reduce(
(prev: number, item1: ProductList) => {
if (item1.count) {
return prev + item1.count
}
return prev
},
0,
)
if (item.data) {
item.data.pickingNumber = pickingNumber
}
}
return item
})
this.podBoxList = boxList
this.podBoxIndex = box
} catch (error) {
console.error(error)
}
} else if (box !== 0 && box !== undefined) {
const arr = this.podBoxList
if (arr) {
arr[box - 1] = {
box,
data: data || boxList || null,
}
}
this.podBoxList = arr
this.podBoxIndex = box
}
}
},
// 清空所有箱子
clearPodBoxList() {
this.podBoxList = []
},
// 设置当前箱子
setPodBox(box: number) {
this.podBoxIndex = box
},
// 清空当前箱子
clearPodBox() {
this.podBoxIndex = null
},
setSocketConnect(connect: string) {
this.socketConnect = connect
},
},
})
export default useOrderStore
...@@ -212,12 +212,12 @@ import { ...@@ -212,12 +212,12 @@ import {
PodMakeOrderData, PodMakeOrderData,
ProductList, ProductList,
} from '@/types/api/podMakeOrder' } from '@/types/api/podMakeOrder'
import useOrderStore from '@/store/cnOrder' import useOrderStore from '@/store/cnSuperOrder'
import { import {
getSuperPackingCnDataApi, getSuperPackingCnDataApi,
clearSuperBoxApi, clearSuperBoxApi,
clearAllBoxApi, clearSuperAllBoxApi,
getSuperPodBoxListApi, getSuperPodBoxListApi,
submitSuperInspectionApi, submitSuperInspectionApi,
} from '@/api/podCnOrder' } from '@/api/podCnOrder'
...@@ -851,7 +851,7 @@ const clearAllBox = async () => { ...@@ -851,7 +851,7 @@ const clearAllBox = async () => {
return return
} }
try { try {
const res = await clearAllBoxApi() const res = await clearSuperAllBoxApi()
if (res.code !== 200) return if (res.code !== 200) return
orderStore.setPodBoxList({ orderStore.setPodBoxList({
boxList: res.data, boxList: res.data,
......
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