skyouc
1 天以前 32dfe79db773c8d2d3045364ac62423454fe9146
库位更新不使用批量插入
1个文件已修改
16 ■■■■■ 已修改文件
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -1666,7 +1666,7 @@
     * @time 2025/4/15 15:28
     */
    @Transactional(rollbackFor = Exception.class)
    public synchronized void saveLocItem(List<TaskItem> items, Long taskId, Long loginUserId) throws Exception {
    public synchronized void saveLocItem(List<TaskItem> items, Long taskId, Long loginUserId) {
        Task task = this.getById(taskId);
        if (Objects.isNull(task)) {
            throw new CoolException("任务不存在!!");
@@ -1692,16 +1692,18 @@
                        .setUpdateBy(loginUserId)
                        .setWkType(taskItem.getWkType())
                        .setType(taskItem.getOrderType());
                locItems.add(item);
                if (!locItemService.saveOrUpdate(item)) {
                    throw new CoolException("库位明细更新失败!!");
                }
            } else {
                locItem.setAnfme(Math.round((locItem.getAnfme() + taskItem.getAnfme()) * 100) / 100.0)
                locItem.setAnfme(Math.round((locItem.getAnfme() + taskItem.getAnfme()) * 1000000) / 1000000.0)
                        .setUpdateTime(new Date());
                locItems.add(locItem);
                if (!locItemService.saveOrUpdate(locItem)) {
                    throw new CoolException("库位明细更新失败!!");
                }
            }
        });
        if (!locItemService.saveBatch(locItems)) {
            throw new CoolException("库位明细更新失败!!");
        }
    }
    /**