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;
/**
*
* 库存盘点主表 服务实现类
*
*
* @author 芯导软件(江苏)有限公司
* @since 2026-05-09 09:57:53
*/
@Service
@RequiredArgsConstructor
public class StockInventoryCheckMainServiceImpl extends ServiceImpl implements StockInventoryCheckMainService {
private final StockInventoryCheckItemMapper stockInventoryCheckItemMapper;
private final StockInventoryCheckMainMapper stockInventoryCheckMainMapper;
@Override
public IPage 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 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;
}
}