diff --git a/src/api/productManagement/proworkorder.js b/src/api/productManagement/proworkorder.js index f5c4641..3a60428 100644 --- a/src/api/productManagement/proworkorder.js +++ b/src/api/productManagement/proworkorder.js @@ -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 }) } diff --git a/src/views/productManagement/ProWorkorder/components/WorkorderMaterialPickDialog.vue b/src/views/productManagement/ProWorkorder/components/WorkorderMaterialPickDialog.vue index 235a9c0..c6c2058 100644 --- a/src/views/productManagement/ProWorkorder/components/WorkorderMaterialPickDialog.vue +++ b/src/views/productManagement/ProWorkorder/components/WorkorderMaterialPickDialog.vue @@ -41,6 +41,13 @@ @@ -60,6 +67,17 @@ + +
+ +
@@ -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 { diff --git a/src/views/productManagement/ProWorkorder/components/WorkorderProductStorageDialog.vue b/src/views/productManagement/ProWorkorder/components/WorkorderProductStorageDialog.vue index 655372d..555fa31 100644 --- a/src/views/productManagement/ProWorkorder/components/WorkorderProductStorageDialog.vue +++ b/src/views/productManagement/ProWorkorder/components/WorkorderProductStorageDialog.vue @@ -37,13 +37,22 @@ @@ -53,6 +62,17 @@ + +
+ +
@@ -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 { diff --git a/src/views/productManagement/ProWorkorder/components/WorkorderShipmentDialog.vue b/src/views/productManagement/ProWorkorder/components/WorkorderShipmentDialog.vue index da0d956..451631b 100644 --- a/src/views/productManagement/ProWorkorder/components/WorkorderShipmentDialog.vue +++ b/src/views/productManagement/ProWorkorder/components/WorkorderShipmentDialog.vue @@ -41,6 +41,7 @@ @@ -62,6 +63,17 @@ + +
+ +
@@ -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 { diff --git a/src/views/productManagement/ProWorkorder/index.vue b/src/views/productManagement/ProWorkorder/index.vue index fb24a1a..5636ef1 100644 --- a/src/views/productManagement/ProWorkorder/index.vue +++ b/src/views/productManagement/ProWorkorder/index.vue @@ -174,7 +174,9 @@ 上移 下移 - 删除