Commit 7029defc by zhuzhequan

fix:清空全部箱子 添加仓库id和工厂id

parent ef04d047
...@@ -243,7 +243,7 @@ export function getPackingDataApi( ...@@ -243,7 +243,7 @@ export function getPackingDataApi(
) )
} }
export function getPodBoxListApi( export function getPodBoxListApi(
factoryNo: number | string, factoryNo: number | string | undefined,
warehouseId: number | string, warehouseId: number | string,
) { ) {
return axios.get<never, BaseRespData<PodMakeOrderData[]>>( return axios.get<never, BaseRespData<PodMakeOrderData[]>>(
......
...@@ -21,13 +21,18 @@ const useOrderStore = defineStore('order', { ...@@ -21,13 +21,18 @@ const useOrderStore = defineStore('order', {
actions: { actions: {
async setPodBoxList(content: { async setPodBoxList(content: {
boxList: PodMakeOrderData[] | OrderData | null boxList: PodMakeOrderData[] | OrderData | null
factoryNo: number | string factoryNo: number | string | undefined
fromUser: number
warehouseId: number | string warehouseId: number | string
box?: number box?: number
data?: OrderData data?: OrderData
}) { }) {
const { factoryNo, warehouseId, boxList, box, data } = content console.log(content,'content')
const { factoryNo, warehouseId, boxList, box, data,fromUser } = content
if (Array.isArray(boxList)) { if (Array.isArray(boxList)) {
boxList.forEach(item => {
item.fromUser = fromUser
})
this.podBoxList = boxList this.podBoxList = boxList
} else { } else {
const index = this.podBoxList?.findIndex((item) => item.box === box) const index = this.podBoxList?.findIndex((item) => item.box === box)
...@@ -35,6 +40,7 @@ const useOrderStore = defineStore('order', { ...@@ -35,6 +40,7 @@ const useOrderStore = defineStore('order', {
try { try {
const res = await getPodBoxListApi(factoryNo, warehouseId) const res = await getPodBoxListApi(factoryNo, warehouseId)
const boxList = res.data.map((item) => { const boxList = res.data.map((item) => {
item.fromUser = fromUser
if (res.data) { if (res.data) {
const productList = item?.data?.productList || [] const productList = item?.data?.productList || []
const pickingNumber = productList.reduce( const pickingNumber = productList.reduce(
...@@ -62,6 +68,7 @@ const useOrderStore = defineStore('order', { ...@@ -62,6 +68,7 @@ const useOrderStore = defineStore('order', {
const arr = this.podBoxList const arr = this.podBoxList
if (arr) { if (arr) {
arr[box - 1] = { arr[box - 1] = {
fromUser: fromUser,
box, box,
data: data || boxList || null, data: data || boxList || null,
} }
......
export interface PodMakeOrderData { export interface PodMakeOrderData {
data?: OrderData | null data?: OrderData | null
warehouseId?: number warehouseId?: number
fromUser?: number | string
box?: number box?: number
addDate?: string addDate?: string
} }
...@@ -12,6 +13,7 @@ export interface OrderData { ...@@ -12,6 +13,7 @@ export interface OrderData {
logisticsWayName?: string | null logisticsWayName?: string | null
company?: string | null company?: string | null
orderStatus?: number orderStatus?: number
fromUser?: string | number
salesPlatform?: string salesPlatform?: string
logisticsCompanyId?: number logisticsCompanyId?: number
blocked?: boolean blocked?: boolean
......
...@@ -10,6 +10,7 @@ interface NotificationOptions { ...@@ -10,6 +10,7 @@ interface NotificationOptions {
export interface WebSocketMessage { export interface WebSocketMessage {
code?: string code?: string
fromUser?: number
content?: string content?: string
type?: string type?: string
data?: unknown data?: unknown
......
...@@ -464,7 +464,7 @@ const renderItemBox = (bool: boolean) => { ...@@ -464,7 +464,7 @@ const renderItemBox = (bool: boolean) => {
renderLock = true renderLock = true
let boxItem = podBoxList.value?.find((item) => item.box === boxIndex.value) let boxItem = podBoxList.value?.find((item) => item.box === boxIndex.value)
console.log(boxItem,'boxItem')
if (!boxItem) boxItem = { data: { productList: [] } } if (!boxItem) boxItem = { data: { productList: [] } }
const { data } = boxItem const { data } = boxItem
data?.productList?.forEach((el) => { data?.productList?.forEach((el) => {
...@@ -520,6 +520,7 @@ const renderItemBox = (bool: boolean) => { ...@@ -520,6 +520,7 @@ const renderItemBox = (bool: boolean) => {
console.log(408, data) console.log(408, data)
if (productList.every((item) => item.power)) { if (productList.every((item) => item.power)) {
if(userStore.user?.id!==boxItem.fromUser) return
print(data, false, () => { print(data, false, () => {
renderLock = false renderLock = false
}) })
...@@ -551,9 +552,11 @@ const messageChange = (data: WebSocketMessage) => { ...@@ -551,9 +552,11 @@ const messageChange = (data: WebSocketMessage) => {
} }
} }
const setPodBoxList = (data: WebSocketMessage) => { const setPodBoxList = (data: WebSocketMessage) => {
console.log(data,'datatatata')
const obj = data.txt const obj = data.txt
if (obj && typeof obj === 'string') { if (obj && typeof obj === 'string') {
const parsedData = JSON.parse(obj) const parsedData = JSON.parse(obj)
parsedData.fromUser = data.fromUser
orderStore.setPodBoxList(parsedData) orderStore.setPodBoxList(parsedData)
} }
} }
...@@ -654,6 +657,7 @@ const getPackingData = async (code: string) => { ...@@ -654,6 +657,7 @@ const getPackingData = async (code: string) => {
// } // }
if (boxIndex.value == 0) { if (boxIndex.value == 0) {
podOrderDetailsData.value = data as OrderData podOrderDetailsData.value = data as OrderData
podOrderDetailsData.value.fromUser = userStore.user?.id
if (podOrderDetailsData.value.productList?.length) { if (podOrderDetailsData.value.productList?.length) {
const list = podOrderDetailsData.value.productList const list = podOrderDetailsData.value.productList
for (const product of list) { for (const product of list) {
...@@ -736,6 +740,7 @@ const initOrderDetailBox = async () => { ...@@ -736,6 +740,7 @@ const initOrderDetailBox = async () => {
} }
orderStore.setPodBoxList({ orderStore.setPodBoxList({
boxList: res.data, boxList: res.data,
fromUser: userStore.user?userStore.user.id : 0,
factoryNo, factoryNo,
warehouseId: warehouseId.value, warehouseId: warehouseId.value,
}) })
...@@ -998,6 +1003,7 @@ const print = (data: OrderData, forcePrint = false, callback?: () => void) => { ...@@ -998,6 +1003,7 @@ const print = (data: OrderData, forcePrint = false, callback?: () => void) => {
const factoryNo = userStore.user?.factory.id const factoryNo = userStore.user?.factory.id
if (!factoryNo) return if (!factoryNo) return
orderStore.setPodBoxList({ orderStore.setPodBoxList({
fromUser:userStore.user?userStore.user.id:0,
boxList: item ? (item.data as PodMakeOrderData[]) : null, boxList: item ? (item.data as PodMakeOrderData[]) : null,
factoryNo, factoryNo,
box: _boxIndex || undefined, box: _boxIndex || undefined,
......
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