565 [库房管理-调拨] 调拨单明细中“源仓库库存数量”未正确读取库存值,始终显示为0

600 【住院护士站-医嘱执行】数据一致性:医嘱执行成功后,在“已执行”列表中无法查询到该医嘱记录
This commit is contained in:
wangjian963
2026-05-29 13:52:27 +08:00
parent 3997c02564
commit c6ac8d1cb1
4 changed files with 32 additions and 98 deletions

View File

@@ -1180,6 +1180,9 @@ function selectRow(rowValue, index) {
form.purchaseinventoryList[index].partPercent = rowValue.partPercent;
form.purchaseinventoryList[index].unitList = rowValue.unitList[0];
form.purchaseinventoryList[index].lotNumber = rowValue.lotNumber;
// 补全单位字典文本formatInventory 依赖此字段格式化库存显示
form.purchaseinventoryList[index].unitCode_dictText = rowValue.unitCode_dictText;
form.purchaseinventoryList[index].minUnitCode_dictText = rowValue.minUnitCode_dictText;
form.purchaseinventoryList[index].itemQuantity = 0;
form.purchaseinventoryList[index].totalPrice = 0;
// 维护一个大小单位的map用来判断当前选中单位是大/小单位
@@ -1194,21 +1197,13 @@ function selectRow(rowValue, index) {
value: rowValue.minUnitCode,
},
];
if (route.query.supplyBusNo) {
handleLocationClick(
receiptHeaderForm.sourceLocationId1,
receiptHeaderForm.purposeLocationId1,
form.purchaseinventoryList[index].itemId,
index
);
} else {
handleLocationClick(
form.purchaseinventoryList[index].sourceLocationId,
form.purchaseinventoryList[index].purposeLocationId,
form.purchaseinventoryList[index].itemId,
index
);
}
// 新单/编辑单统一使用行级仓库ID不再分支判断 route.query.supplyBusNo
handleLocationClick(
form.purchaseinventoryList[index].sourceLocationId,
form.purchaseinventoryList[index].purposeLocationId,
form.purchaseinventoryList[index].itemId,
index
);
editBatchTransfer(index); // todo
}
@@ -1220,23 +1215,29 @@ function handleLocationClick(id, purposeLocationId, itemId, index) {
objLocationId: purposeLocationId,
lotNumber: form.purchaseinventoryList[index].lotNumber,
}).then((res) => {
if (res.data && res.data[0]) {
form.purchaseinventoryList[index].itemTable = res.data[0].itemTable || '';
form.purchaseinventoryList[index].supplierId = res.data[0].supplierId || '';
form.purchaseinventoryList[index].startTime = formatDateymd(res.data[0].productionDate) || '';
form.purchaseinventoryList[index].endTime = formatDateymd(res.data[0].expirationDate) || '';
if (res.data && res.data.length) {
// SQL 按 locationId 分组后可能有两条记录(源/目的),根据 locationId 精确匹配而非盲目取 res.data[0]
const srcId = String(id);
const purId = String(purposeLocationId);
const sourceRow = res.data.find(item => String(item.locationId) === srcId) || {};
const purposeRow = res.data.find(item => String(item.locationId) === purId) || {};
form.purchaseinventoryList[index].price = res.data[0].price;
form.purchaseinventoryList[index].totalSourceQuantity = res.data[0].orgQuantity;
form.purchaseinventoryList[index].totalPurposeQuantity = res.data[0].objQuantity;
form.purchaseinventoryList[index].itemTable = sourceRow.itemTable || '';
form.purchaseinventoryList[index].supplierId = sourceRow.supplierId || '';
form.purchaseinventoryList[index].startTime = formatDateymd(sourceRow.productionDate) || '';
form.purchaseinventoryList[index].endTime = formatDateymd(sourceRow.expirationDate) || '';
form.purchaseinventoryList[index].price = sourceRow.price;
form.purchaseinventoryList[index].totalSourceQuantity = sourceRow.orgQuantity || 0;
form.purchaseinventoryList[index].totalPurposeQuantity = purposeRow.objQuantity || 0;
form.purchaseinventoryList[index].totalSourceQuantityDisplay = formatInventory(
res.data[0].orgQuantity,
sourceRow.orgQuantity || 0,
form.purchaseinventoryList[index].partPercent,
form.purchaseinventoryList[index].unitCode_dictText,
form.purchaseinventoryList[index].minUnitCode_dictText
);
form.purchaseinventoryList[index].totalPurposeQuantityDisplay = formatInventory(
res.data[0].objQuantity,
purposeRow.objQuantity || 0,
form.purchaseinventoryList[index].partPercent,
form.purchaseinventoryList[index].unitCode_dictText,
form.purchaseinventoryList[index].minUnitCode_dictText
@@ -1340,8 +1341,8 @@ function formatInventory(quantity, partPercent, unitCode, minUnitCode) {
return isNegative ? '-' + result : result;
}
// 整除情况
const result = absQuantity / partPercent;
// 整除时也需拼接单位后缀,否则显示为纯数字缺少单位信息
const result = (absQuantity / partPercent) + ' ' + unitCode;
return isNegative ? '-' + result : result;
}