rentaiming
2024-07-19 d204e01db828bbe4dd9ad5e19d6ff13f99334478
ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionCkServiceImpl.java
@@ -5,10 +5,15 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.utils.page.PageDTO;
import com.ruoyi.management.domain.*;
import com.ruoyi.management.domain.dto.AddSlVolumeProductionCkDTO;
import com.ruoyi.management.domain.dto.ManagementimgVolumeProductionCkQuery;
import com.ruoyi.management.domain.dto.SlGoodsMaterialsSlVolumeProductionRkQuery;
import com.ruoyi.management.domain.dto.SlVolumeProductionCkDTO;
import com.ruoyi.management.domain.vo.ManagementimgSlVolumeProductionCkVO;
import com.ruoyi.management.domain.vo.ManagementimgVolumeProductionCkVO;
import com.ruoyi.management.domain.vo.ManagementimgVolumeProductionRkVO;
import com.ruoyi.management.mapper.SlGoodsMaterialsMapper;
import com.ruoyi.management.mapper.SlGoodsShelfMapper;
import com.ruoyi.management.mapper.SlVolumeProductionCkMapper;
import com.ruoyi.management.mapper.SlVolumeProductionRkMapper;
import com.ruoyi.management.service.SlVolumeProductionCkService;
@@ -17,6 +22,8 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@@ -32,6 +39,12 @@
    @Resource
    private SlVolumeProductionRkMapper  slVolumeProductionRkMapper;
    @Resource
    private SlGoodsMaterialsMapper slGoodsMaterialsMapper;
    @Resource
    private SlGoodsShelfMapper slGoodsShelfMapper;
    @Override
    public PageDTO<ManagementimgSlVolumeProductionCkVO> getManagementimgSlVolumeProductionCkList(SlGoodsMaterialsSlVolumeProductionRkQuery slGoodsMaterialsSlVolumeProductionRkQuery) {
@@ -52,14 +65,81 @@
    }
    @Override
    public void addSlVolumeProductionCk(SlVolumeProductionCkDTO slVolumeProductionCkDTO) {
        if (slVolumeProductionCkDTO.getId()==null){
            SlVolumeProductionCk slVolumeProductionCk=new SlVolumeProductionCk();
            slVolumeProductionCk.setRkId(slVolumeProductionCkDTO.getRkId());
        }else{
    public void updSlVolumeProductionCk(SlVolumeProductionCkDTO slVolumeProductionCkDTO) {
            SlVolumeProductionCk byId = this.getById(slVolumeProductionCkDTO.getId());
            byId.setCkNum(slVolumeProductionCkDTO.getCkNum());
            byId.setGuihNum(slVolumeProductionCkDTO.getGuihNum());
            this.updateById(byId);
    }
    @Override
    public void addSlVolumeProductionCk(AddSlVolumeProductionCkDTO addSlVolumeProductionCkDTO) {
        List<Long> rkId = addSlVolumeProductionCkDTO.getRkId();
        for (Long m:rkId){
            SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(m);
            SlVolumeProductionCk slVolumeProductionCk=new SlVolumeProductionCk();
            slVolumeProductionCk.setRkId(m);
            slVolumeProductionCk.setCkglId(addSlVolumeProductionCkDTO.getCkgl_id());
            slVolumeProductionCk.setState(1);
            slVolumeProductionCk.setType(1);
            slVolumeProductionCk.setMaterialsId(slVolumeProductionRk.getMaterialsId());
            this.save(slVolumeProductionCk);
        }
    }
    @Override
    public PageDTO<ManagementimgVolumeProductionCkVO> getSlVolumeProductionCkList(ManagementimgVolumeProductionCkQuery managementimgVolumeProductionCkQuery) {
        Page<SlVolumeProductionCk> page = new Page<>(managementimgVolumeProductionCkQuery.getPageCurr(), managementimgVolumeProductionCkQuery.getPageSize());
        LambdaQueryWrapper< SlVolumeProductionCk> wrapper1= Wrappers.lambdaQuery();
        wrapper1.eq(SlVolumeProductionCk::getCkglId,managementimgVolumeProductionCkQuery.getVolumeProductionCKglId());
        wrapper1.eq( SlVolumeProductionCk::getDelFlag,0);
        wrapper1.orderByDesc(SlVolumeProductionCk::getCreateTime);
        Page<SlVolumeProductionCk> page2 = this.page(page, wrapper1);
        PageDTO<ManagementimgVolumeProductionCkVO> SlGoodsShelfDTO = PageDTO.of(page2, ManagementimgVolumeProductionCkVO.class);
        List<ManagementimgVolumeProductionCkVO> list2 = SlGoodsShelfDTO.getList();
        for(ManagementimgVolumeProductionCkVO list:list2) {{
            SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(list.getRkId());
            list.setStoreManagementNumber(slVolumeProductionRk.getStoreManagementNumber());
            list.setRkNumber(slVolumeProductionRk.getRkNumber());
            list.setRepertoryZhai(slVolumeProductionRk.getRepertoryZhai());
            SlGoodsMaterials slGoodsMaterials = slGoodsMaterialsMapper.selectById(slVolumeProductionRk.getMaterialsId());
            list.setGoodsMaterialsName(slGoodsMaterials.getGoodsMaterialsName());
            list.setIsConsume(slGoodsMaterials.getIsConsume());
            SlGoodsShelf slGoodsShelf = slGoodsShelfMapper.selectById(slVolumeProductionRk.getShelfId());
            list.setGoodsShelfName(slGoodsShelf.getGoodsShelfName());
        }
        }
        return SlGoodsShelfDTO;
    }
    @Override
    public List<ManagementimgVolumeProductionCkVO> SlVolumeProductionCkList(ManagementimgVolumeProductionCkQuery managementimgVolumeProductionCkQuery) {
        LambdaQueryWrapper< SlVolumeProductionCk> wrapper1= Wrappers.lambdaQuery();
        wrapper1.eq(SlVolumeProductionCk::getCkglId,managementimgVolumeProductionCkQuery.getVolumeProductionCKglId());
        wrapper1.eq( SlVolumeProductionCk::getDelFlag,0);
        wrapper1.orderByDesc(SlVolumeProductionCk::getCreateTime);
        List<SlVolumeProductionCk> page2 = this.list(wrapper1);
            List<ManagementimgVolumeProductionCkVO> SlGoodsShelfDTO=new ArrayList<>();
        for(SlVolumeProductionCk list1:page2) {{
            ManagementimgVolumeProductionCkVO list=new ManagementimgVolumeProductionCkVO();
            list.setId(list1.getId());
            list.setCkNum(list1.getCkNum());
            SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(list1.getRkId());
            list.setStoreManagementNumber(slVolumeProductionRk.getStoreManagementNumber());
            list.setRkNumber(slVolumeProductionRk.getRkNumber());
            list.setRepertoryZhai(slVolumeProductionRk.getRepertoryZhai());
            SlGoodsMaterials slGoodsMaterials = slGoodsMaterialsMapper.selectById(slVolumeProductionRk.getMaterialsId());
            list.setGoodsMaterialsName(slGoodsMaterials.getGoodsMaterialsName());
            list.setIsConsume(slGoodsMaterials.getIsConsume());
            SlGoodsShelf slGoodsShelf = slGoodsShelfMapper.selectById(slVolumeProductionRk.getShelfId());
            list.setGoodsShelfName(slGoodsShelf.getGoodsShelfName());
            SlGoodsShelfDTO.add(list);
            }
        }
        return SlGoodsShelfDTO;
    }
}