更新物料导入

main
HUOJIN\92525 2024-09-13 15:59:39 +08:00
parent d36ab45654
commit 30b8661f3e
1 changed files with 3 additions and 4 deletions

View File

@ -81,7 +81,6 @@ public class ImportDataServiceImpl implements ImportDataService {
private final BigItemService bigItemService; private final BigItemService bigItemService;
private final BomAccountService bomAccountService; private final BomAccountService bomAccountService;
private final BomAccountLogService bomAccountLogService; private final BomAccountLogService bomAccountLogService;
private final BatchCreateOrUpdate batchCreateOrUpdate;
@Override @Override
public void importBomAccount(int row, Map<String, Object> readAll) { public void importBomAccount(int row, Map<String, Object> readAll) {
@ -215,19 +214,19 @@ public class ImportDataServiceImpl implements ImportDataService {
//更新物料 //更新物料
itemsToUpdate.add(updateItems(item, dept, record)); itemsToUpdate.add(updateItems(item, dept, record));
} else { } else {
//新增点位 //新增物料
itemsToInsert.add(createItem(dept, record)); itemsToInsert.add(createItem(dept, record));
} }
} }
//批量新增物料 //批量新增物料
if (!itemsToInsert.isEmpty()) { if (!itemsToInsert.isEmpty()) {
batchCreateOrUpdate.batchInsert(itemsToInsert); itemRepository.saveAll(itemsToInsert);
} }
//批量更新物料 //批量更新物料
if (!itemsToUpdate.isEmpty()) { if (!itemsToUpdate.isEmpty()) {
batchCreateOrUpdate.batchUpdate(itemsToUpdate); itemRepository.saveAll(itemsToUpdate);
} }
return ("导入成功:" + " 新增(" + itemsToInsert.size() + ")修改(" + itemsToUpdate.size() + ")"); return ("导入成功:" + " 新增(" + itemsToInsert.size() + ")修改(" + itemsToUpdate.size() + ")");