feat(wms): 库存选择器增加统计未出库的数量

dev
wanghao 1 day ago
parent 69e313b556
commit 2caccfb91c

@ -86,3 +86,6 @@ export function getErpProjectInfoList(query) {
params: query params: query
}); });
} }

@ -74,3 +74,11 @@ export function getWmsOutStockDetailsList(query) {
params: query params: query
}); });
} }
export function countUnOutStockDetails(query) {
return request({
url: '/wms/outStockDetails/countUnOutStockDetails',
method: 'get',
params: query
});
}

@ -81,6 +81,11 @@
<vxe-column key="productSpe" title="物料描述" align="center" field="productSpe" /> <vxe-column key="productSpe" title="物料描述" align="center" field="productSpe" />
<vxe-column key="externalBrand" title="品牌" align="center" field="externalBrand" /> <vxe-column key="externalBrand" title="品牌" align="center" field="externalBrand" />
<vxe-column key="inventoryAmount" title="库存数量" align="center" field="inventoryAmount" /> <vxe-column key="inventoryAmount" title="库存数量" align="center" field="inventoryAmount" />
<vxe-column key="lockedStock" title="锁定库存" align="center" width="100">
<template #default="{ row }">
{{ row.lockedAmount || 0 }}
</template>
</vxe-column>
<!--<vxe-column key="unitPrice" title="单价" align="center" field="unitPrice" />--> <!--<vxe-column key="unitPrice" title="单价" align="center" field="unitPrice" />-->
</vxe-table> </vxe-table>
@ -111,6 +116,7 @@ import { VxeTableInstance } from 'vxe-table';
import useDialog from '@/hooks/useDialog'; import useDialog from '@/hooks/useDialog';
import { computed, getCurrentInstance, nextTick, ref, watch } from 'vue'; import { computed, getCurrentInstance, nextTick, ref, watch } from 'vue';
import { getErpProjectInfoList } from '@/api/oa/erp/projectInfo'; import { getErpProjectInfoList } from '@/api/oa/erp/projectInfo';
import { countUnOutStockDetails } from '@/api/wms/outStockDetails';
interface PropType { interface PropType {
modelValue?: InventoryDetailsVO[] | InventoryDetailsVO | undefined; modelValue?: InventoryDetailsVO[] | InventoryDetailsVO | undefined;
@ -184,6 +190,18 @@ const getList = async () => {
try { try {
const res = await listInventoryDetails(queryParams.value); const res = await listInventoryDetails(queryParams.value);
inventoryDetailsList.value = res.rows; inventoryDetailsList.value = res.rows;
//
for (const item of inventoryDetailsList.value) {
try {
const lockRes = await countUnOutStockDetails({
inventoryDetailsId: item.inventoryDetailsId
});
item.lockedAmount = lockRes.data?.outStockAmount || 0;
} catch (error) {
console.error('查询锁定库存失败:', error);
item.lockedAmount = 0;
}
}
total.value = res.total; total.value = res.total;
} catch (error) { } catch (error) {
console.error('查询库存明细列表失败:', error); console.error('查询库存明细列表失败:', error);

@ -81,7 +81,9 @@
</el-row> </el-row>
</template> </template>
<!-- 出库单表格 -->
<el-table <el-table
ref="outStockTableRef"
v-loading="loading" v-loading="loading"
border border
:data="outStockBillList" :data="outStockBillList"
@ -267,6 +269,11 @@
<el-table-column label="物料名称" align="center" prop="productName" /> <el-table-column label="物料名称" align="center" prop="productName" />
<!--<el-table-column label="单价" align="center" prop="unitPrice" width="80" />--> <!--<el-table-column label="单价" align="center" prop="unitPrice" width="80" />-->
<el-table-column label="当前库存" align="center" prop="inventoryAmount" width="90" /> <el-table-column label="当前库存" align="center" prop="inventoryAmount" width="90" />
<el-table-column label="锁定库存" align="center" width="90">
<template #default="scope">
{{ scope.row.lockedAmount || 0 }}
</template>
</el-table-column>
<el-table-column label="出库数量" align="center" prop="outStockAmount" width="140"> <el-table-column label="出库数量" align="center" prop="outStockAmount" width="140">
<template #default="scope"> <template #default="scope">
<el-input-number <el-input-number
@ -274,7 +281,7 @@
:min="0" :min="0"
:precision="2" :precision="2"
:step="1" :step="1"
:max="scope.row.inventoryAmount" :max="scope.row.inventoryAmount - scope.row.lockedAmount"
controls-position="right" controls-position="right"
size="small" size="small"
placeholder="请输入出库数量" placeholder="请输入出库数量"
@ -555,6 +562,7 @@ const getList = async () => {
outStockBillList.value = res.rows; outStockBillList.value = res.rows;
total.value = res.total; total.value = res.total;
loading.value = false; loading.value = false;
closeChildTable();
}; };
/** 取消按钮 */ /** 取消按钮 */
@ -695,7 +703,7 @@ const handleDelete = async (row?: OutStockBillVO) => {
return; return;
} }
const _outStockBillIds = row?.outStockBillId || ids.value; const _outStockBillIds = row?.outStockBillId || ids.value;
await proxy?.$modal.confirm('是否确认删除出库单编号为"' + _outStockBillIds + '"的数据项?').finally(() => (loading.value = false)); await proxy?.$modal.confirm('是否确认删除出库单编号为"' + row?.outStockCode + '"的数据项?').finally(() => (loading.value = false));
await delOutStockBill(_outStockBillIds); await delOutStockBill(_outStockBillIds);
proxy?.$modal.msgSuccess('删除成功'); proxy?.$modal.msgSuccess('删除成功');
await getList(); await getList();
@ -703,7 +711,7 @@ const handleDelete = async (row?: OutStockBillVO) => {
/** 发货操作 */ /** 发货操作 */
const handleDeliver = async (row?: OutStockBillVO) => { const handleDeliver = async (row?: OutStockBillVO) => {
if (row.outStockBillStatus !== '0') { if (row.outStockBillStatus !== '0') {
ElMessage.warning('不符合发货条件'); ElMessage.warning('不符合出库条件');
return; return;
} }
try { try {
@ -728,7 +736,16 @@ const handleExport = () => {
`outStockBill_${new Date().getTime()}.xlsx` `outStockBill_${new Date().getTime()}.xlsx`
); );
}; };
//
const outStockTableRef = ref();
//
const closeChildTable = () => {
if (outStockTableRef.value) {
outStockTableRef.value.store.states.expandRows.value.forEach((row) => {
outStockTableRef.value.toggleRowExpansion(row, false);
});
}
};
onMounted(() => { onMounted(() => {
getList(); getList();
// //

Loading…
Cancel
Save