提交 8534fab8 authored 作者: zhoushaopan's avatar zhoushaopan

fix(装备模块): 修复了bug

修复了bug
上级 3573c833
...@@ -1220,7 +1220,8 @@ public class DeviceLibraryController { ...@@ -1220,7 +1220,8 @@ public class DeviceLibraryController {
@ApiOperation(value = "修改出库和入库(3D)",notes = "修改出库和入库") @ApiOperation(value = "修改出库和入库(3D)",notes = "修改出库和入库")
public ResponseEntity<String> fnModifyWarehouseLocationsInBatches(@RequestBody UpdateStorageLocationVo updateStorageLocationVo){ public ResponseEntity<String> fnModifyWarehouseLocationsInBatches(@RequestBody UpdateStorageLocationVo updateStorageLocationVo){
deviceLibraryService.updateStorageLocation(updateStorageLocationVo); deviceLibraryService.updateStorageLocation(updateStorageLocationVo);
String s = updateStorageLocationVo.getStorageLocationId() != null ? "入库成功" : "出库成功" ; String s = updateStorageLocationVo.getStorageLocationId() !=null ?"入库成功":"出库成功";
return ResponseEntity.ok(s); return ResponseEntity.ok(s);
} }
......
...@@ -248,6 +248,12 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>, ...@@ -248,6 +248,12 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
int updateStorageLocation( @Param("storageLocation") String storageLocation,@Param("storageLocationId") Integer storageLocationId, int updateStorageLocation( @Param("storageLocation") String storageLocation,@Param("storageLocationId") Integer storageLocationId,
@Param("deviceIds") List<Integer> deviceIds); @Param("deviceIds") List<Integer> deviceIds);
// @Transactional
// @Modifying
// @Query("update DeviceLibrary o set o.storageLocation = :storageLocation,o.storageLocationId = :storageLocationId where o.id in :deviceIds")
// int updateStorageLocation( @Param("storageLocation") String storageLocation,@Param("storageLocationId") Integer storageLocationId,
// @Param("deviceIds") List<Integer> deviceIds);
@Transactional @Transactional
@Modifying @Modifying
......
...@@ -30,5 +30,14 @@ public interface DeviceLibraryPositionDao extends JpaRepository<DeviceLibraryPos ...@@ -30,5 +30,14 @@ public interface DeviceLibraryPositionDao extends JpaRepository<DeviceLibraryPos
@Param("uNum") String uNum, @Param("uNum") String uNum,
@Param("deviceId")Integer deviceId); @Param("deviceId")Integer deviceId);
@Transactional
@Modifying
@Query("update DeviceLibraryPosition d set d.deviceLibraryPositionMessage = :deviceLibraryPositionMessage, " +
"d.rotation = :rotation,d.uNum = :uNum ,d.cabinetPosition = null ,d.ifCabinet =0 where d.deviceId in :deviceIds")
int fnUpdatePostionMessageList(@Param("deviceLibraryPositionMessage") String deviceLibraryPositionMessage,
@Param("rotation") String rotation,
@Param("uNum") String uNum,
@Param("deviceIds")List<Integer> deviceIds);
} }
...@@ -67,7 +67,6 @@ public interface DeviceLibraryPositionService { ...@@ -67,7 +67,6 @@ public interface DeviceLibraryPositionService {
*/ */
void fnUpdatePostionMessage(List<UpdatePostionMessageVO> updatePostionMessageVO); void fnUpdatePostionMessage(List<UpdatePostionMessageVO> updatePostionMessageVO);
void fnUpdatePostionMessageList(UpdatePostionMessageVO updatePostionMessageVO);
} }
...@@ -564,4 +564,5 @@ public interface DeviceLibraryService { ...@@ -564,4 +564,5 @@ public interface DeviceLibraryService {
*/ */
Map<String,Object> fnConditionQuery(QueryTheWarehouseVo queryTheWarehouseVo); Map<String,Object> fnConditionQuery(QueryTheWarehouseVo queryTheWarehouseVo);
} }
...@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
/** /**
* @author zsp * @author zsp
...@@ -76,4 +77,12 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe ...@@ -76,4 +77,12 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe
} }
} }
@Override
public void fnUpdatePostionMessageList(UpdatePostionMessageVO updatePostionMessageVO) {
List<Integer> deviceIds = updatePostionMessageVO.getDeviceIds();
String json = updatePostionMessageVO.getDeviceLibraryPositionMessageVo().toJson();
String json1 = updatePostionMessageVO.getRotationVo().toJson();
deviceLibraryPositionDao.fnUpdatePostionMessageList(json, json1,updatePostionMessageVO.getUNum(), deviceIds);
}
} }
...@@ -19,6 +19,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary; ...@@ -19,6 +19,7 @@ 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.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.vo.*; import com.tykj.dev.device.library.subject.vo.*;
import com.tykj.dev.device.library.utils.DeviceNumberUtils; import com.tykj.dev.device.library.utils.DeviceNumberUtils;
import com.tykj.dev.device.user.cache.UnitsCache; import com.tykj.dev.device.user.cache.UnitsCache;
...@@ -1175,37 +1176,48 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1175,37 +1176,48 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
} }
@Override @Override
@UpdateCache @UpdateCache
public void updateStorageLocation(UpdateStorageLocationVo updateStorageLocationVo) { public void updateStorageLocation(UpdateStorageLocationVo updateStorageLocationVo) {
List<Integer> deviceIds = updateStorageLocationVo.getDeviceIds(); List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
Integer userId = userUtils.getCurrentUserId(); List<Integer> deviceIds = updateStorageLocationVo.getDeviceIds();
List<DeviceLogDto> deviceLogDtos = new ArrayList<>(); Integer userId = userUtils.getCurrentUserId();
if (!CollectionUtils.isEmpty(deviceIds)){ if (!CollectionUtils.isEmpty(deviceIds)){
//添加装备日志 //添加装备日志
deviceIds.forEach(integer -> { deviceIds.forEach(integer -> {
// if (updateStorageLocationVo.getStorageLocationId() != (getOne(integer).getStorageLocationId())){ // if (updateStorageLocationVo.getStorageLocationId() != (getOne(integer).getStorageLocationId())){
// DeviceLogDto deviceLogDto= new DeviceLogDto(integer,"将存放位置修改为"+ // DeviceLogDto deviceLogDto= new DeviceLogDto(integer,"将存放位置修改为"+
// updateStorageLocationVo.getStorageLocation(),null,userId); // updateStorageLocationVo.getStorageLocation(),null,userId);
// deviceLogDtos.add(deviceLogDto); // deviceLogDtos.add(deviceLogDto);
// }}); // }});
Integer storageLocationId = updateStorageLocationVo.getStorageLocationId(); Integer storageLocationId = updateStorageLocationVo.getStorageLocationId();
Integer dataStorageLocationId = getOne(integer).getStorageLocationId(); Integer dataStorageLocationId = getOne(integer).getStorageLocationId();
if (storageLocationId == null ? dataStorageLocationId == null : storageLocationId.equals(dataStorageLocationId)){ if (storageLocationId == null ? dataStorageLocationId == null : storageLocationId.equals(dataStorageLocationId)){
DeviceLogDto deviceLogDto= new DeviceLogDto(integer,"将存放位置修改为"+ DeviceLogDto deviceLogDto= new DeviceLogDto(integer,"将存放位置修改为"+
updateStorageLocationVo.getStorageLocation(),null,userId); updateStorageLocationVo.getStorageLocation(),null,userId);
deviceLogDtos.add(deviceLogDto); deviceLogDtos.add(deviceLogDto);
}}); }});
deviceLibraryDao.updateStorageLocation(updateStorageLocationVo.getStorageLocation(),
updateStorageLocationVo.getStorageLocationId(),deviceIds); }else {
}else { throw new ApiException("请选择要修改的装备");
throw new ApiException("请选择要修改的装备"); }
} deviceLibraryDao.updateStorageLocation(updateStorageLocationVo.getStorageLocation(),
updateStorageLocationVo.getStorageLocationId(),updateStorageLocationVo.getDeviceIds());
//修改3d的部分字段
DeviceLibraryPositionMessageVo deviceLibraryPositionMessageVo = new DeviceLibraryPositionMessageVo();
UpdatePostionMessageVO updatePostionMessageVO = new UpdatePostionMessageVO();
updatePostionMessageVO.setDeviceLibraryPositionMessageVo(deviceLibraryPositionMessageVo);
RotationVo rotationVo = new RotationVo();
updatePostionMessageVO.setRotationVo(rotationVo);
updatePostionMessageVO.setDeviceIds(updateStorageLocationVo.getDeviceIds());
updatePostionMessageVO.setUNum(null);
deviceLibraryPositionService.fnUpdatePostionMessageList(updatePostionMessageVO);
CompletableFuture.runAsync(()->{ CompletableFuture.runAsync(()->{
deviceLogService.addAllLog(deviceLogDtos); deviceLogService.addAllLog(deviceLogDtos);
}); });
// deviceLibraryPositionService.batchUpdateStorageLocation(updateStorageLocationVo.getStorageLocationId(),
// updateStorageLocationVo.getStorageLocation(),deviceIds);
} }
......
package com.tykj.dev.device.library.subject.model.vo; package com.tykj.dev.device.library.subject.model.vo;
import com.tykj.dev.device.library.subject.vo.DeviceLibraryPositionMessageVo; import com.tykj.dev.device.library.subject.vo.DeviceLibraryPositionMessageVo;
import com.tykj.dev.device.library.subject.vo.RotationVo;
import com.tykj.dev.misc.base.CustomPage; import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @author zsp * @author zsp
* @create 2022/1/8 13:14 * @create 2022/1/8 13:14
...@@ -20,7 +23,11 @@ public class UpdatePostionMessageVO extends CustomPage { ...@@ -20,7 +23,11 @@ public class UpdatePostionMessageVO extends CustomPage {
@ApiModelProperty(value = "位置类vo", example = "1") @ApiModelProperty(value = "位置类vo", example = "1")
private DeviceLibraryPositionMessageVo deviceLibraryPositionMessageVo; private DeviceLibraryPositionMessageVo deviceLibraryPositionMessageVo;
private RotationVo rotationVo;
@ApiModelProperty(value = "u位",notes = "1-1") @ApiModelProperty(value = "u位",notes = "1-1")
private String uNum; private String uNum;
@ApiModelProperty(value = "装备id的集合")
private List<Integer> deviceIds;
} }
...@@ -24,4 +24,5 @@ public class UpdateStorageLocationVo { ...@@ -24,4 +24,5 @@ public class UpdateStorageLocationVo {
@ApiModelProperty(value = "要修改的库房位置id") @ApiModelProperty(value = "要修改的库房位置id")
private Integer storageLocationId; private Integer storageLocationId;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论