| | |
| | | package com.ruoyi.management.service.impl; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | 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.fasterxml.jackson.core.JsonProcessingException; |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.enums.ClientTypeEnum; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | 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.InventoriesSuppDTO; |
| | |
| | | import com.ruoyi.management.domain.vo.SlGoodsMaterialsVO; |
| | | import com.ruoyi.management.domain.vo.SlGoodsShelfVO; |
| | | import com.ruoyi.management.mapper.InventoriesSuppliesMapper; |
| | | import com.ruoyi.management.mapper.SlEquipmentMapper; |
| | | import com.ruoyi.management.mapper.SlStoreManagementMapper; |
| | | import com.ruoyi.management.mapper.SlVolumeProductionRkMapper; |
| | | import com.ruoyi.management.service.InventoriesSuppliesService; |
| | |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.domain.WebsocketMessageDTO; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Autowired |
| | | private SlGoodsShelfService slGoodsShelfService; |
| | | @Autowired |
| | | private SlEquipmentMapper slEquipmentMapper; |
| | | @Autowired |
| | | private InventoriesSuppliesMapper inventoriesSuppliesMapper; |
| | | private static final ObjectMapper objectMapper = new ObjectMapper(); |
| | | |
| | | @Override |
| | | public PageDTO<InventoriesSuppliesVO> getInventoriesSuppliesList(InventoriesSuppliesQuery inventoriesSuppliesQuery) { |
| | | LambdaQueryWrapper<SlStoreManagement> wrapper= Wrappers.lambdaQuery(); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | if (userId!=1){ |
| | | SysUser data = sysUserClient.getSysUser(userId).getData(); |
| | | if (!data.getUserType().equals("00")){ |
| | | // 如果不是平台 |
| | | switch (data.getRoleType()){ |
| | | case 3: |
| | | wrapper.ge(SlStoreManagement::getStoreManagementGrade,3); |
| | | wrapper.eq(SlStoreManagement::getCityCode,data.getCityCode()); |
| | | |
| | | break; |
| | | case 4: |
| | | wrapper.ge(SlStoreManagement::getStoreManagementGrade,4); |
| | | wrapper.eq(SlStoreManagement::getCountyCode,data.getCountyCode()); |
| | | break; |
| | | case 5: |
| | | wrapper.ge(SlStoreManagement::getStoreManagementGrade,5); |
| | | wrapper.eq(SlStoreManagement::getTownCode,data.getTownCode()); |
| | | break; |
| | | case 6: |
| | | wrapper.ge(SlStoreManagement::getStoreManagementGrade,6); |
| | | wrapper.eq(SlStoreManagement::getTownCode,data.getTownCode()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (inventoriesSuppliesQuery.getStoreManagementName()!=null&&inventoriesSuppliesQuery.getStoreManagementName()!=""){ |
| | | wrapper.eq(SlStoreManagement::getStoreManagementName,inventoriesSuppliesQuery.getStoreManagementName()); |
| | | } |
| | |
| | | this.save(inventoriesSupplies); |
| | | } |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Override |
| | | public void scanCodes(String rkNumber) { |
| | | public R scanCodes(String rkNumber,String code) { |
| | | LoginUser loginUserDevice = tokenService.getLoginUserDevice(); |
| | | Map<String, Object> map1 = new ConcurrentHashMap<>(); |
| | | String message1 = null; |
| | | SlVolumeProductionRkVO slVolumeProductionRkVO1 = new SlVolumeProductionRkVO(); |
| | | slVolumeProductionRkVO1.setId(""); |
| | | slVolumeProductionRkVO1.setVolumeProductionRkglId(""); |
| | | slVolumeProductionRkVO1.setMaterialsId(""); |
| | | slVolumeProductionRkVO1.setRkNum(0L); |
| | | slVolumeProductionRkVO1.setRkNumber(""); |
| | | slVolumeProductionRkVO1.setRkModel(""); |
| | | slVolumeProductionRkVO1.setRkPice(new BigDecimal("0")); |
| | | slVolumeProductionRkVO1.setRepertoryZhai(0L); |
| | | slVolumeProductionRkVO1.setStoreManagementNumber(0); |
| | | slVolumeProductionRkVO1.setShelfId(""); |
| | | slVolumeProductionRkVO1.setDelFlag(""); |
| | | slVolumeProductionRkVO1.setCreateBy(""); |
| | | slVolumeProductionRkVO1.setCreateTime(new Date()); |
| | | slVolumeProductionRkVO1.setUpdateBy(""); |
| | | slVolumeProductionRkVO1.setUpdateTime(new Date()); |
| | | slVolumeProductionRkVO1.setErwmNum(0); |
| | | slVolumeProductionRkVO1.setSmerwmNum(0); |
| | | slVolumeProductionRkVO1.setManagementId(""); |
| | | slVolumeProductionRkVO1.setNewAddTime(""); |
| | | slVolumeProductionRkVO1.setGoodsMaterialsName(""); |
| | | slVolumeProductionRkVO1.setIsConsume(0); |
| | | slVolumeProductionRkVO1.setManagementNumber(0); |
| | | slVolumeProductionRkVO1.setShelfName(""); |
| | | slVolumeProductionRkVO1.setIsError(""); |
| | | |
| | | try { |
| | | slVolumeProductionRkVO1.setIsError("1"); |
| | | map1.put("SlVolumeProductionRk",slVolumeProductionRkVO1); |
| | | message1 = objectMapper.writeValueAsString(map1); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | // todo 重写一套登录鉴权 |
| | | sysUserClient.pushAll(message1, "1",SecurityConstants.INNER); |
| | | if (true){ |
| | | return R.ok(); |
| | | } |
| | | LambdaQueryWrapper< SlVolumeProductionRk> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(SlVolumeProductionRk::getRkNumber,rkNumber); |
| | | wrapper1.eq(SlVolumeProductionRk::getDelFlag,"0"); |
| | | wrapper1.orderByDesc(SlVolumeProductionRk::getCreateTime); |
| | | SlVolumeProductionRk page2 = slVolumeProductionRkMapper.selectOne(wrapper1); |
| | | List<SlEquipment> slEquipments = slEquipmentMapper.selectList(new QueryWrapper<SlEquipment>() |
| | | .eq("management_id", page2.getManagementId()) |
| | | .eq("del_flag", "0") |
| | | .eq("type", 2)); |
| | | SlEquipment slEquipment1 = slEquipmentMapper.selectOne(new QueryWrapper<SlEquipment>() |
| | | .eq("equipment_num", code) |
| | | .eq("del_flag", "0") |
| | | .eq("type", 2)); |
| | | // if (slEquipments.isEmpty()){ |
| | | // // 这个仓库没有扫码枪 |
| | | // sysUserClient.pushAll("501", SecurityConstants.INNER); |
| | | // return R.ok(); |
| | | // } |
| | | // // 判断当前扫码枪编号是否匹配于入库记录使用的扫码枪编号 |
| | | // for (SlEquipment slEquipment : slEquipments) { |
| | | // if (!slEquipment.getEquipmentNum().equals(code)){ |
| | | // // 扫码枪 |
| | | // sysUserClient.pushAll("501", SecurityConstants.INNER); |
| | | // return R.ok(); |
| | | // } |
| | | // } |
| | | // if (page2.getSmerwmNum()<page2.getErwmNum()){ |
| | | // Integer i=page2.getSmerwmNum()+1; |
| | | // page2.setSmerwmNum(i); |
| | |
| | | slVolumeProductionRkVO.setId(page2.getId().toString()); |
| | | // slVolumeProductionRkVO.setVolumeProductionRkglId(page2.getVolumeProductionRkglId().toString()); |
| | | slVolumeProductionRkVO.setMaterialsId(page2.getMaterialsId().toString()); |
| | | slVolumeProductionRkVO.setManagementId(page2.getManagementId().toString()); |
| | | slVolumeProductionRkVO.setManagementId(slEquipment1.getManagementId().toString()); |
| | | slVolumeProductionRkVO.setShelfId(page2.getShelfId().toString()); |
| | | slVolumeProductionRkVO.setIsError("0"); |
| | | String msg = null; |
| | | |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.SCANCODES); |
| | | map.put("SlVolumeProductionRk",slVolumeProductionRkVO); |
| | | String msg = null; |
| | | Long managementId = slEquipment1.getManagementId(); |
| | | Long managementId1 = page2.getManagementId(); |
| | | if (!managementId.equals(managementId1)){ |
| | | // 二维码错误 |
| | | try { |
| | | slVolumeProductionRkVO.setIsError("1"); |
| | | map.put("SlVolumeProductionRk",slVolumeProductionRkVO); |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | // todo 重写一套登录鉴权 |
| | | sysUserClient.pushAll(msg, "1",SecurityConstants.INNER); |
| | | // 扫码枪 |
| | | return R.ok(); |
| | | }else{ |
| | | map.put("SlVolumeProductionRk",slVolumeProductionRkVO); |
| | | } |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | sysUserClient.pushAll(msg, SecurityConstants.INNER); |
| | | // todo 重写一套登录鉴权 |
| | | sysUserClient.pushAll(msg, "1",SecurityConstants.INNER); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |