提交 a9b8fa09 authored 作者: 邓砥奕's avatar 邓砥奕

更新

上级 41be1d16
...@@ -8,9 +8,7 @@ import com.tykj.dev.device.packing.repository.PackingLibraryDao; ...@@ -8,9 +8,7 @@ import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.packing.service.PackingLibraryService; import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary; import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.packing.subject.vo.*; import com.tykj.dev.device.packing.subject.vo.*;
import com.tykj.dev.misc.utils.GetTreeUtils; import com.tykj.dev.misc.utils.*;
import com.tykj.dev.misc.utils.PageUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -47,9 +45,20 @@ public class PackingLibraryController { ...@@ -47,9 +45,20 @@ public class PackingLibraryController {
@Autowired @Autowired
PackingLibraryDao packingLibraryDao; PackingLibraryDao packingLibraryDao;
@ApiOperation(value = "获取父子结构列装", notes = "获取父子结构列装") @ApiOperation(value = "申请后入库获取父子结构列装(去除已入库序列号)", notes = "获取父子结构列装")
@PostMapping("/merge") @PostMapping("/merge")
public ResponseEntity merge(@RequestBody List<PackingLibrary> packingLibraries){ public ResponseEntity merge(@RequestBody List<PackingLibrary> packingLibraries){
Map<String,DeviceLibrary> map = deviceLibraryService.getAllDeviceSeqMap();
packingLibraries.forEach(packingLibrary -> {
List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(packingLibrary.getSeq());
List<String> outputSeqs = new ArrayList<>();
inputSeqs.forEach(s -> {
if (map.get(s)==null){
outputSeqs.add(s);
}
});
packingLibrary.setSeq(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(outputSeqs)));
});
//返回父子结构 //返回父子结构
Map<Integer, PackingLibrary> nodeCollect = Map<Integer, PackingLibrary> nodeCollect =
packingLibraries.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibrary -> packingLibrary)); packingLibraries.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibrary -> packingLibrary));
......
...@@ -286,11 +286,11 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -286,11 +286,11 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
public void deleteAll(Integer id) { public void deleteAll(Integer id) {
PackingLibrary packingLibrary = getOne(id); PackingLibrary packingLibrary = getOne(id);
if (deviceLibraryDao.getAllByPackingId(id).size()>0){ if (deviceLibraryDao.getAllByPackingId(id).size()>0){
throw new ApiException(ResponseEntity.status(303).body("该列装型号已有装备,请进行退装操作")); throw new ApiException(ResponseEntity.status(20000).body("该列装型号已有装备,请进行退装操作"));
} }
if (packingLibrary.getIsRoot()==1) { if (packingLibrary.getIsRoot()==1) {
if (packingLibraryDao.findAllByPartParentIdAndPackingStatus(id,2).size()>0){ if (packingLibraryDao.findAllByPartParentIdAndPackingStatus(id,2).size()>0){
throw new ApiException(ResponseEntity.status(303).body("该列装型号目录下存在列装装备")); throw new ApiException(ResponseEntity.status(20000).body("该列装型号目录下存在列装装备"));
} }
Integer order = packingLibrary.getShowOrder(); Integer order = packingLibrary.getShowOrder();
getInsertList(new SelectPack()).forEach(packingLibrary1 -> { getInsertList(new SelectPack()).forEach(packingLibrary1 -> {
...@@ -305,7 +305,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -305,7 +305,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
if (ids.size()>0){ if (ids.size()>0){
ids.forEach(integer -> { ids.forEach(integer -> {
if (deviceLibraryDao.getAllByPackingId(integer).size()>0){ if (deviceLibraryDao.getAllByPackingId(integer).size()>0){
throw new ApiException(ResponseEntity.status(303).body("该列装型号已有装备,请进行退装操作")); throw new ApiException(ResponseEntity.status(20000).body("该列装型号已有装备,请进行退装操作"));
} }
deleteAll(integer); deleteAll(integer);
}); });
...@@ -412,7 +412,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -412,7 +412,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
for (Script s:conList) { for (Script s:conList) {
addScript(scriptList,s); addScript(scriptList,s);
} }
return scriptList; return scriptList.stream().sorted(Comparator.comparing(Script::getSeqNumber).reversed()).collect(Collectors.toList());
} }
@Override @Override
...@@ -453,7 +453,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -453,7 +453,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
addScript(scriptList,s); addScript(scriptList,s);
} }
scriptList.forEach(script -> script.setChilds(null)); scriptList.forEach(script -> script.setChilds(null));
return scriptList; return scriptList.stream().sorted(Comparator.comparing(Script::getSeqNumber).reversed()).collect(Collectors.toList());
} }
private void addScript(List<Script> scripts,Script script){ private void addScript(List<Script> scripts,Script script){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论