feat(wms): 入库物料选择后显示库存数量

dev
wanghao 2 weeks ago
parent e75a2256ab
commit 51ded526d0

@ -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
}
});
}

@ -122,7 +122,7 @@ const productDialog = useDialog({
const queryParams = ref<WmsBaseProductQuery>({
pageNum: 1,
pageSize: 50,
pageSize: 500,
productCode: undefined,
productName: undefined,
activeFlag: undefined,

@ -233,6 +233,11 @@
<el-input v-model="scope.row.batchNumber" placeholder="自动生成批次号" :readonly="true" size="small" />
</template>
</el-table-column>
<el-table-column prop="inventoryAmount" label="库存数量" width="120" align="center">
<template #default="scope">
<span>{{ scope.row.inventoryAmount || 0 }}</span>
</template>
</el-table-column>
<!--<el-table-column prop="unitPrice" label="单价(元)" width="140">-->
<!-- <template #default="scope">-->
<!-- <el-input-number-->
@ -289,7 +294,6 @@
</div>
</el-card>
<!-- <MaterialSelect ref="materialSelectRef" v-model="selectedMaterials" :multiple="true" @confirmCallBack="handleMaterialConfirm" />-->
<product-select ref="productSelectRef" :multiple="true" @confirmCallBack="handleProductSelect" />
</div>
@ -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<ElFormInstance>();
const addFormRef = ref<ElFormInstance>();
//
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) => {

@ -54,6 +54,7 @@
</el-table-column>
<el-table-column label="所属仓库" align="center" prop="warehouseName" v-if="columns[3].visible" />
<el-table-column label="仓库编码" align="center" prop="warehouseCode" v-if="columns[3].visible" />
<el-table-column label="物料编码" align="center" prop="productCode" v-if="columns[4].visible" />
<el-table-column label="物料名称" align="center" prop="productName" v-if="columns[4].visible" />
<el-table-column label="物料描述" align="center" prop="productSpe" v-if="columns[4].visible" />

Loading…
Cancel
Save