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

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

修复了bug
上级 3573c833
......@@ -1220,7 +1220,8 @@ public class DeviceLibraryController {
@ApiOperation(value = "修改出库和入库(3D)",notes = "修改出库和入库")
public ResponseEntity<String> fnModifyWarehouseLocationsInBatches(@RequestBody UpdateStorageLocationVo updateStorageLocationVo){
deviceLibraryService.updateStorageLocation(updateStorageLocationVo);
String s = updateStorageLocationVo.getStorageLocationId() != null ? "入库成功" : "出库成功" ;
String s = updateStorageLocationVo.getStorageLocationId() !=null ?"入库成功":"出库成功";
return ResponseEntity.ok(s);
}
......
......@@ -248,6 +248,12 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
int updateStorageLocation( @Param("storageLocation") String storageLocation,@Param("storageLocationId") Integer storageLocationId,
@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
@Modifying
......
......@@ -30,5 +30,14 @@ public interface DeviceLibraryPositionDao extends JpaRepository<DeviceLibraryPos
@Param("uNum") String uNum,
@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 {
*/
void fnUpdatePostionMessage(List<UpdatePostionMessageVO> updatePostionMessageVO);
void fnUpdatePostionMessageList(UpdatePostionMessageVO updatePostionMessageVO);
}
......@@ -564,4 +564,5 @@ public interface DeviceLibraryService {
*/
Map<String,Object> fnConditionQuery(QueryTheWarehouseVo queryTheWarehouseVo);
}
......@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @author zsp
......@@ -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;
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.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.utils.DeviceNumberUtils;
import com.tykj.dev.device.user.cache.UnitsCache;
......@@ -1175,12 +1176,13 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
}
@Override
@UpdateCache
public void updateStorageLocation(UpdateStorageLocationVo updateStorageLocationVo) {
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
List<Integer> deviceIds = updateStorageLocationVo.getDeviceIds();
Integer userId = userUtils.getCurrentUserId();
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
if (!CollectionUtils.isEmpty(deviceIds)){
//添加装备日志
deviceIds.forEach(integer -> {
......@@ -1196,16 +1198,26 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
updateStorageLocationVo.getStorageLocation(),null,userId);
deviceLogDtos.add(deviceLogDto);
}});
deviceLibraryDao.updateStorageLocation(updateStorageLocationVo.getStorageLocation(),
updateStorageLocationVo.getStorageLocationId(),deviceIds);
}else {
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(()->{
deviceLogService.addAllLog(deviceLogDtos);
});
// deviceLibraryPositionService.batchUpdateStorageLocation(updateStorageLocationVo.getStorageLocationId(),
// updateStorageLocationVo.getStorageLocation(),deviceIds);
}
......
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.RotationVo;
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 2022/1/8 13:14
......@@ -20,7 +23,11 @@ public class UpdatePostionMessageVO extends CustomPage {
@ApiModelProperty(value = "位置类vo", example = "1")
private DeviceLibraryPositionMessageVo deviceLibraryPositionMessageVo;
private RotationVo rotationVo;
@ApiModelProperty(value = "u位",notes = "1-1")
private String uNum;
@ApiModelProperty(value = "装备id的集合")
private List<Integer> deviceIds;
}
......@@ -24,4 +24,5 @@ public class UpdateStorageLocationVo {
@ApiModelProperty(value = "要修改的库房位置id")
private Integer storageLocationId;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论