Commit 554ca8ff by qinjianhui

feat: 城中分拣功能开发

parent c61b0b9e
...@@ -398,3 +398,25 @@ export function getByOperationNoLogApi(operationNo: string) { ...@@ -398,3 +398,25 @@ export function getByOperationNoLogApi(operationNo: string) {
}, },
) )
} }
export function listByNoPodOrderApi(params: {
type: string
no: string
logisticsCompanyCode?: string
}) {
return axios.get<never, BaseRespData<never>>(
'factory/podOrder/listByNo',
{ params },
)
}
export function orderWeighingPodOrderApi(
params: unknown,
) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrder/orderWeighing',
params as {
podOrderWeighingParams: { id?: string; outWarehouseWeight?: string }[]
},
)
}
...@@ -110,10 +110,11 @@ interface ILogisticsList { ...@@ -110,10 +110,11 @@ interface ILogisticsList {
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import weight from '../components/weigh.js' import weight from '../components/weigh.js'
import { import {
listByNoApi, listByNoApi as defaultListByNoApi,
orderWeighingApi, orderWeighingApi as defaultOrderWeighingApi,
allErpCodeListApi, allErpCodeListApi,
} from '@/api/podCnOrder' } from '@/api/podCnOrder'
import type { BaseRespData } from '@/types/api'
// import { logisticsCompanyAllCodelist } from '@/api/logistics.ts' // import { logisticsCompanyAllCodelist } from '@/api/logistics.ts'
import CustomizeTable from '@/components/VxeTable.tsx' import CustomizeTable from '@/components/VxeTable.tsx'
import { TableColumn } from '@/components/VxeTable' import { TableColumn } from '@/components/VxeTable'
...@@ -196,6 +197,39 @@ const tableConfig = ref<TableColumn[]>([ ...@@ -196,6 +197,39 @@ const tableConfig = ref<TableColumn[]>([
}, },
}, },
]) ])
const props = withDefaults(
defineProps<{
/** 默认 podCN:`factory/podJomallOrderCn/listByNo` */
listByNoApi?: typeof defaultListByNoApi
/** 默认 podCN:`factory/podJomallOrderCn/orderWeighing` */
orderWeighingApi?: (payload: unknown) => Promise<BaseRespData<never>>
/**
* 提交称重时的请求体构造;默认 `{ podCnWeighingParams: rows }`,
* 若后端字段与 podCN 分叉时可单独传入。
*/
buildOrderWeighingPayload?: (
rows: IpodCnWeighingParams[],
) =>
| {
podCnWeighingParams: { id?: string; outWarehouseWeight?: string }[]
}
| {
podOrderWeighingParams: { id?: string; outWarehouseWeight?: string }[]
}
}>(),
{},
)
const resolveListByNoApi = () => props.listByNoApi ?? defaultListByNoApi
const resolveOrderWeighingApi = () =>
(props.orderWeighingApi ?? defaultOrderWeighingApi) as (
payload: unknown,
) => Promise<BaseRespData<never>>
const resolveWeighingPayload = (rows: IpodCnWeighingParams[]) =>
(props.buildOrderWeighingPayload?.(rows) ?? {
podCnWeighingParams: rows,
}) as unknown
const emits = defineEmits<{ const emits = defineEmits<{
(e: 'updateList'): void (e: 'updateList'): void
}>() }>()
...@@ -259,7 +293,7 @@ const weightChange = async () => { ...@@ -259,7 +293,7 @@ const weightChange = async () => {
params.logisticsCompanyCode = logisticsCompanyCode.value params.logisticsCompanyCode = logisticsCompanyCode.value
weight.check( weight.check(
noValue, noValue,
listByNoApi, resolveListByNoApi(),
params, params,
(arr) => { (arr) => {
tableData.value = [...arr] tableData.value = [...arr]
...@@ -302,7 +336,8 @@ const weightGet = async () => { ...@@ -302,7 +336,8 @@ const weightGet = async () => {
background: 'rgba(0, 0, 0, 0.3)', background: 'rgba(0, 0, 0, 0.3)',
}) })
try { try {
orderWeighingApi({ podCnWeighingParams: tableData.value }).then((res) => { resolveOrderWeighingApi()(resolveWeighingPayload(tableData.value)).then(
(res) => {
if (res.code === 200) { if (res.code === 200) {
weight.clear() weight.clear()
ElMessage.success('保存称重分拣成功') ElMessage.success('保存称重分拣成功')
...@@ -313,7 +348,8 @@ const weightGet = async () => { ...@@ -313,7 +348,8 @@ const weightGet = async () => {
handleClose() handleClose()
emits('updateList') emits('updateList')
} }
}) },
)
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} finally { } finally {
......
...@@ -815,7 +815,13 @@ ...@@ -815,7 +815,13 @@
:is-new-order="true" :is-new-order="true"
@refresh-table="refreshCurrentView" @refresh-table="refreshCurrentView"
/> />
<WeightDialog ref="weightDialogRef" @update-list="refreshCurrentView" /> <WeightDialog
ref="weightDialogRef"
:list-by-no-api="listByNoPodOrderApi"
:order-weighing-api="orderWeighingPodOrderApi"
:build-order-weighing-payload="(rows) => ({ podOrderWeighingParams: rows })"
@update-list="() => refreshCurrentView({ isRefreshTree: true })"
/>
<FastProduction <FastProduction
v-model:detail-visible="detailVisible" v-model:detail-visible="detailVisible"
:detail-data="detailData" :detail-data="detailData"
...@@ -899,6 +905,8 @@ import { ...@@ -899,6 +905,8 @@ import {
updateRemarkApi, updateRemarkApi,
completeDeliveryApi, completeDeliveryApi,
getByOperationNoLogApi, getByOperationNoLogApi,
listByNoPodOrderApi,
orderWeighingPodOrderApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import { filePath } from '@/api/axios' import { filePath } from '@/api/axios'
import { OrderData } from '@/types/api/podMakeOrder' import { OrderData } from '@/types/api/podMakeOrder'
......
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