Commit a7c53064 by wuqian
parents 3b4b818b 07643510
......@@ -9,6 +9,7 @@ import {
WarehouseListData,
LogisticsData,
ExportParams,
InterceptStateGroupData,
} from '@/types/api/podUsOrder'
import axios from './axios'
import { PodMakeOrderData } from '@/types/api/podMakeOrder'
......@@ -43,6 +44,13 @@ export function getOrderTabData() {
'/factory/podJomallOrderUs/findStateGroupList',
)
}
// 拦截状态数量
export function getgetInterceptStateGroupList() {
return axios.get<never, BaseRespData<InterceptStateGroupData>>(
'factory/podJomallOrderUs/findInterceptStateGroupList',
)
}
export function getOrderList(
params: SearchForm,
currentPage: number,
......@@ -505,3 +513,25 @@ export function updateToWaitShipmentApi(params: {
params,
)
}
// 拦截状态改变
export function interceptUpdateApi(params: {
orderIds: (string | number)[]
interceptStatus: number
}) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderUs/updateInterceptStatus`,
params,
)
}
// 驳回
export function rejectToApi(params: {
orderStatus: string
productList: ProductList[]
reasonStr: string
}) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderUs/rejectTo`,
params,
)
}
......@@ -6,7 +6,7 @@ export interface Tab {
export interface ExportParams extends SearchForm {
idList?: number[]
exportAll: boolean
status?:string
status?: string
}
export interface SearchForm {
......@@ -34,6 +34,7 @@ export interface SearchForm {
batchArrangeNumber?: string
craftCode?: string
thirdStockSku?: string
interceptStatus?: number | string
}
export interface PodUsOrderListData {
id: number
......@@ -127,6 +128,7 @@ export interface ProductList {
supplierProductNo?: string | null
replenishmentSumNum?: number | null
batchArrangeNumber?: string | null
interceptStatus?: number | null
}
export interface cardImages {
title: string
......@@ -201,3 +203,12 @@ export interface CraftListData {
craftName: string
craftCode: string
}
export interface InterceptStateGroupData {
shipment: {
[key: string]: number
}
production: {
[key: string]: number
}
}
......@@ -422,6 +422,7 @@ const renderItemBox = (bool: boolean) => {
if (renderLock) return
renderLock = true
let boxItem = podBoxList.value.find((item) => item.box === boxIndex.value)
if (!boxItem) boxItem = { data: { productList: [] } }
const { data } = boxItem
data?.productList?.forEach((el) => {
......
......@@ -329,7 +329,11 @@
</ElButton>
</span> -->
<span
v-if="status === 'PICKING' || status === 'TO_BE_REPLENISHMENT'"
v-if="
status === 'PICKING' ||
status === 'TO_BE_REPLENISHMENT' ||
status === 'IN_PRODUCTION'
"
class="item"
>
<ElButton type="primary" @click="printProductionOrder">
......@@ -412,7 +416,7 @@
<ElDropdownMenu>
<ElDropdownItem
:disabled="
selection.length === 0 ||
(selection.length === 0 && cardSelection.length === 0) ||
selection.some((item) => item.shipmentType !== 1)
"
@click="getOrderByIdApi('createLogisticsOrder')"
......@@ -420,7 +424,7 @@
>
<ElDropdownItem
:disabled="
selection.length === 0 ||
(selection.length === 0 && cardSelection.length === 0) ||
selection.some((item) => item.shipmentType !== 1)
"
@click="getOrderByIdApi('getTrackingNumber')"
......@@ -428,7 +432,7 @@
>
<ElDropdownItem
:disabled="
selection.length === 0 ||
(selection.length === 0 && cardSelection.length === 0) ||
selection.some((item) => item.shipmentType !== 1)
"
@click="getOrderByIdApi('getPrintOrder')"
......@@ -436,7 +440,7 @@
>
<ElDropdownItem
:disabled="
selection.length === 0 ||
(selection.length === 0 && cardSelection.length === 0) ||
selection.some((item) => item.shipmentType !== 1)
"
@click="getOrderByIdApi('cancelLogisticsOrder')"
......@@ -475,12 +479,36 @@
</span>
<span
v-if="
status === 'INTERCEPTED' &&
(interceptCurrent === 1 || interceptCurrent === 4)
"
class="item"
>
<ElButton type="success" @click="interceptChange(true)">
拦截成功
</ElButton>
</span>
<span
v-if="
status === 'INTERCEPTED' &&
(interceptCurrent === 1 || interceptCurrent === 4)
"
class="item"
>
<ElButton type="danger" @click="interceptChange(false)">
拦截失败
</ElButton>
</span>
<span
v-if="
status === 'TO_BE_CONFIRMED' ||
status === 'PICKING' ||
status === 'STOCK_OUT' ||
status === 'EXCEPTION_ORDER' ||
status === 'TO_BE_REPLENISHMENT' ||
status === 'IN_PRODUCTION'
status === 'IN_PRODUCTION' ||
status === 'TO_BE_ARRANGE'
"
class="item"
>
......@@ -488,6 +516,61 @@
刷新商品信息
</ElButton>
</span>
<span
v-if="
status === 'STOCK_OUT' ||
status === 'CREATE_LOGISTICS' ||
status === 'TO_BE_ARRANGE' ||
status === 'PICKING' ||
status === 'IN_PRODUCTION'
"
class="item"
>
<ElDropdown>
<el-button type="warning">
驳回至<el-icon class="el-icon--right"><ArrowDown /></el-icon>
</el-button>
<template #dropdown>
<ElDropdownMenu>
<ElDropdownItem
:disabled="
selection.length === 0 && cardSelection.length === 0
"
@click="rejectOrder('TO_BE_CONFIRMED')"
>待确认</ElDropdownItem
>
<ElDropdownItem
v-if="
status === 'IN_PRODUCTION' ||
status === 'TO_BE_ARRANGE' ||
status === 'PICKING'
"
:disabled="
selection.length === 0 && cardSelection.length === 0
"
@click="rejectOrder('CREATE_LOGISTICS')"
>待创建物流</ElDropdownItem
>
<ElDropdownItem
v-if="status === 'PICKING' || status === 'IN_PRODUCTION'"
:disabled="
selection.length === 0 && cardSelection.length === 0
"
@click="rejectOrder('TO_BE_ARRANGE')"
>待排单</ElDropdownItem
>
<ElDropdownItem
v-if="status === 'IN_PRODUCTION'"
:disabled="
selection.length === 0 && cardSelection.length === 0
"
@click="rejectOrder('PICKING')"
>待拣胚</ElDropdownItem
>
</ElDropdownMenu>
</template>
</ElDropdown>
</span>
<span v-if="status === 'COMPLETE'" class="item">
<ElButton type="success" @click="exportData">导出</ElButton>
</span>
......@@ -573,6 +656,80 @@
<span class="sub-status-item-label">待同步</span>
</div>
</div>
<div v-if="status === 'INTERCEPTED'" class="sub-status mb-10">
<div
class="sub-status-item"
:class="interceptCurrent === 1 ? 'sub-active' : ''"
@click="handleInterceptionCommand(1, 0)"
>
<span class="sub-status-item-label">生产拦截申请</span>
<span
v-if="interceptionStatus.production['0']"
class="tabs-node_count blue"
>{{ interceptionStatus.production['0'] }}</span
>
</div>
<div
class="sub-status-item"
:class="interceptCurrent === 2 ? 'sub-active' : ''"
@click="handleInterceptionCommand(2, 1)"
>
<span class="sub-status-item-label">生产拦截成功</span>
<span
v-if="interceptionStatus.production['1']"
class="tabs-node_count blue"
>{{ interceptionStatus.production['1'] }}</span
>
</div>
<div
class="sub-status-item"
:class="interceptCurrent === 3 ? 'sub-active' : ''"
@click="handleInterceptionCommand(3, 2)"
>
<span class="sub-status-item-label">生产拦截失败</span>
<span
v-if="interceptionStatus.production['2']"
class="tabs-node_count red"
>{{ interceptionStatus.production['2'] }}</span
>
</div>
<div
class="sub-status-item"
:class="interceptCurrent === 4 ? 'sub-active' : ''"
@click="handleInterceptionCommand(4, 2)"
>
<span class="sub-status-item-label">发货拦截申请</span>
<span
v-if="interceptionStatus.shipment['0']"
class="tabs-node_count blue"
>{{ interceptionStatus.shipment['0'] }}</span
>
</div>
<div
class="sub-status-item"
:class="interceptCurrent === 5 ? 'sub-active' : ''"
@click="handleInterceptionCommand(5, 3)"
>
<span class="sub-status-item-label">发货拦截成功</span>
<span
v-if="interceptionStatus.shipment['1']"
class="tabs-node_count blue"
>{{ interceptionStatus.shipment['1'] }}</span
>
</div>
<div
class="sub-status-item"
:class="interceptCurrent === 6 ? 'sub-active' : ''"
@click="handleInterceptionCommand(6, 4)"
>
<span class="sub-status-item-label">发货拦截失败</span>
<span
v-if="interceptionStatus.shipment['2']"
class="tabs-node_count red"
>{{ interceptionStatus.shipment['2'] }}</span
>
</div>
</div>
<div
v-if="
status !== 'IN_PRODUCTION' &&
......@@ -588,7 +745,6 @@
<TableView
ref="tableRef"
:columns="tableColumns"
:serial-numberable="true"
:selectionable="true"
:paginated-data="tableData"
:cell-style="onCellStyle"
......@@ -596,6 +752,26 @@
:row-style="getRowStyle"
@selection-change="handleSelectionChange"
>
<template #serialNumber="{ row, index }">
<div>
<el-tooltip
v-if="
status !== 'INTERCEPTED' &&
(row.interceptStatus == 0 || row.interceptStatus == 2)
"
effect="light"
:content="
row.interceptStatus == 0
? '订单已提交至生产拦截申请'
: '订单已提交至发货拦截申请'
"
placement="bottom"
>
<el-icon color="#E6A23C"><InfoFilled /></el-icon>
</el-tooltip>
<span class="serial-number">{{ index + 1 }}</span>
</div>
</template>
<template #goods="{ row }">
<div class="goods-info-box">
<div class="goods-list">
......@@ -1304,6 +1480,23 @@
:image-field="'variantImage'"
@contextmenu.prevent="(v: MouseEvent) => rightClick(v)"
>
<template #top_left>
<el-tooltip
v-if="
cardItem.interceptStatus == 0 ||
cardItem.interceptStatus == 2
"
effect="light"
:content="
cardItem.interceptStatus == 0
? '订单已提交至生产拦截申请'
: '订单已提交至发货拦截申请'
"
placement="bottom"
>
<el-icon color="#E6A23C"><InfoFilled /></el-icon>
</el-tooltip>
</template>
<template
#top_right
v-if="['ZPZY', 'CXZY', 'THZY'].includes(cardItem.craftCode as string)"
......@@ -1977,6 +2170,7 @@
import { getUserMarkList } from '@/api/common'
// import { AnyObject } from '@/types/api/warehouse'
import {
InfoFilled,
ArrowDown,
CaretBottom,
CaretTop,
......@@ -2032,6 +2226,9 @@ import {
batchDownloadRecomposingApi,
updateToWaitShipmentApi,
exportPodUSInfo,
getgetInterceptStateGroupList,
interceptUpdateApi,
rejectToApi,
} from '@/api/podUsOrder'
import { BaseRespData } from '@/types/api'
......@@ -2058,7 +2255,7 @@ import {
import usePageList from '@/utils/hooks/usePageList'
import { useValue } from '@/utils/hooks/useValue'
import { showConfirm } from '@/utils/ui'
import { DocumentCopy, EditPen } from '@element-plus/icons-vue'
// import { DocumentCopy, EditPen } from '@element-plus/icons-vue'
import { Column, ElFormItem } from 'element-plus'
import { computed, onMounted, ref, nextTick, reactive } from 'vue'
import FastProduction from './FastProduction.vue'
......@@ -2176,6 +2373,13 @@ const searchVisible = ref(false)
const confirmSelectionData = ref<LogisticsData[]>([])
const confirmRowData = ref<ProductList | null>(null)
const status = ref(localStorage.getItem('podUsStatus') || 'TO_BE_CONFIRMED')
const interceptionStatus = ref<{
shipment: Record<string, number>
production: Record<string, number>
}>({
shipment: {},
production: {},
})
const detailData = ref({})
const [searchForm, resetSearchForm] = useValue<SearchForm>({
......@@ -2204,6 +2408,8 @@ const [searchForm, resetSearchForm] = useValue<SearchForm>({
thirdStockSku: '',
})
const exceptionStatus = ref(1)
const interceptCurrent = ref(1)
const interceptStatus = ref(0)
const userMarkList = ref<string[]>([])
const selection = ref<PodUsOrderListData[]>([])
const pickerOptions = {
......@@ -2488,6 +2694,13 @@ const tableColumns = computed(() => {
}
return [
{
label: '序号',
prop: 'serialNumber',
slot: 'serialNumber',
width: 60,
align: 'center',
},
{
label: '商品',
prop: 'goods',
slot: 'goods',
......@@ -2592,6 +2805,12 @@ const asyncOrderAddress = async () => {
const changeTab = (item: Tab) => {
status.value = item.status || ''
localStorage.setItem('podUsStatus', item.status as string)
// 如果切换到INTERCEPTED状态,设置默认的exceptionStatus
if (item.status === 'INTERCEPTED' && !interceptCurrent.value) {
interceptCurrent.value = 1
}
selection.value = []
cardSelection.value = []
stockOutSuccessIds.value = []
......@@ -2614,10 +2833,46 @@ const onCellClassName = ({ column }: { column: Column }) => {
return 'exception-reason'
}
}
// 获取Tab信息
const loadTabData = async () => {
try {
const res = await getOrderTabData()
tabsNav.value = res.data
// 获取拦截数量
const statusRes = await getgetInterceptStateGroupList()
interceptionStatus.value = statusRes.data as {
shipment: Record<string, number>
production: Record<string, number>
}
// 在 已完成 后面添加 拦截 标签页
const completeIndex = tabsNav.value.findIndex(
(item) => item.status === 'COMPLETE',
)
// 发货拦截数量
const shipmentCount = (statusRes.data as any)?.shipment
? Object.values((statusRes.data as any).shipment).reduce(
(sum: number, value: any) => sum + (Number(value) || 0),
0,
)
: 0
// 生产拦截数量
const productionCount = (statusRes.data as any)?.production
? Object.values((statusRes.data as any).production).reduce(
(sum: number, value: any) => sum + (Number(value) || 0),
0,
)
: 0
tabsNav.value.splice(completeIndex + 1, 0, {
status: 'INTERCEPTED',
statusName: '拦截',
quantity: shipmentCount + productionCount,
})
} catch (error) {
// showError(error)
}
......@@ -2665,11 +2920,13 @@ const {
timeRange.value && timeRange.value.length > 0
? timeRange.value[1]
: null,
status: status.value,
status: status.value === 'INTERCEPTED' ? '' : status.value,
exceptionHandling:
status.value === 'EXCEPTION_ORDER'
? exceptionStatus.value || undefined
: undefined,
interceptStatus:
status.value === 'INTERCEPTED' ? interceptStatus.value : '',
},
page,
pageSize,
......@@ -2687,6 +2944,7 @@ const {
? timeRange.value[1]
: null,
status: status.value,
interceptStatus: '',
},
page,
pageSize,
......@@ -3556,6 +3814,55 @@ const getOrderByIdApi = async (type: string) => {
ElMessage.warning('未知操作类型')
}
}
// 驳回
const rejectOrder = async (type: string) => {
if (selection.value.length === 0 && cardSelection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const { value } = await ElMessageBox.prompt('驳回确认', {
confirmButtonText: '确认',
cancelButtonText: '取消',
inputType: 'textarea',
inputPlaceholder: '驳回原因',
inputPattern: /\S+/, // 非空验证,至少一个非空白字符
inputErrorMessage: '内容不能为空',
})
const res = await rejectToApi({
orderStatus: type,
productList: selection.value.length
? selection.value.flatMap(
(item: PodUsOrderListData) => item.productList || [],
)
: cardSelection.value,
reasonStr: value,
})
if (res.code !== 200) return
resultInfo.value = res.data
resultInfo.value = resultInfo.value.filter((item) => !item.status)
if (!resultInfo.value.length) {
ElMessage.success('操作成功')
search()
loadTabData()
} else {
resultRefs.value?.showDialog()
}
} catch (e) {
console.log(e)
} finally {
loading.close()
}
}
const handleStockOut = async (row: PodUsOrderListData) => {
wayDialogTitle.value = `切换物流(当前物流方式:${row.logisticsWayName})`
......@@ -4066,7 +4373,12 @@ const loadCraftList = async () => {
}
const refreshMaterial = async () => {
if (
['PICKING', 'TO_BE_REPLENISHMENT', 'IN_PRODUCTION'].includes(status.value)
[
'PICKING',
'TO_BE_REPLENISHMENT',
'IN_PRODUCTION',
'TO_BE_ARRANGE',
].includes(status.value)
) {
if (cardSelection.value.length === 0) {
return ElMessage.warning('请选择数据')
......@@ -4088,9 +4400,12 @@ const refreshMaterial = async () => {
)
? selection.value.map((item) => item.id).join(',')
: undefined,
productIds: ['PICKING', 'TO_BE_REPLENISHMENT', 'IN_PRODUCTION'].includes(
status.value,
)
productIds: [
'PICKING',
'TO_BE_REPLENISHMENT',
'IN_PRODUCTION',
'TO_BE_ARRANGE',
].includes(status.value)
? cardSelection.value.map((item) => item.id).join(',')
: undefined,
})
......@@ -4164,6 +4479,14 @@ const handleExceptionCommand = (command: number) => {
exceptionStatus.value = command
search()
}
// 拦截分页
const handleInterceptionCommand = (current: number, command: number) => {
interceptCurrent.value = current
interceptStatus.value = command
search()
loadTabData()
}
const applyForReplenishment = async (row: ProductList | undefined) => {
if (!row) {
if (cardSelection.value.length === 0) {
......@@ -4346,6 +4669,54 @@ const handleBeforeRouteLeave = (
next()
}
// 拦截状态改变
const interceptChange = async (status: boolean) => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
try {
await ElMessageBox.confirm(
`确定${status ? '拦截成功' : '拦截失败'}吗?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
)
} catch (e) {
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const interceptStatus = status
? interceptCurrent.value === 1
? 1
: 3
: interceptCurrent.value === 1
? 2
: 4
try {
const res = await interceptUpdateApi({
orderIds: selection.value.map((item) => item.id),
interceptStatus,
})
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
loadTabData()
} catch (e) {
resultInfo.value = []
console.error(e)
} finally {
loading.close()
}
}
useRouter().beforeEach((to, from, next) => {
handleBeforeRouteLeave(to, from, next)
})
......
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