liyong
2026-05-09 4402a6e3befe0c33e8f3b58641984fce3fdb0bbc
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
61
62
package com.ruoyi.stock.service.impl;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.stock.dto.StockInventoryCheckItemDto;
import com.ruoyi.stock.dto.StockInventoryCheckMainDto;
import com.ruoyi.stock.mapper.StockInventoryCheckItemMapper;
import com.ruoyi.stock.mapper.StockInventoryCheckMainMapper;
import com.ruoyi.stock.pojo.StockInventoryCheckItem;
import com.ruoyi.stock.pojo.StockInventoryCheckMain;
import com.ruoyi.stock.service.StockInventoryCheckMainService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
 
/**
 * <p>
 * 库存盘点主表 服务实现类
 * </p>
 *
 * @author 芯导软件(江苏)有限公司
 * @since 2026-05-09 09:57:53
 */
@Service
@RequiredArgsConstructor
public class StockInventoryCheckMainServiceImpl extends ServiceImpl<StockInventoryCheckMainMapper, StockInventoryCheckMain> implements StockInventoryCheckMainService {
 
    private final StockInventoryCheckItemMapper stockInventoryCheckItemMapper;
    private final StockInventoryCheckMainMapper stockInventoryCheckMainMapper;
 
    @Override
    public IPage<StockInventoryCheckMainDto> listPage(Page page, StockInventoryCheckMainDto stockInventoryCheckMainDto) {
        return null;
    }
 
    @Override
    public Boolean add(StockInventoryCheckMainDto stockInventoryCheckMainDto) {
        String checkNo = OrderUtils.countTodayByCreateTime(stockInventoryCheckMainMapper, "PD", "check_no");
        stockInventoryCheckMainDto.setCheckNo(checkNo);
        this.save(stockInventoryCheckMainDto);
        ArrayList<StockInventoryCheckItem> stockInventoryCheckItems = new ArrayList<>();
        for (StockInventoryCheckItemDto itemDto : stockInventoryCheckMainDto.getStockInventoryCheckItemDtos()) {
            StockInventoryCheckItem stockInventoryCheckItem = new StockInventoryCheckItem();
            BeanUtils.copyProperties(itemDto, stockInventoryCheckItem);
            stockInventoryCheckItem.setMainId(stockInventoryCheckMainDto.getId());
            stockInventoryCheckItems.add(stockInventoryCheckItem);
        }
        stockInventoryCheckItemMapper.insert(stockInventoryCheckItems);
        return true;
    }
 
    @Override
    public R updateStockInventoryCheckMainDtoById(StockInventoryCheckMainDto stockInventoryCheckMainDto) {
 
        return null;
    }
}