| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | |
| | | if (!basStation.getUseStatus().equals("O")){ |
| | | throw new CoolException("站点状态不为空闲"); |
| | | } |
| | | Object parse = JSONArray.parse(basStation.getContainerType()); |
| | | List<BasContainer> containers = basContainerService.list( |
| | | new LambdaQueryWrapper<BasContainer>() |
| | | .in(BasContainer::getContainerType, parse) |
| | | ); |
| | | boolean matches = containers.stream() |
| | | .map(BasContainer::getCodeType) |
| | | .anyMatch(codeType -> barcode.matches(codeType)); |
| | | if (!matches) { |
| | | throw new CoolException("条码与站点不匹配"); |
| | | if (!Cools.isEmpty(basStation.getContainerType())){ |
| | | List<Long> longs1 = JSONObject.parseArray(basStation.getContainerType(), Long.class); |
| | | List<BasContainer> containers = basContainerService.list( |
| | | new LambdaQueryWrapper<BasContainer>() |
| | | .in(BasContainer::getContainerType, longs1) |
| | | ); |
| | | boolean matches = containers.stream() |
| | | .map(BasContainer::getCodeType) |
| | | .anyMatch(codeType -> barcode.matches(codeType)); |
| | | if (!matches) { |
| | | throw new CoolException("条码与站点不匹配"); |
| | | } |
| | | } |
| | | |
| | | return basStation; |
| | | } |
| | | } |