| | |
| | | import com.alibaba.fastjson2.util.UUIDUtils; |
| | | import com.alibaba.nacos.common.utils.UuidUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.management.service.SlVolumeProductionRkService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.management.service.SlVolumeProductionRkglService; |
| | | import com.ruoyi.management.service.SlVolumeProductionZyService; |
| | | import com.ruoyi.management.util.ObsUploadUtil; |
| | | import com.ruoyi.management.util.QRCodeUtil; |
| | | import com.ruoyi.management.util.UUIDUtil; |
| | |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.apache.logging.log4j.core.util.UuidUtil; |
| | | import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ByteArrayResource; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private ManagementGoodsMaterialsMapper managementGoodsMaterialsMapper; |
| | | @Autowired |
| | | private SlVolumeProductionZyService slVolumeProductionZyService; |
| | | |
| | | |
| | | @Autowired |
| | | private SlVolumeProductionZyService slVolumeProductionZyglService; |
| | | |
| | | |
| | | @Override |
| | |
| | | SlGoodsMaterials slGoodsMaterials = slGoodsMaterialsMapper.selectById(list.getMaterialsId()); |
| | | list.setGoodsMaterialsName(slGoodsMaterials.getGoodsMaterialsName()); |
| | | list.setIsConsume(slGoodsMaterials.getIsConsume()); |
| | | list.setSupplierName(data.getNickName()); |
| | | if (data!=null){ |
| | | list.setSupplierName(data.getNickName()); |
| | | } |
| | | SlGoodsShelf slGoodsShelf = slGoodsShelfMapper.selectById(list.getShelfId()); |
| | | if (slGoodsShelf!=null){ |
| | | list.setGoodsShelfName(slGoodsShelf.getGoodsShelfName()); |
| | |
| | | SlVolumeProductionRkgl byId = slVolumeProductionRkglMapper.selectById(list.getVolumeProductionRkglId()); |
| | | if (byId!=null){ |
| | | SysUser data = sysUserClient.getSysUser(byId.getSupplierId()).getData(); |
| | | list.setSupplierName(data.getNickName()); |
| | | if (data!=null){ |
| | | list.setSupplierName(data.getNickName()); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | @Override |
| | | public void addVolumeProductionRkgl(List<SlVolumeProductionRkListDTO> slVolumeProductionRkListDTO) { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | for (SlVolumeProductionRkListDTO m:slVolumeProductionRkListDTO){ |
| | | SlVolumeProductionRk slVolumeProductionRk=new SlVolumeProductionRk(); |
| | | slVolumeProductionRk.setVolumeProductionRkglId(m.getVolumeProductionRkglId()); |
| | | slVolumeProductionRk.setMaterialsId(m.getMaterialsId()); |
| | | slVolumeProductionRk.setManagementId(m.getManagementId()); |
| | | slVolumeProductionRk.setRkNumber("CD-"+simpleDateFormat.format(new Date())); |
| | | slVolumeProductionRk.setRkNumber("CD-"+simpleDateFormat.format(new Date())+UUIDUtil.getNumberRandom(2)); |
| | | slVolumeProductionRk.setNewAddTime(m.getNewAddTime()); |
| | | if ( m.getErwmNum()!=null){ |
| | | slVolumeProductionRk.setErwmNum( m.getErwmNum()); |
| | |
| | | }if ( m.getStoreManagementNumber()!=null){ |
| | | slVolumeProductionRk.setStoreManagementNumber( m.getStoreManagementNumber()); |
| | | }if ( m.getRkNumber()!=null){ |
| | | slVolumeProductionRk.setRkNumber( m.getRkNumber()); |
| | | slVolumeProductionRk.setRkNumber(m.getRkNumber()); |
| | | } |
| | | slVolumeProductionRk.setCreateTime(new Date()); |
| | | slVolumeProductionRk.setRepertoryZhai(m.getRkNum()); |
| | |
| | | public void uplSlVolumeProductionRk(List<SlVolumeProductionRkDTO> SlVolumeProductionRkDTO) { |
| | | for (SlVolumeProductionRkDTO a:SlVolumeProductionRkDTO){ |
| | | SlVolumeProductionRk byId = this.getById(a.getId()); |
| | | byId.setSmerwmNum(0); |
| | | if (a.getErwmNum()!=null){ |
| | | byId.setErwmNum(a.getErwmNum()); |
| | | }if (a.getRkPice()!=null){ |
| | |
| | | |
| | | @Override |
| | | public PageDTO<getVolumeProductionRkgCodeVO> getVolumeProductionRkgCode(VolumeProductionRkgCodeQuery volumeProductionRkgCodeQuery) { |
| | | QueryWrapper<SlGoodsMaterials> slGoodsMaterialsQueryWrapper = new QueryWrapper<>(); |
| | | slGoodsMaterialsQueryWrapper.eq("del_flag", 0); |
| | | if (StringUtils.hasLength(volumeProductionRkgCodeQuery.getGoodsMaterialsName())){ |
| | | slGoodsMaterialsQueryWrapper.like("goods_materials_name", volumeProductionRkgCodeQuery.getGoodsMaterialsName()); |
| | | } |
| | | List<Long> collect = slGoodsMaterialsMapper.selectList(slGoodsMaterialsQueryWrapper) |
| | | .stream().map(SlGoodsMaterials::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | collect.add(-1L); |
| | | } |
| | | Page<SlVolumeProductionRk> page = new Page<>(volumeProductionRkgCodeQuery.getPageCurr(), volumeProductionRkgCodeQuery.getPageSize()); |
| | | LambdaQueryWrapper< SlVolumeProductionRk> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.like(SlVolumeProductionRk::getVolumeProductionRkglId,volumeProductionRkgCodeQuery.getVolumeProductionRkglId()); |
| | | wrapper1.eq(SlVolumeProductionRk::getVolumeProductionRkglId,volumeProductionRkgCodeQuery.getVolumeProductionRkglId()); |
| | | wrapper1.eq( SlVolumeProductionRk::getDelFlag,0); |
| | | wrapper1.in( SlVolumeProductionRk::getMaterialsId,collect); |
| | | wrapper1.orderByDesc(SlVolumeProductionRk::getCreateTime); |
| | | Page<SlVolumeProductionRk> page2 = this.page(page, wrapper1); |
| | | PageDTO<getVolumeProductionRkgCodeVO> SlGoodsShelfDTO = PageDTO.of(page2, getVolumeProductionRkgCodeVO.class); |
| | |
| | | |
| | | @Override |
| | | public List<QRCodeVO> codeInfo(Long id) throws Exception { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | List<QRCodeVO> res = new ArrayList<>(); |
| | | LambdaQueryWrapper< SlVolumeProductionRk> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.like(SlVolumeProductionRk::getVolumeProductionRkglId,id); |
| | | wrapper1.eq(SlVolumeProductionRk::getId,id); |
| | | wrapper1.eq( SlVolumeProductionRk::getDelFlag,0); |
| | | wrapper1.orderByDesc(SlVolumeProductionRk::getCreateTime); |
| | | List<SlVolumeProductionRk> list = this.list(wrapper1); |
| | | for (SlVolumeProductionRk byId : list) { |
| | | // 根据生成二维码数量 复制 |
| | | for (int i = 0; i < byId.getErwmNum(); i++) { |
| | | for (int i = 1; i <= byId.getErwmNum(); i++) { |
| | | String blueS = "{\"rkNumber\": "+byId.getRkNumber()+"}"; |
| | | BufferedImage blueImage = QRCodeUtil.createImage(blueS); |
| | | MultipartFile blueFile = convert(blueImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); |
| | |
| | | vo.setGoodsMaterialsName(slGoodsMaterials.getGoodsMaterialsName()); |
| | | SlVolumeProductionRkgl byId1 = slVolumeProductionRkglMapper.selectById(byId.getVolumeProductionRkglId()); |
| | | SysUser data = sysUserClient.getSysUser(byId1.getSupplierId()).getData(); |
| | | vo.setSupplierName(data.getNickName()); |
| | | if (data!=null){ |
| | | vo.setSupplierName(data.getNickName()); |
| | | } |
| | | vo.setMaterialsNum(byId.getRkNum()); |
| | | Long materialsId = byId.getMaterialsId(); |
| | | // 查询物资缩写 |
| | | vo.setMaterials(byId.getRkNumber()); |
| | | SlStoreManagement slStoreManagement = slStoreManagementMapper.selectById(byId.getManagementId()); |
| | | vo.setStoreManagementName(slStoreManagement.getStoreManagementName()); |
| | | vo.setQrCode(s); |
| | | res.add(vo); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | return res; |
| | | } |
| | | @Override |
| | | public List<QRCodeVO> codeInfo1(Long id,Long zyId) throws Exception { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | List<QRCodeVO> res = new ArrayList<>(); |
| | | LambdaQueryWrapper< SlVolumeProductionRk> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(SlVolumeProductionRk::getId,id); |
| | | wrapper1.eq( SlVolumeProductionRk::getDelFlag,0); |
| | | wrapper1.orderByDesc(SlVolumeProductionRk::getCreateTime); |
| | | List<SlVolumeProductionRk> list = this.list(wrapper1); |
| | | for (SlVolumeProductionRk byId : list) { |
| | | // 根据生成二维码数量 复制 |
| | | for (int i = 1; i <= byId.getErwmNum(); i++) { |
| | | String blueS = "{\"rkNumber\": "+byId.getRkNumber()+"}"; |
| | | BufferedImage blueImage = QRCodeUtil.createImage(blueS); |
| | | MultipartFile blueFile = convert(blueImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); |
| | | // 生成的二维码连接 |
| | | String s = ObsUploadUtil.obsUpload(blueFile); |
| | | QRCodeVO vo=new QRCodeVO(); |
| | | String letter = getLetter(i); |
| | | vo.setCategory(letter); |
| | | SlGoodsMaterials slGoodsMaterials = slGoodsMaterialsMapper.selectById(byId.getMaterialsId()); |
| | | vo.setGoodsMaterialsName(slGoodsMaterials.getGoodsMaterialsName()); |
| | | |
| | | SlVolumeProductionZy byId1 = slVolumeProductionZyService.getById(zyId); |
| | | if (byId1.getSupplierId()!=null){ |
| | | SysUser data = sysUserClient.getSysUser(byId1.getSupplierId().longValue()).getData(); |
| | | if (data!=null){ |
| | | vo.setSupplierName(data.getNickName()); |
| | | |
| | | } |
| | | } |
| | | vo.setMaterialsNum(byId.getRkNum()); |
| | | Long materialsId = byId.getMaterialsId(); |
| | | // 查询物资缩写 |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | String blueS = "{\"rkNumber\": CD-1721989472748"+"}"; |
| | | BufferedImage blueImage = QRCodeUtil.createImage(blueS); |
| | | MultipartFile blueFile = convert(blueImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); |
| | | // 生成的二维码连接 |
| | | String s = ObsUploadUtil.obsUpload(blueFile); |
| | | System.err.println(s); |
| | | // String blueS = "{\"rkNumber\": CD-1721989472748"+"}"; |
| | | // BufferedImage blueImage = QRCodeUtil.createImage(blueS); |
| | | // MultipartFile blueFile = convert(blueImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); |
| | | // // 生成的二维码连接 |
| | | // String s = ObsUploadUtil.obsUpload(blueFile); |
| | | // System.err.println(s); |
| | | // String letter = getLetter(27); |
| | | // System.err.println(letter); |
| | | |
| | | } |
| | | public static MultipartFile convert(BufferedImage bufferedImage, String fileName) throws IOException { |
| | | // 将 BufferedImage 转换为字节数组 |
| | |
| | | // 根据传入数字是几 返回对应的字母 |
| | | public static String getLetter(int num) { |
| | | String[] str = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; |
| | | // 如果num大于26 那么往后叠加对应的字母 |
| | | // 如果num大于26 那么往后叠加对应的字母 比如27 那么就是AA |
| | | if (num > 26) { |
| | | int a = num / 26; |
| | | int b = num % 26; |
| | |
| | | } |
| | | return getLetter(a) + getLetter(b); |
| | | } |
| | | |
| | | return str[num - 1]; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public PageDTO<ManagementimgVolumeProductionRkVO> getroductionRkList(umeProductionRkQuery meProductionRkQuery) { |
| | | |
| | |
| | | if (meProductionRkQuery.getGoodsMaterialsName()!=null&&meProductionRkQuery.getGoodsMaterialsName()!=""){ |
| | | wrapper.eq(SlGoodsMaterials::getGoodsMaterialsName,meProductionRkQuery.getGoodsMaterialsName()); |
| | | } |
| | | if (meProductionRkQuery.getIsConsume()!=0){ |
| | | if (meProductionRkQuery.getIsConsume()!=null && meProductionRkQuery.getIsConsume()!=0){ |
| | | wrapper.eq(SlGoodsMaterials::getIsConsume,meProductionRkQuery.getIsConsume()); |
| | | } |
| | | wrapper.eq( SlGoodsMaterials::getDelFlag,0); |
| | |
| | | |
| | | list.setGoodsMaterialsName(slGoodsMaterials.getGoodsMaterialsName()); |
| | | list.setIsConsume(slGoodsMaterials.getIsConsume()); |
| | | list.setSupplierName(data.getNickName()); |
| | | if (data!=null){ |
| | | list.setSupplierName(data.getNickName()); |
| | | } |
| | | SlGoodsShelf slGoodsShelf = slGoodsShelfMapper.selectById(list.getShelfId()); |
| | | list.setGoodsShelfName(slGoodsShelf.getGoodsShelfName()); |
| | | } |
| | |
| | | if (gethuojRkQuery.getGoodsMaterialsName()!=null&&gethuojRkQuery.getGoodsMaterialsName()!=""){ |
| | | wrapper.eq(SlGoodsMaterials::getGoodsMaterialsName,gethuojRkQuery.getGoodsMaterialsName()); |
| | | } |
| | | |
| | | wrapper.eq( SlGoodsMaterials::getDelFlag,0); |
| | | List<SlGoodsMaterials> page1 = slGoodsMaterialsMapper.selectList(wrapper); |
| | | |
| | |
| | | } |
| | | wrapper1.eq(SlVolumeProductionRk::getShelfId,gethuojRkQuery.getGoodsShelid()); |
| | | wrapper1.eq( SlVolumeProductionRk::getDelFlag,0); |
| | | // 该字段用于标记是否入库 |
| | | wrapper1.isNotNull(SlVolumeProductionRk::getNewAddTime); |
| | | wrapper1.orderByDesc(SlVolumeProductionRk::getCreateTime); |
| | | Page<SlVolumeProductionRk> page2 = this.page(page, wrapper1); |
| | | PageDTO<gethuojRkVO> SlGoodsShelfDTO = PageDTO.of(page2, gethuojRkVO.class); |
| | |
| | | SlVolumeProductionRkgl byId = slVolumeProductionRkglMapper.selectById(list.getVolumeProductionRkglId()); |
| | | if (byId!=null){ |
| | | SysUser data = sysUserClient.getSysUser(byId.getSupplierId()).getData(); |
| | | list.setSupplierName(data.getNickName()); |
| | | if (data!=null){ |
| | | list.setSupplierName(data.getNickName()); |
| | | } |
| | | } |
| | | |
| | | if (slGoodsMaterials!=null){ |