Commit 76a2385e by qinjianhui

fix: 美国生产优化

parent 7b866fe9
...@@ -5,6 +5,8 @@ import { ...@@ -5,6 +5,8 @@ import {
SearchForm, SearchForm,
Tab, Tab,
LogListData, LogListData,
ProductionClient,
WarehouseListData,
} from '@/types/api/podUsOrder' } from '@/types/api/podUsOrder'
import axios from './axios' import axios from './axios'
import { PodMakeOrderData } from '@/types/api/podMakeOrder' import { PodMakeOrderData } from '@/types/api/podMakeOrder'
...@@ -42,10 +44,18 @@ export function getCardOrderList( ...@@ -42,10 +44,18 @@ export function getCardOrderList(
}, },
) )
} }
export function confirmOrderApi(data: number[]) { export function confirmOrderApi(data: number[], productionClient: string) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/confirmOrders', 'factory/podJomallOrderUs/confirmOrders',
data, {
ids: data.join(','),
productionClient,
},
)
}
export function getProductionClientApi() {
return axios.get<never, BaseRespData<ProductionClient[]>>(
'factory/podJomallOrderUs/getProductionClientList',
) )
} }
export function updateExceptionOrderApi(data: number[]) { export function updateExceptionOrderApi(data: number[]) {
...@@ -110,6 +120,42 @@ export function printProductionOrderApi(orderIds: number[]) { ...@@ -110,6 +120,42 @@ export function printProductionOrderApi(orderIds: number[]) {
orderIds, orderIds,
) )
} }
export function printPrintOrderApi(
orderIds: number[],
productionClient: string,
) {
return axios.post<never, BaseRespData<string>>(
'factory/podJomallOrderUs/printPickPdf',
{
ids: orderIds.join(','),
productionClient,
},
)
}
export function printPickingOrderApi(
orderIds: number[],
productionClient: string,
) {
return axios.post<never, BaseRespData<string>>(
'factory/podJomallOrderUs/pickingComplete',
{
ids: orderIds.join(','),
productionClient,
},
)
}
export function stockOutCheckApi(orderIds: number[]) {
return axios.get<never, BaseRespData<number[]>>(
`factory/podJomallOrderUs/replenishVerify?ids=${orderIds.join(',')}`,
)
}
export function toBeConfirmedApi(orderIds: number[]) {
return axios.get<never, BaseRespData<never>>(
`factory/podJomallOrderUs/updateStockOutOrderToWaitConfirmed?ids=${orderIds.join(
',',
)}`,
)
}
export function getOrderDetailById(id: number) { export function getOrderDetailById(id: number) {
return axios.get<never, BaseRespData<ProductList>>( return axios.get<never, BaseRespData<ProductList>>(
`factory/podJomallOrderProductUs/getProductUsById?id=${id}`, `factory/podJomallOrderProductUs/getProductUsById?id=${id}`,
...@@ -119,6 +165,7 @@ export function getPackingDataApi( ...@@ -119,6 +165,7 @@ export function getPackingDataApi(
code: string, code: string,
factoryNo: number, factoryNo: number,
box: number | null, box: number | null,
warehouseId: number | string,
) { ) {
return axios.get<never, BaseRespData<PodMakeOrderData>>( return axios.get<never, BaseRespData<PodMakeOrderData>>(
'/factory/podJomallOrderUs/getPodBoxDetailsBySkuOrNo', '/factory/podJomallOrderUs/getPodBoxDetailsBySkuOrNo',
...@@ -127,15 +174,19 @@ export function getPackingDataApi( ...@@ -127,15 +174,19 @@ export function getPackingDataApi(
podJomallUsNo: code, podJomallUsNo: code,
box, box,
factoryNo, factoryNo,
warehouseId,
}, },
}, },
) )
} }
export function getPodBoxListApi(factoryNo: number | string) { export function getPodBoxListApi(
factoryNo: number | string,
warehouseId: number | string,
) {
return axios.get<never, BaseRespData<PodMakeOrderData[]>>( return axios.get<never, BaseRespData<PodMakeOrderData[]>>(
'factory/podJomallOrderUs/getPodBoxOrderDetails', 'factory/podJomallOrderUs/getPodBoxOrderDetails',
{ {
params: { factoryNo }, params: { factoryNo, warehouseId },
}, },
) )
} }
...@@ -143,9 +194,10 @@ export function getPodBoxListApi(factoryNo: number | string) { ...@@ -143,9 +194,10 @@ export function getPodBoxListApi(factoryNo: number | string) {
export function submitInspectionApi( export function submitInspectionApi(
data: { id: number; version?: number }[], data: { id: number; version?: number }[],
boxIndex: number | null, boxIndex: number | null,
warehouseId: number | string,
) { ) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderUs/podPrintOrderComplete?box=${boxIndex}`, `factory/podJomallOrderUs/podPrintOrderComplete?box=${boxIndex}&warehouseId=${warehouseId}`,
{ {
orderParamList: data, orderParamList: data,
}, },
...@@ -170,3 +222,8 @@ export function updateRemarkApi(id: number, content: string) { ...@@ -170,3 +222,8 @@ export function updateRemarkApi(id: number, content: string) {
{ id, content }, { id, content },
) )
} }
export function loadWarehouseListApi() {
return axios.get<never, BaseRespData<WarehouseListData[]>>(
'factoryWarehouseInfo/getAll',
)
}
...@@ -93,10 +93,18 @@ const slots = useSlots() as Record<string, Slot> ...@@ -93,10 +93,18 @@ const slots = useSlots() as Record<string, Slot>
const setCurrentRow = (row: T) => { const setCurrentRow = (row: T) => {
tableRef.value?.setCurrentRow(row) tableRef.value?.setCurrentRow(row)
} }
const toggleRowSelection = (row: T, selected: boolean = true) => {
tableRef.value?.toggleRowSelection(row, selected)
}
const clearSelection = () => {
tableRef.value?.clearSelection()
}
defineExpose({ defineExpose({
tableRef, tableRef,
setCurrentRow, setCurrentRow,
toggleRowSelection,
clearSelection,
}) })
</script> </script>
......
...@@ -110,6 +110,10 @@ export interface LogListData { ...@@ -110,6 +110,10 @@ export interface LogListData {
deleteContent: string deleteContent: string
createTime: string createTime: string
} }
export interface ProductionClient {
code?: string
remark?: string
}
export interface PodOrderRes extends ProductList { export interface PodOrderRes extends ProductList {
expectDeliveryTime?: string | null expectDeliveryTime?: string | null
thirdOrderNumber?: string | null thirdOrderNumber?: string | null
...@@ -124,3 +128,13 @@ export interface PodOrderRes extends ProductList { ...@@ -124,3 +128,13 @@ export interface PodOrderRes extends ProductList {
note?: Array<{ prop: string | number; value: string | number }> note?: Array<{ prop: string | number; value: string | number }>
imgList: cardImages[] imgList: cardImages[]
} }
export interface WarehouseListData {
code?: string
defaulted?: number
factoryCode?: string
factoryId?: number
id: number
name?: string
remarks?: string
sort?: number
}
...@@ -472,7 +472,7 @@ ...@@ -472,7 +472,7 @@
> >
<span>工艺:</span> <span>工艺:</span>
<span <span
:title="String(cardItem?.process)" :title="String(cardItem?.processName)"
style=" style="
display: inline-block; display: inline-block;
width: 100%; width: 100%;
...@@ -480,8 +480,8 @@ ...@@ -480,8 +480,8 @@
text-overflow: ellipsis; text-overflow: ellipsis;
" "
> >
{{ cardItem?.process }} {{ cardItem?.processName }}
</span> </span>
</el-col> </el-col>
<el-col <el-col
:span="12" :span="12"
......
...@@ -36,6 +36,21 @@ ...@@ -36,6 +36,21 @@
/> />
</ElSelect> </ElSelect>
</div> </div>
<div class="form-item">
<ElSelect
v-model="warehouseId"
placeholder="请选择仓库"
style="width: 200px"
@change="handleWarehouseChange"
>
<ElOption
v-for="item in warehouseList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</ElSelect>
</div>
<div class="form-item" style="flex: 1"> <div class="form-item" style="flex: 1">
<ElInput <ElInput
ref="productionOrderRef" ref="productionOrderRef"
...@@ -207,12 +222,14 @@ import { ...@@ -207,12 +222,14 @@ import {
import useUserStore from '@/store/user' import useUserStore from '@/store/user'
import { Check } from '@element-plus/icons-vue' import { Check } from '@element-plus/icons-vue'
import socket from '@/utils/websocket' import socket from '@/utils/websocket'
import { WarehouseListData } from '@/types/api/podUsOrder'
const { getCLodop } = useLodop() const { getCLodop } = useLodop()
const props = defineProps<{ const props = defineProps<{
modelValue: boolean modelValue: boolean
printOrder: (data: OrderData, callback: (status: boolean) => void) => void printOrder: (data: OrderData, callback: (status: boolean) => void) => void
warehouseList: WarehouseListData[]
}>() }>()
const emit = defineEmits(['update:modelValue', 'set-printer', 'refresh']) const emit = defineEmits(['update:modelValue', 'set-printer', 'refresh'])
const visible = computed({ const visible = computed({
...@@ -294,6 +311,8 @@ watch(visible, async (value: boolean) => { ...@@ -294,6 +311,8 @@ watch(visible, async (value: boolean) => {
if (value) { if (value) {
podOrderDetailsData.value = {} podOrderDetailsData.value = {}
currentCode = '' currentCode = ''
warehouseId.value = props.warehouseList[0].id
_warehouseId.value = props.warehouseList[0].id
if (userStore.user?.factory.id) { if (userStore.user?.factory.id) {
try { try {
await socket.init( await socket.init(
...@@ -306,11 +325,13 @@ watch(visible, async (value: boolean) => { ...@@ -306,11 +325,13 @@ watch(visible, async (value: boolean) => {
socket.send({ socket.send({
code: 'STARTORDER', code: 'STARTORDER',
factoryNo: userStore.user?.factory.id, factoryNo: userStore.user?.factory.id,
warehouseId: warehouseId.value,
}) })
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }
} }
initOrderDetailBox() initOrderDetailBox()
initPrintDevice() initPrintDevice()
} else { } else {
...@@ -318,6 +339,7 @@ watch(visible, async (value: boolean) => { ...@@ -318,6 +339,7 @@ watch(visible, async (value: boolean) => {
socket.send({ socket.send({
code: 'ENDORDER', code: 'ENDORDER',
factoryNo: userStore.user?.factory.id, factoryNo: userStore.user?.factory.id,
warehouseId: warehouseId.value,
}) })
socket.close() socket.close()
} }
...@@ -500,7 +522,12 @@ const getPackingData = async (code: string) => { ...@@ -500,7 +522,12 @@ const getPackingData = async (code: string) => {
productionOrder.value = '' productionOrder.value = ''
return return
} }
const res = await getPackingDataApi(code, factoryNo, boxIndex.value) const res = await getPackingDataApi(
code,
factoryNo,
boxIndex.value,
warehouseId.value,
)
if (res.code !== 200) { if (res.code !== 200) {
ElMessage.warning(res.message) ElMessage.warning(res.message)
isLock.value = false isLock.value = false
...@@ -535,7 +562,11 @@ const submitInspection = async (callback: () => void) => { ...@@ -535,7 +562,11 @@ const submitInspection = async (callback: () => void) => {
] ]
: [] : []
try { try {
const res = await submitInspectionApi(data, boxIndex.value) const res = await submitInspectionApi(
data,
boxIndex.value,
warehouseId.value,
)
if (res.code !== 200) return if (res.code !== 200) return
ElMessage.warning(res.message) ElMessage.warning(res.message)
isLock.value = false isLock.value = false
...@@ -560,7 +591,7 @@ const initOrderDetailBox = async () => { ...@@ -560,7 +591,7 @@ const initOrderDetailBox = async () => {
fullscreen: true, fullscreen: true,
}) })
try { try {
const res = await getPodBoxListApi(factoryNo) const res = await getPodBoxListApi(factoryNo, warehouseId.value)
if (res.code !== 200) { if (res.code !== 200) {
ElMessage.warning(res.message) ElMessage.warning(res.message)
return return
...@@ -814,6 +845,26 @@ const handleCurrentChange = (row: ProductList) => { ...@@ -814,6 +845,26 @@ const handleCurrentChange = (row: ProductList) => {
coverImage.value = row.variantImage || '' coverImage.value = row.variantImage || ''
} }
} }
const warehouseId = ref<string | number>('')
const _warehouseId = ref<string | number>('')
const handleWarehouseChange = (value: string | number) => {
if (!value) return
if (_warehouseId.value !== warehouseId.value) {
socket.send({
code: 'ENDORDER',
factoryNo: userStore.user?.factory.id,
warehouseId: _warehouseId.value,
})
}
warehouseId.value = value
socket.send({
code: 'STARTORDER',
factoryNo: userStore.user?.factory.id,
warehouseId: warehouseId.value,
})
_warehouseId.value = value
initOrderDetailBox()
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -137,6 +137,16 @@ ...@@ -137,6 +137,16 @@
打印生产单 打印生产单
</ElButton> </ElButton>
</span> </span>
<span v-if="status === 'PICKING'" class="item">
<ElButton type="success" @click="printPickingOrder">
打印拣货单
</ElButton>
</span>
<span v-if="status === 'PICKING'" class="item">
<ElButton type="warning" @click="pickingComplete">
拣胚完成
</ElButton>
</span>
<span v-if="status === 'TO_BE_CONFIRMED'" class="item"> <span v-if="status === 'TO_BE_CONFIRMED'" class="item">
<ElButton type="warning" @click="changeExceptionOrder"> <ElButton type="warning" @click="changeExceptionOrder">
转为异常单 转为异常单
...@@ -161,6 +171,14 @@ ...@@ -161,6 +171,14 @@
<span v-if="status === 'WAIT_SHIPMENT'" class="item"> <span v-if="status === 'WAIT_SHIPMENT'" class="item">
<ElButton type="warning" @click="printPodOrder"> POD打单 </ElButton> <ElButton type="warning" @click="printPodOrder"> POD打单 </ElButton>
</span> </span>
<span v-if="status === 'STOCK_OUT'" class="item">
<ElButton type="warning" @click="stockOutCheck"> 补货校验 </ElButton>
</span>
<span v-if="status === 'STOCK_OUT'" class="item">
<ElButton type="success" @click="toBeConfirmed">
转至待确认
</ElButton>
</span>
<span class="item"> <span class="item">
<ElButton type="primary" @click="downloadMaterial">下载素材</ElButton> <ElButton type="primary" @click="downloadMaterial">下载素材</ElButton>
</span> </span>
...@@ -172,12 +190,14 @@ ...@@ -172,12 +190,14 @@
class="table-wrapper flex-1 flex-column overflow-hidden" class="table-wrapper flex-1 flex-column overflow-hidden"
> >
<TableView <TableView
ref="tableRef"
:columns="tableColumns" :columns="tableColumns"
:stripe="true" :stripe="true"
:serial-numberable="true" :serial-numberable="true"
:selectionable="true" :selectionable="true"
:paginated-data="tableData" :paginated-data="tableData"
:cell-style="onCellStyle" :cell-style="onCellStyle"
:row-style="getRowStyle"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<template #goods="{ row }"> <template #goods="{ row }">
...@@ -216,6 +236,12 @@ ...@@ -216,6 +236,12 @@
><DocumentCopy ><DocumentCopy
/></el-icon> /></el-icon>
</div> </div>
<div class="goods-item-info-item">
<span class="goods-item-info-item-label">工艺:</span>
<span class="goods-item-info-item-value">
{{ item.craftName }}
</span>
</div>
<div class="goods-item-info-item"> <div class="goods-item-info-item">
<span class="goods-item-info-item-label">备注:</span> <span class="goods-item-info-item-label">备注:</span>
...@@ -270,6 +296,12 @@ ...@@ -270,6 +296,12 @@
{{ item.factoryCode }} {{ item.factoryCode }}
</span> </span>
</div> </div>
<div class="goods-item-info-item">
<span class="goods-item-info-item-label">货号:</span>
<span class="goods-item-info-item-value">
{{ item.thirdSkuCode }}
</span>
</div>
</div> </div>
<div class="goods-item-info"> <div class="goods-item-info">
<div class="goods-item-info-item"> <div class="goods-item-info-item">
...@@ -285,11 +317,18 @@ ...@@ -285,11 +317,18 @@
</span> </span>
</div> </div>
<div class="goods-item-info-item"> <div class="goods-item-info-item">
<span class="goods-item-info-item-label">工艺金额:</span>
<span class="goods-item-info-item-value">
{{ item.craftPrice }}()
</span>
</div>
<div class="goods-item-info-item">
<span class="goods-item-info-item-label">付款金额:</span> <span class="goods-item-info-item-label">付款金额:</span>
<span class="goods-item-info-item-value"> <span class="goods-item-info-item-value">
{{ item.payAmount }}() {{ item.payAmount }}()
</span> </span>
</div> </div>
<div class="goods-item-info-item"> <div class="goods-item-info-item">
<span class="goods-item-info-item-label">{{ <span class="goods-item-info-item-label">{{
status === 'TO_BE_CONFIRMED' status === 'TO_BE_CONFIRMED'
...@@ -611,9 +650,37 @@ ...@@ -611,9 +650,37 @@
<PodMakeOrder <PodMakeOrder
v-model="podOrderVisible" v-model="podOrderVisible"
:print-order="printOrder" :print-order="printOrder"
:warehouse-list="warehouseList"
@set-printer="handlePrinterChange" @set-printer="handlePrinterChange"
@refresh="onFastRefresh" @refresh="onFastRefresh"
/> />
<ElDialog
v-model="productionClientVisible"
title="生产端"
width="600px"
:close-on-click-modal="false"
>
<div class="production-client">
<ElSelect
v-model="productionClientValue"
clearable
placeholder="请选择生产端"
>
<ElOption
v-for="(item, index) in productionClient"
:key="index"
:value="item.code"
:label="`${item.remark}(${item.code})`"
></ElOption>
</ElSelect>
</div>
<template #footer>
<div class="dialog-footer">
<ElButton @click="productionClientVisible = false">取消</ElButton>
<ElButton type="primary" @click="submit">确认</ElButton>
</div>
</template>
</ElDialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getUserMarkList } from '@/api/common' import { getUserMarkList } from '@/api/common'
...@@ -630,14 +697,22 @@ import { ...@@ -630,14 +697,22 @@ import {
printProductionOrderApi, printProductionOrderApi,
getOrderDetailById, getOrderDetailById,
updateRemarkApi, updateRemarkApi,
getProductionClientApi,
printPickingOrderApi,
printPrintOrderApi,
stockOutCheckApi,
toBeConfirmedApi,
loadWarehouseListApi,
} from '@/api/podUsOrder' } from '@/api/podUsOrder'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import { import {
LogListData, LogListData,
PodUsOrderListData, PodUsOrderListData,
ProductList, ProductList,
ProductionClient,
SearchForm, SearchForm,
Tab, Tab,
WarehouseListData,
cardImages, cardImages,
} from '@/types/api/podUsOrder' } from '@/types/api/podUsOrder'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
...@@ -645,7 +720,7 @@ import { useValue } from '@/utils/hooks/useValue' ...@@ -645,7 +720,7 @@ import { useValue } from '@/utils/hooks/useValue'
import { showConfirm } from '@/utils/ui' import { showConfirm } from '@/utils/ui'
import { DocumentCopy, EditPen } from '@element-plus/icons-vue' import { DocumentCopy, EditPen } from '@element-plus/icons-vue'
import { Column } from 'element-plus' import { Column } from 'element-plus'
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref, nextTick } from 'vue'
import FastProduction from './FastProduction.vue' import FastProduction from './FastProduction.vue'
import { filePath } from '@/api/axios' import { filePath } from '@/api/axios'
import PodMakeOrder from './PodMakeOrder.vue' import PodMakeOrder from './PodMakeOrder.vue'
...@@ -807,6 +882,10 @@ const rightClick = (e: MouseEvent) => { ...@@ -807,6 +882,10 @@ const rightClick = (e: MouseEvent) => {
const handleSelectionChange = (val: PodUsOrderListData[]) => { const handleSelectionChange = (val: PodUsOrderListData[]) => {
selection.value = val selection.value = val
// 只在手动清空选择时,且当前没有补货成功的行时,才清除补货成功状态
if (val.length === 0 && stockOutSuccessIds.value.length === 0) {
stockOutSuccessIds.value = []
}
} }
const changeTab = (item: Tab) => { const changeTab = (item: Tab) => {
status.value = item.status || '' status.value = item.status || ''
...@@ -912,24 +991,48 @@ const handleUpdateRemark = async (item: ProductList) => { ...@@ -912,24 +991,48 @@ const handleUpdateRemark = async (item: ProductList) => {
} }
}) })
} }
const productionClientValue = ref('')
const productionClient = ref<ProductionClient[]>()
const productionClientVisible = ref(false)
let confirmBtn = false
let pickingBtn = false
let printBtn = false
const confirmOrder = async () => { const confirmOrder = async () => {
if (selection.value.length === 0) { if (selection.value.length === 0) {
return ElMessage.warning('请选择数据') return ElMessage.warning('请选择数据')
} }
confirmBtn = true
pickingBtn = false
printBtn = false
productionClientValue.value = ''
productionClientVisible.value = true
}
const loadProductionClient = async () => {
try { try {
await showConfirm('确定确认吗?', { const res = await getProductionClientApi()
confirmButtonText: '确认', if (res.code !== 200) return
cancelButtonText: '取消', productionClient.value = res.data
type: 'warning', } catch (e) {
}) console.error(e)
} catch {
return
} }
}
const submit = async () => {
if (confirmBtn) {
await submitConfirm()
} else if (printBtn) {
await submitPrintPickingOrder()
} else if (pickingBtn) {
await submitPickingOrder()
}
}
const submitConfirm = async () => {
const ids = selection.value.map((item) => item.id) const ids = selection.value.map((item) => item.id)
try { try {
const res = await confirmOrderApi(ids) const res = await confirmOrderApi(ids, productionClientValue.value)
if (res.code !== 200) return if (res.code !== 200) return
ElMessage.success('操作成功') ElMessage.success('操作成功')
productionClientVisible.value = false
confirmBtn = false
search() search()
loadTabData() loadTabData()
} catch (e) { } catch (e) {
...@@ -970,12 +1073,59 @@ const printProductionOrder = async () => { ...@@ -970,12 +1073,59 @@ const printProductionOrder = async () => {
if (res.code !== 200) return if (res.code !== 200) return
ElMessage.success('操作成功') ElMessage.success('操作成功')
window.open(filePath + res.message) window.open(filePath + res.message)
} catch (e) {
console.error(e)
}
}
const printPickingOrder = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
pickingBtn = false
printBtn = true
confirmBtn = false
productionClientVisible.value = true
productionClientValue.value = ''
}
const pickingComplete = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
pickingBtn = true
printBtn = false
confirmBtn = false
productionClientVisible.value = true
productionClientValue.value = ''
}
const submitPrintPickingOrder = async () => {
const orderIds = selection.value.map((item) => item.id)
try {
const res = await printPrintOrderApi(orderIds, productionClientValue.value)
if (res.code !== 200) return
ElMessage.success('操作成功')
window.open(filePath + res.message)
printBtn = false
} catch (e) {
console.error(e)
}
}
const submitPickingOrder = async () => {
const orderIds = selection.value.map((item) => item.id)
try {
const res = await printPickingOrderApi(
orderIds,
productionClientValue.value,
)
if (res.code !== 200) return
ElMessage.success('操作成功')
search() search()
loadTabData() loadTabData()
printBtn = false
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
} }
const changeExceptionOrder = async () => { const changeExceptionOrder = async () => {
if (selection.value.length === 0) { if (selection.value.length === 0) {
return ElMessage.warning('请选择数据') return ElMessage.warning('请选择数据')
...@@ -1123,6 +1273,81 @@ const printPodOrder = async () => { ...@@ -1123,6 +1273,81 @@ const printPodOrder = async () => {
sheetPrinter.value = lodop.GET_PRINTER_NAME(0) sheetPrinter.value = lodop.GET_PRINTER_NAME(0)
podOrderVisible.value = true podOrderVisible.value = true
} }
// 添加补货成功行的状态
const stockOutSuccessIds = ref<number[]>([])
const stockOutCheck = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
try {
const selectedIds = selection.value.map((item) => item.id)
const res = await stockOutCheckApi(selectedIds)
if (res.code !== 200) return
const successIds = res.data || []
if (successIds.length === 0) {
ElMessage.warning('未补到货')
return
}
ElMessage.success('操作成功')
const { success, others } = (
tableData.value as PodUsOrderListData[]
).reduce(
(acc, item) => {
successIds.includes(item.id)
? acc.success.push(item)
: acc.others.push(item)
return acc
},
{
success: [] as PodUsOrderListData[],
others: [] as PodUsOrderListData[],
},
)
tableData.value = [...success, ...others]
// 更新补货成功的行ID
stockOutSuccessIds.value = successIds
// 等待DOM更新后再设置选中状态
await nextTick()
// 清除所有选中状态
tableRef.value?.clearSelection()
// 选中补货成功的行
success.forEach((row) => {
tableRef.value?.toggleRowSelection(row, true)
})
} catch (error) {
console.error('补货校验失败:', error)
}
}
const toBeConfirmed = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
try {
await ElMessageBox.confirm('确定转至待确认吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
} catch (e) {
return
}
try {
const res = await toBeConfirmedApi(selection.value.map((item) => item.id))
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
loadTabData()
} catch (e) {
console.error(e)
}
}
const sheetPrinter = ref('') const sheetPrinter = ref('')
const handlePrinterChange = (value: string) => { const handlePrinterChange = (value: string) => {
sheetPrinter.value = value sheetPrinter.value = value
...@@ -1307,9 +1532,33 @@ const onFastRefresh = () => { ...@@ -1307,9 +1532,33 @@ const onFastRefresh = () => {
loadTabData() loadTabData()
search() search()
} }
// 修改行样式方法
const getRowStyle = ({ row }: { row: PodUsOrderListData }) => {
if (stockOutSuccessIds.value.includes(row.id)) {
return {
backgroundColor: '#f0f9eb',
color: '#67c23a',
}
}
return {}
}
// 添加表格ref
const tableRef = ref()
const warehouseList = ref<WarehouseListData[]>([])
const loadWarehouseList = async () => {
try {
const res = await loadWarehouseListApi()
if (res.code !== 200) return
warehouseList.value = res.data
} catch (e) {
console.error(e)
}
}
onMounted(() => { onMounted(() => {
loadTabData() loadTabData()
getUserMark() getUserMark()
loadProductionClient()
loadWarehouseList()
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
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