diff --git a/src/api/wms/inventoryDetails/index.ts b/src/api/wms/inventoryDetails/index.ts index b5d935f..9e04755 100644 --- a/src/api/wms/inventoryDetails/index.ts +++ b/src/api/wms/inventoryDetails/index.ts @@ -1,6 +1,6 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; -import { InventoryDetailsVO, InventoryDetailsForm, InventoryDetailsQuery } from '@/api/wms/inventoryDetails/types'; +import { InventoryDetailsForm, InventoryDetailsQuery, InventoryDetailsVO } from '@/api/wms/inventoryDetails/types'; /** * 查询库存明细列表 @@ -74,10 +74,20 @@ export const delInventoryDetails = (inventoryDetailsId: string | number | Array< * @param query * @returns {*} */ -export function getWmsInventoryDetailsList (query) { - return request({ - url: '/wms/inventoryDetails/getWmsInventoryDetailsList', - method: 'get', - params: query - }); -}; +export function getWmsInventoryDetailsList(query) { + return request({ + url: '/wms/inventoryDetails/getWmsInventoryDetailsList', + method: 'get', + params: query + }); +} + +export function getWmsInventoryDetailbyProductId(productId: number) { + return request({ + url: '/wms/inventoryDetails/getWmsInventoryDetailbyProductId', + method: 'get', + params: { + productId: productId + } + }); +} diff --git a/src/components/WmsProductSelect/index.vue b/src/components/WmsProductSelect/index.vue index 762709b..abdea96 100644 --- a/src/components/WmsProductSelect/index.vue +++ b/src/components/WmsProductSelect/index.vue @@ -122,7 +122,7 @@ const productDialog = useDialog({ const queryParams = ref({ pageNum: 1, - pageSize: 50, + pageSize: 500, productCode: undefined, productName: undefined, activeFlag: undefined, diff --git a/src/views/wms/inStockBill/index.vue b/src/views/wms/inStockBill/index.vue index d729a6e..152bbee 100644 --- a/src/views/wms/inStockBill/index.vue +++ b/src/views/wms/inStockBill/index.vue @@ -233,6 +233,11 @@ + + + @@ -289,7 +294,6 @@ - @@ -313,6 +317,7 @@ import { getWmsWarehouseInfoList } from '@/api/wms/warehouseInfo'; import { getErpProjectInfoList } from '@/api/oa/erp/projectInfo'; // 添加展开行处理函数 import ProductSelect from '@/components/WmsProductSelect/index.vue'; import { parseTime } from '@/utils/ruoyi'; +import { getWmsInventoryDetailbyProductId } from '@/api/wms/inventoryDetails'; // 添加展开行处理函数 const handleExpandChange = async (row, expandedRows) => { @@ -349,23 +354,24 @@ const getProjectName = (projectId) => { return project ? project.projectCode : projectId; }; // 处理物料选择回调 -const handleProductSelect = (products) => { +const handleProductSelect = async (products) => { // 重置所有的物料 // selectedProducts.value = products; - // 为每个物料添加批次号 const timestamp = parseTime(new Date(), '{y}{m}{d}'); - products.forEach((material) => { + for (const material of products) { // 生成批次号:供应商代码 + 时间戳 // const supplierCode = form.value.supplierName ? form.value.supplier.substring(0, 4) : 'SUPP'; // const timestamp = new Date().getTime(); material.batchNumber = `${timestamp}`; // 设置默认单价为采购单价 - material.unitPrice = material.purchasePrice || 0; + // material.unitPrice = material.purchasePrice || 0; material.inStockAmount = 1; // 默认数量为1 - material.totalPrice = (material.unitPrice * material.inStockAmount).toFixed(2); - }); + // material.totalPrice = (material.unitPrice * material.inStockAmount).toFixed(2); + const res = await getWmsInventoryDetailbyProductId(material.productId); + material.inventoryAmount = res.data?.inventoryAmount || 0; + } selectedProducts.value.push(...products); }; @@ -390,22 +396,7 @@ const inStockBillFormRef = ref(); const addFormRef = ref(); -// 处理物料选择确认回调 -const handleMaterialConfirm = (materials) => { - console.log('选中的物料:', materials); - // 为每个物料添加扩展字段 - materials.forEach((material) => { - // 生成批次号:供应商代码 + 时间戳 - // const supplierCode = form.value.supplierName ? form.value.supplier.substring(0, 4) : 'SUPP'; - const timestamp = new Date().getTime(); - // material.batchNumber = `${supplierCode}${timestamp}`; - // 设置默认单价为采购单价 - material.unitPrice = material.purchasePrice || 0; - material.inStockAmount = 1; // 默认数量为1 - material.totalPrice = (material.unitPrice * material.inStockAmount).toFixed(2); - }); -}; // 计算总价 const calculateTotalPrice = (material) => { diff --git a/src/views/wms/inventoryDetails/indexCount.vue b/src/views/wms/inventoryDetails/indexCount.vue index f6b6b46..86e3bce 100644 --- a/src/views/wms/inventoryDetails/indexCount.vue +++ b/src/views/wms/inventoryDetails/indexCount.vue @@ -54,6 +54,7 @@ +