| | |
| | | import com.ruoyi.management.service.SlStoreManagementService; |
| | | import com.ruoyi.management.service.SlVolumeProductionZyService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.management.util.UUIDUtil; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.domain.getVolumeProductionRkQuery; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | private SlAuditService slAuditService; |
| | | @Resource |
| | | private SlAuditRecordService slAuditRecordService; |
| | | @Resource |
| | | private SlVolumeProductionZyMapper slVolumeProductionZyMapper; |
| | | |
| | | @Resource |
| | | private ManagementGoodsMaterialsMapper managementGoodsMaterialsMapper; |
| | | |
| | | @Override |
| | | public void addSlVolumeProductionZy(ADDZYDTO addaddSlVolumeProductionZyDTO) { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | Long userid = SecurityUtils.getUserId(); |
| | | if (addaddSlVolumeProductionZyDTO.getId()==null){ |
| | | // 新增转移管理 |
| | | Long userid = SecurityUtils.getUserId(); |
| | | SlVolumeProductionZygl slVolumeProductionZygl=new SlVolumeProductionZygl(); |
| | | slVolumeProductionZygl.setAttachmentUrl(addaddSlVolumeProductionZyDTO.getAttachmentUrl()); |
| | | slVolumeProductionZygl.setAuthorizationUrl(addaddSlVolumeProductionZyDTO.getAuthorization()); |
| | |
| | | List<AddZYIdsDTO> rkId = addaddSlVolumeProductionZyDTO.getAddZYIdsDTOS(); |
| | | for (AddZYIdsDTO m:rkId){ |
| | | SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(m.getRkId()); |
| | | // todo 目前还不知道转移管理存不存供应商id |
| | | // Long volumeProductionRkglId = slVolumeProductionRk.getVolumeProductionRkglId(); |
| | | // SlVolumeProductionRkgl slVolumeProductionRkgl = slVolumeProductionRkglMapper.selectById(volumeProductionRkglId); |
| | | Long volumeProductionRkglId = slVolumeProductionRk.getVolumeProductionRkglId(); |
| | | SlVolumeProductionRkgl slVolumeProductionRkgl = slVolumeProductionRkglMapper.selectById(volumeProductionRkglId); |
| | | SlVolumeProductionZy slVolumeProductionZy=new SlVolumeProductionZy(); |
| | | slVolumeProductionZy.setRkId(m.getRkId()); |
| | | slVolumeProductionZy.setZyglId(slVolumeProductionZygl.getId()); |
| | |
| | | slVolumeProductionZy.setCreateTime(new Date()); |
| | | slVolumeProductionZy.setStoreManagementNumber(m.getStoreManagementNumber()); |
| | | slVolumeProductionZy.setShelfId(m.getShelfId()); |
| | | slVolumeProductionZy.setSysId(userid); |
| | | slVolumeProductionZy.setRkId(m.getRkId()); |
| | | // slVolumeProductionZy.setSupplierId(slVolumeProductionRkgl.getSupplierId()); |
| | | if (slVolumeProductionRkgl!=null){ |
| | | if (slVolumeProductionRkgl.getSupplierId()!=null){ |
| | | slVolumeProductionZy.setSupplierId(Integer.valueOf(slVolumeProductionRkgl.getSupplierId().toString())); |
| | | |
| | | } |
| | | } |
| | | |
| | | this.save(slVolumeProductionZy); |
| | | } |
| | | LambdaQueryWrapper<SlVolumeProductionZy> wrapper1 = Wrappers.lambdaQuery(); |
| | | wrapper1.eq(SlVolumeProductionZy::getZyglId, slVolumeProductionZygl.getId()); |
| | | wrapper1.eq(SlVolumeProductionZy::getDelFlag, 0); |
| | | wrapper1.orderByDesc(SlVolumeProductionZy::getCreateTime); |
| | | List<SlVolumeProductionZy> page2 = slVolumeProductionZyMapper.selectList(wrapper1); |
| | | for (SlVolumeProductionZy zy:page2){ |
| | | SlVolumeProductionRk slVolumeProductionRk=new SlVolumeProductionRk(); |
| | | slVolumeProductionRk.setMaterialsId(zy.getMaterialsId()); |
| | | slVolumeProductionRk.setStoreManagementNumber(zy.getStoreManagementNumber()); |
| | | slVolumeProductionRk.setManagementId(slVolumeProductionZygl.getBmanagementId()); |
| | | slVolumeProductionRk.setRkNumber("CD-"+simpleDateFormat.format(new Date())+ UUIDUtil.getNumberRandom(2)); |
| | | slVolumeProductionRk.setRkNum(Long.valueOf(zy.getZyNum())); |
| | | SlVolumeProductionRk slVolumeProductionRk2 = slVolumeProductionRkMapper.selectById(zy.getRkId()); |
| | | slVolumeProductionRk.setRkPice(slVolumeProductionRk2.getRkPice()); |
| | | if (slVolumeProductionRk2!=null)slVolumeProductionRk.setRkModel(slVolumeProductionRk2.getRkModel()); |
| | | slVolumeProductionRk.setShelfId(zy.getShelfId()); |
| | | slVolumeProductionRk.setRepertoryZhai(Long.valueOf(zy.getZyNum())); |
| | | slVolumeProductionRk.setCreateTime(new Date()); |
| | | slVolumeProductionRkMapper.insert(slVolumeProductionRk); |
| | | zy.setScrkId(slVolumeProductionRk.getId()); |
| | | slVolumeProductionZyMapper.updateById(zy); |
| | | } |
| | | }else{ |
| | | // 修改 |
| | |
| | | byId.setAuthorizationUrl(addaddSlVolumeProductionZyDTO.getAuthorization()); |
| | | } |
| | | slVolumeProductionZyglMapper.updateById(byId); |
| | | for (AddZYIdsDTO z:addaddSlVolumeProductionZyDTO.getAddZYIdsDTOS()){ |
| | | QueryWrapper<SlVolumeProductionZy> slVolumeProductionZyQueryWrapper = new QueryWrapper<>(); |
| | | slVolumeProductionZyQueryWrapper.eq("zygl_id",addaddSlVolumeProductionZyDTO.getId()); |
| | | slVolumeProductionZyQueryWrapper.eq("rk_id",z.getRkId()); |
| | | SlVolumeProductionZy one = this.getOne(slVolumeProductionZyQueryWrapper); |
| | | if (one!=null){ |
| | | one.setZyNum(z.getZyNum()); |
| | | this.remove(slVolumeProductionZyQueryWrapper); |
| | | for (AddZYIdsDTO m:addaddSlVolumeProductionZyDTO.getAddZYIdsDTOS()){ |
| | | SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(m.getRkId()); |
| | | slVolumeProductionRk.setRkPice(slVolumeProductionRk.getRkPice()); |
| | | // todo 目前还不知道转移管理存不存供应商id |
| | | Long volumeProductionRkglId = slVolumeProductionRk.getVolumeProductionRkglId(); |
| | | SlVolumeProductionRkgl slVolumeProductionRkgl = slVolumeProductionRkglMapper.selectById(volumeProductionRkglId); |
| | | SlVolumeProductionZy slVolumeProductionZy=new SlVolumeProductionZy(); |
| | | slVolumeProductionZy.setRkId(m.getRkId()); |
| | | slVolumeProductionZy.setZyglId(addaddSlVolumeProductionZyDTO.getId()); |
| | | slVolumeProductionZy.setState(1); |
| | | slVolumeProductionZy.setMaterialsId(slVolumeProductionRk.getMaterialsId()); |
| | | slVolumeProductionZy.setZyNum(m.getZyNum()); |
| | | slVolumeProductionZy.setCreateTime(new Date()); |
| | | slVolumeProductionZy.setStoreManagementNumber(m.getStoreManagementNumber()); |
| | | slVolumeProductionZy.setShelfId(m.getShelfId()); |
| | | slVolumeProductionZy.setSysId(userid); |
| | | slVolumeProductionZy.setRkId(m.getRkId()); |
| | | slVolumeProductionZy.setSupplierId(Integer.parseInt(slVolumeProductionRkgl.getSupplierId().toString())); |
| | | this.save(slVolumeProductionZy); |
| | | // slVolumeProductionZyQueryWrapper.eq("rk_id",z.getRkId()); |
| | | // slVolumeProductionZyQueryWrapper.eq("del_flag","0"); |
| | | // slVolumeProductionZyQueryWrapper.eq("shelf_id",z.getShelfId()); |
| | | // slVolumeProductionZyQueryWrapper.eq("store_management_number",z.getStoreManagementNumber()); |
| | | |
| | | } |
| | | this.updateById(one); |
| | | // SlVolumeProductionZy one = this.getOne(slVolumeProductionZyQueryWrapper); |
| | | // if (one!=null){ |
| | | // one.setZyNum(z.getZyNum()); |
| | | // |
| | | // } |
| | | // this.updateById(one); |
| | | } |
| | | } |
| | | // 添加/修改审核记录 |
| | |
| | | slAudit.setSysId(slVolumeProductionZygl.getSysId()); |
| | | slAudit.setManagementId(slVolumeProductionZygl.getManagementId()); |
| | | slAudit.setZymanagementId(slVolumeProductionZygl.getBmanagementId()); |
| | | slVolumeProductionZygl.setPresentState(1); |
| | | slVolumeProductionZygl.setAuditStatus(1); |
| | | slVolumeProductionZyglMapper.updateById(slVolumeProductionZygl); |
| | | SlStoreManagement byId = slStoreManagementService.getById(slVolumeProductionZygl.getManagementId()); |
| | | slAudit.setShenhId(byId.getAdministratorId()); |
| | | slAuditService.save(slAudit); |
| | |
| | | slAuditRecord2.setCreateTime(new Date()); |
| | | slAuditRecordService.save(slAuditRecord2); |
| | | } |
| | | } |
| | | 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 那么往后叠加对应的字母 比如27 那么就是AA |
| | | if (num > 26) { |
| | | int a = num / 26; |
| | | int b = num % 26; |
| | | if (b == 0) { |
| | | a = a - 1; |
| | | b = 26; |
| | | } |
| | | return getLetter(a) + getLetter(b); |
| | | } |
| | | |
| | | return str[num - 1]; |
| | | } |
| | | @Resource |
| | | private SlStoreManagementService slStoreManagementService; |
| | |
| | | } |
| | | } |
| | | numberAndShelfVO.setNumber(number); |
| | | if (dto.getManagementNumber() == null){ |
| | | dto.setManagementNumber(1); |
| | | } |
| | | QueryWrapper<SlGoodsShelf> eq = new QueryWrapper<SlGoodsShelf>() |
| | | .eq("del_flag", "0") |
| | | .eq("store_management_id", dto.getManagementId()) |