实现采购入库的供货商字段数据存放到数据库,并且系统在采购入库界面能读取对应的采购入库单的对应供货商名称显示
This commit is contained in:
@@ -161,6 +161,27 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
|
|||||||
if (receiptDetailList.isEmpty()) {
|
if (receiptDetailList.isEmpty()) {
|
||||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null));
|
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取所有供应商ID
|
||||||
|
Set<Long> supplierIds = receiptDetailList.stream()
|
||||||
|
.filter(dto -> dto.getSupplierId() != null)
|
||||||
|
.map(ReceiptDetailDto::getSupplierId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// 查询供应商信息并设置供应商名称
|
||||||
|
if (!supplierIds.isEmpty()) {
|
||||||
|
List<Supplier> suppliers = supplierService.listByIds(supplierIds);
|
||||||
|
Map<Long, String> supplierNameMap = suppliers.stream()
|
||||||
|
.collect(Collectors.toMap(Supplier::getId, Supplier::getName));
|
||||||
|
|
||||||
|
// 设置供应商名称
|
||||||
|
receiptDetailList.forEach(dto -> {
|
||||||
|
if (dto.getSupplierId() != null) {
|
||||||
|
dto.setSupplierName(supplierNameMap.getOrDefault(dto.getSupplierId(), ""));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return R.ok(receiptDetailList);
|
return R.ok(receiptDetailList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,12 +74,14 @@
|
|||||||
T2."name" AS item_name,
|
T2."name" AS item_name,
|
||||||
T2.id AS item_id,
|
T2.id AS item_id,
|
||||||
T2.part_percent,
|
T2.part_percent,
|
||||||
T2.manufacturer_text AS supplier_name,
|
T2.manufacturer_text AS manufacturer_text,
|
||||||
T3.total_volume,
|
T3.total_volume,
|
||||||
T5."name" AS practitioner_name,
|
T5."name" AS practitioner_name,
|
||||||
T6."name" AS purpose_location_name,
|
T6."name" AS purpose_location_name,
|
||||||
T6."id" AS purpose_location_id,
|
T6."id" AS purpose_location_id,
|
||||||
T7."name" AS purpose_location_store_name,
|
T7."name" AS purpose_location_store_name,
|
||||||
|
T1.supplier_id AS supplierId,
|
||||||
|
T10."name" AS supplier_name,
|
||||||
T1.occurrence_time,
|
T1.occurrence_time,
|
||||||
(SELECT SUM(T9.quantity)
|
(SELECT SUM(T9.quantity)
|
||||||
FROM wor_inventory_item T9
|
FROM wor_inventory_item T9
|
||||||
@@ -100,6 +102,8 @@
|
|||||||
LEFT JOIN wor_inventory_item T9
|
LEFT JOIN wor_inventory_item T9
|
||||||
ON T1.item_id = T9.item_id
|
ON T1.item_id = T9.item_id
|
||||||
AND T1.purpose_location_id = T9.location_id
|
AND T1.purpose_location_id = T9.location_id
|
||||||
|
LEFT JOIN adm_supplier T10
|
||||||
|
ON T1.supplier_id = T10.id
|
||||||
WHERE T1.bus_no = #{busNo}
|
WHERE T1.bus_no = #{busNo}
|
||||||
AND T1.delete_flag = '0'
|
AND T1.delete_flag = '0'
|
||||||
UNION
|
UNION
|
||||||
@@ -121,12 +125,14 @@
|
|||||||
T8."name" AS item_name,
|
T8."name" AS item_name,
|
||||||
T8.id AS item_id,
|
T8.id AS item_id,
|
||||||
T8.part_percent,
|
T8.part_percent,
|
||||||
T8.manufacturer_text AS supplier_name,
|
T8.manufacturer_text AS manufacturer_text,
|
||||||
T8."size" AS total_volume,
|
T8."size" AS total_volume,
|
||||||
T5."name" AS practitioner_name,
|
T5."name" AS practitioner_name,
|
||||||
T6."name" AS purpose_location_name,
|
T6."name" AS purpose_location_name,
|
||||||
T6."id" AS purpose_location_id,
|
T6."id" AS purpose_location_id,
|
||||||
T7."name" AS purpose_location_store_name,
|
T7."name" AS purpose_location_store_name,
|
||||||
|
T1.supplier_id AS supplierId,
|
||||||
|
T10."name" AS supplier_name,
|
||||||
T1.occurrence_time,
|
T1.occurrence_time,
|
||||||
(SELECT SUM(T9.quantity)
|
(SELECT SUM(T9.quantity)
|
||||||
FROM wor_inventory_item T9
|
FROM wor_inventory_item T9
|
||||||
@@ -145,6 +151,8 @@
|
|||||||
LEFT JOIN wor_inventory_item T9
|
LEFT JOIN wor_inventory_item T9
|
||||||
ON T1.item_id = T9.item_id
|
ON T1.item_id = T9.item_id
|
||||||
AND T1.purpose_location_id = T9.location_id
|
AND T1.purpose_location_id = T9.location_id
|
||||||
|
LEFT JOIN adm_supplier T10
|
||||||
|
ON T1.supplier_id = T10.id
|
||||||
WHERE T1.bus_no = #{busNo}
|
WHERE T1.bus_no = #{busNo}
|
||||||
AND T1.delete_flag = '0'
|
AND T1.delete_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
@@ -167,12 +175,14 @@
|
|||||||
T2."name" AS item_name,
|
T2."name" AS item_name,
|
||||||
T2.id AS item_id,
|
T2.id AS item_id,
|
||||||
T2.part_percent,
|
T2.part_percent,
|
||||||
T2.manufacturer_text AS supplier_name,
|
T2.manufacturer_text AS manufacturer_text,
|
||||||
T3.total_volume,
|
T3.total_volume,
|
||||||
T5."name" AS practitioner_name,
|
T5."name" AS practitioner_name,
|
||||||
T6."name" AS purpose_location_name,
|
T6."name" AS purpose_location_name,
|
||||||
T6."id" AS purpose_location_id,
|
T6."id" AS purpose_location_id,
|
||||||
T7."name" AS purpose_location_store_name,
|
T7."name" AS purpose_location_store_name,
|
||||||
|
T1.supplier_id AS supplierId,
|
||||||
|
T10."name" AS supplier_name,
|
||||||
(SELECT SUM(T9.quantity)
|
(SELECT SUM(T9.quantity)
|
||||||
FROM wor_inventory_item T9
|
FROM wor_inventory_item T9
|
||||||
WHERE T9.item_id = T1.item_id
|
WHERE T9.item_id = T1.item_id
|
||||||
@@ -192,6 +202,8 @@
|
|||||||
LEFT JOIN wor_inventory_item T9
|
LEFT JOIN wor_inventory_item T9
|
||||||
ON T1.item_id = T9.item_id
|
ON T1.item_id = T9.item_id
|
||||||
AND T1.purpose_location_id = T9.location_id
|
AND T1.purpose_location_id = T9.location_id
|
||||||
|
LEFT JOIN adm_supplier T10
|
||||||
|
ON T1.supplier_id = T10.id
|
||||||
WHERE T1.purpose_location_id = #{locationId}
|
WHERE T1.purpose_location_id = #{locationId}
|
||||||
AND T1.status_enum = #{statusEnum}
|
AND T1.status_enum = #{statusEnum}
|
||||||
AND T1.type_enum IN
|
AND T1.type_enum IN
|
||||||
@@ -220,12 +232,14 @@
|
|||||||
T8."name" AS item_name,
|
T8."name" AS item_name,
|
||||||
T8.id AS item_id,
|
T8.id AS item_id,
|
||||||
T8.part_percent,
|
T8.part_percent,
|
||||||
T8.manufacturer_text AS supplier_name,
|
T8.manufacturer_text AS manufacturer_text,
|
||||||
T8."size" AS total_volume,
|
T8."size" AS total_volume,
|
||||||
T5."name" AS practitioner_name,
|
T5."name" AS practitioner_name,
|
||||||
T6."name" AS purpose_location_name,
|
T6."name" AS purpose_location_name,
|
||||||
T6."id" AS purpose_location_id,
|
T6."id" AS purpose_location_id,
|
||||||
T7."name" AS purpose_location_store_name,
|
T7."name" AS purpose_location_store_name,
|
||||||
|
T1.supplier_id AS supplierId,
|
||||||
|
T10."name" AS supplier_name,
|
||||||
(SELECT SUM(T9.quantity)
|
(SELECT SUM(T9.quantity)
|
||||||
FROM wor_inventory_item T9
|
FROM wor_inventory_item T9
|
||||||
WHERE T9.item_id = T1.item_id
|
WHERE T9.item_id = T1.item_id
|
||||||
@@ -243,6 +257,8 @@
|
|||||||
LEFT JOIN wor_inventory_item T9
|
LEFT JOIN wor_inventory_item T9
|
||||||
ON T1.item_id = T9.item_id
|
ON T1.item_id = T9.item_id
|
||||||
AND T1.purpose_location_id = T9.location_id
|
AND T1.purpose_location_id = T9.location_id
|
||||||
|
LEFT JOIN adm_supplier T10
|
||||||
|
ON T1.supplier_id = T10.id
|
||||||
WHERE T1.purpose_location_id = #{locationId}
|
WHERE T1.purpose_location_id = #{locationId}
|
||||||
AND T1.status_enum = #{statusEnum}
|
AND T1.status_enum = #{statusEnum}
|
||||||
AND T1.type_enum IN
|
AND T1.type_enum IN
|
||||||
|
|||||||
@@ -1454,7 +1454,8 @@ function edit() {
|
|||||||
}
|
}
|
||||||
receiptHeaderForm.value = editData.value.item.length > 0 ? editData.value.item[0] : {};
|
receiptHeaderForm.value = editData.value.item.length > 0 ? editData.value.item[0] : {};
|
||||||
receiptHeaderForm.busNo = editData.value.editRow.supplyBusNo;
|
receiptHeaderForm.busNo = editData.value.editRow.supplyBusNo;
|
||||||
receiptHeaderForm.supplierId = editData.value.editRow.supplierId;
|
// 修改这里:优先从详情数据中获取供应商ID,如果不存在则从列表数据中获取
|
||||||
|
receiptHeaderForm.supplierId = (editData.value.item[0] && editData.value.item[0].supplierId) || editData.value.editRow.supplierId;
|
||||||
receiptHeaderForm.practitionerId = editData.value.editRow.practitionerId;
|
receiptHeaderForm.practitionerId = editData.value.editRow.practitionerId;
|
||||||
console.log(editData.value.editRow, editData.value, 'editData.value.editRow');
|
console.log(editData.value.editRow, editData.value, 'editData.value.editRow');
|
||||||
receiptHeaderForm.occurrenceTime = editData.value.item[0].occurrenceTime
|
receiptHeaderForm.occurrenceTime = editData.value.item[0].occurrenceTime
|
||||||
|
|||||||
Reference in New Issue
Block a user