feat(工单管理): 增强库存查询功能并添加分页支持
- 在物料领料、成品入库和出货对话框中添加分页功能 - 增加"隐藏0库存"开关和库存类别选择器 - 修改API接口为POST方式并支持分页参数 - 优化删除工单的条件判断
This commit is contained in:
@@ -290,17 +290,6 @@ export function getShipmentList(workorder) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工单号查询物料库存
|
||||
* @param {工单号} workorder
|
||||
*/
|
||||
export function getMaterialInventoryList(workorder) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/GetMaterialInventoryList/' + workorder,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 领料操作
|
||||
* @param {领料请求参数} data
|
||||
@@ -336,36 +325,55 @@ export function shipProduct(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工单号查询物料库存
|
||||
* @param {工单号} data.workorder
|
||||
* @param {是否隐藏为0记录} data.isHideZero
|
||||
* @param {搜索方式} data.searchType
|
||||
*/
|
||||
export function getMaterialInventoryList(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/GetMaterialInventoryList',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 根据工单号获取可领料工单清单
|
||||
* @param {工单号} workorder
|
||||
* @param {工单号} data.workorder
|
||||
* @param {是否隐藏为0记录} data.isHideZero
|
||||
* @param {查询范围 1-物料库 2-转用库} data.searchType
|
||||
*/
|
||||
export function getPickableWorkordersByWorkorder(workorder) {
|
||||
export function getPickableWorkordersByWorkorder(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/GetPickableWorkordersByWorkorder/' + workorder,
|
||||
method: 'get'
|
||||
url: 'mes/productManagement/ProWorkorder/GetPickableWorkordersByWorkorder',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工单号获取可出货订单清单
|
||||
* @param {工单号} workorder
|
||||
* @param {工单号} data.workorder
|
||||
* @param {是否隐藏为0记录} data.isHideZero
|
||||
*/
|
||||
export function getShippableOrdersByWorkorder(workorder) {
|
||||
export function getShippableOrdersByWorkorder(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/GetShippableOrdersByWorkorder/' + workorder,
|
||||
method: 'get'
|
||||
url: 'mes/productManagement/ProWorkorder/GetShippableOrdersByWorkorder',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工单号查询成品库存
|
||||
* @param {工单号} workorder
|
||||
* @param {工单号} data.workorder
|
||||
* @param {是否隐藏为0记录} data.isHideZero
|
||||
*/
|
||||
export function getProductInventoryList(workorder) {
|
||||
export function getProductInventoryList(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/GetProductInventoryList/' + workorder,
|
||||
method: 'get'
|
||||
url: 'mes/productManagement/ProWorkorder/GetProductInventoryList',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -41,6 +41,13 @@
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>可领料库存清单</span>
|
||||
<div class="card-header-right">
|
||||
<el-select v-model="searchType" placeholder="选择库存类别" size="small" style="width: 150px; margin-right: 10px">
|
||||
<el-option label="物料库" :value="1" />
|
||||
<el-option label="转用库" :value="2" />
|
||||
</el-select>
|
||||
<el-switch v-model="isHideZero" active-text="隐藏0库存" inactive-text="显示0库存" size="small" @change="loadInventoryList" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-table :data="inventoryList" stripe size="small" border v-loading="inventoryLoading">
|
||||
@@ -60,6 +67,17 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<div class="pagination-container" v-if="inventoryTotal > 0">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.currentPage"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="inventoryTotal"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange" />
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 可领料工单选择对话框 -->
|
||||
@@ -202,6 +220,16 @@ const pickableWorkorders = ref([])
|
||||
const showWorkorderSelectDialog = ref(false)
|
||||
const workorderSelectLoading = ref(false)
|
||||
|
||||
// 新增变量:控制是否显示0库存
|
||||
const isHideZero = ref(true)
|
||||
const searchType = ref(1)
|
||||
|
||||
// 分页变量
|
||||
const pagination = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
|
||||
// 表格数据
|
||||
const pickRecords = ref([])
|
||||
const inventoryList = ref([])
|
||||
@@ -319,13 +347,19 @@ function loadInventoryList() {
|
||||
}
|
||||
|
||||
inventoryLoading.value = true
|
||||
// 调用后端API
|
||||
getMaterialInventoryList(props.workorderInfo.workorder)
|
||||
// 调用后端API,传递isHideZero、searchType和分页参数
|
||||
getMaterialInventoryList({
|
||||
workorder: props.workorderInfo.workorder,
|
||||
isHideZero: isHideZero.value,
|
||||
searchType: searchType.value,
|
||||
pageNum: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.code === 200) {
|
||||
// 转换后端返回的数据格式为前端需要的格式
|
||||
inventoryList.value = response.data
|
||||
inventoryTotal.value = inventoryList.value.length
|
||||
inventoryList.value = response.data.result || []
|
||||
inventoryTotal.value = response.data.totalNum || 0
|
||||
} else {
|
||||
proxy.$message.error('获取库存清单失败: ' + response.msg)
|
||||
inventoryList.value = []
|
||||
@@ -342,6 +376,17 @@ function loadInventoryList() {
|
||||
})
|
||||
}
|
||||
|
||||
// 分页相关方法
|
||||
function handleSizeChange(val) {
|
||||
pagination.pageSize = val
|
||||
loadInventoryList()
|
||||
}
|
||||
|
||||
function handleCurrentChange(val) {
|
||||
pagination.currentPage = val
|
||||
loadInventoryList()
|
||||
}
|
||||
|
||||
// 加载库位选项
|
||||
function loadLocationOptions() {
|
||||
// 这里应该调用实际的API接口获取库位列表
|
||||
@@ -436,12 +481,18 @@ function handlePickMaterial(material) {
|
||||
// 加载可领料工单列表
|
||||
function loadPickableWorkorders() {
|
||||
workorderSelectLoading.value = true
|
||||
// 调用后端API获取可领料工单列表
|
||||
getPickableWorkordersByWorkorder(props.workorderInfo.workorder)
|
||||
// 调用后端API获取可领料工单列表,传递isHideZero和searchType参数
|
||||
getPickableWorkordersByWorkorder({
|
||||
Workorder: props.workorderInfo.workorder,
|
||||
IsHideZero: isHideZero.value,
|
||||
SearchType: searchType.value,
|
||||
Page: 1,
|
||||
PageSize: 100
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.code === 200) {
|
||||
// 计算每个工单的可领料数量
|
||||
pickableWorkorders.value = response.data
|
||||
pickableWorkorders.value = response.data.result || []
|
||||
// 显示工单选择对话框
|
||||
showWorkorderSelectDialog.value = true
|
||||
} else {
|
||||
|
||||
@@ -37,13 +37,22 @@
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>库存清单</span>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleStorageMaterial()"
|
||||
:disabled="!props.workorderInfo || !props.workorderInfo.workorder">
|
||||
入库
|
||||
</el-button>
|
||||
<div class="card-header-right">
|
||||
<el-switch
|
||||
v-model="isHideZero"
|
||||
active-text="隐藏0库存"
|
||||
inactive-text="显示0库存"
|
||||
size="small"
|
||||
@change="loadInventoryList"
|
||||
style="margin-right: 10px" />
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleStorageMaterial()"
|
||||
:disabled="!props.workorderInfo || !props.workorderInfo.workorder">
|
||||
入库
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-table :data="inventoryList" stripe size="small" border v-loading="inventoryLoading">
|
||||
@@ -53,6 +62,17 @@
|
||||
<el-table-column prop="currentQuantity" label="当前库存" width="100" />
|
||||
<!-- <el-table-column prop="locationCode" label="库位" width="120" /> -->
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<div class="pagination-container" v-if="inventoryTotal > 0">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.currentPage"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="inventoryTotal"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange" />
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 入库单据弹窗 -->
|
||||
@@ -134,6 +154,15 @@ const showStorageForm = ref(false)
|
||||
const recordsLoading = ref(false)
|
||||
const inventoryLoading = ref(false)
|
||||
|
||||
// 新增变量:控制是否显示0库存
|
||||
const isHideZero = ref(true)
|
||||
|
||||
// 分页变量
|
||||
const pagination = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
|
||||
// 表格数据
|
||||
const storageRecords = ref([])
|
||||
const inventoryList = ref([])
|
||||
@@ -240,13 +269,18 @@ function loadInventoryList() {
|
||||
}
|
||||
|
||||
inventoryLoading.value = true
|
||||
// 调用后端API
|
||||
getProductInventoryList(props.workorderInfo.workorder)
|
||||
// 调用后端API,传递isHideZero和分页参数
|
||||
getProductInventoryList({
|
||||
workorder: props.workorderInfo.workorder,
|
||||
isHideZero: isHideZero.value,
|
||||
pageNum: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.code === 200) {
|
||||
// 转换后端返回的数据格式为前端需要的格式
|
||||
inventoryList.value = response.data
|
||||
inventoryTotal.value = inventoryList.value.length
|
||||
inventoryList.value = response.data.result || []
|
||||
inventoryTotal.value = response.data.totalNum || 0
|
||||
} else {
|
||||
proxy.$message.error('获取库存清单失败: ' + response.msg)
|
||||
inventoryList.value = []
|
||||
@@ -263,6 +297,17 @@ function loadInventoryList() {
|
||||
})
|
||||
}
|
||||
|
||||
// 分页相关方法
|
||||
function handleSizeChange(val) {
|
||||
pagination.pageSize = val
|
||||
loadInventoryList()
|
||||
}
|
||||
|
||||
function handleCurrentChange(val) {
|
||||
pagination.currentPage = val
|
||||
loadInventoryList()
|
||||
}
|
||||
|
||||
// 获取操作员列表
|
||||
function getOperatorList() {
|
||||
try {
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>可出货订单</span>
|
||||
<el-switch v-model="isHideZero" active-text="隐藏0库存" inactive-text="显示0库存" size="small" @change="loadInventoryList" />
|
||||
</div>
|
||||
</template>
|
||||
<el-table :data="inventoryList" stripe size="small" border v-loading="inventoryLoading">
|
||||
@@ -62,6 +63,17 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<div class="pagination-container" v-if="inventoryTotal > 0">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.currentPage"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="inventoryTotal"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange" />
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 出货单据弹窗 -->
|
||||
@@ -147,6 +159,15 @@ const showShipmentForm = ref(false)
|
||||
const recordsLoading = ref(false)
|
||||
const inventoryLoading = ref(false)
|
||||
|
||||
// 新增变量:控制是否显示0库存
|
||||
const isHideZero = ref(true)
|
||||
|
||||
// 分页变量
|
||||
const pagination = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
|
||||
// 表格数据
|
||||
const shipmentRecords = ref([])
|
||||
const inventoryList = ref([])
|
||||
@@ -260,13 +281,18 @@ function loadInventoryList() {
|
||||
}
|
||||
|
||||
inventoryLoading.value = true
|
||||
// 调用后端API
|
||||
getShippableOrdersByWorkorder(props.workorderInfo.workorder)
|
||||
// 调用后端API,传递isHideZero和分页参数
|
||||
getShippableOrdersByWorkorder({
|
||||
workorder: props.workorderInfo.workorder,
|
||||
isHideZero: isHideZero.value,
|
||||
pageNum: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.code === 200) {
|
||||
// 直接使用后端返回的数据
|
||||
inventoryList.value = response.data || []
|
||||
inventoryTotal.value = inventoryList.value.length
|
||||
inventoryList.value = response.data.result || []
|
||||
inventoryTotal.value = response.data.totalNum || 0
|
||||
} else {
|
||||
proxy.$message.error('获取库存清单失败: ' + response.msg)
|
||||
inventoryList.value = []
|
||||
@@ -283,6 +309,17 @@ function loadInventoryList() {
|
||||
})
|
||||
}
|
||||
|
||||
// 分页相关方法
|
||||
function handleSizeChange(val) {
|
||||
pagination.pageSize = val
|
||||
loadInventoryList()
|
||||
}
|
||||
|
||||
function handleCurrentChange(val) {
|
||||
pagination.currentPage = val
|
||||
loadInventoryList()
|
||||
}
|
||||
|
||||
// 获取操作员列表
|
||||
function getOperatorList() {
|
||||
try {
|
||||
|
||||
@@ -174,7 +174,9 @@
|
||||
<el-dropdown-item @click="handleMove(scope.row, 1)"><el-text type="info">上移</el-text></el-dropdown-item>
|
||||
<el-dropdown-item @click="handleMove(scope.row, 2)"><el-text type="info">下移</el-text></el-dropdown-item>
|
||||
<!-- <el-dropdown-item @click="handleUpdate(scope.row)"><el-text type="success">编辑</el-text></el-dropdown-item> -->
|
||||
<el-dropdown-item v-if="scope.row.planNum == 0" @click="handleDelete(scope.row)"
|
||||
<el-dropdown-item
|
||||
v-if="scope.row.planNum == 0 && (scope.row.feedOrder == null || scope.row.feedOrder == '')"
|
||||
@click="handleDelete(scope.row)"
|
||||
><el-text type="danger">删除</el-text></el-dropdown-item
|
||||
>
|
||||
</el-dropdown-menu>
|
||||
|
||||
Reference in New Issue
Block a user