提交 84f9df39 authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备模块): 新增了查询未上架的装备

新增了查询未上架的装备
上级 c074b818
...@@ -12,6 +12,7 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; ...@@ -12,6 +12,7 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition; import com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition;
import com.tykj.dev.device.library.subject.domin.DeviceLog; import com.tykj.dev.device.library.subject.domin.DeviceLog;
import com.tykj.dev.device.library.subject.model.vo.QueryNotOnVo;
import com.tykj.dev.device.library.subject.model.vo.QueryTheWarehouseVo; import com.tykj.dev.device.library.subject.model.vo.QueryTheWarehouseVo;
import com.tykj.dev.device.library.subject.vo.*; import com.tykj.dev.device.library.subject.vo.*;
import com.tykj.dev.device.user.cache.StoreCache; import com.tykj.dev.device.user.cache.StoreCache;
...@@ -1257,6 +1258,14 @@ public class DeviceLibraryController { ...@@ -1257,6 +1258,14 @@ public class DeviceLibraryController {
return ResponseEntity.ok(map); return ResponseEntity.ok(map);
} }
@Transactional(rollbackFor = Exception.class)
@PostMapping("/fnNotOnDeviceQuery")
@ApiOperation(value = "查询未上架的装备",notes = "查询未上架的装备")
public ResponseEntity<Map<String, Object>> fnNotOnDeviceQuery(@RequestBody QueryNotOnVo queryNotOnVo){
Map<String, Object> map = deviceLibraryService.fnNotOnDeviceQuery(queryNotOnVo);
return ResponseEntity.ok(map);
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@PostMapping("/fnModifyWarehouseLocationsInBatches") @PostMapping("/fnModifyWarehouseLocationsInBatches")
@ApiOperation(value = "修改出库和入库(3D)",notes = "修改出库和入库") @ApiOperation(value = "修改出库和入库(3D)",notes = "修改出库和入库")
......
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.library.service; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.library.service;
import com.tykj.dev.config.UpdateCache; import com.tykj.dev.config.UpdateCache;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.model.vo.QueryNotOnVo;
import com.tykj.dev.device.library.subject.model.vo.QueryTheWarehouseVo; import com.tykj.dev.device.library.subject.model.vo.QueryTheWarehouseVo;
import com.tykj.dev.device.library.subject.vo.*; import com.tykj.dev.device.library.subject.vo.*;
import com.tykj.dev.device.user.util.DecryptMD5; import com.tykj.dev.device.user.util.DecryptMD5;
...@@ -564,6 +565,13 @@ public interface DeviceLibraryService { ...@@ -564,6 +565,13 @@ public interface DeviceLibraryService {
*/ */
Map<String,Object> fnConditionQuery(QueryTheWarehouseVo queryTheWarehouseVo); Map<String,Object> fnConditionQuery(QueryTheWarehouseVo queryTheWarehouseVo);
/**
* 查询为上架的商品
* @param queryNotOnVo 条件查询类
* @return
*/
Map<String,Object> fnNotOnDeviceQuery(QueryNotOnVo queryNotOnVo);
void batchUpdateDevicesByPackingIds(String newModel,List<Integer> packingIds); void batchUpdateDevicesByPackingIds(String newModel,List<Integer> packingIds);
void importData(); void importData();
......
...@@ -18,6 +18,7 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; ...@@ -18,6 +18,7 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition; import com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition;
import com.tykj.dev.device.library.subject.model.vo.AllVO; import com.tykj.dev.device.library.subject.model.vo.AllVO;
import com.tykj.dev.device.library.subject.model.vo.QueryNotOnVo;
import com.tykj.dev.device.library.subject.model.vo.QueryTheWarehouseVo; import com.tykj.dev.device.library.subject.model.vo.QueryTheWarehouseVo;
import com.tykj.dev.device.library.subject.model.vo.UpdatePostionMessageVO; import com.tykj.dev.device.library.subject.model.vo.UpdatePostionMessageVO;
import com.tykj.dev.device.library.subject.vo.*; import com.tykj.dev.device.library.subject.vo.*;
...@@ -1410,6 +1411,66 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1410,6 +1411,66 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return map; return map;
} }
@Override
public Map<String, Object> fnNotOnDeviceQuery(QueryNotOnVo queryNotOnVo) {
Map<String,Object> map = new HashMap<>();
DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
BeanUtils.copyProperties(queryNotOnVo,deviceLibrarySelectVo);
PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(deviceLibrarySelectVo);
List<Integer> deviceIds = queryNotOnVo.getDeviceIds();
//先查询未上架的装备
List<DeviceLibrary> allByIds = findAllByIds(deviceIds);
//根据构造器查询
List<DeviceLibrary> deviceLibraries = deviceLibraryDao.findAll(predicateBuilder.build());
//进行过滤
List<DeviceLibrary> deviceLibraryList =
allByIds.stream().filter(deviceLibraries::contains).collect(Collectors.toList());
deviceLibraryList.forEach(DeviceLibrary::setConfigName);
//3D位置的map
List<DeviceLibraryPosition> deviceLibraryPositionList = deviceLibraryPositionService.findAll();
deviceLibraryPositionList = deviceLibraryPositionList.stream().filter(deviceLibraryPosition -> deviceIds.contains(deviceLibraryPosition.getDeviceId()))
.collect(Collectors.toList());
Map<Integer, DeviceLibraryPosition> positionMap =
deviceLibraryPositionList.stream().collect(toMap(DeviceLibraryPosition::getDeviceId,
Function.identity()));
List<AllVO> allVOS = new ArrayList<>();
//开始遍历装备
deviceLibraryList.forEach(deviceLibrary -> {
AllVO allVO = new AllVO();
//开始赋值
allVO.setDeviceLibrary(deviceLibrary);
DeviceLibraryPosition deviceLibraryPosition = positionMap.getOrDefault(deviceLibrary.getId(),new DeviceLibraryPosition());
allVO.setDeviceLibraryPosition(deviceLibraryPosition);
allVOS.add(allVO);
});
List<AllVO> pageAllVo = new ArrayList<>(allVOS);
Page<AllVO> allVOPage = PageUtil.getPerPage(queryNotOnVo.getPage(),
queryNotOnVo.getSize(), pageAllVo, queryNotOnVo.getPageable());
List<DeviceLibrary> collect = pageAllVo.stream().map(AllVO::getDeviceLibrary).collect(Collectors.toList());
List<String> models =
collect.stream().map(DeviceLibrary::getModel).distinct().collect(Collectors.toList());
List<String> seqNumberList = collect.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
List<String> names =
collect.stream().map(DeviceLibrary::getName).distinct().collect(Collectors.toList());
List<String> ownUnits =
collect.stream().map(DeviceLibrary::getOwnUnit).distinct().collect(Collectors.toList());
List<Integer> storageLocationIds = collect.stream().map(DeviceLibrary::getStorageLocationId).distinct().collect(Collectors.toList());
Map<Integer, String> idMap = storeCache.getIdMap();
map.put("allVOPage",allVOPage);
map.put("models",models);
map.put("seqNumberList",seqNumberList);
map.put("names",names);
map.put("ownUnits",ownUnits);
map.put("storageLocation",storageLocationIds.stream().map(integer -> new StorageLocationVo(integer,idMap.getOrDefault(integer,null)))
.collect(Collectors.toList()));
return map;
}
// @Override // @Override
// @UpdateCache // @UpdateCache
// public int updatePartParentId(List<Integer> deviceIds) { // public int updatePartParentId(List<Integer> deviceIds) {
......
package com.tykj.dev.device.library.subject.model.vo;
import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
* @create 2021/12/30 13:05
*/
@Data
@ApiModel("未上架的装备查询类")
public class QueryNotOnVo extends CustomPage {
@ApiModelProperty(value = "型号", example = "bmxx")
public String model;
@ApiModelProperty(value = "名称", example = "BM-1")
public String name;
@ApiModelProperty(value = "装备序列号", example = "123-1")
public String seqNumber;
@ApiModelProperty(value = "装备ids")
private List<Integer> deviceIds;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论