Commit e25dfaf4 by qinjianhui

feat: 备货单据字段填充

parent 7b7b3751
...@@ -114,3 +114,21 @@ export function stockingCompleteApi(id: number) { ...@@ -114,3 +114,21 @@ export function stockingCompleteApi(id: number) {
`factory/supply/stockingUpManage/delivery?id=${id}`, `factory/supply/stockingUpManage/delivery?id=${id}`,
) )
} }
export function deleteStockingOrderApi(id: string | number) {
return axios.get<never, BaseRespData<void>>(
`factory/supply/stockingUpManage/delete`,
{
params: { id },
},
)
}
export function cancelStockingOrderApi(id: string | number) {
return axios.get<never, BaseRespData<void>>(
`factory/supply/stockingUpManage/cancel`,
{
params: { id },
},
)
}
...@@ -38,7 +38,7 @@ export function getStockingApplyOrderRelatedDocumentListByIdApi( ...@@ -38,7 +38,7 @@ export function getStockingApplyOrderRelatedDocumentListByIdApi(
warehouseApplyNo: string, warehouseApplyNo: string,
) { ) {
return axios.get<never, BaseRespData<RelatedDocumentList[]>>( return axios.get<never, BaseRespData<RelatedDocumentList[]>>(
`factory/supply/stockingUpWarehouseApply/getWarehouseApplyList?warehouseApplyNo=${warehouseApplyNo}`, `factory/supply/stockingUpWarehouseApply/getWarehouseInList?warehouseApplyNo=${warehouseApplyNo}`,
) )
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<ElTable <ElTable
ref="tableRef" ref="tableRef"
:data="paginatedData" :data="paginatedData"
show-overflow-tooltip
border border
:stripe="stripe" :stripe="stripe"
header-align="center" header-align="center"
......
...@@ -50,6 +50,12 @@ export interface TableData { ...@@ -50,6 +50,12 @@ export interface TableData {
updateTime?: string updateTime?: string
remark?: string remark?: string
dataVersion?: number dataVersion?: number
shippingStatus?: number
delayDays?: number
lastDeliveryTime?: string
completeTime?: string
auditName?: string
auditTime?: string
} }
export interface StockProduct { export interface StockProduct {
skuImage?: string skuImage?: string
...@@ -64,10 +70,6 @@ export interface StockProduct { ...@@ -64,10 +70,6 @@ export interface StockProduct {
inWarehouseQuantity?: number inWarehouseQuantity?: number
defectiveQuantity?: number defectiveQuantity?: number
} }
export interface supplierData {}
// 新增备货单表单
export interface AddStockingOrderForm { export interface AddStockingOrderForm {
id?: number | string id?: number | string
stockingUpManageNo?: string stockingUpManageNo?: string
...@@ -107,7 +109,27 @@ export interface StockingOrderProduct { ...@@ -107,7 +109,27 @@ export interface StockingOrderProduct {
currentShipQuantity?: number | string // 本次发货数量 currentShipQuantity?: number | string // 本次发货数量
} }
export interface RelatedDocumentList {} export interface RelatedDocumentList {
id: number
factoryId?: number
factoryCode?: string
manageId?: number
manageNo?: string
warehouseApplyNo?: string
warehouseId?: number
warehouseName?: string
skuTotal?: number
total?: number
buyStored?: number
rejectsAmount?: number
storeStatus?: string
expectDeliveryTime?: string
createUserId?: number
createUserName?: string
createTime?: string
updateTime?: string
dataVersion?: number
}
export interface InternalMemoList {} export interface InternalMemoList {}
export interface LogListData { export interface LogListData {
id: number id: number
......
...@@ -58,7 +58,29 @@ export interface StockingApplyOrderDetailList { ...@@ -58,7 +58,29 @@ export interface StockingApplyOrderDetailList {
finallyShipmentQuantity?: number finallyShipmentQuantity?: number
} }
export interface RelatedDocumentList {} export interface RelatedDocumentList {
id: number
dataVersion?: number
createTime?: string
updateTime?: string
factoryId?: number
factoryCode?: string
warehouseId?: number
warehouseName?: string
inNo?: string
skuAmount?: number
total?: number
totalPrice?: number
billStatus?: string
billStatusTxt?: string
makerName?: string
makerUserId?: number
makeTime?: string
checkerUserId?: number
checkerName?: string
source?: string
sourceOn?: string
}
export interface StockingApplyOrderDetailData { export interface StockingApplyOrderDetailData {
id: number id: number
warehouseApplyNo?: string warehouseApplyNo?: string
......
...@@ -43,6 +43,7 @@ import type { TabsPaneContext } from 'element-plus' ...@@ -43,6 +43,7 @@ import type { TabsPaneContext } from 'element-plus'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import { import {
LogListData, LogListData,
RelatedDocumentList,
StockingOrderProduct, StockingOrderProduct,
TableData, TableData,
} from '@/types/api/supply/stockingOrder' } from '@/types/api/supply/stockingOrder'
...@@ -58,46 +59,55 @@ const relatedDocumentsColumns = computed(() => { ...@@ -58,46 +59,55 @@ const relatedDocumentsColumns = computed(() => {
return [ return [
{ {
label: '关联单据', label: '关联单据',
width: 120, prop: 'warehouseApplyNo',
prop: 'documentNo', align: 'center',
}, },
{ {
label: '关联单号', label: '关联单号',
prop: 'manageNo',
align: 'center',
}, },
{ {
label: '制单人', label: '制单人',
width: 120, width: 120,
prop: 'createUserName', prop: 'createUserName',
align: 'center',
}, },
{ {
label: '制单时间', label: '制单时间',
width: 160, width: 160,
prop:'createTime',
align: 'center',
}, },
{ {
label: 'SKU个数', label: 'SKU个数',
width: 120, width: 120,
align: 'right', align: 'right',
prop: 'skuTotal',
}, },
{ {
label: '入库数量', label: '入库数量',
width: 120, width: 120,
align: 'right', align: 'right',
prop:'buyStored'
}, },
{ {
label: '申请数量', label: '申请数量',
width: 120, width: 120,
prop: 'shipmentQuantity', prop: 'total',
align: 'right', align: 'right',
}, },
{ {
label: '预计到货日期', label: '预计到货日期',
width: 160, width: 160,
align: 'center', align: 'center',
prop:'expectDeliveryTime'
}, },
{ {
label: '实际到货日期', label: '实际到货日期',
width: 160, width: 160,
align: 'center', align: 'center',
prop:'deliveryTime'
}, },
] ]
}) })
...@@ -173,7 +183,7 @@ const props = defineProps<{ ...@@ -173,7 +183,7 @@ const props = defineProps<{
}>() }>()
const stockProductsData = ref<StockingOrderProduct[]>([]) const stockProductsData = ref<StockingOrderProduct[]>([])
const relatedDocumentsData = ref<StockingOrderProduct[]>([]) const relatedDocumentsData = ref<RelatedDocumentList[]>([])
const internalMemoData = ref<StockingOrderProduct[]>([]) const internalMemoData = ref<StockingOrderProduct[]>([])
const operationLogData = ref<LogListData[]>([]) const operationLogData = ref<LogListData[]>([])
const activeTab = ref('stockProducts') const activeTab = ref('stockProducts')
......
...@@ -169,10 +169,10 @@ ...@@ -169,10 +169,10 @@
v-if="['PENDING_SUBMIT', 'STOCKING_UP'].includes(status)" v-if="['PENDING_SUBMIT', 'STOCKING_UP'].includes(status)"
class="item" class="item"
> >
<ElButton type="warning">取消</ElButton> <ElButton type="warning" @click="handleCancelOrder">取消</ElButton>
</span> </span>
<span v-if="status === 'PENDING_SUBMIT'" class="item"> <span v-if="status === 'PENDING_SUBMIT'" class="item">
<ElButton type="danger">删除</ElButton> <ElButton type="danger" @click="handleDeleteOrder">删除</ElButton>
</span> </span>
</div> </div>
</div> </div>
...@@ -226,10 +226,13 @@ ...@@ -226,10 +226,13 @@
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import dayjs from 'dayjs'
import { import {
getStockingOrderListApi, getStockingOrderListApi,
stockingCompleteApi, stockingCompleteApi,
submitStockingOrderAuditApi, submitStockingOrderAuditApi,
deleteStockingOrderApi,
cancelStockingOrderApi,
} from '@/api/supplier/stockingOrder' } from '@/api/supplier/stockingOrder'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import StockingOrderDetailTabs from './StockingOrderDetailTabs.vue' import StockingOrderDetailTabs from './StockingOrderDetailTabs.vue'
...@@ -252,13 +255,39 @@ import { ...@@ -252,13 +255,39 @@ import {
import { getStockingOrderStatusTreeApi } from '@/api/supplier/stockingOrder' import { getStockingOrderStatusTreeApi } from '@/api/supplier/stockingOrder'
import { userData } from '@/types/api/user' import { userData } from '@/types/api/user'
import { ElButton, ElTag } from 'element-plus' import { ElButton, ElTag } from 'element-plus'
const deliveryStatusList = ref([
{ label: '待发货', value: 0 },
{ label: '部分发货', value: 1 },
{ label: '全部发货', value: 2 },
])
const tableColumns = computed(() => { const tableColumns = computed(() => {
return [ return [
{ {
label: '备货单号', label: '备货单号',
prop: 'stockingUpManageNo', prop: 'stockingUpManageNo',
minWidth: 150, minWidth: 200,
align: 'center', align: 'center',
render: (row: TableData) => {
const isDelayed =
row.expectDeliveryTime &&
dayjs()
.startOf('day')
.diff(dayjs(row.expectDeliveryTime).startOf('day'), 'day') > 0
return (
<div style="position: relative; width: 100%;">
{isDelayed && (
<ElTag
type="danger"
size="small"
style="position: absolute; left: -10px; top: 2px; transform: scale(0.8);"
>
延期
</ElTag>
)}
<span>{row.stockingUpManageNo}</span>
</div>
)
},
}, },
{ {
label: '备货仓库', label: '备货仓库',
...@@ -327,9 +356,20 @@ const tableColumns = computed(() => { ...@@ -327,9 +356,20 @@ const tableColumns = computed(() => {
}, },
{ {
label: '发货状态', label: '发货状态',
prop: 'deliveryStatus', prop: 'shippingStatus',
width: 100, width: 100,
align: 'center', align: 'center',
render: (row: TableData) => {
return (
<span>
{row.shippingStatus && (
<ElTag type="primary">
{getDeliveryStatusName(row.shippingStatus)}
</ElTag>
)}
</span>
)
},
}, },
{ {
label: '备货员', label: '备货员',
...@@ -340,13 +380,13 @@ const tableColumns = computed(() => { ...@@ -340,13 +380,13 @@ const tableColumns = computed(() => {
{ {
label: '最后交货日期', label: '最后交货日期',
prop: 'lastDeliveryTime', prop: 'lastDeliveryTime',
width: 130, width: 160,
align: 'center', align: 'center',
}, },
{ {
label: '订单完成日期', label: '订单完成日期',
prop: 'completeTime', prop: 'completeTime',
width: 130, width: 160,
align: 'center', align: 'center',
}, },
{ {
...@@ -354,6 +394,18 @@ const tableColumns = computed(() => { ...@@ -354,6 +394,18 @@ const tableColumns = computed(() => {
prop: 'delayDays', prop: 'delayDays',
width: 100, width: 100,
align: 'center', align: 'center',
render: (row: TableData) => {
if (!row.expectDeliveryTime) return <span>-</span>
const delayDays = dayjs()
.startOf('day')
.diff(dayjs(row.expectDeliveryTime).startOf('day'), 'day')
if (delayDays > 0) {
return (
<span style="color: #f56c6c; font-weight: bold;">{delayDays}</span>
)
}
return <span>-</span>
},
}, },
{ {
label: '制单人', label: '制单人',
...@@ -448,11 +500,7 @@ const warehouseList = ref<WarehouseListData[]>([]) ...@@ -448,11 +500,7 @@ const warehouseList = ref<WarehouseListData[]>([])
const supplierList = ref<SupplierItem[]>([]) const supplierList = ref<SupplierItem[]>([])
const stockKeeperList = ref<userData[]>([]) const stockKeeperList = ref<userData[]>([])
const currencyList = ref<CurrencyCodeData[]>([]) const currencyList = ref<CurrencyCodeData[]>([])
const deliveryStatusList = ref([
{ label: '待发货', value: 'pending' },
{ label: '部分发货', value: 'partial' },
{ label: '全部发货', value: 'completed' },
])
const selection = ref<TableData[]>([]) const selection = ref<TableData[]>([])
const rangeTime = ref<string[]>([]) const rangeTime = ref<string[]>([])
const [searchForm, resetSearchForm] = useValue<SearchForm>({} as SearchForm) const [searchForm, resetSearchForm] = useValue<SearchForm>({} as SearchForm)
...@@ -512,6 +560,12 @@ const nodeClick = (data: TreeData) => { ...@@ -512,6 +560,12 @@ const nodeClick = (data: TreeData) => {
status.value = data.code status.value = data.code
search() search()
} }
const getDeliveryStatusName = (shippingStatus: number) => {
if (!shippingStatus) return ''
return deliveryStatusList.value.find(
(item) => item.value === Number(shippingStatus),
)?.label
}
const { const {
currentPage, currentPage,
...@@ -625,7 +679,50 @@ const handleSubmitAudit = async () => { ...@@ -625,7 +679,50 @@ const handleSubmitAudit = async () => {
console.error(e) console.error(e)
} }
} }
const handleDeleteOrder = async () => {
if (selection.value.length !== 1) {
return ElMessage.warning('请选择一条数据')
}
try {
await ElMessageBox.confirm('确定要删除选中的数据吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
try {
const res = await deleteStockingOrderApi(selection.value[0].id)
if (res.code !== 200) return
ElMessage.success('删除成功')
onRefresh()
} catch (e) {
console.error(e)
}
}
const handleCancelOrder = async () => {
if (selection.value.length !== 1) {
return ElMessage.warning('请选择一条数据')
}
try {
await ElMessageBox.confirm('确定要取消选中的数据吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
try {
const res = await cancelStockingOrderApi(selection.value[0].id)
if (res.code !== 200) return
ElMessage.success('取消成功')
onRefresh()
} catch (e) {
console.error(e)
}
}
const onRefresh = () => { const onRefresh = () => {
search() search()
loadTreeData() loadTreeData()
......
...@@ -54,30 +54,37 @@ const relatedDocumentsColumns = computed(() => { ...@@ -54,30 +54,37 @@ const relatedDocumentsColumns = computed(() => {
return [ return [
{ {
label: '关联单据', label: '关联单据',
width: 120, prop: 'inNo',
prop: 'documentNo', align: 'center',
}, },
{ {
label: '关联单号', label: '关联单号',
prop: 'sourceOn',
align: 'center',
}, },
{ {
label: '制单人', label: '制单人',
width: 120, width: 120,
prop: 'createUserName', prop: 'checkerName',
align: 'center',
}, },
{ {
label: '制单时间', label: '制单时间',
width: 160, width: 160,
prop: 'createTime',
align: 'center',
}, },
{ {
label: 'SKU个数', label: 'SKU个数',
width: 120, width: 120,
align: 'right', align: 'right',
prop: 'skuAmount',
}, },
{ {
label: '入库数量', label: '入库数量',
width: 120, width: 120,
align: 'right', align: 'right',
prop: 'total',
}, },
] ]
}) })
...@@ -144,7 +151,7 @@ const stockProductsColumns = computed(() => { ...@@ -144,7 +151,7 @@ const stockProductsColumns = computed(() => {
label: '币种', label: '币种',
prop: 'currencyCode', prop: 'currencyCode',
width: 100, width: 100,
align: 'right', align: 'center',
}, },
{ {
label: '入库单价', label: '入库单价',
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<ElButton @click="handleCancel">取消</ElButton> <ElButton @click="handleCancel">取消</ElButton>
<ElButton type="primary" :loading="submitLoading" @click="handleSubmit"> <ElButton type="primary" @click="handleSubmit">
入库 入库
</ElButton> </ElButton>
</div> </div>
...@@ -133,7 +133,6 @@ const emit = defineEmits<{ ...@@ -133,7 +133,6 @@ const emit = defineEmits<{
}>() }>()
const visible = ref(false) const visible = ref(false)
const submitLoading = ref(false)
const formRef = ref<FormInstance>() const formRef = ref<FormInstance>()
const userList = ref<userData[]>([]) const userList = ref<userData[]>([])
const locationList = ref<LocationDataBySkuData[]>([]) const locationList = ref<LocationDataBySkuData[]>([])
...@@ -344,7 +343,11 @@ const handleSubmit = async () => { ...@@ -344,7 +343,11 @@ const handleSubmit = async () => {
const checkerName = userList.value.find( const checkerName = userList.value.find(
(item) => item.id === formData.value.checkerUserId, (item) => item.id === formData.value.checkerUserId,
)?.account )?.account
submitLoading.value = true const loading = ElLoading.service({
lock: true,
text: '加载中...',
background: 'rgba(0, 0, 0, 0.7)',
})
try { try {
const res = await submitWarehousingApi({ ...formData.value, checkerName }) const res = await submitWarehousingApi({ ...formData.value, checkerName })
if (res.code === 200) { if (res.code === 200) {
...@@ -355,7 +358,7 @@ const handleSubmit = async () => { ...@@ -355,7 +358,7 @@ const handleSubmit = async () => {
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally { } finally {
submitLoading.value = false loading.close()
} }
} }
defineExpose({ open }) defineExpose({ open })
......
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