提交 97e3b5af authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备模块,3D模块): 新增修改存放位置的接口

新增修改存放位置的接口
上级 06d4ee51
...@@ -9,6 +9,7 @@ import com.tykj.dev.device.allot.subject.domin.AllotBill; ...@@ -9,6 +9,7 @@ import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.allot.subject.vo.*; import com.tykj.dev.device.allot.subject.vo.*;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryPositionService;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService; import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
...@@ -51,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -51,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -115,7 +117,7 @@ public class AllotBillController { ...@@ -115,7 +117,7 @@ public class AllotBillController {
@Autowired @Autowired
private UserPublicService userService; private UserPublicService userService;
@Autowired @Resource
private ConfigCache configCache; private ConfigCache configCache;
@Autowired @Autowired
...@@ -130,9 +132,12 @@ public class AllotBillController { ...@@ -130,9 +132,12 @@ public class AllotBillController {
@Autowired @Autowired
private PackingController packingController; private PackingController packingController;
@Autowired @Resource
private UnitsCache unitsCache; private UnitsCache unitsCache;
@Resource
private DeviceLibraryPositionService deviceLibraryPositionService;
@ApiOperation(value = "导入二维码获取配发装备", notes = "可以通过这个接口导入二维码获取配发装备") @ApiOperation(value = "导入二维码获取配发装备", notes = "可以通过这个接口导入二维码获取配发装备")
@PostMapping(value = "/load") @PostMapping(value = "/load")
public ResponseEntity loadDevice(@RequestBody RfidVo rfidVo) { public ResponseEntity loadDevice(@RequestBody RfidVo rfidVo) {
...@@ -488,6 +493,7 @@ public class AllotBillController { ...@@ -488,6 +493,7 @@ public class AllotBillController {
//分隔装备id信息 //分隔装备id信息
String deviceIdDetail = allotReceiveVo.getReceiveCheckDetail(); String deviceIdDetail = allotReceiveVo.getReceiveCheckDetail();
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
List<Integer> deviceIds = new ArrayList<>();
for (String s : strings) { for (String s : strings) {
if (s.length() >= 2) { if (s.length() >= 2) {
//接收无误 //接收无误
...@@ -500,6 +506,9 @@ public class AllotBillController { ...@@ -500,6 +506,9 @@ public class AllotBillController {
deviceLibraryEntity.setLifeStatus(2); deviceLibraryEntity.setLifeStatus(2);
deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName()); deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setManageStatus(1); deviceLibraryEntity.setManageStatus(1);
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
deviceIds.add(id);
//如果接收时填写了生产号 //如果接收时填写了生产号
if (allotReceiveVo.getMap().get(id) != null) { if (allotReceiveVo.getMap().get(id) != null) {
deviceLibraryEntity.setProdNumber(allotReceiveVo.getMap().get(id)); deviceLibraryEntity.setProdNumber(allotReceiveVo.getMap().get(id));
...@@ -526,9 +535,15 @@ public class AllotBillController { ...@@ -526,9 +535,15 @@ public class AllotBillController {
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList, taskBto.getId(), taskBto.getId()); DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList, taskBto.getId(), taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
deviceIds.add(id);
} }
} }
//修改3D的存放位置
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,deviceIds);
} }
//发送阅知信息 //发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userId); List<Integer> ids = userPublicService.findOtherUser(userId);
...@@ -880,8 +895,12 @@ public class AllotBillController { ...@@ -880,8 +895,12 @@ public class AllotBillController {
deviceLibrary.setLifeStatus(2); deviceLibrary.setLifeStatus(2);
deviceLibrary.setOwnUnit(allotBill.getReceiveUnit()); deviceLibrary.setOwnUnit(allotBill.getReceiveUnit());
deviceLibrary.setManageStatus(1); deviceLibrary.setManageStatus(1);
deviceLibrary.setStorageLocationId(null);
deviceLibrary.setStorageLocation(null);
deviceLibraryService.update(deviceLibrary); deviceLibraryService.update(deviceLibrary);
}); });
//修改3D的库房
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,ids);
//经办人阅知 //经办人阅知
// if (idList.size()>0) { // if (idList.size()>0) {
// MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1); // MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1);
......
...@@ -10,6 +10,7 @@ import com.tykj.dev.device.allot.subject.vo.AllotBackReceiveVo; ...@@ -10,6 +10,7 @@ import com.tykj.dev.device.allot.subject.vo.AllotBackReceiveVo;
import com.tykj.dev.device.allot.subject.vo.AllotBillSaveVo; import com.tykj.dev.device.allot.subject.vo.AllotBillSaveVo;
import com.tykj.dev.device.allot.subject.vo.FileUploadVo; import com.tykj.dev.device.allot.subject.vo.FileUploadVo;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.service.DeviceLibraryPositionService;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService; import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
...@@ -45,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -45,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -94,9 +96,12 @@ public class BackController { ...@@ -94,9 +96,12 @@ public class BackController {
@Autowired @Autowired
private UnitsService unitsService; private UnitsService unitsService;
@Autowired @Resource
private UnitsCache unitsCache; private UnitsCache unitsCache;
@Resource
private DeviceLibraryPositionService deviceLibraryPositionService;
@ApiOperation(value = "发起退回业务", notes = "可以通过这个接口发起退回任务") @ApiOperation(value = "发起退回业务", notes = "可以通过这个接口发起退回任务")
@PostMapping(value = "/addBackBill") @PostMapping(value = "/addBackBill")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -308,6 +313,7 @@ public class BackController { ...@@ -308,6 +313,7 @@ public class BackController {
//分隔装备id信息 //分隔装备id信息
String deviceIdDetail = allotBackReceiveVo.getReceiveCheckDetail(); String deviceIdDetail = allotBackReceiveVo.getReceiveCheckDetail();
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
List<Integer> deviceIds = new ArrayList<>();
for (String s : strings) { for (String s : strings) {
if (s.length() >= 2) { if (s.length() >= 2) {
//接收无误 //接收无误
...@@ -320,6 +326,8 @@ public class BackController { ...@@ -320,6 +326,8 @@ public class BackController {
deviceLibraryEntity.setLifeStatus(2); deviceLibraryEntity.setLifeStatus(2);
deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName()); deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setManageStatus(1); deviceLibraryEntity.setManageStatus(1);
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
//判断是签字入库还是签章入库 //判断是签字入库还是签章入库
DeviceLogDto deviceLogDto = new DeviceLogDto(); DeviceLogDto deviceLogDto = new DeviceLogDto();
if (allotBackReceiveVo.getRightSignatureId()!=null&&!"".equals(allotBackReceiveVo.getRightSignatureId())) { if (allotBackReceiveVo.getRightSignatureId()!=null&&!"".equals(allotBackReceiveVo.getRightSignatureId())) {
...@@ -332,6 +340,7 @@ public class BackController { ...@@ -332,6 +340,7 @@ public class BackController {
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
deviceIds.add(id);
} }
//接收缺失 //接收缺失
if ("0".equals(s.substring(s.length() - 1))) { if ("0".equals(s.substring(s.length() - 1))) {
...@@ -339,14 +348,19 @@ public class BackController { ...@@ -339,14 +348,19 @@ public class BackController {
//改变装备状态 //改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(11); deviceLibraryEntity.setLifeStatus(11);
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
//存装备日志 //存装备日志
// DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList,taskBto.getId(),null); // DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList,taskBto.getId(),taskBto.getId()); DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList,taskBto.getId(),taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
deviceIds.add(id);
} }
} }
} }
//修改3D
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,deviceIds);
//发送阅知信息 //发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userId); List<Integer> ids = userPublicService.findOtherUser(userId);
// ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBackBill.getSendUnit())).stream() // ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBackBill.getSendUnit())).stream()
...@@ -512,8 +526,13 @@ public class BackController { ...@@ -512,8 +526,13 @@ public class BackController {
deviceLibrary.setLifeStatus(2); deviceLibrary.setLifeStatus(2);
deviceLibrary.setOwnUnit(allotBackBill.getReceiveUnit()); deviceLibrary.setOwnUnit(allotBackBill.getReceiveUnit());
deviceLibrary.setManageStatus(1); deviceLibrary.setManageStatus(1);
deviceLibrary.setStorageLocationId(null);
deviceLibrary.setStorageLocation(null);
deviceLibraryService.update(deviceLibrary); deviceLibraryService.update(deviceLibrary);
}); });
//修改3D
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,ids);
//经办人阅知 //经办人阅知
// if (idList.size()>0) { // if (idList.size()>0) {
// MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1); // MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1);
......
...@@ -8,6 +8,7 @@ import io.swagger.annotations.Api; ...@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
...@@ -26,6 +27,7 @@ public class DeviceLibraryPositionController { ...@@ -26,6 +27,7 @@ public class DeviceLibraryPositionController {
@Resource @Resource
private DeviceLibraryPositionService deviceLibraryPositionService; private DeviceLibraryPositionService deviceLibraryPositionService;
@Transactional(rollbackFor = Exception.class)
@GetMapping("/findByStorageLocationId") @GetMapping("/findByStorageLocationId")
@ApiOperation(value = "根据当前库房位置查询装备") @ApiOperation(value = "根据当前库房位置查询装备")
public ResponseEntity<Map<String, Object>> findByStorageLocationId(@RequestBody QueryTheWarehouseVo queryTheWarehouseVo){ public ResponseEntity<Map<String, Object>> findByStorageLocationId(@RequestBody QueryTheWarehouseVo queryTheWarehouseVo){
...@@ -33,6 +35,7 @@ public class DeviceLibraryPositionController { ...@@ -33,6 +35,7 @@ public class DeviceLibraryPositionController {
return ResponseEntity.ok(map); return ResponseEntity.ok(map);
} }
@Transactional(rollbackFor = Exception.class)
@PostMapping("/updateDeviceLibraryPosition") @PostMapping("/updateDeviceLibraryPosition")
@ApiOperation(value = "修改3D") @ApiOperation(value = "修改3D")
public ResponseEntity<String> updateDeviceLibraryPosition(@RequestBody DeviceLibraryPosition deviceLibraryPosition){ public ResponseEntity<String> updateDeviceLibraryPosition(@RequestBody DeviceLibraryPosition deviceLibraryPosition){
...@@ -51,6 +54,7 @@ public class DeviceLibraryPositionController { ...@@ -51,6 +54,7 @@ public class DeviceLibraryPositionController {
return ResponseEntity.ok(deviceLibraryPosition); return ResponseEntity.ok(deviceLibraryPosition);
} }
@Transactional(rollbackFor = Exception.class)
@GetMapping("/delete") @GetMapping("/delete")
@ApiOperation(value = "根据id删除") @ApiOperation(value = "根据id删除")
public ResponseEntity<String> deleteByPosition(Integer id){ public ResponseEntity<String> deleteByPosition(Integer id){
......
...@@ -24,7 +24,7 @@ public interface DeviceLibraryPositionDao extends JpaRepository<DeviceLibraryPos ...@@ -24,7 +24,7 @@ public interface DeviceLibraryPositionDao extends JpaRepository<DeviceLibraryPos
DeviceLibraryPosition findByDeviceId(Integer deviceId); DeviceLibraryPosition findByDeviceId(Integer deviceId);
DeviceLibraryPosition findAllByDeviceIdIn(List<Integer> deviceIds); List<DeviceLibraryPosition> findAllByDeviceIdIn(List<Integer> deviceIds);
List<DeviceLibraryPosition> findAllByModel(String model); List<DeviceLibraryPosition> findAllByModel(String model);
......
...@@ -28,7 +28,7 @@ public interface DeviceLibraryPositionService { ...@@ -28,7 +28,7 @@ public interface DeviceLibraryPositionService {
DeviceLibraryPosition findByDeviceId(Integer deviceId); DeviceLibraryPosition findByDeviceId(Integer deviceId);
DeviceLibraryPosition findByDeviceIds(List<Integer> deviceIds); List<DeviceLibraryPosition> findByDeviceIds(List<Integer> deviceIds);
/** /**
* 根据装备id修改库房位置 * 根据装备id修改库房位置
......
...@@ -12,6 +12,7 @@ import com.tykj.dev.device.library.subject.model.vo.QueryTheWarehouseVo; ...@@ -12,6 +12,7 @@ import com.tykj.dev.device.library.subject.model.vo.QueryTheWarehouseVo;
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.device.library.subject.vo.RotationVo;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.PageUtil; import com.tykj.dev.misc.utils.PageUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -52,7 +53,6 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe ...@@ -52,7 +53,6 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe
@Override @Override
public List<DeviceLibraryPosition> findByStorageLocationId(Integer StorageLocationId) { public List<DeviceLibraryPosition> findByStorageLocationId(Integer StorageLocationId) {
return deviceLibraryPositionDao.findAllByStorageLocationId(StorageLocationId); return deviceLibraryPositionDao.findAllByStorageLocationId(StorageLocationId);
} }
@Override @Override
...@@ -81,15 +81,13 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe ...@@ -81,15 +81,13 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe
} }
@Override @Override
public DeviceLibraryPosition findByDeviceIds(List<Integer> deviceIds) { public List<DeviceLibraryPosition> findByDeviceIds(List<Integer> deviceIds) {
return deviceLibraryPositionDao.findAllByDeviceIdIn(deviceIds); return deviceLibraryPositionDao.findAllByDeviceIdIn(deviceIds);
} }
@Override @Override
public void onlyUpdateStorageLocation(Integer StorageLocationId, String StorageLocation,Integer deviceId) { public void onlyUpdateStorageLocation(Integer StorageLocationId, String StorageLocation, Integer deviceId) {
if (findByDeviceId(deviceId)!=null){ deviceLibraryPositionDao.onlyUpdateStorageLocation(StorageLocationId, StorageLocation, deviceId);
deviceLibraryPositionDao.onlyUpdateStorageLocation(StorageLocationId,StorageLocation,deviceId);
}
} }
@Override @Override
...@@ -99,7 +97,7 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe ...@@ -99,7 +97,7 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe
@Override @Override
public void batchUpdateStorageLocation(Integer StorageLocationId, String StorageLocation, List<Integer> deviceIds) { public void batchUpdateStorageLocation(Integer StorageLocationId, String StorageLocation, List<Integer> deviceIds) {
deviceLibraryPositionDao.batchUpdateStorageLocation(StorageLocationId,StorageLocation,deviceIds); deviceLibraryPositionDao.batchUpdateStorageLocation(StorageLocationId, StorageLocation, deviceIds);
} }
@Override @Override
...@@ -133,25 +131,18 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe ...@@ -133,25 +131,18 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe
} }
@Override @Override
public void updateModelByOldModel(String oldModel,String newModel) { public void updateModelByOldModel(String oldModel, String newModel) {
List<DeviceLibraryPosition> libraryPositions = findByModel(oldModel); deviceLibraryPositionDao.updateModelByOldModel(oldModel, newModel);
if (!libraryPositions.isEmpty()){
deviceLibraryPositionDao.updateModelByOldModel(oldModel,newModel);
}
} }
@Override @Override
public void updateName(String name, Integer deviceId) { public void updateName(String name, Integer deviceId) {
if (findByDeviceId(deviceId)!=null){ deviceLibraryPositionDao.updateName(name, deviceId);
deviceLibraryPositionDao.updateName(name,deviceId);
}
} }
@Override @Override
public void updateSeqNumber(String seqNumber, Integer deviceId) { public void updateSeqNumber(String seqNumber, Integer deviceId) {
if (findByDeviceId(deviceId)!=null){ deviceLibraryPositionDao.updateSeqNumber(seqNumber, deviceId);
deviceLibraryPositionDao.updateSeqNumber(seqNumber,deviceId);
}
} }
@Override @Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论