Commit 79f80b97 by wusiyi

feat: 工厂订单new添加配货分拣功能 #1005762

parent cb0342fe
...@@ -713,7 +713,7 @@ export function updateConfighApi(data: { id: number; enable: boolean }) { ...@@ -713,7 +713,7 @@ export function updateConfighApi(data: { id: number; enable: boolean }) {
} }
// 配货分拣 列表 // 配货分拣 列表
export function getSortingRuleListApi(data: { warehouseId: number }) { export function getSortingRuleListApi(data?: { warehouseId?: number }) {
return axios.post<never, BasePaginationData<SortingList>>( return axios.post<never, BasePaginationData<SortingList>>(
'allocation-sorting-rule/list_page', 'allocation-sorting-rule/list_page',
data, data,
......
...@@ -263,9 +263,10 @@ export function getPodBoxListApi( ...@@ -263,9 +263,10 @@ export function getPodBoxListApi(
url: string, url: string,
factoryNo: number | string | undefined, factoryNo: number | string | undefined,
warehouseId: number | string, warehouseId: number | string,
sortingAreaId?: number | string,
) { ) {
return axios.get<never, BaseRespData<PodMakeOrderData[]>>(url, { return axios.get<never, BaseRespData<PodMakeOrderData[]>>(url, {
params: { factoryNo, warehouseId }, params: { factoryNo, warehouseId, packingId: sortingAreaId },
}) })
} }
...@@ -276,9 +277,10 @@ export function submitInspectionApi( ...@@ -276,9 +277,10 @@ export function submitInspectionApi(
}, },
boxIndex: number | null, boxIndex: number | null,
warehouseId: number | string, warehouseId: number | string,
sortingAreaId?: number | string,
) { ) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
`${url}?box=${boxIndex}&warehouseId=${warehouseId}`, `${url}?box=${boxIndex}&warehouseId=${warehouseId}&packingId=${sortingAreaId}`,
params, params,
) )
} }
...@@ -287,18 +289,20 @@ export function clearBoxApi( ...@@ -287,18 +289,20 @@ export function clearBoxApi(
factoryNo: number, factoryNo: number,
box: number | null, box: number | null,
warehouseId: number | string, warehouseId: number | string,
sortingAreaId?: number | string,
) { ) {
return axios.get<never, BaseRespData<never>>(url, { return axios.get<never, BaseRespData<never>>(url, {
params: { factoryNo, box, warehouseId }, params: { factoryNo, box, warehouseId, packingId: sortingAreaId },
}) })
} }
export function clearAllBoxApi( export function clearAllBoxApi(
url: string, url: string,
warehouseId: string | number, warehouseId: string | number,
factoryNo: string | number | undefined, factoryNo: string | number | undefined,
sortingAreaId?: number | string,
) { ) {
return axios.get<never, BaseRespData<never>>(url, { return axios.get<never, BaseRespData<never>>(url, {
params: { warehouseId, factoryNo }, params: { warehouseId, factoryNo, packingId: sortingAreaId },
}) })
} }
export function updateRemarkApi(id: number, content: string) { export function updateRemarkApi(id: number, content: string) {
......
...@@ -302,7 +302,7 @@ export interface SortingList { ...@@ -302,7 +302,7 @@ export interface SortingList {
areaCode: string areaCode: string
warehouseId: number warehouseId: number
warehouseName: string warehouseName: string
autoPrint: 0 | 1 autoPrint: boolean
} }
// 配货分拣 详情 // 配货分拣 详情
......
...@@ -4,6 +4,9 @@ export interface PodMakeOrderData { ...@@ -4,6 +4,9 @@ export interface PodMakeOrderData {
fromUser?: number | string fromUser?: number | string
box?: number box?: number
addDate?: string addDate?: string
packingId?: number | string
factoryNo?: number | string
autoPrint?: boolean
} }
export interface OrderData { export interface OrderData {
......
...@@ -31,8 +31,11 @@ ...@@ -31,8 +31,11 @@
/> />
<div class="text-xs">配货分拣</div> <div class="text-xs">配货分拣</div>
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<div v-if="!isEnableSorting">关闭时,直接使用配货打单功能配货</div>
<div v-else> <div v-if="!isEnableSorting" class="info">
关闭时,直接使用配货打单功能配货
</div>
<div v-else class="info">
开启时,支持设置分拣规则,根据分拣规则分配配货区,使用配货分拣功能配货。 开启时,支持设置分拣规则,根据分拣规则分配配货区,使用配货分拣功能配货。
</div> </div>
</div> </div>
...@@ -296,6 +299,10 @@ onMounted(async () => { ...@@ -296,6 +299,10 @@ onMounted(async () => {
font-size: 14px; font-size: 14px;
color: #555; color: #555;
font-weight: 500; font-weight: 500;
.info {
font-size: 12px;
color: #999;
}
} }
.sorting-content { .sorting-content {
......
...@@ -581,7 +581,7 @@ ...@@ -581,7 +581,7 @@
> >
</span> </span>
<span v-if="status === 'IN_PRODUCTION' && isEnableSorting" class="item"> <span v-if="status === 'IN_PRODUCTION' && isEnableSorting" class="item">
<ElButton type="primary" @click="handleSeedingWall" <ElButton type="primary" @click="handleSeedingWall('sort')"
>配货分拣</ElButton >配货分拣</ElButton
> >
</span> </span>
...@@ -592,7 +592,7 @@ ...@@ -592,7 +592,7 @@
" "
class="item" class="item"
> >
<ElButton type="success" @click="handleSeedingWall" <ElButton type="success" @click="handleSeedingWall('print')"
>配货打单</ElButton >配货打单</ElButton
> >
</span> </span>
...@@ -1050,9 +1050,15 @@ ...@@ -1050,9 +1050,15 @@
v-model="podOrderVisible" v-model="podOrderVisible"
:print-order="printOrder" :print-order="printOrder"
:warehouse-list="warehouseList" :warehouse-list="warehouseList"
:title="wallType === 'print' ? '配货打单' : '配货分拣'"
:is-new-order="true" :is-new-order="true"
ws-open-code="STARTORDERNEWPOD" :wall-type="wallType"
ws-close-code="ENDORDERNEWPOD" :ws-open-code="
wallType === 'print' ? 'STARTORDERNEWPOD' : 'STARTORDERNEWPODTOP'
"
:ws-close-code="
wallType === 'print' ? 'ENDORDERNEWPOD' : 'ENDORDERNEWPODTOP'
"
init-url="factory/podOrderPacking/local/getPodBoxOrderDetails" init-url="factory/podOrderPacking/local/getPodBoxOrderDetails"
@set-printer="handlePrinterChange" @set-printer="handlePrinterChange"
@set-warehouse-id="handleWarehouseIdChange" @set-warehouse-id="handleWarehouseIdChange"
...@@ -2471,8 +2477,16 @@ const handlePrinterChange = (value: string) => { ...@@ -2471,8 +2477,16 @@ const handlePrinterChange = (value: string) => {
sheetPrinter.value = value sheetPrinter.value = value
localStorage.setItem('sheetPrinter', JSON.stringify(value)) localStorage.setItem('sheetPrinter', JSON.stringify(value))
} }
const handleWarehouseIdChange = (value: string) => { const handleWarehouseIdChange = (
localStorage.setItem('localNewWarehouseId', JSON.stringify(value)) value:
| string
| { warehouseId: string | number; sortingAreaId: string | number },
) => {
if (wallType.value === 'print') {
localStorage.setItem('localNewWarehouseId', JSON.stringify(value))
} else if (wallType.value === 'sort') {
localStorage.setItem('localSortingAreaId', JSON.stringify(value))
}
} }
const mapOrderParamListToSubmitItems = ( const mapOrderParamListToSubmitItems = (
orderParamList: { id: number; dataVersion?: number }[], orderParamList: { id: number; dataVersion?: number }[],
...@@ -2493,7 +2507,9 @@ const getPrintLogisticLabelFactory = (id?: number) => ...@@ -2493,7 +2507,9 @@ const getPrintLogisticLabelFactory = (id?: number) =>
getfaceSimplexFileApi([id ?? 0]) getfaceSimplexFileApi([id ?? 0])
const { getCLodop } = useLodop() const { getCLodop } = useLodop()
const handleSeedingWall = () => { const wallType = ref<'print' | 'sort'>('print')
const handleSeedingWall = (type: 'print' | 'sort') => {
wallType.value = type
const lodop = getCLodop(null, null) const lodop = getCLodop(null, null)
if (!lodop) return if (!lodop) return
sheetPrinter.value = lodop.GET_PRINTER_NAME(0) sheetPrinter.value = lodop.GET_PRINTER_NAME(0)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
> >
<template #header> <template #header>
<div class="title"> <div class="title">
<span>{{ isNewOrder ? '配货打单' : '播种墙配货' }}</span> <span>{{ props.title }}</span>
<span v-if="socketConnect === 'online'" class="online">[在线]</span> <span v-if="socketConnect === 'online'" class="online">[在线]</span>
<span v-else class="offline">[离线]</span> <span v-else class="offline">[离线]</span>
<ElButton <ElButton
...@@ -47,6 +47,21 @@ ...@@ -47,6 +47,21 @@
</div> </div>
<div class="form-item"> <div class="form-item">
<ElSelect <ElSelect
v-if="props.wallType === 'sort'"
v-model="sortingAreaId"
placeholder="请选择配货区"
style="width: 200px"
@change="handleSortingAreaChange"
>
<ElOption
v-for="item in sortingAreaList"
:key="item.id"
:label="item.areaName + ' - ' + item.warehouseName"
:value="item.id"
/>
</ElSelect>
<ElSelect
v-else
v-model="warehouseId" v-model="warehouseId"
placeholder="请选择仓库" placeholder="请选择仓库"
style="width: 200px" style="width: 200px"
...@@ -65,7 +80,11 @@ ...@@ -65,7 +80,11 @@
ref="productionOrderRef" ref="productionOrderRef"
v-model="productionOrder" v-model="productionOrder"
:placeholder=" :placeholder="
props.isNewOrder ? '请输入操作单号' : '请输入生产单号' props.wallType === 'us'
? '请输入生产单号'
: props.wallType === 'sort'
? '请输入操作单号/生产单号'
: '请输入操作单号'
" "
clearable clearable
style="width: 100%" style="width: 100%"
...@@ -124,14 +143,14 @@ ...@@ -124,14 +143,14 @@
> >
<template #image="{ row }"> <template #image="{ row }">
<div <div
style="display: flex; flex-wrap: nowrap"
v-if="row.previewImgs?.length" v-if="row.previewImgs?.length"
style="display: flex; flex-wrap: nowrap"
> >
<div <div
v-for="img in row.previewImgs" v-for="img in row.previewImgs"
:key="img" :key="img"
@click.stop="handleCurrentChange(img.url)"
style="cursor: pointer; margin-right: 5px; flex: 1" style="cursor: pointer; margin-right: 5px; flex: 1"
@click.stop="handleCurrentChange(img.url)"
> >
<img v-if="img.url" :src="img.url" alt="" /> <img v-if="img.url" :src="img.url" alt="" />
</div> </div>
...@@ -147,124 +166,145 @@ ...@@ -147,124 +166,145 @@
</TableView> </TableView>
</div> </div>
</div> </div>
<div class="middle-content"> <div class="right-panel">
<div class="box-top"> <div v-if="props.wallType === 'sort'" class="sorting-area-content">
<div class="box-top-item" v-if="boxIndex !== 0"> {{
<span class="box-top-item-box-index"> (sortingAreaList.find((item) => item.id === sortingAreaId)
{{ boxIndex }} ?.areaName || '') +
</span> ' - ' +
(sortingAreaList.find((item) => item.id === sortingAreaId)
?.warehouseName || '')
}}
</div>
<div class="flex right-panel-body">
<div class="middle-content">
<div class="box-top">
<div v-if="boxIndex !== 0" class="box-top-item">
<span class="box-top-item-box-index">
{{ boxIndex }}
</span>
<span class="box-top-item-box-index-text">号箱</span> <span class="box-top-item-box-index-text">号箱</span>
<span style="font-size: 30px">放入第</span> <span style="font-size: 30px">放入第</span>
<div <div
class="box-top-item-box-index-number" class="box-top-item-box-index-number"
:style="{ :style="{
color: color:
podOrderDetailsData?.pickingNumber === podOrderDetailsData?.pickingNumber ===
podOrderDetailsData?.purchaseNumber podOrderDetailsData?.purchaseNumber
? 'rgb(0, 255, 0)' ? 'rgb(0, 255, 0)'
: '', : '',
}" }"
> >
{{ podOrderDetailsData?.pickingNumber }} {{ podOrderDetailsData?.pickingNumber }}
</div>
<span
v-if="
podOrderDetailsData?.pickingNumber != null &&
podOrderDetailsData?.purchaseNumber != null &&
podOrderDetailsData.pickingNumber ===
podOrderDetailsData.purchaseNumber
"
style="font-size: 30px"
>件已配齐</span
>
<span v-else style="font-size: 30px">件商品</span>
</div>
<div v-else class="box-top-item-box-index-text">
单件商品<span style="color: rgb(0, 255, 0)">(配齐)</span
>,不占用播种墙
</div>
<div class="box-top-item-status">
<span
v-if="
isAutoPrint &&
podOrderDetailsData?.pickingNumber &&
podOrderDetailsData?.purchaseNumber &&
podOrderDetailsData?.pickingNumber ===
podOrderDetailsData?.purchaseNumber
"
>
<span v-if="podOrderDetailsData?.printResult">
面单{{
renderPrintResult(podOrderDetailsData?.printResult)
}}
</span>
<span v-else>面单打印中。。。</span>
</span>
<span v-else>验货中。。。</span>
</div>
<div class="box-top-item-btn">
<ElButton
type="primary"
@click="
podOrderDetailsData && print(podOrderDetailsData, true)
"
>手动打印</ElButton
>
<ElButton
v-if="wallType === 'us'"
type="primary"
@click="printNormal"
>普货拣货
</ElButton>
<ElButton type="success" @click="handlePrintFinish"
>打单完成</ElButton
>
<ElButton
:disabled="boxIndex === 0"
type="danger"
@click="handleClearBox"
>清空箱子</ElButton
>
</div>
<div
v-if="
podOrderDetailsData?.productList?.length &&
podOrderDetailsData?.productList?.length > 1
"
class="multiple-title"
>
<span class="multiple-title-text"></span>
</div>
</div>
<div class="order-image">
<img :src="coverImage" alt="" />
</div> </div>
<span
v-if="
podOrderDetailsData?.pickingNumber != null &&
podOrderDetailsData?.purchaseNumber != null &&
podOrderDetailsData.pickingNumber ===
podOrderDetailsData.purchaseNumber
"
style="font-size: 30px"
>件已配齐</span
>
<span v-else style="font-size: 30px">件商品</span>
</div>
<div v-else class="box-top-item-box-index-text">
单件商品<span style="color: rgb(0, 255, 0)">(配齐)</span
>,不占用播种墙
</div>
<div class="box-top-item-status">
<span
v-if="
podOrderDetailsData?.pickingNumber &&
podOrderDetailsData?.purchaseNumber &&
podOrderDetailsData?.pickingNumber ===
podOrderDetailsData?.purchaseNumber
"
>
<span v-if="podOrderDetailsData?.printResult">
面单{{ renderPrintResult(podOrderDetailsData?.printResult) }}
</span>
<span v-else>面单打印中。。。</span>
</span>
<span v-else>验货中。。。</span>
</div>
<div class="box-top-item-btn">
<ElButton
type="primary"
@click="podOrderDetailsData && print(podOrderDetailsData, true)"
>手动打印</ElButton
>
<ElButton v-if="!isNewOrder" type="primary" @click="printNormal"
>普货拣货
</ElButton>
<ElButton type="success" @click="handlePrintFinish"
>打单完成</ElButton
>
<ElButton
:disabled="boxIndex === 0"
type="danger"
@click="handleClearBox"
>清空箱子</ElButton
>
</div>
<div
v-if="
podOrderDetailsData?.productList?.length &&
podOrderDetailsData?.productList?.length > 1
"
class="multiple-title"
>
<span class="multiple-title-text"></span>
</div> </div>
</div> <div class="right-content">
<div class="order-image"> <div class="box-list">
<img :src="coverImage" alt="" /> <div
</div> v-for="(item, index) in podBoxList"
</div> :key="item.box"
<div class="right-content"> class="box-list-item"
<div class="box-list"> :class="{
<div active: item.box && boxIndex == item.box,
v-for="(item, index) in podBoxList" isNull: !item.data,
:key="item.box" }"
class="box-list-item" @click="handleBoxClick(item)"
:class="{ >
active: item.box && boxIndex == item.box, <span style="font-weight: bold" :title="index + 1 + '号箱'">
isNull: !item.data, {{ index + 1 }}
}" </span>
@click="handleBoxClick(item)"
>
<span style="font-weight: bold" :title="index + 1 + '号箱'">
{{ index + 1 }}
</span>
<span v-if="item.data?.pickingNumber" class="number"> <span v-if="item.data?.pickingNumber" class="number">
{{ item.data?.pickingNumber }}/{{ item.data.purchaseNumber }} {{ item.data?.pickingNumber }}/{{ item.data.purchaseNumber }}
</span> </span>
<div <div
v-if=" v-if="
item.data && item.data &&
item.data.productList?.some( item.data.productList?.some(
(e) => (e) =>
e.productMark === 'custom_normal' || e.productMark === 'custom_normal' ||
e.productMark === 'normal', e.productMark === 'normal',
) )
" "
class="cb-product-mark" class="cb-product-mark"
> >
<div class="red-circle"></div> <div class="red-circle"></div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -292,6 +332,7 @@ import { ...@@ -292,6 +332,7 @@ import {
submitInspectionApi, submitInspectionApi,
printNormalPickPdfApi, printNormalPickPdfApi,
} from '@/api/podUsOrder' } from '@/api/podUsOrder'
import { getSortingRuleListApi } from '@/api/order'
import useUserStore from '@/store/user' import useUserStore from '@/store/user'
import { Check, Refresh } from '@element-plus/icons-vue' import { Check, Refresh } from '@element-plus/icons-vue'
import socket from '@/utils/websocket' import socket from '@/utils/websocket'
...@@ -299,6 +340,7 @@ import { WarehouseListData } from '@/types/index' ...@@ -299,6 +340,7 @@ import { WarehouseListData } from '@/types/index'
import { filePath } from '@/api/axios.ts' import { filePath } from '@/api/axios.ts'
import { ElButton, ElIcon, ElTag } from 'element-plus' import { ElButton, ElIcon, ElTag } from 'element-plus'
import { BaseRespData } from '@/types/api' import { BaseRespData } from '@/types/api'
import type { SortingList } from '@/types/api/order'
const { getCLodop } = useLodop() const { getCLodop } = useLodop()
...@@ -311,12 +353,16 @@ const props = withDefaults( ...@@ -311,12 +353,16 @@ const props = withDefaults(
wsOpenCode?: string wsOpenCode?: string
wsCloseCode?: string wsCloseCode?: string
initUrl?: string initUrl?: string
wallType?: 'print' | 'sort' | 'us'
title?: string
}>(), }>(),
{ {
isNewOrder: false, isNewOrder: false,
wsOpenCode: 'STARTORDER', wsOpenCode: 'STARTORDER',
wsCloseCode: 'ENDORDER', wsCloseCode: 'ENDORDER',
initUrl: 'factory/podJomallOrderUs/local/getPodBoxOrderDetails', initUrl: 'factory/podJomallOrderUs/local/getPodBoxOrderDetails',
wallType: 'us',
title: '播种墙配货',
}, },
) )
const emit = defineEmits([ const emit = defineEmits([
...@@ -402,14 +448,14 @@ const podOrderDetailsColumns = computed(() => [ ...@@ -402,14 +448,14 @@ const podOrderDetailsColumns = computed(() => [
align: 'center', align: 'center',
}, },
{ {
label: props.isNewOrder ? '操作单号' : '生产单号', label: props.wallType === 'us' ? '生产单号' : '操作单号',
prop: props.isNewOrder ? 'operationNos' : 'podJomallUsNo', prop: props.wallType === 'us' ? 'podJomallUsNo' : 'operationNos',
width: props.isNewOrder ? 180 : 150, width: props.wallType === 'us' ? 150 : 180,
align: 'center', align: 'center',
render: (row: ProductList) => { render: (row: ProductList) => {
return ( return (
<div> <div>
{props.isNewOrder && {props.wallType !== 'us' &&
row.operationNos?.split(',').map((item) => { row.operationNos?.split(',').map((item) => {
const { operationNo, status, statusText } = parseOperationNo(item) const { operationNo, status, statusText } = parseOperationNo(item)
const { type, style } = operationStatusTagMap[status] || {} const { type, style } = operationStatusTagMap[status] || {}
...@@ -428,7 +474,7 @@ const podOrderDetailsColumns = computed(() => [ ...@@ -428,7 +474,7 @@ const podOrderDetailsColumns = computed(() => [
</div> </div>
) )
})} })}
{!props.isNewOrder && row.podJomallUsNo} {props.wallType === 'us' && row.podJomallUsNo}
</div> </div>
) )
}, },
...@@ -490,14 +536,43 @@ watch(visible, async (value: boolean) => { ...@@ -490,14 +536,43 @@ watch(visible, async (value: boolean) => {
if (value) { if (value) {
podOrderDetailsData.value = {} podOrderDetailsData.value = {}
currentCode = '' currentCode = ''
const localRaw = props.isNewOrder if (props.wallType === 'sort') {
? localStorage.getItem('localNewWarehouseId') await getSortingAreaList()
: localStorage.getItem('locaclWarehouseId') }
const localId = localRaw ? JSON.parse(localRaw) : '' let localRaw = ''
/* 先找一次,确认本地值是否存在于列表 */ switch (props.wallType) {
const hit = props.warehouseList.find((w) => w.id == localId) case 'us':
warehouseId.value = hit ? localId : props.warehouseList[0]?.id localRaw = localStorage.getItem('locaclWarehouseId') || ''
_warehouseId.value = hit ? localId : props.warehouseList[0]?.id break
case 'print':
localRaw = localStorage.getItem('localNewWarehouseId') || ''
break
case 'sort':
localRaw = localStorage.getItem('localSortingAreaId') || ''
break
}
const localData = localRaw ? JSON.parse(localRaw) : ''
// 配货分拣 存仓库+配货区
if (props.wallType === 'sort') {
const localSortingAreaId = localData.sortingAreaId
const localWarehouseId = localData.warehouseId
const hit = sortingAreaList.value.find(
(item) =>
item.id === localSortingAreaId &&
item.warehouseId === localWarehouseId,
)
if (hit) {
sortingAreaId.value = hit.id
warehouseId.value = hit.warehouseId
isAutoPrint.value = hit.autoPrint
}
} else {
/* 先找一次,确认本地值是否存在于列表 */
const hit = props.warehouseList.find((w) => w.id == localData)
warehouseId.value = hit ? localData : props.warehouseList[0]?.id
_warehouseId.value = hit ? localData : props.warehouseList[0]?.id
}
if (userStore.user?.factory.id) { if (userStore.user?.factory.id) {
try { try {
...@@ -512,6 +587,8 @@ watch(visible, async (value: boolean) => { ...@@ -512,6 +587,8 @@ watch(visible, async (value: boolean) => {
code: props.wsOpenCode, code: props.wsOpenCode,
factoryNo: userStore.user?.factory.id, factoryNo: userStore.user?.factory.id,
warehouseId: warehouseId.value, warehouseId: warehouseId.value,
packingId:
props.wallType === 'sort' ? sortingAreaId.value : undefined,
}) })
} catch (error) { } catch (error) {
console.error(error) console.error(error)
...@@ -519,6 +596,7 @@ watch(visible, async (value: boolean) => { ...@@ -519,6 +596,7 @@ watch(visible, async (value: boolean) => {
} }
initOrderDetailBox() initOrderDetailBox()
initPrintDevice() initPrintDevice()
const locaclPrinter = localStorage.getItem('sheetPrinter') const locaclPrinter = localStorage.getItem('sheetPrinter')
if (locaclPrinter) sheetPrinter.value = JSON.parse(locaclPrinter) if (locaclPrinter) sheetPrinter.value = JSON.parse(locaclPrinter)
emit('set-printer', sheetPrinter.value) emit('set-printer', sheetPrinter.value)
...@@ -528,6 +606,7 @@ watch(visible, async (value: boolean) => { ...@@ -528,6 +606,7 @@ watch(visible, async (value: boolean) => {
code: props.wsCloseCode, code: props.wsCloseCode,
factoryNo: userStore.user?.factory.id, factoryNo: userStore.user?.factory.id,
warehouseId: warehouseId.value, warehouseId: warehouseId.value,
packingId: sortingAreaId.value,
}) })
socket.close() socket.close()
} }
...@@ -535,7 +614,6 @@ watch(visible, async (value: boolean) => { ...@@ -535,7 +614,6 @@ watch(visible, async (value: boolean) => {
}) })
watch(boxIndex, (value: number | null) => { watch(boxIndex, (value: number | null) => {
// if (value) { // if (value) {
console.log('boxIndex11111', value)
const bool = !boxChange.value const bool = !boxChange.value
boxChange.value = false boxChange.value = false
...@@ -597,7 +675,6 @@ const renderItemBox = (bool: boolean) => { ...@@ -597,7 +675,6 @@ 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) => {
...@@ -658,8 +735,22 @@ const renderItemBox = (bool: boolean) => { ...@@ -658,8 +735,22 @@ const renderItemBox = (bool: boolean) => {
if (productList.every((item) => item.power)) { if (productList.every((item) => item.power)) {
if (userStore.user?.id !== boxItem.fromUser) return if (userStore.user?.id !== boxItem.fromUser) return
// 配货分拣 非自动打单的配货区: 不打印 不打单完成; 自动打单的配货区: 打印后打单完成
if (props.wallType === 'sort' && !isAutoPrint.value) {
renderLock = false
return
}
print(data, false, () => { print(data, false, () => {
if (props.wallType === 'sort' && isAutoPrint.value) {
submitInspection(() => {
getPackingData(currentCode)
renderLock = false
return
})
}
renderLock = false renderLock = false
return
}) })
} else { } else {
renderLock = false renderLock = false
...@@ -669,7 +760,12 @@ const messageChange = (data: WebSocketMessage) => { ...@@ -669,7 +760,12 @@ const messageChange = (data: WebSocketMessage) => {
if (!data) return if (!data) return
const { code, ...more } = data const { code, ...more } = data
if (code === 'POD_PRINT_ORDER' || code === 'FACTORY_POD_ORDER_PRINT_ORDER') { // 扫码进箱
if (
code === 'POD_PRINT_ORDER' ||
code === 'FACTORY_POD_ORDER_PRINT_ORDER' ||
code === 'FACTORY_POD_ORDER_TOP_PRINT_ORDER'
) {
try { try {
if (typeof more.txt === 'string') { if (typeof more.txt === 'string') {
console.log( console.log(
...@@ -684,15 +780,17 @@ const messageChange = (data: WebSocketMessage) => { ...@@ -684,15 +780,17 @@ const messageChange = (data: WebSocketMessage) => {
console.log('WebSocketMessage', more) console.log('WebSocketMessage', more)
setPodBoxList(more) setPodBoxList(more)
} else if ( }
// 清空箱子
else if (
code === 'POD_BOX_FLUSH' || code === 'POD_BOX_FLUSH' ||
code === 'FACTORY_POD_ORDER_BOX_FLUSH' code === 'FACTORY_POD_ORDER_BOX_FLUSH' ||
code === 'FACTORY_POD_ORDER_TOP_BOX_FLUSH'
) { ) {
initOrderDetailBox() initOrderDetailBox()
} }
} }
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)
...@@ -753,7 +851,12 @@ const handleSearch = () => { ...@@ -753,7 +851,12 @@ const handleSearch = () => {
* printIng 打印中 * printIng 打印中
* notPrintSuccess 未能获取打印状态 * notPrintSuccess 未能获取打印状态
*/ */
if (podOrderDetailsData.value?.printResult === 'printSuccess') { // 配货分拣 自动打单(无需校验是否打单成功)
if (
props.wallType !== 'sort' &&
podOrderDetailsData.value?.printResult === 'printSuccess'
) {
submitInspection(() => { submitInspection(() => {
getPackingData(code) getPackingData(code)
}) })
...@@ -781,23 +884,38 @@ const getPackingData = async (code: string) => { ...@@ -781,23 +884,38 @@ const getPackingData = async (code: string) => {
productionOrder.value = '' productionOrder.value = ''
return return
} }
if (!warehouseId.value) { if (props.wallType !== 'sort' && !warehouseId.value) {
return ElMessage.warning('请选择仓库') return ElMessage.warning('请选择仓库')
} }
const url = props.isNewOrder let url = ''
? 'factory/podOrderPacking/local/putPackingSafe' switch (props.wallType) {
: 'factory/podJomallOrderUs/local/putPackingSafe' case 'us':
url = 'factory/podJomallOrderUs/local/putPackingSafe'
break
case 'print':
url = 'factory/podOrderPacking/local/putPackingSafe'
break
case 'sort':
url = 'factory/podOrderPacking/top/putPackingSafe'
break
}
let params = {} let params = {}
if (props.isNewOrder) { if (props.wallType === 'us') {
params = { params = {
podOperationNo: code, podJomallUsNo: code,
box: boxIndex.value, box: boxIndex.value,
factoryNo, factoryNo,
warehouseId: warehouseId.value, warehouseId: warehouseId.value,
} }
} else if (props.wallType === 'sort') {
params = {
podOperationNo: code,
box: boxIndex.value,
factoryNo,
}
} else { } else {
params = { params = {
podJomallUsNo: code, podOperationNo: code,
box: boxIndex.value, box: boxIndex.value,
factoryNo, factoryNo,
warehouseId: warehouseId.value, warehouseId: warehouseId.value,
...@@ -811,12 +929,22 @@ const getPackingData = async (code: string) => { ...@@ -811,12 +929,22 @@ const getPackingData = async (code: string) => {
productionOrder.value = '' productionOrder.value = ''
return return
} }
const { box, data } = res.data const { box, data, packingId, factoryNo: respFactoryNo } = res.data
console.log('box', box)
// if (box) { // 配货分拣 扫码
if (props.wallType === 'sort') {
const area = sortingAreaList.value.find((item) => item.id == packingId)
const areaChanged =
sortingAreaId.value != packingId ||
(!!area && warehouseId.value != area.warehouseId)
syncSortingArea(packingId as number, respFactoryNo ?? factoryNo)
if (areaChanged) {
await initOrderDetailBox()
}
}
boxChange.value = true
boxIndex.value = box as number boxIndex.value = box as number
// }
if (boxIndex.value == 0) { if (boxIndex.value == 0) {
podOrderDetailsData.value = data as OrderData podOrderDetailsData.value = data as OrderData
podOrderDetailsData.value.fromUser = userStore.user?.id podOrderDetailsData.value.fromUser = userStore.user?.id
...@@ -835,11 +963,6 @@ const getPackingData = async (code: string) => { ...@@ -835,11 +963,6 @@ const getPackingData = async (code: string) => {
}) })
} }
} }
// renderItemBox(true)
console.log('podBoxList', podBoxList.value)
// }
} catch (error) { } catch (error) {
const err = error as BaseRespData<{ const err = error as BaseRespData<{
inventory: number inventory: number
...@@ -847,7 +970,7 @@ const getPackingData = async (code: string) => { ...@@ -847,7 +970,7 @@ const getPackingData = async (code: string) => {
availableInventory: number availableInventory: number
thirdSkuCode?: string thirdSkuCode?: string
}> }>
if (props.isNewOrder && err?.code === 301) { if (props.wallType === 'print' && err?.code === 301) {
loading.close() loading.close()
await ElMessageBox.alert( await ElMessageBox.alert(
`${err.data?.thirdSkuCode}库存不足,无法进入生产!请联系仓库管理人员核对库存。<br/> `${err.data?.thirdSkuCode}库存不足,无法进入生产!请联系仓库管理人员核对库存。<br/>
...@@ -873,17 +996,19 @@ const submitInspection = async (callback: () => void) => { ...@@ -873,17 +996,19 @@ const submitInspection = async (callback: () => void) => {
return return
} }
try { try {
const url = props.isNewOrder const url =
? 'factory/podOrderPacking/podPrintOrderComplete' props.wallType === 'us'
: 'factory/podJomallOrderUs/podPrintOrderComplete' ? 'factory/podJomallOrderUs/podPrintOrderComplete'
: 'factory/podOrderPacking/podPrintOrderComplete'
let params = {} let params = {}
if (props.isNewOrder) { if (props.wallType === 'us') {
params = { params = {
orderParamList: [{ id: podOrderDetailsData.value?.id }], orderId: podOrderDetailsData.value?.id,
} }
} else { } else {
params = { params = {
orderId: podOrderDetailsData.value?.id, orderParamList: [{ id: podOrderDetailsData.value?.id }],
} }
} }
const res = await submitInspectionApi( const res = await submitInspectionApi(
...@@ -891,6 +1016,7 @@ const submitInspection = async (callback: () => void) => { ...@@ -891,6 +1016,7 @@ const submitInspection = async (callback: () => void) => {
params, params,
boxIndex.value, boxIndex.value,
warehouseId.value, warehouseId.value,
sortingAreaId.value,
) )
if (res.code !== 200) return if (res.code !== 200) return
ElMessage.warning(res.message) ElMessage.warning(res.message)
...@@ -912,7 +1038,7 @@ const initOrderDetailBox = async () => { ...@@ -912,7 +1038,7 @@ const initOrderDetailBox = async () => {
if (!factoryNo) { if (!factoryNo) {
return return
} }
if (!warehouseId.value) { if (props.wallType !== 'sort' && !warehouseId.value) {
return ElMessage.warning('请选择仓库') return ElMessage.warning('请选择仓库')
} }
const loading = ElLoading.service({ const loading = ElLoading.service({
...@@ -922,11 +1048,17 @@ const initOrderDetailBox = async () => { ...@@ -922,11 +1048,17 @@ const initOrderDetailBox = async () => {
}) })
try { try {
const url = props.initUrl const url = props.initUrl
const res = await getPodBoxListApi(url, factoryNo, warehouseId.value) const res = await getPodBoxListApi(
url,
factoryNo,
warehouseId.value,
sortingAreaId.value,
)
if (res.code !== 200) { if (res.code !== 200) {
ElMessage.warning(res.message) ElMessage.warning(res.message)
return return
} }
orderStore.setPodBoxList({ orderStore.setPodBoxList({
url, url,
boxList: res.data, boxList: res.data,
...@@ -956,9 +1088,14 @@ const initOrderDetailBox = async () => { ...@@ -956,9 +1088,14 @@ const initOrderDetailBox = async () => {
} }
return item return item
}) })
podOrderDetailsData.value = const currentBox = boxIndex.value
boxList.find((item) => item.data)?.data || undefined const currentBoxItem = currentBox
boxIndex.value = boxList.find((item) => item.data)?.box || null ? boxList.find((item) => item.box === currentBox && item.data)
: undefined
const fallbackItem = boxList.find((item) => item.data)
const targetItem = currentBoxItem || fallbackItem
podOrderDetailsData.value = targetItem?.data || undefined
boxIndex.value = targetItem?.box || null
podOrderDetailsData.value?.productList?.forEach((el) => { podOrderDetailsData.value?.productList?.forEach((el) => {
if (!el.previewImgs) { if (!el.previewImgs) {
...@@ -986,6 +1123,11 @@ const initOrderDetailBox = async () => { ...@@ -986,6 +1123,11 @@ const initOrderDetailBox = async () => {
}) })
const boxs = pickFinished.map((item) => item.box) const boxs = pickFinished.map((item) => item.box)
if (boxs.length > 0) { if (boxs.length > 0) {
if (props.wallType === 'sort') {
console.log(podOrderDetailsData, 'boxspodOrderDetailsData')
return
}
nextTick(async () => { nextTick(async () => {
try { try {
await ElMessageBox.alert( await ElMessageBox.alert(
...@@ -1046,7 +1188,8 @@ const nextStep = async (callback: () => void) => { ...@@ -1046,7 +1188,8 @@ const nextStep = async (callback: () => void) => {
if ( if (
everyPicked && everyPicked &&
(podOrderDetailsData.value?.printResult === 'printSuccess' || (podOrderDetailsData.value?.printResult === 'printSuccess' ||
podOrderDetailsData.value?.printResult === 'notPrintSuccess') podOrderDetailsData.value?.printResult === 'notPrintSuccess') &&
props.wallType !== 'sort'
) { ) {
try { try {
await ElMessageBox.alert( await ElMessageBox.alert(
...@@ -1101,14 +1244,17 @@ const handleClearBox = async () => { ...@@ -1101,14 +1244,17 @@ const handleClearBox = async () => {
} }
try { try {
const url = props.isNewOrder const url =
? 'factory/podOrderPacking/local/delPodBoxOrderDetailsByBox' props.wallType === 'us'
: 'factory/podJomallOrderUs/local/delPodBoxOrderDetailsByBox' ? 'factory/podJomallOrderUs/local/delPodBoxOrderDetailsByBox'
: 'factory/podOrderPacking/local/delPodBoxOrderDetailsByBox'
const res = await clearBoxApi( const res = await clearBoxApi(
url, url,
factoryNo, factoryNo,
boxIndex.value || null, boxIndex.value || null,
warehouseId.value, warehouseId.value,
sortingAreaId.value,
) )
if (res.code !== 200) { if (res.code !== 200) {
ElMessage.warning(res.message) ElMessage.warning(res.message)
...@@ -1219,13 +1365,15 @@ const clearAllBox = async () => { ...@@ -1219,13 +1365,15 @@ const clearAllBox = async () => {
return return
} }
try { try {
const url = props.isNewOrder const url =
? 'factory/podOrderPacking/local/delPodBoxOrderDetails' props.wallType === 'us'
: 'factory/podJomallOrderUs/local/delPodBoxOrderDetails' ? 'factory/podJomallOrderUs/local/delPodBoxOrderDetails'
: 'factory/podOrderPacking/local/delPodBoxOrderDetails'
const res = await clearAllBoxApi( const res = await clearAllBoxApi(
url, url,
warehouseId.value, warehouseId.value,
userStore.user?.factory.id, userStore.user?.factory.id,
sortingAreaId.value,
) )
if (res.code !== 200) return if (res.code !== 200) return
productionOrderRef.value.focus() productionOrderRef.value.focus()
...@@ -1249,6 +1397,47 @@ const handleCurrentChange = (url: string) => { ...@@ -1249,6 +1397,47 @@ const handleCurrentChange = (url: string) => {
} }
const warehouseId = ref<string | number>('') const warehouseId = ref<string | number>('')
const _warehouseId = ref<string | number>('') const _warehouseId = ref<string | number>('')
const sortingAreaList = ref<SortingList[]>([])
const sortingAreaId = ref<number | string>('')
const isAutoPrint = ref<boolean>(false) // 当前配货区是否自动打单
// 配货分拣 更新配货区
const syncSortingArea = (
packingId: number | string,
factoryNo: number | string,
) => {
const currentArea = sortingAreaList.value.find((item) => item.id == packingId)
if (!currentArea) return
if (
sortingAreaId.value == packingId &&
warehouseId.value == currentArea.warehouseId
) {
return
}
warehouseId.value = currentArea.warehouseId
sortingAreaId.value = packingId
isAutoPrint.value = currentArea.autoPrint
socket.send({
code: props.wsOpenCode,
factoryNo,
warehouseId: warehouseId.value,
packingId: sortingAreaId.value,
})
}
// 配货分拣 手动切换配货区
const handleSortingAreaChange = (
value: string | number,
factoryNo?: number | string,
) => {
const no = factoryNo ?? userStore.user?.factory.id
if (!no) return
syncSortingArea(value, no)
emit('set-warehouseId', {
warehouseId: warehouseId.value,
sortingAreaId: sortingAreaId.value,
})
initOrderDetailBox()
}
// 手动切换仓库
const handleWarehouseChange = (value: string | number) => { const handleWarehouseChange = (value: string | number) => {
if (!value) return if (!value) return
if (_warehouseId.value !== warehouseId.value) { if (_warehouseId.value !== warehouseId.value) {
...@@ -1309,12 +1498,23 @@ const reconnectWebSocket = async () => { ...@@ -1309,12 +1498,23 @@ const reconnectWebSocket = async () => {
code: props.wsOpenCode, code: props.wsOpenCode,
factoryNo: userStore.user?.factory.id, factoryNo: userStore.user?.factory.id,
warehouseId: warehouseId.value, warehouseId: warehouseId.value,
packingId: sortingAreaId.value,
}) })
} catch (error) { } catch (error) {
console.error('WebSocket 重连失败:', error) console.error('WebSocket 重连失败:', error)
ElMessage.error('WebSocket 重连失败,请稍后重试') ElMessage.error('WebSocket 重连失败,请稍后重试')
} }
} }
// 配货分拣 获取配货区列表
const getSortingAreaList = async () => {
const res = await getSortingRuleListApi({})
if (res.code !== 200) return
sortingAreaList.value = res.data.records
sortingAreaId.value = res.data.records[0].id
warehouseId.value = res.data.records[0].warehouseId
isAutoPrint.value = res.data.records[0].autoPrint
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
...@@ -1354,6 +1554,30 @@ const reconnectWebSocket = async () => { ...@@ -1354,6 +1554,30 @@ const reconnectWebSocket = async () => {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
} }
.right-panel {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
overflow: hidden;
}
.right-panel-body {
min-height: 0;
overflow: hidden;
}
.sorting-area-content {
border: 2px solid #666;
padding: 10px;
margin-bottom: 10px;
width: 100%;
height: 80px;
font-size: 35px;
color: red;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
}
.middle-content { .middle-content {
width: 500px; width: 500px;
display: flex; display: flex;
...@@ -1443,7 +1667,7 @@ const reconnectWebSocket = async () => { ...@@ -1443,7 +1667,7 @@ const reconnectWebSocket = async () => {
} }
.order-image { .order-image {
flex: 1; flex: 1;
overflow: hidden; overflow: auto;
border: 1px solid #ddd; border: 1px solid #ddd;
background: #eee; background: #eee;
} }
......
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