Fix Bug #452: 领用出库模块选择药品时提示"仓库数量为0,无法调用",与实际库存数据不符
严格批号查询返回记录但 orgQuantity=0 时,原代码直接调用 applyFromDto 并弹出警告, 未回退到非严格查询(不含 lotNumber)获取同仓库其他有库存的批号。 修复:在 applyFromDto 之前检查 orgQuantity > 0,数量为0时回退到非严格查询。
This commit is contained in:
@@ -1131,15 +1131,15 @@ function handleLocationClick(item, row, index) {
|
||||
.then((res) => {
|
||||
const list = res.data || [];
|
||||
const d = pickBestOrgQuantityRow(list);
|
||||
const strictOk = d && Number(d.orgQuantity ?? 0) > 0;
|
||||
if (strictOk) {
|
||||
|
||||
// 严格批号查询有库存(orgQuantity > 0)
|
||||
if (d && Number(d.orgQuantity ?? 0) > 0) {
|
||||
applyFromDto(d, false);
|
||||
if (Number(r.totalQuantity) <= 0) {
|
||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
||||
}
|
||||
persistStore();
|
||||
return;
|
||||
}
|
||||
|
||||
// 严格查询无库存或数量为0 → 回退到非严格查询(查同仓库其他批号)
|
||||
if (lotTrimmed) {
|
||||
return runGet(false).then((res2) => {
|
||||
const list2 = res2.data || [];
|
||||
@@ -1157,6 +1157,8 @@ function handleLocationClick(item, row, index) {
|
||||
persistStore();
|
||||
});
|
||||
}
|
||||
|
||||
// 没有指定批号,直接提示
|
||||
r.totalQuantity = 0;
|
||||
r.price = 0;
|
||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
||||
|
||||
Reference in New Issue
Block a user