| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.management.domain.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.management.domain.dto.ADDPdDTO; |
| | | import com.ruoyi.management.domain.dto.InventoriesSuppliesInfoDTO; |
| | | import com.ruoyi.management.domain.dto.InventoriesSuppliesInfoQuery; |
| | | import com.ruoyi.management.domain.vo.InventoriesSuppliesInfoVO; |
| | | import com.ruoyi.management.domain.vo.InventoriesSuppliesVO; |
| | | import com.ruoyi.management.mapper.*; |
| | | import com.ruoyi.management.service.InventoriesSuppliesInfoService; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.security.Security; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | @Resource |
| | | private SlGoodsShelfMapper slGoodsShelfMapper; |
| | | @Autowired |
| | | private InventoriesSuppliesServiceImpl inventoriesSuppliesService; |
| | | @Override |
| | | public PageDTO<InventoriesSuppliesInfoVO> inventoriesSuppliesInfoService(InventoriesSuppliesInfoQuery inventoriesSuppliesInfoQuery) { |
| | | |
| | | Page<InventoriesSuppliesInfo> page = new Page<>(inventoriesSuppliesInfoQuery.getPageCurr(), inventoriesSuppliesInfoQuery.getPageSize()); |
| | | LambdaQueryWrapper< InventoriesSuppliesInfo> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(InventoriesSuppliesInfo::getSuppliesId, inventoriesSuppliesInfoQuery.getSuppliesId()); |
| | | wrapper1.eq( InventoriesSuppliesInfo::getDelFlag,0); |
| | | wrapper1.orderByDesc(InventoriesSuppliesInfo::getCreateTime); |
| | | |
| | | wrapper1.orderByDesc(InventoriesSuppliesInfo::getType); |
| | | Page<InventoriesSuppliesInfo> page2 = this.page(page, wrapper1); |
| | | PageDTO<InventoriesSuppliesInfoVO> slGoodsMaterialsVO = PageDTO.of(page2, InventoriesSuppliesInfoVO.class); |
| | |
| | | InventoriesSuppliesInfo byId = this.getById(m.getId()); |
| | | byId.setSuppliesNum(m.getSuppliesNum()); |
| | | this.updateById(byId); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void submitInventoriesSuppliesInfo(InventoriesSuppliesInfoDTO inventoriesSuppliesInfoDTO) { |
| | | LambdaQueryWrapper< InventoriesSuppliesInfo> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(InventoriesSuppliesInfo::getSuppliesId, inventoriesSuppliesInfoDTO.getSuppliesId()); |
| | | wrapper1.eq( InventoriesSuppliesInfo::getDelFlag,0); |
| | | List<InventoriesSuppliesInfo> page2 = this.list(wrapper1); |
| | | for (InventoriesSuppliesInfo page:page2){ |
| | | if (page.getZkNum()!=page.getSuppliesNum()){ |
| | | page.setType(2); |
| | | public String submitInventoriesSuppliesInfo(ADDPdDTO dto) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | // 添加主表 |
| | | InventoriesSupplies inventoriesSupplies = new InventoriesSupplies(); |
| | | inventoriesSupplies.setMaterialsId(dto.getManagementId()); |
| | | inventoriesSupplies.setPdrId(loginUser.getUserid()); |
| | | inventoriesSupplies.setPdTime(new Date()); |
| | | inventoriesSupplies.setPdrName(loginUser.getUsername()); |
| | | inventoriesSupplies.setCreateTime(new Date()); |
| | | inventoriesSupplies.setDelFlag("2"); |
| | | inventoriesSuppliesService.save(inventoriesSupplies); |
| | | for (InventoriesSuppliesInfoDTO temp : dto.getList()) { |
| | | InventoriesSuppliesInfo res = new InventoriesSuppliesInfo(); |
| | | res.setRkId(temp.getRkId()); |
| | | res.setSuppliesId(inventoriesSupplies.getId()); |
| | | res.setSuppliesNum(temp.getSuppliesNum()); |
| | | res.setZkNum(temp.getZkNum()); |
| | | res.setCreateTime(new Date()); |
| | | if (!Objects.equals(temp.getZkNum(), temp.getSuppliesNum())){ |
| | | res.setType(2); |
| | | }else{ |
| | | res.setType(1); |
| | | } |
| | | this.updateById(page); |
| | | this.save(res); |
| | | return inventoriesSupplies.getId().toString(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void accomplishInventoriesSuppliesInfo(InventoriesSuppliesInfoDTO inventoriesSuppliesInfoDTO) { |
| | | |
| | | InventoriesSupplies byId = inventoriesSuppliesService.getById1(inventoriesSuppliesInfoDTO.getSuppliesId()); |
| | | byId.setDelFlag("0"); |
| | | inventoriesSuppliesService.updateById(byId); |
| | | LambdaQueryWrapper< InventoriesSuppliesInfo> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(InventoriesSuppliesInfo::getSuppliesId, inventoriesSuppliesInfoDTO.getSuppliesId()); |
| | | wrapper1.eq(InventoriesSuppliesInfo::getType, 2); |
| | | wrapper1.eq( InventoriesSuppliesInfo::getDelFlag,0); |
| | | wrapper1.eq( InventoriesSuppliesInfo::getDelFlag,"0"); |
| | | wrapper1.orderByDesc(InventoriesSuppliesInfo::getType); |
| | | List<InventoriesSuppliesInfo> page2 = this.list(wrapper1); |
| | | for (InventoriesSuppliesInfo page:page2){ |
| | | SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(page.getRkId()); |
| | | slVolumeProductionRk.setRepertoryZhai(page.getSuppliesNum()); |
| | | slVolumeProductionRkMapper.updateById(slVolumeProductionRk); |
| | | |
| | | |
| | | LambdaQueryWrapper<ManagementGoodsMaterials> wrapper2 = Wrappers.lambdaQuery(); |
| | | wrapper2.eq(ManagementGoodsMaterials::getGoodsMaterialsId,slVolumeProductionRk.getMaterialsId()); |
| | | wrapper2.eq(ManagementGoodsMaterials::getManagementId,slVolumeProductionRk.getManagementId()); |
| | | wrapper2.eq(ManagementGoodsMaterials::getDelFlag, 0); |
| | | ManagementGoodsMaterials managementGoodsMaterials = managementGoodsMaterialsMapper.selectOne(wrapper2); |
| | | if (managementGoodsMaterials!=null){ |
| | | managementGoodsMaterials.setRepertoryZhai(page.getSuppliesNum()); |
| | | long l = page.getZkNum() - page.getSuppliesNum(); |
| | | if (l>0){ |
| | | managementGoodsMaterials.setRepertoryZhai(page.getSuppliesNum()); |
| | | }else if (l<0){ |
| | | managementGoodsMaterials.setRepertoryYishi(Integer.valueOf(String.valueOf(l))); |
| | | } |
| | | managementGoodsMaterials.setCheckNum(Integer.valueOf(String.valueOf(page.getSuppliesNum()))); |
| | | managementGoodsMaterialsMapper.updateById(managementGoodsMaterials); |
| | | } |
| | | } |