chenhj
2 天以前 60264687a654d2e7fc46dc9dc81e4fd663210b78
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package com.ruoyi.business.service.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.business.dto.OfficialInventoryDto;
import com.ruoyi.business.dto.PendingInventoryDto;
import com.ruoyi.business.entity.InputInventoryRecord;
import com.ruoyi.business.mapper.InputInventoryRecordMapper;
import com.ruoyi.business.service.InputInventoryRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
 
import java.math.BigDecimal;
 
import static com.ruoyi.business.constant.InventoryRecordConstant.OFFICIAL_INVENTORY;
import static com.ruoyi.business.constant.InventoryRecordConstant.PENDING_INVENTORY;
 
/**
 * <p>
 * 入库记录表 服务实现类
 * </p>
 *
 * @author chenhj
 * @since 2025-06-14
 */
@Service
@RequiredArgsConstructor
public class InputInventoryRecordServiceImpl extends ServiceImpl<InputInventoryRecordMapper, InputInventoryRecord> implements InputInventoryRecordService {
    private final InputInventoryRecordMapper inputInventoryRecordMapper;
 
    @Override
    public int insertInputInventoryRecord(PendingInventoryDto pendingInventoryDto, OfficialInventoryDto officialInventoryDto, BigDecimal quantity) {
        if ((pendingInventoryDto != null && officialInventoryDto != null) || (pendingInventoryDto == null && officialInventoryDto == null)) {
            throw new RuntimeException("库存记录异常");
        }
 
        InputInventoryRecord inputInventoryRecord = new InputInventoryRecord();
        if (officialInventoryDto != null) {
            inputInventoryRecord.setInventoryType(OFFICIAL_INVENTORY);
            inputInventoryRecord.setId(officialInventoryDto.getId());
        } else {
            inputInventoryRecord.setInventoryType(PENDING_INVENTORY);
            inputInventoryRecord.setId(pendingInventoryDto.getId());
        }
        inputInventoryRecord.setQuantity(quantity);
 
        return inputInventoryRecordMapper.insert(inputInventoryRecord);
 
        // 更新库存
//         inventorySummaryService.updateInventory(pendingInventoryDto, officialInventoryDto);
    }
 
    @Override
    public int deleteInputInventoryRecord(Long[] ids) {
 
 
 
 
        return 0;
    }
}