Commit 5208633a by wusiyi

feat: 添加配货分拣规则页面 #1007664

parent a851c9e6
...@@ -23,6 +23,7 @@ declare module 'vue' { ...@@ -23,6 +23,7 @@ declare module 'vue' {
ElDescriptions: typeof import('element-plus/es')['ElDescriptions'] ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem'] ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDialog: typeof import('element-plus/es')['ElDialog'] ElDialog: typeof import('element-plus/es')['ElDialog']
ElDivider: typeof import('element-plus/es')['ElDivider']
ElDrawer: typeof import('element-plus/es')['ElDrawer'] ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
......
...@@ -12,6 +12,9 @@ import { ...@@ -12,6 +12,9 @@ import {
InspectionData, InspectionData,
PaymentForm, PaymentForm,
RejectParams, RejectParams,
SortingList,
SortingRuleDetail,
OperatorList,
} from '@/types/api/order' } from '@/types/api/order'
import { import {
apiSubmitPodOrderForm, apiSubmitPodOrderForm,
...@@ -22,7 +25,8 @@ import { ...@@ -22,7 +25,8 @@ import {
ProductionOrder, ProductionOrder,
ShipmentOrderDetailData, ShipmentOrderDetailData,
updatePriceForm, updatePriceForm,
IUpdatePrice, PodUsDetailData, IUpdatePrice,
PodUsDetailData,
} from '@/types/api/deliveryNote' } from '@/types/api/deliveryNote'
import { import {
AccountStatementNote, AccountStatementNote,
...@@ -30,7 +34,9 @@ import { ...@@ -30,7 +34,9 @@ import {
BillOrderDetailData, BillOrderDetailData,
ConfirmOrderForm, ConfirmOrderForm,
CountStatus, CountStatus,
LogList, OrderDetails, ProductDetails, LogList,
OrderDetails,
ProductDetails,
} from '@/types/api/billOrder' } from '@/types/api/billOrder'
export function getOrderList( export function getOrderList(
...@@ -152,7 +158,7 @@ export function apiSetCraftData({ ...@@ -152,7 +158,7 @@ export function apiSetCraftData({
craftTotalPrice, craftTotalPrice,
recNumber, recNumber,
craftPriceList, craftPriceList,
}: { }: {
id: number | undefined id: number | undefined
craftTotalPrice: number | undefined craftTotalPrice: number | undefined
recNumber: string | undefined recNumber: string | undefined
...@@ -509,7 +515,7 @@ export function getPodUsDetailData(id?: number | string) { ...@@ -509,7 +515,7 @@ export function getPodUsDetailData(id?: number | string) {
export function delPodUsOrderData(ids?: number | string[]) { export function delPodUsOrderData(ids?: number | string[]) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'pod_us/reconciliation/delItem', 'pod_us/reconciliation/delItem',
{ids}, { ids },
) )
} }
...@@ -555,7 +561,10 @@ export function updateRecPrice(data: updatePriceForm) { ...@@ -555,7 +561,10 @@ export function updateRecPrice(data: updatePriceForm) {
) )
} }
export function updatePodUsCarriageAmount(data: { ids: number[], carriage_amount: number }) { export function updatePodUsCarriageAmount(data: {
ids: number[]
carriage_amount: number
}) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'pod_us/reconciliation/updateCarriage', 'pod_us/reconciliation/updateCarriage',
data, data,
...@@ -563,11 +572,11 @@ export function updatePodUsCarriageAmount(data: { ids: number[], carriage_amount ...@@ -563,11 +572,11 @@ export function updatePodUsCarriageAmount(data: { ids: number[], carriage_amount
} }
interface BatchUpdatePrice { interface BatchUpdatePrice {
info_id?: number |string | undefined, info_id?: number | string | undefined
itemList: { itemList: {
id: number |string, id: number | string
craft_price: number |string, craft_price: number | string
template_price: number |string template_price: number | string
}[] }[]
} }
...@@ -650,7 +659,7 @@ export function apiRejectionOfReview({ ...@@ -650,7 +659,7 @@ export function apiRejectionOfReview({
ids, ids,
description, description,
recNumbers, recNumbers,
}: { }: {
ids: string ids: string
recNumbers: string recNumbers: string
description: string description: string
...@@ -676,7 +685,7 @@ export function rejectOrderApi({ ...@@ -676,7 +685,7 @@ export function rejectOrderApi({
ids, ids,
description, description,
pass, pass,
}: { }: {
ids: string ids: string
pass: number pass: number
description: string description: string
...@@ -687,3 +696,87 @@ export function rejectOrderApi({ ...@@ -687,3 +696,87 @@ export function rejectOrderApi({
pass, pass,
}) })
} }
// 配货分拣 获取功能开关
export function getConfigApi() {
return axios.get<never, BaseRespData<{ enable: boolean; id: number }>>(
'allocation-sorting-rule/config',
)
}
// 配货分拣 更新功能开关
export function updateConfighApi(data: { id: number; enable: boolean }) {
return axios.get<never, BaseRespData<never>>(
'allocation-sorting-rule/enable-config',
{ params: data },
)
}
// 配货分拣 列表
export function getSortingRuleListApi(data: { warehouseId: number }) {
return axios.post<never, BasePaginationData<SortingList>>(
'allocation-sorting-rule/list_page',
data,
)
}
// 配货分拣 详情
export function getAreaInfoApi(id: number) {
return axios.get<never, BaseRespData<SortingRuleDetail>>(
'allocation-sorting-rule/get',
{ params: { id } },
)
}
// 配货分拣 新增
export function addAreaApi(data: SortingRuleDetail) {
return axios.post<never, BaseRespData<never>>(
'allocation-sorting-rule/add',
data,
)
}
// 配货分拣 编辑
export function editAreaApi(data: SortingRuleDetail) {
return axios.post<never, BaseRespData<never>>(
'allocation-sorting-rule/update',
data,
)
}
// 配货分拣 删除
export function deleteAreaApi(id: number) {
return axios.get<never, BaseRespData<never>>(
'allocation-sorting-rule/delete',
{ params: { id } },
)
}
// 配货分拣 查询可用配货区
export function getAreaListApi(warehouseId: number) {
return axios.get<never, BaseRespData<OperatorList[]>>(
'allocation-sorting-rule/area-list',
{ params: { warehouseId } },
)
}
// 配货分拣 配货规则 条件
export function getConditionTypeListApi() {
return axios.get<never, BaseRespData<OperatorList[]>>(
'allocation-sorting-rule/condition-type',
)
}
// 配货分拣 配货规则 操作符
export function getOperatorListApi() {
return axios.get<never, BaseRespData<OperatorList[]>>(
'allocation-sorting-rule/operator-list',
)
}
// 配货分拣 操作日志
export function getSortingLogApi(id: number) {
return axios.get<never, BaseRespData<LogListData[]>>('sorting/getLog', {
params: { id },
})
}
...@@ -103,16 +103,22 @@ const router = createRouter({ ...@@ -103,16 +103,22 @@ const router = createRouter({
meta: { meta: {
title: '工厂订单(NEW)', title: '工厂订单(NEW)',
}, },
component: () => component: () => import('@/views/order/factoryOrderNew/index.vue'),
import('@/views/order/factoryOrderNew/index.vue'),
}, },
{ {
path:'/order/cancel-order-process', path: '/order/cancel-order-process',
meta: { meta: {
title: '取消后订单处理', title: '取消后订单处理',
}, },
component: () => import('@/views/order/cancelOrderProcess/index.vue'),
},
{
path: '/order/allocation-sorting-rule',
meta: {
title: '配货分拣规则',
},
component: () => component: () =>
import('@/views/order/cancelOrderProcess/index.vue'), import('@/views/order/allocationSortingRule/index.vue'),
}, },
{ {
path: '/pod-cn-order/orderTracking', path: '/pod-cn-order/orderTracking',
......
...@@ -156,6 +156,11 @@ const menu: MenuItem[] = [ ...@@ -156,6 +156,11 @@ const menu: MenuItem[] = [
id: 13, id: 13,
label: '取消后订单处理', label: '取消后订单处理',
}, },
{
index: '/order/allocation-sorting-rule',
id: 14,
label: '配货分拣规则',
},
], ],
}, },
{ {
......
...@@ -292,3 +292,48 @@ export interface RejectParams { ...@@ -292,3 +292,48 @@ export interface RejectParams {
ids?: string ids?: string
pass?: number pass?: number
} }
// 配货分拣 列表
export interface SortingList {
id: number
sortNo: number
areaDesc: string
areaName: string
areaCode: string
warehouseId: number
warehouseName: string
autoPrint: 0 | 1
}
// 配货分拣 详情
export interface SortingRuleDetail {
id?: number
sortNo: number // 分拣序号
areaDesc: string // 分拣区描述
areaCode: string // 分拣区编码
areaName?: string // 分拣区名称
warehouseId: number
warehouseName: string
matchType: 1 | 2 //匹配类型:1=所有条件(且) 2=任一条件(或)
autoPrint: boolean // 自动打单
defaultFlag: boolean // 默认分拣区
secondScan: boolean // 二次扫码
conditions: SortingRuleCondition[] // 配货规则
}
// 配货分拣 配货规则
export interface SortingRuleCondition {
id?: number
ruleId?: number
conditionType: string // 条件
operator: string // 操作符
conditionValue?: string | number | string[]
}
// 配货分拣 配货区/操作符/条件
export interface OperatorList {
desc: string
code: string
used?: boolean
def?: boolean
}
<template>
<div class="page card h-100 flex-gap-10 overflow-hidden flex">
<div class="search-form flex flex-column w-100 flex-1 overflow-hidden">
<el-form :model="searchForm" inline>
<el-form-item label="仓库">
<el-select
v-model="searchForm.warehouseId"
placeholder="请选择仓库"
style="width: 180px"
filterable
@change="handleWarehouseChange"
>
<el-option
v-for="item in warehouseList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<ElFormItem>
<ElButton type="primary" @click="() => search()"> 查询 </ElButton>
</ElFormItem>
</el-form>
<div class="picking-sort-info flex flex-align-center">
<el-switch
v-model="isEnableSorting"
size="large"
class="mr-10"
:before-change="updateConfig"
/>
<div class="text-xs">配货分拣</div>
<el-divider direction="vertical" />
<div v-if="!isEnableSorting">关闭时,直接使用配货打单功能配货</div>
<div v-else>
开启时,支持设置分拣规则,根据分拣规则分配配货区,使用配货分拣功能配货。
</div>
</div>
<div v-if="isEnableSorting" class="sorting-content mt-10 w-100">
<el-button type="success" @click="addArea()">新增</el-button>
<div class="table-container">
<TableView :paginated-data="sortingList" :columns="columns">
<template #autoPrint="{ row }">
{{ row.autoPrint ? '开启' : '关闭' }}
</template>
<template #operation="{ row }">
<el-button type="primary" link @click="addArea(row)">
编辑
</el-button>
<el-button
v-if="row.areaCode !== 'AREA_0'"
type="danger"
link
@click="deleteArea(row.id)"
>
删除
</el-button>
<!-- <el-button type="success" link @click="viewLog(row.id)">
查看日志
</el-button> -->
</template>
</TableView>
</div>
</div>
</div>
<AddAreaDialog
v-if="addAreaDialogVisible"
v-model="addAreaDialogVisible"
:is-edit="isEdit"
:is-disabled="isDisabled"
:edit-data="editData"
:warehouse-id="searchForm.warehouseId"
:warehouse-name="searchForm.warehouseName"
@submit="getSortingRuleList"
/>
<el-dialog
v-model="logVisible"
title="操作日志"
width="1000px"
:close-on-click-modal="false"
>
<LogList :log-list="logList" />
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { loadWarehouseListApi } from '@/api/common'
import type { WarehouseListData } from '@/types'
import type {
LogListData,
SortingList,
SortingRuleDetail,
} from '@/types/api/order'
import type { CustomColumn } from '@/types/table'
import {
getSortingRuleListApi,
deleteAreaApi,
getConfigApi,
updateConfighApi,
getAreaInfoApi,
} from '@/api/order'
import TableView from '@/components/TableView.vue'
import LogList from '@/components/LogList.vue'
import AddAreaDialog from './components/addDialog.vue'
const columns: CustomColumn<SortingList>[] = [
{
key: 'sortNo',
prop: 'sortNo',
label: '序号',
width: 80,
align: 'center',
},
{
key: 'conditionsText',
prop: 'conditionsText',
label: '配货规则',
minWidth: 250,
align: 'left',
},
{
key: 'areaName',
prop: 'areaName',
label: '配货区',
width: 100,
align: 'center',
},
{
key: 'areaDesc',
prop: 'areaDesc',
label: '配货区说明',
minWidth: 200,
align: 'left',
},
{
key: 'autoPrint',
prop: 'autoPrint',
label: '自动打单',
width: 100,
align: 'center',
slot: 'autoPrint',
},
{
key: 'warehouseName',
prop: 'warehouseName',
label: '仓库',
width: 180,
align: 'center',
},
{
key: 'operation',
label: '操作',
width: 140,
align: 'center',
slot: 'operation',
},
]
const warehouseList = ref<WarehouseListData[]>([]) // 仓库列表
const sortingList = ref<SortingList[]>([]) // 规则列表
const isEnableSorting = ref(false) // 是否开启配货分拣
const currentId = ref(0) // 当前操作id
const isEdit = ref(false) // 是否编辑
const isDisabled = ref(false) // 是否可编辑 (0号配货区禁止编辑)
const editData = ref<SortingRuleDetail>()
const addAreaDialogVisible = ref(false)
const logVisible = ref(false)
const logList = ref<LogListData[]>([])
const searchForm = ref({
warehouseId: 0,
warehouseName: '',
})
// 加载仓库列表
const loadWarehouseList = async () => {
try {
const res = await loadWarehouseListApi()
if (res.code !== 200) return
warehouseList.value = res.data || []
// 默认选中默认仓库
searchForm.value.warehouseId =
warehouseList.value.find((item) => item.defaulted === 1)?.id ?? 0
} catch (e) {
console.error(e)
}
}
const handleWarehouseChange = (warehouseId: number) => {
searchForm.value.warehouseId = warehouseId
getSortingRuleList()
}
const search = () => {
getSortingRuleList()
}
// 获取功能开关
const getFunctionSwitch = async () => {
const res = await getConfigApi()
if (res.code !== 200) return
isEnableSorting.value = res.data.enable
currentId.value = res.data.id
}
// 切换功能
const updateConfig = async () => {
try {
ElMessageBox.confirm('是否确定切换功能?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
const res = await updateConfighApi({
id: currentId.value,
enable: !isEnableSorting.value,
})
if (res.code !== 200) return
isEnableSorting.value = !isEnableSorting.value
await getSortingRuleList()
})
} catch (e) {
console.error(e)
}
}
// 查询列表
const getSortingRuleList = async () => {
const res = await getSortingRuleListApi({
warehouseId: searchForm.value.warehouseId,
})
if (res.code !== 200) return
sortingList.value = res.data.records
}
// 新增/编辑
const addArea = async (row?: SortingList) => {
searchForm.value.warehouseName =
warehouseList.value.find((item) => item.id === searchForm.value.warehouseId)
?.name ?? ''
if (row) {
isEdit.value = true
isDisabled.value = row.areaCode === 'AREA_0'
const res = await getAreaInfoApi(row.id)
if (res.code !== 200) return
editData.value = res.data
} else {
isDisabled.value = false
isEdit.value = false
editData.value = undefined
}
addAreaDialogVisible.value = true
}
// 删除配货区
const deleteArea = async (id: number) => {
await ElMessageBox.confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
const res = await deleteAreaApi(id)
if (res.code !== 200) return
ElMessage.success('删除成功')
await getSortingRuleList()
})
}
// 查看日志
// const viewLog = async (id: number) => {
// try {
// const res = await getSortingLogApi(id)
// logList.value = res.data
// logVisible.value = true
// } catch (e) {
// console.error(e)
// }
// }
onMounted(async () => {
await loadWarehouseList()
await getFunctionSwitch()
await getSortingRuleList()
})
</script>
<style scoped lang="scss">
.search-form {
min-height: 0;
}
.picking-sort-info {
font-size: 14px;
color: #555;
font-weight: 500;
}
.sorting-content {
flex: 1;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: flex-start;
.table-container {
width: 100%;
flex: 1;
min-height: 0;
overflow: hidden;
margin-top: 10px;
}
}
</style>
...@@ -580,7 +580,18 @@ ...@@ -580,7 +580,18 @@
>补胚失败</ElButton >补胚失败</ElButton
> >
</span> </span>
<span v-if="status === 'PENDING_PACKING'" class="item"> <span v-if="status === 'IN_PRODUCTION' && isEnableSorting" class="item">
<ElButton type="success" @click="handleSeedingWall"
>配货分拣</ElButton
>
</span>
<span
v-if="
status === 'PENDING_PACKING' ||
(status === 'IN_PRODUCTION' && !isEnableSorting)
"
class="item"
>
<ElButton type="success" @click="handleSeedingWall" <ElButton type="success" @click="handleSeedingWall"
>配货打单</ElButton >配货打单</ElButton
> >
...@@ -1209,6 +1220,7 @@ import { ...@@ -1209,6 +1220,7 @@ import {
interceptUpdateApi, interceptUpdateApi,
interceptSuccessApi, interceptSuccessApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import { getConfigApi } from '@/api/order'
import { getLogisticsWayApi } from '@/api/podUsOrder' import { getLogisticsWayApi } from '@/api/podUsOrder'
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import { filePath } from '@/api/axios' import { filePath } from '@/api/axios'
...@@ -3116,12 +3128,21 @@ const handleInterceptionFail = async (row?: FactoryOrderNewListData) => { ...@@ -3116,12 +3128,21 @@ const handleInterceptionFail = async (row?: FactoryOrderNewListData) => {
}, },
}) })
} }
const isEnableSorting = ref(false)
// 获取功能开关
const getFunctionSwitch = async () => {
const res = await getConfigApi()
if (res.code !== 200) return
isEnableSorting.value = res.data.enable
}
onMounted(() => { onMounted(() => {
loadStatusTreeCounts() loadStatusTreeCounts()
loadAllDictionaries() loadAllDictionaries()
getLogisticsWay() getLogisticsWay()
getReceiverCountryList() getReceiverCountryList()
loadWarehouseList() loadWarehouseList()
getFunctionSwitch()
void treeRef.value void treeRef.value
void tableRef.value void tableRef.value
if (status.value === 'PENDING_RECEIVE') { if (status.value === 'PENDING_RECEIVE') {
......
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